Skip to content

fix(runtime): add snapshot revision compare-and-swap - #1240

Merged
Brad-Edwards merged 4 commits into
devfrom
1180-snapshot-revision-cas
Sep 9, 2026
Merged

fix(runtime): add snapshot revision compare-and-swap#1240
Brad-Edwards merged 4 commits into
devfrom
1180-snapshot-revision-cas

Conversation

@Brad-Edwards

@Brad-Edwards Brad-Edwards commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Plain-Language Summary

  • Context: Runtime control-plane mutations can originate from concurrent writers that share one durable snapshot store.
  • Problem: A writer could persist an update derived from an older snapshot and silently overwrite newer snapshot, operation, or audit state.
  • Fix: Add provider-neutral observed revisions, atomic compare-and-swap commits, revision-pinned reads, and regression coverage for stale-writer isolation.

Issue Tracking

Closes #1180

Verification

  • Ground Control completion suite: passed.
  • Repository policy gate: passed.
  • Focused snapshot-CAS and participant-flow regression suites: 47 tests passed.
  • Pre-push code review findings were repaired; independent test-quality review passed cleanly.

Summary

Add provider-neutral snapshot revisions and compare-and-swap persistence so concurrent control-plane writers cannot silently overwrite newer durable state.

Requirement UIDs

  • (none — bug/refactor/maintenance run; see Traceability section below)

Related Issues

Closes #1180

ADR Impact

  • ADR-021
  • ADR-036
  • ADR-104

Changes

  • Require observed snapshot revisions for every snapshot-bearing commit and reject stale writers atomically across in-memory, SQLite, and compatible custom stores.
  • Pin derived reads and participant projections to one observed snapshot revision while keeping provider revisions out of portable snapshot metadata.
  • Demote runtime caches to rebuildable projections and expose the observed revision on snapshot-derived HTTP responses.
  • Migrate durable records to revision-aware state and document the concurrency, compatibility, and cache boundaries.
  • Migration reminder: this change includes a migration — verify the repo's migration/version references and run its migration checks per the repository's migration policy.

Test Plan

  • Unit tests pass
  • Integration tests pass if applicable
  • Configured completion command passes
  • No coverage regression

Ground Control completion and repository-policy gates passed after the final review fixes; focused snapshot-CAS and participant-flow regression suites also passed (47 tests).

Ground Control Checks

  • Configured repository policy command passes
  • Pre-push code review and test-quality review completed; all findings fixed or dispositioned

Traceability

  • IMPLEMENTS: API-404 ← implementations/python/packages/raes_runtime/control_plane_store_revision.py, API-404 ← implementations/python/packages/raes_runtime/control_plane_store_local_snapshot.py, API-404 ← implementations/python/packages/raes_runtime/control_plane_durability.py, API-404 ← implementations/python/packages/raes_runtime/control_plane_api/_responses.py
  • TESTS: API-404 ← implementations/python/tests/test_issue_1180_snapshot_revision_cas.py, API-404 ← implementations/python/tests/test_run_319_participant_flow_policy.py

Checklist

  • Code follows the project's coding standards
  • Changelog: owned by Release Please (generated from the Conventional Commit PR title; no per-PR fragment)
  • Architectural docs updated if stack, package structure, or key behaviors changed

Documentation

Updated: see diff.

@Brad-Edwards
Brad-Edwards merged commit f834682 into dev Sep 9, 2026
18 checks passed
@Brad-Edwards
Brad-Edwards deleted the 1180-snapshot-revision-cas branch September 9, 2026 01:51
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