Repository navigation
Copies a parent's named metadata to a durable child - #306
Merged
Merged
Conversation
Implements the ADR-0008 Amendment of 2026-11-23, points 1, 2, 4 and 5. Driver.new/3 takes inherited_metadata_keys:, a list of host metadata keys, default []. At every durable child's create (a single child on any pass, each fan-out child) the child is given each named key its parent's host metadata holds, beside its linkage. The parent's map is the create's metadata: for a child started during the parent's own create, the stored record on a step, and the record start_child_at/6 already read for a fan-out. An adopted child is not written to. With [] no copy and no read is made, and no metadata: is passed, so a child is created as on 0.27.0. new/3 raises on a list that is not strings or names the reserved key; create/3, send_event/4, done_invocation/5 and failed_invocation/5 raise on a per-call list. The Ecto adapter's moduledoc now says what an opted-in host's metadata-held linkage gets: the re-pin reads it, the listings, the pin count and the retirement guard do not; a SQLite test pins it. Tests run on the in-memory adapter and on Postgres. Full mix quality green. Refs: sp-3iui, sp-rokq
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.
Implements the ADR-0008 Amendment of 2026-11-23 (on main, at proposed), points 1, 2, 4 and 5 and its "What a host sees". Point 6, the reader, is a later change and is not here.
What changes
Driver.new/3takesinherited_metadata_keys:, a list of host metadata keys, default[](new/3's docstring).new/3raisesArgumentErroron a value that is not a list of strings, or that namesLinkage.reserved_key/0(inherited_metadata_keys!/1).inherited_metadata_keys:raisesArgumentErroroncreate/3,send_event/4,done_invocation/5andfailed_invocation/5, before any read or write (refuse_per_call_inheritance!/1).metadata:each named key its parent's host metadata holds, with the parent's value; a named key the parent does not hold is not written (create_linked/5,take_inherited/2). The parent's map is themetadata:its own create was given for a child started during that create, its stored record on a step (one:fetch_executionof the parent), and the recordstart_child_at/6already reads for a fan-out (start_context/3) (inherited_metadata/3).[], no read is made and nometadata:is passed to the child's create, so a child is created as on 0.27.0 (inherited_metadata/3's first clause,inherited_opt/2).write_tree_migration/2re-pins it inmetadata, while the two listings, thechildrenpin count and the retirement guard read the V09 columns alone, so such a child is not listed, not counted and does not block a retirement.changelog.d/sp-3iui.md.docs/telemetry.mdnames the private emitter at its new arity.No migration version, no adapter callback, no schema and no stored value changes; no dependency is added.
Where it is proved
test/statifier_persistence/driver_inherited_metadata_test.exs: every child case runs on the in-memory adapter and on the Ecto adapter on Postgres (named in each test). A parent holding a named and an unnamed key gives the child the named key only; a missing key is not written; without the option the child's metadata is its linkage alone; a loop's later pass copies from the stored parent and its re-drive adopts the child with the keys kept; a grandchild copies; each fan-out child copies; a step's child reads the parent once more only when keys are named; and the option's refusals.test/statifier_persistence/ecto/sqlite_migrations_test.exs: a linkage written with the linkage-columns option off and read with it on is re-pinned but not listed or counted.Each new test carries its sabotage note. The required one: copying every host key in
take_inherited/2turns the named-key test red on both stores.Held from this pull request
The fan-out re-entered by a loop (sp-1my6) is not in this pull request. A fan-out child's start is at-least-once, and on 0.27.0 a start delivered again after its child ended adopts that child. Naming a later pass's fan-out children the way single children are named (an ended child at the first id is an earlier pass's) would instead start a second child for that delivery, which changes what an existing call does for a host that never loops. The token of the pass that created a first-pass child is not stored, so no rule tells the two apart from what is stored today. That choice is held for a ruling and is not decided here.
Provenance
metadataas the re-pin does: the cheaper true answer, and it changes no existing answer. Decided by the conductor under a standing consent, 2026-11-23.Gate
Full
mix qualitygreen on this branch's head: format, compile with warnings as errors, credo, docs, dialyzer and the whole suite, Postgres and SQLite included.