feat(tools): emit read-only PR label plans as JSON #12768
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12768"
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-29T08:39:52Z.
What
Add read-only
--dry-run --jsonPR label plans; preserve normal text mode and reject JSON without dry-run before accessing a repository.Pin whole JSON reports for --all and --pr: repository, success/error PR numbers, add/remove labels, posted-comment suppression, markers and failed items. Use deliberately descending set iteration so removing a sort fails independently of hash seed. The test's GitHub adapter is mocked and dry-run remains mandatory; it sends no live label edits or comments. Production behavior is unchanged by this test hardening.
Tested
Exact tested head:
29dd548a18be4156364094598d384e42d923d2fd; observed main snapshot:ba5b5330b37724bca4b99f30faab504653635a04. Upstream may advance after that recorded snapshot.Windows 11 / Python 3.14.3 / MinGW GCC 15.2 / CMake 4.3.1 and non-root WSL Ubuntu 26.04 / Python 3.14.4 / GCC 15.2 / CMake 4.2.3. Ninja Release relinker-only configurations with BUILD_TESTING=ON; Linux uses exact source archives on its native filesystem.
^pr_labels$with --parallel 4 -V: 23 Python cases on each OS, all relevant groups passed. Slowest group 0.23 s Windows / 0.13 s Linux. No CTest group is skipped.Current-main conventions with this complete description and whitespace checks pass. Python 3.9 grammar checks pass for changed Python files. Recorded main and the original published PR head are ancestors of this tested branch. New hosted jobs run after publication; old-head passes are not substituted for the new head's results.
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-29T11:14:24Z.
Review: COMMENTED
Reviewed head
ace7b9a6a1on macOS arm64.Result: the change is correct, but the new tests leave most of the JSON row contents unchecked.
tools/tests/test_pr_labels.pypasses on Python 3.9.6, 3.13 and 3.15 (22/22). When the file runs against main'spr_labels.py, both JSON tests that touch the output fail as expected.git merge-treeagainst current mainba5b5330b3merges cleanly.check_conventions --headandgit diff --checkare clean.pr_overlap --branchprobed 1392 PRs and found 2 that share files; both merge cleanly with no overlap.Mutation check. I applied 15 single-line mutants to the new code in
main()and ran the PR's tests on each. These 5 still pass:"remove": []comment_markeralways set toMARKER, even when no comment would be posted"number": 0in success rows"number": 0in error rows"repository": ""A sixth,
"add": list(add), passes or fails depending onPYTHONHASHSEED, because the test sets only have two elements. The only remaining survivor issort_keys=Trueremoved, which changes byte layout but not content.The test below compares the whole JSON object for
--all(a remove-only row, an add row whose comment is already posted so the marker isNone, and an error row) and for--pr. It returns sets that iterate in descending order, so droppingsorted()fails on every hash seed. With it, 14/15 mutants fail under seeds 1–6. It passes on head (23/23, ×3 Pythons) and fails on main.Non-blocking: in text mode a failed item ends with
sys.exit(message), while JSON mode returns 1. Both exit with status 1, so that matches.