Skip to content

Fix review findings #105/#106/#107 (12.1.11) - #108

Merged
Nerds489 merged 4 commits into
mainfrom
fix/review-105-106-107
Sep 29, 2026
Merged

Nerds489 merged 4 commits into
mainfrom
fix/review-105-106-107

Conversation

@Nerds489

Copy link
Copy Markdown
Owner

Fixes from the read-only review, verified with the repo's own ruff, mypy and pytest on the touched paths. Bumps to 12.1.11.

#105 (high)

  • Signal cleanup core/cleanup.py: install handlers on the running loop (add_signal_handler) instead of run_until_complete(), which raised on the live TUI loop and skipped interface/iptables teardown on Ctrl-C. The synchronous fallback never calls run_until_complete on a running loop.
  • Audit verify() core/audit.py: an external append is now a segment boundary, so verify() no longer goes permanently false after a concurrent writer. verify_file() stays the authority for the on-disk chain.
  • Captive-portal capture automation/handlers/setup.py: the loot dir is substituted into the generated capture.php (was a literal placeholder in a non-f-string; every capture was written to a dead path).

#106 (medium)

  • Chain error policy chaining/executor.py: condition, RETRY/retry_count/retry_delay, FALLBACK/fallback_tool and SKIP are now honoured. Defaults (STOP, no condition) preserve the old behaviour, so existing chains are unaffected.
  • Session lost-update sessions/manager.py: optimistic concurrency (WHERE id AND updated_at = <baseline>, re-read and retry on a miss). No schema change.
  • Mislabelled gate safety/: check_target_safety removed from the public API and documented as not an authorisation gate.
  • Not in this PR: the tool_requirements preflight registry is still consumed only in the TUI path (finding M1). Wiring it into non-TUI execution is a design decision, so Medium: chain retry/fallback ignored, session lost-update, mislabelled safety primitive, TUI-only preflight #106 stays open for it; see the issue comment.

#107 (low / hygiene)

  • API key file created with mode 0o600 at os.open time (was write_text then chmod).
  • restore_managed_mode / flush_iptables report command failures instead of always returning True; stray "completed" debug log removed from the failure branch; duplicate log calls removed.
  • SECURITY.md: note that audit truncation detection fails open without the .anchor sidecar. Cleared stale .coverage / .hang-diagnostic.log.

Verification

  • New regression tests: test_audit_concurrent_interleave.py, test_chain_error_policy.py, test_session_optimistic_update.py.
  • ran the affected suites (audit, chaining, sessions, reachability, requirement flags, root enforcement, tiered confirmation, review rounds): all green. ruff and mypy introduce no new findings over main on the changed files.

Closes #105
Closes #107

…al capture (#105)

- core/cleanup.py: install signal handlers on the running loop instead of
  run_until_complete(), which raised on the live TUI loop and skipped interface
  and iptables teardown on Ctrl-C.
- core/audit.py: treat an external append as a segment boundary so verify() no
  longer goes permanently false after a concurrent writer; verify_file() stays
  the authority for the on-disk chain.
- automation/handlers/setup.py: substitute the loot dir into the generated
  capture.php (was a literal placeholder in a non-f-string; captures were lost).
… gate (#106)

- chaining/executor.py: implement condition (pre-run skip), on_error RETRY
  (retry_count/retry_delay), FALLBACK (fallback_tool) and SKIP; defaults (STOP,
  no condition) keep the previous behaviour. Uses paths.resolve_path for the
  condition value, so paths.py is now a live module (reachability ledger updated).
- sessions/manager.py: optimistic-concurrency update() (WHERE id AND
  updated_at=baseline, re-read and retry on a miss) so racing callers no longer
  silently clobber each other; no schema change.
- safety: check_target_safety removed from the package public API and documented
  as not an authorisation gate, so it cannot be mistaken for the scope gate.
- Not addressed here: the tool_requirements preflight registry is still consumed
  only in the TUI path (M1); wiring it into non-TUI execution is a design call.

Tests: test_chain_error_policy.py, test_session_optimistic_update.py.
…chor note (#107)

- keys.py: create the API key file with mode 0o600 at os.open time instead of
  write_text + chmod, closing the world/group-readable window.
- automation/handlers/cleanup.py: restore_managed_mode and flush_iptables now
  check each command's result instead of always returning True; removed the
  stray 'completed' debug log in the failure branch.
- Removed duplicate back-to-back log calls (control.py, tools/base.py).
- SECURITY.md: note that audit truncation detection fails open when the .anchor
  sidecar is missing.
@Nerds489
Nerds489 merged commit 20482ef into main Sep 29, 2026
2 checks passed
@Nerds489
Nerds489 deleted the fix/review-105-106-107 branch September 29, 2026 21:52
Nerds489 added a commit that referenced this pull request Oct 1, 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

1 participant