| feat(session): close 6 deferred gates — parent chain, compact boundary, metadata, listing/search
Closes session deferred gates per docs/politdeck-session-refactor-development-guide.md §11:
1. session-parent-chain — new TranscriptChain.ts buildConversationChain()
builds a DAG from entryId/parentEntryId links and picks the longest
root→leaf path. Falls back to sequence order for pre-chain transcripts.
Orphans (missing parentEntryId) are appended at the end of the chain
(partial parity with legacy recoverOrphanedParallelToolResults).
2. session-compact-boundary — already resolved in Phase 1.5 (control_boundary
schema + findLastCompactBoundaryIndex + TranscriptReplay slicing). Doc
status updated from deferred to resolved.
3. session-metadata-store — SessionMetadataStore.restoreFromReplay() seeds
the in-memory snapshot from replayed metadata without writing to the
transcript. reappendTail() re-appends the full metadata snapshot at the
transcript tail so readSessionLite() (head/tail reader) can see the
latest title/tag without scanning the whole file. resumeAgentSession()
now returns metadata and uses restoreFromReplay.
4. session-listing + session-lite-reader — listAllSessions({ politHome })
scans all projects under {politHome}/projects/*/chats/*.jsonl.
searchSessionsByTitle({ projectRoot, politHome, query }) does
case-insensitive substring match against customTitle / aiTitle /
firstPrompt. Both return results sorted by lastModified descending.
Tests:
- tests/session/transcript/chain.test.ts (5 cases): linear chain, longest
branch selection, orphan recovery, no-entryId fallback, empty input.
- tests/session/metadata/metadata-store.test.ts (4 cases): restoreFromReplay,
reappendTail writes, empty no-op, restore+save merge.
- tests/session/storage/list-all-sessions.test.ts (6 cases): cross-project
listing, limit/offset pagination, missing dir, title search match,
firstPrompt fallback match, case-insensitive search.
Docs:
- §3 adds implementation progress table (6 features resolved).
- §9 Feature Matrix: 5 rows upgraded from deferred/partial to compare.
- §11 Deferred Register: 6 gates marked resolved with resolution notes.
Regression: 301 / 297 pass / 4 skipped (real-API e2e) / 0 fail.
Co-authored-by: Cursor <cursoragent@cursor.com>
| 24 天前 |