Skip to content

test: one tests/common crate and backend conformance suites - #344

Merged
patrickleet merged 2 commits into
v5from
refactor/v5-review-27b-test-common
Nov 25, 2026
Merged

patrickleet merged 2 commits into
v5from
refactor/v5-review-27b-test-common

Conversation

@patrickleet

Copy link
Copy Markdown
Collaborator

Task 27 stage B ([[tasks/v5-review-27]]): one fixture library and one conformance pattern.

What changed

  • tests/common is a publish = false workspace crate. It is a path dev-dependency of distributed, which forwards its sqlite / postgres / graphql features. The dev-dependency cycle compiles, and the distributed types are the same in both crates.
  • What common holds:
    • the single todo::Todo
    • read models and sessions
    • sqlite::TempDb and postgres::PostgresTestSchema
    • env, ids, outbox, commands, graphql (on_each_dialect!, with_repository!), oidc and transport (bus_conformance_tests!)
    • the repository, lease, lock and schedule suites
  • No #[path] left in tests/: unit tests in src use common::env.
  • Conformance pattern:
    • Each contract has a backend trait. open(case) returns None when the service is missing, which skips the test.
    • Each capability is a sub-trait of that backend trait.
    • The macro requires every capability flag to be written as true or false. Claiming a capability without implementing its trait does not compile.
    mod sqlite {
        common::schedule_conformance_tests!(common::schedule::Sqlite, settle_faults: true, store_clock: false);
    }
  • typed_commands:
    • Fixtures use projection! + mutation!. Three stay hand-built because they assign constants (an enum variant, null), which mutation! can't express.
    • Errors are asserted by typed kind. GraphqlServiceBindError is now an enum with unchanged Display text.

Case lists (before → after)

Contract In-memory SQLite Postgres Named capabilities
Repository 23 → 31 23 (+12 dialect-only) → 35 23 (+9 dialect-only) → 35 sql_faults, durable
Lease 6 → 7 5 → 7 4 → 7 controlled_clock, standalone_migration
Lock none 11 → 11 11 → 11 none
Schedule 1 → 5 5 → 5 5 → 5 settle_faults, store_clock
  • Cases that used to run on only some backends now run on all of them.
  • Kept per dialect: migration idempotence, dev bootstrap, Postgres column types and backend termination.
  • One true duplicate was dropped.

Counts and size

  • Tests (--list): 2,853 → 2,874.
  • Diff with renames detected: 100 files, +3,259 / −3,654.

Tests

Run locally:

  • Workspace check (all features), no-default, and each of the 18 features alone with --all-targets: OK.
  • make test-local --no-fail-fast (Postgres and compose services): 2,858 passed, 0 failed.
  • CLI with --include-ignored: 341 passed. e2e-celld: 31 passed. e2e-ui ci-offline: OK.
  • Excluded crates: gateway-native; gateway-portable native and wasm32; gateway-worker and the celld workers on wasm32; the domain check. All OK.
  • 30× loops of the lease, lock, schedule and repository suites on SQLite and in-memory: 210 binary runs, 0 failures. Once on Postgres, with skips counted as failures: pass.

Not done

  • Postgres deliver_at: it reads back about 76 ns off even for a whole-millisecond timestamp, which looks like a float conversion on the read path. The restart case, newly run on Postgres, now compares to within 1 ms. Filed as an incident; the fix belongs in src.
  • tests/support/rustc_fail.rs is still #[path]-included by the two proc-macro crates, which shouldn't depend on the runtime crate.
  • Other shared modules:
    • tests/gateway_support is still a per-binary module with dead_code allowed.
    • The saga fixtures and the non-Todo sourced_snapshot variants are not folded into common.
  • Stage C: consolidating test binaries and adding rust-cache to CI.

A tests/common dev-dependency crate holds the single Todo aggregate,
read models, sessions, TempDb, PostgresTestSchema, env helpers and the
conformance suites. Repository, lease, lock and schedule contracts run
one identical case list per backend; exclusions are named capabilities
that must be stated explicitly. The #[path] support idiom is gone from
tests/. typed_commands fixtures use projection!/mutation! and assert
typed error kinds (GraphqlServiceBindError is now an enum).

Implements [[tasks/v5-review-27]]
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 783ff673-ae77-493b-a1b1-a95f3ead210d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@patrickleet
patrickleet merged commit 2859485 into v5 Nov 25, 2026
27 checks passed
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