Skip to content

chore: local CI-mirror gate (verify.sh) + pre-push hook#164

Merged
phuongnse merged 4 commits into
mainfrom
chore/verify-gate
Jun 1, 2026
Merged

chore: local CI-mirror gate (verify.sh) + pre-push hook#164
phuongnse merged 4 commits into
mainfrom
chore/verify-gate

Conversation

@phuongnse

@phuongnse phuongnse commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the biggest source of red-CI round-trips in the register-org slices: "build passed locally but CI failed" (charset/format, integration, casing). Mechanical, not self-reported.

  • scripts/verify.sh [fast|full] — runs the same commands as .github/workflows/build-and-test.yml, only for the layers whose files changed (vs origin/main):
    • fastdotnet build + dotnet format --verify-no-changes + frontend npm run ci/test + check-doc-drift.sh (no Docker).
    • full — adds the full dotnet test (Testcontainers), exactly like CI.
    • Runs every step, reports all failures, exits non-zero if any.
  • scripts/hooks/pre-push + scripts/install-hooks.sh — committed pre-push hook (enabled via core.hooksPath) runs verify.sh fast automatically. Bypass only with git push --no-verify.
  • Wired into agent-checklist.md Gate 1 and CONTRIBUTING.md.

Verified end-to-end (forced the violation, per "green ≠ active"):

Linked spec

Process/tooling — no use-case AC. Motivated by the register-org CI cycle (charset, integration cascade, casing).

Requirements

  • verify.sh mirrors the CI matrix with change-detection + fast/full modes
  • Committed pre-push hook + one-time installer
  • Counterexample-verified (fails on a real violation, passes clean)
  • Wired into agent-checklist Gate 1 + CONTRIBUTING
  • ./scripts/check-doc-drift.sh green

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated contribution docs and playbook with a one-command local verification flow, guidance on fast vs full modes, and how to opt out of verification when necessary.
  • Chores

    • Added an automatic pre-push verification hook and a one-time setup to enable it.
    • Added a local verification tool that conditionally runs backend, frontend, and documentation checks, aggregates failures, and supports fast/full modes.

phuongnse and others added 2 commits June 1, 2026 07:22
Point agent-checklist Gate 1 and CONTRIBUTING at scripts/verify.sh (the local
mirror of the CI matrix) and the committed pre-push hook, so "build passed
locally" stops diverging from "CI passed".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@phuongnse, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 4 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09187227-d12d-4d90-bffc-5c5bf332d9b6

📥 Commits

Reviewing files that changed from the base of the PR and between 4c1bde7 and 974c846.

📒 Files selected for processing (3)
  • CONTRIBUTING.md
  • docs/playbooks/agent-checklist.md
  • scripts/verify.sh
📝 Walkthrough

Walkthrough

Adds a local verification gate (scripts/verify.sh) with change detection and fast/full modes, a pre-push hook (scripts/hooks/pre-push) that runs the gate in fast mode, a one-time installer (scripts/install-hooks.sh), and documentation updates describing the workflow and bypass.

Changes

Local CI gate with pre-push integration

Layer / File(s) Summary
Verify script: entry and change detection
scripts/verify.sh (lines 1–46)
Sets strict bash options, parses MODE (fast/full), computes a git diff range, collects changed filenames, and sets DOTNET/FE booleans by matching file patterns.
Verify script: steps, aggregation, and flow
scripts/verify.sh (lines 47–87)
Provides step() wrapper, runs conditional .NET build/format (and dotnet test only in full), frontend npm checks if needed, always runs ./scripts/check-doc-drift.sh, aggregates failures, and exits with PASS/FAIL.
Pre-push hook and installer
scripts/install-hooks.sh, scripts/hooks/pre-push
Adds install-hooks.sh to set core.hooksPath to scripts/hooks and mark scripts executable; pre-push execs scripts/verify.sh fast to gate pushes.
Contributor docs and checklist updates
CONTRIBUTING.md, docs/playbooks/agent-checklist.md
Documents how to run the local gate (scripts/verify.sh), the fast vs full modes and mapping to CI, how to enable the pre-push hook, and that --no-verify bypass exists with a reason.

Sequence Diagram

