Repository navigation
chore(tests): speed up large upload byte checks - #140402
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 6, 2026, 3:59 PM ET / 19:59 UTC. ClawSweeper reviewWhat this changesThe PR replaces deep comparison of an 8 MiB uploaded archive in a regression test with native Buffer equality and an explicit length assertion. Merge readiness✅ Ready for maintainer review This remains a useful, narrowly scoped optimization: current main retains the expensive assertion, and the replacement preserves exact byte checking. No actionable correctness or security findings. Priority: P3 Review scores
Verification
How this fits togetherThe skill upload store stages archive chunks in SQLite and materializes a committed archive for installation. This regression test checks that materialization preserves every byte while avoiding unnecessary archive reads and copies. flowchart LR
A[Archive chunks] --> B[SQLite upload staging]
B --> C[Size and checksum verification]
C --> D[Install claim]
D --> E[Temporary archive file]
E --> F[Length and byte equality check]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +2. Total +2 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the full-size regression and its storage invariants while using native equality for the large materialized buffer. Do we have a high-confidence way to reproduce the issue? Not applicable as a product bug: this is test-performance cleanup, supported by reported controlled before/after measurements and a corruption negative control. Is this the best way to solve the issue? Yes. Native equality preserves the required byte-for-byte invariant without reducing the fixture or replacing the comparison with sampling or a checksum. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7974cc77bf27. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…rol-ui * origin/main: docs: remove the empty release-sections nav group (#140427) fix(tooling): omit Codex machine squash credit (#140420) chore(ui): refresh control ui locales (#140384) refactor(plugin-sdk): reuse native approval input contracts (#140415) fix: silent model WebSocket streams hang past the idle timeout (#140335) perf(ai): avoid unused text extraction for image results (#140409) fix(ui): distinguish failed GitHub status checks from disconnected accounts (#140333) refactor(cron): share runtime feedback schema fields (#140408) fix: avoid duplicate cloud worker teardown during recovery (#140377) fix(cli): show executable approval scope (#138386) refactor(ui): reuse shared requirement records (#140407) test(gateway): table-drive device token lifecycle checks (#140403) fix(chat): fence delayed history at terminal retirement (#140379) test(skills): compare large upload bytes natively (#140402) refactor(delivery): reuse the canonical rendered batch plan type (#140386) docs(start): repair the first-run path from landing page to first channel (#140390) # Conflicts: # docs/.i18n/glossary.zh-CN.json
What Problem This Solves
The large upload regression spent most of its test time deeply comparing an 8 MiB buffer. The existing case took 9.417 seconds in the controlled local run, with about 3.91 GB peak process memory.
Why This Change Was Made
Compare the materialized file with exact native Buffer equality and retain an explicit length assertion. The two 4 MiB chunks, SHA-256 checks, SQLite state, deferred archive reads, transactional install claim, zero redundant native-byte copies, and cleanup checks remain unchanged. Smaller archive comparisons retain their existing diagnostics.
User Impact
Test-only performance improvement; no production, schema, upload-limit, or behavior change. The test still checks every byte, including same-length corruption.
Evidence
Both original and candidate full-file runs passed all 23 cases on the same Node 24.19.0/pnpm 12.3.4 frozen install, with separate fresh compiler caches. The selected case improved 9.417 → 0.327 seconds; peak process RSS improved 3.91 → 2.14 GB. Total command wall time was noisy (18.66 → 19.59 seconds), so this is a scoped case/memory improvement, not a claimed whole-CI speedup.
A temporary control changed only the final materialized byte: the length assertion passed and byte equality failed as expected. The control was then removed and exact candidate bytes verified. Node's comparator implementation was inspected; this uses full byte equality rather than sampling or digest-only comparison.
The changed-file gate passed, including core test types, all three dead-code scans, lint and formatting. Independent P2 review passed with no findings. One test file changes by +3/-1 lines; production is unchanged. Exact-head CI remains the landing gate.