Skip to content

refactor(models): reject legacy action values at API boundaries#163

Open
lan17 wants to merge 3 commits intomainfrom
lev/rejectoldenums
Open

refactor(models): reject legacy action values at API boundaries#163
lan17 wants to merge 3 commits intomainfrom
lev/rejectoldenums

Conversation

@lan17
Copy link
Copy Markdown
Contributor

@lan17 lan17 commented Apr 2, 2026

Summary

  • Split action validation into strict (validate_action) for API input boundaries and lenient (normalize_action) for internal read paths
  • ControlAction.decision now rejects allow/warn/log with a clear error — only deny, steer, observe are accepted when creating or updating controls
  • EventQueryRequest.actions now rejects legacy values in query filters
  • ControlMatch and ControlExecutionEvent still normalize legacy values from historical DB rows via normalize_action
  • expand_action_filter unchanged — still expands observe to include legacy values for SQL queries against old event data

Follows #161 which introduced the observe action and normalization layer.

Test plan

  • models/tests/test_actions.py — 43 tests covering strict validation, lenient normalization, Pydantic model boundaries, and query expansion
  • server/tests/test_observability_models.py — updated to verify legacy rejection in query filters
  • engine/tests/test_core.py — 49 tests pass (unchanged)
  • sdks/python/tests/test_control_decorators.py — 35 tests pass (unchanged)
  • make lint and make typecheck pass

🤖 Generated with Claude Code

lan17 added 2 commits April 2, 2026 13:00
Split action validation into strict (validate_action) for API input
boundaries and lenient (normalize_action) for internal read paths.

ControlAction.decision and EventQueryRequest.actions now reject
allow/warn/log with a clear error. ControlMatch and
ControlExecutionEvent still normalize legacy values from historical
DB rows.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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