Repository navigation
feat(client): tier becomes optional on materials() — hides 'scalar' sentinel (closes #339) - #341
Merged
Merged
Conversation
…entinel (closes #339) bernhard's #281 reply ("some materials expect tier=None. Need to find out how to work with this") + #311 cascade: typing `tier="scalar"` forces the user to know an internal sentinel. After #338 landed the data-layer fix (catalog now declares `available_tiers=["scalar"]`), the client API is the next layer to clean up. Change: `MatVisClient.materials(source, tier: str | None = None)`. When `tier` is omitted, returns every material in the source that advertises ≥1 tier — deduped across tiers. Explicit tier still wins (backwards-compat). End-to-end after #338 + this: client.materials("physicallybased") # → 86 ids (no "scalar" needed) client.materials("gpuopen") # → 454 ids (deduped across tiers) client.materials("ambientcg", "1k") # → 1948 ids (explicit, unchanged) Excludes inert pre-#331 records with `available_tiers=[]` from the no-tier path — they're not fetchable anywhere, surfacing them would mislead consumers. Mirror in `mat_vis_client_standalone.py` keeps signature parity for single-file users. 5 new tests cover: no-tier returns all with ≥1 tier, dedup, explicit tier still filters, inert entries excluded. Existing 354-test client suite still green. Forward-verify (mat-vis-client + tst v2026.04.3 substrate): client.materials("physicallybased") → 86 ids ✓ (verified locally) Bernhard's #313 cascade now needs only mat#222 (pymat-side `Vis("physicallybased", "Aluminum")` defaults `tier="1k"`) to fully resolve at his entry point. Refs #339 (closed), #281 (the original cue), #338 (data-layer), #313 (cascade), mat#222 (pymat half).
gerchowl
added a commit
that referenced
this pull request
May 15, 2026
…entinel (closes #339) (#341) bernhard's #281 reply ("some materials expect tier=None. Need to find out how to work with this") + #311 cascade: typing `tier="scalar"` forces the user to know an internal sentinel. After #338 landed the data-layer fix (catalog now declares `available_tiers=["scalar"]`), the client API is the next layer to clean up. Change: `MatVisClient.materials(source, tier: str | None = None)`. When `tier` is omitted, returns every material in the source that advertises ≥1 tier — deduped across tiers. Explicit tier still wins (backwards-compat). End-to-end after #338 + this: client.materials("physicallybased") # → 86 ids (no "scalar" needed) client.materials("gpuopen") # → 454 ids (deduped across tiers) client.materials("ambientcg", "1k") # → 1948 ids (explicit, unchanged) Excludes inert pre-#331 records with `available_tiers=[]` from the no-tier path — they're not fetchable anywhere, surfacing them would mislead consumers. Mirror in `mat_vis_client_standalone.py` keeps signature parity for single-file users. 5 new tests cover: no-tier returns all with ≥1 tier, dedup, explicit tier still filters, inert entries excluded. Existing 354-test client suite still green. Forward-verify (mat-vis-client + tst v2026.04.3 substrate): client.materials("physicallybased") → 86 ids ✓ (verified locally) Bernhard's #313 cascade now needs only mat#222 (pymat-side `Vis("physicallybased", "Aluminum")` defaults `tier="1k"`) to fully resolve at his entry point. Refs #339 (closed), #281 (the original cue), #338 (data-layer), #313 (cascade), mat#222 (pymat half).
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
Closes #339. Companion to #338 — that was the data-layer fix (catalog declares `available_tiers=["scalar"]`); this is the API-layer ergonomic that hides the sentinel from consumers.
`MatVisClient.materials(source, tier: str | None = None)` — `tier` is now optional. When omitted, returns every material in the source that advertises ≥1 tier (deduped across tiers). Explicit tier still filters (backwards-compatible).
End-to-end
After #338 + this on `mat-vis-client` + tst v2026.04.3 substrate:
```python
client.materials("physicallybased") # → 86 ids (no "scalar" needed)
client.materials("gpuopen") # → 454 ids (deduped across tiers)
client.materials("ambientcg", "1k") # → 1948 ids (explicit, unchanged)
```
Verified locally against `gerchowl/[email protected]` — bernhard's UX cascade works end-to-end on this layer. Three layers needed for his full #313 repro to succeed:
Standalone parity
Same change mirrored to `mat_vis_client_standalone.py`. The signature-parity hook (`test_standalone_drift`) stays green.
Tests
5 new tests in `TestClientCatalogQueries`:
Plus 1 existing `test_materials_list` still green. Full client suite: 354 passed, no regressions.
References