Skip to content

fix(runtime): make local operation state transactional and durable #1092

Description

@doublewhy

Parent design

Gap claim

The local control-plane JSON store performs unlocked whole-file read/modify/write operations. Concurrent writers lose records; replacement is not file-and-directory fsynced; idempotency lookup is linear. API-404 cannot claim durable or idempotent operation state.

Existing surface audit

The audit covers local store serialization, audit append, state transition, idempotency lookup, control-plane execution, repository contracts, and issue #8. An in-process lock would not protect multiple workers or crash consistency. ADR-104 now owns the lifecycle, concurrency, recovery, identity, and profile decisions that were previously implicit here.

Scope

Re-land the transactional local-store work from PR #1136 under the CP-1, CP-2, CP-4, and CP-5 contracts. Provide atomic claim and terminal-commit capabilities, verified WAL/durability admission, path and permission hardening, integrity checks, strict lossless snapshot/operation codecs, and a one-time legacy JSON import with durable backup. Recovery classification belongs to CP-3 and actor-scoped receipt semantics belong to CP-7.

Dependencies

  • CP-1
  • CP-2
  • CP-4
  • CP-5

Acceptance criteria

  • The P1 provider supplies atomic claim, snapshot-revision compare-and-swap, terminal snapshot/record/audit commit, and single-owner lease capabilities.
  • Startup acquires ownership before schema inspection, migration, codec loading, reconciliation, or state reads.
  • The store pins immutable target/run identity and refuses mismatched reopen.
  • Published/domain snapshot and operation state round-trip through one closed, lossless codec; malformed or unknown state fails closed.
  • WAL/synchronization configuration is verified from the provider's granted result.
  • Legacy import verifies counts and digests, fsyncs data and directory changes, retains a durable backup, and switches only after validation.
  • No multi-process, high-availability, multitenancy, automatic-replay, or exactly-once backend-effect claim is introduced.

Verification

  • Store-contract and crash-consistency tests, including process and commit-boundary fault injection.
  • Concurrent-owner, revision-race, path/symlink/permission, corruption, and interrupted-migration tests.
  • Full snapshot/operation round-trip tests, including participant episode closure records and malformed-carrier rejection.
  • Profile P1 conformance through CP-9.

Traceability

  • Requirement: API-404
  • Decision: ADR-104
  • Formal model: specs/formal/runtime-control-plane/README.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions