Skip to content

refactor: make engine state opaque - #229

Merged
rlippmann merged 4 commits into
mainfrom
hide_state
Aug 5, 2026
Merged

refactor: make engine state opaque#229
rlippmann merged 4 commits into
mainfrom
hide_state

Conversation

@rlippmann

Copy link
Copy Markdown
Owner

What changed

  • Removed the public raw-state surface from the engine:
    • removed exported State
    • removed Engine.state
    • removed state= from Engine.__init__
    • removed state= from create_engine()
  • Migrated supported consumers to semantic engine APIs:
    • engine.premise
    • engine.policies
    • export_json() / import_json()
  • Updated REPL, demos, examples, evals, tests, fixtures, and documentation to stop depending on public raw state.
  • Replaced state-based test setup and assertions with supported public behavior and persistence boundaries.
  • Removed obsolete mutation-isolation fixtures for constructor state injection and public state snapshots.
  • Updated fixture documentation to reflect the new public surface.

Why

  • The public raw state representation exposed internal implementation details and increased cross-language API maintenance.
  • Consumers generally need semantic state access or persistence, not the engine's internal state structure.
  • Keeping authoritative state private allows the engine implementation to evolve while preserving a smaller, clearer public contract.

Checklist

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

@rlippmann
rlippmann merged commit 1148f37 into main Aug 5, 2026
16 checks passed
@rlippmann
rlippmann deleted the hide_state branch August 5, 2026 06:08
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