Skip to content

Support persistent read-before-write ledgers #888

Closed

Description

@jerm-dro

Problem

The Read/Edit/Write safety contract records the version observed by a session before allowing an existing file to be changed. That read-before-write ledger is currently tied to the lifetime and storage of a live Workspace, which prevents deployments from retaining the ledger outside process memory.

Cloud-native and remote filesystem deployments need to choose durable ledger storage independently from the filesystem that stores file contents. The safety semantics must remain consistent regardless of the selected storage.

Desired behavior

  • The read-before-write ledger is a storage-independent capability rather than being inherently in-memory.
  • Ledger entries remain scoped to a session.
  • A durable implementation can retain entries across runs, process restarts, and replicas.
  • Filesystem contents and ledger entries may use independently selected storage backends.
  • The existing in-memory behavior remains available as the default for deployments that do not configure durable ledger storage.
  • Ledger storage failures fail closed: an existing file cannot be changed unless the required prior read can be established.

Invariants to preserve

  • A recorded entry contains the exact opaque file version returned by the corresponding read.
  • Paths use the existing I/O-free lexical normalization rules.
  • Existing-file Edit and Write still require a prior read and reject a file changed since that read.
  • New-file Write remains create-only.
  • The filesystem's conditional replacement remains the final concurrency guard; a durable ledger does not weaken or replace compare-and-swap behavior.
  • Physical path aliases may conservatively require another read rather than performing filesystem I/O during ledger keying.

Acceptance criteria

  • At least one non-memory ledger implementation can satisfy the ledger contract without coupling it to a file-content backend.
  • Two sessions using the same filesystem retain independent ledger entries.
  • A durable ledger can be reopened by another process/replica and preserve the session's recorded versions.
  • Missing, unavailable, or corrupt ledger state causes mutation to be refused rather than treated as a successful prior read.
  • Existing Workspace and file-tool safety/conformance behavior remains covered.
  • Architecture and compatibility documentation records the revised ledger lifetime and persistence semantics.

Out of scope

  • Adding a remote filesystem backend.
  • Changing filesystem content scoping.
  • Bash, command execution, or sandboxing.

Activity

  1. changed the title [-]Make the read-before-write ledger storage-independent[/-] [+]Support persistent read-before-write ledgers[/+] on Aug 31, 2026
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions