All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.2.0 - 2026-07-09
Added
ValidateTenantSourcecompile-time verifier — a resource declaring non-global Ash multitenancy must declare areplicanttenant source (tenant_attributeortenant_mfa). Without one, every mirror write is attempted withtenant: niland halts fail-closed (:tenant_required) at runtime; this gate moves that failure to build time. It is the converse ofValidateMultitenancy(which checks the shape of a declared discriminator).
Fixed (closeout review, 2026-07-08 — /review-autopilot --fix)
- Snapshot fails closed on an empty resolver index —
handle_snapshot/3andhandle_snapshot_complete/2now share thehandle_transaction/2fail-closed guard (a degenerate/misloaded index no longer silently drops a backfill while advancing the checkpoint). on_truncate :mirrorclears tenant-blind — was aTenantRequireddead-end for non-global attribute-multitenant resources; now a quoted rawDELETEon the mirror table (matching the snapshot redo-safety clear).- Full telemetry contract — the
[:ash_replicant, :snapshot, :batch]/[:snapshot, :complete]events (previously never emitted),:sink,:haltederror_class, and:sink,:appliedchange_count+durationmeasurements are now emitted (change_countcounted single-pass). transaction?: falseon the per-record upsert (the sink owns the outer transaction the action joins).
Documented (closeout review)
- Tenant-scoped source tables must be
REPLICA IDENTITY FULL— a tenant-scoped delete / PK-changing update resolves the tenant fromold_record, which is key-only under the default replica identity (else the sink halts fail-closed:tenant_required). Documented in AGENTS Critical Rule 2, thetenant_attributeDSL doc, README, and usage-rules; locked by a key-only-old_recordred-gate.
Optimized (post-closeout, 2026-07-09)
- Snapshot bulk path computes its reflection once per batch — the non-tenant
bulk upsert derives the
{skip, cloak, attribute-name}reflection a single time (Resolver.upsert_reflection/1+Resolver.upsert_input/2) instead of re-deriving it per row;attrs_for_upsert/2is retained for single-record callers. Behavior unchanged (F13). - Delete path is a single atomic
bulk_destroy—Apply.destroy_by_pk/3issues oneDELETE ... WHERE pk(strategy: [:atomic, :stream],transaction: false) instead of read-then-destroy, falling back to per-record streaming when a host destroy action carries non-atomic changes. The nil-PK fail-closed guard, per-row tenant scoping, and idempotent-on-absent-row semantics are preserved (F14).
0.1.0 - 2026-07-08
First release: the complete Ash Replicant.Sink adapter with effect-once
semantics, fail-closed multitenancy, AshCloak integration, and compile-time
sensitive-column verification.
Added
Ash resource extension (
AshReplicant.Resource) — areplicant do ... endDSL section for marking AshPostgres resources as CDC mirror targets. Options:source_table,source_schema,tenant_attribute,tenant_mfa,sensitive,skip,on_truncate,on_schema_change,upsert_identity.Checkpoint macro (
AshReplicant.Checkpoint) — generates an AshPostgres resource backing theash_replicant_checkpointstable (one row per slot, tracking the durablecommit_lsnwatermark). Bound to the host's repo and domain at compile time.Sink-config macro (
AshReplicant.Sink) — generates aReplicant.Sinkimplementation with repo, domains, checkpoint resource, andslot_namebaked in. Theslot_nameis the single source of truth for the replication slot (not astart_linkoption) and keys the resolver index.Resource resolver (
AshReplicant.Resolver) — maps{schema, table}pairs to resources, built from the sink's domains. The index is cached in:persistent_termand accessed by the sink's transaction handler.Sink action applier (
AshReplicant.Apply) — applies changes to mirror resources: upsert by PK, destroy, truncate per policy. Actions are the host's own resource actions; the sink invokes them withauthorize?: falseat the boundary (the host's Ash policies still guard those actions for application callers; the flag exempts only the sink's in-transaction mirror writes from re-gating). Tenant is passed per-row.Compile-time verifiers — enforce critical rules:
ValidateSensitive: each sensitive column maps to an AshCloak-encrypted attribute, a binary-storage attribute, or is skipped.ValidateMultitenancy: a multitenant resource with atenant_attributehas a plaintext, declared discriminator; the tenant is never classified or skipped.
Value-free error & telemetry boundaries — sink failures and halt paths carry structure (error reason, table name, LSN) only. No row values, PKs, tenant names, or raw data appear in logs, errors, or telemetry. Column names are strings, never atoms.
Effect-once transaction model — each
Replicant.Transactionapplies in oneRepo.transaction: skip by commit-LSN watermark, apply rows, upsert checkpoint atomically. Failure rolls back; on resume, un-acked WAL re-streams and dedups against the durable checkpoint. Proven by crash-injection tests (loss = 0, effect-dup = 0).Documentation —
CLAUDE.md,AGENTS.md,README.md,CHANGELOG.md,usage-rules.md,CONTRIBUTING.md,LICENSE,NOTICE; tracked charter atdocs/CHARTER.md(only/docs/superpowers/lifecycle artifacts are local-only).