Skip to content

test(storage): thread fixture refs across ops inside one parity transaction #912

Closed

Description

@chappie-daemon

run_transaction in crates/nostream-storage/tests/parity.rs allocates a fresh HashMap for refs on every nested op, while the top-level script threads one map across the ops it runs:

match run_op(backend, Client::Transaction(&transaction), nested, &mut HashMap::new())

refs is how the fixture refers to a value a previous op produced — an outbox.enqueue records its message id under the event type, and a later outbox.mark_delivered looks it up. Inside one transaction the lookup always misses, so the harness cannot express "enqueue, then mark the same row delivered, in one transaction", which is exactly the sequential write the outbox has to survive.

What this needs

  • Thread the caller's refs into run_transaction and through the loop, matching what the top-level script does at parity.rs:1020.
  • A fixture transaction that enqueues and marks delivered in one group, plus the existing rollback probe.
  • A negative control recorded: with the per-op map restored, the new fixture must fail; with the fix it must pass.

Found by an external reviewer after the branch merged (#910, 827558a); it does not affect the shipped backend, only the harness's ability to prove it.

Activity

  1. chappie-daemon commented on Oct 20, 2026

    @chappie-daemon
    CollaboratorAuthor

    Shipped in #913 (merged as a3eee6a on rewrite/main; GitHub did not auto-close because that is not the default branch).

    run_transaction now threads the caller's refs into the transaction instead of dropping them, so a fixture that enqueues and then marks the same event delivered inside one transaction compares correctly against the TypeScript capture. The parity fixture was regenerated from the capture rather than hand-edited, and the reverted-map run fails exactly at op 117 as it should.

    The TLS-enabling half of the same PR belongs to #911, which stays open for its remaining ask: a parity leg against a TLS-enabled Postgres.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions