test: make startup watcher launch control deterministic #2315

Merged
R0Y00 merged 1 commit from upstream-pr/2323 into main 2026-11-25 12:22:08 +00:00
R0Y00 commented 2026-11-25 12:17:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:17:15Z.


The Linux launcher check intermittently missed the "watcher without --render" mutant when the debugger stub exited before the background watcher reached Python. Sleeping after the launcher exited could not recover the marker.

The negative control now marks the watcher launch synchronously in the copied shell script, after it captures the child's PID. The existing markers still check real watcher startup and shutdown. Production launcher behavior is unchanged.

Validation on Ubuntu 22.04 under WSL at df121178: python3 -B tests/startup_run_sh_check.py -v detected all mutants and ended with startup run.sh: 0 failed. The hosted occurrence was in #2084.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6604285609 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2323). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T12:17:15Z. --- The Linux launcher check intermittently missed the "watcher without --render" mutant when the debugger stub exited before the background watcher reached Python. Sleeping after the launcher exited could not recover the marker. The negative control now marks the watcher launch synchronously in the copied shell script, after it captures the child's PID. The existing markers still check real watcher startup and shutdown. Production launcher behavior is unchanged. Validation on Ubuntu 22.04 under WSL at df121178: `python3 -B tests/startup_run_sh_check.py -v` detected all mutants and ended with `startup run.sh: 0 failed`. The hosted occurrence was in #2084.
tedin7 commented 2026-11-25 12:25:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:25:25Z.

Review: COMMENTED


Review of head df12117800099ef70c0abc423359d3e7849dd05c (test-only change, tests/startup_run_sh_check.py).

Findings: 0 P1, 0 P2. Clean-room: no external code, no ISA content.

The fixed time.sleep(1) is replaced by a marker file (watch-spawn.flag) written by the test copy of run.sh right after watcher=$!. It is written by the parent shell, so it no longer races with the stub debugger exiting early. replace() raises if the anchor is not found exactly once, so a change to run.sh fails loudly instead of silently disabling the check.

Commands executed locally:

  • python3 tests/startup_run_sh_check.py (3 runs): startup run.sh: 0 failed each time
  • python3 tests/docs_links_check.py: 18 files, 451 links OK
  • python3 tests/bidi_controls_check.py: no bidirectional controls
  • git diff --check origin/main...HEAD: clean
  • Mutation: in tools/startup/run.sh the watcher condition changed from [ -n "$translate" ] && [ -n "$render" ] to [ -n "$translate" ]. The test FAILED as expected: FAIL stub exit 0 --translate: the translator started without --render --translate (1 failed). Restored with git checkout -- ..
  • CI: Build and test on Windows, Linux Python checks and fixture assembly all SUCCESS.

Only a .py file is touched, so the pure-Python fast path applies.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057556367 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2323#pullrequestreview-6057556367). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:25:25Z. **Review:** COMMENTED --- Review of head `df12117800099ef70c0abc423359d3e7849dd05c` (test-only change, `tests/startup_run_sh_check.py`). Findings: 0 P1, 0 P2. Clean-room: no external code, no ISA content. The fixed `time.sleep(1)` is replaced by a marker file (`watch-spawn.flag`) written by the test copy of `run.sh` right after `watcher=$!`. It is written by the parent shell, so it no longer races with the stub debugger exiting early. `replace()` raises if the anchor is not found exactly once, so a change to `run.sh` fails loudly instead of silently disabling the check. Commands executed locally: - `python3 tests/startup_run_sh_check.py` (3 runs): `startup run.sh: 0 failed` each time - `python3 tests/docs_links_check.py`: 18 files, 451 links OK - `python3 tests/bidi_controls_check.py`: no bidirectional controls - `git diff --check origin/main...HEAD`: clean - Mutation: in `tools/startup/run.sh` the watcher condition changed from `[ -n "$translate" ] && [ -n "$render" ]` to `[ -n "$translate" ]`. The test FAILED as expected: `FAIL stub exit 0 --translate: the translator started without --render --translate` (`1 failed`). Restored with `git checkout -- .`. - CI: `Build and test on Windows`, Linux Python checks and fixture assembly all SUCCESS. Only a `.py` file is touched, so the pure-Python fast path applies. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 13:00:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2315
No description provided.