Cover egress_addon adapter and remove coverage omit #290

Open
didericis-claude wants to merge 1 commits from cover-egress-addon-adapter into main
Collaborator

Closes #286.

Summary

bot_bottle/egress_addon.py — the mitmproxy adapter that wires the host-importable decision logic (egress_addon_core) into mitmproxy's request/response hooks — was excluded from coverage in .coveragerc. The core logic and the log-redaction helpers were tested, but the adapter glue itself was unexercised.

This adds tests/unit/test_egress_addon_request_flow.py, which stubs the sidecar-only mitmproxy import and drives EgressAddon end to end:

  • introspection endpoint (/allowlist, 404)
  • allowlist enforcement (unlisted host → 403; listed host forwards)
  • Authorization strip + sidecar-token injection; unset-env block
  • git push / fetch over HTTPS blocking
  • outbound-DLP policy branches: block, redact, and supervise (operator approval, rejection, and timeout round-trips)
  • inbound DLP response scanning
  • WebSocket frame scanning

The bot_bottle/egress_addon.py omit is removed from .coveragerc; the adapter now reports ~76% line coverage. Full unit suite (1317 tests) passes; pyright clean; pylint 9.64 on the new file.

Closes #286. ## Summary `bot_bottle/egress_addon.py` — the mitmproxy adapter that wires the host-importable decision logic (`egress_addon_core`) into mitmproxy's request/response hooks — was excluded from coverage in `.coveragerc`. The core logic and the log-redaction helpers were tested, but the adapter glue itself was unexercised. This adds `tests/unit/test_egress_addon_request_flow.py`, which stubs the sidecar-only `mitmproxy` import and drives `EgressAddon` end to end: - introspection endpoint (`/allowlist`, 404) - allowlist enforcement (unlisted host → 403; listed host forwards) - Authorization strip + sidecar-token injection; unset-env block - git push / fetch over HTTPS blocking - outbound-DLP policy branches: `block`, `redact`, and `supervise` (operator approval, rejection, and timeout round-trips) - inbound DLP response scanning - WebSocket frame scanning The `bot_bottle/egress_addon.py` omit is removed from `.coveragerc`; the adapter now reports ~76% line coverage. Full unit suite (1317 tests) passes; pyright clean; pylint 9.64 on the new file.
didericis-claude added 1 commit 2026-06-25 19:31:38 -04:00
test(egress): cover egress_addon adapter; drop coverage omit
lint / lint (push) Successful in 1m50s
test / unit (pull_request) Successful in 46s
test / integration (pull_request) Successful in 17s
af7f74dc32
The mitmproxy adapter `egress_addon.py` was omitted from coverage
because it can't import on the host (mitmproxy is sidecar-only) and
only its log-redaction helpers were exercised. Add a request/response
flow suite that stubs mitmproxy and drives the adapter glue:
introspection, allowlist enforcement, auth strip+inject, git
push/fetch blocking, the outbound-DLP block/redact/supervise policy
branches (including the operator approval round-trip), inbound
response scanning, and WebSocket frame scanning.

Removes the `bot_bottle/egress_addon.py` omit from `.coveragerc`;
the adapter now reports ~76% covered.

Closes #286

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkwFXLFff9PYPy4wgVBJp9
Some checks are pending
lint / lint (push) Successful in 1m50s
test / unit (pull_request) Successful in 46s
test / integration (pull_request) Successful in 17s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin cover-egress-addon-adapter:cover-egress-addon-adapter
git checkout cover-egress-addon-adapter
Sign in to join this conversation.