refactor(core): consolidate content parsing and cache source ownership - #413
refactor(core): consolidate content parsing and cache source ownership#413steipete wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 11:06 PM ET / September 5, 2026, 03:06 UTC. ClawSweeper reviewWhat this changesThe PR simplifies HTML document handling, shares YouTube JSON parsing, and preserves transcript-source diagnostics across cache reads. Merge readiness⛔ Blocked before merge - 2 items remain The cache-source defect remains in current main and v0.21.11, so this PR remains useful. The introduced patch has no actionable correctness findings; repository policy also excludes automatic closure of this owner-authored work. Priority: P2 Review scores
Verification
How this fits togetherSummarize’s core library extracts article text, media metadata, and transcripts from web content. Its CLI stores transcripts in SQLite and passes cached results back through core for summaries and diagnostics. flowchart LR
A[Web page HTML] --> B[HTML and YouTube parsing]
B --> C[Article and media extraction]
C --> D[Transcript result]
D --> E[SQLite cache]
E --> F[Core cache reader]
G[Shared source inventory] --> E
G --> F
F --> H[Summary input and diagnostics]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one core-owned source inventory and shared parsing helpers while preserving existing cache formats, unknown-value handling, and extraction fallbacks. Do we have a high-confidence way to reproduce the issue? Yes, from source: writing an embedded or youtube-media transcript and reading it through main’s SQLite adapter loses its source value. No runtime reproduction was executed. Is this the best way to solve the issue? Yes. Sharing the existing source inventory fixes both readers without a storage migration, and the parsing changes remove equivalent implementations while retaining their behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6e20e4493ffa. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landed through #415 in 8308778. The resulting main tree was verified byte-for-byte against the complete reviewed stack (33b957d), with green combined review, Node 24, Chromium E2E, Firefox smoke, and security checks. Closing this constituent PR as superseded; its changes and review history are preserved by the integration. |
What changed
Remove the DOM adapter's fictional lifetime: parseHtmlDocument now returns its Document directly, and callers no longer wrap extraction in finally blocks that invoke a no-op close. Real error handling, document normalization, and test marker cleanup remain intact.
Consolidate three balanced-JSON scanners and two initial-player parsers into one implementation shared by YouTube captions, metadata, and page descriptions. Public YouTube parsing no longer imports a caption HTTP module merely to read JSON.
Make the transcript source tuple own both the source type and cache validation. This fixes a real drift bug: SQLite discarded embedded and youtube-media sources, and core cache reads downgraded youtube-media to unknown. Unknown persisted values retain their prior handling.
Net reduction: 209 production lines and 136 lines overall, with new parser edge cases and SQLite-to-core cache round-trip regression coverage. No compatibility wrappers remain.
Proof
A new whitespace test initially expected a space; validation correctly showed the existing normalizer preserves one newline. The expectation was corrected without changing production behavior, and the full gate and review were rerun.
Stacked on #412. No dependency or public CLI behavior changes beyond preserving cache-source diagnostics.