Skip to content

Confirm NDI Cloud recorded every uploaded file; resend what it did not - #374

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/clever-goldberg-45o38v
Nov 23, 2026
Merged

stevevanhooser merged 2 commits into
mainfrom
claude/clever-goldberg-45o38v

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

Port of VH-Lab/NDI-matlab#1297.

A batch (zip) upload counted its files as uploaded once the zips reached S3 and the extraction job finished. The server records each file in a later step, and that step can fail without the client hearing of it. A dataset lost 327 files this way (Waltham-Data-Science/ndi-cloud-node#175). Since that fix the server leaves such files marked not uploaded; with this PR the client now checks.

New: ndi.cloud.upload.confirmFilesRecorded.

  • Waits while new files keep being recorded. It moves on after stall_timeout seconds in which none was (default 900 s).
  • Uploads each file still unrecorded again, one at a time, then waits for those (resend_timeout, 300 s).
  • Reports any still missing. A resend that fails or raises is reported, not raised.
  • wait_fcn and resend_fcn are seams for tests.

uploadFilesForDatasetDocuments.

  • New options: verify_uploads (default True) and verify_stall_timeout.
  • The check runs after 'batch'. Files in batches that zipForUpload already failed are skipped, since those are already reported.
  • It also runs after 'serial', replacing the 120 s wait that failed without resending.
  • Files still not recorded count as failed, and their documents go into failed_document_ids, so the sync index leaves them out.

Bridge. New confirmFilesRecorded entry; uploadFilesForDatasetDocuments is synced to NDI-matlab 63e56ae14 (on the same-named branch).

Testing

  • black and ruff are clean.
  • tests/test_cloud_upload_confirm_recorded.py mirrors MATLAB's ConfirmFilesRecordedTest, with a scripted fake recording server:
    • everything recorded at once;
    • a slow but progressing server is waited for, with nothing resent;
    • dropped files are resent;
    • a file the server never records, a refused resend and a raising resend are each reported;
    • duplicate and empty input;
    • the default resend is a single-file upload.
  • tests/test_cloud_upload_file_batches.py: the fake server now answers record lookups and can drop files. New cases:
    • a batch's dropped file is resent and counted as uploaded;
    • a file never recorded fails its document;
    • a failed batch's files are not checked again;
    • verify_uploads=False skips the check.

Generated by Claude Code

…t (sync with NDI-matlab 63e56ae14)

Port of VH-Lab/NDI-matlab#1297. A batch (zip) upload counted its files
as uploaded once the zips reached S3 and the extraction job finished,
but the server records each file in a later step that can fail unheard
(a dataset lost 327 files this way, ndi-cloud-node#175).

- ndi.cloud.upload.confirmFilesRecorded: wait while records keep
  arriving (stall_timeout, default 900 s, without progress), upload each
  file still unrecorded again one at a time, wait for those
  (resend_timeout, 300 s), report any still missing. wait_fcn/resend_fcn
  seams for tests.
- uploadFilesForDatasetDocuments: verify_uploads (default True) and
  verify_stall_timeout. After 'batch' (files of batches zipForUpload
  already failed are not checked) and 'serial' (replacing the 120 s
  wait that failed without resending); files never recorded count as
  failed and their documents go into failed_document_ids.
- Tests: test_cloud_upload_confirm_recorded (mirrors MATLAB's
  ConfirmFilesRecordedTest); test_cloud_upload_file_batches' fake server
  now answers record lookups and can drop files; batch resend, never
  recorded, failed-batch and opt-out cases.
- Bridge: confirmFilesRecorded (new) and uploadFilesForDatasetDocuments
  synced to 63e56ae14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5rmThd1CWtGUX32qh7
…(sync with NDI-matlab 0be6cfed3)

NDI-matlab CI found a zip of 10,165 small files (84 MB, under the 250 MB
size cap) that NDI Cloud never recorded; resending them one at a time
then did not finish in 40 minutes.

- New preference Cloud.Upload.Max_File_Batch_Count (2000); zipForUpload
  ends a batch at count_limit files as well as at size_limit bytes.
- confirmFilesRecorded: more than single_file_limit (20) unrecorded
  files are resent as zip batches via zipForUpload; after resending it
  waits while records keep arriving. resend_batch_fcn seam.
- Tests: count cap and its preference, zip-batch resend, failed batch
  resend still waited for, resent files waited for, the default batch
  resend; preferences editor rows include the new item.
- Bridge: zipForUpload, confirmFilesRecorded and preferences synced to
  0be6cfed3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5rmThd1CWtGUX32qh7
@stevevanhooser
stevevanhooser merged commit 3abb452 into main Nov 23, 2026
19 checks passed
@stevevanhooser
stevevanhooser deleted the claude/clever-goldberg-45o38v branch November 23, 2026 01:38
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