fix(compact): correct _extractText surface-order JSDoc; add disposal to the HMR-safety suite (CBR-005, CBR-006)

Manual review round, two non-blocking findings:

- CBR-005: _extractText's JSDoc claimed it "walks events in log order",
  but it walks the seqs in surface order (the inline comment already said
  so) — the exact distinction CBR-001 paid for, since after a replace a
  high-seq checkpoint heads the surface before lower-seq retained nodes.
  Corrected the JSDoc to match.
- CBR-006: the "HMR safety" suite only asserted registration; the actual
  dispose-and-confirm-cleanup test lived under "llm inject", so a reader
  searching by name could miss it. Added a disposal test to the HMR-safety
  suite (mount via the real plugin fiber with LlmService present so inject
  resolves, dispose, assert ctx.get('compact') is undefined) and reframed
  the llm-inject test's trailing teardown to point at it.
This commit is contained in:
Hypatia May
2026-06-26 14:40:20 +08:00
parent 6de5e3a20a
commit f4ace25648
2 files changed
+22 -3

No files matched your search

+5 -2
View File
@@ -601,8 +601,11 @@ export class BasicCompactService extends CompactService {
/**
* Extract plain-text conversation from a set of surface node seqs, for
* feeding into the summarization model. Walks events in log order so the
* summary captures chronological flow.
* feeding into the summarization model. Walks the seqs in the order given
* (surface order, as `compactRegion` slices the surface-node list) so the
* summary follows the conversation as the model sees it — which, after a
* `replace`, is NOT ascending log-seq order (a high-seq summary node heads the
* surface before older retained lower-seq nodes).
*/
private _extractText(session: Session, seqs: number[]): string {
const lines: string[] = []