Repository navigation
test(media): avoid stale memory counters in base64 checks - #154808
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 11:32 AM ET / 15:32 UTC (Revision 4). ClawSweeper reviewWhat this changesUpdates base64 allocation tests to use current memory counters, avoid temporary fixture garbage, and measure canonicalization separately from assertions. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, focused test-reliability fix absent from current main and the latest release. No actionable correctness or security findings remain, and the reviewed head has successful CI. Priority: P2 Review scores
Verification
How this fits togetherMedia Core validates and normalizes encoded attachments before downstream decoding. These tests check its output and coarse memory budgets without changing production behavior. flowchart LR
A[Encoded attachment fixtures] --> B[Base64 normalization]
B --> C[Canonical output]
D[Runtime memory counters] --> E[Allocation delta]
B --> E
C --> F[Exact output checks]
E --> G[Memory budget checks]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -2. Total -2 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing allocation guards with current counters, low-garbage fixtures, unchanged budgets, and explicit limits on what the measurements prove. Do we have a high-confidence way to reproduce the issue? No deterministic reproduction of the original CI timing is established; source confirms the stale-counter mechanism, and the body reports a controlled collection probe. Is this the best way to solve the issue? Yes. Repairing measurement and fixture allocation preserves the intended regression checks without relaxing thresholds, adding retries, or changing production code. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d61156bb5cfa. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Use current heap and external-memory statistics, build the same whitespace fixture without split-array garbage, and measure only canonicalization. Keep the existing payloads, output assertions, and memory budgets unchanged.
ad32230 to
3c2ba0b
Compare
|
Merged via squash.
|
Use current heap and external-memory statistics, build the same whitespace fixture without split-array garbage, and measure only canonicalization. Keep the existing payloads, output assertions, and memory budgets unchanged.
Related: #154545
What Problem This Solves
Fixes false base64 memory-budget failures when Bun refreshes its last-collection heap counter during the measured operation.
User Impact
Internal test reliability only; production decoding behavior is unchanged.
Why This Change Was Made
Measure current heap and external memory through
node:v8, construct the same 2 MiB whitespace fixture without a temporary split array, and keep assertions outside the measurement. Payloads, exact-output checks, and the 64 MiB/100 MiB budgets stay unchanged. No forced GC, retries, sleeps, or runtime exceptions are added.Evidence
3ff0efc82); wrapper wall time: 2.16 s / 1.37 s.The exact timing of the original CI failure did not reproduce naturally. These remain coarse memory guards: the historical per-run implementation fits below 64 MiB in these probes, and Bun does not account for unexposed Buffer backing memory. Exposed backing memory is conservatively counted by both Bun fields.
Hosted CI run 35598468201 passed base64 but failed the unchanged cron handoff case
holds adopted on-exit work until the previous scheduler drains (start): its heartbeat mock was still uncalled whenvi.waitForexpired. The canonical cron fixture repair is now incorporated by a patch-identical refresh to3c2ba0b79f435710d94c36cb764adb0e94f40789; the tested base64 file hash is unchanged. Fresh exact-head CI passed all 106 jobs, including the repaired cron shard (13 files / 283 tests).