feat(debug-files): honor server upload limits and add --derived-data#1140
feat(debug-files): honor server upload limits and add --derived-data#1140BYK wants to merge 1 commit into
Conversation
|
Codecov Results 📊✅ Patch coverage is 86.46%. Project has 5107 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.46% 81.49% +0.03%
==========================================
Files 396 396 —
Lines 27525 27588 +63
Branches 17863 17912 +49
==========================================
+ Hits 22422 22481 +59
- Misses 5103 5107 +4
- Partials 1861 1865 +4Generated by Codecov Action |
249c931 to
aacabfb
Compare
3f5f100 to
775acd0
Compare
775acd0 to
8054816
Compare
8054816 to
e27e349
Compare
e27e349 to
faea897
Compare
faea897 to
38245f8
Compare
38245f8 to
b38b62f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b38b62f. Configure here.
Follow-up to #1139 covering the "outer upload envelope" parity with the legacy `dif_upload`: - Parse the server-advertised `maxFileSize` / `maxWait` from chunk-upload options (both optional; absent/0 means no cap). - Skip files larger than the server's `maxFileSize` before assembling (with a warning); `prepareDifs` also gains a scan-time size gate using the 2 GiB default so dry-runs report realistic skips. - Clamp the processing wait to the server's `maxWait` in wait mode. - Add `--derived-data` to also scan Xcode's DerivedData folder on macOS (existence-gated so the stricter scanPaths check is not tripped). Tests cover the schema's optional fields, the size gate (scan + upload), the wait clamp, and the --derived-data branches.
b38b62f to
751cf0b
Compare
There was a problem hiding this comment.
Assembly deadline runs down during chunk upload, causing false timeout when server maxWait is tight
In debug-files.ts, deadline = Date.now() + effectiveMaxWaitMs is stamped before the initial postAssemble + uploadMissing calls, so slow chunk delivery consumes the server-clamped budget. If upload takes longer than effectiveMaxWaitMs, the while loop's first Date.now() >= deadline check fires and throws ApiError(408) even though all chunks were successfully delivered and the server will complete assembly — producing a false failure on builds with large DIFs and a low server maxWait.
Evidence
effectiveMaxWaitMsis clamped toserverOptions.maxWait * 1000whenwait=true(debug-files.ts:415-417).deadline = Date.now() + effectiveMaxWaitMsis set at line 418, beforepostAssemble(line 419) anduploadMissingBufferChunks(lines 421-427).- The while loop checks
Date.now() >= deadlineat line 430 as its first action; if chunk upload consumed the budget, it immediately throwsApiError(408, 'Assembly did not complete within Xs'). - By contrast,
pollAssemblyinchunk-upload.tssets its deadline only after chunks are already uploaded by the caller, so artifact-bundle uploads don't have this race. - The server has received every chunk and will continue processing regardless; only the client reports failure.
Identified by Warden find-bugs
| const difs = dedupeDifs( | ||
| buildDifList(prepared, Boolean(flags["include-sources"])) | ||
| ); |
There was a problem hiding this comment.
Partial size-drop in filterBySize (e.g. oversized source bundles) silently exits 0
In uploadDebugFiles, filterBySize drops any DIF whose content.length exceeds effectiveMaxFileSize with only a log.warn. The accepted.length === 0 guard that raises ValidationError only fires when every file is dropped. When some files are accepted and only others are dropped — most notably the in-memory source bundles produced by --include-sources, which bypass the scan-time prepareDifs size gate — the dropped files never enter chunked, so buildResults produces no result entry for them. doUpload only flags results with state === "error" || "not_found", so failures.length stays 0, setExitCode(1) is never called, and the command prints "Uploaded N debug file(s)" and exits 0 with no indication the source bundle was dropped.
Evidence
filterBySize(debug-files.ts:309-327) drops oversized DIFs with onlylog.warnandcontinue, returning the remaining subset.- The
accepted.length === 0guard (debug-files.ts:391) only throwsValidationErrorwhen all files are dropped; a partial drop passes through silently. buildResults(debug-files.ts:288) maps only overchunked, built fromaccepted, so dropped files have no entry in the returned results.--include-sourcesbundles are pushed bybuildDifListafterprepareDifsran its scan-time gate, so they reachfilterBySizeas the only files that can be oversized in the real-upload path; if a bundle exceeds the limit while its parent DIF does not, it is dropped silently.doUpload(upload.ts) computesfailuresonly fromstate === "error" || "not_found"; with no entry for the dropped bundle,failures.lengthis 0 andsetExitCode(1)is never invoked, so the command exits 0.
Identified by Warden find-bugs · 9LL-87A

Follow-up to #1139. Scopes the outer upload envelope of
debug-files uploadto parity with the legacydif_upload— honoring server-advertised limits and adding Xcode DerivedData scanning. No WASM changes.What's included
maxFileSizeenforcement — parse the optionalmaxFileSizefrom chunk-upload options; files exceeding it are dropped (with a warning) before assembling.prepareDifsalso gains a scan-time size gate using the 2 GiBDEFAULT_MAX_DIF_SIZEdefault so--no-uploaddry-runs report realistic skips without needing server options.maxWaitclamp — in wait mode, the processing wait is clamped tomin(requested, server.maxWait). No-wait mode leaves its hang-guard deadline untouched.--derived-data— additionally scans~/Library/Developer/Xcode/DerivedDataon macOS. Existence-gated (and a no-op with a warning on non-macOS), so the stricterscanPathsexistence check from feat(debug-files): add upload command (core) #1139 is never tripped by an absent folder.Both server fields are optional in the schema (
maxFileSize/maxWait); a server response that omits them parses unchanged (backward compatible), and0means "no cap" (legacy semantics).Testing
chunk-upload.test.ts— schema parses with/without the new optional fields.debug-files.test.ts— oversized files dropped before assemble; all-oversized returns[]with no request; wait clamped to servermaxWait(reflected in the timeout detail); no clamp when server advertises0.scan.test.ts—prepareDifssize gate keeps/skips by limit.upload.test.ts—--derived-datais additive with explicit paths; on non-macOS,--derived-dataalone exits non-zero (no scan targets).53 tests pass across the touched suites; full repo lint + typecheck clean.
Deferred to follow-ups
filter_bad_sources+ il2cpp sources (next PR),fix_pdb_ages(after that). Blocked on upstream WASM/tooling:--il2cpp-mappingline mappings (ObjectLineMapping),--symbol-maps(Appledsymutil).