Skip to content

feat(mcp): predict the manifest path policy + path-gated pre-merge checks via changedPaths - #1413

Merged
JSONbored merged 1 commit into
mainfrom
claude/predict-gate-changed-paths
Jun 26, 2026
Merged

feat(mcp): predict the manifest path policy + path-gated pre-merge checks via changedPaths#1413
JSONbored merged 1 commit into
mainfrom
claude/predict-gate-changed-paths

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Part two of the predict_gate parity work (audit #11–13/#18; part one was #1411). The pre-submit oracle now accepts the PR's changed file PATHS — metadata only (paths, never source content), so the predictor stays metadata-only — and, when supplied, evaluates the path-dependent gates the live gate enforces:

  • All review.pre_merge_checks (path-gated ones now match their whenPaths), not just the path-independent subset.
  • The focus-manifest path policy (manifest_blocked_path / manifest_linked_issue_required / manifest_missing_tests), threaded through manifestPolicyGateMode so block-mode blocks and advisory-mode doesn't — matching evaluateGateCheck exactly.

Slop stays disclaimed — it needs the diff content, which a metadata-only oracle must never receive (the miner/maintainer boundary). So #13 is resolved by design, not by adding a gate. The verdict note is now conditional: with paths it disclaims only slop; without them it also discloses the path-policy / path-gated gap (part one's behavior).

Wiring: the API route's localBranchAnalysisSchema already accepted changedFiles (no schema change — just map to paths); the MCP predict_gate tool gains one optional changedPaths field. The PredictedGateVerdict output shape is unchanged, so no OpenAPI regen (ui:openapi:check passes).

No GitHub issue — internal review-subsystem audit finding. This closes the predict_gate parity thread.

Scope

  • Backend (src/) only — predicted-gate.ts, mcp/server.ts, api/routes.ts
  • No DB/migration, wrangler.jsonc, or UI change; no OpenAPI change (output shape unchanged)
  • One coherent change (predictor accepts changed paths)

Validation

  • npm run test:ci — green (4477 passed | 4 skipped)
  • npm run test:coverage — every changed line and branch covered (one genuinely-unreachable no-action arm marked v8 ignore — the three policy findings always carry an action)
  • npm audit --audit-level=moderate — 0 vulnerabilities; typecheck/ui:typecheck/ui:openapi:check clean; git diff --check clean
  • New tests: path-gated pre-merge now predicted when paths match (and N/A when they don't); manifest policy block/advisory/off parity; non-policy guidance findings ignored; note drops the path disclaimer with paths; an end-to-end MCP predict_gate call with changedPaths predicting a manifest_blocked_path block.

Safety

  • No secrets / wallets / hotkeys / coldkeys / trust scores / reward values added
  • Metadata-only preserved — only file paths are accepted, never diff content; slop (which needs content) is never predicted
  • Public-safe: findings run through publicSafeFinding/sanitizePublicComment; only public .gittensory.yml config is read
  • Backward-compatible: omitting changedPaths reproduces part-one behavior exactly

…ecks via changedPaths

Part two of the predict_gate parity work (#11-13/#18). The oracle now accepts the
PR's changed file PATHS (metadata only — paths, never source content, so the
predictor stays metadata-only) and, when supplied, evaluates the path-dependent
gates the live gate enforces:
 - ALL review.pre_merge_checks (path-gated ones now match their whenPaths), not
   just the path-independent subset.
 - the focus-manifest path policy (manifest_blocked_path / _linked_issue_required /
   _missing_tests), threaded through manifestPolicyGateMode so block-mode blocks.

The slop score stays disclaimed: it needs the diff CONTENT, which a metadata-only
oracle must never receive — so #13 is resolved by design, not by adding a gate.
The note is now conditional: with paths it disclaims only slop; without them it
also discloses the path-policy/path-gated gap.

Wiring: the API route already accepted changedFiles (no schema change); the MCP
tool gains an optional changedPaths field. No output-schema change → no OpenAPI
regen.
@dosubot dosubot Bot added the size:M label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.36%. Comparing base (af6be76) to head (24a962c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1413   +/-   ##
=======================================
  Coverage   95.35%   95.36%           
=======================================
  Files         192      192           
  Lines       20786    20802   +16     
  Branches     7519     7524    +5     
=======================================
+ Hits        19821    19837   +16     
  Misses        383      383           
  Partials      582      582           
Files with missing lines Coverage Δ
src/api/routes.ts 94.59% <100.00%> (+<0.01%) ⬆️
src/mcp/server.ts 95.56% <100.00%> (+<0.01%) ⬆️
src/rules/predicted-gate.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit c89d6b0 into main Jun 26, 2026
18 checks passed
@JSONbored
JSONbored deleted the claude/predict-gate-changed-paths branch June 26, 2026 02:32
JSONbored added a commit that referenced this pull request Jun 26, 2026
Revive #1405: rebased onto current main (resolved the predict_gate test against
the changedPaths work in #1413 — both tests kept), fixed the #1413 test to store
a PUBLIC repo_file manifest now that predict_gate reads public-only config,
inlined publicSafeManifestPolicyFinding with a v8-ignore on the unreachable
no-action arm, exported it, and added a focused unit test asserting the private
blocked-path / test-expectation detail is redacted out of the public advisory.
JSONbored added a commit that referenced this pull request Jun 26, 2026
* fix(selfhost): protect private policy surfaces

* test(selfhost): assert manifest-policy redaction + rebase onto main

Revive #1405: rebased onto current main (resolved the predict_gate test against
the changedPaths work in #1413 — both tests kept), fixed the #1413 test to store
a PUBLIC repo_file manifest now that predict_gate reads public-only config,
inlined publicSafeManifestPolicyFinding with a v8-ignore on the unreachable
no-action arm, exported it, and added a focused unit test asserting the private
blocked-path / test-expectation detail is redacted out of the public advisory.
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