Skip to content

Fix: report failing SceneTest case context - #1927

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:fix/issue-1832-case-reporting
Aug 24, 2026
Merged

ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:fix/issue-1832-case-reporting

Conversation

@doraemonmj

@doraemonmj doraemonmj commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • report a failing SceneTest entry as its class-qualified case name
  • retain the original exception message and cause so device poison markers remain detectable
  • cover ordinary failures and pooled Worker poison classification with regression tests

Testing

  • python -m pytest tests/ut/py/test_scene_test_cli_contract.py -q (8 passed)
  • Ruff check and format check on the changed files
  • Pyright on the changed files
  • Full tests/ut reached 1667 passed and 19 skipped; the unrelated test_second_child_failure_reaps_first suite-load teardown flake failed and passed when rerun alone

Closes #1832

Wrap each case execution failure with its class-qualified case name while
preserving the original exception and its message. Keep device error markers
visible so pooled Worker poison detection still recycles failed lanes.

Refs hw-native-sys#1832
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bcad62f2-d619-47bc-a046-430c8d29fa43

📥 Commits

Reviewing files that changed from the base of the PR and between aac09a6 and 5b58bf9.

📒 Files selected for processing (2)
  • simpler_setup/scene_test.py
  • tests/ut/py/test_scene_test_cli_contract.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

run_class_cases now reports the scene and case name when execution fails. It preserves the original exception as the cause. Contract tests verify error details and device-error classification.

Changes

Scene case error reporting

Layer / File(s) Summary
Contextual failure handling
simpler_setup/scene_test.py
run_class_cases wraps case failures in RuntimeError with Class::case context and chains the original exception. The failure documentation describes this behavior.
Failure contract tests
tests/ut/py/test_scene_test_cli_contract.py
Tests verify the error context, preserved ValueError cause, and device-error classification.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 5b58b

The change is localized to failure reporting and regression coverage, with the supplied checks passing; no actionable merge-blocking risk remains beyond normal review.

Poem

A rabbit saw a case fail fast,
Then named the scene and case at last.
The first error stayed in view,
Chained beneath the failure too.
Tests now guard the message bright.
Hop, hop—diagnosis right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: reporting the failing SceneTest case context.
Description check ✅ Passed The description directly explains the failure-reporting change, exception preservation, regression tests, and validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChaoZheng109
ChaoZheng109 merged commit 086e15e into hw-native-sys:main Aug 24, 2026
19 checks passed
@doraemonmj
doraemonmj deleted the fix/issue-1832-case-reporting branch August 25, 2026 09:30
ChaoWao added a commit that referenced this pull request Aug 26, 2026
`run_class_cases` reported which case failed by wrapping every case exception in
a fresh `RuntimeError`. That makes a negative scene test — one whose subject is
the exception its own orchestration raises — unable to pass:

    with pytest.raises(ValueError, match="ibing mode is only supported for nranks=2"):
        super().test_run(st_platform, st_worker, request)

`TestAllreduceIbingNranksError` asserts exactly that. The `ValueError` does fire,
in `allreduce_orch_fn`, and reaches the test as a `RuntimeError` carrying it as
`__cause__`, which `pytest.raises(ValueError)` does not match. The wrapper arrived
in #1927 and did not update this test; the case is `manual: True`, and per-PR CI
runs the sim and NPU workflows with their default `manual_mode: exclude`, so only
the daily full sweep reaches it. It has been red there since.

The case name is now added to the exception already in flight —
`_name_failing_case` rewrites `args[0]` — and the original is re-raised with a
bare `raise`. Type, identity, traceback and attributes all survive, and `str()`
still ends with the original text.

Two things depend on that:

- a negative test can assert on the type its orchestration raised, which is the
  only way to state what such a test is actually checking;
- `conftest._requires_l2_worker_retirement` gates on
  `issubclass(excinfo.type, RuntimeError)` before matching device-poison codes.
  Every code in `_DEVICE_POISON_CODES` and every string in
  `_L2_WORKER_RETIREMENT_MARKERS` names a native-layer failure
  (`{prepare,launch,poll,finalize}_native_run`, `simpler_init`, device
  quarantine), all of which surface as `RuntimeError`, so keeping the type keeps
  them classifiable. The wrapper had been widening non-RuntimeError failures into
  that gate, never narrowing.

`TestAllreduceIbingNranksError` needs no change and is the regression test: it
fails on the parent commit with `DID NOT RAISE <class 'RuntimeError'>` and passes
here. The unit contract test moves to the new shape — same type out, case name in
the message, no wrapper to unwrap — and gains a case for an exception raised with
no arguments, so the annotation cannot degrade to a bare `"…::case: "`.

`tests/st/worker/collectives/allreduce/test_allreduce.py:326` is the only place
that wraps `super().test_run(...)` in `pytest.raises`; the other overrides call it
plainly, so no other scene test changes behaviour.

Verified: `pytest tests/ut/py` 1937 passed / 14 skipped, the whole
`tests/st/worker/collectives` suite green in daily mode (`--manual include`), and
the per-PR sim gate (`--manual exclude`) green on a2a3sim and a5sim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Daily full-scene run #31722222789 exposes manual PA regressions and sim lane poisoning

2 participants