Repository navigation
Port the file-tier command family from NDI-matlab - #315
Merged
Merged
Conversation
Mirrors NDI-matlab#990 (matlab HEAD 6fdec7e7). Adds four wrappers to
ndi.cloud.api.files plus mock tests for the poll loop:
setFileTier POST /datasets/{d}/file-tier-jobs
getFileTierJob GET /file-tier-jobs/{jobId}
waitForFileTierJob poll loop over getFileTierJob
getFileTier projects filesTier off a documents.getDocument
Selector semantics match the MATLAB side: document_ids may mix cloud
_id and NDI id shapes, id_namespace defaults to "auto" so the server
infers per-selector, and "cloud"/"ndi" force a kind field on every
selector. target_tier stays a plain str at the wire level so
PSEUDO_COLD stays reachable for non-production tests; the docstring
names the five production tiers and the exported FileTier Literal
gives callers strict typing when they want it.
waitForFileTierJob follows the existing waitForBulkUpload contract:
returns the last status dict, with state='timeout' + elapsed on
timeout, so the caller reads state ('completed' | 'failed' |
'superseded') themselves. A transient poll error is NOT treated as
terminal -- the FileTierMockTest pin ports over as tests exercising
each terminal state, the timeout path, and gateway-blip retry.
Bridge YAML gets four new entries under files.py with matlab_last_sync_hash
6fdec7e7 (the merge commit of NDI-matlab#990).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AyvQiNcA83wxQN82vM1QD6
NDI-matlab#990 (the file-tier PR being ported in this branch) also added two rows to url.m for the file-tier endpoints (create_file_tier_job, get_file_tier_job). Python inlines every route at its call site (CloudClient._build_url), so those two rows have nothing to add on the Python side -- setFileTier and getFileTierJob in api/files.py name them directly. Bump the recorded hash so the drift check stops firing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AyvQiNcA83wxQN82vM1QD6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the file-tier client surface to Python at parity with NDI-matlab#990. Four new wrappers in
ndi.cloud.api.files, backed by mock unit tests that mirrorFileTierMockTest.m:setFileTier(dataset_id, document_ids, target_tier, id_namespace="auto")POST /datasets/{d}/file-tier-jobsgetFileTierJob(job_id)GET /file-tier-jobs/{jobId}waitForFileTierJob(job_id, timeout=600, initial_interval=3, max_interval=30, backoff_factor=2)getFileTierJobcompleted|failed|superseded) or client-side timeoutgetFileTier(dataset_id, document_id)getDocument{counts, dominant, notes, updatedAt, raw}from the doc's cachedfilesTierSelector semantics match MATLAB:
document_idsmay mix cloud_idand NDI id shapes; the server infers per-selector whenid_namespace="auto"(default), and"cloud"/"ndi"force akindfield on every selector.target_tierstays a plainstrat the wire level soPSEUDO_COLDremains reachable for non-production tests — the docstring names the five production tiers explicitly, and the exportedFileTierLiteralgives callers strict typing when they want it.waitForFileTierJobfollows the existingwaitForBulkUploadcontract: returns the last status dict (withstate='timeout'andelapsedon timeout), so the caller readsstatethemselves. A transient poll error is not treated as terminal — a gateway blip would otherwise be mistaken for a dead job. The MATLABFileTierMockTestpins port over as unit tests exercising each terminal state, the timeout path, and gateway-blip retry.Bridge YAML gets four new entries under
files.pywithmatlab_last_sync_hash: 6fdec7e7(the merge commit of NDI-matlab#990).Design reference:
ndi-cloud-node/manuals/file-tier-design.md(server PRs #139 + #140).Test plan
pytest tests/test_cloud_file_tier.py— 18 tests, all passpytest tests/test_matlab_bridge_completeness.py tests/test_matlab_bridge_status.py tests/test_matlab_bridge_hashes.py tests/test_every_module_imports.py— all pass, no regressionspytest tests/test_cloud_api_datasets.py tests/test_cloud_api_documents.py— adjacent cloud API tests still passruff checkandblack --checkclean on the touched filestest_cloud_live.pywith module-scoped fixtures that don't currently cover file-tier. Add-on can follow once the live cloud stage is green server-side.🤖 Generated with Claude Code
https://claude.ai/code/session_01AyvQiNcA83wxQN82vM1QD6
Generated by Claude Code