Skip to content

test(gui): pin the target banner to the process, not to the field - #68

Merged
donislawdev merged 1 commit into
masterfrom
test/gui-banner-when-the-target-process-vanishes
Jul 28, 2026
Merged

test(gui): pin the target banner to the process, not to the field#68
donislawdev merged 1 commit into
masterfrom
test/gui-banner-when-the-target-process-vanishes

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Why

Stacked on #67 (--base is the chunk-1 branch, so review that one first).

test_a_gui_session_keeps_the_target_banner_honest only ever moves the expression: the user types something that matches nothing, then something that does. The case a tester actually hits moves the other end - the field is left alone and the targeted program exits, or a harness restarts it onto a new pid.

Nothing covered that, and the handoff note had concluded from reading the code that the verdict was taken only at session start. It is not: App._refresh_target re-reads targeting.matched on every tick, and only the APPLY half is gated on the expression having changed. Correct behaviour, zero guards - which in this project is how a true sentence turns into a false one a few sessions later.

The guard

Real engine, real resolver, SyntheticDivert, injected FakeTable. It empties the socket table under a running session and asserts _applied_target did not move (otherwise it decays into the old test), then that the banner rises, then that it comes back down when the process reappears under a new pid with the same name - the name-targeting recovery measured 2026-07-28 against a real capture.

Mutants

Three, all caught, each on its intended assertion:

mutant caught by
_refresh_target reads the verdict only when the expression changed (the assumed behaviour) a target that died must raise the banner
ProcessTargeting.matched forced to True a target that died must raise the banner
the banner is never taken back down the banner outlived the problem

Verification

  • python -m pytest tests - 718 passed, 0 failed (elevated shell).
  • python smoke_gui.py - OK.
  • Test-only, so CHANGELOG-INTERNAL.md only (convention 39).

🤖 Generated with Claude Code

The existing banner test only ever moves the EXPRESSION: the user types
something that matches nothing, then something that does. The case a tester
actually hits moves the other end - the field is left alone and the targeted
program exits, or a harness restarts it onto a new pid.

Nothing covered that, and a handoff note had concluded from reading the code
that the verdict was taken only at session start. It is not: _refresh_target
re-reads it on every tick, and only the APPLY half is gated on the expression
having changed. That behaviour was correct and unguarded, which in this
project is how a true sentence turns into a false one a few sessions later.

- empties the socket table under a running session and asserts _applied_target
  did NOT move, so this cannot decay into the old test
- then the banner rises, then it comes back DOWN when the process reappears
  under a NEW pid with the same name - the recovery measured 2026-07-28
  against a real capture
- three mutants, all caught; the first restores the assumed "only at session
  start" behaviour and goes red, which is the point of the guard

Test-only, so CHANGELOG-INTERNAL only (convention 39).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Base automatically changed from fix/cli-says-when-the-target-stops-matching to master July 28, 2026 17:30
@donislawdev
donislawdev merged commit 62fbc66 into master Jul 28, 2026
5 checks passed
@donislawdev
donislawdev deleted the test/gui-banner-when-the-target-process-vanishes branch July 28, 2026 17:30
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.

1 participant