feat(cli): say when the process target stops matching (audit F17) - #67
Merged
Merged
Conversation
A targeted process that exits mid-run was invisible from the command line. Measured 2026-07-28 on a real capture (elevated, real WinDivert, probe narrowed to --target <pid> --dst-ip 8.8.8.8 --dst-port 53 --syn-drop 100): the target was impaired correctly, then killed and restarted under a new pid, after which 5 of 5 fresh connections went untouched - and the only targeting line in the entire run was the one printed at start. Exit 0. The GUI has always shouted about this (_refresh_target re-reads the verdict on every tick), so the blind spot was exactly on the CI/CD side. - _targeting_state(engine) plus transition logging in _report_loop: warn on losing the target, info on getting it back. Reading `matched` is a plain bool on the live ProcessTargeting, so the loop can ask on every pass. - end of run: warn when a target was set, traffic was captured and nothing was in scope, plus an "In scope: X of Y captured packets" summary line. Guarded on `seen` - with no traffic at all the capture filter is the story and --min-packets is the flag that tells it. - no new exit code and no new flag: a quiet target is a legitimate run, and an assertion would change the exit-code contract under existing users. The NDJSON sample schema is untouched; the new line is text-channel only. - two guards in tests/test_cli_runtime.py, five mutants, all caught. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this closes (audit F17)
A process target that stops matching mid-run was invisible from the CLI. Measured
2026-07-28 on a real capture (elevated, real WinDivert), with the probe narrowed to
--target <pid> --dst-ip 8.8.8.8 --dst-port 53 --syn-drop 100so nothing else on themachine could be touched:
exit=OKOK FAIL FAIL FAILin 3 of 3 livesSo the name path recovers on its own and a restart costs exactly one connection (the
one opened before the process owns any socket - the
_pidslimit F16 already documents).The PID path never recovers, because that id is gone. Either way the CLI said nothing.
gui/app.py::_refresh_targetre-reads the verdict on every tick and raises a banner, sothe blind spot was precisely on the CI/CD side (convention 18).
Change
_targeting_state(engine)+ transition logging in_report_loop:warnon losing thetarget,
infoon getting it back.matchedis a plain bool on the liveProcessTargeting- no lock, no syscall - so the loop asks on every pass. Sampled, notcontinuous, and the comment says so.
warnwhen a target was set, traffic was captured and nothing was inscope, plus
In scope: X of Y captured packetsin the text summary.seen: with nothing captured at all the capture filter is the story and--min-packetsis the flag that tells it.Deliberately not done
No new exit code, no
--min-scoped. A target with no traffic of its own is a legitimaterun, and an assertion would change the exit-code contract under everyone already running
one.
counters.scoped_seenis in the JSON summary for a pipeline that wants to assert onit itself. The NDJSON
sampleschema (frozen contract) is untouched.Verification
python -m pytest tests- 717 passed, 0 failed on an elevated shell (was 715).python smoke_gui.py- OK.test_repo_conventions,test_cli_docs,test_code_hygiene,test_layering).fired every pass instead of on change; zero-scope warning removed; its
seenguardremoved; the
In scopeline removed.🤖 Generated with Claude Code