Repository navigation
Adds a reader of inherited metadata keys - #307
Merged
Merged
Conversation
Implements point 6 of the ADR-0008 Amendment of 2026-11-23.
Executions.inherited_metadata/3 answers {:ok, map} holding each named
host metadata key an execution's stored record holds, with its value,
and the read's error when the record cannot be read. It reads that one
record and nothing else: no linkage walk, no lock. For a root it answers
the root's own keys. Naming the reserved linkage key raises
ArgumentError before anything is read. Execution gains no field.
The moduledoc's reentrant-step paragraph now names the reader beside
active_children/2 as a door that is not refused.
Tests run on the in-memory adapter and on Postgres, a driver-created
tree on both, and SQLite with the linkage columns option on. Doctests
added. Full mix quality green.
Refs: sp-ppt6
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 point 6 of the 2026-11-23 Amendment on ADR-0008 (
docs/adr/0008-durable-subchart-child-runs.md, "Amendment (2026-11-23, sp-ezfr)"): a host reads the host metadata keys an execution carries without walking the linkage itself.What changes
StatifierPersistence.Executions.inherited_metadata/3(new): for an execution id and a list of keys it answers{:ok, map}holding each named key the stored record holds, with its value, and the read's error when the record cannot be read ({:error, :execution_not_found}for an id that is not stored). It reads that one record throughStorage.fetch_execution/2and nothing else: no linkage walk, no lock. For a root it answers the root's own keys. NamingLinkage.reserved_key/0raisesArgumentErrorbefore anything is read.Executionsmoduledoc's reentrant-step paragraph names the reader besideactive_children/2as a door that writes nothing and is not refused.StatifierPersistence.Executiongains no field, and no existing function's answer changes.changelog.d/sp-ppt6.md.The function's arguments follow the module's reader convention (
active_children/2,inputs/2: the store first, then the execution id), with the keys third, as the Amendment names them.Tests
executions_inherited_metadata_test.exs, parameterized over the in-memory adapter and the Ecto adapter on Postgres: a root's named keys, a child that answers its own record and never its parent's, an id that is not stored, and the reserved-key refusal for a stored and an unstored id; plus the doctest.driver_inherited_metadata_test.exs: a tree a driver created underinherited_metadata_keys:read back at the root, the child and the grandchild, on both stores.ecto/sqlite_migrations_test.exs: off Postgres with the linkage columns option on, the parent and its child answer an empty map (the Amendment's point 4).Every new test carries its sabotage note; each mutation was run, turned its test red on an assertion, and was reverted from a copy.
Review
In-turn review round (diff critic and test critic) before opening. Accepted and fixed: two assertions matched
{:ok, %{}}as a pattern, which any map satisfies; they now compare with==, and the child test checks the child that copied nothing first. Not taken: tests for the function-clause guards (a non-listkeysraisesFunctionClauseError, as the sibling readers do).Gate: full
mix qualitygreen on the committed tree.Refs: sp-ppt6