Fix: distinguish existing Stop findings from new debt (#754)

Use verified first-edit baselines to distinguish pre-existing text findings from new or unknown Stop findings. Preserve dirty worktrees, bound notice rendering, and keep explicit scans unchanged. Verified with the full Rust and Bun/Node suites and real Claude Code edit-to-Stop sessions. Related to #522; keep it open until an engine release ships the fix.

AI assistance: Codex, under maintainer direction.
This commit is contained in:
Paul Bakaus
2026-09-06 16:59:51 -07:00
committed by GitHub
parent 457d152292
commit c4a4f035ed
14 changed files with 777 additions and 15 deletions
+34
View File
@@ -17,6 +17,40 @@ const claudeEdit = (file, extra = {}) => ({
const stop = (extra = {}) => ({ session_id: 's1', cwd: WS, hook_event_name: 'Stop', stop_hook_active: false, ...extra });
export default [
{
id: 'hook-stop-baseline-new-finding', workspace: 'hook-project', files: CACHE_FILES,
normalize: [['("stopBaseline":\\{"version":1,"engine":")[^"]+', 'g', '$1<ENGINE_VERSION>']],
setup(ws) {
fs.writeFileSync(`${ws}/src/new.css`, '.card { border-left: 4px solid #6366f1; border-radius: 8px; }\n');
},
steps: [
{ verb: 'hook', stdin: claudeEdit('src/new.css', {
tool_name: 'Write',
tool_response: {
type: 'create', filePath: `${WS}/src/new.css`, originalFile: null,
content: '.card { border-left: 4px solid #6366f1; border-radius: 8px; }\n',
},
}) },
{ verb: 'hook', stdin: stop() },
],
},
{
id: 'hook-stop-baseline-import-only', workspace: 'hook-project', files: CACHE_FILES,
normalize: [['("stopBaseline":\\{"version":1,"engine":")[^"]+', 'g', '$1<ENGINE_VERSION>']],
setup(ws) {
fs.writeFileSync(`${ws}/src/report.ts`, "const report = `<style>body { font-family: Fraunces; }</style>`;\n");
},
steps: [
{ verb: 'hook', stdin: claudeEdit('src/report.ts', {
tool_response: {
filePath: `${WS}/src/report.ts`,
originalFile: "import dead from 'dead';\nconst report = `<style>body { font-family: Fraunces; }</style>`;\n",
oldString: "import dead from 'dead';\n", newString: '', replaceAll: false, userModified: false,
},
}) },
{ verb: 'hook', stdin: stop() },
],
},
// --- hook.mjs: per-edit ---
{ id: 'hook-edit-tsx-fresh', verb: 'hook', workspace: 'hook-project', stdin: claudeEdit('src/components/Card.tsx'), files: CACHE_FILES },
{ id: 'hook-edit-css-fresh', verb: 'hook', workspace: 'hook-project', stdin: claudeEdit('src/components/Card.module.css'), files: CACHE_FILES },