fix(controlplane): refresh a stale seeded resource and re-seed a removed one

A seed was consulted only for a resource kind the store did not hold, so a
document that changed in the build never reached a database an earlier
release had seeded. For workflow-definitions that is not a stale setting but
a total outage: the collection validates as one document, so a stored step
type this build no longer has fails every task's pin, whatever workflow the
task names. The seed's request ID was stable per kind and the store answers a
known request ID from resource_history, which outlives the resource, so the
documented recovery -- remove the resource and restart -- wrote nothing
either.

Seeds now carry one identity the reader can name, and a kind the store holds
is refreshed only when the seed itself wrote the newest revision: a
file-derived value stays the store's, and an operator's replacement is never
undone. The request ID is derived from the value, so an idempotent replay is
still one revision without making a second, changed document impossible. A
replay whose resource is gone re-creates it from the ledger's revision.

The shipped-vs-file-derived distinction is the seed's to make, so it is a
property of the definition (Defaults is set exactly for the kinds that ship a
document) rather than a check at each consumer.
This commit is contained in:
sam committed 2026-09-29 14:27:57 +10:00
1 parent 9bb3340dce
commit 64a4210b1f
10 files changed
+651 -41

No files matched your search

+6 -1
View File
@@ -17,7 +17,12 @@ that reads it and the path the value takes to get there.
channels, containers). The file only seeds it. Once the State Store holds the
control-plane resource, the stored document is layered over the file
(`controlplane.Client.RuntimeConfig`) and the file key stops mattering. It is
checked by `validateDatabaseOwned` and by the resource's validator.
checked by `validateDatabaseOwned` and by the resource's validator. A stored
value is refreshed from the file only when the store has no value for the kind
at all; a kind that ships a document of its own (workflow definitions,
personas) is refreshed whenever the seed itself wrote the stored copy, since
that copy is a previous release's document rather than an operator's
(`controlplane.Server.seedKind`).
- **Worker-carried.** A value the agent container needs travels in
`config.TaskConfig` (`Config.ForTask`) or on `taskrun.Request`. Never pass it
as an environment variable the daemon did not already define, and never carry