Repository navigation
The JavaScript byte pool carries only what a JS caller can reach - #8821
Conversation
Quest-Claim: e809c6a5fecd18bf
No JS caller sets a pool capacity, so byte debt, debt shedding, reader debt, run billing, and the tail's debt folds never ran outside tests. Delete them, keeping idle expiry, drop-run expiry, and the per-group frame tail cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
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. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the full removal of the JS byte budget from js/net's cache pool. I traced each deleted branch back to the condition that made it dead: no JS caller sets capacity or calls resize, so Pool.accrue always returned undefined, Reader.debt was always 0, and the record floor #folded stayed at 0n.
cache.tsslimmed to the idle window —Chargenow records only the last access as a whole tick.now - accessed > expirymatches the oldnow - floor(stamp / 4) > expiry, so expiry timing is unchanged.- Reader record floor removed (
track.ts) — with#foldedstuck at0n,told,untold,#reportRun, andrecord.foldedwere already identities or always false. Dropping them changes nothing in either lite publisher branch. - Tail fold and overtaken removed (
tail.ts,lite/subscriber.ts) —overtaken()always returned[]without a fold, so subscribingrecordeddirectly matches the oldowed. - Debt hooks removed (
group.ts,ledger.ts,resume.ts,internal.ts) —#shed,shedReader,foldOldest,billTrack/billSubscriber, and thefoldedsignal had no production trigger.#trim's 32 MiB tail cap is kept. #evictalways ends withTooFarBehind— the"evicted"reason came only from#payDebt, and every other caller already used the default.- Tests rewritten to use expiry or the tail cap — the
wideningpair, the broadcast fetch test, and the takeovershedvariants still force the same loss through paths that production code can reach.
I ran the touched suites locally: cache, lite/drop_record, broadcast, and ledger (71 pass), plus track, group, resume, lite/subscriber, and lite/publisher (800 pass). tsc --noEmit -p net/tsconfig.json and Biome are clean on the touched files. A grep at head found no leftovers that are now unused.
claude-opus-5-5 | 𝕏

Finishes
quest/m1/js-pool-reach.md.Problem
js/net's per-broadcast cache pool ported Rust's byte budget, but every JS pool is built without a capacity andresizehad no non-test caller. SoPool.accruealways returnedundefined: byte debt,#payDebt, group debt shedding, reader-record debt (and itsTooFarBehindend), drop/arrival/reader run billing, and the tail's debt folds ran only in tests, while later PRs kept building on them. The maintainer picked deletion on moq-dev/moq#8764.Approach
cache.tskeeps only the idle window:Pool(expiry, tick clock, sweep),Track(scan order, bounded write-driven scan, full sweep, drop-run expiry hook), andCharge, now just a group's last-access tick. Dropped: capacity,used,resize,accrue, the access mean and sub-tick boosts, debt and its payment,Reader, and the*_OVERHEADconstants.group.ts: deleted#shed,shedGroup,shedReader, and the byte billing. The 32 MiB per-group frame tail cap (#trim) is unchanged.track.ts: deleted debt charging, drop/arrival billing,#shedDrops/#shedArrivals, thefoldedwake signal, the reader record's floor (#folded,#fold,#settleRecord,#lagged), and theEvictedeviction reason, which only debt produced. Drop-run expiry (#dropsBorn,#expireDrops,#forgot,#rearmDrops) stays, and now registers with the sweep throughTrack.dropsChanged().tail.ts: deleted the bill,fold(),overtaken(), and the debt folding of#finished/#dropped.lite/subscriber.tsno longer subtracts the overtaken runs, andlite/publisher.tsloses the tworecord.foldedbranches, which never fired without a fold.ledger.ts: deletedRUN_OVERHEAD,foldOldest, andsize.resume.tsandinternal.tslose the billing hooks.reachesthat sat on theBorninterface.pool.usedassertions. Three tests had usedresizeto force eviction and now use the idle window or the tail cap instead: the drop-recordwideningpair gives the publisher a 10 s expiry, the broadcast fetch test ages the failed group out, and the twoshedvariants of the takeover test overflow the tail cap.Choices made without the maintainer (AFK), all reversible in review:
Charge(andhooks.chargeGroup) for the access record, to keep the diff and the Rust naming parallel, though it no longer bills. Renaming it to something likeAccesswould be fine too.Evicteddrop for a run the pool folded. No path could reach it.Impact
cache.tsand the removed hooks are package-internal.Evicteddrops this removes, since a fold never happened.Validation
bun testinjs/net: 3313 pass, 0 fail. Alsojs/hang563,js/watch648,js/publish379,js/json191, all passing.just checkpasses.PUBLISHER_EXPIRYboth fail.bun build src/index.ts --minify --target browser): 704,080 → 695,084 bytes minified (-9.0 KB), 211,253 → 208,374 gzip -9 (-2.9 KB).Alternatives
Rejected on #8764: (b) expose
capacityto JS callers, (c) keep the code for parity with Rust. Restore it from git once a consumer needs it.Follow-ups
None.
Models
Size: S
Implementer: Claude, claude-opus-5-5, unknown effort (arm A)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 80d763f
Base: origin/main at fabfe5e
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1df3e-0f4e-7720-9849-9c6ebc3bb193, round 1Score: 9/10,
Source review found no actionable regressions in the focused removal of unreachable byte-budget machinery, with idle expiry and frame-tail limits retained; builds and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none