-
Notifications
You must be signed in to change notification settings - Fork 0
test: fail closed on skipped pytest evidence #1733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
36
commits into
main
Choose a base branch
from
fix/no-hidden-pytest-outcomes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
33ce556
test: reject hidden pytest skip outcomes
seonghobae 3131f27
test: fail closed on skipped pytest outcomes
seonghobae 9b44a76
docs: record fail-closed pytest evidence
seonghobae 8380151
test: expose non-execution counts in pytest logs
seonghobae 1adf41e
test: preserve primary pytest failure status
seonghobae cbe0d83
fix: preserve primary pytest failure classification
seonghobae c2d4ca1
test: classify atomic-write capability without skipping
seonghobae e913a0d
test: require Rust parity capability instead of skipping
seonghobae de7bf9d
test: require native multigroup Rust evidence
seonghobae 85ed9ee
test: require native multilevel Rust evidence
seonghobae d86a48b
test: make marginal parity capability evidence explicit
seonghobae 42b723b
test: require Rust CLI backend evidence
seonghobae 4e788a6
test: require marginal ABI capability evidence
seonghobae 685aaaa
test: require Rust fit-pipeline evidence
seonghobae 71d8646
test: require Rust JMLE ownership evidence
seonghobae deb5bb9
test: require production Rust backend evidence
seonghobae b34c2c4
test: require Rust robustness parity evidence
seonghobae eb04946
test: prove missing atomic-write capability fails closed
seonghobae 5dc238d
test: make atomic-write capability RED deterministic
seonghobae 3ab1ebf
test: fail closed when atomic-write primitives are unavailable
seonghobae c17462e
docs: record fail-closed atomic-write capability evidence
seonghobae 1a75be8
test: prove late plugin cannot erase non-execution failure
seonghobae 6430de9
fix: make pytest non-execution enforcement final
seonghobae b66a970
docs: record final pytest outcome enforcement
seonghobae 10b1e5d
test: fail closed on missing extended precision
seonghobae 3c1ed4e
test: fail closed on missing longdouble evidence
seonghobae c9adf57
docs: record extended-precision fail-closed evidence
seonghobae 584d213
test: fail closed on missing WLE precision evidence
seonghobae f928b17
docs: include WLE precision fail-closed evidence
seonghobae e169e93
test: fail closed on missing CDM precision evidence
seonghobae 1bb4a27
docs: include CDM precision fail-closed evidence
seonghobae 102e116
test: fail closed on missing 2PL precision evidence
seonghobae 07cc438
docs: include 2PL precision fail-closed evidence
seonghobae bf15b62
test(personfit): require Monte Carlo acceptance execution
seonghobae 1d3016b
fix(personfit): execute deterministic Monte Carlo acceptance
seonghobae f7ecedd
docs(changelog): record person-fit Monte Carlo execution repair
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Fail-closed pytest outcome accounting | ||
|
|
||
| ## Fixed | ||
|
|
||
| - Make repository pytest evidence non-passing whenever collection or execution records a skipped, expected-failure, or unexpected-pass outcome, so missing Rust/GPU/platform capability cannot be reported as a successful scientific or package gate. Clean all-executed runs retain their original status, and missing terminal outcome accounting fails closed. | ||
| - Make descriptor-relative atomic-write capability evidence fail closed when any required POSIX primitive is unavailable instead of returning normally from the three atomic-write tests and recording false passes. | ||
| - Enforce the non-execution verdict after ordinary `pytest_sessionfinish` implementations complete, so a later plugin cannot overwrite skipped evidence back to a successful process exit; a pre-existing stronger non-success exit remains non-passing rather than being erased. | ||
| - Make extended-precision population-label, Brennan-Kane mastery-cut, WLE control-admission, CDM response-admission, and compensatory 2PL response-admission evidence fail explicitly when the host `longdouble` is not wider than binary64, instead of recording those repository-owned losslessness checks as passing skips. | ||
| - Execute the existing deterministic 500-replication person-fit U3 reversed-respondent acceptance in the normal Rust suite instead of leaving it behind `#[ignore]`; its fixed-seed design, n=60, I=20, production `person_fit_np` call, and >=95% detection criterion remain unchanged. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """Fail-closed accounting for pytest outcomes that do not execute assertions.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Mapping, Sized | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| _NON_EXECUTION_BUCKETS = ("skipped", "xfailed", "xpassed") | ||
|
|
||
|
|
||
| def _non_execution_counts(stats: Mapping[str, Sized]) -> dict[str, int]: | ||
| """Return non-zero skip/xfail/xpass counts from pytest terminal statistics.""" | ||
| return { | ||
| bucket: len(stats.get(bucket, ())) | ||
| for bucket in _NON_EXECUTION_BUCKETS | ||
| if len(stats.get(bucket, ())) > 0 | ||
| } | ||
|
|
||
|
|
||
| def _format_non_execution_counts(counts: Mapping[str, int]) -> str: | ||
| """Render deterministic terminal evidence for prohibited non-execution states.""" | ||
| detail = ", ".join(f"{bucket}={counts[bucket]}" for bucket in _NON_EXECUTION_BUCKETS if bucket in counts) | ||
| return f"non-execution outcomes are non-passing: {detail}" | ||
|
|
||
|
|
||
| def _enforce_no_hidden_outcomes(session: object, terminalreporter: object | None) -> None: | ||
| """Fail a successful invocation on non-execution without erasing stronger failures.""" | ||
| if session.exitstatus != pytest.ExitCode.OK: | ||
| return | ||
| if terminalreporter is None: | ||
| session.exitstatus = pytest.ExitCode.TESTS_FAILED | ||
| return | ||
| counts = _non_execution_counts(terminalreporter.stats) | ||
| if counts: | ||
| session.exitstatus = pytest.ExitCode.TESTS_FAILED | ||
|
seonghobae marked this conversation as resolved.
coderabbitai[bot] marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| """Repository-wide pytest governance for fail-closed test execution.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Generator | ||
|
|
||
| import pytest | ||
|
|
||
| from _outcome_policy import ( | ||
| _enforce_no_hidden_outcomes, | ||
| _format_non_execution_counts, | ||
| _non_execution_counts, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.hookimpl(hookwrapper=True, tryfirst=True) | ||
| def pytest_sessionfinish( | ||
| session: object, | ||
| exitstatus: int, | ||
| ) -> Generator[None, None, None]: | ||
| """Enforce non-execution policy after every ordinary session-finish hook.""" | ||
| original_exitstatus = exitstatus | ||
| yield | ||
|
|
||
| if original_exitstatus != pytest.ExitCode.OK and session.exitstatus == pytest.ExitCode.OK: | ||
| session.exitstatus = original_exitstatus | ||
|
|
||
| terminalreporter = session.config.pluginmanager.get_plugin("terminalreporter") | ||
| if session.exitstatus == pytest.ExitCode.OK and terminalreporter is not None: | ||
| counts = _non_execution_counts(terminalreporter.stats) | ||
| if counts: | ||
| terminalreporter.write_sep("=", _format_non_execution_counts(counts)) | ||
| _enforce_no_hidden_outcomes(session, terminalreporter) |
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.