m.recordTurn(turn('Add idempotency to refunds','refund.rb'),'m');
constid=m.liveId();
m.seal('done');
assert.match(m.digest().recently[0].text,/Addidempotencytorefunds/,'starts as the goal headline');
assert.ok(m.transcript(id).length>=4,'the full transcript is readable for the summarizer');
assert.ok(m.refineSummary(id,'Made refunds idempotent with a Redis lock; added a regression spec.'));
assert.strictEqual(m.digest().recently[0].text,'Made refunds idempotent with a Redis lock; added a regression spec.','the model outcome supersedes the headline');
assert.match(fs.readFileSync(memory.memoryMdFile(root,slug),'utf8'),/Redislock/,'MEMORY.md follows the refinement');
assert.ok(!m.refineSummary(id,' '),'a blank refinement is refused');
});
test('MEMORY: recall finds a past session by a query over its outcome + files',()=>{
assert.ok(panel&&panel.superseded&&panel.supersededBy==='Moved idempotency to Postgres','still in the panel, marked superseded, with the one-line history');
m.factAction(key,'confirm');
assert.strictEqual(m.digest().facts.length,1,'Keep/Confirm restores it to the digest');
});
// ---- Fork (experience doc §6, "the what-if-I'd-told-it-to-do-X-instead branch") -----------------
/** A sealed, archived, pinned session with two turns — every state a fork must NOT inherit. */