Skip to content
LITHOEN

Evidence platform and governance

Document

ADR-0040: The material chain as typed entities and records, with no new infrastructure

Repository path
docs/decisions/ADR-0040-material-chain-typed-records.md
Size · SHA-256
2.4 KB · 9d03011e9dae7bc490ed527f8e97780e09d9ae27bb57a42f2fce399ded6cdcb1

Date: 2026-09-09 · Status: accepted

Context

Phase 27 extends Lithoen past the ground: materials, process routes, facilities, specifications, applications, and documented process limitations. The obvious temptations were a graph database for the chain, Postgres for the richer relational model, and Python for process calculations.

Decision

Four new entity types — Material, ProcessFacility, IndustrialApplication, MaterialSpecification — added to the existing discriminated union rather than to a parallel taxonomy, so they inherit every publication, projection and reachability gate already built.

One new public record type, ProcessRoute, kept out of the entity union on purpose: a route is not an object in the world but a described sequence, true of a feed at a date according to a document. Making it an entity would invite exactly the reading the record type exists to prevent.

One internal record type, BottleneckAssessment, INTERNAL by construction with no public projection.

Four authorable relation types with derived inverses — PRODUCED_FROM, USED_IN, SPECIFIED_BY, RECOVERED_AT — with domains that make the errors unrepresentable rather than merely discouraged. USED_IN has domain Material, so an edge from an element to an application cannot be written at all.

No database, no graph database, no Python. The corpus is 442 entities and 860 relations, the chain is shallow, and queries are file scans over a few hundred records. Adoption needs a measured trigger in corpus size, query complexity, mutation frequency, spatial joins or multi-user workflows. "The model got richer" is not one. This extends ADR-0001, ADR-0005 and ADR-0008 rather than revisiting them.

No reaction engine. Process steps do not need stoichiometric graphs to record what a source said happened.

Consequences

The chain is queryable with the tools already in the repository, and every new object passes through the validators built in Phases 0–26 rather than around them.

The cost is that a route's internal consistency is checked by a bespoke gate rather than by a database's referential integrity — steps joining up, denominators present, scale not outrunning status. That gate is scripts/check-material-chain.ts, and every rule in it has a mutation test, because a rule nobody has watched fail is a rule nobody has tested.