Skip to content

feat(intake): stream whole JSON preparation into sealed shards - #5562

Merged
Sinity merged 1 commit into
masterfrom
fix/whole-json-prepared-stream
Sep 26, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/whole-json-prepared-stream

Conversation

@Sinity

@Sinity Sinity commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

Stream supported whole-JSON bundle preparation into a sealed SQLite artifact and keep the shard session manifest on disk.

Problem

The worker parsed top-level bundle arrays and session wrappers into complete Python session lists, then returned an in-memory shard manifest. A large count of small sessions could retain a growing tree before publication even began.

Solution

Normalize supported JSON records incrementally into the worker artifact, keep duplicate-identity checks and lookahead in SQLite-backed state, and expose shard sessions through lazy sequence and identity lookups. Existing object-returning parser entry points collect from the same lowering logic. The writer can consume the sealed manifest without rebuilding its row identities.

Verification

  • devtools test tests/unit/sources/test_prepared_jsonl.py — 9 passed, receipt 20260926T213827Z-focused-test-3920758-99aacb51.
  • devtools test tests/unit/storage/test_session_shards.py::test_many_small_sessions_keep_manifest_off_python_heap — passed with 8,000 sessions, receipt 20260926T213140Z-focused-test-3902735-bc95b2d7.
  • Shard/inline parity and duplicate-ID refusal focused tests passed, receipts 20260926T213403Z-focused-test-3910057-4158a13e and 20260926T214035Z-focused-test-3927591-ac1edb01.
  • Final scoped mypy, format/lint, pattern, and schema-closure gates passed. The local quick run before the final structured-log change found the new prose warning; devtools gate patterns passed after that correction. Hosted quick gate on this PR will verify the final integrated bytes.

This patch bounds worker preparation and its manifest. Live publication still materializes a session list; a separate follow-up is implementing that boundary. This PR alone does not satisfy end-to-end 9m93s or the whale memory qualification.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a6bff1d3-09bd-4f72-bf72-1eb2012122d3

📥 Commits

Reviewing files that changed from the base of the PR and between 8e762e4 and 96d8324.

📒 Files selected for processing (9)
  • polylogue/sources/decoder_json.py
  • polylogue/sources/dispatch.py
  • polylogue/sources/live/batch.py
  • polylogue/sources/prepared_jsonl.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/write.py
  • polylogue/storage/sqlite/archive_tiers/write_shard.py
  • tests/unit/sources/test_prepared_jsonl.py
  • tests/unit/storage/test_session_shards.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T22:43:05.738070Z 96d8324 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity force-pushed the fix/whole-json-prepared-stream branch from 63231e0 to 96d8324 Compare September 26, 2026 22:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96d8324ed4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/sources/prepared_jsonl.py Resolved
@Sinity
Sinity merged commit dddac24 into master Sep 26, 2026
3 checks passed
@Sinity
Sinity deleted the fix/whole-json-prepared-stream branch September 26, 2026 22:49
Sinity added a commit that referenced this pull request Sep 26, 2026
## Summary
Prepare retained non-JSON raws in an isolated process worker without the
old payload-size refusal.

## Problem
A retained raw beyond the old size cap could remain outside ordinary
materialization even when its parser supported it. The first worker
patch opened archive tiers directly from the source layer, bypassing the
declared read boundary.

## Solution
Route non-JSON retained preparation through the same sealed artifact
publication path and inject an operations-owned worker that pins the
archive through `open_operation_read`. The worker revalidates its
descriptor, blob and enrichment dependencies before publishing; worker
exit and stale input remain retryable. Content-aware routing keeps
logical SQLite/Hermes exports named `.json` on their proper parser
route. The separate 419 MB and 1.6 GB completed-convergence
qualifications remain under `58bwo`, and the broader one-route work
remains under `9m93s`.

## Verification
- `devtools test` with the seven exact selectors for non-JSON over-limit
replay, text/JSON parity, SQLite page and logical-export replay, worker
death, canonical daemon raw admission and discovery costs: 9 selected, 9
passed on the frozen refactor content; receipt
`20260926T221843Z-focused-test-4118482-81995384`.
- `devtools gate controlled-read`: zero violations; `devtools gate
schema-closure`: 565 observed/565 baseline; `devtools verify --quick`:
passed, receipt `20260926T222117Z-quick-4130603-b8e512a5` on that
content.
- The two-commit branch was rebased onto merged master `dddac2422` after
#5562. The same seven exact selectors passed 9/9 on clean published head
`d50005095`, receipt `20260926T225042Z-focused-test-48131-03662e2f`. The
hosted quick gate checks that head. An independent read-only review
found no concrete wrong output or missing production caller.

A wider three-file test selection was cancelled after it reached an
unrelated 4,096-row bound test and occupied the managed pytest slot for
11 minutes. It is not acceptance evidence. The isolated worker still
materializes a non-JSON parser's complete session tree; this PR removes
the size refusal and makes that failure retryable, while bounded
representation for supported large JSON is handled separately.
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at bf68918):

  • P1 polylogue/sources/prepared_jsonl.py:403: Fixed on master (checked at bf68918): Browser-bundle classification uses the member shape (polylogue/sources/prepared_jsonl.py:1131), in which each shape key is a scalar or an emptied container (polylogue/sources/decoder_json.py:1511-1513), so nested fractional values under session/provenance never reach browser_capture.looks_like.

Resolving every thread listed; confirmed defects are fixed under the named bead.

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