feat(tools): emit skip policy decisions as JSON #12750
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12750"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by StoneDC on 2026-10-29T07:36:20Z.
What
Add optional JSON output to the skip-policy checker. The report includes the job policy, sorted skipped tests, raw output, occurrence count, expected status and unexpected names. It uses the same policy decisions and exit status as text mode.
Synchronize with main
090f57166adb9692d27d16662a89ccc33a502406. Duplicate JUnit testcase names are rejected in both text and JSON modes with exit 2. The previous duplicate-grouping regression is updated to assert this current validation rule. The merge retains current raw-socket, shared-memory, CTest-status and report-validation handling.Tested
At
b187072b4fe0b3af690f847dcfe681b0367ea837, Windows and Linux with Python 3.12 and 3.14 each passed both registered CTest groups (44 unittest cases, zero skips). The groups cover policy parsing and real CTest-generated JUnit reports. Regressions compare text/JSON errors for duplicate names, full JSON objects for raw-socket and shared-memory limitations, unexpected reasons, CTest skip status, CLI errors and both platform policies.Current-main conventions with the complete description, Python 3.9 grammar, script registration, whitespace and merge checks pass. Hosted checks for the new revision are tracked on the PR. Checks
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T10:49:05Z.
Review: COMMENTED
Reviewed exact head
b14b53e233on macOS arm64 against current main1db077e876:git merge-treeis clean andgit diff --checkis clean.test_check_skips.pyandtest_check_skips_ctest.pyboth pass on Python 3.13.13 and 3.9.6. On Homebrew 3.15 they fail, and main's copies fail the same way, because that interpreter's pyexpat is broken on this machine. That failure is environmental and has nothing to do with this PR.Policy decisions are correct for both jobs. I ran a report containing the duplicate names
a(one expected occurrence, one unexpected) andc(two unexpected occurrences). JSONexpectedmatches text mode, rc is 1 in both, and--json --listis rejected as described.Two points about the duplicate-name behaviour the description promises:
Nothing tests it. I made three mutations together in
main():"occurrences": 1,"output": outputs[-1], and"unexpected": sorted(set(unexpected)). Both modules still pass. The current tests never put a name in a report twice, so the grouping, the count and the "unexpected if any occurrence fails" rule are unpinned. A single report with<testcase name="a">skipped twice (one reason expected, one not) would cover all three.unexpectedrepeats grouped names. For the report above,skipshas one entry per name (a,b,c), butunexpectedis["a", "c", "c"]. This matches text mode, which printserror: c skippedtwice. Still, a JSON consumer gets two different cardinalities in one document. The cleanest fix is probably to state which one is intended and pin it in the test: eitherunexpectedlists occurrences (so document it), or it lists names (sorted(set(unexpected))).Minor: the
outputstrings keep the doubled prefix thatskips()builds ("skipped, skipped, no display\n\n"). That comes from main's internal representation, not this PR, but it is now part of the JSON contract. If consumers are meant to read the reason, areasonfield like the one--listderives might be the better thing to expose.No blocking issue in the policy logic.