Appearance
0053. SQLite, a store service, a database per agent and a static coder ​
Status: Accepted (2026-11-19), an owner decision. The owner's words: SQLite joins Postgres and MongoDB because "a test harness or client app won't use postgres/mongo"; the SQLite binding conflict is solved for good by moving adam-store-postgres off sqlx; Store is served by a store service over CrateStack RPC/CBOR; the platform makes one CloudNativePG Database and DatabaseRole per agent in a shared cluster; the image's binaries are static (x86_64-unknown-linux-musl). Nothing is built; the slices are at the end. Builds ADR 0047 decision 3 and amends it (its workspace of its own), decides ADR 0052 decision 10's open glibc point, and changes the bench of ADR 0048 (dated notes there).
Context ​
The Store port (crates/adam-core/src/store/mod.rs, 19 methods) has two shipped adapters and the memory one (Store adapters). Today:
- The binaries know one store.
adam-serviceconnectsPgStorefromDATABASE_URLandPgNotifyon its pool (crates/adam-service/src/serve.rs); MongoDB is a library adapter only. - SQLite cannot join the workspace.
adam-store-postgresandadam-notify-postgresusesqlx0.9, andsqlxlockssqlx-sqliteeven when nothing uses it. Verified 2026-11-19 (the crates.io index and twocargo generate-lockfileprobes,rusqlite0.43 withbundledbesidesqlxwithpostgres,json,chrono,uuid): withsqlx0.9.0 (this workspace's lock) the resolution fails onlinks = "sqlite3", becausesqlx-sqlite0.9.0 wantslibsqlite3-sysbelow 0.38; withsqlx0.9.1, published 2026-11-18, it resolves, becausesqlx-sqlite0.9.1 widened that to below 0.41. The ceiling is still there: the nextlibsqlite3-sys(0.41) conflicts again untilsqlxfollows. So ADR 0047 put the SQLite adapter in a Cargo workspace of its own. - Every process that runs a worker holds the database's credential. In a cluster that is the coder pod; on a desktop or in the bench a run's commands run beside the coder (
RUN_ENVIRONMENT=local, ADR 0052 decision 3), so a file database there would be readable by the commands. - The image's binaries need glibc 2.39. They are built on
rust:1.94-trixie(docker/coder/Dockerfile), and the bench's adam arm is to start the coder from each task image (ADR 0052 decision 10), where Debian bookworm has glibc 2.36 (verified 2026-11-19 by the caller). - The platform makes one CloudNativePG
Clusterper service (crates/store-cnpgof another-agentic-platform, its §59a S6), and defers "aDatabasein someone else's Cluster".
What the pieces offer, checked on 2026-11-19:
Postgres without
sqlx.tokio-postgres0.7.18 (2026-06-12;postgres-types0.2.14), the client of therust-postgresproject, is pipelined (concurrent queries on one connection go out without waiting) and deliversLISTENnotifications asAsyncMessage::Notification(itssrc/lib.rs,src/connection.rs).deadpool-postgres0.14.2 (2026-08-26) pools it;bb8-postgres0.9.0 has had no release since 2024-12.tokio-postgres-rustls0.14.0 (2026-05-21) takesrustls0.23 with no provider of its own, so the tree keeps aws-lc-rs. Verified on crates.io and in the published sources. Itssslmodeisdisable,preferorrequireonly (src/config.rs), whilesqlxalso parsesverify-ca,verify-full,sslrootcert,sslcertandsslkey(sqlx-postgres0.9.0,src/options/parse.rs), verified in both sources.SQLite.
rusqlite0.43.0 (2026-11-15) needslibsqlite3-sys0.40; CrateStack's embedded store,cratestack-rusqlite0.20.4, needsrusqlite0.41.1 (libsqlite3-sys0.39). One build links onesqlite3, so an application that uses both must use onerusqliteminor. Verified on crates.io.CrateStack RPC (github.com/cratestack/cratestack at
cbbae98, 0.20.4 of 2026-11-16, MIT; verified 2026-11-19 in itsREADME.md,docs/design/rpc-transport.md,docs/design/rpc-batching-coalescing-model.md,docs/adr/0017-remove-grpc-protobuf.md,crates/cratestack-client-rustandexamples/rpc-procedures):- a schema with
transport rpcanddatasource { provider = "none" }, compiled bycratestack-api'sinclude_server_schema!(…, db = None), gives an axum router withPOST /rpc/{op_id}andPOST /rpc/batch, and aProcedureRegistrytrait the service implements: no database and nosqlxin the tree; cratestack-client'sinclude_client_schema!gives typed procedure clients overreqwest0.13 (rustls, no provider chosen; it enablesrustls'sringfeature), andRpcClient::batch; a client can be built on a givenreqwest::Client(with_http_client);- CBOR is the default codec between services;
@streamprocedures answer asapplication/cbor-seq, and subscriptions go over SSE or WebSocket; - a batch is not transactional: each frame is its own call, the server may run frames in parallel, the answers come back in the request's order, and a frame never refers to another; a batch has a frame limit;
- coalescing calls into batches is a shipped TypeScript package and, in Rust, an example (
examples/rpc-batch-debounce), not a library; - gRPC was removed in 0.8.5 (its ADR 0017);
cratestack-grpcstopped at 0.8.4 (2026-08-18); - the workspace's
rust-versionis 1.98.0 (crates.io), and the project is pre-1.0: "minor releases can break".
Verified 2026-11-19 by a probe (Rust 1.98.0,
x86_64-unknown-linux-musl,cratestack-api,cratestack-client,cratestack-codec-cbor0.20.4): atransport rpcschema with one procedure (aUuid, aBigInt, aString, aBoolean, aJson) compiled as a server and as a client in two crates; the client called it alone, then three times in onePOST /rpc/batch, over CBOR, with a bearer token checked by anAuthProvider; a call without the token was refused (permission_denied, 403). Two limits found: aJsonfield isJson<cratestack::Value>, whose integers arei64, sou64::MAXcame back as the float1.8446744073709552e19; and in an image with no CA certificates the default client panics when it is built (reqwest0.13: "No CA certificates were loaded from the system"). Unverified: the cost of one call; streaming (@stream) and the batch's frame limit were read, not run.- a schema with
CloudNativePG 1.30.2 (the latest release, 2026-11-17; verified 2026-11-19 in
docs/src/declarative_role_management.mdanddeclarative_database_management.mdat the tagv1.30.2):Database(postgresql.cnpg.io/v1):spec.name,spec.owner,spec.cluster.name(immutable),databaseReclaimPolicy(retainby default, ordelete),ensure;status.applied,status.message;postgres,template0andtemplate1are refused;DatabaseRole(the recommended form, namespaced with its Cluster):spec.cluster.name,spec.name,login,inRoles,connectionLimit,databaseRoleReclaimPolicy(retainby default;deletedrops the role, and staysTerminatingwhile the role owns objects),passwordSecret(akubernetes.io/basic-authSecret someone else writes), andclientCertificate, with which the CloudNativePG operator itself writes the Secret<databaserole>-client-cert(tls.crt,tls.key), signed by the cluster's client CA, 90 days, renewed 7 days before expiry; the Cluster needs ahostssl … certline inspec.postgresql.pg_hbafor it; aDatabaseRoleof an existing role adopts it and resets what it omits;- a name in the Cluster's
spec.managed.roleswins over aDatabaseRoleof the same name, which then reportsapplied: false.
musl. A release build of the six binaries of the image (
adam-coder,adam-agent,adam-kube-exec,adam-egress,adam-git-sandbox,adam-git) atmain(d8d6005) forx86_64-unknown-linux-musl, withmusl-gccas the C compiler and nothing else changed, built (8 minutes on 4 cores; verified 2026-11-19): aws-lc-sys, ring throughrustls,kubewithws,sqlx's Postgres driver, the vendoredprotoc,rmcp,reqwest0.13.filesays each isstatic-pie linked; in an empty root (no C library, no/etc) as uid 10001 each starts and reaches its own configuration check (exit 78,adam-kube-exec64). A second probe builtrusqlite0.41bundled(SQLite 3.54.1, run),tokio-postgres0.7.18,deadpool-postgres0.14.2,tokio-postgres-rustls0.14.0,mongodb3.10.1 andmimalloc0.1.52 for musl, and the CrateStack probe above is musl too. Unverified: a whole run on musl (TLS to real hosts, DNS in a cluster, git), and the allocator's effect.
Decision ​
SQLite, and the store chosen by DATABASE_URL ​
adam-store-postgresandadam-notify-postgresmove totokio-postgres, pooled bydeadpool-postgres, TLS bytokio-postgres-rustlson the process's aws-lc-rs provider.sqlxleaves the workspace andCargo.lock, and CI fails when it comes back (cargo tree -i sqlxmust find nothing). The schema, the statements and the guarantees of Store adapters do not change, and the migration of an existing database is a no-op: the tablessqlxmade are the tablestokio-postgresreads. The adapter parses the URL parameterstokio-postgresdoes not (sslmode=verify-caandverify-full,sslrootcert,sslcert,sslkey) and configuresrustlswith them, so everyDATABASE_URLthat works today works after.Amended 2026-11-20 (slice 2, #361): built. Both crates run on
tokio-postgres0.7.18,deadpool-postgres0.14.2 andtokio-postgres-rustls0.14.0,sqlxis out ofCargo.lock, and theclippy-defaultjob runsif cargo tree --workspace --locked -i sqlx; then exit 1; fi(an absent package exits 101). The URL handling lives in the newadam-postgrescrate,PgConfig: it strips the TLS keys and thesqlxaliases, mapssslmodeto the driver'sdisable|prefer|require, and for the two verifying modes installs arustlsverifier —verify-cachecks the chain only,verify-fullthe chain and the host name — with roots fromsslrootcert(else the Mozilla roots) and an optional client certificate fromsslcert+sslkey; the provider is alwaysaws-lc-rs, named explicitly because the tree also compilesring(throughmongodb). The breaking signatures (Rule 2):PgStore::from_pool(deadpool_postgres::Pool),PgStore::pool() -> &deadpool_postgres::Pool,PgStore::from_config(PgConfig, u32), andPgNotify::new(deadpool_postgres::Pool, PgConfig, BroadcastSink)— the listener owns a connection of its own, because deadpool drives a pooled client as theConnectionfuture, which drops notifications.adam_core::time::Timestampbinds throughpostgres-types'with-jiff-0_2, so thePgTimebridge of ADR 0057 is deleted. One error class changes:sqlx'sProtocolandWorkerCrashedwereTransient,tokio-postgreshas no equivalent, so what is not a database error, a closed connection or an I/O/TLS failure isInternal; a unique violation, a serialization failure, a lost connection and a bad statement keep their classes.Amended 2026-11-20, second part (the head and the body, ADR 0055):
SCHEMA_VERSIONis 6 andPgStorekeeps bodies (keeps_bodies() == true).runs.head/runs.head_versionhold the v5 head and the version it was written at;adam_bodyholds(run_id, generation, idx) -> (message, writer, written_at)and cascades with the run. A commit that writes a head, a body or blob references is one transaction: the run row lockedFOR UPDATE, the version check, the rows after the head'slen(INSERT .. SELECT unnest(..) ON CONFLICT DO NOTHING), the refs, the CAS; a foreign slot is resolved inside it (identical message adopted, older than the 5-minute orphan grace collected and retried once, live and differentConflict).load_headis oneSELECTthat serves the head whenhead_version == versionand the whole state otherwise, soRuntime::viewon Postgres is onelease_until+ oneload_headand no body;Runtime::statejoins the head and onebody_list. The upgrade gate isstored < 6(orto_regclass('<prefix>body')), never the blob step'sstored == Some(4): a database stamped 5 has the blob tables and no head or body.tests/fixtures/schema-v5.sql(thesqlxbuild) opens and upgrades to 6, andschema-v6.sqlis the current schema, compared with the live statements by a unit test.Store::load_headandkeeps_bodiesare defaulted; aStorewrapper must forward them (withbody_listandgc_body), because the defaultload_headcalls the wrapper'sload_run, so a view through a wrapper that does not delegate silently reads the whole state and loses the head.adam-store-sqlite(new) joins the main workspace:rusqlitewithbundledSQLite, on therusqliteminor thatcratestack-rusqliteuses (0.41 today), so an application can link both; a CI probe resolves the two together. It is what ADR 0047 decision 3 asked:store_conformance!, one writer, each change oneBEGIN IMMEDIATEtransaction, WAL,LocalNotifierfor signals, a lock file that refuses a second process and lets the process release its own leases at start. Its calls run on a blocking thread, so the async runtime never waits on the file.Every binary picks its store from
DATABASE_URL, inadam-service(each adapter behind a Cargo feature of the service, all on in the image):DATABASE_URLStore Signals across processes postgres://…,postgresql://…adam-store-postgresLISTEN/NOTIFY(adam-notify-postgres)mongodb://…,mongodb+srv://…adam-store-mongodbnone: workers poll sqlite://<path>adam-store-sqlitein-process ( LocalNotifier)store+http://…,store+https://…(new)adam-store-remote(decision 5)the service's stream (decision 7) Any other scheme is exit 78.
sqlite://holds one process per file, so aROLEofcontrol-planeorworkeron it is exit 78: a split deployment uses Postgres, MongoDB or the store service.Amended 2026-11-20 (slice 3, #362): built, except the store service.
adam-store-sqliteis in the main workspace onrusqlite0.41.1 withbundled(the minorcratestack-rusqlite0.20.4 uses, so an application that links both has onelibsqlite3-sys),SCHEMA_VERSION1, and passesstore_conformance!,blob_conformance!andbody_conformance!; it keeps heads, bodies and blobs. It is one file, one process:opentakes an exclusiveflockon<path>.lockand refuses a second process,migrateclears the dead predecessor's leases so aSIGKILLed process's runs are claimable at once, and a file stamped with a newer schema is refused. Every change is oneBEGIN IMMEDIATEtransaction on a blocking thread; WAL;LocalNotifierin process.adam-servicechooses the adapter fromDATABASE_URL:postgres(ql)://,mongodb(+srv)://andsqlite://, each behind a feature (store-postgres,store-mongodb,store-sqlite, all on in the binaries); an unknown scheme is exit 78, and so issqlite://withROLE=workerorROLE=control-plane. MongoDB is now selected, not only a library. The probetools/sqlite-probe(CI jobsqlite-probe, part oflint) resolves the adapter withcratestack-sqliteand asserts onerusqliteand onelibsqlite3-sys. Not built:store+http:///store+https://and the store service of decisions 4–7. Breaking:adam-service's Postgres dependencies are optional features, andServeError::Connectis a struct variant whose message names the backend (connecting to Postgres,connecting to SQLite), not a generic "connecting to the store".
A store service ​
Storeis served over CrateStack RPC with CBOR, not gRPC: CrateStack does what this needs (above) and removed its gRPC transport, and the owner's default for a Rust service is CrateStack. One schema,store.cstack(new), says one procedure perStoremethod plusjournal.from(decision 6) andsignals(decision 7), withtransport rpcand no datasource;StoreError's class (adam_error::Classify) travels in the error, so the caller decides from the class as it does in process (Rule 6). A state, a payload or a push configuration travels asBytesholding its JSON text, not as CrateStack'sJson, whose integers arei64(above): the value read back is the value written. The client is built on its ownreqwest::Client(with_http_client), with the CA it is given, so an image without system certificates does not stop it.- Two parts.
adam-store-remote(new) is the client adapter: aStorethat passesstore_conformance!against a real server in its tests.adam-store-server(new,bin/adam-store-server) serves anyStoreit is given: it chooses its own from itsDATABASE_URL(decision 3, the remote scheme refused), runsmigrateat start, and holds the only database credential. The client'smigrateasks the server for its schema and protocol version and refuses one it does not speak (exit 78). It listens on HTTP/2 (h2con a private network, TLS otherwise) and refuses every call without a credential (Rule 4): a bearer token from a file, or, in a cluster, the agent's projected service-account token checked against the cluster's issuer (decision 10). - Batching and pipelining, because every step journals (
Ctx::stepreadsjournal_getand writesjournal_put,crates/adam-runtime/src/ctx.rs):- One HTTP/2 connection carries every call of a process at once, so the concurrent calls the runtime already makes (the steps of parallel tool calls, ADR 0049; lease renewals of several runs; push deliveries) do not wait for one another.
- Coalescing. Calls that are issued while a request is in flight wait for it and go out together as one
POST /rpc/batch. A lone call is never delayed (no timer). Calls in flight together are by construction ones the runtime does not order, which is what a batch allows (its frames are independent). - Read-ahead of the journal. A
journal_getthe client cannot answer from its cache callsjournal.from(run, seq, 64), which returns the entries fromseqon, and caches them per run until the lease of that run is released. An entry once written never changes (first writer wins), so a cached entry is always right; an absence is never cached. Replaying a run of N steps then costs about N/64 calls instead of N. - A new step's write is not deferred:
journal_putreturns the stored winner, which the step returns, so a step waits one round trip, as it waits for Postgres today. - Retries. A call whose connection broke is
Transientand the runtime retries it; a commit's version check and the journal's first-writer-wins make the retry safe, as they do for a dropped database connection today.
- Signals. The service offers
signals, an@streamprocedure that forwards its own notifier (PostgresNOTIFY, or in-process for SQLite), andadam-store-remotegives aNotifierover it. A signal is never the truth (Rule 5): a broken stream is aResync, and workers poll as they do on MongoDB.
Where it runs ​
Three shapes.
Shape The store Who can read the data Phone (Flutter with flutter_rust_bridge, adam-engineof ADR 0047)adam-store-sqlitein processthe application: there is no shell, and the tools are the host's Cloud (Kubernetes) adam-store-remote→ the agent's store service →adam-store-postgres→ the agent's ownDatabasethe store service alone; the agent pod holds no database credential; run pods cannot reach the service Bench, desktop dev adam-store-remote→ a store service beside the coder →adam-store-sqliteon a volume of the servicethe store service alone: the run's commands, which run beside the coder, see neither the file nor its credential In the bench and on a desktop the coder still hides its variables from its children and is non-dumpable (
crates/adam-service/src/harden.rs), so a command cannot read the store's token from the coder's environment.Production databases: one
Databaseand oneDatabaseRoleper agent in a shared CloudNativePG cluster. The platform'sstore-cnpgmakes, for an agent<svc>:- a
DatabaseRole<svc>-storewithlogin: true,inRolesthe cluster's agents group, andclientCertificate, so the CloudNativePG operator writes the credential (<svc>-store-client-cert) and no component of ours writes or reads a Secret (the platform's AD-024 stands); - a
Database<svc>owned by that role, in the cluster the deployment names; - both with the reclaim policy of the service's
deletionPolicy(retainforRetain,deleteforDelete); - the agent's store service (a Deployment of
adam-store-serverfrom the agent's own image), which mounts that Secret and the cluster's CA and connects withsslmode=verify-fulland the certificate; - a
NetworkPolicythat admits to the store service only the agent's own pods, so run pods (gVisor, AD-052) are refused at the network as well as by their deny-by-default egress (ADR 0042).
The shared Cluster is the deployment's: it carries the agents group (in
spec.managed.roles,login: false) and onepg_hbaline,hostssl all +<group> all cert, which the operator reads (it is not a Secret) and reports missing as not ready. A per-serviceClusterstays available for a deployment that wants one.- a
The agent's credential for the store service is a projected service-account token of the agent's pod, with the audience of its store service, checked by the service against the cluster's service-account issuer (its OIDC discovery and keys) with the subject the agent's own account. Nothing is written for it, and a run pod, which has no such token (ADR 0041), has nothing to present. Outside a cluster the token is a file the deployment makes.
A static coder ​
The image's binaries are built for
x86_64-unknown-linux-musl, statically linked:adam-coder,adam-agent,adam-kube-exec,adam-egress,adam-git-sandbox,adam-git, andadam-store-serverwhen it exists. They then start in any Linux image of that architecture, whatever its C library, which is what the bench's adam arm needs (ADR 0052 decision 10: the coder started from the task image). The build stage adds the musl target andmusl-toolsto the pinned Rust image; the runtime base stays theworkspaceimage. A global allocator other than musl's (mimallocby default) is set in the binaries, since musl's allocator is slow under many threads (unverified for adam: the slice measures it).What moves with it: the image (its binaries), its tag (
sha-<7>of the slice's merge, bumped by the workflow, never by hand), the platform's and the system's pins when their holders move them, the bench'sbench/pins.json(tag, digest, revision), and so the bench's configuration fingerprint (pins), which makes a new pilot necessary (requireConfirmed,bench/lib/budget.mjs).
The bench (ADR 0052's slice B1, amended) ​
- What changes in B1's plan (ADR 0052 decisions 9 and 10 otherwise stand):
- The glibc question is answered by the static coder (decision 11), not by a loader: adam's coder starts in every task image, so selection no longer drops a task for it, and
bench doctorchecks that the static binary starts. - Postgres leaves the bench. Each slot gets a store service (
store-N,adam-store-serverfrom the pinned coder image) with SQLite on a volume of its own, and the coder'sDATABASE_URLnames that service (decision 8);bench/postgres-init.sqlgoes. Until slices 3 and 4 are built, B1's first half keeps the bench's Postgres. - Both arms run as uid 10001: the coder container, OpenCode's container, and every command they run.
- Both arms get equal CPU and memory limits on the container in which the agent and its commands run, from one setting of the harness.
- A runtime marker joins the configuration fingerprint (
configFingerprint,bench/lib/budget.mjs): a fieldruntimethat names the stack's shape (the host's runtime, the store, the coder's linking, the uid, the limits), so a ledger of the Podman stack and one of this stack never confirm each other's pilot. - One shared
verifiernetwork for gradings, in place of the grader's own network: a grading container joins it and nothing else, and it reaches the internet only while a verifier needs it, asgrader-netdid.
- The glibc question is answered by the static coder (decision 11), not by a loader: adam's coder starts in every task image, so selection no longer drops a task for it, and
Sequence: a cloud step journals through the store service ​
The client's connection ​
Leases are the store's (claim_due, renew_lease), not the connection's: a store service that restarts loses nothing, and a worker whose renewals fail past its lease loses the run to another worker as it would on a database outage.
Shapes ​
Phone:
Cloud:
Bench (and desktop dev, with one slot):
Alternatives rejected ​
- gRPC (tonic, protobuf). A second RPC stack and a code generator beside CrateStack, which the owner uses for Rust services; CrateStack removed its gRPC transport (0.8.5, its ADR 0017), so it would not be CrateStack either.
- A CloudNativePG
Clusterper service (today'sstore-cnpg). A Postgres instance, its storage and its backups per agent; a database and a role per agent in one cluster isolate the data by role and cost one instance. - Keep
sqlxand the SQLite adapter in a workspace of its own (ADR 0047 as written). Two workspaces, two CI setups and two lockfiles; no binary could choose SQLite at run time; and the conflict comes back with eachlibsqlite3-systhatsqlx's ceiling has not reached (it was solved bysqlx0.9.1 the day before this record, and reopens at 0.41). - Run the glibc coder in older task images through its own loader (
ld-linux-x86-64.so.2 --library-pathwith trixie's libraries in the read-only volume). Every program the coder starts from that volume (adam-git,adam-kube-exec) must be started the same way,/proc/self/exenames the loader, and the trick breaks with any library the binary loads later. A static binary has no C library to bring. - SQLite in the coder's process for the bench and the desktop. The run's commands run beside the coder and could read or change the file.
- One store service for every agent of a namespace. It would hold every agent's credential; one per agent keeps a compromise to one database.
Consequences ​
- Rule 2. No
StoreorNotifiermethod changes. New adapters:adam-store-sqlite,adam-store-remote(aStoreand aNotifier), and the serveradam-store-server. Breaking for embedders:PgStore::from_poolandPgStore::pooltake and give adeadpool_postgres::Poolinstead of asqlx::PgPool, and so doesPgNotify::new;adam_store_postgres's errors no longer wrapsqlxerrors. another-agentic-system'sorch-agent-adampassessqlxpools today (orchestrator/crates/agent-adam/src/agents.rs) and changes with the bump of its adam pin; its agent-local build then holds both drivers. The crate READMEs say so. - Environment.
DATABASE_URLtakes four schemes (decision 3);postgresURLs keep every parameter they take today.docs/reference/environment.mdanderrors.mdchange in the slices. - MSRV. The crates that use CrateStack (
adam-store-remote,adam-store-server, and through themadam-serviceand the binaries) need Rust 1.98, CrateStack'srust-version. The workspace moves from 1.94 to 1.98 in slice 4, with the builder image ofdocker/coder/Dockerfileand the CI jobmsrv. - Two TLS providers in the binaries.
cratestack-client-rustenablesrustls'sringbeside the tree's aws-lc-rs; the binaries already name their provider (crates/adam-env-kubernetes), so nothing changes at run time, and ADR 0047's check keeps both out ofadam-engine. - A wire contract.
store.cstackis versioned; a client and a server of different protocol versions refuse each other at start. Client and server ship in one image, so a deployment moves them together. - Cost of a call. A step costs one round trip to the store service and one from it to the database instead of one; unverified how much that adds per step until slice 4 measures it, and the bench reports it.
- ADR 0047 decision 3 still holds except "a Cargo workspace of its own" and "built on cratestack": the adapter is plain
rusqlite, because theStore's statements (the claim's conditions, the partial unique index, keyset paging) are hand-written SQL that CrateStack's embedded facade does not generate (ADR 0047 left that unverified), and the facade would bring the schema macro and Rust 1.98 to the phone's path for nothing. The application's own state stays on CrateStack; adam's file stays adam's; the one rule is a sharedrusqliteminor. - The platform. AD-024 holds: the operator writes a
Database, aDatabaseRole, a Deployment, a Service and aNetworkPolicy, never a Secret. The shared Cluster'smanaged.rolesandpg_hbaare the deployment's (the co-ownership §59a calls unverified is avoided: the operator never writes the Cluster). - The bench loses its Postgres: each slot gets a store service with SQLite, on the coder image.
- Pages.
docs/architecture.md(the store), Store adapters,docs/reference/environment.md,docs/guides/deploy-the-coder.md, the crate READMEs, theadam-store-adapter,adam-embedandadam-coder-deployskills.
For the owner to confirm ​
| Id | Topic | Default | Alternative |
|---|---|---|---|
| Q1 | The remote scheme | store+http:// and store+https://, the token in a file the URL does not hold | the token as the URL's password |
| Q2 | One store service per agent | yes (decision 9) | one per namespace |
| Q3 | The database credential | the DatabaseRole's client certificate, written by CloudNativePG | a password Secret from an External Secrets generator |
| Q4 | The agent's credential for the service | its projected service-account token, checked against the issuer | a token the deployment writes |
| Q5 | MSRV | 1.98 for the whole workspace | 1.98 only for the crates that use CrateStack, behind features off in the MSRV job |
| Q6 | The musl allocator | mimalloc | musl's own, if the bench shows no difference |
| Q7 | arm64 | not now: the image is linux/amd64 (.github/workflows/coder.yml) | aarch64-unknown-linux-musl beside it |
Slices ​
Each is a pull request with its own proof.
| # | Slice | Repository | Proof | Depends on |
|---|---|---|---|---|
| 0 | This record; the notes on ADRs 0047, 0048 and 0052; docs/README.md; docs/roadmap.md | adam | docs-check | none |
| 1 | The static musl image: the build stage, the allocator, the smoke tests that every binary is static (file, ldd) and starts in a bookworm and an Alpine image | adam | coder.yml green; the binaries start in debian:bookworm-slim | none |
| 2 | adam-store-postgres and adam-notify-postgres on tokio-postgres; sqlx gone and a CI check that it stays gone; the URL parameters | adam | both conformance suites on Postgres; every URL form of the docs and the chart parses; cargo tree -i sqlx empty | none |
| 3 | adam-store-sqlite, and adam-service choosing the store from DATABASE_URL | adam | store_conformance!; a second process refused; a split role on sqlite:// is exit 78; the probe with cratestack-sqlite resolves | 2 |
| 4 | store.cstack, adam-store-remote and adam-store-server: coalescing, read-ahead, signals, the token check, the MSRV move | adam | store_conformance! and notifier_conformance! through a real server over memory, SQLite and Postgres; a replay of 200 steps in at most 5 calls; a call without a token refused | 3 for SQLite under it |
| 5 | The coder chart's store service (off by default: nothing renders), its NetworkPolicy and the projected token | adam | render-check; the parity goldens of the platform say so in the pull request | 4 |
| 6a | The bench on the host's runtime (ADR 0052's B1 with decision 12 here): Podman out, uid 10001, equal limits, the runtime marker, the verifier network; the bench's Postgres stays | adam | ADR 0052's proof; every container of both arms at uid 10001 with equal limits; a fingerprint test | none (the adam arm in a bookworm task needs 1) |
| 6b | The bench's store: a store service with SQLite per slot, Postgres out, the pin at a static coder | adam | the dry run passes with no Postgres container; bench doctor starts the coder in each selected task image | 1, 3, 4, 6a |
| 7 | The platform: Database, DatabaseRole, the store service's Deployment, Service and NetworkPolicy from store-cnpg | platform | tests on the fake API server; the kind job with CloudNativePG 1.30.2: an agent's step journals through its store service, and a run pod is refused | 4, 5 |