Skip to content

refactor: separate directive parsing and application - #235

Merged
rlippmann merged 3 commits into
mainfrom
apply_directive
Aug 11, 2026
Merged

refactor: separate directive parsing and application#235
rlippmann merged 3 commits into
mainfrom
apply_directive

Conversation

@rlippmann

Copy link
Copy Markdown
Owner

What changed

  • Added Engine.apply_directive() as the semantic application boundary for parsed directives.
  • Removed the legacy _parse_directive() path so directive handling now flows through:
    • decompose_directive()
    • CanonicalDirective
    • apply_directive()
  • Removed leaked implementation types from the public API:
    • Action is now internal to the engine.
    • DirectiveKind is now internal to grammar.
  • Updated tests, fixtures, and documentation to reflect the reduced public surface.

Why

The previous implementation mixed directive parsing and semantic application inside the engine.

This change separates responsibilities:

  • grammar owns converting text into canonical directives;
  • engine owns applying canonical directives to state.

Reducing the public surface prevents consumers from depending on internal semantic representations and keeps the supported integration path centered on parsed directives and engine application.

Checklist

  • pre-commit run (uv run pre-commit run --all-files)
  • tests pass (uv run pytest)

@rlippmann
rlippmann merged commit 41df148 into main Aug 11, 2026
16 checks passed
@rlippmann
rlippmann deleted the apply_directive branch August 11, 2026 05:11
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