Add opt-in snapshot policies#14
Merged
Merged
Conversation
roodboi
marked this pull request as ready for review
July 10, 2026 23:16
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82b9edcfd5
ℹ️ 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".
Merged
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.
Summary
Add opt-in snapshot cadence controls to
parse()anditerate()while keeping the v4 per-input-chunk behavior as the default.chunk, completed-value, byte-threshold, andfinalsnapshot policiesSetWhy
Serializing cumulative JSON after every network chunk can dominate allocation and emitted-byte volume for large structured responses. Consumers that do not need chunk-level updates can now select a lower-frequency policy without changing the existing default or final result.
In the 10.25 MB benchmark, default chunk mode emitted 165 snapshots / 855.88 MB, while final mode emitted one 10.25 MB snapshot. The benchmark reports counts and throughput without fragile timing assertions.
Security review
A focused review of all three workflows found no path that exposes
NPM_TOKENto fork or unmerged pull-request code and no step that prints secret values. It did identify mutable action tags in privileged release jobs; all action references are now pinned to reviewed full commit SHAs. The publish job now usescontents: read, does not persist checkout credentials, and retains its exact merged/canonical-repository/release-branch gates.The remaining external hardening options are to configure npm trusted publishing before replacing
NPM_TOKENwith OIDC, add protection rules to thePUBLISHenvironment, and enable repository-level SHA-pin enforcement after these pinned workflows reach the base branch.Validation
bun install --frozen-lockfilebun x ultracite doctor— 4 passed, 0 warnings, 0 failedbun run lint— 28 files checked, zero diagnosticsbun run formatfollowed bybun run lint— idempotent, no remaining fixesbun run test:coverage— 42 tests, 382 assertions; all source 90.48% line coverage and streaming parser 95.86%bun run check— Ultracite formatting/linting, TypeScript 7 type-check, tests, build, and packed consumer matrixbun audit --production --audit-level=high— no vulnerabilitiesbun run changeset status— minor release recognizedbun run benchmark:snapshots 10— 10.25 MB, 165/5/42/11/1 snapshots across the policy matrixStack
This PR is based on and should merge after #13, which establishes the published v4 code as the standalone repository source of truth.