Skip to main content

Module projection

Module projection 

Expand description

The projection store rule family: its rules, its single enumeration, its three emitters and its entry macro.

§Why a projection rule may not live in suite.rs

cargo xtask spec-trace and no_orphan_rules both read suite.rs as the event-store family’s rules module, matching pub async fn textually. A projection rule written there is claimed by the event-store enumeration it is absent from, and reported as an orphan of the wrong family. So this family carries its own rules, its own enumeration and its own emitters, in one file — which is the shape model.rs and concurrency.rs already have, and the reason CF-22’s “exactly one place” is per rule family rather than per crate.

§What the family costs, stated rather than discovered

Four exported macros: for_each_projection_store_rule!, three emitters, whose names CF-41 promises, and projection_store_conformance! at the crate root. happenstance-testkit carries its own version precisely because a suite change can turn a passing adapter’s CI red, and a macro is the hardest surface to walk back.

It reuses everything else unchanged: Capability, RuleOutcome, block_on and __rule_names. There is no projection-local skip type and no second line shape, because an author reading one CI log must not have to learn two.

§What a green run here does and does not prove

Every rule below passes against MemoryProjectionStore, which is the oracle and is supposed to pass. That the suite can fail a wrong store is a different claim, and it is now discharged rather than carried: each rule names the defect it rejects, and the store carrying that defect is registered as data in tests/projection_mutation_coverage.rs, driven through this enumeration, and asserted to fail exactly the rules it declares (ADR-0010). every_projection_rule_has_a_mutant is what makes that true of the next rule as well: a rule added here without a store that fails it turns the workspace red, and there is no exemption list.

What a green run still does not prove is that this family is complete. Every rule §4.11 assigns to an adapter’s own suite is now written; what is still owed is the six runner-dependent ones, which CF-36 moves to the workspace e2e crate because they need a runner rather than a store (spec/SPECIFICATION.md:6095-6104). A store that passes everything here has not been observed under replay.

The seventeenth landed last and did not land quietly. fresh_projection_has_no_checkpoint was held out of this module for a day, because §4.11 assigned it to PS-19 and PS-19’s MUST is scoped after a successful reset — so writing the rule would have widened a [FROZEN] clause by test, convicting adapters of an obligation no sentence stated. The repair was a new clause rather than a line edit: ADR-0030 minted PS-38, whose second sentence is the obligation, and the rule cites that clause rather than the one it was filed under (ADR-0030).

§Three rules here are answered by a skip against the reference fixture

failed_commit_leaves_both_unchanged is PS-1’s second conjunct — the arm about a commit that reported failure — and it is gated on COMMIT_FAULT. refused_reset_changes_nothing is PS-18, and it is gated on RESET_REFUSAL. Neither capability is supported by any fixture outside the mutant harness, and MemoryProjectionFixture declines both honestly and for reasons it states: the reference store applies both halves of a commit under one write lock and has no write that can be made to fail, and it holds no protection policy, so there is no projection it could decline to reset. A run against the oracle therefore prints two SKIP lines, and an adapter that wants either conjunct checked has to supply what its own store can do.

The third is committed_rows_and_checkpoint_survive_a_reopen, PS-1’s durable read across a reopen, gated on REOPEN. The reference store has no medium outside the process, so MemoryProjectionFixture declines it, as CF-17 requires, and the oracle run prints a third SKIP line. InMemoryDatabaseStore and VolatileReadModelStore fail it by name in tests/projection_mutation_coverage.rs, against a fixture whose reopen keeps a modelled medium and discards the process state around it.

A third switch can produce a skip and is not on the fixture at all: READS_THROUGH_BATCH is a const on the store’s probe impl, because whether a batch can be read through is a property of the batch type. An adapter declaring it false — which PS-12 permits outright — gets batch_reads_reflect_pending_writes and rebuild_is_chunk_size_invariant as skips naming that constant, with a reason the testkit writes rather than the fixture, for NO_CEILING_REASON’s reason. MemoryProjectionStore declares true, so a reference run does not print those two.

Read that as the answer to “does a green run mean anything here”: for fifteen of the seventeen landed rules it means the store was driven and asserted about; for these two it means what the SKIP lines say. Neither rule is decorative — PartialCommitStore, RefusalAsSuccessStore and RefusalAfterTheFactStore fail them by name in tests/projection_mutation_coverage.rs — but the demonstration lives against a fixture that can arm a fault and protect a projection, and the reference fixture is neither.

One stale sentence, named here because it cannot be repaired here. PS-1’s Rejects: prose says “Today no rule can fail it” (spec/SPECIFICATION.md:5122-5124), which stopped being true when CheckpointOnlyStore landed and is further from true now. PS-1 is [FROZEN], so the repair is a new decision atom under the repair-frozen-clause discipline rather than a line edit, and it belongs to unstable-projection-gate-and-clause-disposition along with the rest of the PS-1 – PS-37 maturity sweep. Nothing in this crate may edit that sentence; this paragraph exists so an adapter author reading the code is not the last person to find out it is stale.

Modules§

rules
The projection conformance rules.