Skip to content

Promote trigger to a subcommand + add trust-root-touched verify check (M1)#139

Merged
pengfei-threemoonslab merged 3 commits into
mainfrom
claude/laughing-pascal-d18b31
May 28, 2026
Merged

Promote trigger to a subcommand + add trust-root-touched verify check (M1)#139
pengfei-threemoonslab merged 3 commits into
mainfrom
claude/laughing-pascal-d18b31

Conversation

@pengfei-threemoonslab
Copy link
Copy Markdown
Contributor

Summary

  • Promote the existing trigger evaluator to a first-class agents-shipgate trigger subcommand. It takes --changed-files/--diff file inputs and --base/--head git mode (the only path that shells out to git), keeps --list-rules --json, and preserves python -m agents_shipgate.triggers for developers. evaluate() now emits the M1 output shape (should_run, force_run, skip_reason, changed_files, diff_tokens) alongside the preserved back-compat fields (run_shipgate, stop_conditions_fired, rationale); action precedence is unchanged.
  • Add SHIP-VERIFY-TRUST-ROOT-TOUCHED — the cheap half of the reward-hacking guard. A changed-files-only path classifier in a new verify check category that fires only when a VerificationContext is present (scan --changed-files) and emits an ordinary medium-severity Finding routed through release_decision to review_required — never a second verdict. Plain scan behavior is unchanged.
  • Add a reverse docs/triggers.json ↔ AGENTS.md parity test. Closing the gap it surfaced required a new TRIGGER-N8N-WORKFLOW-CHANGED rule (keyed on the adapter's own n8n-nodes-* markers), so the prose table and catalog are now in true parity.

Why

This is milestone M1 of the AI coding workflow verifier direction (roadmap P0): productize the trigger evaluator and land trust-root protection. Reward hacking is the coding-agent threat model — an optimizer told to "make CI green" may edit the gate instead of fixing the readiness issue — so touching a release trust root (manifest, policies, prompts, the Shipgate CI gate, agent instructions, tool-surface declarations) now requires human review. The verify command's base/head orchestration is the separate P1 milestone; scan --changed-files is the M1 injection point that makes the check reachable through the existing gate.

Type

  • Check or risk-model change
  • CLI or GitHub Action behavior

Verification

CI is authoritative for python -m ruff check ., python -m compileall -q src tests, and python -m pytest.

Additional local checks run:

  • python -m ruff check . — clean.
  • python -m pytest — 2104 passed, 5 skipped. The 7 tests/test_bootstrap.py failures are pre-existing and environmental (confirmed identical on main): this sandbox's editable install points at a sibling worktree without __main__.py, so bootstrap's python -m agents_shipgate subprocess can't resolve. They are unrelated to this change.
  • python scripts/generate_schemas.py --checkdocs/checks.json (and manifest/report/packet schemas) in sync.
  • Smoke-tested both trigger modes (file inputs and --base/--head git) and scan --changed-files end-to-end (trust-root finding flows to review_required).

Release-readiness notes

  • No user-code import added to default scan paths
  • No network access added to default scan paths (git runs only under trigger --base/--head; the trust-boundary allowlist in tests/test_adapter_static_only.py and STABILITY.md § Meta-CLI surfaces are updated to pin the new call sites)
  • New or changed check IDs are documented in docs/checks.md (SHIP-VERIFY-TRUST-ROOT-TOUCHED)
  • Report/schema changes are additive or documented in STABILITY.md (new verify category in docs/checks.json; new trigger command + scan --changed-files flag added to the stable command surface)

🤖 Generated with Claude Code

pengfei-threemoonslab and others added 3 commits May 27, 2026 22:16
… (M1)

Productizes the existing trigger evaluator and ships the cheap half of
the reward-hacking guard.

- Promote triggers.py to a first-class `agents-shipgate trigger`
  subcommand with --changed-files/--diff file inputs and --base/--head
  git mode (the only path that shells out to git). evaluate() now emits
  should_run, force_run, skip_reason, changed_files, and diff_tokens
  alongside the preserved back-compat fields; action precedence is
  unchanged.
- Add SHIP-VERIFY-TRUST-ROOT-TOUCHED, a changed-files-only path
  classifier in a new `verify` check category. It fires only when a
  VerificationContext is present (scan --changed-files) and emits an
  ordinary medium-severity Finding routed through release_decision —
  never a second verdict.
- Add a reverse triggers.json <-> AGENTS.md parity test; closing the
  gap it found required a new TRIGGER-N8N-WORKFLOW-CHANGED rule.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses two PR review findings.

- High: a PR could edit shipgate.yaml to add `checks.ignore` (or a
  below-default severity_override) for SHIP-VERIFY-TRUST-ROOT-TOUCHED and
  silence the very check that flags the edit. apply_suppressions now skips
  UNSUPPRESSIBLE_FINDING_CATEGORIES (the `verify` trust-spine category),
  mirroring how baseline-integrity findings stay immune; and the check
  declares floor_severity: medium so a severity_override below the review
  tier is a hard ConfigError (exit 2) rather than a silent downgrade.
- Medium: `scan --changed-files` is documented single-config-only but was
  fanned across every manifest in a multi-config workspace. It now rejects
  with a ConfigError (exit 2) when more than one manifest resolves; the
  dead verification_context threading through _run_multi_scan is removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses a PR review finding (P2). The public `agents-shipgate trigger`
command read its --changed-files / --diff input files without catching
errors, so a missing or undecodable path crashed with a Typer traceback
(exit 1). It now catches OSError / UnicodeDecodeError, prints a concise
message to stderr, and exits 2 — matching the --base/--head git-failure
path and `scan --changed-files` behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pengfei-threemoonslab pengfei-threemoonslab merged commit 1fbc93c into main May 28, 2026
1 check passed
@pengfei-threemoonslab pengfei-threemoonslab deleted the claude/laughing-pascal-d18b31 branch May 28, 2026 06:20
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