Skip to content

test: pin Bernhard's open mat-vis bugs as strict xfails (#330/#331/#332/#333) - #334

Merged
gerchowl merged 1 commit into
devfrom
test/330-bernhard-xfails
May 7, 2026
Merged

gerchowl merged 1 commit into
devfrom
test/330-bernhard-xfails

Conversation

@gerchowl

@gerchowl gerchowl commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Locks 4 currently-failing-on-dev behaviors into the test suite as `pytest.mark.xfail(strict=True)` baselines. `strict` means: when the fix lands and the test passes, the xfail itself fails — forcing the developer to remove the marker as a mechanical step in the fix PR.

Discipline

Addresses the symptom-vs-spec failure mode that bit #287/#288: closed against unit tests inside the package while the user-visible bug persisted at the consumer's surface. Each test here carries bernhard's literal repro snippet and a cross-link to the proper-fix issue.

Test File Issue
`test_fetch_populates_available_tiers_with_scalar_sentinel` `tests/test_physicallybased_available_tiers.py` (new) #331 — fetcher hardcodes `available_tiers=[]`; cascades to #313
`test_materials_named_method_exists` `clients/python/tests/test_materials_named.py` (new) #330 — display-name accessor
`test_material_not_staged_error_lists_available_tiers` `clients/python/tests/test_errors.py` (append) #332 — error message should include `Available tiers: [...]`
`test_client_accepts_on_download_callback` `clients/python/tests/test_download_progress.py` (append) #333 — proper user-facing surface to replace #287's silent `log.info`

Test suite stays green

  • baker: 506 passed + 1 xfailed
  • client: 350 passed + 3 xfailed

The 4 new xfails are the only new "failures" and are expected per `strict=True`.

Shape

Forcing-function only: each test asserts the API surface or behavior contract, not the full spec. Full behavioural tests land in the fix PR alongside the implementation.

References

#333)

Locks 4 currently-failing-on-dev behaviors into the test suite as
pytest.mark.xfail(strict=True) baselines. Strict means: when the fix
lands and the test passes, the xfail itself fails — forcing the
developer to remove the marker as a mechanical step in the fix PR.

Discipline: addresses the symptom-vs-spec failure mode that bit
mat-vis#287/#288 (closed against unit tests inside the package while
the user-visible bug persisted at the consumer's surface).

- test_fetch_populates_available_tiers_with_scalar_sentinel — #331
- test_materials_named_method_exists — #330
- test_material_not_staged_error_lists_available_tiers — #332
- test_client_accepts_on_download_callback — #333

Forcing-function only. Test suite stays green: 506 passed + 1 xfailed
(baker), 350 passed + 3 xfailed (client). The 4 new xfails are expected
per strict=True.

Refs mat-vis#311, #312, #313, #330, #331, #332, #333.
@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 0a516a8 into dev May 7, 2026
5 checks passed
@gerchowl
gerchowl deleted the test/330-bernhard-xfails branch May 7, 2026 13:01
gerchowl added a commit that referenced this pull request May 7, 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 7, 2026
bernhard mat-vis#311 sub-bullet 'Unclear error messages':

  Today: 'material X is not staged for tier 3k. Needs a re-bake.'
  bernhard's expectation: '... is not staged for tier 3k. Available
  tiers: ["1k", "2k"].'

The pre-#332 wording was actionable only for maintainers ('rebake')
and gave the user no path forward without grep'ing the catalog.

Implementation:
- MaterialNotStagedError gains optional available= kwarg + .available
  attribute (programmatic consumers like pymat / build123d can render
  alternate-tier UI from it).
- Message lists 'Available tiers: [...]' when alternatives exist,
  falls back to the original 'Needs a re-bake' wording when the
  material isn't staged anywhere (the only case where rebake is the
  actual answer).
- Both raise sites in _resolve_material_id pass available_tiers from
  the catalog entry — direct-UUID path AND name-resolved path.
- Standalone parity: same signature + behavior in
  mat_vis_client_standalone.py.

Closes the strict-xfail forcing function from PR #334. 3 new tests
pin the post-fix behavior; existing #280 tests for original_name
unchanged.

414 client tests pass (+3); standalone-drift gate green.

