Repository navigation
test(vis): xfail-pin pymat-surface repros for #220/#221/#222 - #224
Merged
Merged
Conversation
…strict xfails
Adds tests/test_vis_bernhard_repros.py covering the three pymat-side
issues filed from Bernhard's mat-vis#311 / #313 feedback:
* TestIssue220ScalarsAccessor: Vis.scalars accessor missing — three
tests for attribute existence, authored-PBR after fetch, and lazy
(no texture fetch).
* TestIssue221ReprObservability: pre-fetch repr shows fetched=False,
post-fetch shows fetched=True with scalars/available_textures
summary, and repr visibly differs across fetch.
* TestIssue222ScalarOnlySources: Vis("physicallybased", "Aluminum")
must resolve tier→"scalar" automatically; .textures returns {};
.to_threejs() succeeds. Plus a non-regression guard pinning
textured-source default tier='1k' (kept outside the xfail class so
it must keep passing today AND after the fix).
Complements the substrate-level live-network xfails in #219
(test_substrate_repros.py) — that file pins the upstream
mat-vis-client surface; this one pins the pymat Vis surface using
mocked clients so unit-level regressions surface without network.
Each xfail is strict: when the fix lands the test XPASSes and CI
fails until the marker is removed.
Refs #220, #221, #222
5 tasks done
gerchowl
added a commit
that referenced
this pull request
May 7, 2026
Vis('physicallybased', 'Aluminum').to_threejs() previously raised
MaterialNotStagedError because the substrate path treated
physicallybased like a textured source — tier defaulted to "1k"
which doesn't exist in physicallybased's manifest, so
fetch_all_textures raised before scalars could be read.
Three pieces:
1. **Type widening**: `tier: str = "1k"` → `tier: str | None = "1k"`
matches the type already used in `set_identity` / `_validate_tier`.
Setting `vis.tier = None` is a documented un-mapping operation
(per `has_mapping` docstring).
2. **`__post_init__` auto-resolution** via new
`_auto_resolve_tier_from_manifest()`. When source + material_id
are set and the configured tier isn't in the source's manifest
tier list, fall back to "scalar" if available. Permissive on
client / manifest unavailability — mirrors `_validate_tier`'s
policy. The default stays "1k" (textured-source majority);
physicallybased silently re-resolves to "scalar".
3. **`_fetch` short-circuit**: when tier == "scalar", skip
`client.fetch_all_textures` entirely and mark the Vis fetched
with an empty texture dict. The scalars are already on the Vis
(loaded from TOML or set explicitly); downstream adapters fall
back to `Vis._PBR_DEFAULTS` for anything still None.
Closes the py-mat-side manifestation of mat-vis #313 — upstream
issue stays open for the substrate-path fix, but consumers no
longer hit the symptom because we route around it.
## Tests
- `tests/test_vis_bernhard_repros.py::TestIssue222ScalarOnlySources`
(added in PR #224 as strict-xfail) flips to passing — drops the
xfail marker.
- `tests/test_substrate_repros.py::TestMatVis313_PhysicallybasedAccess`
(added in PR #219 as strict-xfail) also flips to passing as a
cascade — drops the xfail, tightens the assertion to verify
tier auto-resolution lands on "scalar" rather than just "doesn't
raise."
Suite: 823 passed, 43 skipped, 15 xfailed (down from 17 — the two
that flipped were the #222 + #313 markers).
## Caller compatibility
- Existing `Vis(source="ambientcg", material_id="Wood095")` —
unchanged. Auto-resolution sees "1k" is in ambientcg's tier
list, leaves it alone.
- New `Vis(source="physicallybased", material_id="Aluminum")` —
auto-resolves tier to "scalar"; `.to_threejs()` returns
populated dict; `.textures` returns `{}`.
- Offline / cache-miss callers: auto-resolution silently skips
rather than blocking construction.
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
Adds
tests/test_vis_bernhard_repros.py— 9 strict-xfail tests + 1 non-regression guard pinning the pymat-side half of Bernhard's mat-vis#311 / #313 feedback.Vis.scalarsaccessor) — 3 tests: attribute exists, returns authored PBR after fetch, lazy (no texture fetch)fetched=False, post-fetch showsfetched=Trueplus scalars/textures summary, repr visibly changesVis("physicallybased", "Aluminum")resolves tier→"scalar"automatically;.texturesreturns{};.to_threejs()succeeds; textured-source default tier stays"1k"(guard outside xfail class)Relation to #219
#219 (
test_substrate_repros.py) coversmat-vis#313at the substrate / live-network level —Vis(...).to_threejs()must not raise against the real CDN. This PR adds pymat-surface unit-level coverage using mockedMatVisClientinstances, so:#220and#221issues (no upstream component) get coverage they don't currently haveEach xfail is
strict=True— when a fix lands, the testXPASSes and CI fails until the marker is removed.Test plan
pytest tests/test_vis_bernhard_repros.py -v→1 passed, 9 xfailedFakeClientfor Vis: graceful handling of scalar-only sources (physicallybased / 'tier=None') #222 mirrors real-client raise behavior (not a permissive mock that hides the bug)test_issue222_textured_source_default_unchangedpasses today and must keep passing post-fixFollow-up (post-merge, per-fix)
After each issue's fix lands: drop the corresponding xfail marker, then re-run Bernhard's literal repro from the originating mat-vis issue end-to-end (mat-vis#287/#288 lesson — don't trust unit tests alone for user-surface bugs).
Refs #220, #221, #222