fix: final-review wave — preview host INV-10 gate, thread status+offer contextValue tokens, establish-on-open baseline, polish
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,9 +32,36 @@ suite("comment → reply → offer → proposal (PUC-8, D10/D19)", () => {
|
||||
const t = api.sidecarRouter.load(api.proposalController.keyFor(doc))?.threads.find((x) => x.id === threadId);
|
||||
return (t?.messages.length ?? 0) >= 2 && t!.messages[1].author.kind === "agent";
|
||||
}, 10000);
|
||||
// Finding 2 (final whole-branch review): the machine reply flips the
|
||||
// thread into an "offer" — this used to CLOBBER the "open" status token
|
||||
// instead of folding in alongside it, so Resolve/Reopen disappeared from
|
||||
// the menu the moment any thread got a reply. Assert both tokens survive
|
||||
// together, directly via the rendered vsThread's contextValue (the exact
|
||||
// string package.json's `comments/commentThread/title` `when`-clauses key
|
||||
// on) — no DOM/UI query needed.
|
||||
const docKey = api.proposalController.keyFor(doc);
|
||||
const afterReply = api.threadController.getRendered(docKey).find((t) => t.id === threadId);
|
||||
assert.ok(afterReply, "thread is rendered after the reply lands");
|
||||
assert.match(
|
||||
afterReply!.contextValue,
|
||||
/\bopen\b/,
|
||||
`expected the "open" status token to survive the offer transition, got "${afterReply!.contextValue}"`,
|
||||
);
|
||||
assert.match(
|
||||
afterReply!.contextValue,
|
||||
/\boffer\b/,
|
||||
`expected the "offer" token once the machine reply lands, got "${afterReply!.contextValue}"`,
|
||||
);
|
||||
const ids = await api.threadController.makeThreadEdit(threadId, api.proposalController.keyFor(doc));
|
||||
assert.ok(ids.length >= 1);
|
||||
assert.ok(api.proposalController.listProposals(doc).length >= 1); // pending, INV-5
|
||||
// Spending the offer flips it to "offerdone" — status token still intact,
|
||||
// and the plain "offer" token must not still match (it's a DIFFERENT word,
|
||||
// not just a substring: /\boffer\b/ must not match "offerdone").
|
||||
const afterMakeEdit = api.threadController.getRendered(docKey).find((t) => t.id === threadId);
|
||||
assert.match(afterMakeEdit!.contextValue, /\bopen\b/, "status token still intact after spending the offer");
|
||||
assert.match(afterMakeEdit!.contextValue, /\bofferdone\b/, "offer token flips to offerdone once spent");
|
||||
assert.doesNotMatch(afterMakeEdit!.contextValue, /\boffer\b(?!done)/, "the bare offer token is gone once spent");
|
||||
});
|
||||
|
||||
test("a comment on a NON-coedited doc summons nothing (INV-10)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user