Repository navigation
2.x.x: stream PRISM share-window serialization and parsing - #239
Merged
Merged
Conversation
Every whole-window JSON call on the payout-window paths -- the daemon prepare_window request, the audit-builder compact tail (spool, in-memory fallback and one-shot), the digest of a freshly read share list, the daemon mirror's lazy parse, the found-block candidate identity digest and the one-shot canonical payload -- is replaced by batched encoding or record-at-a-time parsing that produces byte-identical output while bounding any one C call to 512 records or one 64 KiB decode chunk, so the writer-lease monitor thread can run between batches instead of waiting behind a whole-window json.dumps/json.loads. - lab/prism/share_json_stream.py: new leaf helper (batched array/object encoders, streamed canonical digest, ShareArrayJsonSequence view, bounded list release). - share_ledger.py: page encoding through the helper; _walk_canonical_items (incremental UTF-8 decode + raw_decode per record, shared key strings, strict layout checks); DaemonShareJsonSequence parses record by record and publishes only after the count check; block_candidate_identity_sha256 streams shares_json. - bundle_compiler.py: compact tail as bounded chunks (compact_tail_chunks) written identically by spool, daemon in-memory fallback and one-shot; prepare_payout_window streams the request and retires the daemon on a half-written line; the canonical one-shot payload streams its arrays. - payout_state.py / job_bundle.py: share-list digests go through the streaming view; transient per-share lists released in bounded slices. - metrics.py: compact-json byte accounting via compact_json_bytes. - tests: byte-parity, malformed/chunk-boundary parse, fault injection (unencodable record mid-request, daemon death mid-request), candidate digest parity, spool/in-memory equality. - tests/perf: --latency-probe mode with a lease-monitor-cadence lateness thread, GC attribution and the real daemon round trip; report section 9 records the shared-host measurements and the Rust paging finding. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01AFvDqz6xwHRWxCWwJPiXvT
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 6, 2026
This was referenced Sep 6, 2026
Closed
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several PRISM payout-window paths serialize or parse an entire share array in one call, delaying the lease-monitor thread at large window sizes. Encode share arrays in 512-record batches and parse daemon mirror records incrementally while preserving the historical JSON bytes and canonical digests.
This covers daemon prepare requests, compact audit-builder tails, one-shot payloads, share-array digests and candidate identity hashes. Serialized tails remain cached per generation; partial request failures retire the daemon so a later request cannot reuse an incomplete line. Lazy mirror parsing retains strict framing/count checks and only publishes a complete parse. Sharing parsed key strings and releasing operation-owned temporary lists in batches reduce cleanup pauses.
Validation:
os.spliceassumptions previously reproduced on the unchanged macOS base.git diff --checkpassed.The included on-demand probe measured replacement encoding/parsing phases at roughly control-level monitor delay on a shared Python 3.12 host. These are synthetic phase measurements, not production-image or end-to-end Stratum recovery validation. See
tests/perf/window_pipeline_gil_scaling.mdfor measurements and limitations.A separate existing Rust paging allocation defect was reproduced during profiling; a scratch fix dramatically reduced daemon memory use, but no Rust change is included here; the fix is tracked in #240. Candidate-intent SQL literal serialization also remains outstanding; the database-read companion PR does not cover that mutation path. Combined recovery, GC/lease latency and soak gates remain for #236.
Part of #236, alongside pipe transport #237 and database decoding #238. This PR does not close the incident issue.
Integration validation: this branch now includes merged #237 (
43fef00). Independent reviews found no blocking regressions. The full three-PR integration tree at6174754passed 436 local Python 3.14 tests (2 platform skips), preserving both appended share-ledger test blocks. GitHub CI passed on both updated branches, including 3,374 Python tests (2 skipped) plus PostgreSQL, Rust and payout-window parity gates on the full combination. One unchanged ckpool test hit a readiness-file race; its failed CI job passed on rerun at the same commit.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.