Skip to content

feat: load test results from uploaded archive files#165

Open
eboudrant wants to merge 1 commit into
mainfrom
feat/scan-from-files
Open

feat: load test results from uploaded archive files#165
eboudrant wants to merge 1 commit into
mainfrom
feat/scan-from-files

Conversation

@eboudrant

Copy link
Copy Markdown
Owner

Summary

Adds a multi-file picker beside the existing Scan from URL input. Users can upload one or more .zip/.tar/.tar.gz archives; their build/ outputs are merged into a single overlay onto the project and scanned against local goldens.

Duplicate handling: the same archive-internal path in two archives is fine when the bytes are identical (merged silently). If the content differs, the scan is aborted before touching the project and an error dialog lists the conflicting paths + which archives they came from.

How it works

  • POST /api/uploads streams each file to a temp file (byte-capped at 2 GB, no in-memory buffering; dep-free — pipes the raw request, no multipart parser). Returns an opaque uploadId.
  • POST /api/projects/:id/scan-from-uploads merges the named uploads: each archive is fully extracted to a stage dir (unzip for zip, tar for tar — chosen by magic-byte sniff), build/ members are sha256-hashed and cross-checked, then matched <module>/build subtrees are copied in via fs.cpSync and handed to the normal scan. Same needs_confirmation park/resume as the URL flow.
  • New src/localArchive.js reuses remoteFetch's path-traversal + compat helpers.

UI note (screenshots)

The picker is added inside the existing hidden Scan-from-URL form, and the collapsed project card / action row is untouched — so screenshot baselines are expected to be unchanged. I couldn't run the Docker screenshot suite locally (Docker Desktop requires a Netflix org sign-in), so I'm relying on CI's Screenshot Tests to confirm no diff.

Test plan

  • npm test — 190 pass, incl. new tests/node/localArchive.test.js (11 cases): pure helpers (sniffFormat, collectBuildMembers filter + symlink skip, mergeStages happy/identical-dup/conflict) and e2e through the real handler (tar+zip merge, identical-dup merge, conflict abort with project untouched, needs_confirmation→confirm, size-cap 413 + no leaked temp dir, input validation).
  • Live curl smoke test of /api/uploads (health, 400 on bad extension, successful uploads).
  • Electron restarted for manual UI check.

🤖 Generated with Claude Code

Add a multi-file picker beside the Scan-from-URL input that accepts
.zip/.tar/.tar.gz archives, merges their build/ outputs into one overlay +
scan, and aborts with a conflict dialog when two archives contain the same
path with differing content (identical duplicates merge silently).

- src/localArchive.js: sniff/extract (unzip|tar) → stage → hash → merge +
  conflict-detect → overlay <module>/build via fs.cpSync. Reuses remoteFetch
  path-safety + compat helpers.
- src/scanJobs.js: upload registry, startScanFromUploads/runUploads/
  doOverlayAndScan, kind-aware confirmScanJob/finishJob, getJob conflicts.
- src/handler.js: POST /api/uploads (raw streamed, byte-capped) and
  POST /api/projects/:id/scan-from-uploads.
- Picker lives inside the hidden url-form → project-card screenshot baselines
  unchanged.
- tests/node/localArchive.test.js: 11 cases (helpers + e2e merge/dup/conflict/
  needs_confirmation/size-cap/validation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/handler.js Dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants