chore(gates): enforce barrel and Vitest isolation rules with a repo guard

Merged
TH
1d ago
+105-6

Summary

Agent docs stated three mechanical rules as prose. test/repo-guards/agent-rule-guards.test.ts now enforces them: no re-export-only index.ts that no package.json exports, and no Vitest retry, pool, poolOptions, or isolate: false in configs, scripts, workflows, or test files. The docs commit deletes those sentences, plus the slow-test pin sentences. No pin list exists; fixed budgets in scripts/vitest-slow-test-reporter.ts enforce speed.

Dropped: error-text matching (AGENTS.md), platform-barrel imports, test-kit in vi.mock, pnpm only.

Before / after

No observable change to product behavior. Before, retry: 2 on a project or a stray index.ts re-export passed CI. After, the guard fails with the rule stated.

Value

  • Prose rules removed: 6 sentences.
  • Violations on main: 0 for each added rule.
  • Planted violations reported: barrel, retry in config, isolate: false, { retry: 2 } in a test.

Validation

  • Head 7d8fdb2df5; CI pending.
  • vitest run --project unit-core test/repo-guards/agent-rule-guards.test.ts: 3 passed. Lint and format clean on that file.
  • Not enforced, with counts on main:
    • Error text: 1 .message regex (replay-plan-step-execution.ts), 2 false positives, and at least 3 local-variable forms a lexical rule cannot see.
    • Platform barrels: 30 test imports of @agent-device/platform-* roots.
    • test-kit in vi.mock: needs semantic module knowledge.
    • pnpm: packageManager exists; npm is not blocked.

Open in [code]smith 路 Need help on this PR? Tag @codesmith-bot with what you need.