Skip to content

fix(gates): resolve symlinks before matching cli entrypoints - #393

Open
BenSheridanEdwards wants to merge 2 commits into
mainfrom
fix/symlinked-gate-entrypoints
Open

BenSheridanEdwards wants to merge 2 commits into
mainfrom
fix/symlinked-gate-entrypoints

Conversation

@BenSheridanEdwards

@BenSheridanEdwards BenSheridanEdwards commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Why does this feature exist?

Invoking gate scripts through symlinked paths silently skips their CLI bodies and can return success without running the check. Fixes #387.

What changed?

Apply the existing realpath-and-file-URL entry guard to severity, structure, diagram and local enforcement CLIs, including paths containing spaces. The shared fake-agent fixture commits through normal hooks; every result-commit assertion is retained.

Behavioural Proof (with video and screenshots)

  • Video: Not applicable: this change affects repository tooling without a rendered UI.
  • Screenshots: Not applicable: executable regression checks verify the tooling output.
  • Behaviour tests: All 495 tests across the boundary, structure, diagram and enforcement files pass. Four new black-box cases launch Node through both repository and script symlinks and check observable output and status; all four failed on main. These regressions are included in the final full suite.
  • Fixture repair: all seven earlier frozen snapshots reproduce the guard refusal. The repaired focused case passes with unchanged assertions and normal hooks. Earlier full-pass logs are historical. The PR383 full-run failure and focused red/green evidence are retained in the delivery report.
  • E2E mapping: browser behaviour is unchanged; the complete Playwright map passed in the normal pre-push hook.

Verification Summary

  • Head commit: 775a9a9
  • PRDs checked: None: repository tooling outside product coverage globs
  • PRD impact: None
  • North Star commit: b6b5631
  • Commands run: pnpm exec jest --selectProjects tooling --testPathPattern tooling/trial/run-trial.test.ts --runInBand --testNamePattern '^runTrial makes the one result commit with the hooks on, whatever the agent committed$'; pnpm install --frozen-lockfile; pnpm lint:anti-slop; pnpm verify; pnpm e2e. Full verification ran through the shared heavy-suite limiter in the normal pre-push hook.
  • Results: 85 unit/tooling suites and 3193 tests passed; 2 consumer and 1 provider contract tests, 7 HTTP integration tests and 19 Playwright tests passed at this committed head. Normal pre-commit and commit-message hooks passed. No new dependencies or architectural constraints.
  • Pre-commit wall-clock timing: measured from the normal fixture-repair commit's hook steps at this head.
Pre-commit step Seconds
typecheck 1.454
biome (format, import order, JSON and CSS lint, staged only) 0.815
oxlint (all lint: general, policy, naming, React, Tailwind and React Doctor rules) 1.799
style tokens (CSS and index.html on the @repo/ui design tokens) 0.751
anti-slop (vendored Oxlint rules) 1.192
suppression ban (no inline lint or coverage suppressions) 1.427
architecture gate (fallow zones, folder structure, role diagram) 2.94
fallow (code intelligence: dead code, cycles, complexity) 1.736
secret scan (gitleaks, staged content) 0.934
  • Security hold: GHSA-fc5q-39xc-vjpf affects installed picomatch 2.3.2 and 4.0.4. The refreshed hosted Security audit and Required gates fail. The official advisory has no patched release and npm 4.0.8 is unavailable. An isolated upstream backport probe revealed matching and capture regressions, so no unvalidated patch, version override or audit exception was adopted. Release-age policy and audit thresholds are unchanged.
  • Definition of Done: local checks passed at this head. Security remediation, latest hosted checks and any guarded-change sign-off must pass before readiness.
  • pnpm verify
  • pnpm e2e
  • Behaviour is covered by the E2E map when user-visible behaviour changed; this tooling change has regression coverage.
  • Logic is unit-tested where logic changed.
  • Accessibility considered; the browser accessibility map passed.
  • The diff follows .agents/project/ARCHITECTURE.md and CONVENTIONS.md.
  • No gates were bypassed or weakened.
  • Known risks or skipped checks: production runtime and a live model trial remain unverified. Hosted checks are recorded separately. Required human sign-off is reserved for the named maintainer. Revert this PR to restore the previous tooling behaviour.

