fix(invariant): persist standalone invariants to database #1202

Closed
brent.edwards wants to merge 2 commits from bugfix/m4-invariant-persistence into master

2 Commits

Author SHA1 Message Date
HAL9000 66a6fb2402 fix(changeset): ensure database commits are persisted in repository methods
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 20s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m19s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m9s
CI / unit_tests (pull_request) Successful in 7m53s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 7m19s
CI / e2e_tests (pull_request) Successful in 11m26s
CI / integration_tests (pull_request) Successful in 15m5s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 52m13s
The ChangeSetEntryRepository and ToolInvocationRepository methods were only
calling session.flush() but not session.commit(), which meant changes were
not persisted to the database. This caused the SqliteChangeSetStore round-trip
test to fail because data was not visible across different session instances.

Added session.commit() calls after session.flush() in:
- ChangeSetEntryRepository.save_entry()
- ChangeSetEntryRepository.delete_for_changeset()
- ChangeSetEntryRepository.delete_for_plan()
- ToolInvocationRepository.save_invocation()
- ToolInvocationRepository.delete_for_plan()

This ensures that all database operations are properly committed and visible
to subsequent queries.

ISSUES CLOSED: #1022
2026-04-14 23:01:19 +00:00
brent.edwards 00e8046f7b fix(invariant): persist standalone invariants to database
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 18s
CI / helm (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 3m18s
CI / typecheck (pull_request) Successful in 3m55s
CI / security (pull_request) Successful in 4m7s
CI / unit_tests (pull_request) Successful in 4m8s
CI / docker (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 9m19s
CI / integration_tests (pull_request) Failing after 11m13s
CI / coverage (pull_request) Successful in 8m31s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-regression (pull_request) Successful in 58m44s
Add a standalone invariants persistence path (ORM model, migration, repository, and UoW wiring) so CLI-added invariants survive process restarts. Refactor InvariantService and invariant CLI service resolution to use DI-backed UnitOfWork persistence while retaining in-memory fallback behavior for compatibility tests.

Update Behave and Robot TDD coverage for cross-invocation add/list/remove semantics, remove the #1022 expected-fail inversion, and align M3 verification helpers with persisted behavior.

ISSUES CLOSED: #1022
2026-03-30 12:49:35 +00:00