fix(v0.6.4): rollback removes the proposal's ab-tracking entry

adam-rollback.mjs's docstring always claimed it "removes the ab-tracking entry
(so it doesn't re-trigger)", but executeRollback() never did. Consequence: a
rolled-back proposal kept being re-detected as `regressed` on every subsequent
/reflect, which triggered endless `not_found` rollback attempts (the applied
file is already gone) and noisy ## Regressions sections.

executeRollback now deletes the matching ab-tracking.jsonl row by proposal_id
after the move, preserving all unrelated rows. Surfaced by running ADAM's own
/reflect loop a second time (two zombie regressions: 2026-05-16-002 and
2026-05-22-001).

Tests: 138 -> 140 (rollback purges the entry by id; an unrelated entry is
preserved).
This commit is contained in:
2026-05-29 13:50:38 +01:00
parent fcddb6bf79
commit c23b09cc09
4 changed files with 61 additions and 4 deletions
+17
View File
@@ -167,6 +167,23 @@ export function executeRollback(plan, adamRoot, opts = {}) {
result.actions.push(`nudge failed: ${e.message}`);
}
// Remove the ab-tracking entry for this proposal so it stops re-flagging as a
// regression on every future /reflect (which would trigger endless not_found
// rollback attempts). This is the documented contract for rollback.
try {
const abPath = join(adamRoot, "ab-tracking.jsonl");
if (existsSync(abPath)) {
const before = readJsonlSafe(abPath);
const kept = before.filter((e) => !(e && e.proposal_id === plan.proposal_id));
if (kept.length !== before.length) {
writeFileSync(abPath, kept.length ? kept.map((e) => JSON.stringify(e)).join("\n") + "\n" : "");
result.actions.push(`ab-tracking entry removed (${before.length - kept.length})`);
}
}
} catch (e) {
result.actions.push(`ab-tracking cleanup failed: ${e.message}`);
}
result.status = "rolled_back";
return result;
}