Skip to content

The in-memory backend cannot run processor leases (ALB0024) #159

Description

@VDBBjorn

InMemoryBackendDescriptor refuses a module that turns leases on:

ALB0024 — The module enables processor leases (Leases.Enabled = true) but the
in-memory backend does not provide an IProcessorLeaseManager.
  → Switch to .WithPostgres(...) for a module that uses processor leases, or
    disable leases with .WithControlLoop(o => o with { Leases = o.Leases with { Enabled = false } }).

So the documented dev/test backend cannot exercise a control loop configured the way production is. Anyone developing against .WithInMemory() has to either turn leases off — and test a different topology from the one they ship — or run Postgres.

#158 builds a working in-memory IProcessorLeaseManager and IFencedCheckpointStore pair (TimeProvider-backed leases, monotonic fence tokens via Interlocked.Increment, both fencing guards) but deliberately keeps them in tests/Alberto.Tests, because promoting them is a feature and not a side effect of adding a conformance specification.

Fix

Promote both types into Alberto.InMemory, register them from InMemoryBuilderExtensions.RegisterBackend, and delete the ALB0024 validation failure. Leases.Enabled = true then works end to end on the in-memory backend, and the conformance specification from #158 runs against the adapter consumers actually get rather than a test double.

Why this is not free

Two things need deciding before it lands, which is why it is not folded into #158:

  • Public API. Roughly 15 new entries in Alberto.InMemory/PublicAPI.Unshipped.txt, frozen under semver at 1.0. Worth reviewing the surface deliberately rather than inheriting whatever the test types happened to expose.
  • CachingCheckpointStore behaviour change. It picks the fenced path with _inner as IFencedCheckpointStore (CachingCheckpointStore.cs:322). Making the in-memory checkpoint store implement the interface flips that cast from null to non-null for existing in-memory wiring. If the store is then handed a fencing context it cannot honour, the type test gives the wrong answer — the same shape as Only Alberto's own decorator can answer whether a checkpoint store can enumerate #155, where "implements the interface" and "can actually do it" came apart and needed a capability query to tell them apart.

Related

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions