Skip to content

Records inherited host metadata on durable children - #305

Merged
johnnyt merged 4 commits into
mainfrom
sp-ezfr-inherited-metadata-amendment
Nov 23, 2026
Merged

johnnyt merged 4 commits into
mainfrom
sp-ezfr-inherited-metadata-amendment

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Adds an Amendment to ADR-0008, at proposed, with no code: a durable child carries the host metadata keys the host names as inherited. Ruled by the operator, 2026-11-23: a host's scope is stored as host metadata on its execution, and a durable child copies the metadata keys the host names as inherited; the package names no host, no product and no key of its own, and ADR-0006's identities-only rule stays as it is. The engineering shape was decided by the conductor under a standing consent, 2026-11-23.

What the Amendment decides:

  • The option. Driver.new/3 takes inherited_metadata_keys:, a list of string keys, default []. It is driver-level only, joining dispatch: as an option not overridden per call. A non-list, a non-string key or the package's reserved key raises ArgumentError at Driver.new/3, and a per-call inherited_metadata_keys: raises ArgumentError at Driver.create/3, Driver.send_event/4, Driver.done_invocation/5 and Driver.failed_invocation/5.
  • The copy. At a child's create, each named key the parent holds is given to the child as its metadata:, beside the package-owned linkage; a missing key writes nothing. The source is the parent's stored record, or, for a child started from the parent's initial configuration, the metadata: the parent's own create was given, because that create runs its effects before it inserts the record; that map is stored only when the insert succeeds, and what becomes of such a child when the insert fails or is refused is left to a later record. With no keys named, no copy and no read happen.
  • ADR-0006 unchanged. The copy adds no value of the package's, so the identities-only rule binds a copied key as it binds the original.
  • Backends without metadata. No parent there can hold a host key, so a child is created as today; naming keys there is not an error.
  • Adoption and loop passes. An adopted child is not written to; a later pass's child copies at its own create. A child created before this change carries nothing, and the host falls back to the root through Driver.parent_link/2.
  • What a host sees. A listing by a copied key, and a cascade_cancel/3 match on copied keys, now reach the children created under the option as well as the root; a linkage match is unchanged.
  • The reader. Executions.inherited_metadata/3, a new read-only function over the stored record; StatifierPersistence.Execution gains no field, so Executions.active_children/2 answers as it does today.

It does not decide how a fan-out re-entered by a loop names its children per pass.

Cure 1

Ruled by the operator, 2026-11-23: the three advisories of the first review are cured in one commit, inside the Amendment's own text. A per-call inherited_metadata_keys: is refused with ArgumentError, since today execution_opts/3 passes keys the driver does not take on to Executions. The cascade consequence is named beside the listing one: a cascade_cancel/3 match on copied keys reaches the children directly, a further visit counts as retained, the listing documents no order, and cascade_cancel_where/4 and every match the driver passes are linkage matches and unchanged. The sentence on a create's own metadata: is qualified to an insert that succeeds (its failure-path detail is withdrawn by cure 3 below). Zero removed lines under docs/adr/ against main.

Cure 2

After the second review, cure 2 scoped the failure-path detail that cure 1 had added; a third review found that scoping still overbroad, and cure 3 withdraws it.

Cure 3

After the third review, the failure-path detail is withdrawn to a later record: the sentences on what a failed or refused parent insert leaves of a child created inside the parent's create are replaced by one statement. The copy is taken from the metadata: the parent's create was given, which is the map the insert stores when that insert succeeds; what becomes of a child created inside a parent's create whose insert then fails or is refused is not decided by this Amendment and depends on the adapter. Cure 1's per-call refusal and cascade consequence are unchanged. Zero removed lines under docs/adr/ against main.

Provenance

  • The brief recommended the option name inherited_metadata_keys: and the reader on StatifierPersistence.Executions; both are taken. The reader's name, inherited_metadata/3, and its argument list (a store, an execution id, the keys) are this PR's choice.
  • The brief said the copy reads the parent's stored record. Reading persist_tail/8 showed a create executes its effects before it inserts the record, so a child started from the parent's initial configuration finds no parent record; the Amendment names that case and its source (the create's own metadata:).
  • A fan-out child started through Driver.start_child_at/6 already reads the parent's record (start_context/3); the Amendment says the copy uses that read.
  • Not overridable per call, and the reserved-key and malformed-list refusal by ArgumentError at Driver.new/3, are this PR's choices, following the posture Executions.create/4 takes toward a host's reserved key.

Direction check (in-turn)

Every cite to existing code was read on main at b0defbb and verified there by anchor: Driver.new/3 and its docstring (the per-call override sentence and the function_providers: sentence), Driver.create/3, create_linked/5, first_child/2, adopt_later/2, adopt_child/3, start_context/3, Driver.start_child_at/6, Driver.parent_link/2 and its :no_parent answer; Executions.create/4 (its documentation that a step and a fail carry the map forward), the private metadata/1 reserved-key raise, persist_tail/8 (effects before the insert), Executions.cascade_cancel/3 and cascade_cancel_where/4, execution_opts/3, Driver.send_event/4, Driver.done_invocation/5, Driver.failed_invocation/5, Executions.active_children/2; Storage.fetch_execution/2, Storage.update_execution/5's write-once sentence, check_metadata_supported/2, Storage.list_executions_by_metadata/2; supports_metadata?/1 on the Ecto adapter (Postgres only) and on the in-memory adapter (true); Linkage.reserved_key/0; StatifierPersistence.Execution's fields; ADR-0006 decision 2 and its Consequences. The option and the reader do not exist yet and are cited by name alone. git diff origin/main -- docs/adr/ shows zero removed lines; the Amendment is appended at the file's foot in the shape of the 2026-11-22 Amendment (heading with date and bead, a "Status of this amendment" line, no rule before it). The text is ASCII with plain hyphens, as the file is.

Gate

Docs only: the diff touches docs/adr/ alone, outside the manifest's build paths, so the repo's rule "a change touching no Elixir code has no gate to run" applies and no gate ran; CI runs on the request. No changelog fragment: ADRs are on the changelog.d/README.md "do not" side.

Firewall: the diff, the commit message and this body were scanned again for the cure against the hard pattern with a positive control that fired, and the planning-id scan ran clean on the diff and on this body.

Refs: sp-ezfr

Adds an Amendment to ADR-0008, at proposed. A host names, once, on the
driver, the metadata keys a durable child inherits: a new
inherited_metadata_keys: option on Driver.new/3, default none. At a
child's create each named key the parent holds is copied beside the
package-owned linkage, read from the parent's stored record, or from
the parent's own create metadata when the child starts from the
parent's initial configuration. A missing key copies nothing, an
adopted child keeps what it was created with, and a child created
before this change carries nothing, so a host falls back to the root
through Driver.parent_link/2. ADR-0006's identities-only rule is
unchanged. The record names the reader, Executions.inherited_metadata/3,
and leaves the Execution struct as it is.

Docs only: the diff touches no path in the manifest's build_paths, so
the quality gate does not apply (CLAUDE.md authority table). No
changelog fragment: ADRs are on the changelog.d/README.md "do not"
side.

Refs: sp-ezfr
Cure 1 on the ADR-0008 Amendment, ruled by the operator, 2026-11-23.
Three changes, all inside the Amendment's own text:

- A per-call inherited_metadata_keys: is refused with ArgumentError
  on the four driver doors that take opts, since today the driver
  passes keys it does not take on to Executions.
- The cascade consequence is named beside the listing one: a
  cascade_cancel/3 match on copied keys reaches the children
  directly, each extra visit counting as retained, in no documented
  order; a linkage match is unchanged.
- The sentence on a create's own metadata is qualified to the insert
  that succeeds, with what a failed parent insert leaves on each kind
  of store.

Docs only: no Elixir code changes, so the quality gate does not apply
(CLAUDE.md authority table).

Refs: sp-ezfr
Cure 2 on the ADR-0008 Amendment, after the scope-frozen second
review. On Postgres under AdapterLock, only an insert whose statement
runs and fails (the unique index's execution_exists) aborts the
transaction the child's insert ran in. A refusal the Ecto adapter
answers before any statement (metadata_unsupported for a value it
cannot store) aborts nothing, since a create's failed insert asks for
no roll-back, so the child commits as on a store where the two commit
apart. Nothing else in the record changes.

Docs only: no Elixir code changes, so the quality gate does not apply
(CLAUDE.md authority table).

Refs: sp-ezfr
Cure 3 on the ADR-0008 Amendment, after the third review. The
sentences on what a failed or refused parent insert leaves of a child
created inside the parent's create are replaced by one statement: the
copy is taken from the metadata the parent's create was given, the
map its insert stores when that insert succeeds, and what becomes of
such a child when the insert fails or is refused is not decided here
and depends on the adapter. That case is left to a later record. The
per-call refusal and the cascade consequence are unchanged.

Docs only: no Elixir code changes, so the quality gate does not apply
(CLAUDE.md authority table).

Refs: sp-ezfr
@johnnyt
johnnyt merged commit 4d29d4f into main Nov 23, 2026
1 check passed
@johnnyt
johnnyt deleted the sp-ezfr-inherited-metadata-amendment branch November 23, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant