Repository navigation
Records inherited host metadata on durable children - #305
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Driver.new/3takesinherited_metadata_keys:, a list of string keys, default[]. It is driver-level only, joiningdispatch:as an option not overridden per call. A non-list, a non-string key or the package's reserved key raisesArgumentErroratDriver.new/3, and a per-callinherited_metadata_keys:raisesArgumentErroratDriver.create/3,Driver.send_event/4,Driver.done_invocation/5andDriver.failed_invocation/5.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, themetadata: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.Driver.parent_link/2.cascade_cancel/3match on copied keys, now reach the children created under the option as well as the root; a linkage match is unchanged.Executions.inherited_metadata/3, a new read-only function over the stored record;StatifierPersistence.Executiongains no field, soExecutions.active_children/2answers 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 withArgumentError, since todayexecution_opts/3passes keys the driver does not take on toExecutions. The cascade consequence is named beside the listing one: acascade_cancel/3match on copied keys reaches the children directly, a further visit counts as retained, the listing documents no order, andcascade_cancel_where/4and every match the driver passes are linkage matches and unchanged. The sentence on a create's ownmetadata:is qualified to an insert that succeeds (its failure-path detail is withdrawn by cure 3 below). Zero removed lines underdocs/adr/againstmain.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 underdocs/adr/againstmain.Provenance
inherited_metadata_keys:and the reader onStatifierPersistence.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.persist_tail/8showed 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 ownmetadata:).Driver.start_child_at/6already reads the parent's record (start_context/3); the Amendment says the copy uses that read.ArgumentErroratDriver.new/3, are this PR's choices, following the postureExecutions.create/4takes toward a host's reserved key.Direction check (in-turn)
Every cite to existing code was read on
mainatb0defbband verified there by anchor:Driver.new/3and its docstring (the per-call override sentence and thefunction_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/2and its:no_parentanswer;Executions.create/4(its documentation that a step and a fail carry the map forward), the privatemetadata/1reserved-key raise,persist_tail/8(effects before the insert),Executions.cascade_cancel/3andcascade_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?/1on 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 thechangelog.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