Skip to content

Adds a reader of inherited metadata keys - #307

Merged
johnnyt merged 1 commit into
mainfrom
sp-ppt6-inherited-metadata-reader
Nov 23, 2026
Merged

johnnyt merged 1 commit into
mainfrom
sp-ppt6-inherited-metadata-reader

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 23, 2026

Copy link
Copy Markdown
Member

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 through Storage.fetch_execution/2 and nothing else: no linkage walk, no lock. For a root it answers the root's own keys. Naming Linkage.reserved_key/0 raises ArgumentError before anything is read.
  • The Executions moduledoc's reentrant-step paragraph names the reader beside active_children/2 as a door that writes nothing and is not refused.
  • StatifierPersistence.Execution gains no field, and no existing function's answer changes.
  • One Added fragment, 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 under inherited_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-list keys raises FunctionClauseError, as the sibling readers do).

Gate: full mix quality green on the committed tree.

Refs: sp-ppt6

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
@johnnyt
johnnyt merged commit 745c991 into main Nov 23, 2026
1 check passed
@johnnyt
johnnyt deleted the sp-ppt6-inherited-metadata-reader branch November 23, 2026 21: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