Skip to content

Tests a parked timer against the real store - #136

Merged
johnnyt merged 1 commit into
mainfrom
sob-8ie-parked-timer-real-store-test
Sep 28, 2026
Merged

johnnyt merged 1 commit into
mainfrom
sob-8ie-parked-timer-real-store-test

Conversation

@johnnyt

@johnnyt johnnyt commented Sep 28, 2026

Copy link
Copy Markdown
Member

What

A second parked-timer test, test/statifier_oban/timer/parked_persisted_execution_test.exs, fires a timer into an execution parked in statifier_persistence's own store, where the existing test beside it (parked_execution_test.exs) runs against a stand-in. The stand-in test stays.

The delivery is the README's "Delivering timers to a durable execution" module, defined inside the test over a StatifierPersistence.Storage.InMemory store, calling StatifierPersistence.Executions.step/5. The execution runs a small library-loan chart (on_loan takes reminder to reminded).

The assertions are the stand-in's:

  • the first attempt raises on the {:error, {:needs_migration, _}} refusal: the drain reports one failure and no cancel or discard, the job is retryable at attempt 1 with the raise recorded, nothing is delivered, the stored execution is still :needs_migration, and the scope still has one pending timer (Timer.pending_for/2);
  • StatifierPersistence.Executions.unpark/3 answers the execution :active;
  • the next attempt delivers: the drain reports one success, the job is completed at attempt 2, and the machine state step/5 answered has reminded as its active leaf.

The lock move

The lock needed to move for this test: mix.lock resolved statifier_persistence 0.13.0, which predates the :needs_migration status and unpark/3 (both first shipped in 0.14.0). mix deps.update statifier_persistence moved these lock lines:

  • statifier_persistence 0.13.0 -> 0.21.0
  • statifier 2.7.0 -> 2.9.0 (statifier_persistence 0.21.0 requires ~> 2.9)
  • predicator 9.0.2 -> 9.4.2

mix.exs is unchanged: the optional requirement stays ~> 0.13, and statifier stays ~> 2.5. No other lock line moved, and nothing else in the suite changed.

No changelog fragment: a test and a lock move for tests, and the package's requirement is unchanged (changelog.d/README.md excludes test harness changes).

Provenance

  • The store is StatifierPersistence.Storage.InMemory, the package's reference adapter, which ships in its lib/. The Ecto adapter is not used here because this repo's test harness is SQLite and that adapter's gate runs on Postgres. The door under test, Executions.step/5, is the same over either adapter, and so is the refusal it makes from the execution record.
  • The park is StatifierPersistence.Storage.update_execution_status/4 writing :needs_migration with a nil failure. That is the one write a chart migration's park makes (StatifierPersistence.Executions.migrate/4 under on_failure: :park, ADR-0014 decision 1 in that package). The test does not build a migration plan that refuses.

Review (own, in-turn)

I re-read the diff against the bead and its dispatch note. The test repeats each of the stand-in's three assertions against the real store. The lock lines that moved are exactly the three listed above, with mix.exs untouched. The delivery module inside the test matches the README module's arms one for one; the only additions are the test-pid report and a no-op executor.

I ran two sabotage checks, each restored from a copy afterwards. First, the delivery's needs_migration arm answered {:discarded, :needs_migration}. Second, StatifierOban.Timer.Worker.perform/1 rescued a raise out of deliver/2 as a discard. Both turned the new test red on the first drain's assertion (cancelled 1, where failure 1 was expected).

The full mix quality gate is green on the committed tree: every stage passed, and Doctor, Gettext and Sobelow were skipped as not installed.

Refs: sob-8ie

The parked-timer test beside this one runs against a stand-in store,
because the lock resolved statifier_persistence 0.13.0, which predates
the needs_migration status and unpark/3. The lock now resolves
statifier_persistence 0.21.0, and a second test fires a timer into an
execution parked in that package's own InMemory store, through a
delivery shaped on the README's durable module that calls
StatifierPersistence.Executions.step/5.

Its assertions are the stand-in's: the first attempt raises on the
needs_migration refusal, the job is retryable (not cancelled or
discarded) and still pending for the scope; after
StatifierPersistence.Executions.unpark/3 the next attempt delivers,
the job completes on attempt 2, and the stored execution has moved to
the chart's next state. The stand-in test stays.

The lock move is the lock only; mix.exs is unchanged (the optional
requirement stays "~> 0.13", statifier stays "~> 2.5"). Three lock
lines moved, as mix deps.update statifier_persistence resolved them:
statifier_persistence 0.13.0 -> 0.21.0, statifier 2.7.0 -> 2.9.0
(statifier_persistence 0.21.0 requires "~> 2.9"), predicator 9.0.2
-> 9.4.2.

No changelog fragment (a test and a lock move for tests; the package's
requirement is unchanged). Full mix quality green on this tree.

Refs: sob-8ie
@johnnyt
johnnyt merged commit 839eac8 into main Sep 28, 2026
1 check passed
@johnnyt
johnnyt deleted the sob-8ie-parked-timer-real-store-test branch September 28, 2026 06:22
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