test: the desks run through a real store (PR 1 of #4) #7

Closed
mercurius wants to merge 4 commits from mercurius/4-pr1-test-store into main
Member

Purpose (test): the CMD division's desks are tested through a real reckon-db store, as mcl-bookclub's are. This is PR 1 of #4 (gap table H.1). Every later parity PR uses the fixture.

Refs #4

What changes

  • HostBookclub.TestStore (apps/host_bookclub/test/support, compiled for :test only) ports host_bookclub_test_store.erl. It opens the store the desks dispatch to, the way the facade does, under a fresh MCL_DATA_DIR, and reads streams back as #event{} records. reckon_db is a test-only dependency at the facade's ~> 5.11.
  • Store cases, ported from mcl-bookclub:
    • initiate: 3 cases
    • archive: 5 cases
    • plan_party: 3 cases
  • The CMD-mesh boundary test (division_boundary_test.exs): nothing in host_bookclub/lib names esqlite, macula or mcl_om.
  • No app code changes. No test showed phoenix behaving differently from mcl-bookclub.

Where it differs from mcl-bookclub, and why

  1. The desks are called as they stand. dispatch/1 takes a params map until PR 3.
  2. Store cases live in their own *_store_test.exs files with async: false, so the pure suites stay async.
  3. The store directory persists for the VM's life. reckon-db keeps one Ra system per store id, bound to its first directory.
  4. Under the umbrella's mix test, the fixture reuses the store the facade already opened, and stop/1 closes only a store it opened itself.
  5. The boundary test exempts no file: phoenix keeps its emitters in the facade.
  6. The rejected-id cases assert the command's exact validate/1 refusal. mcl-bookclub asserts only {error, _}, a looseness that two mutants survived.

Checks

Run on msi00 in the ci image:

  • format, compile --warnings-as-errors, credo --strict: clean
  • umbrella mix test: 0 failures, rc=0
  • host app alone: 69 tests, 0 failures

14 mutants, all killed (initiate, archive, plan_party, the guards, validation and the boundary).

No CI yet: Actions are off on this repo until PR 6's GO.

Purpose (test): the CMD division's desks are tested through a real reckon-db store, as mcl-bookclub's are. This is PR 1 of #4 (gap table H.1). Every later parity PR uses the fixture. Refs #4 ## What changes - **`HostBookclub.TestStore`** (`apps/host_bookclub/test/support`, compiled for `:test` only) ports `host_bookclub_test_store.erl`. It opens the store the desks dispatch to, the way the facade does, under a fresh `MCL_DATA_DIR`, and reads streams back as `#event{}` records. `reckon_db` is a test-only dependency at the facade's `~> 5.11`. - **Store cases**, ported from mcl-bookclub: - initiate: 3 cases - archive: 5 cases - plan_party: 3 cases - **The CMD-mesh boundary test** (`division_boundary_test.exs`): nothing in host_bookclub/lib names esqlite, macula or mcl_om. - **No app code changes.** No test showed phoenix behaving differently from mcl-bookclub. ## Where it differs from mcl-bookclub, and why 1. The desks are called as they stand. `dispatch/1` takes a params map until PR 3. 2. Store cases live in their own `*_store_test.exs` files with `async: false`, so the pure suites stay async. 3. The store directory persists for the VM's life. reckon-db keeps one Ra system per store id, bound to its first directory. 4. Under the umbrella's `mix test`, the fixture reuses the store the facade already opened, and `stop/1` closes only a store it opened itself. 5. The boundary test exempts no file: phoenix keeps its emitters in the facade. 6. The rejected-id cases assert the command's exact `validate/1` refusal. mcl-bookclub asserts only `{error, _}`, a looseness that two mutants survived. ## Checks Run on msi00 in the ci image: - format, compile `--warnings-as-errors`, credo `--strict`: clean - umbrella `mix test`: 0 failures, rc=0 - host app alone: 69 tests, 0 failures 14 mutants, all killed (initiate, archive, plan_party, the guards, validation and the boundary). No CI yet: Actions are off on this repo until PR 6's GO.
HostBookclub.TestStore opens a real reckon-db store in the test VM,
through :reckon_db_sup.start_store/1, under the store id evoq's config
names and in the directory the facade gives it (MCL_DATA_DIR, a fresh
temp dir on every test run). When the umbrella's facade has opened that
store already, the fixture uses it and leaves it open. The initiate,
archive and plan_party desks are now dispatched through the store, and
each case reads its result back off the stream. A division boundary test
keeps the CMD sources free of the read-model library and the mesh SDK.

reckon_db joins host_bookclub as a test-only dependency, at the facade's
requirement (~> 5.11).

Ports, from macula-services/mcl-bookclub 0ce055a:
- apps/host_bookclub/test/host_bookclub_test_store.erl
- apps/host_bookclub/test/initiate_bookclub_tests.erl (store_test_, the CMD mesh boundary test)
- apps/host_bookclub/test/archive_bookclub_tests.erl (store_test_)
- apps/host_bookclub/test/plan_party_tests.erl (store_test_)

Refs macula-services/mcl-bookclub-phoenix#4
TestStore.stream/1 called :reckon_db_streams.read/5, which Dialyzer cannot
see: reckon_db is outside the PLT (no debug_info). It now reads through
:evoq_event_store.read/5, the path an aggregate loads from, so the store
cases read each event as evoq's flat map instead of reckon_gater's #event{}
record, and the record macro is gone.

Refs macula-services/mcl-bookclub-phoenix#4
Merge remote-tracking branch 'origin/main' into mercurius/4-pr1-test-store
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 6s
c4 model / c4-model (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Successful in 6m56s
8465878a26
Merge remote-tracking branch 'origin/main' into mercurius/4-pr1-test-store
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 10s
c4 model / c4-model (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Has been cancelled
8c6ac58036
Member

Landed: phoenix main is cbe8061c4d, which merges this PR's passed head 8465878a (PASS r=2 Uranus) on main e9cc2372; CI 6140 + 6141 on that tip. Closed rather than merged: this repository does not allow the manually-merged style.

Landed: phoenix main is cbe8061c4d51822706d9c15a08dbea48086cd15d, which merges this PR's passed head 8465878a (PASS r=2 Uranus) on main e9cc2372; CI 6140 + 6141 on that tip. Closed rather than merged: this repository does not allow the manually-merged style.
terra closed this pull request 2026-12-01 06:04:33 +00:00
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 10s
c4 model / c4-model (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-bookclub-phoenix!7
No description provided.