Skip to content

feat(client): tier becomes optional on materials() — hides 'scalar' sentinel (closes #339) - #341

Merged
gerchowl merged 1 commit into
devfrom
feature/339-tier-optional-scalar-sources
May 7, 2026
Merged

gerchowl merged 1 commit into
devfrom
feature/339-tier-optional-scalar-sources

Conversation

@gerchowl

@gerchowl gerchowl commented May 7, 2026

Copy link
Copy Markdown
Contributor

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:

  1. ✅ bugfix(baker): physicallybased fetcher emits available_tiers=['scalar'] (closes #331) #338 (mat-vis): catalog `available_tiers=["scalar"]`
  2. ✅ client.materials() / Vis: tier should be optional for scalar-only sources ("scalar" is leaky DX) #339 (this PR): client API hides the sentinel
  3. ⏳ mat#222 (py-mat): `Vis("physicallybased", "Aluminum")` shouldn't default `tier="1k"`

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

…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).
@github-actions github-actions Bot added area:testing Test infrastructure, BATS, pytest area:client Python/JS/Rust client packages labels May 7, 2026
@gerchowl
gerchowl merged commit 78afdad into dev May 7, 2026
5 checks passed
@gerchowl
gerchowl deleted the feature/339-tier-optional-scalar-sources branch May 7, 2026 15:01
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:client Python/JS/Rust client packages area:testing Test infrastructure, BATS, pytest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

client.materials() / Vis: tier should be optional for scalar-only sources ("scalar" is leaky DX)

1 participant