Skip to content

fix: harden evidence guard and command gate freshness - #5

Merged
vannt-dev merged 2 commits into
mainfrom
fix/source-review-20260924
Sep 24, 2026
Merged

vannt-dev merged 2 commits into
mainfrom
fix/source-review-20260924

Conversation

@vannt-dev

Copy link
Copy Markdown
Owner

Summary

Closes gaps between what Junto's evidence promises and what it enforces.

  • Guard aliases. guard.js matched protected paths case-sensitively on the raw path, so .JUNTO/tasks/t/verdicts/unit.json or .junto/tasks/t/Verdicts/... were allowed, even though Windows and macOS write them to the protected evidence. The existing path prefix is now canonicalized with realpath.native (case, 8.3 short names, symlinks), Windows trailing dots/spaces are dropped from new segments, and matching is case-insensitive.
  • Command gate freshness. Only review gates were bound to source; command gates relied on the Edit/Write hooks, so edits through Bash, formatters or codegen after a passing test left done reachable. In a Git repository root, command gate verdicts now carry a sourceFingerprint over file contents outside staleIgnore plus the gate spec; advance/status recompute it and treat a mismatch as stale. Commits of unchanged content and Markdown edits keep the verdict fresh. Projects without a Git repository root keep the hook-only behavior. Fingerprints are hashed outside the task lock so edit hooks are not starved.
  • Locked task writes. advance, plan and verify wrote task.json from an unlocked snapshot, which could drop concurrent hook updates (staleness, user approval). Rule obligations (monotonic) are merged under the lock, the phase transition is applied to the latest task, and done is refused if a required gate was invalidated during the transition.
  • Review gate names. Review gates now reject reserved Windows device names (nul, con, ...) like command gates.

The second commit requires Node.js 22.12 (Node.js 20 reached end of life on 2026-04-30), tests Node.js 22.12 and 24 in CI, targets Node.js 22 in the bundles, and updates @modelcontextprotocol/sdk to 1.30.1. Each commit's plugin bundles were built from that commit's lockfile and target.

Verification

  • corepack pnpm typecheck — passes on both commits
  • corepack pnpm build — bundles rebuilt per commit
  • corepack pnpm test — 378 passed, 4 platform/optional skips on both commits. New tests: guard case and Windows aliases; source-bound command gates (Bash-style edit blocks done, staleIgnore and unchanged-content commits do not, revert restores freshness); policy persistence keeps a concurrent approval; device-name review gates.

Compatibility

  • Minimum Node.js is now 22.12 (engines); the hooks and MCP server run on the user's node.
  • Verdicts gain an optional sourceFingerprint field; SCHEMA_VERSION stays 1. Existing command verdicts without it keep the previous hook-only behavior until rerun.
  • In large repositories, advance/status hash tracked sources once per fingerprinted command gate.

- Block case variants and Windows trailing-dot/short-name aliases of
  protected .junto/ evidence paths in the guard hook.
- Bind command gate verdicts to source contents outside staleIgnore in
  Git repository roots, so edits that bypass the edit hooks (Bash,
  formatters, codegen) make them stale at the next transition.
- Persist rule obligations and phase transitions under the task lock and
  refuse done if a required gate was invalidated during the transition.
- Reject reserved Windows device names for review gates.
Node.js 20 reached end of life on 2026-04-30. CI tests Node.js 22.12 and
24, and plugin bundles target Node.js 22.
@vannt-dev
vannt-dev merged commit fe2bc67 into main Sep 24, 2026
5 checks passed
@vannt-dev
vannt-dev deleted the fix/source-review-20260924 branch September 24, 2026 15:06
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