sequenceDiagram
  participant Developer
  participant PrePush as pre-push hook
  participant VerifyScript as verify.sh
  participant ChangeDetect as change detection
  participant DotnetStep as .NET checks
  participant FEStep as Frontend checks
  participant DocsStep as Docs check

  Developer->>PrePush: git push
  PrePush->>VerifyScript: exec verify.sh fast
  VerifyScript->>ChangeDetect: compute git range and detect changed files
  ChangeDetect-->>VerifyScript: sets DOTNET/FE flags
  VerifyScript->>DotnetStep: run .NET steps if DOTNET
  DotnetStep-->>VerifyScript: exit codes
  VerifyScript->>FEStep: run frontend steps if FE
  FEStep-->>VerifyScript: exit codes
  VerifyScript->>DocsStep: run check-doc-drift (always)
  DocsStep-->>VerifyScript: exit code
  VerifyScript-->>PrePush: PASS or FAIL (aggregated)
  PrePush-->>Developer: exit 0 or exit 1
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • phuongnse/axis#48: Related to the doc-drift gate and its invocation from local CI/verify scripts.
  • phuongnse/axis#49: Also touches scripts/check-doc-drift.sh and CI wiring used by the verify gate.
  • phuongnse/axis#128: Prior updates to agent-checklist/Gate 1 guidance around pre-push verification.

Poem

A rabbit taps the keys at night,
A pre-push guard to do what's right,
Fast for speed and full for tests,
Hooks installed to pass the quests,
Push with care — the gate is bright. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main changes: addition of a local CI-mirror gate script (verify.sh) and a pre-push hook, which are the primary objectives of this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/verify-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/verify.sh`:
- Around line 15-16: The MODE variable is currently set with MODE="${1:-fast}"
and any unknown value behaves like "fast", so add explicit validation: after
setting MODE, check that MODE equals either "fast" or "full" and if not, print a
clear error and exit non-zero (do not silently default); update the same
validation where MODE is re-used in the other block (lines handling test
selection) so both places use the same check (e.g., a small helper validate_mode
or a single if/case that references MODE) to ensure typos like "ful" fail fast
and require an explicit correct value.
- Line 13: The repo-root change directory command using "$(dirname "$0")/.."
should guard against failure and exit immediately if cd fails; update the cd
invocation in scripts/verify.sh (the line that calls cd "$(dirname "$0")/..") to
check its return status and fail fast (e.g., by appending an explicit failure
handler that prints a clear error and exits non‑zero) so subsequent commands
never run in the wrong directory.
- Around line 53-59: The script's "full" MODE branch omits the build step
contrary to the documented contract; update the if branch that checks MODE to
include the same build invocation used in the non-full branch by adding a step
call for ".NET build" with the command "dotnet build Axis.sln --nologo" before
running the ".NET format" and ".NET test (full, Testcontainers)" steps (locate
the MODE conditional and the step function calls such as ".NET test (full,
Testcontainers)" and ".NET format" to insert the build step).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 17b5ed9a-d61d-41ce-9336-94c30df912a6

📥 Commits

Reviewing files that changed from the base of the PR and between 36a26c4 and 01b1ba9.

📒 Files selected for processing (5)
  • CONTRIBUTING.md
  • docs/playbooks/agent-checklist.md
  • scripts/hooks/pre-push
  • scripts/install-hooks.sh
  • scripts/verify.sh

Comment thread scripts/verify.sh Outdated
Comment thread scripts/verify.sh
Comment thread scripts/verify.sh
phuongnse and others added 2 commits June 1, 2026 11:32
Address CodeRabbit findings on the local CI gate:

- guard `cd "$(dirname "$0")/.."` with `|| exit` so a missing repo
  root fails fast instead of running subsequent steps in the wrong
  directory (SC2164).
- validate the MODE arg via a `case` so typos like `ful` exit 2 with
  a usage hint rather than silently downgrading to fast.
- restore the script's own contract: `full` mode must include
  `dotnet build` (header says `full = fast scope + full test`); the
  build step now runs in both modes and `full` only adds the
  Testcontainers test pass on top.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The verify.sh header and the CONTRIBUTING / agent-checklist notes listed
"integration" among the classes the local gate catches, but the default
mode and the pre-push hook run `fast` (no Testcontainers). State plainly
that integration surfaces only in `verify.sh full` or CI, so the gate's
guarantee is not overstated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@phuongnse phuongnse merged commit 87289f8 into main Jun 1, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant