Skip to content

Commit 93877db

Browse files
hyperpolymathclaude
andcommitted
feat: add panel checker module — bots can now invoke PCC
panel_checker.rs bridges gitbot-fleet with the Panel Contract Compiler: - PCC JSON output types (PccPanelResult, PccSummary, PccObligation) - run_pcc_verify() executes PCC binary and parses JSON - pcc_results_to_findings() converts PCC obligations to fleet Findings with correct rule IDs, severity mapping, fixability, and confidence - pcc_result_to_manifest() converts to PanelManifest for context tracking - 8 unit tests (28 total passing) scripts/run-panel-check.sh: shell wrapper for CI/fleet integration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bbac336 commit 93877db

3 files changed

Lines changed: 677 additions & 0 deletions

File tree

scripts/run-panel-check.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: PMPL-1.0-or-later
3+
# Run PCC verification as a gitbot-fleet bot check.
4+
# Called by fleet-coordinator.sh for repos that have a tools/pcc/ directory.
5+
#
6+
# Usage: run-panel-check.sh <repo-path> [bot-name] [output-dir]
7+
#
8+
# Arguments:
9+
# repo-path - Path to the repository containing tools/pcc/.
10+
# bot-name - Bot identity for logging (default: seambot).
11+
# output-dir - Directory for findings output (default: findings).
12+
#
13+
# Exit codes:
14+
# 0 - All panels are releasable (or no PCC binary found).
15+
# 1 - One or more panels are not releasable, or PCC produced no output.
16+
set -euo pipefail
17+
18+
REPO_PATH="${1:?Usage: run-panel-check.sh <repo-path>}"
19+
BOT_NAME="${2:-seambot}"
20+
OUTPUT_DIR="${3:-findings}"
21+
22+
echo "[${BOT_NAME}] Running panel verification on ${REPO_PATH}..."
23+
24+
# Find PCC binary — prefer release build, fall back to debug.
25+
PCC_BIN=""
26+
if [[ -x "${REPO_PATH}/tools/pcc/target/release/panll" ]]; then
27+
PCC_BIN="${REPO_PATH}/tools/pcc/target/release/panll"
28+
elif [[ -x "${REPO_PATH}/tools/pcc/target/debug/panll" ]]; then
29+
PCC_BIN="${REPO_PATH}/tools/pcc/target/debug/panll"
30+
else
31+
echo "[${BOT_NAME}] No PCC binary found, skipping panel check"
32+
exit 0
33+
fi
34+
35+
# Run PCC verify with JSON output.
36+
RESULT=$("${PCC_BIN}" panel verify --json --repo-root "${REPO_PATH}" 2>/dev/null || true)
37+
38+
if [[ -z "${RESULT}" ]]; then
39+
echo "[${BOT_NAME}] PCC returned empty output"
40+
exit 1
41+
fi
42+
43+
# Write findings to timestamped file with a "latest" symlink.
44+
REPO_NAME=$(basename "${REPO_PATH}")
45+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
46+
FINDINGS_DIR="${OUTPUT_DIR}/${REPO_NAME}"
47+
mkdir -p "${FINDINGS_DIR}"
48+
49+
echo "${RESULT}" | jq '.' > "${FINDINGS_DIR}/panel-check-${TIMESTAMP}.json"
50+
ln -sf "panel-check-${TIMESTAMP}.json" "${FINDINGS_DIR}/latest-panel-check.json"
51+
52+
# Summarise: count total panels and how many are releasable.
53+
TOTAL=$(echo "${RESULT}" | jq 'if type == "array" then length else 1 end')
54+
RELEASABLE=$(echo "${RESULT}" | jq 'if type == "array" then [.[] | select(.state == "releasable")] | length else (if .state == "releasable" then 1 else 0 end) end')
55+
56+
echo "[${BOT_NAME}] Panel check complete: ${RELEASABLE}/${TOTAL} releasable"
57+
58+
if [[ "${RELEASABLE}" -lt "${TOTAL}" ]]; then
59+
exit 1
60+
fi

shared-context/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub mod context;
4444
pub mod finding;
4545
pub mod health;
4646
pub mod panel;
47+
pub mod panel_checker;
4748
pub mod reporting;
4849
pub mod state;
4950
pub mod storage;
@@ -60,6 +61,10 @@ pub use panel::{
6061
pub use reporting::{FleetReport, ReportFormat};
6162
pub use state::{RepoState, SessionState};
6263
pub use storage::ContextStorage;
64+
pub use panel_checker::{
65+
PccObligation, PccPanelResult, PccSummary, find_pcc_binary, pcc_result_to_manifest,
66+
pcc_results_to_findings, run_pcc_verify,
67+
};
6368
pub use triangle::{ConfidenceThresholds, DispatchStrategy, TriangleTier};
6469

6570
use thiserror::Error;

0 commit comments

Comments
 (0)