fix(#70): INV-5 — reject after an interior tweak restores the retained original (PR #73)

Reject on an optimistically-applied proposal now restores the retained original even after interior tweaks: appliedSpans tracked-range fallback (pure shiftTracked, boundary-straddle distrust, close-clears, rebuild-only resync), honest hard failure with a Discard action, INV-16 read-only guards, rejectAll {reverted,skipped} reporting on all batch surfaces, CodeLens reachability at the tracked span. 312 unit + 94/5 host E2E.

Closes #70.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit was merged in pull request #73.
This commit is contained in:
2026-07-03 01:19:46 +00:00
parent 42740f7cc6
commit 7583165354
8 changed files with 897 additions and 42 deletions
+16 -1
View File
@@ -140,7 +140,22 @@ suite("full native loop — PUC-7 → PUC-8 → PUC-2 → PUC-1 (§6.8, §7.1 ru
assert.ok(claudeSpan, "claude's words are attributed");
assert.ok(humanSpan, "the human tweak is attributed separately (char-honest split)");
// ---- PUC-2, reject: revert the untouched second proposal in place ----------------
// ---- PUC-2, reject: revert the second proposal in place --------------------------
// #70 (INV-5): the reject leg now ALSO takes an interior tweak first — the
// original deliberately rejected only an un-tweaked proposal because the
// pre-fix revert silently skipped an orphaned anchor. The tweak orphans the
// exact anchor; the revert must restore ORIG_REJECT via the tracked span.
const rejAt = doc.getText().indexOf(REJECT_REPLACEMENT);
assert.ok(rejAt >= 0, "reject proposal's applied text present");
const rejTweak = new vscode.WorkspaceEdit();
rejTweak.replace(doc.uri, new vscode.Range(doc.positionAt(rejAt + 2), doc.positionAt(rejAt + 2)), "x");
assert.ok(await vscode.workspace.applyEdit(rejTweak), "human tweak inside the reject proposal's range");
await settle();
assert.strictEqual(
api.proposalController.listProposals(doc).find((v) => v.id === rejectId)!.anchorStart,
null,
"tweak orphans the reject proposal's exact anchor (INV-11)",
);
assert.ok(await api.proposalController.revertInPlace(docKey, rejectId), "reject reverts in place");
await settle();
assert.strictEqual(