feat(client): ETag-aware manifest cache + immutable-tag policy (#258)#259
Merged
feat(client): ETag-aware manifest cache + immutable-tag policy (#258)#259
Conversation
Replace the never-invalidated manifest disk cache with one conditional GET per client lifecycle across all four reference clients (Python, JS, Rust, shell). Cache holds a sibling .manifest.etag; on the first .manifest access we send If-None-Match and serve the cached body on 304, refetch on 200. Defensive cold-start when the origin omits an ETag — body cached, no etag file written, next lifecycle refetches unconditionally. Also formalises the immutable-tag policy in README + CHANGELOG: once a CalVer tag is published (e.g. v2026.04.2) the data at that revision will not change. New data → new CalVer. This contract is what lets the ETag cache trust 304 responses on pinned tags. All four client packages aligned to 0.6.3.
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
Issue #258 — replaces the never-invalidated manifest disk cache with an ETag-aware conditional GET across all four reference clients, plus formalises the immutable-tag policy in README + CHANGELOG.
.manifest.etag; first.manifestaccess in a client lifecycle sendsIf-None-Match. 304 → cached body served without refetch; 200 → both body and ETag replaced atomically.### Notessubsection: once a CalVer tag is published the data at that revision will not change. New data → new CalVer.Mechanism summary across clients
clients/python/src/mat_vis_client/client.py)$cache_dir/<tag>/.manifest.{json,etag}_get_with_etag(url, etag=…)via stdliburllib.request, mirrors_get's retry/backoff envelope; 304 short-circuits before the rate-limit handlerclients/js/mat-vis-client.mjs)$MAT_VIS_CACHE/<tag>/.manifest.{json,etag}); in-memory only in browser (no IndexedDB to avoid a runtime dep)fetch(url, { headers: { 'If-None-Match': etag } }), branches onresp.status === 304clients/rust/src/main.rs)$MAT_VIS_CACHE/<tag>/.manifest.{json,etag}(skipped when noHOMEresolves)reqwest::blocking::Client.get(url).header(IF_NONE_MATCH, etag), branches onresp.status() == NOT_MODIFIEDclients/mat-vis.sh)$CACHE/$TAG/.manifest.{json,etag}curl -H "If-None-Match: $etag" -w '%{http_code}', branches on 304 vs 200 (and treats000fromfile://as 200 so structural tests still pass)Policy paragraphs
README.md (under
## Versioning)CHANGELOG.md (under
## mat-vis-client 0.6.3→### Notes)Test plan
TestManifestEtagCache(cold start, in-process memo, fresh-process 304, fresh-process 200 mutation, no-ETag-from-server). Existing manifest tests migrated from_get_jsonto_get_with_etagpatches.MAT_VIS_SKIP_LIVE_TESTS=1 pytest clients/python/test_client.py clients/python/tests/ tests/ -q→ 605 passed, 30 skipped.text()+headers.get('etag')on thefetchstub; all 10 tests pass.cargo test→ 21 passed.bash clients/test_client.sh→ 13 passed.MAT_VIS_LIVE_TESTS=1 pytest clients/python/test_client.py::test_proof_phase_2_fetch_physicallybased_index_from_hf→ passed againstgerchowl/mat-vis@v2026.04.2.TestLiveDefaultTag→ 2 passed.Out of scope
mat_vis_client_standalone.py) version bumped via sync hook but its manifest path differs (tree-listing reconstruction) and is out of feat(client): manifest cache invalidation + immutable-tag policy #258's scope.