Repository navigation
Bring the RegressionTests Python Tools Under the Interrupt Rule - #1300
Conversation
A shared interrupts.py implements CODESTYLE.md "Interrupts in Python" once: one SIGINT/SIGTERM handler, one KeyboardInterrupt catch that names the signal and re-raises it, a bounded child stop, run_child for every subprocess so a docker CLI gets SIGTERM it proxies to its container, and an atomic write beside the target. Every tool's state file and the synthesizer's outputs go through a temporary sibling and os.replace. Mid-run signal tests cover locate_issue, reduce_corpus and synthesize. The harness tests move to test_regression_harness.py, skip off Linux, and gain the wrong-mountpoint and non-clone-origin refusal cases. Docs/ClosedCaptions.md states the TS file as the consequence it is. Refs #1293. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
integration-test.sh mounts only RegressionTests/synthetic, so the helper lives there and the top-level tools add that directory to sys.path. A new test runs the synthetic scripts from a copy holding only synthetic/. The partial-file test now covers a child that writes the partial itself, each signal subtest cleans up its own process group, and a new target takes the umask-masked mode write_text gave it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoMake RegressionTests Python tools interrupt-safe
AI Description
Merge Risk
|
Code Review by Qodo
1. Three tools lack a mid-run signal test
|
There was a problem hiding this comment.
🟡 Changes recommended
The regression tests do not verify SIGTERM delivery for the locate_issue and synthesize cases, so a SIGKILL regression could still pass undetected.
1 open issue
What changed in this PR
This pull request applies shared interrupt handling and atomic-write behavior across the RegressionTests Python tooling, improving signal re-raising, child-process cleanup, and protection against partial state.
Changes:
- Adds shared signal, child-process, and atomic-write helpers under
RegressionTests/synthetic/. - Migrates corpus, reduction, catalog, result-checking, locating, and synthetic-generation tools to the shared helpers.
- Expands harness, interrupt, mountpoint, clone-origin, and synthetic-directory test coverage.
- Clarifies the related CCExtractor temporary-file behavior in the documentation.
| File | Description |
|---|---|
| RegressionTests/tests/test_regression_harness.py | Separates harness tests and adds Linux-only signal, mountpoint, clone-origin, and synthetic-directory coverage. |
| RegressionTests/tests/test_reduce_corpus.py | Updates reduction tests and subprocess mocks for the shared child-process runner. |
| RegressionTests/tests/test_interrupts.py | Adds atomic-write, child-cleanup, signal, and synthetic-directory tests. |
| RegressionTests/tests/test_help.py | Maintains help and injector-focused tests after harness coverage was extracted. |
| RegressionTests/synthetic/synthesize.py | Routes media-tool processes through shared interrupt handling and promotes partial outputs atomically. |
| RegressionTests/synthetic/interrupts.py | Provides shared signal handling, bounded child termination, and atomic-write primitives. |
| RegressionTests/synthetic/hevc_nal.py | Applies shared interrupt handling and atomic output writes to the injector entry points. |
| RegressionTests/reduce_corpus.py | Uses shared child execution, atomic catalog writes, and interrupt-aware entry handling. |
| RegressionTests/README.md | Documents the shared interrupt helper and synthetic-directory integration layout. |
| RegressionTests/locate_issue.py | Adds interrupt-aware child cleanup and atomic rule-file writes. |
| RegressionTests/corpus_common.py | Routes media-tool subprocesses through the shared child runner. |
| RegressionTests/check_results.py | Makes expected-result writes atomic and uses shared interrupt-aware entry handling. |
| RegressionTests/catalog_corpus.py | Makes catalog generation atomic and uses shared interrupt-aware entry handling. |
| RegressionTests/audit_physical.py | Makes augmented catalog updates atomic and uses shared interrupt-aware entry handling. |
| Docs/ClosedCaptions.md | Clarifies the temporary TS-file consequence of CCExtractor input handling. |
Review effort: Lite
The atomic write resolves its target first, so a symlinked state file keeps its link. synthesize reserves its partial sibling with mkstemp, so it never overwrites or deletes a file it did not create. A test drives a KeyboardInterrupt through the atomic write, the only thing audit_physical, catalog_corpus and check_results hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One TERM-trapping stub serves all three cases, so a regression to SIGKILL fails locate_issue and synthesize as it already failed reduce_corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
Action not completed
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
@qodo-free-for-open-source-projects please dismiss finding 1 ("Three tools lack a mid-run signal test"). audit_physical, catalog_corpus and check_results hold no child process and no long-lived path. The one thing each holds is the temporary file inside |
I couldn't dismiss finding 1 ("Three tools lack a mid-run signal test") because I can't match it to a finding ID. The findings index for this PR is empty, so I have no stable ID to pass to the dismiss action. Your argument is substantive.
|

Summary
Brings the RegressionTests Python tools under the CODESTYLE.md "Interrupts" and "Interrupts in Python" rules, which #1294 refreshed from the hub, and folds in the review items #1293 lists. #1293 stays open until the promotion carries this to
main.RegressionTests/synthetic/interrupts.pyimplements the rule once. That covers the single SIGINT/SIGTERM handler, oneKeyboardInterruptcatch that names the signal and re-raises it, and a bounded child stop. It addsrun_childfor every subprocess, so adockerCLI receives SIGTERM, which it proxies to its container, rather thansubprocess.run's SIGKILL. It also provides an atomic write beside the target. It lives undersynthetic/because the integration run mounts only that directory, and the top-level tools add it tosys.path.audit_physical,catalog_corpus,check_results,locate_issueandreduce_corpuswrite their state files atomically and run every child throughrun_child.synthesizehas each child write a.partialsibling, then replaces the target with it.hevc_nal.run_injectormoves off its own SIGTERM-only,exit 143/130shape.locate_issue,reduce_corpusandsynthesize. Each asserts death by the signal, one interrupt line with no traceback, the stub child stopped by SIGTERM, and nothing left behind.SyntheticDirectoryTestsruns the synthetic scripts from a copy holding onlysynthetic/, as the integration container does.test_regression_harness.pyand skip unless on Linux. They gain the wrong-mountpoint and non-clone-origin refusal cases, andDocs/ClosedCaptions.mdstates the TS file as the consequence it is.Not Covered
audit_physical,catalog_corpus,check_resultsand the injectors hold only a momentary temporary file, so the rule owes them no mid-run signal test.Verification
frontierpasses. The first found seven issues: the integration import break, two comment-case lines, an untested partial cleanup, leaking subtests, a fixed file mode, and a path filter that the move made moot. The second found a README omission. All are fixed, and the third found nothing.🤖 Generated with Claude Code