Skip to content

log_parsers: isolate mocha failure epilogues from test results - #288

Open
Pybsama wants to merge 1 commit into
huggingface:mainfrom
Pybsama:fix/mocha-epilogue-isolation
Open

Pybsama wants to merge 1 commit into
huggingface:mainfrom
Pybsama:fix/mocha-epilogue-isolation

Conversation

@Pybsama

@Pybsama Pybsama commented Dec 1, 2026

Copy link
Copy Markdown

Summary

  • Prevent indented - ..., numbered, or check-mark lines inside Mocha failure epilogues from prematurely exiting epilogue mode, emitting bogus test results, or turning subsequent 2) Suite epilogue headers into FAILED tests.
  • Reset the Mocha suite stack at epilogue boundaries, ignore N pending summary lines, and require a valid spec-reporter suite chain or root-level test line to exit the final failure block so diff lines (such as indent-2 { / }) cannot leak into a subsequent Mocha run in the same log.
  • Apply the same fix in lockstep to both src/repo2rlenv/log_parsers/jest_parser.py and the standalone verifier in src/repo2rlenv/pipelines/_pr_runtime_verifier.py.

Test plan

  • Added 4 regression tests (8 parametrized cases across canonical and standalone parsers) in tests/test_mocha_output.py covering dash/numbered/check-mark lines inside multi-failure and single-failure epilogues, indent-2 diff lines and N pending summaries before a second run, and nested second runs after epilogue diffs.
  • pytest -q tests/test_mocha_output.py tests/test_log_parsers.py tests/test_pr_runtime_verifier.py tests/test_pipeline_contract.py tests/test_pipeline_pr_runtime.py tests/test_node_runner.py — 222 passed.
  • ruff check . and ruff format --check . — passed.

Out of scope

  • Previously exported task bundles embed their own copy of tests/verifier.py; those tasks would need regeneration to pick up the updated standalone parser.

In mocha's spec reporter epilogue, indented diff or error lines starting
with `- ` (or nested numbered items) matched `_MOCHA_TEST_RE` and
prematurely cleared `in_epilogue`, emitting spurious test entries and
recording subsequent `2) Suite` epilogue headers as failed tests. Lines
such as `N pending` or indent-2 diff braces also remained on `suites`
and could prefix tests from a later mocha run in the same log.

Reset `suites` on epilogue entry, skip `N pending` summary lines, keep
the parser in epilogue mode until all expected numbered failure headers
are consumed, and only exit the final failure block on a valid
spec-reporter suite chain or root-level test line. Keep the standalone
verifier parser in lockstep.

This branch has not been deployed

No deployments
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.

1 participant