All notable changes to ankusa are documented here. Format follows
Keep a Changelog; this project
follows Semantic Versioning.
Release process: bump version in the package's mix.exs and move the
relevant [Unreleased] entries under a new dated heading in the same PR, in
accordance with SemVer. A pushed <pkg>-vX.Y.Z git tag publishes. See
docs/releasing.md for the mechanics.
Unreleased
0.7.0 - 2026-10-28
Added
Bounded claim sweeper and claim batch error handling (PERF-2).
Ankusa.ClaimCheck.Sweepersweeps one tenant per tick instead of globbing everyclaims/tenant=*/dt=*directory: a pass lists the tenant directories once, in name order, and each tick takes the next tenant's day partitions (by name, never a glob). The tenant a pass last finished is persisted (m:claim_sweep_cursor, additive: a build that does not know the row ignores it, so a rollback needs no step), so a restart resumes after it. While tenants are left the next step follows in 100 ms;scannedandpartitions_leftof[:ankusa, :claim_check, :sweep]now count the one tenant swept, andtenants_left(gaugeankusa_claim_check_sweep_tenants_left) is new.Ankusa.ClaimCheck.check_in_batch/2uploads its packs unlinked: an upload process that dies is{:error, {:unavailable, reason}}for that pack's items and no longer takes the dispatch packing task down, and an item no pack can hold is{:error, :too_large}; the claim-count and size limits now live insplit/3, andcheck_in/4answers{:error, :too_large}for more than 65 000 claims or about 4 GiB instead of raising fromPack.build/1. Seeclaim-check.md.Message size preflight and forwarded-header caps (DEL-5). A queue sink that
usesAnkusa.Sink.Messagingnow checks every message against itsAnkusa.Sink.Messaging.max_message_bytes/1(implemented for you: the:max_message_bytesoption, default 1 MiB) beforepublish/4, inAnkusa.Sink.Message.encode/4. An inline body whose base64 message would not fit is checked in and published as a claim; a body that is over the limit by itself is{:permanent, {:message_too_large, size, max}}, dead-lettered at once with no broker call.Message.max_bytes/1anddefault_max_message_bytes/0are new.Sink.GooglePubSub(10 MB) overrides the default;Sink.SQSkeeps:max_message_bytes.max_headers(64) andforward_headers_max_bytes(16 KiB) onAnkusa.Source.Ankusa.Sink.Message.forwarded_headers/2now takes a sinkctx(or a bare mode, as before) and drops a header past either cap, whole, emitting[:ankusa, :sink, :headers_dropped](ankusa_sink_headers_dropped_total{reason="count" | "bytes"}).Sink.Httpis capped too. Sources that forward more than 64 headers, or more than 16 KiB of them, lose the excess: raise the two keys to keep them.Owned, bounded HTTP connection pools (DEL-3). Every
Ankusa.HttpClientrequest that does not name its own transport (Sink.Http, SQS, Pub/Sub, JWKS and secret-provider fetches) goes throughAnkusa.HttpClient.Pools, one Finch for the node (Ankusa.HttpClient.Finch, started with the application) with a pool per receiver address and connection profile per instance, instead of Req's default of one 50-connection pool per origin that is never closed. Newegress.poolsconfig (inside theegresssection, soAnkusa.Configkeeps its 31 struct fields):pool_size(32),pool_count(1),pool_timeout(5000),pool_max_idle_ms(60000),conn_max_idle_ms(30000),max_pools(1024),max_pools_per_tenant(256) andprotocols([:http1, :http2], so HTTP/2 negotiates by ALPN), all range-checked, and a per-sinkpool: [pool_size:, pool_count:, pool_timeout:, protocols:]onSink.Http. An idle-pool sweep (every 30 s, mirroringSink.Reaper) closes pools idle forpool_max_idle_ms; deleting a source closes its idle pools; at a ceiling the least recently used idle pool (the tenant's own, formax_pools_per_tenant) is closed to make room, and with every pool serving a request the call is{:error, {:unavailable, :pool_limit}}, retried. Boot warns whenpool_size * pool_countis belowdispatch.concurrencyormax_pools * pool_size * pool_countpassesulimit -n. Gaugeankusa_http_pools([:ankusa, :http, :state]), countersankusa_http_pool_closed_total{reason}andankusa_http_pool_refused_total{scope}.Ankusa.HttpClient.request/6takes the pool context options:instance,:tenant,:sourceand:pool. Tests:http_client_test.exs,sink/http_test.exs,config_test.exs;bench/pools_bench.exs. Seedelivery.md.Ankusa.Sink.MessagingandAnkusa.Sink.Connections: the shared shape of a queue-style sink.use Ankusa.Sink.Messagingand implementpublish/4: the injecteddeliver/3encodes the hook asAnkusa.Sink.Message(inline, or its claim) and hands the payload over, andinline_max_bytes/1is implemented for you;resolve/2/static/1read a "string or function of the hook" option,endpoints/1a broker list ("host:port",{host, port}, or one comma-separated string).Ankusa.Sink.Connections.start_link/1starts an adapter's<sink>.Supervisor+<sink>.Reapertree under<sink>.TopSup, andensure/5finds or starts a connection under it and touches it in the reaper.Ankusa.Sink.Messagegainsheaders/2(theankusa_*transport headers, tenant always present),delivery_id/2(id, orid:replay:<replay_id>) andfits/2(the{:permanent, {:message_too_large, size, max}}gate);Ankusa.HttpClient.authority/1is public.mise run new:adapterscaffolds the new shape. Docs:packaging.md#adding-a-new-adapter-package.Claim gateway integrity check, and gateway, sweep and archive metrics (CLM-1).
claim_check.integrity_check(:manifest, the default, or:off): the gateway holds every whole-claimGETto the sha256 its pack's manifest records, answers502 integrity_mismatchrather than send bytes that differ (or from a pack whose manifest does not parse or does not list its claims), and sends the digest on200and206asx-ankusa-sha256. The manifest is read once per pack (one ranged read at the end of the last claim), coalesced byAnkusa.ClaimCheck.Readerlike any read ([:ankusa, :claim_check, :read]gainskind: :manifestandresult: :integrity_mismatch) and kept in the pack'sAnkusa.ClaimCheck.Cacheentry, so it counts againstread_cache_bytes(32 bytes a claim) and ages with the pack's index.Ankusa.ClaimCheck.digest/3is new; the locationlocate/4returns gains:claimsand:claims_end;Pack.count/1,manifest_header_bytes/0,manifest_size/1,digests/3anddigest/2are new. Metrics:ankusa_claim_gateway_requests_total{status}andankusa_claim_gateway_duration_seconds(these replace the unreleasedankusa_claim_check_gateway_*: status is the only label, no method),ankusa_claim_sweeps_total{deleted},ankusa_archive_failures_total(one per compactor tick that could not write a segment) andankusa_archive_oldest_unarchived_age_seconds(from the batch the compactor already reads, no scan). Telemetry:[:ankusa, :archive, :failure],[:ankusa, :archive, :state](:oldest_unarchived_age_ms), and:deletedmetadata on[:ankusa, :claim_check, :sweep]. Seeclaim-check.md#integrity.Pipelined WAL sync: the fsync is off the writer's critical path (DUR-4.b).
Ankusa.Queue.Writerapplies a group withsync: falseand hands its callers' replies to the newAnkusa.Queue.Syncer, which runs oneStore.sync_wal/1(RocksDBSyncWAL()) for every group applied so far and then answers them, so group N+1 is assembled and applied while group N syncs. Nothing external relies on a group before its fsync: dispatch does not scan its rows (Syncer.visible/2), the archive stops at the durable seq, and a retry's201 duplicatewaits for the fsync of the original; a failed fsync answers every group it covers with the error, reopens the store like a failed write, and is retried. Underwal: :dualthe local half's confirm is the syncer's. New[:ankusa, :wal_sync]span andankusa_wal_sync_duration_seconds;[:ankusa, :commit]now measures the write of a group into the store. ADR 0002 amendment 17 states the invariant and the crash order.Segment format header, safe index decode, dated archive layout, time-based roll (DUR-8). A segment is now
"ANKSEG" <> <<version, codec_id, count::32>>, the codec's frames and a sha256 trailer (Ankusa.Storage.Segment); its.idxis"ANKIDX"+ version + count +term_to_binary+ sha256 and is decoded withbinary_to_term(_, [:safe])and a shape check (Ankusa.Storage.Index), so a tampered or hostile index or segment is{:error, _}(Storage.fetch/2answers:error, archive replay logs and skips it). Segments go underarchive/v1/dt=<yyyy-mm-dd>/<node>/seg-<first>-<last>.seg(+.idxand the node-day_manifest.json;<node>isintake.node_id, else the host name), so a node without the catalogue can find another node's segments:Storage.fetch/2falls back to a day-prefix scan on a catalogue miss, and the newQueue.Archive.reconcile/2rebuilds catalogue rows from the prefix (the boot restore reconcile now runs through it).storage.roll_msis no longer dead: a partial segment is written once its oldest hook has waited that long, andstorage.max_segments_per_tick(16) caps what one compactor tick writes.Ankusa.Codecgains an optionalid/0callback. Segments written by earlier releases (seg/…, bare frames) stay readable. Store format 7 (the catalogue's segment rows recordformat,codec,node,dt,sha256; migrationSegmentRows, fixturestore-v7.tar.zst): a format 7 store cannot be opened by an earlier image, and an earlier node cannot read segments of format 1. Seestorage.md.Store failure telemetry,
/readyreasons and a reopen backoff (DUR-5).[:ankusa, :store, :write_failed](one per failed write a process reported and per failed readiness probe, with aclassfrom the fixed setAnkusa.Store.failure_class/1returns),[:ankusa, :store, :reopened](one per reopen attempt::durationis the WAL replay,:unavailable_msthe outage so far) and[:ankusa, :store, :unavailable](:seconds,0at boot and once open) feedankusa_store_write_failures_total{class},ankusa_store_reopen_total{result},ankusa_store_unavailable_secondsandankusa_store_wal_replay_seconds./ready's503body gainsreason(no_space,io_error,read_only,corruption,busy,timeout,not_running,other). A store that fails to reopen retries by itself after 5 s, then twice as long each time up to 60 s, each wait jittered down by up to a quarter (retry_open_ms,retry_open_max_msstore options). Changed:Ankusa.Store.ready/1answers{:error, {:store_unavailable | :write_failed, class}}instead of{:error, :store_unavailable | :write_failed | raw_reason}. Also: the reopen a failed write asks for now waits until a synced write of a small file next to the database works (ankusa_store_reopen_total{result="deferred"}) instead of closing a database that still answers reads while the disk still fails. The crash drills' EIO windows fail only the file data area (journal and metadata stay up), their harness logs to stderr (it was silent), and they check/ready'sreasonand theankusa_store_*series. Seedocs/storage.md#durability-corruption-full-disk.Object-store adapters: conditional puts, jittered retries, checksums, multipart, pools, credential refresh (DUR-7).
Ankusa.BlobStore.put_if_absent/4(a new callback every store implements; S3 and AzureIf-None-Match: *, GCSifGenerationMatch=0, OCIif-none-match: *,LocalFSa file check) answers{:error, :already_exists}and leaves the original alone; claim packs are written with it, andClaimCheck.check_in/4writes a refused pack again under a fresh pack id (3 attempts,[:ankusa, :claim_check, :pack_collision]). One absolute deadline per blob operation (op_deadline_ms, 120 s) covers every attempt, wait, multipart part, pack-id retry and store tried. Retries use full jitter, honourRetry-Afterwhen it fits the deadline and otherwise return{:error, {:throttled, seconds}}at once (claim check-ins surface it as{:unavailable, {:throttled, seconds}}); a breaker per{endpoint, bucket}(breaker_failures,breaker_open_ms,breaker_slow_ms: it also opens on p99 latency) answers{:error, :breaker_open}([:ankusa, :blob_store, :breaker]).upload_timeout_ms(60 s) governs a request that carries over 1 MiB, and a body overmultipart_threshold_bytes(8 MiB) goes up as an S3/OCI multipart upload, an Azure block list or a GCS resumable upload inmultipart_part_bytespieces. EveryPUTcarries a digest (x-amz-checksum-sha256,x-goog-hash,Content-MD5) and aGETverifies the one the store returns:{:error, :integrity}.pool_size,pool_countandpool_timeoutsize a Finch pool per endpoint that the instance starts (Ankusa.BlobStore.Pool), instead of Req's shared default. New token providersAnkusa.BlobStore.GCS.MetadataServerandAnkusa.BlobStore.OCI.InstancePrincipal(key_provider:), and on a401every adapter drops the provider's cached token (invalidate/n) and retries once with a fresh one. All options are range-checked at boot. CustomAnkusa.BlobStoreimplementations must addput_if_absent/4. Seestorage.md.Cross-partition group commit (DUR-4).
Ankusa.Queue.Writertakes every batch the batcher partitions have queued and commits them as one group: one synced store write (and, underwal: :dual, one intake publish), seqs dense across it, every caller replied to with its own hooks. The work that needs no seq moved out of the writer into the batcher's commit task: the hook's binary, its encoded delivery rows, and a prefetch read of its dedupe keys. The writer re-validates that read before it assigns seqs (the first occurrence of a key in a group wins, a key committed since the caller read it is answered from what the writer wrote, and underdualthe pending set is consulted), so the same provider key posted to two partitions at once still stores one hook. New keysbatcher.group_commit_max_bytes(default 4 MiB: every caller waits for its whole group, so the cap bounds the ack latency a backlog adds) andbatcher.group_commit_max_records(1 024); a partition now keeps up tobatcher.max_commits(64) commits in flight instead of one, so the writer finds every waiting caller in its mailbox, and a saturated writer waitsbatcher.group_commit_delay_ms(1) for the callers it just answered to join the next group (never at low load);batcher.partitionsnow defaults to 4. A delivery row'satis the time the hook was received rather than the writer's stamp (the due key keeps the writer's).bench/store_commit.exsmeasures commits/s and ack p99 at 1, 5 and 10 ms of fsync, and a one-second stall's drain. Seedocs/storage.md.queue.rocksdb: the store's RocksDB settings are config, andindexanddeliveriescarry a bloom filter (DUR-3).block_cache_bytes(64 MiB),bloom_bits_per_key(10; 0 = off),max_open_files(65 536),compaction_style(:level|:universal),rate_limiter_bytes_per_sec(0 = unlimited),max_background_jobs(4) andwrite_buffer_bytesper column family, each range-checked atAnkusa.Config.new/1and read back from theOPTIONS-*file instore_test.exs. The defaults add a whole-key bloom filter withcache_index_and_filter_blockson theindexanddeliveriesfamilies, so a first-seen dedupe key is one filter probe per file instead of an index and data block read; there is no prefix extractor, becauseindexalso serves ordered scans. Filters exist only in files written after the upgrade (compaction brings the rest); the store format is unchanged and no migration runs. The index and filter blocks now live in the block cache: sizeblock_cache_bytesfor a store with tens of millions of dedupe keys.bench/dedupe_bench.exsmeasures a miss and a commit against a store ofKEYSdedupe keys. Seedocs/storage.md#rocksdb-tuning-and-the-index-filters.Claim leases, and a bounded claim sweeper (DUR-2.c). The
LocalFSclaim retention sweeper no longer deletes a pack a hook still needs. Each hook that checks its body in leases the pack (Keys.claim_lease/3, rows?l, counterclaim_leases, gaugeankusa_claim_leases) in the same batch; the lease is held while the hook is live, a dead letter included, and when the hook is reclaimed it runs on forclaim_check.redeem_grace_ms(default 24 h) so the consumer of a queue message that carries the ref can still redeem it.Ankusa.ClaimCheck.Sweepernow runs on:dispatchnodes too, lists each expireddt=partition and deletes only unleased packs, at mostclaim_check.sweep_max_objects(default 10 000) a tick (ankusa_claim_check_sweep_backlog,..._sweep_partitions_left,ankusa_claim_check_pruned_total,ankusa_claim_check_leases_pruned_total), and deletes nothing when it cannot read the leases. Object-store claims have no lease: declare the bucket lifecycle rule's age inclaim_check.bucket_expiry_daysand boot refuses one shorter than the retry horizon (21 days) +queue.dlq.retention_days+ the redeem grace. Store format 6: the migration5 -> 6leases the claim of every live hook, resumably;test/fixtures/store-v6.tar.zst. A node running format 6 cannot be rolled back to an image that writes format 5. Seedocs/claim-check.md#claim-leases.wal: :dual: the ack waits for a replicated intake log too (DUR-1.b.a, ADR 0002). The core of the dual commit: theAnkusa.Intakebehaviour andAnkusa.Intake.Memory(a file-backed test double with fault injection),Queue.Writerrunning the synced local write and the confirmed publish in parallel (both required for the201; the reply is a message when the publish task answers, so batches pipeline), a bounded pending set, the breaker (Intake.Gate), the liveIntake.Reconcilerthat carries a half-persisted hook to completion (the fleet dedupe claim is held, then promoted; a retry that meets an unconfirmed original is503 intake_pending, never201), boot recovery (Intake.Recovery: identity, replay fromm:intake_offsetthrough the seq-and-id rule, republish of the local tail;mix ankusa.recover),Health.readyintake: up | down | recovering,GET /v1/walintake, theankusa_intake_*series,503 intake_unavailable/intake_pending, and everyintake.*key with its range. New meta rows only (m:intake_seq,m:intake_node,m:intake_partition); the store format is unchanged. The Kafka adapter, the YAML keys, the fleet drill and the architecture, storage and deployment docs are DUR-1.b.b.bench/intake_bench.exsis part ofmise run bench:gate.Tenant erase (TEN-5).
DELETE /v1/tenants/{tenant}?confirm={tenant}(new scopetenants:write, which also needstenant:*) andAnkusa.Tenant.delete/3erase a tenant as a resumable background job (GET /v1/tenants/{tenant}/erasereports it): the tenant is closed first (503 tenant_erasing, dispatch stops claiming its rows, running attempts drain), then its sources, routes, rate-limit override, pending/inflight/dead rows, archive obligations, quarantine rows,claims/tenant=<t>/objects, dedupe keys and lifecycle entities are deleted, and one synced batch commits the tombstonem:erased:<tenant>with atenant.deleteaudit row, which is the new lifecycle eventio.ankusa.tenant.deleted. Progress is kept inm:erase:<tenant>, so akill -9resumes the job at the next boot.Ankusa.Storage.fetch/2answers{:error, :gone}for an erased tenant's archived hooks and archive and lifecycle replay skip them.Queue.purge_tenant/3accepts:inflight. Configured (static or seeded) sources naming the tenant, anddefault, are refused with409. Proof:test/ankusa/tenant_test.exs,tenant_s3_integration_test.exs.DLQ, quarantine and catalogue retention; audit and lifecycle-outbox ceilings (DUR-2.b).
Ankusa.Queue.DlqReaperevicts dead rows pastqueue.dlq.retention_daysand overmax_rows/max_bytes, only while their hook is archived and findable; otherwise ingest answers503 dlq_full.DELETE /v1/dlqevicts on demand.quarantine.retention_days,storage.catalogue_retention_daysandarchive.retention_daysbound the pen and the archive catalogue;audit.max_rows,audit.max_bytesandaudit.outbox_max_backlogbound the trail and refuse new changes with503 audit_backlog. Store format 5 adds thedead_bytescounter (migration4 -> 5, fixturestore-v5): a node running format 5 cannot be rolled back to an image that writes format 4. Seedocs/storage.md.Dedupe ceilings, the dedupe sweeper and audit retention behind the outbox (DUR-2.a).
dedupe.max_entries(default 100 000 000) anddedupe.max_entries_per_tenant(default 30 000 000) bound the live ingest-dedupe keys: a hook whose key would be a new one past either is refused with503 {"error":"dedupe_quota"}andRetry-After: 60(outcome="dedupe_quota"onankusa_ingest_requests_total), never stored without its key. The count is the newdedupecounter (field 7 of thecountersfamily, so the check is one read per commit batch), and the expiry sweep moved out ofAnkusa.Queue.Writerinto the supervisedAnkusa.Queue.DedupeSweeper, which runs back to back while full chunks of expired keys keep coming (the old sweep was capped at 2 000 keys per 10 s) and has the writer apply each chunk, deleting a key only if a refresh did not replace it. Store format 4: the migration3 -> 4counts the?ekeys of a format 3 store, resumably;test/fixtures/store-v4.tar.zst. A format 3 release cannot open a format 4 store (no downgrade across this change). New seriesankusa_dedupe_keys,ankusa_dedupe_pruned_total. The audit trail's retention (audit.retention_days) no longer deletes a row, or its lifecycle entity, at or abovem:lifecycle_cursorwhilelifecycle.sinksis set, so a lifecycle sink that is down longer than the retention cannot lose events it has not seen;ankusa_audit_retention_blocked_by_cursorreports the expired rows held back. Seedocs/storage.md#ingest-dedupe-keys-bounded-expired-outside-the-writer.Backup verification, signed manifests, a final backup on stop and a secondary region (DUR-6).
Ankusa.Store.Backup.verify/2reads the latest backup back (manifest, every file's size and sha256) without writing, onbackup.verify_interval_ms, counted byankusa_backup_verify_failed_total{target}.backup.signing_key(a string or a list, each at least 32 bytes) signs every manifest with HMAC-SHA256 (manifest version 2; version 1 is still read) and a restore refuses an unsigned or mis-signed one. A clean stop takes one last backup underbackup.final_timeout_ms(20 s).backup.timeout_msbounds each object-store call.backup.max_age_msputs"backup": "fresh" | "stale"on/ready,503only withbackup.require_fresh.backup.secondaryis a second object store every backup is also written to, and restore falls back to. The manifest records the store format (a backup of a newer one is refused at restore) andm:intake_offset.Backup.restore/2is nowrestore/3.A restore is announced (DUR-6). A store restored from a backup writes a fresh
m:incarnationand, before taking any change, emitsio.ankusa.instance.restored(incarnation,restored_sequence); lifecycle event ids of rows from then on are keyed with the incarnation, so audit sequence numbers the lost node had already published are not reused as event ids. Rows of the restored trail keep their ids.Routes at 10⁶ entries (TEN-9). The route snapshot is indexed by the literal segments a pattern starts with (
{:lit, gen, prefix, priority, id}, up to eight), so a request is matched against the few routes that share its leading literals, merged in priority order, instead of every pattern in the table: a miss with the decision cache out of the picture is microseconds at a million routes, with the same answers as the old walk (the newroutes/snapshot_test.exschecks it against the old walk on random tables). Enabled routes are also indexed by{compiled pattern, method}, so the create/replace/update conflict check is one lookup per method, not a scan of every pattern;Routes.list/2pages from its cursor with:ets.next/2instead of sorting the table; publishing a generation inserts in batches of 2 000 routes and no longer sorts. Newroutes.memory_budget_bytes(default 8 GiB): at bootmax_routesis multiplied by an estimate of what a route costs (Snapshot.estimated_bytes/1) and a cap that does not fit is anArgumentErrornaming both keys; a store refuses a load that does not fit (Snapshot.check_budget/2).bench/routes_bench.exs(10⁶ routes over 10⁵ paths by default;mise run bench:gateruns it at 10⁵) asserts boot and reload time, miss p99 < 1 ms, create/list flat in the table size and bytes per route against the estimate. The same prefix index backsSnapshot.overlaps/4(every route whose pattern shares a request path with a candidate, each carrying itstenant_id; one prefix chain, not the table) andMatcher.overlap?/2: the query a cross-tenant path-overlap check (TEN-4.b) needs. Nothing calls it yet.Per-tenant observability with a cardinality policy (TEN-7).
metrics.detail(:tenantby default,:source,:none) says which identity labels the per-hook Prometheus series carry, andmetrics.max_series_per_metric(default5000, a positive integer) caps how many label sets one metric keeps: the firstmax_series_per_metric - 1are admitted, every later one is counted undertenant_id/source_id"other"(Ankusa.Metrics.Cardinality, an ETS admission in the emitting process: one:ets.member/2for a known label set). The ingest, verify-failure, quarantine, rate-limit and delivery counters now carrytenant_id;source_idonly under:source, which also puts both on the ingest duration histogram;:nonecarries neither and drops the two per-tenant gauges, so the scrape does not grow with the tenant count. A gauge past the ceiling drops the tenant instead of writing to"other". The[:ankusa, :ingest],[:verify],[:quarantine, *]and[:dispatch, :stop | :dlq | :breaker]events carry:tenant_idmetadata.Ankusa.Metricsis now a supervisor (the policy's table and the reporter restart together). Behaviour change:source_idis no longer a label by default (it was on the ingest, verify-failure, weak-hash, quarantine and dead-letter series, and the ingest duration histogram), andAnkusa.Edge.Quarantine.hittakes the tenant too (instance, source_id, tenant_id). Seedocs/configuration.md#metric-cardinality; tests inmetrics_test.exs,config_test.exs.Per-tenant HTTP destinations on shared sources (TEN-8).
Sink.Http's:url,:headersand:secretaccept a one-arity function of the%Envelope{}or a{mod, fun, args}, resolved on every attempt, so one shared source delivers each tenant's hooks to that tenant's receiver. The resolved URL goes through the egress policy on every attempt (a denied or rebinding target fails closed as{:permanent, {:egress_denied, _}}), a secret that resolves to nothing is{:permanent, :unsigned_sink}unlessallow_unsigned: true, and a value of the wrong shape is{:permanent, {:computed, key, :invalid}}.validate_opts!/1checks the shapes at load.Sink.Http.describe/2reportscomputed: [...]andpayload: :bodyin the newSink.Descriptionfields of those names (payload: :message, the default, is what the AsyncAPI document keeps;hostmay now benil). Computed URLs connect through the owned pools of DEL-3 below (the per-instanceAnkusa.Sink.Http.Poolthis entry first shipped was folded into them).finchis now a declared dependency (already locked through Req).HttpClienthonoursreq_options: [finch: [name: pool]], which raised before (Req refuses:finchbeside the:connect_optionsit always set); the pool then owns the connection options, and combining it with:connect_options,:cacertfileorallow_insecure_tlsraisesArgumentError.Fleet-scoped rate limits and dedupe (TEN-6).
rate_limits.scopeand the newdedupe.scopetake:node(the default, unchanged) or:fleet: the tenant quota (hooks and bytes per second) and the provider event key are then counted infleet.store, a module implementing the newAnkusa.RateLimiter.StoreandAnkusa.Dedupe.Storebehaviours (Ankusa.RateLimiter.Store.Redisinankusa_redis), so N edge nodes enforce one limit and a provider retry on another node is the first hook, not a second.Ankusa.Edge.Fleetis the request path's one entry (Ingestcalls it in place ofRateLimiter.hit/3): one store call per hook carries the tenant's charges and the dedupe claim. The claim is two-phase: pending before the commit, committed (with the hook's id) after it, off the request path in batches; a commit that fails releases it, a key another node holds pending is409 dedupe_pendingwithRetry-After(outcome:dedupe_pending), one it committed is201with the first hook'sidand"duplicate": true. A limiter outage never refuses a hook: every call has a hard budget (fleet.timeout_ms, 1–1000, default 20), a call that fails or times out is answered from the node's own limiter and dedupe index, and a breaker (fleet.breaker_*) opens on the failure rate and probes half-open. New telemetry and metrics:[:ankusa, :fleet, :degraded | :breaker | :fallback | :settle_dropped],ankusa_fleet_limiter_degraded{kind},ankusa_fleet_breaker_transitions_total,ankusa_fleet_fallback_total,ankusa_fleet_settle_dropped_total.per_ip,nodeandsourcesstay per node. New config:fleet(store,timeout_ms,pending_ttl_ms,breaker_window_ms,breaker_min_calls,breaker_failure_rate,breaker_open_ms),dedupe.scope,rate_limits.scope;RateLimiter.fleet_charges/3. Tests:edge_fleet_test.exs,config_test.exs.Dispatch fairness by tenant (TEN-3). A scan claims from the tenants with work due by deficit round-robin (an equal share of the page each, a tenant with less due leaves the rest to the others, a tenant the page did not reach goes first in the next scan), and every tenant has its own window beside the global one:
dispatch.tenants.defaultanddispatch.tenants["acme"]setmax_inflight(default 1024),max_inflight_bytes(32 MiB) andconcurrency(16), so a tenant whose sink is slow fills its own window and nobody else's. Slots go round-robin across tenants, then across a tenant's keys. The sink key is now{tenant_id, source_id, sink index, module}: circuit breakers anddispatch.sink_concurrencyare per tenant. New gaugeankusa_dispatch_tenant_inflight{tenant}(claimed rows, the 100 tenants holding the most).Deliveries.next_due_at/3takesskip:, the tenants at their window. Proof:tenant fairnessintest/ankusa/dispatch/isolation_test.exsandbench/tenant_fairness_bench.exs.Tenant key layout, per-tenant counters and the active-tenant index (TEN-1.b, ADR 0001). Store format 3. Every tenant gets a dense ordinal (
tenantscolumn family, assigned once at its first committed hook, never reused); due, claimed and dead rows lead their keys with it (?D,?F,?Xbeside the global?x), so one tenant's rows are one contiguous range. Six counters per tenant and for the node (pending,scheduled,inflight,dead,bytes,archive_pending;pendingis now first-attempt rows andscheduledretry rows, their sum unchanged) live in acounterscolumn family written only aserlang_merge_operatorint_addoperands in the same synced batch as the transition, so counts and rows agree after akill -9. An active-tenant index (?A, one marker per tenant per second with a due row, cleaned by delete-then-verify) makes a dispatch scan cost the tenants with work due, not all tenants; the scan keeps a cursor per tenant. New:Queue.pending_for_tenant/2anddead_for_tenant/2(constant time),Queue.purge_tenant/3(synced chunks of 500 rows, resumable by calling it again),tenants.max(default 1 000 000; a hook of a tenant past it is503 tenant_limitwithRetry-After: 300), the seriesankusa_tenants,ankusa_dispatch_active_tenantsandankusa_tenant_pending{tenant}(the 100 tenants with the most pending). The queue gauges read counters instead of folding the index, so a gauge tick costs the same at 10³ and 10⁶ queued rows and at 10 and 10⁵ tenants (bench/gauges_bench.exs,bench/dispatch_tick_bench.exs, run bymise run bench:gate); a tenant-limitedGET /v1/dlqis one range scan of that tenant's rows instead of a hook read per dead row. The v2 → v3 migration re-keys the rows in bounded, resumable batches and seeds the counters from them; a release that writes format 2 refuses a format 3 store, so rolling back past this release needs a backup taken before the upgrade (Upgrading between releases).mix ankusa.store.fixturewrites the new layout (store-v3.tar.zst).Admission at the edge: per tenant, per source, per address, per node (TEN-2).
rate_limitsgainsper_ipandnode(%{rate, burst}, hooks per second per client address and for the whole node; off by default) andsources.default.bytes_per_second(body bytes per second per source, 100 MB/s unless changed,default: nilis off). They run inAnkusa.Edge.Routerafter the source lookup and before the body is read, so a forged flood costs neither a read nor an HMAC:429 ip_rate_limited,429 node_rate_limited,429 source_rate_limited, each withRetry-Afterand counted onankusa_ingest_refused_total{reason}. The client address isAnkusa.Net.ClientIP's (routes.trusted_proxiesdecides whoseX-Forwarded-Forcounts), an IPv6 address is its/64, and addresses hash into 2^20 buckets, so the table has a ceiling. The declaredContent-Lengthis charged up front; a body with none is charged once it has been read. A tenant's limit (rate_limits.tenants[t]andrate_limits.default, and a runtime override) may now also carrybytes_per_secondandburst_bytes(body bytes, charged with the hook after verification),max_body_bytes(413, checked against the declared length before the read and enforced on the bytes received; at most the instance's) andmax_queue/max_queue_bytes, the hooks and body bytes the tenant may hold in this node's batchers at once.Ankusa.Edge.Batcher.commit/4counts the share in ETS (Ankusa.Edge.RateLimiter.acquire_queue/3, released when the call returns or exits, so a crashed batcher leaks nothing) and answers{:error, {:tenant_overload, retry_after_ms}}, a429 tenant_overload, never the global503 overload. NewAnkusa.Edge.RateLimiterfunctions:pre_read/4,hit_ip/2,hit_node/1,hit_source_bytes/3,body_limit/2,acquire_queue/3,release_queue/2, andhit/3(hit/2is unchanged). The admin API's rate-limit routes accept and return the new keys (only when set), andingest.v1.yaml/admin.v1.yamldescribe them. New refusal reasons:ip_rate_limited,:node_rate_limited,:source_rate_limited; new ingest outcome:tenant_overload. Tested inedge_rate_limit_test.exsandconfig_test.exs.Tenant-aware routes bound to sources (TEN-4). A route now has a
tenant_id(default"default", the shared tenant) and an optionalsource_id, inRoute.from_attrs/2,to_json/1,from_json/1, theroutes.seedentries and the admin API, and the route guard hands the route it matched to ingest instead of discarding it:conn.assigns.ankusa_routeis now theAnkusa.Routes.Route(it was its id),Routes.capture/5isauthorize_path/5answering with the route, andAnkusa.Edge.Ingest.lookup/3holds the route's binding against the resolver. A route owned by a tenant admits hooks only into that tenant (another tenant in the URL, or a source owned by another tenant, is the404an unknown source gets) and, matched on a shared source that the URL names no tenant for, files the hook under its own; a route bound to asource_idadmits only that source. The ingest span carries:route_id. Route lifecycle events and audit rows now carry the route's tenant instead of"default", so a replay or an audit read filtered to a tenant sees its own routes. The route-management listener gains a tenant surface,GET|POST /v1/tenants/:tenant/routesandGET|PUT|PATCH|DELETE /v1/tenants/:tenant/routes/:id, that needstenant:<tenant>(nottenant:*) and shows and changes only that tenant's routes, read from a{tenant, id}index in the snapshot table (Snapshot.tenant_routes/4); another tenant's route is404, a body naming another tenant is400 invalid_route, and an id or path another tenant holds is a409 duplicate_routethat does not name the holder./admin/routesstays the all-tenants operator surface (tenant:*), so the SDKs' routes clients are unchanged.tenant_idandsource_idare immutable underPATCH. Breaking for a customAnkusa.Routes.Store:delete/2is nowdelete/3, taking the tenant the delete is made for (nil: any owner), which the store checks in the delete itself.Route.to_stored_json/1leaves out a defaulttenant_idand an absentsource_id, so a node from before them still reads a Redis table with no tenant routes.Verifier breadth: public-key, token and client-certificate (SEC-12). A provider that signs with Ed25519 or RSA, sends a static credential, or authenticates by mutual TLS no longer has to be a
Verifier.Nonesource withaccept_flag.Ankusa.Verifier.Asymmetricverifies an Ed25519 (RFC 8032) or RSASSA-PKCS1-v15/SHA-256 signature against the provider's public key (`whpkbase64, bare base64, or a PEMPUBLIC KEY/RSA PUBLIC KEY; a list for rotation), over the same wire templates asHmac, with the preset:standard_webhooks_asym(v1a,entries) and a replay window; it holds no secret, and a signature of the wrong length is dropped before any public-key operation, at most 8 being tried per request.Ankusa.Verifier.Tokenaccepts a bearer, basic, header or query credential (rotation list, comparison over SHA-256 digests withsecure_compare/2) and keeps it out of everything stored: its header is added to the source'sstore_headersdrop list.Ankusa.Verifier.ClientCertaccepts a request whose mutual-TLS client certificate matches a pinned SHA-256 fingerprint or a SAN/CN identity; the edge fetches the certificate from the socket only for such a source and passes it, and the query string, through the verifier'sopts(the envelope and the stored format are unchanged). The shared half ofHmacmoved toAnkusa.Verifier.Template(candidates/2,timestamp/4,signed_bytes/3), andAnkusa.Verifier.Schemesvalidates%Asymmetric.Scheme{}too. A new optionalAnkusa.Verifiercallback,validate_opts/1, is run at boot byvalidate_config!/1for every verifier that has one, which now refuses a token secret, public key or pin it cannot use, and aClientCertsource on a listener withouttls.verify: :verify_peer, naming the source. New failure reasons:bad_keyand:bad_pin.Redactshowslocation,fingerprints,subjects,paramandalgorithm, never a secret or a public key. See [docs/configuration.md`](../../docs/configuration.md#public-key-token-and-client-certificate-verifiers).Claim gateway authorization and signed, expiring refs (SEC-11). The gateway's built-in check (
claims:readplustenant:<t>/tenant:*, a tenant-A credential on a tenant-B path is403) can be replaced withclaim_check.authorize: {mod, fun, args}, called before anything is read with%{principal, tenant_id, claim_id, conn}. New v2 refs,urn:ankusa:claim:v2:<tenant>:<claim_id>:<exp_unix>:<base64url hmac-sha256>, are minted whenclaim_check.ref_signing_keys([current | previous], each at least 16 bytes, shown as[REDACTED]by/v1/config) is set, expire afterclaim_check.ref_ttl_ms(default: the retention, else 30 days), and redeem atGET /v1/claims/<t>/<c>?exp=&sig=: a signature no key produced is400 bad_signature, a good one past its expiry410 ref_expired, and a v1 ref400 unsigned_refonce keys are set (unlessclaim_check.accept_unsigned_refs: true;redeem/3applies the same rule,Ankusa.ClaimCheck.verify_ref/2).Ankusa.ClaimCheck.Refparses both grammars and hassign/3,verify/3andsigned/4. With no keys nothing changes: refs stay v1 and are served.claim_check.max_concurrent_reads(default 1024,0= no cap) sheds a node's excess requests as503 overloaded+Retry-Afterbefore any read. The OpenAPI contract and the AsyncAPIclaimpattern describe v2; conformance has theclaim_ref.v2andclaim_check.redeem.signedcases. A pre-SEC-11 node reads a v2 ref as invalid: roll the gateways and the SDK readers before setting keys on the writers.Ankusa.SecretProviderandAnkusa.SourceStore.Static.publish/2(SEC-9). The behaviour (fetch(ref, opts)returning{:ok, binary} | {:error, :not_found | :unavailable}) a secret manager implements; theankusa_serverimage resolves${sm:<provider>:<ref>}through it.publish/2replaces the sources a running instance with the static source store serves, after the checks it boots under (durability underwal: :none, shared sources without a verifier, verifier options, egress), and returns the ids that changed; a refused spec applies nothing. Reads see the new spec on their nextfetch/2.Durable lifecycle outbox with revisions (SEC-2.b). Lifecycle events are no longer queued in memory: the audit row of a source or route change is flagged
publish: trueand committed, with the redacted entity beside it (<<?o, seq>>; an audit row still never holds a spec), in the same synced batch as the change.Ankusa.Lifecycle.Publisheris a cursor reader over those rows (m:lifecycle_cursor, synced on every advance; a first boot starts at the end of the trail), so akill -9right afterSourceStore.put/5returns still deliverssource.createdafter the restart, and events arrive in commit order. Events carryrevision,actor,instance,sequenceand the full redacted entity on delete; the eventidis derived from the row (a keyed hash laid out as a UUID, version 8) andtimeis the commit time, so a redelivery after a crash, or a replay, is the same event and a consumer dedupes onid.Ankusa.Replayhas a fourth kind,:lifecycle(since/until, and the SEC-7tenantsfilter;POST /v1/replays {"kind": "lifecycle"}) that re-emits a window of the trail, addingreplayid. A pending audit row of a route or Redis-store source (a node killed mid-change) is settled by comparing the subject's present state with the row'sbefore_hash/after_hash: applied (ok, announced), not applied (failed, not announced) or neither (staysinterrupted, announces a state-refreshupdated/deletedevent with the current entity and revision).Ankusa.SourceStoregains the optionalready?/1callback for it. TheLifecycleEventV1schema in the AsyncAPI document names the new attributes. Breaking: the in-memory queue and its:queue_full/:not_runningdrop reasons are gone (ankusa_lifecycle_dropped_totalhasgave_upandunreadable),Lifecycle.source_changed/3androute_changed/3andPublisher.publish/4are removed, a route deletion'sdatais the whole route (it was{"id": ...}), and a node with lifecycle sinks but no store runs no publisher. The store gains them:lifecycle_cursorkey and the?okey family in theauditcolumn family: additive, no format bump; a release that predates them ignores both (and leaves orphaned?orows when it prunes).Verifier hardening (SEC-8).
Ankusa.Verifier.Hmaccaps:toleranceatAnkusa.Verifier.max_tolerance_seconds/0(3600 s):validate_opts/1returns{:error, :bad_tolerance}for anything but an integer from 0 to 3600,Ankusa.Verifier.validate_config!/1refuses to boot a source declared in config with one (naming it), andverify/2fails every hook closed with:bad_tolerancefor a stored source written before the cap. An inline scheme withhash: :sha1still verifies (some providers only sign that way) but now logs one boot warning naming the source, and every verification of it increments the newankusa_verifier_weak_hash_total{instance,source_id,scheme}counter (:weak_hashon the[:ankusa, :verify]span metadata);Ankusa.Verifier.Hmac.weak_hash?/1is the predicate. No named scheme uses SHA-1.Tenant-scoped admin reads and writes (SEC-7). The DLQ, replay jobs, the quarantine pen and the rate-limit listing are filtered by tenant instead of needing
tenant:*:GET /v1/dlq,GET|DELETE /v1/quarantine,GET /v1/rate-limits,GET /v1/replays[/:id]andPATCH /v1/replays/:idtake?tenant=<id>(POST /v1/replaysatenantbody key). A principal limited to sometenant:<id>scopes gets rows for those tenants only (forced server-side),403namingtenant:<id>when the request names another tenant, and403namingtenant:*when it holds no tenant; onlytenant:*reads, purges or replays unfiltered. A purge deletes, and a replay touches, only the caller's tenants' rows; a replay job carries atenantsfilter and is404to a limited caller it is not scoped to.Ankusa.Queue.dead/2,Ankusa.Edge.Quarantine.recent/3/purge/3andAnkusa.Replay.start/3take:tenants;Replay.list/2andget/3take the visible tenants,Replay.update/4thetenants:option;Ankusa.Admin.Auth.authorize_tenants/4is the plug-side helper. Until the store keys carry the tenant (TEN-1) the DLQ filter reads the hook of each candidate row. Route definitions and IP rules still needtenant:*.Audit trail (SEC-2.a). Every change to an API-managed source, a route, the global IP rules, a rate-limit override, the quarantine pen (
DELETE /v1/quarantine) or a replay job writes one row to the newauditcolumn family: actor (Ankusa.Principal), client address, request id (X-Request-Id, echoed in the response),action,tenant,resource, keyedbefore_hash/after_hash(never a secret or a spec),resultand the subject'srevision. Rows are in commit order (<<?a, seq, at>>:Ankusa.Auditallocatesseqand commits the batch). Changes in this node's store (sources, rate limits, quarantine, replays) are committed in the same synced batch as their row; route definitions and the Redis source store are a dual write (a pending row, then the outcome), and a node killed in between recordsresult: "interrupted"at the next boot.GET /v1/audit(scopeaudit:read, newest first,since/until/actor/action/tenant/cursor/limit; a tenant-scoped reader sees only its tenants' rows),audit.retention_days(365), telemetry[:ankusa, :audit]and[:ankusa, :audit, :pruned]. Sources and routes carry arevision(also in their API objects).SourceStore.put/6,delete/4,Routes.*,RateLimiter.*_override,Quarantine.purge/4andReplay.start/3/update/4takeaudit: %Ankusa.Audit.Context{}; code that passes none issystem. The store format is now 2 (store-v2fixture): a node that has booted it cannot roll back to a format 1 release without restoring a backup, and a node withadmin.enabledor a writable source store now opens the store.Secrets encrypted at rest, server-side encryption on every object-store write (SEC-4).
Ankusa.Crypto.Envelopeencrypts the secret-bearing fields of an API-managed source's spec (the onesAnkusa.Admin.Redacthides:verify.secret, sink credentials, header values, URLs with credentials) with AES-256-GCM (<<"AENC", 1, key_id_len, key_id, iv::96, tag::128, ciphertext>>, base64 behindAENC:in the JSON) beforeAnkusa.SourceStore.Persistentwrites the row, so neither the node's store files nor any backup of them hold a secret in the clear. The key comes from the newsecretsconfig section:kek(32 bytes, base64, optionally<id>:<base64>) orkek_provider: {module, fun, args}, andkek_previousfor rotation (keys that decrypt and never encrypt). A stored row no key opens refuses the boot instead of being skipped; rows written before a KEK existed still load.Ankusa.SourceStore.Persistent.rewrap/1andmix ankusa.secrets.rewrap(a stopped node's data dir; keys fromANKUSA_KEKandANKUSA_KEK_PREVIOUS,--dry-run) move every row to the current key, in synced batches.Ankusa.Admin.Redact.config/1shows the keys as[REDACTED]. The 0.3 import encrypts the sources it imports. The startup log now says how secrets rest:store files rely on volume encryption; secrets envelope-encrypted with key <id>(or that they are stored in plaintext).sse:onAnkusa.BlobStore.S3,GCS,AzureandOCI(%{type: :aes256}or%{type: :kms, key_id: key}): server-side encryption sent on everyput/4of that store, so on segments, backups and claim packs alike (x-amz-server-side-encryptionand…-aws-kms-key-id, signed;x-goog-encryption-kms-key-nameandkmsKeyName;x-ms-encryption-scope;opc-sse-kms-key-id).Ankusa.BlobStore.validate_config!/1checks it at boot forstorage.blob_store,backup.blob_storeand everyclaim_check.blob_storesentry; a misspelled option,:kmswithout thekey_idthe provider needs, orsseonLocalFSis a boot error, never an unencrypted object. Seedocs/storage.md#encryption-at-rest.Authentication and scopes on every control plane (SEC-1). The admin API, the route-management API and the claim-check gateway authenticate every request but
GET /health/GET /ready(401withwww-authenticate,403naming the missing scope). Newadmin.auth,routes.admin.authandclaim_check.authblocks pick themode::token(SHA-256-hashed bearer tokens with scopes),:jwt(Ankusa.Admin.Auth.JWT: OIDC access tokens verified withjoseagainst a cached, refreshed JWKS or static keys; checksiss,aud,exp,nbf; scopes fromscope, tenants fromankusa_tenants),:mtls(Ankusa.Admin.Auth.MTLS: theverify_peerclient certificate, mapped bymtls.subject_map), or:none. A caller is anAnkusa.Principal(conn.assigns.principal) with scopes (metrics:read,config:read,sources:*,dlq:*,replays:*,quarantine:*,rate_limits:*,routes:*,claims:read) and tenants (tenant:<id>,tenant:*); resources that span tenants needtenant:*.joseis a new core dependency. The OpenAPI documents declare the security scheme and the401/403responses.Breaking:
mode: :noneis refused on a non-loopback address. A running admin, route-management or claim-check listener bound anywhere but loopback now failsAnkusa.Config.new/1unless itsauth.modeis:token,:jwtor:mtls, orauth.allow_insecure: truesays a proxy or mesh in front authenticates every caller./v1/configshows each token'sidand scopes but never its hash.Stored-header policy (SEC-5). A hook used to be stored, archived and forwarded with every provider header,
Authorization,Cookieandx-api-keyincluded. The newstore_headersconfig key (%{drop: [...], hash: [...]},Ankusa.Edge.StoredHeaders) and the per-sourcestore_headersoverride are applied inAnkusa.Edge.Ingestafter verification (the verifier and the dedupe key still read every header):dropremoves a header from the hook,hashkeeps it with the value replaced bysha256:<hex>. The default dropsauthorization,proxy-authorization,cookie,set-cookie,x-api-keyandx-auth-token, so those are no longer in the stored hook, the archive segment, the quarantine pen or any sink message; setdrop: []to keep the old behaviour. The[:ankusa, :ingest]span's stop metadata gains:dropped_headers. Hooks stored before the upgrade are not rewritten. Seedocs/configuration.md#stored-headers.Hardened listeners, TLS/mTLS on every listener, a separate metrics listener (SEC-6). The new
listenerconfig section sets what Bandit's defaults left open, on every HTTP listener the instance runs:read_timeout_ms(10 s: a connection that sends nothing, or dribbles its request head, is closed),body_read_timeout_ms(15 s) andrequest_deadline_ms(30 s: the ingest port answers408),max_connections(20 000, overnum_acceptors, default two per scheduler),max_requests_per_connection(1 000),max_header_count(64),max_header_length(16 384) andhttp2(false).listener.tls,admin.tls,routes.admin.tls,claim_check.tlsandmetrics.tlstake a TLS block (certfile,keyfile,cacertfile,verify,versions,ciphers,Ankusa.Listener);verify: :verify_peerdemands a client certificate (mTLS) and makes it available as the request's peer certificate.metrics: %{enabled, ip, port}startsAnkusa.Metrics.Router, a listener that serves only/metrics,/healthand/ready; the admin API keeps serving/metrics.Ankusa.Http.read_body_limited/3takes:read_timeoutand:deadline. Every new key is range-checked at boot. Behaviour change: listeners are now HTTP/1.1 only and close idle connections after 10 s; setlistener.http2: true/listener.read_timeout_msto restore Bandit's behaviour.Store format version, migration registry, downgrade guard. The store records its layout version under
m:format_version(this release writes format 1; a store without the key is format 1 and is stamped on first open). A release that changes the key layout registers a migration in the store's migration registry; on boot, before serving, migrations run in order in bounded synced batches, each recording its place inm:migrating:<to>so a node killed mid-migration resumes at the next boot. A store written by a newer release refuses to open with{:store_format_newer, found, supported}instead of being read by code that ignores its keys. New tasks:mix ankusa.store.migrate [--dry-run]shows (or applies) the plan for a data directory, andmix ankusa.store.fixture <path>packs a seeded store as atest/fixtures/store-v<n>.tar.zstupgrade fixture. Upgrade order and rollback:deployment.md.Ankusa.Net.cidr/0, the type of a parsed CIDR range, now in the specs ofAnkusa.Net.parse_cidr/1andAnkusa.Net.ClientIP.resolve/2in place of%CIDR{}.Several claim stores, with failover.
claim_check.blob_storestakes a list of{module, opts}(buckets, regions, providers) andclaim_check.placementpicks a new pack's store::ordered(default) the first, the others only while it is down;:hashspreads packs over every store by the pack id's random bits. A failed pack write moves on to the next store at once, and a store whose write failed, or that could not answer a read, is skipped by writes and searched last by reads forclaim_check.store_cooldown_ms(default 30 s); a throttled answer (429,503) never opens the breaker. A read searches every store under both key layouts, healthy stores first, so a failed-over pack is still found, and a store that could not answer is not asked again within the same read; a miss while some store could not answer is{:unavailable, reason}, never:not_found. Acheck_in/4that tried several stores fails with{:unavailable, [{store, reason}, ...]}in attempt order ({:unavailable, reason}after a single attempt, as before). Refs, the gateway API and the SDKs are unchanged: the store is a function of the ref and the config.Ankusa.ClaimCheck.validate_config!/1rejects a badblob_stores,placementorkey_layout, andretention_dayswith any non-LocalFS claim store. NewAnkusa.ClaimCheck.Stores, supervised in every role;Ankusa.ClaimCheck.locationgains:store;[:ankusa, :claim_check, :check_in]gains:store, and[:ankusa, :claim_check, :store_breaker]/ankusa_claim_check_store_breaker_transitions_totalcount breaker opens and closes.Sharded claim keys.
claim_check.key_layout: :shardedwrites packs underclaims/tenant=<t>/shard=<c>/dt=<d>/<pack>,cbeing the pack id's eleventh character: 32 prefixes per tenant, so one busy tenant's writes spread over 32 object-store partitions instead of throttling (S3503 SlowDown) on one. Opt-in (default:flat, the existing layout); reads try both layouts whatever it says, and the LocalFS sweeper sweeps both.Ankusa.ClaimCheck.Ref.object_keys/3andshard/1.[:ankusa, :blob_store, :retry]on every HTTP blob-store retry, counted byankusa_blob_store_retries_total{status}.The claim gateway stays fast while an object store throttles or hangs. A
:claim_checknode caches pack indexes and claims in memory (Ankusa.ClaimCheck.Cache,claim_check.read_cache_bytes, default 128 MiB; a claim overread_cache_max_entry_bytes, default 1 MiB, is never cached), and reads the store throughAnkusa.ClaimCheck.Reader: concurrent reads of one pack index or claim share one store request; per store, an adaptive limit on concurrent reads (ceilingread_max_inflight, default 48, under the HTTP client's 50 connections per host) halves on a throttle (429,503) or an unreachable store and grows back by one per round of successes; reads past it queue up toread_queue_max(default 256) and the rest are shed at once; and every request is answered withinread_deadline_ms(default 5 s) — a store read that outlives it still fills the cache. Claim reads useread_timeout_ms(3 s) andread_retries(1) instead of the store's own write timeouts.Ankusa.ClaimCheck.locate/4,read/4andread_bytes/5take a:deadline;Ankusa.ClaimCheck.locationgains:tenant_id,:pack_idand:index;Ankusa.ClaimCheck.deadline/1andAnkusa.ClaimCheck.Stores.throttled?/1are new. Telemetry:[:ankusa, :claim_check, :gateway],:read,:read_limitand:read_state; on/metrics,ankusa_claim_gateway_requests_total{status},ankusa_claim_gateway_duration_seconds(buckets up to 10 s, past the deadline),ankusa_claim_check_reads_total{kind,source,result}andankusa_claim_check_read_limit/_read_inflight/_read_queued{store}.Egress policy:
Sink.Httpcan no longer be pointed at loopback, the cloud metadata service or the private network (CWE-918).Configgainsegress: %{allow_insecure_http, deny_cidrs, allow_cidrs, allow_hosts, deny_hosts}; everySink.Httpattempt (a source's and a lifecycle sink's) goes throughAnkusa.HttpClient.Egress: the name is resolved for both families and the delivery is refused, as{:permanent, {:egress_denied, reason}}, when any address is denied (loopback, RFC 1918, carrier-grade NAT, link-local, unique-local IPv6, the unspecified addresses; IPv4-mapped IPv6 and odd literals such as2130706433match as the address they are) and not excepted byallow_cidrs/allow_hosts, or the host is indeny_hosts(metadata.google.internal).httpURLs are refused unlessallow_insecure_http; anhttpdelivery connects to the address that was checked, with the name as itshostheader. A name that does not resolve is retried. Reasons name the host and address, never the URL.configuration.md#egress.TLS verification is explicit everywhere. Every outbound
httpsrequest (Ankusa.HttpClient: object stores, SQS, Pub/Sub, HTTP sinks) verifies the peer's chain and hostname and negotiates TLS 1.2 or 1.3 only.Sink.Httptakes:cacertfile(a private CA bundle) and:allow_insecure_tls(the one way to skip verification, per sink); averify: :verify_nonein:req_optionsraises fromHttpClient.validate!/2, and fails the config load for a static or lifecycle HTTP sink (Egress.validate_config!/1,Sink.Http.validate_opts!/1).castore ~> 1.0is now a locked dependency (Mint's fallback bundle).Ankusa.fetch_config/1,Ankusa.HttpClient.validate!/2(public).Bounded, cursor-paged DLQ listing and filtered replay (DEL-6).
GET /v1/dlq/Ankusa.Queue.dead/2no longer folds the whole dead family: a page is a reverse range scan oflimit + 1keys (no scan examines more than 10 000), returned with anext_cursorto pass back ascursor(nullon the last page; a selective filter can give a short page with the cursor set, so keep asking until it isnull).totalis a counter read when the only filter is the tenant, the match count when a filtered scan reached the end inside the first page, andnullotherwise (it was always exact before, at the price of the full scan). New filterssinkanderror_class(permanent,throttled,transient:Ankusa.Sink.error_class/1), which every entry now also carries besidesink; a dead row records its class (error_classin the delivery row: additive, a row without one listsnulland matches no class filter).POST /v1/replaystakessinkanderror_classfor adlqjob (a row of another class stays dead) and, for every kind, ajob_id: the same id with the same kind and filter answers that job whatever its state, another filter on it is400 invalid_filter(job_id), which is what lets a fleet command start one job on every node and again after a failure. The server image'sreplaycommand is that client; see its changelog.Ankusa.Queue.dead/2now returnsnext_cursorbesidetotalandentries. Proofs:replay_test.exs("tenant filter", "sink filter", "error_class filter", "job_id"),admin/router_test.exs("cursor page", "is bounded"),examples/fleet-e2e/run.sh --replay-drill.Alert rules, dashboard and runbooks (OPS-7). Two series the shipped alerts read:
ankusa_instance_subtree_down_total{domain}(from[:ankusa, :instance, :subtree_down]: a failure domain out of restart budget) andankusa_vm_memory_bytes(:erlang.memory(:total), a new[:ankusa, :vm, :state]gauge event, sampled with the other gauges everyadmin.gauge_interval_ms). The rules, apromtoolunit test for each, the Grafana dashboard and twelve runbooks are in the repository underdeploy/monitoring/anddocs/runbooks/, checked bymise run check:monitoring; seearchitecture.md.Allocation cuts on the request path (PERF-1). A signature is verified without a second copy of the body:
Ankusa.Verifier.Templatecompiles a scheme'ssignedtemplate once (compile/1; a preset's at build time) andHmacfeeds the pieces to the MAC one at a time (signed_iodata/3), the body by reference, whereRegex.replaceused to build the whole signed message again for every hook.Envelope.header/2folds ASCII header names byte by byte instead of downcasing every header of the request (Envelope.header_downcased/2for a name already lowercase). Ajsondedupe source reads no body past the newdedupe.max_json_bytes(1 MiB by default, an integer >= 1): it is stored with no dedupe key and never decoded. The rate limiter's bucket table is 16 tables sharded byphash2(tenant, 16), and each 60 s sweep is 16 ticks of one shard, not oneselect_deleteover every row. Tests:verifier_test.exs"allocations per verify",dedupe_test.exs"dedupe.max_json_bytes",edge_rate_limit_test.exs"the bucket sweep".Wire-format evolution path and producer conformance (CON-2). Every queue message (
Ankusa.Sink.Message) carriesinstance(the instance's name) andregion(dispatch.region,nullfor none), andAnkusa.AsyncApidocuments both inSinkMessageV1and publishes the region as the document'sx-ankusa-regionextension.vstays1: the SDKs now acceptmin_supported <= v <= max_supported(1 to 2,v: 2beingv: 1plus additive fields), so a later additivev: 2does not break a deployed consumer; a field that changes meaning needsv: 3. New taskmix ankusa.conformance.genwritesconformance/cases/producer.jsonfromSink.Message.encode/3, andmise run check:conformancefails when the checked-in file differs, so a field added to the encoder fails the gate until the vectors (and so every SDK) follow.Config reload (OPS-6).
Ankusa.Reload: the seam a loader reloads an instance through.register/2/run/2hold the instance's reload function;apply_config/3takes the reloadable fields of a validated%Ankusa.Config{}(rate_limitsbutscope,dispatch.concurrency,dispatch.sink_concurrency,dispatch.tenants,metrics.detail,admin.gauge_interval_ms,routes.seed, static sources) and applies them to the running instance atomically, after the checks the instance boots under, with oneconfig.reloadaudit row (result: ok | failed).POST /v1/config/reload(scopeconfig:write+tenant:*) runs it:200with the keys and source ids that changed,409 not_reloadablenaming the keys that need a restart,409 reload_unavailablefor an instance with no reload registered,422 invalid_config,503 audit_backlog/store_unavailable.Ankusa.Dispatch.Pipeline.reconfigure/1takes new dispatch limits without dropping a claimed or running delivery;Ankusa.SourceStore.Static.with_sources/2is whatpublish/2now builds on.A Salesforce dedupe preset and a boot warning for a source with no dedupe (CON-3).
dedupe: :salesforceis{:json, ["id"]}: Salesforce stamps no delivery-id header and documents no JSON delivery id on any outbound mechanism (Outbound Messages are SOAP/XML; Flow/Apex callouts and Data 360 webhook targets send a body the org builds), so the preset keys on the top-level"id"the callout sets, andconfiguration.mdsays so. An:edgeinstance logssource <id> has no dedupe:once per source it declares withoutdedupe(Ankusa.Dedupe.warn_undeduped/1), and the gaugeankusa_sources_without_dedupe([:ankusa, :sources, :state],:without_dedupe) counts them. Tests:salesforce preset,warns without dedupe.SLI metrics (OPS-3).
[:ankusa, :dispatch, :stop]now measuresattempt_ms(the final attempt) andsince_received_ms(the hook's age when the delivery settled; absent for a replayed delivery), and a new[:ankusa, :dispatch, :attempt]event (attempt_ms;resultok,errorortimeout) fires per attempt, in direct mode too. New on/metrics:ankusa_delivery_latency_seconds{sink,result}(buckets to 60 s;tenant_idandsource_idonly atmetrics.detail: source, like the ingest histogram),ankusa_dispatch_attempt_duration_seconds{sink,result},ankusa_compact_failures_total{stage}(segment,retention,reclaim; from the new[:ankusa, :compact, :failure]),ankusa_claim_check_failures_total{op}(check_in,redeem; from[:ankusa, :claim_check, :failure], only for a claim store's fault) andankusa_backup_failures_total. The SLO table is inarchitecture.md.Opt-in ordering lanes (DEL-1.b, ADR 0004). A sink entry with
ordered: trueand anordering_key({:header, name},{:json, "a.b"},{mod, fun, args}) delivers the hooks of one lane ({tenant, source, sink, key}) one at a time inseqorder; a retry blocks its lane only, a dead head releases it, and lane state is in the store (store format 8: index families?O/?H/?P, due kinds 2/3, counterslanes,lanes_blocked,lane_members).ctx.ordering_keyandctx.lanereach the sink; SQS sends the key asMessageGroupId, Pub/Sub asorderingKey,Sink.Httpasx-ankusa-ordering-key; queue sinks carryankusa_ordering_key. New gaugesankusa_dispatch_lanesandankusa_dispatch_lanes_blocked, counterankusa_dispatch_lane_key_missing_total{sink}. Format 8 is a one-way door at its first start.Log correlation and a runtime log level (OPS-2). The process that handles a hook carries its correlation as
Loggermetadata:Ankusa.Edge.Routerclears it per request and setsinstance;Ankusa.Edge.Ingestsetssource_id,tenant_id,trace_id(Ankusa.Trace.trace_id/1) andhook_id;Ankusa.Sink.attempt/5sets them, withsink,attemptandreplay_id, for every delivery attempt (dispatch, lifecycle events,wal.type: nonepublishes); a replay step setsreplay_id; the breaker,wal.type: nonesink refusal and lifecycle give-up lines name their source, tenant and sink. The console format is unchanged; the server image'slog.format: jsonprints them.Ankusa.LogLevel(levels/0,get/0,parse/1,set/1) andPUT /v1/log-level({"level": "debug"}; scopeconfig:writeplustenant:*) change the VM's log level at once, without a restart, with an audit row (log_level.put, written first: a node whose store cannot take the row keeps its level).config:write, reserved until now, is the scope of that route.Sink.SQSandSink.GooglePubSubbatch (DEL-4). Dispatch's deliveries to one queue or topic wait in anAnkusa.Sink.Batcher(one per destination and set of credentials, underAnkusa.Instance) and go out as oneSendMessageBatch(10 entries, 256 KiB) ortopics.publish(1 000 messages, 7.5 MB of data), 20 ms after the first arrived or when the batch is full: about 10× and 1 000× fewer requests at 10 k messages a second (mix run bench/sqs_batch_bench.exs). A delivery is answered when its entry is: an SQSFailedentry is classified alone (InvalidParameterValue,MissingParameter, … permanent; throttling a jittered{:retry_after, ms, _}; the rest transient), and the entryIdis the position in the request, never the hook id, so a hook twice in a batch is fine. Pub/Sub'spublishhas no per-message results, soINVALID_ARGUMENTbisects the request (at most2 · (⌈log₂ n⌉ + 1)splits) until the one refused message is{:permanent, _}and the rest are delivered. A FIFOMessageGroupIdor Pub/Subordering_keyhas one request in flight and keeps admission order. The queue is bounded (batch_queue_max4 096,batch_queue_max_bytes128 MiB,batch_queue_tenant_max1 024; a delivery past one is{:retry_after, ms, {:batch_queue_full, reason}}) and entries are taken round-robin across tenants. New sink optionsbatch,batch_linger_ms,batch_max_entries,batch_max_bytes,batch_queue_max,batch_queue_max_bytes,batch_queue_tenant_max,batch_max_inflight; new optional callbackAnkusa.Sink.batched?/1andSink.batched?/2; newAnkusa.Sink.SQS.classify_error/4andAnkusa.Sink.GooglePubSub.classify_error/4(the DEL-2 classes, shared by a whole request and one entry of a batch), andvalidate_opts!/1on both (range checks of thebatch_*options; the server image runs them at load, a delivery that meets a bad one is a permanent{:config, {:batch_options, _}}). SQS'sMissingParameter,InvalidAttributeName,InvalidAttributeValueandKmsThrottledare now classified (permanent and throttled). New seriesankusa_sink_batch_{requests,entries,bisections,refused}_totalandankusa_sink_batch_{batchers,queued,queued_bytes}; events[:ankusa, :sink_batch, :flush | :refused | :state]. Behaviour change: for a batching sink dispatch no longer counts an attempt againstdispatch.sink_concurrency, a tenant'sconcurrencyordispatch.concurrency(those would cap a batch at 8); the claimed-row windows bound the attempts andsink_concurrencycounts the batcher's requests.batch: falserestores the old one-request-per-message behaviour for a sink.OpenTelemetry tracing end to end (OPS-1).
Ankusa.Tracereads the request's W3Ctraceparent/tracestateinto the newEnvelope.tracefield (additive: a node that predates it ignores it) and every sink carries it to the consumer: thetraceparent(andtracestate) header onSink.Http, thetraceparent/tracestatefields ofSink.Message(nullfor a hook with no trace) plus the same pair inMessage.headers/2andattributes/2, and the CloudEventstraceparentextension on lifecycle events. Core depends onopentelemetry_apionly: with no SDK started the request's context reaches the consumer byte for byte and no span exists. With an SDK, spansankusa.ingest(a child of the provider's),ankusa.verify,ankusa.commit,ankusa.dispatch.attempt(a child of, and linked to, the stored context),ankusa.claim_check,ankusa.replayandankusa.lifecycle.eventmake a hook one trace. NewAnkusa.Sink.attempt/5andAnkusa.Lifecycle.traced_envelope/4.Readiness thresholds (OPS-5).
listener.ready_sink_error_window_ms(5000): underwal: :none, a sink whose last publish failed within this long ago makes/ready503withsinks: "failing"; a sink that publishes again clears itself at once (Ankusa.Health.SinkErrors, one ETS write per publish in the request process, bounded at 10 000 entries and swept every window).listener.ready_min_free_bytes(nil): below itdiskis failing and the node unready, measured by:disksup(:os_mon; with none running the reason isunmeasured).queue.max_oldest_due_ms(nil): past itbacklogis failing, a label that never makes the node unready. All range-checked, and shown by/v1/config(none is a secret). They live in existing sections, soAnkusa.Configkeeps its 31 struct fields.Drain keys (OPS-4).
listener.drain_delay_ms(5000, an integer >= 0): how long the node keeps serving after/readyflips todraining.listener.drain_timeout_ms(30000, an integer >= 1): the bound on closing the ingress listener and waiting for the batchers. Both range-checked, shown by/v1/config(neither is a secret), and in the existinglistenersection, soAnkusa.Configkeeps its 31 struct fields.
Changed
Sink.Httppinshttpsdestinations too (DEL-3).Egress.pin/3always rewrites the URL to the address it validated (with the name as the TLShostname, so the certificate is still checked against the name), and the connection pool is keyed by that address, so every connection a pool opens goes to the checked address and a name rebound after the check cannot reach the private network through an open pool. Its:pin_httpsoption is gone. A computed:urlmay now combine with:cacertfileand:allow_insecure_tls(the TLS options are the pool's), and the{:permanent, {:computed, :url, :tls_override}}and:unpinnableresults no longer exist.Sink.Http.Pooland the gaugeankusa_sink_http_pool_originsare replaced byAnkusa.HttpClient.Poolsandankusa_http_pools.Retry horizon: 24 hours by wall clock, not 84 attempts; per-source
retry:; explicit error classes (DEL-2). Every delivery now getsmax_elapsed_ms(default 24 h,dispatch.retry's option, 1 s to 30 days) from its first attempt, kept in the delivery row asfirst_attempt_at(an additive key under the row versioning: a row written before it gets the stamp when dispatch first takes it), and is dead-lettered by the first failure at or after it; no retry is scheduled later than it.Ankusa.RetryPolicy.Exponential'smax_attemptsdefault is nownil(it was84, about 6 hours), so a sink that is down for 30 hours dead-letters its hooks at 24 hours, and a deployment that wants the old window setsmax_elapsed_ms: 21_600_000. Rows parked behind an open circuit breaker age too: due no later than their horizon, dead-lettered as{:retry_horizon, module}past it. A DLQ replay gives the row a fresh horizon.Ankusa.Sourcehas aretry:field (base_ms,max_ms,max_attempts,jitter,max_elapsed_ms) laid overdispatch.retry; lifecycle events keep the instance's.dispatch.max_retry_after_ms(default 1 h, was a constant) caps a sink'sRetry-After.Ankusa.RetryPolicygainsschedule/5,for_source/2,normalize_opts!/2.Sinks classify explicitly: SQS
AccessDenied/QueueDoesNotExist/credential errors and Pub/SubPERMISSION_DENIED/NOT_FOUND/UNAUTHENTICATEDare{:permanent, {:config, _}}(dead-lettered at once, counted inankusa_dispatch_config_errors_total{sink}/[:ankusa, :dispatch, :config_error]; they used to be retried for hours); SQSThrottlingand Pub/SubRESOURCE_EXHAUSTED, and any429/503from them, are{:retry_after, ms, _}with a full-jitterms(Ankusa.Sink.throttle_after_ms/1);Sink.Httptreats451as permanent,425as a pause and409as transient. Seedelivery.md.A source's retry horizon cannot outlast the claim bucket's lifecycle rule (DEL-2).
claim_check.bucket_expiry_daysis now checked against the longest ofdispatch.retry's horizon and every claim-using source'sretry.max_elapsed_ms(+queue.dlq.retention_days+redeem_grace_ms, in days: 32 by default, was a 21-day assumption, 52). A source write that would exceed it is{:error, :retry_exceeds_claim_expiry, message}(422 retry_exceeds_claim_expiryfrom the admin API), and boot refuses a stored source that does (Ankusa.ClaimCheck.validate_stored_horizons!/2).Ankusa.Sink.SQSandAnkusa.Sink.GooglePubSubare built onAnkusa.Sink.Messaging; what they send is unchanged.The quarantine pen no longer serializes every flagged hook (DUR-9). A source's bucket is one ETS row updated with a compare-and-swap (
RateLimiter.hit_bucket/4), the pen's byte count and the number of writes waiting for it are:ets.update_counter/3, andQuarantine.put/3andhit/3run in the request's process; a refusal after the token was taken gives it back. The pen process keeps recovery, the bucket sweep, retention andpurge/3, and commits the writes that queued meanwhile in one syncedStore.write(a group commit), so a forged flood costs one fsync per group and never holds more than one dirty-IO scheduler. At most 1 000 writes may wait: the next is{:error, :overload}(503,Retry-After: 1), spending nothing (ankusa_quarantine_pendingis the gauge;Quarantine.held/1gainspending).Quarantine.hit/3answers{:error, :store_unavailable}only while the pen restarts (its tables are gone), no longer when its process is busy. A refusal'sRetry-Afteris now the GCRA wait for the bucket rather than the token-bucket arithmetic it replaced.bench/quarantine_bench.exs: 5 000 forged hooks/s over 500 sources, p99 under 50 ms, a clean source's p99 within 2× of its solo p99. Docs:delivery.md#quarantine,architecture.md,configuration.md.routes.max_routesdefaults to 1 000 000 (was 10 000, TEN-9); the cap is still hard and nothing is evicted, and it is checked against the newroutes.memory_budget_bytes. The snapshot's:patternrows are replaced by:litrows,:metagainsmax_prefix, and a:conflictindex is added;Snapshot.patterns/2andSnapshot.build/1are gone (nothing outside the snapshot read them).dispatch.sink_concurrencydefaults to8(wasnil), and the per-tenant windows ofdispatch.tenants.defaultapply by default (TEN-3). A deployment whose hooks all share one tenant (none, or one tenant id) is held tomax_inflight: 1024,max_inflight_bytes: 32 MiBandconcurrency: 16instead of the global limits: raisedispatch.tenants.defaulttomax_inflight: 4096,max_inflight_bytes: 134217728andconcurrency: 32to restore the old ceilings.dispatch.sink_concurrencymay now exceeddispatch.concurrency(the global cap binds first), where it used to be refused; the breaker and the sink cap are per tenant. The cap is also a rate ceiling: one sink key delivers at mostsink_concurrency÷ the sink's latency per second (bench/core_bench.exs's 5 ms sink:end_to_end_per_s3 595 → 1 140 at 512 B on one machine; ingest and its p99 unchanged), so setsink_concurrencyhigher, ornil, for a source that needs more.A tenant-carrying URL scheme needs a
rate_limits.default(TEN-2).Ankusa.RouteResolver.TenantPath(routing: tenant_path) withrate_limits.default: nilnow fails the boot inAnkusa.Edge.RateLimiter.validate_config!/1: the URL names the tenant, so every tenant the config does not list was unlimited. Give it a default. The limit parser now takes the instance'smax_body_bytesas a second argument (parse_limit(attrs, max_body_bytes)replacesparse_limit(attrs)), the ceiling for a tenant's own, and a limit that is notrateandburstplus the optional keys above is refused with a new message.Breaking (SEC-10):
Sink.Httpis signed by default.validate_opts!/1(so boot, and the image's loader) refuses a sink with neither:secretnorallow_unsigned: true(Sink.Http requires secret: …), and a delivery attempt for one that skipped validation is dead-lettered ({:error, {:permanent, :unsigned_sink}}) instead of being sent unsigned.allow_unsigned: truesends no signature headers and is for a receiver that cannot verify; a:secretstill signs when both are set. A deployment that delivers unsigned addsallow_unsigned: trueto those sinks, or better, a:secretthe receiver verifies (every SDK'sreceive_delivery).Breaking:
Sink.Httprefuses, at delivery, a URL that is nothttpsor that resolves to a denied address, with the default policy. A deployment that delivers to a plain-http or private-network receiver setsegress(allow_insecure_http: true, andallow_cidrsorallow_hostsnaming the receiver). A static or lifecycle sink with an unsupported:req_optionskey now fails at boot instead of at its first delivery.Hooks and delivery rows have a versioned encoding.
Ankusa.Envelopegainsto_binary/2(version: 0 | 1; v1 is"AE",1, then the term) and a delivery row gets the same scheme ("AD",1). Both are read in the old bare form (v0) and in v1; this release still writes v0, so a rollback to 0.6 keeps reading every row, and the release after it writes v1 (seedocs/deployment.md, "Rolling back a minor"). A field a newer node added is ignored on an envelope and kept on a row, whether or not this VM has seen its atom (decoding does not usebinary_to_term/2's:safe, which would reject it). Breaking for callers of the internals:Ankusa.Envelope.from_binary/1now returns{:ok, envelope} | {:error, :unsupported_envelope_version | :undecodable}instead of the struct or a raise. Every reader handles the error: dispatch dead-letters the delivery (reason:unsupported_envelope_version,:unsupported_delivery_row_versionor:undecodable) and lists it in the DLQ,Ankusa.Queue.hooks/3returns{:error, {:corrupt_value, :hooks, _}}, a replay skips the hook, the compactor logs it, and the 0.3 import refuses to boot with{:corrupt_legacy_wal_record, path, seq, reason}.Requires
async_api_spex ~> 0.2from Hex (was~> 0.1, which excluded 0.2.0, the release this package is built and tested against).Breaking:
claim_check.blob_storeis nowclaim_check.blob_stores, a list (blob_stores: [{mod, opts}]); a config still namingblob_storefailsAnkusa.Config.new/1withunknown Ankusa.Config key: claim_check.blob_store.Ankusa.ClaimCheck'sclaim_store/1and the:claimsscope ofAnkusa.BlobStoreare gone: claim packs go throughAnkusa.ClaimCheck.Stores.Breaking:
Ankusa.ClaimCheck.Ref'sobject_key/2andkey/1take a layout:Ankusa.ClaimCheck.Ref.object_key/3,Ankusa.ClaimCheck.Ref.key/2.Ankusa.BlobStore.Retry'srun/2becamerun/3(a later release added the breaker scope and request kind:Ankusa.BlobStore.Retry.run/5), the instance first.Ankusa.BlobStore.Retryjitters each delay to between half and all of 200 ms / 1 s / 5 s, so nodes throttled together don't retry in lockstep.Metric labels with integer values (an HTTP status, a store index) are reported as that number instead of
other.The claim gateway's
503 store_unavailablecarriesRetry-Afterof a random 1–3 s instead of a fixed1, and logs throttles, sheds and missed deadlines at:debug(they are counted byankusa_claim_check_reads_total).Ankusa.HttpClientanswers{:error, %RuntimeError{}}when the HTTP client's connection pool cannot hand out a connection within its checkout timeout, instead of letting that raise out of the adapter: the retry and the breaker see it as the transport failure it is.bench/core_bench.exsno longer caps the 10 KB cell (DUR-4.b.b.a). Every request, body included, is built once before the clock starts andCONCURRENCYlong-lived client processes claim the next one off a shared counter, where each item used to build its body and start aTaskinside the timed section (about 60 µs of CPU per hook, enough to hold the cell to ~1.6× the F1 code's rate however cheap ingest got). The cell matrix,N,CONCURRENCYand the JSON line are unchanged;STUB_INGEST=1answers each request at once and reports what the harness itself can drive (11.3 M/s at 10 KB on the laptop that measured it, against 78.9 k/s for the F1 code).bench/baseline.jsonis re-recorded under the new harness (aperf: rebaselinechange) with anf1_codeblock that holds the F1 baseline's code measured in the same session;bench/gate.exsignores the block and carries it over when it rewrites the file./readylists every readiness check (OPS-5).Ankusa.Health.ready/1runs eachAnkusa.Health.Checkthat applies to the node (store,intakeunderwal: :dual,sinksunderwal: :none,disk,backlog,backup) and the body carries one key per check with its state,"ok","failing"or"draining", plusreasons(a fixed set of atoms per check) while one is not"ok". It answers503when a check that gates is not ok:store,intake,sinksanddiskalways,backupwithbackup.require_fresh, neverbacklog. Wire change:storeis now"ok"/"failing"(it was"ok","none","store_unavailable","write_failed") and the failure class moved from the top-levelreasontoreasons.store; a node with no store has nostorekey;backupis"ok"/"failing"(it was"fresh"/"stale") andintakeis"ok"/"failing"withreasons.intakedownorrecovering(it wasup/down/recovering). The status codes are unchanged, and so are the gating rules ofstore,intakeandbackup. Both OpenAPI documents describe the new body.A stop drains before it closes anything (OPS-4). Core's application and
AnkusaServer.Applicationdefineprep_stop/1, which runsAnkusa.Instance.Drainwhen the VM is told to stop (SIGTERM,docker stop):/readyanswers503with"status": "draining"and adraincheck (Ankusa.Health.Check.Drain,Ankusa.Health.drain/1) at once, the ingress listener keeps serving forlistener.drain_delay_ms, then closes and waits for the requests it is serving, then every batcher is waited on until it holds nothing (Ankusa.Edge.Batcher.queued/2), all withinlistener.drain_timeout_ms. Dispatch's outcomes and the backup's final checkpoint run as the tree stops. Wire change:/ready'sstatusis"draining"(was"unavailable") while a check reportsdraining; both OpenAPI documents and the TypeScript admin types follow. The ingest Bandit child isid: :ingress, and its Thousand Islandshutdown_timeoutisAnkusa.Listener.ingress_shutdown_timeout_ms/1(22 s; 13 s underwal: :none, 24 s underwal: :dual), no longer Thousand Island's 15 s default, which was the batcher's own record deadline, so a commit that started late was killed mid-fsync and the provider saw a reset for a committed hook.Ankusa.Listener.bandit_options/3takes extra Thousand Island options. A node with the:edgerole refuses alistener.drain_timeout_msbelow that wait atAnkusa.Config.new/1.Ankusa.Edge.Batcher.record_deadline_ms/0is the one definition of the 15 s record deadline (theintake.publish_timeout_msbound reads it). SetterminationGracePeriodSecondsto at least(drain_delay_ms + drain_timeout_ms) / 1000 + 10(deployment.md).Requires
bandit ~> 1.14(was~> 1.13): 1.13.1 is affected by EEF-CVE-2026-115269 (High: a WINDOW_UPDATE or empty SETTINGS frame restarted the HTTP/2 request-body read timeout, so a trickle of them held a stream and its handler open indefinitely) and ten more advisories 1.14.0 closes (HTTP/2 flow control, HPACK and SETTINGS limits; HTTP/1.1 chunked bodies, one of them a request-smuggling vector; WebSocket framing);mix hex.auditfails on it.Requires
jose ~> 1.11 and >= 1.11.13(was~> 1.11): 1.11.12 has eight advisories fixed in 1.11.13, EEF-CVE-2026-65625 to EEF-CVE-2026-65632 (High: EEF-CVE-2026-65629). One reachesAnkusa.Admin.Auth.JWT's check of a presented token: an ECDSA signature's length was not validated, so anES*token's signature was malleable; RSA JWK parsing (a crafted modulus was factored, CPU exhaustion) reaches only the configured keys and the issuer'sjwt.jwks_url.
Fixed
Ankusa.Verifier.Hmac: a scheme withhash: sha1(documented inconfiguration.md) raised:badargon every hook, because:crypto.mac/4names SHA-1:sha, not:sha1; it now verifies.Ankusa.Verifier.Hmacanswers{:error, :bad_scheme}for an inline%Scheme{}that fails validation (an unknown{token}insigned, a{:sig, _}timestamp withoutparse: :csv_pairs, ...), asvalidate_opts/1already said it would, instead of raisingArgumentErrorout of the request path.- The 0.3 import treats a WAL frame header with length 0 as not a frame. A
header whose payload never landed, followed by the zeros a file is extended
with after a crash (length 0, CRC 0, the CRC of nothing), was "valid", was
decoded as an envelope, and refused the boot with
legacy_import_failed; it is now the torn tail it is, and every complete frame before it imports. Ankusa.ClaimCheck.Pack.build/1refuses a pack of more than 65,532 claims (was 65,533). A full 65,535-entry pack wrote ZIP64's0xFFFFmarker in its end record, which standard readers (Erlang's:zip:{:error, :bad_eocd}) refuse to open.Ankusa.ClaimCheckalready split packs at 65,000 claims, so only a direct caller ofPack.build/1could reach it.- A delivery that races a batcher's death no longer fails. A batcher that
stops (idle, or killed) leaves its registry name behind for a moment — the
partition that owns the key reaps it when it handles the monitor, measured at
1-9 µs — and a delivery that landed in that window was answered
{:error, {:batcher_down, :noproc}}about a healthy destination, because both the lookup and the one immediate retry read the same stale name.Ankusa.Sink.Batcher.deliver/4now waits for the name to go (at most 250 ms, in 2 ms steps) and starts the next batcher; the call a dead batcher was already holding still fails with{:error, {:batcher_down, reason}}, so the dispatch attempt retries it as before. - Dispatch under a backlog (soak). A synced commit's wake ran a full store
scan, one per commit, even when every tenant's window was full; at 200 req/s
the scans outran the pipeline, the attempts' outcomes queued behind them, and
nothing freed the window: the nightly soak lost 694 704 of 720 000 hooks to a
logsink. Wakes are now coalesced into one scan per mailbox round (Ankusa.Dispatch.Pipeline). Test:isolation_test.exs"wakes are coalesced".
0.6.0 - 2026-10-14
Added
Every delivery says how the hook was verified at ingest. The v1 message (
Ankusa.Sink.Message, every queue sink) carriesverification: {"status": "ok" | "failed" | "skipped", "flagged": bool}, andSink.Httpsendsx-ankusa-verificationalways andx-ankusa-verification-flagged: truefor a hook its source accepted despite a failed check (on_verify_failure: :accept_flag).skippedis a source with no verifier (Verifier.None) or a lifecycle event. The reason stays off the wire.SinkMessageV1requires the field;vstays1.Ankusa.Sink.Message.verification/1is the one place that decides it.GET /v1/tenants/:tenant/sources[/:name]showstrust_url_tenant.trust_url_tenanton%Ankusa.Source{}(defaultfalse), andAnkusa.Verifier.check_shared/2,validate_shared!/1andwarn_stored_shared/2: see the E5 entry under Changed.An internal
SourceStore.Tablemodule: the ETS layout and spec handlingSourceStore.Persistentandankusa_redis'sSourceStore.Redisshare. A source-store read while the store restarts answers{:error, :unavailable}instead of raising.Ankusa.Queue.pending_for_source/2: one source's pending and in-flight delivery rows in this node's queue.Ankusa.Dispatch.Pipeline.dead_letter_source/2: dead-letter one source's pending rows now, inside the pipeline.Ankusa.ClaimCheck.locate/3andread_bytes/4: find a claim, and read any range of it, without reading it whole.Ankusa.BlobStore.Retry, the retry loop the HTTP blob stores share.Ankusa.Sink.Reaper: stops a sink adapter's connection after its:idle_timeout_mswithout a delivery. The broker adapters (ankusa_rabbitmq,ankusa_kafka,ankusa_nats,ankusa_redis) run one each.Ankusa.Sink.GooglePubSub: publishes hooks to a Google Cloud Pub/Sub topic with onetopics.publishPOSTper delivery, the sameAnkusa.Sink.Messagedata as the other queue sinks and the same metadata as message attributes. No new dependency (req). Auth is a caller-supplied:token_providerMFA, as forBlobStore.GCS; one that answers:erroris:no_credentials(retried, no request sent).:okonly on a200naming the message id. A message over:max_message_bytes(10 MB) andINVALID_ARGUMENTare permanent; every other Pub/Sub error (a missing topic included: the sink never creates one) is retried. Optional:ordering_key(a string or a function of the envelope).describe/2reports the AsyncAPIgooglepubsubbindings. The admin config view showsprojectandordering_key.Ankusa.Sink.Message.attributes/2: the{name, value}metadata pairs a queue sink carries outside the body, now shared bySink.SQSandSink.GooglePubSub.Store backup and restore (
Ankusa.Store.Backup,backup.*, off by default). Everybackup.interval_ms(60 s) the store writes a RocksDB checkpoint (Ankusa.Store.checkpoint/2, off the store process so/readykeeps answering) and the uploader puts it in the:backupblob-store scope (backup.blob_store, elsestorage.blob_store, understorage.key_prefix):.sst/.blobfiles once each, the rest per backup, a sha256 manifest, thenbackup/LATEST.backup.keep(3) backups are kept. A store directory with no database restoresLATESTat boot, every file checked, and refuses to start ({:store_restore_failed, path, reason}) when the backup can't be read instead of starting empty. A restored or new store is then reconciled with the segment store:m:next_seqmoves past the highest archived seq and uncatalogued segments are catalogued from their.idx. New telemetry[:ankusa, :backup, :stop | :state]and metricsankusa_backup_runs_total,ankusa_backup_age_seconds.Readiness.
GET /readyon the ingest and admin listeners (Ankusa.Health.ready/1):200while this node's store takes a synced write (Ankusa.Store.ready/1, checked at most once a second, reopening the store when a write fails) and no write has failed in the last 5 s, else503withRetry-After: 1andstore: "write_failed" | "store_unavailable"./healthstays liveness.State gauges.
Ankusa.Metrics.Gauges(atelemetry_poller, new dependency) samples the store, the queue index, the quarantine pen and disk space everyadmin.gauge_interval_ms(15 s), and dispatch reports its scheduler, as[:ankusa, :store | :queue | :quarantine | :disk | :dispatch, :state]events and/metricsgauges (ankusa_queue_pending,ankusa_queue_oldest_due_age_seconds,ankusa_disk_free_bytes,ankusa_dispatch_breakers_open, …).[:ankusa, :dispatch, :stop]carriessinkandsource_id; delivery counters gain asinklabel.Per-sink isolation and circuit breakers. Dispatch queues claimed rows per
{source_id, sink index, module}and hands slots round-robin across them;dispatch.sink_concurrencycaps one key's concurrent attempts. A key that failsdispatch.breaker_failures(5) times in a row is parked forbreaker_open_ms(30 s), doubling up tobreaker_max_open_ms(5 min), then probed; parked rows spend no attempts.[:ankusa, :dispatch, :breaker]on every transition.Sink error classes.
{:error, {:permanent, term}}dead-letters after the attempt;{:error, {:retry_after, ms, term}}delays the next attempt (capped at an hour).Ankusa.Sink.classify/1.Signed HTTP deliveries.
Sink.Http:secret(awhsec_secret or a list) adds Standard Webhookswebhook-id/webhook-timestamp/webhook-signatureheaders (Ankusa.Sink.Http.Signer).:max_response_bytes(64 KiB) caps what is read of a response.Shared buckets.
storage.key_prefixputs every segment key under a per-node prefix;claim_check.blob_storegives claims a store of their own (aLocalFSone takes:root). Claim keys are never prefixed, so one gateway serves every node.S3 credential chain. With no static keys the S3 adapter reads
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN, then web identity (IRSA, STSAssumeRoleWithWebIdentity), then IMDSv2, caching temporary credentials until shortly before expiry;:session_tokenis signed when set.Claim gateway:
HEAD /v1/claims/{tenant}/{claim_id}.batcher.max_queue_bytes(256 MiB): load shedding by buffered body bytes as well as records;[:ankusa, :load_shed]carriesbytes.Boot-time range validation of every numeric config key (
"<key> must be <constraint>, got <value>"), and of embedded sources' verifier secrets (Ankusa.Verifier.validate_config!/1,Ankusa.Verifier.Hmac.validate_opts/1).Ankusa.Sink.SQS: delivers hooks to an Amazon SQS queue with one SigV4-signedSendMessageper delivery, the sameAnkusa.Sink.Messagebody as the other queue sinks, and the Kafka header set as message attributes. No new dependency (req+aws_signature).:okonly on a200whoseMD5OfMessageBodymatches the body sent. A.fifoqueue getsMessageGroupId(:message_group_id, default"tenant/source") andMessageDeduplicationId(the hook id,id:replay:<replay_id>on a replay). A message over:max_message_bytes(1 MiB),InvalidMessageContentsandInvalidParameterValueare permanent; every other SQS error (a missing queue included: the sink never creates one) is retried.describe/2reports the AsyncAPIsqschannel binding. The admin config view showsqueue_urlandmessage_group_id.Ingest dedupe.
Ankusa.Dedupeextracts a provider event key (a delivery header such as GitHub'sx-github-delivery, or a JSON field such as Stripe's"id") from every accepted hook, configured per source asdedupe: :github | :standard_webhooks | :svix | :shopify | :stripeordedupe: %{header: …}/dedupe: %{json: …}with an optionalttl_ms(default 72 h). Keys are scoped to tenant and source. The queue writer collapses envelopes that share a key atomically in the commit batch: the retry is answered201with the original hook's id and"duplicate": true, nothing extra is stored. Expired keys are swept inside the writer. A forged, flag-accepted request never claims a key.Replay jobs.
POST /v1/replayscreates a durable, paced replay job:kind: :dlqre-sends dead delivery rows,kind: :archivere-sends archived hooks over areceived_atwindow. Jobs drip rows into the existing due index atrateitems per second, and only while dispatch's oldest-due lag is at mostmax_lag_msand its in-flight window is not full — a replay uses only spare capacity and inherits retries, the DLQ, claim check and at-least-once bookkeeping. Every job is a store record whose cursor commits in the same batch as the rows it moves, so a restart resumes it; a job that keeps dead-lettering its deliveries pauses itself.GET /v1/replays,GET|PATCH /v1/replays/{id}manage them (POST /v1/dlq/replayis removed).Ankusa.Replay.start/2,list/1,get/2andupdate/3expose the same surface to embedders; replayed deliveries keep the hook's originalidanddedupe_keyand carry the job id asreplay_id(alsox-ankusa-replay-id, theankusa_replay_idbroker header, and NATSNats-Msg-Idasid:replay:<replay_id>). A dead row whose delivery record cannot be decoded is passed over, not dropped or retried: it stays in the DLQ andGET /v1/dlqlists it with the reasonundecodable delivery row.Message identity and integrity. Every queue message now carries
sha256(also on inline bodies),dedupe_key,replay_id, and the forwarded provider requestheaders(per the source'sforward_headersoption,:defaultforwards everything except auth/framing/hop-by-hop andx-ankusa-*headers).Sink.Httpforwards them as request headers, withx-ankusa-dedupe-key/x-ankusa-replay-id; RabbitMQ carries the hook id as AMQPmessage_idplus the dedupe/replay AMQP headers; NATS setsNats-Msg-Idon every publish (the hookid, orid:replay:<replay_id>on a replay); Kafka and NATS carry them as record headers. All 8 SDKs decode the message, verify its integrity, and read the idempotency key (below;#replay:<replay_id>is appended when asked); the conformance suite covers it.Idempotency key, computed once.
Ankusa.Envelope.idempotency_key/1returns the tenant-scoped key a consumer dedupes on:tenant:source_id:dedupe_keywhen the hook has a dedupe key (defaultwhen it has no tenant), else itsid. It ships as the message'sidempotency_keyfield (additive, stillv: 1;SinkMessageV1now requiressha256,dedupe_key,replay_id,idempotency_keyandheaders, andSinkMessageHeadersV1gainsankusa_dedupe_key,ankusa_replay_idandNats-Msg-Id), thex-ankusa-idempotency-keyheader onSink.Http, and theankusa_idempotency_keyheader on RabbitMQ, Kafka and NATS. Ingest dedupe scopes by tenant and source, so two tenants' hooks with one provider event id are two hooks; the tenant in the key keeps them two keys at the consumer. The SDKidempotency_keyhelpers read the shipped value and compute the same formula only for a message or delivery that predates the field.Direct-mode deadline. With
wal.type: none,Ankusa.Edge.Publishpublishes to every sink concurrently under one overall deadline (direct_publish_timeout_ms, default 8 000, configurable aswal.publish_timeout_msinankusa.yml); a sink that misses it is a 503.Ankusa.Dispatch.Pipeline.pressure/1reports the oldest-due lag and window state for replay pacing.Ankusa.UUIDv7.min_for/1andmax_for/1bound a millisecond's id range.Ankusa.Queue.redrive/3commits archived hooks back into the queue in one synced batch with the replay job's cursor.Failure domains.
Ankusa.Instanceis now:rest_for_one, and dispatch, storage (compactor and claim-check sweeper), lifecycle, metrics and the admin, route-admin and claim-check listeners each run underAnkusa.Instance.Isolatedwith a restart budget of their own. When a domain's budget is exhausted it is restarted later with backoff (1 s doubling to 60 s, reset after a minute up) instead of rebuilding the instance, edge listener included. The store, the source store and the edge (routes, queue writer, quarantine, rate limiter, batchers, ingress listener, now onerest_for_onesubtree registered asAnkusa.via(instance, :edge)) are the core: a crash there restarts what depends on it. A child that cannot start at boot still fails the boot. New telemetry events[:ankusa, :instance, :subtree_down](:delay_ms;:instance,:domain,:reason) and[:ankusa, :instance, :subtree_up].Ankusa.Instance.RegistryWatch: an instance stops, and its supervisor restarts it, whenAnkusa.Registryor one of its partitions restarts. A restart used to leave the store and every supervisor running but unregistered (Ankusa.whereis/2returnednil). The application's own supervisor is now:rest_for_onefor the same reason.Quarantine release.
kind: :quarantinereplay jobs (POST /v1/replays {"kind":"quarantine"},Ankusa.Replay.start/2) re-verify hooks held in the quarantine pen against each source's current verifier, judging the timestamp window at the hook's receive time, and commit the ones that pass through the queue writer with their originalidandreplay_idon every delivery row; the rest stay in the pen. Optionalsource_id,id,since/until(onreceived_at) filters. Needs the:edgeand:dispatchroles.Ankusa.Queue.release/3commits such hooks with the pen deletes and the job's cursor in one synced batch.DELETE /v1/quarantine(Ankusa.Edge.Quarantine.purge/3) deletes held hooks bysource_id,id,since/untilandlimitand reports{deleted, bytes}.GET /v1/quarantineentries gaintenant_idandsize.quarantineconfig section:burstandrate(one token bucket per source, defaults 100 and 20/s) andmax_bytes(the pen's byte cap, default 1 GiB). New telemetry event[:ankusa, :quarantine, :full]and metricankusa_quarantine_full_total.Metrics
ankusa_replay_moved_total{instance,kind}andankusa_replay_throttled_total{instance,reason}, telemetry events[:ankusa, :replay, :moved | :throttled | :state], andoutcome="duplicate"onankusa_ingest_requests_total.Ankusa.Verifier.Hmacacceptssecret: [new, old]: every key is tried, so a secret rotation needs no cut-over. An empty list or an element that is not a usable key is{:error, :bad_secret}.Ankusa.Verifier.check_timestamp/2takesnow:(Unix seconds) to judge the window against a fixed instant;Ankusa.Verifier.scheme_name/2is the shared scheme label.config.dispatch.attempt_timeout_ms(default30_000): a delivery attempt that has not returned after it is killed and counts as a failed attempt with reason{:attempt_timeout, ms}, so a hung sink frees its dispatch slot. It covers the sink call and the fallback claim check-in of an attempt, andAnkusa.Lifecycle.Publisherapplies the same deadline to lifecycle sinks. The sink may still complete a killed delivery, so consumers dedupe on the idempotency key.Ankusa.Dispatch.Pipeline.validate_config!/1rejects a value that is not a positive integer.Ankusa.Edge.Ingest.lookup/2,ingest/4andrefused/2. The edge looks the source up withlookup/2before it reads the body, then callsingest/4with the source it found;ingest/2islookup/2followed byingest/4.refused/2emits the new telemetry event[:ankusa, :ingest, :refused](:instance,:reasonof:unknown_source | :payload_too_large | :body_read_failed | :invalid_header), andAnkusa.Metricscounts it asankusa_ingest_refused_total{instance,reason}.An
ipoption for the admin API, the route management API and the claim gateway.admin.ip,routes.admin.ipandclaim_check.iptake a strict IPv4 or IPv6 literal (or an:inetaddress tuple) and default to"127.0.0.1";Ankusa.Config.new/1raisesArgumentErrorfor anything else ("10"and"localhost"included), throughAnkusa.Config.listen_ip!/2. The edge listener has noipand stays on every interface.Ankusa.Store.report_write_failure/2: tell the store a write failed, so it reopens itself (at most once per 5 s) to clear RocksDB's latched error.Ankusa.Store.write/3calls it on every failed batch.
Changed
- Requires
bandit ~> 1.13(was~> 1.12.5, which held every app on 1.12.x: 1.12.5 has two published advisories, EEF-CVE-2026-105659 and EEF-CVE-2026-105660, fixed in 1.13.0). Ankusa.BlobStore.S3.Credentialsis nowAnkusa.AWS.Credentials(ETS table:ankusa_aws_credentials), shared byBlobStore.S3andSink.SQS. The chain and its options are unchanged.- Circuit breakers are on by default (
dispatch.breaker_failures: 5): a sink that keeps failing has its rows parked, without spending attempts, instead of each retrying on the policy's schedule, so they reach the DLQ later than before.breaker_failures: 0keeps the old behaviour. A replay job counts its rows parked behind an open breaker toward auto-pause. Sink.Httpmaps400,401,403,404,410,413,422to{:permanent, {:status, s}}(dead-letter now) and honoursRetry-Afteron408,429and5xx.- Breaking:
Ankusa.BlobStorecalls take a scope —put(instance, :segments | :claims, key, data)and so on — and thelist/3callback returns{:ok, keys} | {:error, reason}, following every adapter's pagination (S3, GCS, Azure, OCI) to the end. - Breaking:
Ankusa.SourceStore.fetch/2may return{:error, :unavailable}: ingest answers503 store_unavailableinstead of404, dispatch reschedules the row a second later with attempts unchanged instead of dead-lettering it as:source_gone, and a replay job retries its page. - Breaking: the route snapshot lives in a per-instance ETS table
published in generations (
Ankusa.Routes.Snapshot), not:persistent_term; the removedAnkusa.Routes.snapshotfunction is replaced byAnkusa.Routes.meta/1. - A source with a
tenant_idother than"default"answers only routes naming that tenant (any other is404);"default"sources stay shared. - A hook accepted flagged (
accept_flag) spends its source's quarantine bucket. - Single-claim pack ids are the check-in time plus 64 random bits (no longer derived from the hook id and its receive time); retention counts from check-in.
- Claim gateway:
cache-control: private, max-age=31536000, immutable;503bodies carry only the error code; a store403is503 store_forbiddenwithRetry-After: 60. - Breaking (E5): under a resolver that takes the tenant from the request
(any but
Ankusa.RouteResolver.Path), a source that is shared (tenant_id: "default"), hasAnkusa.Verifier.Noneand does not settrust_url_tenant: trueis refused: a configured one stops the instance from starting (ArgumentErrornaming the source, on every node whatever its roles), and aSourceStore.Persistentwrite of one is{:error, :invalid, message}(the admin API's400 invalid_source). One the store already held keeps serving, and is named in a warning at boot. Settrust_url_tenant: trueto keep a deliberately open shared endpoint. - Breaking (O2): no supervisor in the instance tree holds the
%Ankusa.Config{}any more.Ankusa.Instance.child_spec/1andstart_link/1store the config (Ankusa.put_config/1) and pass only the instance name; every child is started with[instance: instance]and readsAnkusa.config(instance). A customAnkusa.SourceStoreorAnkusa.Routes.Storethat runs a process now getsstart_link([instance: instance])instead ofstart_link(%Ankusa.Config{})/opts[:config], and reads its options fromAnkusa.config(instance).SourceStore.Persistent.start_link/1takes[instance: instance].:sys.get_status/1of the instance's parent, the instance and its subtrees no longer prints sink options or verifier secrets. - Delivery rows may carry
replay: replay_id, the job a replayed delivery is attributed to. Ankusa.Queue.enqueue/3takes an optionaldeadline(aSystem.monotonic_time(:millisecond)value) and waits for the commit's outcome instead of timing out after 5 s. The writer refuses, without consuming a seq, a batch it could not start before the deadline ({:error, :deadline_exceeded}) and one whose caller died while it waited ({:error, :caller_gone}).Ankusa.Edge.Batcher.commit/4'stimeoutbounds how long a record may wait before its batch starts committing (15 s by default), not the commit itself.:infinitystill means no bound.Ankusa.Sink.safe_deliver/4returns{:error, {:bad_return, value}}for any return value other than:okor{:error, _}. Dispatch, lifecycle events and thewal: :noneack path all deliver through it.- Breaking: the quarantine bucket is per source and refuses with
429. A source over its bucket answers429 quarantine_rate_limitedwithRetry-Afterinstead of401 verification_failed;401now always means a failed signature.Ankusa.Edge.Quarantine.put/3returns{:rate_limited, retry_after_ms}or:fullinstead of:rate_limited, andAnkusa.Edge.Ingest.ingest/2returns{:error, {:quarantine_rate_limited, ms}}or{:error, :quarantine_full}(outcome tags:quarantine_rate_limitedand:quarantine_full). - The quarantine pen keeps the whole envelope (method, path, headers, body,
tenant) instead of headers and body, and refuses a write that would cross
quarantine.max_byteswith503 quarantine_full(Retry-After: 60); it never evicts a held hook. Entries held by earlier versions stay readable and releasable (rebuilt asPOST /). - The default retry policy retries for about 6 hours.
Ankusa.RetryPolicy.Exponentialdefaults tomax_ms: 300_000andmax_attempts: 84(they were30_000and12, about 83 s): 100 ms doubling to a 5-minute cap by attempt 13, then 5 minutes apart. A retry is a delivery row due later and holds no slot, so a longer horizon costs nothing while a sink is down. Setmax_attemptslower to dead-letter sooner. Errors are not classified yet, so a permanent failure (an HTTP400, say) also takes every attempt before it reaches the DLQ. - Breaking for dashboards: refused requests are no longer on
ankusa_ingest_requests_total. A request for a source that does not exist used to be counted there asoutcome="unknown_source"under asource_idtaken from the URL; it is nowankusa_ingest_refused_total{reason="unknown_source"}, as are413(payload_too_large) and unreadable-body400(body_read_failed) refusals. A panel that sumsankusa_ingest_requests_totalfor "all traffic" must add the refused counter.source_idon[:ankusa, :ingest]and on the metrics built from it is now always a configured source's id.Ankusa.Edge.Ingest.ingest/2still returns{:error, :unknown_source}for one. - Breaking for callers that match exhaustively: a duplicate is a new
result.
Ankusa.Edge.Ingest.ingest/2andingest/4may return{:duplicate, env}(besides{:ok, env}),Ankusa.Edge.Batcher.commit/4returns{:duplicate, env}besides{:committed, env}, andAnkusa.Queue.enqueue/3returns{:ok, [{:committed, env} | {:duplicate, env}]}. - Breaking for embedders: the supervision tree is split into failure
domains. The batcher, queue writer, quarantine, rate limiter, routes and
ingress listener now live under
Ankusa.via(instance, :edge); dispatch, storage, lifecycle, metrics and the listeners underAnkusa.Instance.Isolatedsubtrees, soSupervisor.terminate_child/2/which_children/1on the instance root no longer finds them. See "Failure domains" under Added. - Breaking for HTTP-sink receivers and queue consumers: provider request
headers are forwarded by default.
forward_headers: :defaultforwards every header except auth/framing/hop-by-hop andx-ankusa-*; setforward_headers: [...]to narrow it. - Breaking: the admin API (4002), route management API (4003) and claim
gateway (4001) listen on
127.0.0.1by default. They used to bind every interface and are unauthenticated. A deployment that reaches one from another host or container must setadmin.ip,routes.admin.iporclaim_check.ipto"0.0.0.0"(or one interface's address) and keep fronting it with its own proxy or network policy. - Breaking: the edge refuses header bytes no sink can carry. A request is
answered
400 {"error":"invalid_header","header":"<name>"}before its body is read when a header name holds a byte outside0x21..0x7Eor a value one outside0x20..0x7Eand tab (RFC 9110 field-value withoutobs-text); a non-ASCII value such ascaféis refused too, becauseSink.Http(Mint) cannot send it and queue sinks need UTF-8.headerisnullwhen the name is itself not printable. Such a request used to be acked201and then retried for hours and dead-lettered.Ankusa.Edge.Ingest.ingest/2returns{:error, {:invalid_header, name | nil}}, and the refusal is counted asankusa_ingest_refused_total{reason="invalid_header"}. NewAnkusa.Edge.Ingest.check_headers/1. - Breaking for anything that reads
GET /v1/config: redaction is an allowlist inside adapter options. An option of a{module, opts}pair (sinks, verifiers, blob store, source store, codec, retry policy, route resolver, route store, lifecycle sinks) is shown only under a known non-secret key (bucket,region,topic,exchange, …); every other value,sas_token,private_key,jwtandaccess_key_idincluded, is"[REDACTED]". A URL (url,endpoint,resource) keeps its host and path, loses the password ofuser:pass@(or a lonetoken@), and every query value becomes[REDACTED]. The same view feedsprint-configand the source lifecycle events. - Breaking for callers:
Ankusa.Sink.inline_max_bytes/2returns{:ok, max | nil} | {:error, reason}(it returnedmax | nil). A raise, exit, throw or invalid return from a sink'sinline_max_bytes/1is an{:error, _}; dispatch fails that delivery with{:inline_max_bytes, reason}(the retry policy runs, the DLQ reason names it) andwal: :noneanswers503. Ankusa.Fsync.mkdir_p/1ismkdir_p/2: it takes the root the path may be created under, and fsyncs the parent of every directory from the root down on every call. A LocalFS put costs one extra directory fsync per level between its root and the object.
Removed
- Breaking:
POST /v1/dlq/replay. Replaced byPOST /v1/replayswithkind: "dlq";GET /v1/dlqis unchanged. Ankusa.Dispatch(replay/1,replay/2) — replaced byAnkusa.Replay.start/2.
Fixed
- Under
wal: :none, a source written at runtime (Ankusa.SourceStore.put/5, the admin API's source routes) with no durable sink is refused with{:error, :invalid, message}(400 invalid_source), as boot already refused a static one: it would have answered201with no durable copy anywhere. Every writable source store applies the newAnkusa.Queue.check_durable/2before a write, andAnkusa.Edge.Publishanswers503for a source that reaches ingest without that check (stored before it, or written to a shared source store by awal: :disknode) instead of acking it with no durable copy. - A store restored from backup (or created fresh with a backup configured)
keeps its
RESTORE-IN-PROGRESSmarker untilreconcile_archivehas succeeded. A node that died, or whose reconcile failed, between the restore and the reconcile now reconciles on its next boot instead of opening as an existing store and reusing archived seqs. - A backup refuses to run when the prefix's latest backup belongs to another
store (
{:foreign_backup, theirs, ours}, logged at error level): each store gets an id (m:store_id) on its first backup, carried by its checkpoints and recorded in every manifest. Two nodes on one prefix no longer purge each other's backups. A node whoseLATESTwas moved by another writer of the same store (an old host beside its replacement) refuses too ({:prefix_shared, latest}). - Blob files of the hooks and quarantine column families are capped at 64 MiB
(
blob_file_size; RocksDB's default is 256 MiB), bounding what one backup upload or restore holds in memory. DELETE /v1/tenants/:tenant/sources/:nameno longer answers204while this node's queue still holds undelivered rows for the source: it is409 source_has_deliveries({"pending": n, "inflight": m}) and nothing is deleted.?deliveries=dead_letterdead-letters the pending rows first, as{:source_gone, source_id}(needs the:dispatchrole,409 role_not_enabledotherwise;503 dispatch_unavailableif the pipeline cannot answer), then deletes; rows in flight settle on their own. A source re-created under the same name no longer inherits the old backlog.- Delivery rows record their
source_id, so one source's rows are found without reading every hook. Rows written before keep working: they are matched by their hook's source. - The claim gateway serves one
Range: bytes=range as206withContent-Range(416past the end), from one ranged store read, and every claim response saysAccept-Ranges: bytes. Several ranges, other units and anyIf-Rangeget the whole claim.HEADreads only the pack's index, not the claim. - The S3, GCS, Azure and OCI blob stores retry a transport error or a
408,429,500,502,503or504(:retries, default 2 extra attempts, 200 ms then 1 s apart), re-signing each attempt; any other answer is returned at once, mapped as before.putsends its iodata as is instead of copying a segment into one binary first. - The claim sweeper no longer stops at a partition it cannot delete
(
File.rm_rf/1, logged);claim_check.retention_daysmust benilor ≥ 1, andsweep_interval_mspositive. - The S3 and Azure managed-identity credential caches are created when the
:ankusaapplication starts; they used to belong to whichever request or task filled them first and vanished with it, so temporary credentials were fetched again on almost every call. - The route snapshot table is owned by
Ankusa.Routes.TableOwnerand lent to the routes store, so a store crash no longer deletes it, and the restarted store resumes from it (Ankusa.Routes.Snapshot.adopt/1): the ETS store keeps API-created routes across a store crash instead of re-seeding from config. - A
{:permanent, _}answer to a breaker's probe closes the breaker; it used to leave the probe slot taken, parking the key forever. storage.key_prefixis applied when a segment is named and the catalogue keeps the full key, so changing the prefix no longer strands archived segments.Ankusa.Verifier.Hmacfails closed on an empty key. A missing,nilor empty:secret, an empty list, or a list element that is empty or does not decode is{:error, :bad_secret}for every hook. It used to HMAC with the empty key, which verified anything signed with it (a forgery anyone can compute); an explicitnilraised on every request.- A stalled store no longer answers
503for hooks it then commits. It used to answer503after 5 s for hooks the writer committed afterwards; now a batch the writer has started is waited out, one it has not is refused, and one whose commit task died before the writer reached it is dropped. A process dying while the writer is mid-commit (the commit task, the batcher, or the writer after its sync) can still answer503for a durable hook, which the provider's retry then stores again. - The batcher's commit task is supervised, not linked: a commit task that dies fails its own batch, not the batcher and the records buffered behind it.
- A sink that returns something other than
:okor{:error, _}is a503on thewal: :noneack path, not aCaseClauseErrorin the request. - A claim check whose blob store write exits, throws or returns something other
than
:okor{:error, _}(a:token_providerthat exits, say) is{:error, {:unavailable, _}}, a503underwal: :none, not a crashed request. - A GenServer crash report (the "terminating" report Logger prints) no longer
prints sink options, and neither does
:sys.get_status/1on these processes: the dispatch pipeline, compactor, claim-check sweeper, rate limiter, lifecycle publisher, writable source store, edge batchers andAnkusa.Instance.Isolatedredact their state, and the batchers and the writable source store also redact the message being handled. Supervisors still carry the config in their children's start arguments, so:sys.get_status/1on a supervisor (and observer) still shows it, and so would supervisor reports if SASL reports were enabled (Logger'shandle_sasl_reports, off by default). - Unauthenticated requests no longer mint Prometheus series: 20 000
POSTs to random paths used to add 280 000ankusa_ingest_*series (the lookup ran inside the[:ankusa, :ingest]span, with the URL'ssource_idas a label); they are now oneankusa_ingest_refused_totalseries. - The edge answers a request it will refuse without reading its body: a
Content-Lengthabovemax_body_bytesis413and an unknown source (or a tenant that is not valid) is404immediately, where each used to buffer up tomax_body_bytesfirst. The envelope copies the body only when it is a slice of a larger binary, not on every request. - The compactor backs off. After a failed tick it retries at
storage.interval_msdoubled per consecutive failure (jittered, capped at 60 s) instead of every interval, and a blob store whoseput/4exits, throws or returns something other than:okor{:error, _}fails the tick instead of crashing the compactor. - Any failed store write now asks the store for a reopen (at most once per
5 s), whichever process saw it (dispatch outcomes, the compactor,
quarantine, the replayer, rate-limit overrides, the source store), not only
an ingest commit: a fallback for a latched RocksDB write error left by a full
disk. RocksDB recovered from a full disk on its own in a container drill, so
this is a safety net, not a measured fix.
Queue.Writerno longer reopens the store itself, so ingest no longer blocks on a synchronous reopen. - Concurrent first writes into a new LocalFS directory (a claim pack's
tenant=*/dt=*partition at UTC midnight) no longer return before the directory is durable, and a parent fsync that failed once is retried by the next write. - A custom sink whose
inline_max_bytes/1raises no longer crash-loops the dispatch domain, which stopped delivery for every tenant. - A quarantine pen write that does not answer within 5 s is
503 store_unavailablewithRetry-After: 1, not a crashed request.
0.4.0 - 2026-10-02
Added
- An AsyncAPI 3.0 document of the channels an instance publishes to, served
by the admin API at
GET /asyncapi.json(application/asyncapi+json) and built byAnkusa.AsyncApi.document/1from the configured sources. Messaging sinks advertise their channel through the new optionalAnkusa.Sink.describe/2callback (Ankusa.Sink.Description); the Kafka, RabbitMQ, NATS, and Redis sinks implement it. Built on the newasync_api_spexpackage, now a dependency.docs/asyncapi.md. - Lifecycle events:
config.lifecycle.sinks(off by default) receives a CloudEvents 1.0 event,io.ankusa.source.{created,updated,deleted}orio.ankusa.route.{created,updated,deleted}, wheneverAnkusa.SourceStore.put/5ordelete/3orAnkusa.Routes.create/2,replace/3,update/3, ordelete/2changes something. Events never touch the store: a supervised in-memory publisher (Ankusa.Lifecycle.Publisher) delivers each one to every lifecycle sink independently, retrying withdispatch.retry, off the caller's path. When its queue is full (10,000 pending sink deliveries), when retries run out, or when it isn't running, the event is dropped and counted; pending events are lost on restart and are not ordered. A lifecycle failure never fails the change.[:ankusa, :lifecycle, :delivered]and[:ankusa, :lifecycle, :dropped]telemetry events, and theankusa_lifecycle_delivered_total/ankusa_lifecycle_dropped_totalmetrics. Ankusa.Store: one RocksDB database per instance at<data_dir>/<instance>/store(Hexrocksdb, erlang-rocksdb), holding the hooks, one delivery row per hook and sink, the quarantine pen, API-managed sources, rate-limit overrides, the segment catalogue, and the migration markers. It replaceswal/ankusa.wal(and its.cursors/.truncatedsidecars),dlq/dlq.log,quarantine/quarantine.log,segments/index.log,sources.json, andrate_limits.json. Column families:default,hooks,deliveries,index,archive,quarantine.Ankusa.Queue(public):enqueue/2commits a batch of hooks with one synced store write,hooks/3reads them back,stats/1reports the store,dead/2lists the dead rows, andvalidate_config!/1/label/1replace the old WAL adapter's.Ankusa.Queue.Writeris the only seq assigner: one group commit is one synced batch holding each hook, one pending delivery row and due key per sink of its source (bound by sink index and module at ack), an archive obligation while thestoragerole runs, and the seq marker. A failed commit acks nothing but may consume seqs, so seqs are strictly increasing and never reused (gaps are allowed). A hook with no obligations is acked with a seq but not stored.Ankusa.Edge.Quarantine.recent/2reads the pen from the store, newest first; the pen survives a restart (the old 200-entry in-memory list is gone).- An import of a 0.3 data dir on the first boot of a new store:
sources.json,rate_limits.json,quarantine/,wal/,dlq/, andsegments/index.logare read in that order, marked in the store, and then renamed<name>.migrated-<unix seconds>(never deleted — renaming them back is the rollback). Imported dead letters replay to the source's current sinks, and the next seq is past everything imported. Reading is chunked, so memory stays bounded at any file size.
Changed
Ankusa.Admin.Redact.source_entry/1takes theAnkusa.SourceStore.stored()map and builds the redacted source view itself (the admin API's source endpoints and the lifecycle events share it), where it used to redact a map the admin router had built.- Breaking: the WAL, DLQ, quarantine and segment-index files, and the
sources.json/rate_limits.jsonstate files, are gone. One RocksDB store per instance owns them all; a 0.3 data dir is imported on first boot (above). The data volume now holdsstore/, segments atsegments/seg/<first_seq>-<last_seq>.segwith a new siblingseg/<first_seq>-<last_seq>.idxper segment, andclaims/...claim packs. - Breaking:
wal: {Ankusa.WAL.DiskLog, _}raisesArgumentErrorwith the hint to usewal: :disk(the RocksDB store) orwal: :none. The key itself is unchanged:wal: :disk | :nonein core,wal.type: disk | nonein YAML. - Breaking:
Ankusa.Dispatch.replay/2returns{:ok, n}— the number of rows moved back to pending — and is asynchronous: it moves the rows and the pipeline delivers them. A replayed row leaves the DLQ, where the old replay left the entry in place. It needs thedispatchrole. - Breaking:
GET /v1/walreports the store. The body isnext_seq(exact) plushooksanddeliveries(RocksDB key estimates) anddisk_bytes;walis{}when the store is unreachable, and it is still409 wal_disabledunderwal.type: none.503 store_unavailableis added toGET /v1/dlq,POST /v1/dlq/replay,GET /v1/quarantine, and the rate-limit routes. - Breaking for embedders: core compiles a NIF. Building
rocksdbfrom source needs cmake >= 3.12, a C++20 compiler, and zstd + OpenSSL development headers; on Alpine,linux-headers, and Ubuntu CI runners needlibzstd-dev. - Dispatch is a scheduler over delivery rows. A commit wakes it; otherwise it
sleeps until the earliest due row. A retry is a row due at
now + backoff, so it frees its concurrency slot instead of sleeping inside a task. The window isdispatch.max_inflightclaimed rows anddispatch.max_inflight_bytes(the sum of their stored hook sizes);dispatch.batchis rows claimed per store scan. - A row's sink binding is
(index, module)at ack, but its opts always come from the source as it is now, so a config fix applies to the backlog and no fun or secret is ever persisted. A reordered source falls back to the unique sink with the row's module; otherwise the row is dead-lettered with{:sink_gone, index, module}, and a deleted source with{:source_gone, source_id}.
Removed
- Breaking: the Ankusa.Sink.ordering_key/2 callback, Sink.ordering_key/3, and
the http sink's
orderedoption. Deliveries are unordered, and a broker key (a Kafka partition key, an AMQP routing key) only keeps the order hooks were published in. A consumer that needs order has to rebuild it from data it receives, such as the provider's event timestamp or sequence number in the body, and tolerate redelivery. - Breaking:
dispatch.poll_ms. Dispatch is woken by a commit or by the next due row; the key is now an unknown-key error. - Ankusa.WAL, Ankusa.WAL.DiskLog, Ankusa.DurableLog, Ankusa.Storage.Index, Ankusa.Dispatch.DLQ.
Fixed
- A full disk recovers by itself. A commit that cannot write answers
503store_unavailableand acks nothing; the Writer asks the store to close and reopen (at most once every 5 s), which clears RocksDB's latched write error, so ingest resumes once space frees. kill -9loses nothing acked. Every commit is one synced store write; the loss suite SIGKILLs a separate BEAM and every acked hook is read back.- Corruption is reported, never silently truncated or shortened.
paranoid_checkspluswal_recovery_mode: tolerate_corrupted_tail_recordsdrop a torn tail (the last, never-acked write) and refuse to open on damage before it ({:store_open_failed, path, reason}). Point reads report checksum failures; a scan believes only a result that reaches its end-of-range sentinel. The Writer, the persistent source store, and the rate limiter refuse to start when they cannot read their state, rather than treating an unreadable store as empty. - One damaged frame in a 0.3 WAL no longer drops the acked frames after it.
A frame that fails its CRC with a valid frame after it refuses to start
(
{:damaged_legacy_wal, path, byte, later_byte}); only a torn tail is skipped. An unreadable.cursorsor.truncatedsidecar likewise refuses to start ({:corrupt_legacy_sidecar, path}). - Reclamation no longer needs the archive. A hook is deleted once its last
obligation clears — every delivery row and, only if
storageran at ack time, the archive obligation. So a node without thestoragerole reclaims on delivery, and the compactor can lag or be off without blocking delivery. - A retry no longer holds a delivery slot, so a failing sink cannot starve other sinks or sources.
- The archive compactor no longer crash-loops. A failed blob write ends the tick with an error log; nothing crashes, and the same hooks are rewritten next tick.
- LocalFS blob writes are durable.
Ankusa.BlobStore.LocalFSwrites a temp file, fsyncs it, renames it, and fsyncs the directory on everyput; a failed write returns{:error, reason}instead of raising. Claim packs, segments, and index objects all go through it. - The
schemelabel on verification metrics is the scheme, from the first request. Ingest asked a verifier for its scheme name without loading the module first, so until something else had loaded it the label (and theschemein telemetry metadata) was the module name instead, for exampleAnkusa.Verifier.Hmacwherestripewas meant.
0.3.0 - 2026-10-01
Added
wal: :none, the stateless ack path. Ingest verifies, then publishes to the source's sinks in the request (Ankusa.Edge.Publish) and answers201only once every sink has confirmed; a refusal is a503withRetry-Afterand the provider retries. No WAL, no batcher, no dispatch pipeline, no compactor, no DLQ: the node runs only theedgerole (the WAL's reader roles are dropped fromconfig.rolesrather than rejected). Ankusa.WAL.validate_config!/1 refuses awal: :noneconfig in which a statically configured source has no sink whose:okmeans durable — sources created at runtime through the admin API are not checked.Ankusa.Sink.durable?/1, the per-sink promisewal: :noneacks on; defaults totrue, andAnkusa.Sink.Loganswersfalse.Ankusa.Sink.safe_deliver/4(the raise/throw/exit-to-{:error, reason}wrapper hidden inside the dispatch pipeline) is now public, so both ack paths deliver through the same function.GET /v1/walon the admin API: this node's Ankusa.WAL.stats/1, or409 wal_disabledunderwal: :none. Ankusa.WAL.label/1 names the configured adapter for boot banners andcheck-config.- Per-tenant ingest rate limits (
Ankusa.Edge.RateLimiter,rate_limitsin the config:%{rate: hooks_per_second, burst: hooks}per tenant, plus adefault). A hook is charged after verification and before the durable write, so forged requests spend no budget; over the limit the sender gets429withRetry-Afterand nothing is stored. Enforcement is GCRA over one ETS row per tenant, updated by compare-and-swap, so concurrent hooks on one tenant cannot overshoot, and the buckets are this node's alone. The admin API reads and adjusts limits at runtime without a restart (GET /v1/rate-limits,GET|PUT|DELETE /v1/tenants/:tenant/rate-limit,:edgerole), persisting overrides torate_limits.jsonin the instance's data dir; aPUTorDELETEresets that tenant's bucket. Rejections emit[:ankusa, :rate_limit, :rejected](tenant-tagged) and appear asankusa_rate_limit_rejected_total, and the ingest:outcomelabel gains:rate_limited. Ankusa.SourceStoregains optional write callbacksput/5,get/3, andlist_tenant/2, plus matching facade functions, and a newAnkusa.SourceStore.Persistentadapter that keeps sources in ETS and persists the API-managed ones tosources.jsonunder the instance data directory. Sources can now be created, listed, and updated at runtime.- The admin API gains
GET/POST /v1/tenants/:tenant/sourcesandGET/PUT /v1/tenants/:tenant/sources/:name, andGET /healthnow reports the application version.
Changed
- Breaking: the ingest
201body is{"status": "accepted", "id": "…"}. Theseqfield is gone: it was this node's WAL position, not a per-source sequence, so two nodes in a fleet both emit1, 2, 3and any consumer ordering or deduping on it was wrong. Dedupe on the envelopeid. - Breaking: ingest
GET /statsis removed andGET /healthis liveness only ({"status": "ok", "instance": "…"}). Per-node WAL stats are operator surface, not provider surface: they moved toGET /v1/walon the admin port. - Breaking:
Ankusa.Sink.Httpno longer sendsx-ankusa-seq. The delivery contract isx-ankusa-id,x-ankusa-source, andx-ankusa-tenantwhen set. (The publishedankusanpm and PyPI SDKs dropHookHeaders.seqin the same release; their changelogs say so.) - Breaking for custom route stores.
Ankusa.Routes.Store'sinsertandreplacecallbacks take the version of the snapshot the caller validated against —insert(instance, route, version),replace(instance, route, version)— and answer{:error, :stale}, having changed nothing, when the table has moved on.Ankusa.Routesre-reads, re-validates and retries; a write that keeps losing answers503 store_unavailable, safe to retry.delete/2andput_ip_rules/2are unchanged.ankusa_redishas to be released with this: an olderAnkusa.Routes.Store.Redisdoes not implement the new arities. PUT /admin/ip-rulesrequires bothdefaultandrules. An omitteddefaultused to meanallow, which quietly turned a deny-by-default list into an open one; it is now400 invalid_ip_rulesnaming the missing field.- Client address:
X-Forwarded-Forfrom a trusted proxy is walked right to left. The first entry outsideroutes.trusted_proxiesis the client, entries to its left are never examined, and an entry that cannot be read before that point denies the request. Everyx-forwarded-forline is joined in order, and1.2.3.4:5678,[::1]and[::1]:443are accepted forms. Ankusa.Routes.Cacheis keyed by a per-snapshotepoch, not the store'sversion, because versions start over (a restarted in-memory store, a flushed Redis) and a decision cached under one could answer for a table it was never made against. Only requests of at most 16 segments and 256 bytes of path are cached, and the cache's memory check runs every second. A longer path is still decided correctly, by a scan of the route table;[:ankusa, :routes, :match]gainscacheable(false for such a path) so that cost can be seen.- The IP-rule and trusted-proxy parser is
Ankusa.Net.parse_cidr/1, which never raises and refuses a range inside::ffff:0:0/96(see Fixed).
Fixed
- Concurrent route writes could overwrite each other.
createchecked the id and the path against a snapshot outside the store's serialized write, so two creates of one id both answered201and the second replaced the first, and two enabled routes could take one path and method. APATCHwas an unguarded read-modify-write that lost concurrent updates, and one racing aDELETEbrought the route back. - An unreadable
X-Forwarded-Forentry from a trusted proxy resolved the client to the proxy's own address, which an allow rule for the proxy's range then admitted.Net.parse/1no longer raises on invalid UTF-8. - A range inside
::ffff:0:0/96as an IP rule or trusted proxy is refused at write time, and the error says to write the IPv4 CIDR instead. Addresses are matched as IPv4, so it could never match — and as a deny rule it silently let its own traffic through. - A dry run (
POST /admin/routes/test) no longer reads or fills the decision cache, and a store restart can no longer let a cached decision answer for the new table. - A seed with a disabled route after an enabled one for the same path no longer fails boot, and conflict detection is linear in the size of the seed.
- Route ids and methods refuse a trailing newline; a non-string
idis a400instead of a generated one;Route.from_json/1refuses a stored definition with no id instead of minting one per node. - The guard's log sampler draws independently per rejection, the warning for a
node with no route table loaded is sampled like the rest, and
routes.enabledmust be a boolean. A route store that does not answer is503with the reason logged instead of a crash. - The release notes below named
Ankusa.Net.CIDRandstream_dataproperty tests; neither ever shipped, and the entry now says what did.
0.2.4 - 2026-09-28
Added
- Route management: an allowlist in front of capture. With
routes.enabled: truethe edge is deny-by-default — aPOSTis captured only if its method and normalized path match an enabled route and its client address passes the IP rules; everything else is answered404(403for an IP denial, configurable to404) and never written to the WAL. Off by default, which is the previous behaviour.Ankusa.Routesis the context (authorize/4,authorize_path/5,dry_run/2, CRUD over definitions),Ankusa.Edge.RouteGuardthe plugAnkusa.Edge.Routercalls first on the capture path, andAnkusa.Routes.Store.ETSthe default node-local store with a hard cap (nothing is evicted) and aroutes.seedloaded at boot. Ankusa.Routes.Router: the management API on its own listener (routes.admin.port, default 4003), never the ingest port. Unauthenticated by design, the same stance asAnkusa.Admin.Router— Ankusa doesn't manage users, tokens, or API keys, so front it with your own proxy or network policy. Route CRUD,GET/PUT /admin/ip-rules,GET /health, and a dry run (POST /admin/routes/test) that reports the decision, the reason, the route, and the rule that produced it — without capturing anything.Ankusa.NetandAnkusa.Net.ClientIP: IP addresses as:inettuples, CIDR matching through thecidrpackage, and client resolution that readsX-Forwarded-Foronly from a peer insideroutes.trusted_proxies(one unparseable entry discards the header whole).Ankusa.Routes.Cache: a local decision cache (nebulex+nebulex_local) keyed by the snapshot version, so a route change retires every cached decision at once.- Telemetry:
[:ankusa, :routes, :match](with:cached),[:ankusa, :routes, :reject](with:reason), and[:ankusa, :routes, :changed]. - Dependencies:
cidrfor CIDR parsing and range membership, andnebulexandnebulex_local— every deployment that turns routes on wants the decision cache, so it lives in core; the Redis definitions store is the separateankusa_redispackage.yaml_elixir(:testonly) backs the OpenAPI contract test. priv/openapi/admin.v1.yamlnow documents the route-management endpoints too (theroutestag:admin/routes,admin/routes/{id},admin/ip-rules,admin/routes/test), with a worked example of every request and response — the examples are a sequence, one route's life. The tag is served on its own listener, so the path items carry aserversoverride and/healthis documented as a union of the two listeners' bodies.test/ankusa/routes/router_openapi_test.exs: the contract test. It builds every documented request from the document's own examples, sends it through the real router, and checks the status, the schema, and the field names against what the document says; it enforces the documented method matrix, 404s the near-misses of the documented surface, and validates every example against its own schema. A rename, a status change, an added or removed endpoint, or a stale example fails the suite instead of shipping.Ankusa.Routes.ip_rules/1falls back to the configured rules when no store has published a table, and a write through a store with no table is the documented{:error, :store_unavailable}rather than a crash.
Changed
Ankusa.Configgained the:routessection. It merges one level deeper than the others (routes.cache,routes.ip_rules, androutes.adminmerge key by key), becauseroutes.cache.max_sizereplacing the whole section would silently drop the TTLs.
0.2.1 - 2026-09-28
Changed
- The claim reference is
urn:ankusa:claim:v1:<tenant>:<claim_id>, whereclaim_idis a canonical (uppercase) ULID: the pack's timestamp and entropy, with the claim's position in its pack in the last 16 bits. The digest moved out of the reference into the queue message's newsha256field (lowercase hex). The gateway route isGET /v1/claims/:tenant_id/:claim_id; its416/invalid_rangeresponse is gone, and a claim id past the end of its pack is404. Ankusa.ClaimCheck.redeem/3takes the ref (or its URN) and the expected sha256;read/3takes a tenant and a claim id.check_in/4andcheck_in_batch/2return%{ref: %Ref{}, sha256: hex}per item, which is also what dispatch hands sinks inctx.claim.check_in/4's:object_idoption is now:pack_id.- Packs start with an
index.binentry (a big-endianoffset,lengthuint32pair per claim) so the gateway can find a claim from its id alone. Claim entries are named by claim id;manifest.jsonrows gainclaim_id. Pack objects live atclaims/tenant=<t>/dt=<day>/<pack_id>. [:ankusa, :claim_check, :check_in]telemetry metadata carries:pack_id, and:redeemcarries:claim_id, instead of:object_id.
0.2.0 - 2026-09-24
Added
Ankusa.BlobStore.Azure: Azure Blob Storage. Carries no credential dependency: a pre-generated:sas_token(Shared Access Signature) or a:token_providerMFA (Entra ID bearer token) is appended to each request; the adapter does no Shared-Key signing of its own. Local testing against thefloci-azemulator indocker-compose.yml.Ankusa.BlobStore.OCI: Oracle Cloud Infrastructure Object Storage. OCI has no bearer/SAS shortcut, so this adapter signs its own requests (RSA-SHA256 Signature version 1) with OTP's:public_key, no dependency, pinned against OCI's published reference signature (computed independently with OpenSSL) intest/ankusa/blob_store_oci_signing_test.exs. Local testing against thefloci-ociemulator indocker-compose.yml.Admin API (
Ankusa.Admin.Router), started whenadmin.enabledis true (defaultfalse, port4002):GET /health,GET /metrics,GET /v1/config(redacted),GET /v1/dlq,POST /v1/dlq/replay,GET /v1/quarantine. Unauthenticated by design; front it with your own proxy or network policy. Contract:priv/openapi/admin.v1.yaml.Ankusa.Metrics: a per-instance Prometheus reporter behind/metrics, covering ingest, verification, WAL commit, dedup, load shedding, quarantine, dispatch, compaction, and claim check. New dependencies:telemetry_metricsandtelemetry_metrics_prometheus_core.:instancein the metadata of[:ankusa, :dispatch, :stop],[:ankusa, :dispatch, :dlq],[:ankusa, :claim_check, :check_in], and[:ankusa, :claim_check, :redeem].Ankusa.Verifier.Hmac: a configurable HMAC signature engine driven by a%Ankusa.Verifier.Hmac.Scheme{}descriptor, with named presets inAnkusa.Verifier.Schemesfor Stripe, GitHub, Standard Webhooks, Shopify, and Slack, and an inlinetype: hmacYAML surface for any other body-HMAC provider. Theshopifyandslackverify.typevalues are new.scheme_name/1optional callback onAnkusa.Verifier, aschemefield onAnkusa.Verification, and aschemelabel onankusa.verify.failures.total.Ankusa.Sink.ordering_key/2, an optional sink callback naming the ordering scope of a delivery. Deliveries to the same sink with an equal key run one at a time in
seqorder, different keys run concurrently.Sink.Httptakesordered: trueto opt in (off by default);Sink.Kafkauses its record key,Sink.RabbitMQits routing key,Sink.Lognone.Ankusa.Sink.inline_max_bytes/1: optional sink callback naming the largest body the sink sends inline. Dispatch checks a body in once, before any sink runs, and hands the claim reference to every sink and retry inctx.claim.
Removed
Ankusa.Verifier.Stripe,Ankusa.Verifier.GitHub, andAnkusa.Verifier.StandardWebhooks, replaced byAnkusa.Verifier.Hmacpresets. Elixir embedders use{Ankusa.Verifier.Hmac, scheme: :stripe, …}.- Claim-check authentication:
claim_check.api_tokens(and the YAMLclaim_check.tokens), tenant scopes, and the401/403responses. The gateway does no auth or authorization; put a proxy, mesh, or network policy in front of it. Ankusa.ClaimCheck.Ticket,Ankusa.ClaimCheck.Direct, andAnkusa.ClaimCheck.Remote, plusclaim_check.adapter,claim_check.remote, andclaim_check.max_bytes. Dispatch nodes write directly to the object store; a public write API and a credential-less write path are no longer supported.
Changed
The claim reference is now one URN string in a queue message's
claimfield,urn:ankusa:claim:v1:<tenant>:<object_id>:<offset>:<length>:sha256-<hex>, instead of a nested ticket object. Messagevstays1. Consumers redeem it withGET /v1/claims/:tenant/:object_id/:offset/:lengthand check the sha256 themselves. Breaking for consumers of the old ticket object.Claims are packed: dispatch checks each WAL read batch's claims in per tenant as one uncompressed-ZIP object (plus a
manifest.json), onePUTper tenant per batch, sized byclaim_check.pack_max_bytes(default 16 MiB). Previously each sink wrote each claim on every attempt.The default
inline_max_bytesfor the queue sinks is now 64 KiB (was 8 KiB), andSink.Message.inline_max_bytes/1is the single source of that default.Claim storage layout is now Hive-style:
claims/tenant=<t>/dt=<yyyy-mm-dd>/<object_id>(wasclaims/<percent-encoded tenant>/<id>). Tenants are validated as[A-Za-z0-9_-]{1,64}at ingest and config time; a bad URL tenant is a404before anything is written.The claim-check gateway is read-only and cacheable:
GETresponses carrycache-control: public, max-age=31536000, immutable, and416is returned for a range past the end of an object.PUTis gone.Ankusa.ClaimCheck'sredeem/2takes a%Ankusa.ClaimCheck.Ref{}or its URN string;check_in/4andcheck_in_batch/2replace the old per-ticketcheck_in/4.Dispatch is concurrent: up to
dispatch.concurrency(default32) sink deliveries run at once, serialized per Ankusa.Sink.ordering_key/2, and the durable cursor is a watermark that never advances past an unfinished envelope. A slow or retrying sink no longer blocks the whole instance, anddispatch.max_inflight(4096) /dispatch.max_inflight_bytes(128 MiB) bound how much admitted-but-unfinished work it can hold. A sink that raises, throws, or exits is retried and dead-lettered instead of crashing the pipeline.dispatch.batch(128) now bounds one WAL read rather than one tick's delivery.batcher.max_delay_msdefaults to0andbatcher.partitionsto2: the WAL append runs in a task, so commits pipeline naturally and extra partitions only add contention.max_queuebounds buffered and in-flight records. A failed WAL append now replies{:error, :store_unavailable}(→503) to every caller in the batch instead of crashing the batcher.WAL.DiskLog truncation is logical first:
truncate_through/2records a durable seq floor (<name>.truncated) and drops index entries, and only rewrites the file once the dead prefix passes:rewrite_min_bytes(default 64 MiB) and is as large as the live suffix..cursors,.dedup, and.truncatedare fsynced before their rename, andread/3walks the index with:ets.next/2instead of a full:ets.select/3scan per read.Ankusa.Storage.Compactorhonoursstorage.roll_bytes: a backlog is written as several bounded segments per tick (256-record reads) instead of one unbounded segment, so memory stays flat after a storage outage.storage.roll_msremains unimplemented;storage.roll_bytesis now the segment bound it always claimed to be.claim_check.api_tokensis optional. Empty (the default) leaves the claim-check gateway open, with authentication delegated to whatever fronts the port; a:claim_check-role node no longer fails to boot without tokens.Ankusa.ClaimCheck.Remote's:tokenis optional; omit it when the gateway has noapi_tokens.Ankusa.Admin.Redactalso redactsnkey_seed, the private key aSink.NATSdeployment authenticates with, soGET /v1/configcannot print it.
Fixed
- WAL.DiskLog: a restart after a full truncation resumed at
seq1 while the persisted cursors were far ahead, so every new hook was skipped by dispatch and then deleted by the next truncation. Seq allocation now continues from the truncation floor, the persisted cursors, and the last replayed frame. - DLQ appends and storage-index appends are fsynced: a dispatch cursor could advance past a dead letter (or a compaction cursor past index rows) that a power loss then dropped, leaving the hook in neither place.
Ankusa.Dispatchno longer copies the whole pipeline state into every delivery task, and WAL.DiskLog no longer scans its whole index per read. Together those two were the dispatch throughput ceiling (seedocs/testing.md).
0.1.0 - 2026-09-23
Added
- Core ingest pipeline: Bandit edge, group-commit batcher, durable WAL (Ankusa.WAL.DiskLog), idempotent receiver, dispatch pipeline, segment compactor.
- Pluggable behaviours:
Ankusa.RouteResolver, Ankusa.WAL,Ankusa.Verifier,Ankusa.DedupKey,Ankusa.SourceStore,Ankusa.Sink,Ankusa.RetryPolicy,Ankusa.BlobStore,Ankusa.Codec. - Verifiers: Standard Webhooks, Stripe, GitHub.
- Object store adapters:
BlobStore.LocalFS(default),BlobStore.S3(AWS/MinIO/R2, SigV4 viaaws_signature),BlobStore.GCS. - Multi-tenant catch-URL routing (
RouteResolver.Path,RouteResolver.TenantPath) with tenant-scoped dedup/storage. - Quarantine (rate-limited durable pen for verification failures) and DLQ + replay for dispatch give-ups.
- Loss checker: proves every acked id survives a hard instance crash.
Ankusa.ClaimCheckgateway: check bytes in, get a versioned ticket back; present the ticket, get the bytes back.Ankusa.ClaimCheck.Direct(calls the instance's configuredBlobStorein-process) andAnkusa.ClaimCheck.Remote(HTTP client against a:claim_check-role node, for callers that must not hold blob-store credentials). New:claim_checkrole andAnkusa.ClaimCheck.RouterHTTP API (PUT/GET /v1/claims/:tenant_id/:id), off by default, bearer-token authenticated and tenant-scoped. Seedocs/claim-check.md.Ankusa.Sink.Message: the wire format every queue-style sink publishes (Sink.RabbitMQ,Sink.Kafka): inline base64 up toinline_max_bytesor a claim ticket above it, with an additive"v": 1version field.Sink.Httpaddsx-ankusa-tenantto its identity headers when the envelope has a tenant id.Ankusa.Config.parse_roles!/1validatesANKUSA_ROLESagainst the fixed role set (edge,dispatch,storage,claim_check) and fails boot on an unknown name, instead of silently atomizing arbitrary input.Ankusa.Config.new/1rejects an unknown nested key (e.g.batcher: %{max_queu: 5}) and correctly deep-merges a keyword-list section instead of replacing the whole defaults map.- HTTP is
Reqthroughout: the S3 and GCS blob stores, the claim-checkRemoteadapter, andSink.Httpno longer hand-roll:httpcplumbing (and:inetsis no longer started by this package). Outbound requests go throughAnkusa.HttpClient, which never follows a redirect (a followed one re-sends a hook as aGET) and takes:req_optionsfrom an allowlist: transport tuning only, so a caller cannot rewrite a URL that has already been signed. - Ankusa.Application's built-in default instance is opt-in:
autostartdefaults tofalse, so depending onankusanever binds a port as a side effect.