Validate proposed egress config #266

Merged
didericis merged 2 commits from fix-egress-apply-config-validation into main 2026-06-25 03:08:19 -04:00
Collaborator

Closes #256.

Summary

  • Validate proposed egress routes with the full egress config parser used by the sidecar.
  • Reject route proposals that attempt to change egress logging mode.
  • Add regression coverage for log: 2 proposals in host apply and supervise MCP validation.
Closes #256. ## Summary - Validate proposed egress routes with the full egress config parser used by the sidecar. - Reject route proposals that attempt to change egress logging mode. - Add regression coverage for `log: 2` proposals in host apply and supervise MCP validation.
didericis-codex added 1 commit 2026-06-25 01:25:59 -04:00
fix(egress): validate proposed full config
lint / lint (push) Successful in 2m23s
test / unit (pull_request) Successful in 47s
test / integration (pull_request) Successful in 28s
454baaf3a1
Owner

@didericis-claude can you check whether load_routes is still used, and why we don't just use load_config everywhere/what the discrepancy is

@didericis-claude can you check whether `load_routes` is still used, and why we don't just use `load_config` everywhere/what the discrepancy is
Collaborator

load_routes is no longer used in any production code path — egress_apply.py, supervise_server.py, and egress_addon.py all call load_config now (this PR migrated the last few). It survives in the test layer only: test_egress_addon_core.py tests the function directly, and the round-trip tests in test_egress.py use it to verify that egress_render_routes produces valid route YAML.

The reason tests don't use load_config instead: load_routes returns tuple[Route, ...] directly, which is exactly what those round-trip assertions are comparing. load_config returns a Config wrapper, so callers would have to reach in with .routes. The function is also a natural unit-test target since it's a distinct public export.

The short answer: load_routes is still functional and still exported (__all__ includes it), but it is test-only at this point. If you want uniformity, it could be removed from production exports and either inlined into its tests or replaced with load_config(...).routes — but there's no behavioral discrepancy, just two layers of the same stack.

`load_routes` is no longer used in any production code path — `egress_apply.py`, `supervise_server.py`, and `egress_addon.py` all call `load_config` now (this PR migrated the last few). It survives in the test layer only: `test_egress_addon_core.py` tests the function directly, and the round-trip tests in `test_egress.py` use it to verify that `egress_render_routes` produces valid route YAML. The reason tests don't use `load_config` instead: `load_routes` returns `tuple[Route, ...]` directly, which is exactly what those round-trip assertions are comparing. `load_config` returns a `Config` wrapper, so callers would have to reach in with `.routes`. The function is also a natural unit-test target since it's a distinct public export. The short answer: `load_routes` is still functional and still exported (`__all__` includes it), but it is test-only at this point. If you want uniformity, it could be removed from production exports and either inlined into its tests or replaced with `load_config(...).routes` — but there's no behavioral discrepancy, just two layers of the same stack.
Owner

@didericis-claude remove it and refactor the tests to use load_config(...).routes

@didericis-claude remove it and refactor the tests to use `load_config(...).routes`
didericis added 1 commit 2026-06-25 02:07:56 -04:00
refactor: remove load_routes, use load_config(...).routes in tests
test / unit (pull_request) Successful in 48s
test / integration (pull_request) Successful in 26s
lint / lint (push) Successful in 1m45s
test / unit (push) Successful in 32s
test / integration (push) Successful in 17s
Update Quality Badges / update-badges (push) Successful in 1m21s
9f9aa2e762
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator

Done — pushed in 9f9aa2e.

  • Removed load_routes from egress_addon_core.py (definition + __all__)
  • Folded the three unique coverage cases (empty_routes_list, full_route_shape_parses, invalid_yaml_raises_value_error) into TestLoadConfig in test_egress_addon_core.py, using load_config(...).routes
  • Updated the four round-trip tests in test_egress.py to inline from bot_bottle.egress_addon_core import load_config and call .routes on the result
Done — pushed in 9f9aa2e. - Removed `load_routes` from `egress_addon_core.py` (definition + `__all__`) - Folded the three unique coverage cases (`empty_routes_list`, `full_route_shape_parses`, `invalid_yaml_raises_value_error`) into `TestLoadConfig` in `test_egress_addon_core.py`, using `load_config(...).routes` - Updated the four round-trip tests in `test_egress.py` to inline `from bot_bottle.egress_addon_core import load_config` and call `.routes` on the result
didericis merged commit 9f9aa2e762 into main 2026-06-25 03:08:19 -04:00
didericis deleted branch fix-egress-apply-config-validation 2026-06-25 03:08:20 -04:00
Sign in to join this conversation.