Skip to content

Address seven review findings across detectors, CLI, and CI#48

Merged
Conalh merged 2 commits into
mainfrom
fix/review-findings
May 23, 2026
Merged

Address seven review findings across detectors, CLI, and CI#48
Conalh merged 2 commits into
mainfrom
fix/review-findings

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 23, 2026

Summary

Implements the seven follow-ups from the review pass. Each is independently testable and lands with a focused regression test.

  • Emit GitHub annotations for drift findings #2 range detectionmcp-risk.ts now treats @vendor/pkg@^1.2.3, ~1.2.3, >=1.2.3, *, and bare names as unpinned. The previous looksLikePackageName regex rejected range operators entirely so these slipped past the npx/bunx/uvx/pipx unpinned check.
  • Demo: risky agent permission drift #3 parsed TOMLdetectCodexConfigDrift walks the parseToml tree for sandbox/approval/network keys, so inline tables like sandbox_workspace_write = { network_access = true } and windows = { sandbox = "danger-full-access" } produce findings instead of rating none. The split between regex parsing (sandbox/approval/network) and parseToml (trusted projects) is gone.
  • Add traction plan and feedback intake #4 git-ref errorsgit-snapshot.ts exports a ScopeTrailError; verifyGitRef wraps rev-parse failures with a concise message that names the ref and hints at fetch-depth: 0. Caught in main() so the CLI exits 2 with that message instead of leaking a Node stack trace.
  • Add public CI and Action metadata #5 Node supportpackage.json declares engines.node: ">=20" (matching agent-gov-core@>=0.7's requirement), and CI matrices Node 20/22/24.
  • Add line-level GitHub annotations #6 hygiene — temp dirs in test/codex-config-drift.test.mjs use os.tmpdir() (the import was already there, unused) instead of writing under node_modules/.
  • Update checkout action to v6 #7 --fail-on in CLI — threshold logic moved into src/index.ts via meetsFailOnThreshold in report.ts. action.yml now passes --fail-on $fail_on to the CLI and captures exit status, removing the bash rank table.
  • Add GitHub Action diff mode #1 repo cleanup74f3f52 already untracked the demo .mcp.json / .claude/settings.json. This PR adds .gitignore rules matching the existing /.codex/ pattern and a regression test in test/package-surface.test.mjs so the live demo files can't come back unnoticed.

Five new tests added; one CI workflow assertion updated for the Node matrix. The action wrapper drops the bash rank helper in favor of the CLI gate.

Test plan

  • npm test — 66/66 pass (was 59/59)
  • npx tsc -p tsconfig.json --noEmit — exit 0
  • npm pack --dry-run --json — 17 packaged files, no change
  • npm audit --omit=dev — 0 vulnerabilities
  • CI Node 20/22/24 matrix passes on PR
  • Confirm scopetrail.yml dogfood run produces a clean advisory report on this PR (no false-positives from the new detector behavior)

🤖 Generated with Claude Code

Conalh and others added 2 commits May 22, 2026 17:21
Contract-hardening patch: 5 P0/P1 fixes from external review.
Lockfile only on this branch — leaving the in-flight
fix/review-findings work untouched. ^0.7.0 absorbs the patch
so no package.json change needed.
- mcp-risk: package-range detection now recognizes ^, ~, >=, *, and
  bare names. Previously `@vendor/pkg@^1.2.3` slipped past the unpinned
  check because the looksLikePackageName regex didn't admit range
  operators.
- codex-config: walk the parsed TOML tree for sandbox/approval/network
  keys so inline tables like `sandbox_workspace_write = { network_access
  = true }` and `windows = { sandbox = "danger-full-access" }` surface
  findings instead of returning rating: "none".
- git-snapshot: wrap rev-parse failures in a ScopeTrailError that names
  the unresolvable ref and hints at fetch-depth: 0 — no more raw Node
  stack traces escaping to user output.
- package.json + CI: declare engines.node >=20 (agent-gov-core@>=0.7
  requires it) and test the supported Node range (20, 22, 24).
- tests: move codex-config-drift temp dirs out of node_modules and use
  os.tmpdir(); the tmpdir import was already there but unused.
- CLI: add --fail-on so non-GitHub CI users get the same threshold gate
  the Action has. action.yml now defers to the CLI (exit 1 on threshold
  trip) instead of reimplementing the rank table in bash.
- repo hygiene: .gitignore now keeps .mcp.json and /.claude/ out at the
  root (matching the existing /.codex/ rule) so the demo-PR fix can't
  silently regress; package-surface test enforces the same.

npm test 66/66, tsc --noEmit 0, npm pack 17 files unchanged,
npm audit --omit=dev 0 vulnerabilities.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Conalh Conalh merged commit 5697ae0 into main May 23, 2026
5 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