Skip to content

fix(lint-surface): test-gate veto — ловить in-file collateral - #205

Merged
vitaliytv merged 1 commit into
mainfrom
claude/fix-ladder-collateral-damage-53baa4
Jul 24, 2026
Merged

fix(lint-surface): test-gate veto — ловить in-file collateral#205
vitaliytv merged 1 commit into
mainfrom
claude/fix-ladder-collateral-damage-53baa4

Conversation

@vitaliytv

Copy link
Copy Markdown
Member

Summary

  • collateral-veto.mjs detects rung collateral edits only OUTSIDE the target-set, and canonical re-detect only re-runs the original detector against the original violation. Neither catches edits INSIDE an already-targeted file — a real case: an LLM ladder rung deleted a documented Bun SQL workaround right next to a fix in upsert-order.js, breaking the project test that guards it, and the clean verdict was still accepted.
  • Adds test-gate.mjs: for files modified inside the target-set, if a sibling test file exists by convention (<dir>/tests/<stem>.test.{mjs,js,ts}, per n-test.mdc), it's run via bunx vitest as part of verify. A failure takes the same rollback/feedback/telemetry path as collateral-veto (kind:"test-gate-veto").
  • Fail-open by design (matching collateral-veto.mjs): missing test-runner, timeout, or no sibling test never blocks the ladder.
  • Refactored resolveTargetSet out of collateral-veto.mjs so both vetoes share the same target-set normalization.
  • Threaded an optional deps.testRunner override through runFixPipelinefixConcernrunRung for unit testing without spawning real subprocesses.
  • Updated docs/run-fix.md, docs/collateral-veto.md, and added docs/test-gate.md with fresh CRC stamps.

Test plan

  • npx vitest run scripts/lib/lint-surface/tests/ — 154/154 passing, including two new tests reproducing the upsert-order.js-style scenario (broken sibling test → veto/rollback/escalation) and the fail-open case (no sibling test file)
  • npx oxlint scripts/lib/lint-surface/ — clean
  • npx cspell on all touched files — clean
  • node --check on all new/modified .mjs files

🤖 Generated with Claude Code

… бачить collateral-veto

collateral-veto.mjs детектує колатеральні правки rung-а лише ПОЗА target-set
(інші файли), а canonical re-detect бачить лише той самий детектор/порушення.
Обидва пропускають правки ВСЕРЕДИНІ вже-таргетованого файлу — реальний кейс:
LLM-рунг видалив задокументований воркараунд Bun SQL-бага поряд із фіксованим
порушенням у upsert-order.js, зламавши проєктний тест, і clean-вердикт все
одно був прийнятий.

Додає test-gate.mjs: якщо змінений target-set файл має сестринський тест-файл
за конвенцією `<dir>/tests/<stem>.test.{mjs,js,ts}` (n-test.mdc), той тест
виконується через bunx vitest як частина verify. Провал → той самий шлях
rollback/feedback/телеметрія, що й collateral-veto (kind:"test-gate-veto").
Fail-open за дизайном: відсутній test-runner/таймаут/відсутність сестринського
тесту не блокує ladder.
@vitaliytv
vitaliytv merged commit 39ee4e4 into main Jul 24, 2026
4 of 7 checks passed
@vitaliytv
vitaliytv deleted the claude/fix-ladder-collateral-damage-53baa4 branch July 25, 2026 05:03
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