Repository navigation
fix(cli): deliver complete TOON beyond the string limit - #12074
Conversation
[Medium impact] The PR appears safe to merge; no new blocking issues were found. SummaryLarge default TOON results now avoid one document-sized string by finishing encoding in memory or a private temporary file before delivery.
No new actionable issues found. The four supplied earlier findings are addressed in the current code. The target branch still uses whole-string TOON output, so this fix is not superseded there. Tests were not rerun because dependencies are not installed. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Result] --> B[Encode TOON lines]
B --> C{Fits in memory?}
C -->|Yes| D[Deliver completed output]
C -->|No| E[Allocate private stage]
E --> F[Finish encoding into stage]
F --> D
D --> G[Close file, then remove root]
G -->|Cleanup fails| H[Keep owner for shutdown retry]
H --> G
Reviews (6) · Last reviewed commit: "docs(cli): clarify TOON encoding memory ..." · Reviewed by Greptile |
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: faf2aa34aa
ℹ️ 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".
Summary
Deliver complete default TOON results beyond Node's single-string limit, while retaining private staging through interruption and cleanup failure. Resolves #12071.
The old CLI joined all encoded lines into one string. A 536,961,045-byte ASCII document raises
RangeError: Invalid string lengthon Node 24.22.1 even though each row fits.Fix
PrivateRuntimeRoot, including its Windows native DACL authority; refuse if privacy cannot be established. One retryable lease closes the exact descriptor before its root. Failed stages remain owned by CLI shutdown, and cleanup labels follow actual release.cancelledByfactory for the original caller reason; a weak sidecar records only this output owner's 130/143 disposition. Settle admitted I/O before stopping further writes; early iterator return leaves descriptor close to its owner. No replacement document is appended.Addresses the verified cleanup, capacity-hook, cancellation, Windows privacy controlled-wait and canonical cancellation factory findings. No new provider, dependency, option or target execution.
Executed validation
Base: main
f7849cad; final qualification:1000e9d4. Affected TOON sources and contribution rules were also checked against refreshed mainb236bcfewithout relevant changes.63459ee0; cancellation/private-root regressions 7 failed / 6 passed and capacity acceptance 7 failed / 16 passed againstfaf2aa34.encode()throws; the CLI result writer delivers 536,961,045 bytes in 8,194 writes. SHA-2564daa6decb73ebf848d02bfdfcbe10a207c32002804525b6d083a805c4424c627matches independent header/row calculation; stage removed. Used private Linux tmpfs because workspace storage was insufficient.npm run docs:checkandnpm run verify:test-discovery. Normal commit/pre-push hooks passed; reviewed-file hashes verified.checkcomponents ran; the unmodified single-processnpm run checkcommand was not run.Hosted verification
CI for
1000e9d4passed: 15 jobs succeeded / 24 skipped, testing mergebfb0d905against mainb236bcfe. The affected-test shards passed 2,109 tests in 84 files, with 2 skipped, including the new TOON capacity/cancellation/cleanup cases. Clean-runnernpm run verify:package, real Node Inspector discovery/observation, runtime compatibility and Portable tests passed. The earlier unrelated main fixture failure was repaired by #12088 before this qualification.Greptile reviewed all 10 changed files with 0 new comments; all six verified review threads are resolved. Main retired the automated PR readiness workflow in #12095 (
b60836a1); earlier declaration-check failures are historical records. The Author readiness section below is preserved verbatim from the remote PR. This status update changes neither source code nor declarations.Limits
Linux, Node 24.22.1/npm 11.16.0; no actual Windows/Darwin runtime or full local deterministic suite. Windows authority tests mock the native boundary; filesystem denials do not establish real failing-device behavior. Cancellation awaits admitted I/O and can leave an already delivered prefix. Temporary space scales with output; individual lines and token presentations remain string-limited.
--format jsonavoids TOON staging.Focused regression command
Maintainer recheck on refreshed main: 40 TOON staging, cleanup, capacity and cancellation tests passed. The guide now describes the encoded-output buffering limit separately from the encoder's full-tree normalization. The existing Author readiness declaration is preserved.
Author readiness
Human owner: @ShuaixinHuang