concrete/contract/row-source
A row names its table in `from`; its source is a row slot it mirrors, a compute, the element inside an item, or a pick, and is never a table or a list.
A row names its table in from; its source is a row slot it mirrors, a compute, the element inside an item, or a pick, and is never a table or a list.
Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
A row holds one row of a table, and its from names the table: the row's type — its
members are that table's — and the set it is picked from. With no source it holds the
table's first row. Its source is only an origin, and must yield a row of from:
another row it mirrors, a compute() returning one row or nothing, a fill.pick out
of from, or — inside a list's item — the element itself. A table is never a row's
source: it is its from. Nor is a list: a list is read whole, so the row at its head
is a compute() over the list. Only a pick fills a row: a row holds a row that exists,
and a write would invent one.
from may name several tables in order —
from: [fact.property.units, fact.property.comparables] — and the row is a row of any
of them, picked from their union. Each table is named once, and the row reads only
the members every one of them carries, at one kind.
The element exists only inside an item, so a row declared from it anywhere else holds nothing.
Type-caught: a row takes a from that is a table, and its source only these origins.
Check-caught for a schema assembled outside the builders, which
publishing re-runs the contract venue over.
Fix
Name the row's table in from — or its tables, each once. Source the row from a row slot it mirrors, a compute,
or the element inside an item, or fill it with fill.pick — or give it no source and
it holds the table's first row. For a list's first row, compute it over the list:
source: compute({ reads: [agents] }, (rows) => rows?.[0] ?? null).
Before and after
// A row filled by a write: the row's types refuse it, as the rule does.
// @noErrors
import { fact, fill, row } from "@homepages/concrete";
row({ label: "Agent", from: fact.property.contacts, source: fill.write({ brief: "The listing agent." }) });import { fact, fill, row } from "@homepages/concrete";
row({ label: "Agent", from: fact.property.contacts, source: fill.pick({ brief: "The listing agent." }) });