chore: add local CI scripts, metrics gate, and pre-commit hook#144
chore: add local CI scripts, metrics gate, and pre-commit hook#144
Conversation
📊 Test Coverage Report
Coverage measured by |
📏 Metrics Gate ReportStatus: ✅ All gates passed Commit Size ❌
Bundle Size ✅
Perf Metrics E2E ✅
Command Perf (local) ✅
Local command timings
Command Perf (remote SSH) ✅
Remote command timings (via Docker SSH)
Home Page Render Probes (real IPC) ✅
Code Readability
|
📦 PR Build Artifacts
|
e7555b8 to
8de3904
Compare
📸 UI ScreenshotsCommit: Light Mode — Core Pages
Dark Mode
Responsive + Dialogs
|
Keith-CY
left a comment
There was a problem hiding this comment.
P1 tests/e2e/perf/ipc-bridge-server.mjs:76
The new "real IPC" bridge still fabricates a healthy runtime/status snapshot when the live gateway call fails. Both get_instance_runtime_snapshot() and get_status_light() await gatewayFetch("/api/status") and then ignore the result, returning healthy: true plus config-derived agents either way. src/lib/api.ts:89-94 shows those are exactly the Home reads being measured, and .github/workflows/metrics.yml:414-420 now treats any non-null snapshot as readiness. So this can still report green "real IPC" probe numbers without ever receiving a successful gateway-backed runtime response.
P1 scripts/ci-metrics.sh:13
The new local metrics/pre-commit path no longer matches the GitHub metrics gate this PR introduces. CI lowered the bundle cap to 350 KB in .github/workflows/metrics.yml:80-96, but scripts/ci-metrics.sh still uses BUNDLE_LIMIT_KB=512. The drift continues for perf metrics: src-tauri/tests/perf_metrics.rs:197-199 now emits cmd_*_us, while scripts/ci-metrics.sh:204-206 still parses cmd_*_ms, so the local script drops those numbers entirely instead of enforcing the same thresholds CI uses. That means scripts/pre-commit can go green on a branch that GitHub will still reject, which defeats the point of adding local CI parity.
dev01lay2
left a comment
There was a problem hiding this comment.
P1-2 fixed in 0a943c1: ci-metrics.sh now uses BUNDLE_LIMIT_KB=350 and parses cmd_*_us metrics, matching CI exactly.
P1-1 (ipc-bridge-server.mjs): This file is not modified by this PR — it comes from the develop merge commit. The fabricated-healthy-on-failure issue is a pre-existing bug in fix/home-probe-real-ipc (#141). Happy to fix it in a separate PR, but it's out of scope here.
Requesting re-review.
Keith-CY
left a comment
There was a problem hiding this comment.
P1 scripts/ci-metrics.sh:382
The follow-up fixed the 350 KB constant and the cmd_*_us parsing, but the local metrics script still does not enforce the same hard gates that the GitHub metrics workflow enforces locally-measurable inputs for. scripts/ci-metrics.sh only fails on three conditions: total bundle gzip pass/fail, perf_metrics test exit, and command_perf_e2e test exit. By contrast, .github/workflows/metrics.yml:486-494 also hard-fails when initial-load gzip exceeds 180 KB and when cmd_p50_us exceeds 1000. Those values are already computed and printed by scripts/ci-metrics.sh:347 and scripts/ci-metrics.sh:352, but they never affect hard_failures. So scripts/pre-commit can still go green on a branch that GitHub rejects, which is still a correctness gap for a PR whose stated goal is local CI parity.
Non-blocking: scripts/README.md:31 still documents the old <= 512 KB bundle cap, so the docs no longer match either the script or CI.
- Add initial-load gzip <= 180 KB hard gate (matches .github/workflows/metrics.yml:486) - Add cmd_p50 <= 1000 µs hard gate (matches .github/workflows/metrics.yml:493) - Update README bundle cap from 512 KB to 350 KB to match script and CI
|
P1 fixed in Requesting re-review. |
dev01lay2
left a comment
There was a problem hiding this comment.
Both issues addressed in 6691eef:
P1: Added hard-failure gates for initial-load gzip > 180 KB and cmd_p50_us > 1000 in scripts/ci-metrics.sh, matching the CI workflow thresholds exactly.
Non-blocking: Updated scripts/README.md to document the correct <= 350 KB bundle cap.
Requesting re-review.
Keith-CY
left a comment
There was a problem hiding this comment.
The remaining local CI parity blocker is fixed on this head. I do not see further blocking issues in the current scripts-only diff.

























Summary
Extract CI workflow steps into local scripts for fast iteration without pushing to GitHub.
New files (scripts/)
_common.shci-frontend.shci-rust.shci-metrics.shci-coverage.shci-all.shpre-commitinstall-hooks.shREADME.mdGate behavior
Hard gates (block commit):
cargo test -p clawpal --test perf_metricspassescargo test -p clawpal --test command_perf_e2epassesSoft gates (report only):
Pre-commit hook optimization
CLAWPAL_FMT_SCOPE=stagednarrows cargo fmt to staged .rs files only.Skips Docker/SSH remote perf, Playwright, and system deps installation (those need CI infra).