Skip to content

fix(gui): apply the target field only through Apply changes - #211

Merged
donislawdev merged 1 commit into
masterfrom
fix/target-applies-only-on-apply
Sep 28, 2026
Merged

donislawdev merged 1 commit into
masterfrom
fix/target-applies-only-on-apply

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Summary

Every GUI tick pushed the raw Target process field to the running engine, without Apply changes:

  • Clearing the field to type a new name switched process targeting off. So did stopping halfway through an expression such as re:^fire(.
  • With targeting off, every connection in the traffic filter was impaired, and the unbounded-impairment warning never ran.
  • The note under the field said the reverse: "traffic is NOT being impaired".

This broke the rule the README states for the whole form: nothing applies itself.

The cause is a leftover of the old background target refresher. START and Apply changes already applied the target properly, through apply_settings: validated, announced, and followed by the unbounded warning. The tick added a second, unvalidated path on top of that. After START it also re-applied the field instead of the validated start settings.

Changes (gui/app.py)

  • _refresh_target becomes _refresh_target_verdict. It reads engine.targeting() and never applies anything. _snapshot_target and _target_expr are removed.
  • _applied_target now means "what START / Apply changes applied". It is set from the validated settings in _finish_start and apply_if_running. The "apply needed" log line after a row action is now true for the target field too.
  • New note, fields.target_all_traffic (en/pl/zh). It shows when a target was applied but cannot be used, for example no psutil, or an expression that narrows nothing. In that case every connection is impaired, and the note says so instead of the opposite.
  • The note clears when the session stops.

Tests

Rewritten on purpose, because they pinned the tick-side apply or called the removed methods:

  • test_a_row_action_fills_the_form_and_does_not_reach_a_running_engine now ticks. It never did, so it stayed green while the rule it names was broken on every tick.
  • test_a_gui_session_keeps_the_target_banner_honest sets targets through Apply. It asserts that an emptied or a half-typed field reaches nothing through 0.4 s of ticks, that no targeting error is logged, and that Apply is lit.
  • The dies-mid-session, verdict-thread, matches-nothing and tk-variable tests move to the new API. The two session tests share one prelude, _TARGET_SESSION.
  • New: test_a_target_that_cannot_be_used_says_everything_is_impaired, covering START, Apply of an empty field, Apply again, and STOP.

Mutation proof: five new entries, all caught.

  • the tick pushes the field again
  • the new note reverts to "no match"
  • START forgets the applied target
  • Apply forgets the applied target
  • the note outlives STOP

All 37 gui: and 7 ratchet: entries were run and caught.

Ratchets move down with the removed code: the file ceiling from 1166 to 1150, App methods from 96 to 95, App attributes from 80 to 79, and silent handlers in gui/app.py from 13 to 12.

Run locally:

  • the guards with evidence for the changed files, plus the convention set (16 files, 337 passed);
  • ruff and mypy;
  • the changelog guard.

Not run locally: the full suite (it runs here on Linux and Windows).

🤖 Generated with Claude Code

Every tick pushed the raw "Target process" field to the running engine.
Clearing the field to type a new name, or a half-typed expression such
as re:^fire(, switched process targeting off, so every connection in the
filter was impaired - without the unbounded-impairment warning and with
a banner saying traffic was NOT being impaired.

- The tick only reads the verdict on what START / Apply applied; the
  field snapshot and the tick-side apply are gone.
- New banner text when an applied target cannot be used (no psutil, an
  expression that narrows nothing): every connection is impaired.
- The banner clears when the session stops.
- Tests that pinned the tick-side apply were rewritten; the row-action
  guard now ticks. Five new mutation entries, all caught. The class and
  file ratchets move down with the removed code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 8edd9aa2-48de-4526-8f6c-2bce5eec6545

📥 Commits

Reviewing files that changed from the base of the PR and between 7e47f4a and 3d9094b.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • beantester/gui/app.py
  • lang/en.json
  • lang/pl.json
  • lang/zh.json
  • tests/test_code_hygiene.py
  • tests/test_code_shape.py
  • tests/test_failsafe.py
  • tests/test_gui_release_fixes.py
  • tests/test_gui_state.py
  • tests/test_mutation_registry.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@donislawdev
donislawdev merged commit b0adaf3 into master Sep 28, 2026
15 checks passed
@donislawdev
donislawdev deleted the fix/target-applies-only-on-apply branch September 28, 2026 18:01
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