Skip to content

bugfix(baker): physicallybased fetcher emits available_tiers=['scalar'] (closes #331) - #338

Merged
gerchowl merged 1 commit into
devfrom
bugfix/331-physicallybased-available-tiers
May 7, 2026
Merged

gerchowl merged 1 commit into
devfrom
bugfix/331-physicallybased-available-tiers

Conversation

@gerchowl

@gerchowl gerchowl commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #331 (data-layer half of bernhard's #313 cascade). One-line fetcher fix at `sources/physicallybased.py:197`:

```diff

  •        available_tiers=[],
    
  •        available_tiers=["scalar"],
    

```

The catalog's 86 entries were all advertising `available_tiers=[]`, so `client.materials("physicallybased", "scalar")` filtered them all out (`tier in []` matches nothing). The manifest already declared `tiers.scalar.complete=True` for physicallybased — the fetcher was just emitting an empty literal that contradicted it.

Tests

Removes the strict-xfail marker on `test_fetch_populates_available_tiers_with_scalar_sentinel` (committed in #334 as a forcing function); it's now a regular green regression test.

Out of scope

The API-layer DX concern — `tier="scalar"` is a leaky sentinel and the user shouldn't have to know it (Bernhard's #281 quote: "some materials expect `tier=None`. Need to find out how to work with this") — is filed separately as a new issue. This PR is data-layer only; the new issue tracks making `tier` optional for scalar-only sources at the client API.

The pymat-side default-tier mismatch (mat#222) is the other half of the cascade.

Forward-verify after merge

  1. Re-dispatch physicallybased bake on tst (current v2026.04.3 has `available_tiers=[]` from the pre-fix bake earlier today).
  2. Confirm `client.materials("physicallybased", "scalar")` returns 86 ids.
  3. With mat#222 landing on py-mat: `Vis("physicallybased", "Aluminum").to_threejs()` succeeds end-to-end. That closes Bernhard's Access of physicallybased.info materials still not possible #313 repro.

References

  • mat-vis#331 (closed by this)
  • mat-vis#313 (cascade — needs both this + mat#222 + the new UX issue)
  • mat#222 (pymat side — `Vis` defaults `tier="1k"`)
  • mat-vis#334 (the xfail this PR removes)

…'] (closes #331)

bernhard mat-vis#311 + #313 cascade root cause: `sources/physicallybased.py:197`
hardcoded `available_tiers=[]`, so `client.materials('physicallybased', 'scalar')`
returned empty for every dispatcher (`tier in []` matches nothing).
86 catalog entries existed but were unfilterable.

Fix: emit `['scalar']` so the manifest's already-declared
`tiers.scalar.complete=True` and the catalog's `available_tiers`
agree. One-line change at the fetcher.

Removes the strict-xfail marker on
`test_fetch_populates_available_tiers_with_scalar_sentinel` (forced
by the strict=True the marker was set to in #334) — now a regular
green regression test pinning the contract for the future.

Note: this is the DATA-LAYER fix only. The API-layer concern that
`tier="scalar"` is leaky DX (Bernhard's #281 quote: 'some materials
expect tier=None. Need to find out how to work with this') is a
separate UX issue — filed alongside this PR.

After merge: re-dispatch physicallybased bake on tst (current
v2026.04.3 substrate has 86 entries with `available_tiers=[]` from
the pre-fix bake earlier today). Production cuts will pick up the
right shape from the next baseline.

Forward-verify: with this fix on tst,
`client.materials('physicallybased', 'scalar')` returns 86 ids;
combined with mat#222 (pymat-side scalar-source detection) Bernhard's
#313 repro succeeds end-to-end.

Refs #331, #313 (cascade), mat#222 (pymat side).
@github-actions github-actions Bot added area:testing Test infrastructure, BATS, pytest area:baker Baker pipeline, Dagger, data fetchers labels May 7, 2026
@gerchowl
gerchowl merged commit 0fbc18c into dev May 7, 2026
5 checks passed
@gerchowl
gerchowl deleted the bugfix/331-physicallybased-available-tiers branch May 7, 2026 14:49
gerchowl added a commit that referenced this pull request May 7, 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).
gerchowl added a commit that referenced this pull request May 10, 2026
…lar"] (closes #369)

Pre-fix: 18 of 454 gpuopen catalog entries (Chrome, Aluminum, Gold, Brass,
Frosted Glass, Cobalt, Red Wine, White Plastic, …) had `available_tiers`
absent — `index_builder.py` omitted the key when the record's list was
empty, so consumers saw `None` from `dict.get()`. Diverged silently from
physicallybased's `["scalar"]` convention (#338).

Fix:
- `gpuopen.py` `_fetch_one`: emit `["scalar"]` (not `[]`) when no textures
  shipped — symmetric with physicallybased.
- `index_builder.py`: always emit `available_tiers` on every entry. The
  empty-list shape is no longer reachable from any source path.
- Client `_is_scalar_only_entry`: accept all four catalog shapes — new
  `["scalar"]` (post-#369), legacy `[]` and `None` (pre-#369), and key-
  absent — via `all(t == "scalar" for t in tiers)`. Standalone mirrored.

Tests:
- `test_index_builder.py`: pin always-present contract; pin `["scalar"]`
  passthrough.
- `test_gpuopen_baker.py`: extend mtlx-only path to assert
  `available_tiers == ["scalar"]`; new test pins `["1k"]` for textured
  entries (regression guard against the fallback leaking).
- `test_scalar_only_lookup.py`: parametrised over the four shapes
  (`["scalar"]`, `[]`, `None`, missing-key) + an end-to-end test that
  `asset(...).textures` returns `{}` without calling `fetch_all_textures`.
gerchowl added a commit that referenced this pull request May 10, 2026
…lar"] (closes #369) (#379)

Pre-fix: 18 of 454 gpuopen catalog entries (Chrome, Aluminum, Gold, Brass,
Frosted Glass, Cobalt, Red Wine, White Plastic, …) had `available_tiers`
absent — `index_builder.py` omitted the key when the record's list was
empty, so consumers saw `None` from `dict.get()`. Diverged silently from
physicallybased's `["scalar"]` convention (#338).

Fix:
- `gpuopen.py` `_fetch_one`: emit `["scalar"]` (not `[]`) when no textures
  shipped — symmetric with physicallybased.
- `index_builder.py`: always emit `available_tiers` on every entry. The
  empty-list shape is no longer reachable from any source path.
- Client `_is_scalar_only_entry`: accept all four catalog shapes — new
  `["scalar"]` (post-#369), legacy `[]` and `None` (pre-#369), and key-
  absent — via `all(t == "scalar" for t in tiers)`. Standalone mirrored.

Tests:
- `test_index_builder.py`: pin always-present contract; pin `["scalar"]`
  passthrough.
- `test_gpuopen_baker.py`: extend mtlx-only path to assert
  `available_tiers == ["scalar"]`; new test pins `["1k"]` for textured
  entries (regression guard against the fallback leaking).
- `test_scalar_only_lookup.py`: parametrised over the four shapes
  (`["scalar"]`, `[]`, `None`, missing-key) + an end-to-end test that
  `asset(...).textures` returns `{}` without calling `fetch_all_textures`.
gerchowl added a commit that referenced this pull request May 15, 2026
…'] (closes #331) (#338)

bernhard mat-vis#311 + #313 cascade root cause: `sources/physicallybased.py:197`
hardcoded `available_tiers=[]`, so `client.materials('physicallybased', 'scalar')`
returned empty for every dispatcher (`tier in []` matches nothing).
86 catalog entries existed but were unfilterable.

Fix: emit `['scalar']` so the manifest's already-declared
`tiers.scalar.complete=True` and the catalog's `available_tiers`
agree. One-line change at the fetcher.

Removes the strict-xfail marker on
`test_fetch_populates_available_tiers_with_scalar_sentinel` (forced
by the strict=True the marker was set to in #334) — now a regular
green regression test pinning the contract for the future.

Note: this is the DATA-LAYER fix only. The API-layer concern that
`tier="scalar"` is leaky DX (Bernhard's #281 quote: 'some materials
expect tier=None. Need to find out how to work with this') is a
separate UX issue — filed alongside this PR.

After merge: re-dispatch physicallybased bake on tst (current
v2026.04.3 substrate has 86 entries with `available_tiers=[]` from
the pre-fix bake earlier today). Production cuts will pick up the
right shape from the next baseline.

Forward-verify: with this fix on tst,
`client.materials('physicallybased', 'scalar')` returns 86 ids;
combined with mat#222 (pymat-side scalar-source detection) Bernhard's
#313 repro succeeds end-to-end.

Refs #331, #313 (cascade), mat#222 (pymat side).
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).
gerchowl added a commit that referenced this pull request May 15, 2026
…lar"] (closes #369) (#379)

Pre-fix: 18 of 454 gpuopen catalog entries (Chrome, Aluminum, Gold, Brass,
Frosted Glass, Cobalt, Red Wine, White Plastic, …) had `available_tiers`
absent — `index_builder.py` omitted the key when the record's list was
empty, so consumers saw `None` from `dict.get()`. Diverged silently from
physicallybased's `["scalar"]` convention (#338).

Fix:
- `gpuopen.py` `_fetch_one`: emit `["scalar"]` (not `[]`) when no textures
  shipped — symmetric with physicallybased.
- `index_builder.py`: always emit `available_tiers` on every entry. The
  empty-list shape is no longer reachable from any source path.
- Client `_is_scalar_only_entry`: accept all four catalog shapes — new
  `["scalar"]` (post-#369), legacy `[]` and `None` (pre-#369), and key-
  absent — via `all(t == "scalar" for t in tiers)`. Standalone mirrored.

Tests:
- `test_index_builder.py`: pin always-present contract; pin `["scalar"]`
  passthrough.
- `test_gpuopen_baker.py`: extend mtlx-only path to assert
  `available_tiers == ["scalar"]`; new test pins `["1k"]` for textured
  entries (regression guard against the fallback leaking).
- `test_scalar_only_lookup.py`: parametrised over the four shapes
  (`["scalar"]`, `[]`, `None`, missing-key) + an end-to-end test that
  `asset(...).textures` returns `{}` without calling `fetch_all_textures`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:baker Baker pipeline, Dagger, data fetchers area:testing Test infrastructure, BATS, pytest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bake: physicallybased catalog ships available_tiers=[] — client.materials() returns empty

1 participant