Refs #332 (closed), #311 (bernhard's umbrella; this closes one of
the sub-bullets), #280 (related — original_name). Lands on the
same branch as #358 since it's the same area of client.py and the
same bernhard-audit feedback loop.
gerchowl added a commit that referenced this pull request May 7, 2026
…355) (#358)

* feat(client): observability events + cache hygiene API (closes #312, #355)

Joint design from 3-angle sub-agent spike. Single `on_event=` callback
+ typed ClientEvent taxonomy + opt-in reporters (silent/log/tty/mcp).

#312 — observability surface:
  client = MatVisClient(on_event=tty_reporter())
  client = MatVisClient(on_event=mcp_reporter(emit))

#355 — cache hygiene:
- Per-index ETag (warm path); cold start preserves _get_json shape
  for test compatibility.
- Version-namespaced cache: ~/.cache/mat-vis/v0.6/<tag>/...
- Drop "latest/" aliasing; tag-pinned everywhere.
- Orphan-layout detection at init emits cache_stale_detected.
- client.cache_check() — JSON-serializable status dict.
- client.cache_clear(stale_only=True) — keeps current version's cache.
- CLI: python -m mat_vis_client cache check / clear --stale-only.

Upgrade UX (lazy, not eager):
- New version does NOT auto-delete old cache.
- Does NOT auto-read through old layout (the bernhard #281/#283 bug).
- Does NOT eagerly re-fetch on init.
- Lazy re-fetch on first call to materials/fetch_texture.

Tests: 405 client (+17), 604 host, drift gate green.

Refs #312, #355, #287, #258.

* test: cross-process + real-HF E2E for cache observability (#312/#358 follow-up)

User caught the E2E gap: unit tests in test_progress_and_cache.py
mock _get_with_etag per-test, which proves the code path runs but
not that on-disk artifacts validate across process boundaries — the
load-bearing claim of #355.

Three pieces:

1. tests/e2e/_e2e_fixtures.py — preserved fixture set declaration
   pinning gerchowl/[email protected] (2 ambientcg
   AcousticFoam materials × 1k × 3 channels). Frozen tag so substrate
   evolution doesn't break tests; preflight HEADs every fixture URL.

2. scripts/rebake_e2e_fixtures.py — operator-runnable script that
   restores the fixture set via gh workflow run bake.yml. Self-
   recovering: missing fixtures recommend running this script.

3. clients/python/tests/test_cache_lifecycle_e2e.py — two scenarios:
   - Cross-process upgrade (no network): spawn fresh subprocess
     against a local http.server stub; assert client emits
     etag_not_modified on second run + emits cache_stale_detected
     when orphan dir exists.
   - Real HF round-trip (MAT_VIS_E2E=1 + preflight): cache_check()
     against real HF; warm-path ETag handshake actually fires.

Manifest path now also emits etag_not_modified — symmetry with the
index path; uniform observability across both ETag-validated fetches.

Tests: 407 client (+19 new), 2 e2e tests skipped without
MAT_VIS_E2E=1 + fixture preflight.

Refs #312, #355, #358 (parent PR).

* fix(client): close #312/#355 from bernhard's seat (independent reviewer follow-up)

Independent adversarial review caught two gaps in #358 that left
bernhard's literal repro broken even after the structural fix:

1. get_client() singleton (the path bernhard reaches via pymat)
   constructed MatVisClient with no on_event= — _emit short-
   circuits, log.info stays silent in default loggers.
2. Orphan-layout detection emitted only via on_event — silent-default
   consumers never see it; orphan caches sit silently consuming disk.

Fix:

1. __init__.py get_client() now wires tty_reporter() by default.
   The reporter auto-detects TTY: pretty progress in REPL/Jupyter,
   falls back to silent-log in CI/scripts (no spam regression).
   MAT_VIS_NO_PROGRESS=1 env var opts out → silent_reporter().
2. _emit_legacy_layout_warning_if_any now also fires log.warning
   in addition to the on_event dispatch. Root logger sits at WARNING
   by default so even silent consumers see one line per process at
   startup.

After fix: bernhard's #312 repro shows progress in his IPython REPL
out-of-box (no consumer wiring needed). Stale cache from a v0.6.x
install logs one WARN line at startup pointing at cache clear
--stale-only — my own dev cache surfaced 147MB of orphans this way.

4 new tests: get_client wires on_event by default; MAT_VIS_NO_PROGRESS=1
opts out; orphan WARN log fires without on_event; both surfaces fire
when on_event is wired.

411 client tests pass (+4 new). #312 + #355 now FIXED end-to-end.

Refs #358 (parent), independent-review-driven follow-up.

* feat(client): MaterialNotStagedError lists available tiers (closes #332)

bernhard mat-vis#311 sub-bullet 'Unclear error messages':

  Today: 'material X is not staged for tier 3k. Needs a re-bake.'
  bernhard's expectation: '... is not staged for tier 3k. Available
  tiers: ["1k", "2k"].'

The pre-#332 wording was actionable only for maintainers ('rebake')
and gave the user no path forward without grep'ing the catalog.

Implementation:
- MaterialNotStagedError gains optional available= kwarg + .available
  attribute (programmatic consumers like pymat / build123d can render
  alternate-tier UI from it).
- Message lists 'Available tiers: [...]' when alternatives exist,
  falls back to the original 'Needs a re-bake' wording when the
  material isn't staged anywhere (the only case where rebake is the
  actual answer).
- Both raise sites in _resolve_material_id pass available_tiers from
  the catalog entry — direct-UUID path AND name-resolved path.
- Standalone parity: same signature + behavior in
  mat_vis_client_standalone.py.

Closes the strict-xfail forcing function from PR #334. 3 new tests
pin the post-fix behavior; existing #280 tests for original_name
unchanged.

414 client tests pass (+3); standalone-drift gate green.

Refs #332 (closed), #311 (bernhard's umbrella; this closes one of
the sub-bullets), #280 (related — original_name). Lands on the
same branch as #358 since it's the same area of client.py and the
same bernhard-audit feedback loop.
gerchowl added a commit that referenced this pull request May 15, 2026
#333) (#334)

Locks 4 currently-failing-on-dev behaviors into the test suite as
pytest.mark.xfail(strict=True) baselines. Strict means: when the fix
lands and the test passes, the xfail itself fails — forcing the
developer to remove the marker as a mechanical step in the fix PR.

Discipline: addresses the symptom-vs-spec failure mode that bit
mat-vis#287/#288 (closed against unit tests inside the package while
the user-visible bug persisted at the consumer's surface).

- test_fetch_populates_available_tiers_with_scalar_sentinel — #331
- test_materials_named_method_exists — #330
- test_material_not_staged_error_lists_available_tiers — #332
- test_client_accepts_on_download_callback — #333

Forcing-function only. Test suite stays green: 506 passed + 1 xfailed
(baker), 350 passed + 3 xfailed (client). The 4 new xfails are expected
per strict=True.

Refs mat-vis#311, #312, #313, #330, #331, #332, #333.
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
…355) (#358)

* feat(client): observability events + cache hygiene API (closes #312, #355)

Joint design from 3-angle sub-agent spike. Single `on_event=` callback
+ typed ClientEvent taxonomy + opt-in reporters (silent/log/tty/mcp).

#312 — observability surface:
  client = MatVisClient(on_event=tty_reporter())
  client = MatVisClient(on_event=mcp_reporter(emit))

#355 — cache hygiene:
- Per-index ETag (warm path); cold start preserves _get_json shape
  for test compatibility.
- Version-namespaced cache: ~/.cache/mat-vis/v0.6/<tag>/...
- Drop "latest/" aliasing; tag-pinned everywhere.
- Orphan-layout detection at init emits cache_stale_detected.
- client.cache_check() — JSON-serializable status dict.
- client.cache_clear(stale_only=True) — keeps current version's cache.
- CLI: python -m mat_vis_client cache check / clear --stale-only.

Upgrade UX (lazy, not eager):
- New version does NOT auto-delete old cache.
- Does NOT auto-read through old layout (the bernhard #281/#283 bug).
- Does NOT eagerly re-fetch on init.
- Lazy re-fetch on first call to materials/fetch_texture.

Tests: 405 client (+17), 604 host, drift gate green.

Refs #312, #355, #287, #258.

* test: cross-process + real-HF E2E for cache observability (#312/#358 follow-up)

User caught the E2E gap: unit tests in test_progress_and_cache.py
mock _get_with_etag per-test, which proves the code path runs but
not that on-disk artifacts validate across process boundaries — the
load-bearing claim of #355.

Three pieces:

1. tests/e2e/_e2e_fixtures.py — preserved fixture set declaration
   pinning gerchowl/[email protected] (2 ambientcg
   AcousticFoam materials × 1k × 3 channels). Frozen tag so substrate
   evolution doesn't break tests; preflight HEADs every fixture URL.

2. scripts/rebake_e2e_fixtures.py — operator-runnable script that
   restores the fixture set via gh workflow run bake.yml. Self-
   recovering: missing fixtures recommend running this script.

3. clients/python/tests/test_cache_lifecycle_e2e.py — two scenarios:
   - Cross-process upgrade (no network): spawn fresh subprocess
     against a local http.server stub; assert client emits
     etag_not_modified on second run + emits cache_stale_detected
     when orphan dir exists.
   - Real HF round-trip (MAT_VIS_E2E=1 + preflight): cache_check()
     against real HF; warm-path ETag handshake actually fires.

Manifest path now also emits etag_not_modified — symmetry with the
index path; uniform observability across both ETag-validated fetches.

Tests: 407 client (+19 new), 2 e2e tests skipped without
MAT_VIS_E2E=1 + fixture preflight.

Refs #312, #355, #358 (parent PR).

* fix(client): close #312/#355 from bernhard's seat (independent reviewer follow-up)

Independent adversarial review caught two gaps in #358 that left
bernhard's literal repro broken even after the structural fix:

1. get_client() singleton (the path bernhard reaches via pymat)
   constructed MatVisClient with no on_event= — _emit short-
   circuits, log.info stays silent in default loggers.
2. Orphan-layout detection emitted only via on_event — silent-default
   consumers never see it; orphan caches sit silently consuming disk.

Fix:

1. __init__.py get_client() now wires tty_reporter() by default.
   The reporter auto-detects TTY: pretty progress in REPL/Jupyter,
   falls back to silent-log in CI/scripts (no spam regression).
   MAT_VIS_NO_PROGRESS=1 env var opts out → silent_reporter().
2. _emit_legacy_layout_warning_if_any now also fires log.warning
   in addition to the on_event dispatch. Root logger sits at WARNING
   by default so even silent consumers see one line per process at
   startup.

After fix: bernhard's #312 repro shows progress in his IPython REPL
out-of-box (no consumer wiring needed). Stale cache from a v0.6.x
install logs one WARN line at startup pointing at cache clear
--stale-only — my own dev cache surfaced 147MB of orphans this way.

4 new tests: get_client wires on_event by default; MAT_VIS_NO_PROGRESS=1
opts out; orphan WARN log fires without on_event; both surfaces fire
when on_event is wired.

411 client tests pass (+4 new). #312 + #355 now FIXED end-to-end.

Refs #358 (parent), independent-review-driven follow-up.

* feat(client): MaterialNotStagedError lists available tiers (closes #332)

bernhard mat-vis#311 sub-bullet 'Unclear error messages':

  Today: 'material X is not staged for tier 3k. Needs a re-bake.'
  bernhard's expectation: '... is not staged for tier 3k. Available
  tiers: ["1k", "2k"].'

The pre-#332 wording was actionable only for maintainers ('rebake')
and gave the user no path forward without grep'ing the catalog.

Implementation:
- MaterialNotStagedError gains optional available= kwarg + .available
  attribute (programmatic consumers like pymat / build123d can render
  alternate-tier UI from it).
- Message lists 'Available tiers: [...]' when alternatives exist,
  falls back to the original 'Needs a re-bake' wording when the
  material isn't staged anywhere (the only case where rebake is the
  actual answer).
- Both raise sites in _resolve_material_id pass available_tiers from
  the catalog entry — direct-UUID path AND name-resolved path.
- Standalone parity: same signature + behavior in
  mat_vis_client_standalone.py.

Closes the strict-xfail forcing function from PR #334. 3 new tests
pin the post-fix behavior; existing #280 tests for original_name
unchanged.

414 client tests pass (+3); standalone-drift gate green.

Refs #332 (closed), #311 (bernhard's umbrella; this closes one of
the sub-bullets), #280 (related — original_name). Lands on the
same branch as #358 since it's the same area of client.py and the
same bernhard-audit feedback loop.
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.

1 participant