Skip to content

010 stream session parsing - #17

Merged
S2thend merged 4 commits into
mainfrom
010-stream-session-parsing
Apr 4, 2026
Merged

S2thend merged 4 commits into
mainfrom
010-stream-session-parsing

Conversation

@S2thend

@S2thend S2thend commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Node OOM when running Claude session list/sync because CCH and vibe-history load many large transcripts and duplicate full-file parses just to derive fallback preview text. #16

S2thend added 4 commits April 3, 2026 21:25
Add Spec Kit artifacts for 010-stream-session-parsing to define the CCH-only OOM fix scope and implementation path.

- specify one-pass summary/detail parsing requirements, additive SessionSummary.preview, and 512 MiB listSessions() regression budget
- document parser/session research decisions, data model, library and CLI contracts, and implementation quickstart
- generate executable story-first tasks for US1-US3 with test-first checkpoints, dependency graph, and parallelization notes
- update AGENTS.md with the active JSONL session storage context for this feature
Apply the five post-analysis decisions across the 010-stream-session-parsing artifacts.

- document the branch-name governance exception for this Spec Kit-generated branch
- clarify that listSessions()/cch list must return both main-session and agent-session top-level rows
- pin summary preview behavior to a 200-character cap with '(No summary)' as the exact fallback label
- add explicit baseline-vs-new regression coverage for >=90% fewer fallback detail fetches
- align plan.md with tests/unit/cli/formatters/table.test.ts and refresh related contracts, data model, quickstart, and task counts
Refactor summary and detail parsing around one-pass JSONL scanners so list and view paths retain only derived state, emit bounded preview text, return top-level agent rows, and avoid duplicate target-file parses. Add large-fixture, one-pass, and CLI fallback regression coverage, then update stale contract/export expectations to the new listing shape.

Validation:
- npm run typecheck
- npm run lint
- npm test

Per-file summary:
eslint.config.js - Ignore minified JS artifacts.
specs/010-stream-session-parsing/tasks.md - Mark all implementation tasks complete.
src/cli/formatters/table.ts - Render summary, then preview, then the no-summary placeholder.
src/lib/parser.ts - Add streaming scan helpers, preview extraction, and one-pass detail and summary parsers.
src/lib/session.ts - Use one-pass parser outputs for listing and detail retrieval and include top-level agent rows.
src/lib/types.ts - Add SessionSummary.preview.
tests/helpers/large-session-fixtures.ts - Add synthetic large/untitled JSONL fixture builders.
tests/helpers/parser-performance.ts - Add heap sampling and parser scan-count helpers.
tests/integration/cli/list.test.ts - Cover CLI preview fallback, top-level agent rows, and reduced fallback reads.
tests/integration/contract/claude-session-contract.test.ts - Expect both main and agent rows in contract fixture listing.
tests/integration/export-sessions.test.ts - Expect top-level agent rows in export-all JSON.
tests/integration/get-session.test.ts - Assert preview and metadata on large main and agent detail responses.
tests/integration/list-sessions.test.ts - Cover agent rows, preview fallback, malformed-line recovery, and summary precedence.
tests/integration/performance/session-lookup.test.ts - Add 1,000-session heap regression and update agent-inclusive list counts.
tests/unit/cli/formatters/table.test.ts - Cover preview fallback and display-only truncation.
tests/unit/parser.test.ts - Cover streaming scans, preview normalization, and malformed-line recovery.
tests/unit/session.test.ts - Cover preview propagation and one-pass main and agent detail parsing.
Apply the feature-branch version bump and run Prettier over the touched TypeScript files.

Validation:
- npm run format
- npm run typecheck
- npm test

Per-file summary:
package.json - Bump package version to 0.9.0.
package-lock.json - Sync lockfile package version metadata to 0.9.0.
src/lib/session.ts - Apply Prettier formatting to wrapped parser/link-context calls.
tests/integration/cli/list.test.ts - Apply Prettier formatting to long CLI fixture calls.
tests/integration/performance/session-lookup.test.ts - Apply Prettier formatting to long performance fixture helpers.
@S2thend
S2thend merged commit 39f6069 into main Apr 4, 2026
2 checks passed
@S2thend S2thend self-assigned this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant