fix(lint-surface): in-file hunk-level collateral veto для fix-ladder - #207
Merged
Conversation
Cross-file collateral-veto не бачив колатеральних правок ВСЕРЕДИНІ вже- таргетованого файлу поза ділянкою самого порушення — LLM-rung міг виправити violation і заодно тихцем видалити сусідній задокументований воркараунд у тому ж файлі (реальний кейс: видалення Bun SQL workaround-у в upsert-order.js, що зламало проєктний тест, але пройшло canonical re-detect). findInFileCollateralEdits() рахує грубий (common-prefix/common-suffix) змінений рядковий діапазон між pre-image і поточним вмістом файлу й звіряє його з вікном навколо кожної violation.data.line — fail-open, якщо рядок порушення невідомий. Той самий rollback/feedback/телеметрія шлях, що й у наявного cross-file veto. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
vitaliytv
force-pushed
the
claude/fix-ladder-collateral-damage-f35dd7
branch
from
July 24, 2026 19:21
e0103f1 to
feab772
Compare
- npm/scripts/lib/lint-surface/tests/run-fix.test.mjs: неправильний відносний шлях у JSDoc-типі (`../../types.mjs` → `../types.mjs`) — knip unresolved import. - npm/rules/doc-files/docgen-gen/main.mjs: дедуплікувати pre-send guard + факт-лист (jscpd 30-рядковий клон між generateDoc і prepareBatchItem) у спільний loadSrcAndFacts(); поведінка ідентична (68/68 тестів модуля зелені). - .cspell.json: додати "післястартовий" (helyx typo-report на acp/docs/session.md, вже existed on main до цього PR). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eless-assignment Мердж трьох veto-механізмів (cross-file collateral, in-file hunk-level, test-gate) у runRung підняв cognitive complexity до 47 (allowed 20, eslint sonarjs/cognitive-complexity). Виносить обчислення collateral (cross-file + in-file hunk), test-gate-виклик і побудову errorSuffix/silentFailureNote у окремі чисті функції (computeCollateral, detectBrokenTest, describeVetoOutcome) — поведінка та телеметрія незмінні (34/34 тестів run-fix.test.mjs зелені). Заразом прибрано no-useless-assignment: `let current = null` перед try, що завжди перезаписує current до першого читання. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…fix.mjs oxlint jsdoc(require-param-description)/jsdoc(require-returns-description) — @param/@returns без описового тексту у computeCollateral/detectBrokenTest/ describeVetoOutcome (типи-only, без прози). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
collateral-veto.mjs's cross-file veto only caught edits to files outside the target set of a fix-ladder rung. It couldn't see collateral edits made inside an already-targeted file, outside the actual violation location — the exact class of bug that let an LLM rung fix ajs/doc_commentsviolation while silently deleting an unrelated, intentionally-documented Bun SQL workaround in the same file (upsert-order.js), breaking an existing project test that canonical re-detect never runs.findInFileCollateralEdits(): a coarse common-prefix/common-suffix line diff between the pre-image (S1 snapshot) and current file content, compared against a window (HUNK_WINDOW = 20lines, configurable) around each violation'sdata.linein that file. A changed range that falls outside every violation's window is treated as collateral.runRung()inrun-fix.mjsalongside the existing cross-file veto: same rollback + feedback-to-next-rung +kind: "collateral-veto"telemetry path (now also carriesrejectedHunks).data.line, the file wasn't actually modified, or content can't be read. Only applies to LLM-ladder rungs, not deterministic T0 fixes.snapshot.mjsgainedpreImageOf(absPath)to expose a file's pre-image content for the new diff.Test plan
run-fix.test.mjsreproducing the real-world repro: a violation near line 1 plus a documented workaround ~40 lines away in the same file.bun test scripts/lib/lint-surface/tests/run-fix.test.mjs) — 32/32 pass.oxlintandcspellclean on all touched files.🤖 Generated with Claude Code