Skip to content

Keep setup PTY test children within fixture lifetime - #1062

Merged
JacobStephens2 merged 3 commits into
mainfrom
issue-736
Oct 22, 2026
Merged

JacobStephens2 merged 3 commits into
mainfrom
issue-736

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Keep Linux setup PTY test children from outliving their fixture, even when an inherited master remains open.

run_terminal
  arm Linux parent-death SIGKILL and verify parent still exists
  attach controlling PTY and drive setup
  on return/unwind: kill and reap the exact child
  on fixture death: kernel ends the child

The isolated supervisor covers successful completion, assertion unwinding, timeout, SIGKILL, and SIGKILL with a retained PTY master. It adopts/reaps recorded children and owns its temporary subtree. Setup's production terminal and interruption code is unchanged.

macOS retains Drop cleanup and last-master hangup. The stronger retained-master guarantee is Linux-only; the macOS lifecycle supervisor test is explicitly skipped with that limit named.

Closes #736

Evidence

  • Before: cargo test --test setup_lifetime setup_ends_after_sigkill_even_with_an_inherited_pty_master -- --nocapture failed: owned setup child ... survived its fixture after five seconds. The test cleaned up its owned setup/keeper processes. The plain SIGKILL test already passed before the fix and is retained as a guard; the historical incident's original cause remains unknown.
    After: cargo test --test setup_lifetime passes all five lifecycle cases; one ignored test is the subprocess entry point. The retained-master regression remains in the suite.
  • cargo test --test setup: 30 passed, including existing interruption and terminal-restoration assertions.
  • cargo check --tests, cargo clippy --all-targets -- -D warnings, and cargo fmt --check: passed.
  • /usr/bin/time -p scripts/affected-tests main selected cargo nextest run: 2,228 passed, 3 skipped. Total wall time 1,111.07s, including 59.87s compilation; test execution 1,050.139s. This run started before the final duplicate-code extraction; the five lifecycle cases, targeted clippy, and formatting were rerun successfully on the final head (452afd1).
  • CI passed on final head 452afd1: Linux Rust suite, macOS gate, Console, and site checks.

Test seams

  • Scenario::run_terminal / run_terminal_bounded: real setup PTY child lifetime after fixture completion, assertion unwinding, bounded timeout, and SIGKILL of a separate fixture process; observe and reap exact owned PIDs.

Review coverage

Reviewed against main (cd7119f6ee1ea4570de24f2dd79cba319095c0ed) with independent Standards and Spec reviewers. Both read all four changed files: docs/testing.md, tests/setup_lifetime.rs, tests/support/child_lifetime.rs, and tests/support/mod.rs. Unread changed files: none. Generated-output exclusions: none.

Standards raised one nonbehavioral Duplicated Code finding; addressed by Fixture::kill_harness, confirmed by the reviewer. Spec raised no findings. Final reports, including each axis's files-read list, are saved in .thirdshift-review-GjlQmn/standards.md and .thirdshift-review-GjlQmn/spec.md in the worktree.

Unaddressed findings

Standards

None.

Spec

None.

Security

None.

Security review outcome

No unaddressed introduced findings.

Merge Danger

Door: two-way

Blast Radius: Tests

Linux terminal-fixture child lifetime and its regression supervisor; no production behavior or dependencies change.

Built with codex · gpt-6.1-sol · xhigh

@JacobStephens2
JacobStephens2 merged commit 1f564a2 into main Oct 22, 2026
7 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-736 branch October 22, 2026 08:02
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent setup PTY test children from surviving a dead test harness

1 participant