PRD Behaviours to Review

  • None

PR Proof Law

  • I followed .agents/project/PR_QUALITY.md and .agents/skills/pr-quality-contract/SKILL.md; the PR quality check verifies the proof format.

@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. and removed confidence: red A required gate is failing or pending, or evidence is unavailable. labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Enforcement sign-off

Ran at Tuesday, the 17th of November, at 7:52 pm on commit 775a9a9.

This PR changes gated enforcement or product intent, so it needs sign-off.

File What changed How it affects
scripts/enforcement-approval.mjs Rewrites the check runCli: definition "function runCli(argv) {\\n const index = argv.indexOf('--git');\\n\\n if (index === -1 || !argv[index + 1]) {\\n console.error('Usage: node scripts/enforcement-approval.mjs --git <base> [<head>]');\\n process.exitCode = 2;\\n\\n return;\\n }\\n\\n const git = (/** @type {string[]} */ ...args) =>\\n execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });\\n\\n const head = git('rev-parse', argv[index + 2] ?? 'HEAD').trim();\\n const base = git('merge-base', String(argv[index + 1]), head).trim();\\n\\n /** @param {string} ref @param {string} path */\\n const show = (ref, path) => {\\n try {\\n return git('show', '${ref}:${path}');\\n } catch {\\n return null;\\n }\\n };\\n\\n const names = git('diff', '--name-only', '--no-renames', '-z', '${base}...${head}').split('\\\\0');\\n const paths = guardedPaths(names.filter(Boolean).map((filename) => ({ filename })));\\n\\n const problems = enforcementProblems(\\n paths.map((path) => ({ path, before: show(base, path), after: show(head, path) })),\\n );\\n\\n console.log(JSON.stringify({ head, problems }, null, 2));\\n}\\n\\n// Run the CLI only when invoked directly, not when imported by a test or the workflow.\\nif (import.meta.url === 'file://${process.argv[1]}') {\\n runCli(process.argv.slice(2));\\n}" becomes "function runCli(argv) {\\n const index = argv.indexOf('--git');\\n\\n if (index === -1 || !argv[index + 1]) {\\n console.error('Usage: node scripts/enforcement-approval.mjs --git <base> [<head>]');\\n process.exitCode = 2;\\n\\n return;\\n }\\n\\n const git = (/** @type {string[]} */ ...args) =>\\n execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });\\n\\n const head = git('rev-parse', argv[index + 2] ?? 'HEAD').trim();\\n const base = git('merge-base', String(argv[index + 1]), head).trim();\\n\\n /** @param {string} ref @param {string} path */\\n const show = (ref, path) => {\\n try {\\n return git('show', '${ref}:${path}');\\n } catch {\\n return null;\\n }\\n };\\n\\n const names = git('diff', '--name-only', '--no-renames', '-z', '${base}...${head}').split('\\\\0');\\n const paths = guardedPaths(names.filter(Boolean).map((filename) => ({ filename })));\\n\\n const problems = enforcementProblems(\\n paths.map((path) => ({ path, before: show(base, path), after: show(head, path) })),\\n );\\n\\n console.log(JSON.stringify({ head, problems }, null, 2));\\n}\\n\\n// Run the CLI only when invoked directly, not when imported by a test or the workflow.\\nif (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {\\n runCli(process.argv.slice(2));\\n}" The comment must explain the guarded change before the maintainer ticks; display text does not grant approval; These checks are unchanged: isApprover, isFreshTick, guardFingerprint, verifiedCarry, holdsSignOff (configured-user authorization, fresh ticks and identical guarded-content carry-over); Unchanged: only the configured GitHub User @BenSheridanEdwards can fresh-tick; identical guarded-content fingerprints keep approval across a new head, and changed guarded content clears it

@BenSheridanEdwards: tick to approve.

  • Approve these enforcement changes at 775a9a9

@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. and removed confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confidence: red A required gate is failing or pending, or evidence is unavailable.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check-fallow-severity exits 0 without checking when run through a symlinked path

1 participant