Concrete
Rulescontract

concrete/contract/row-fill

A list fill plans only unbound fields its object item declares, each of a kind an item field can be filled with.

A list fill plans only unbound fields its object item declares, each of a kind an item field can be filled with.

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

The fields of a list's object item are filled inside the list's one batched call, one planner per field, and the fill spec restates nothing the item already declares. So almost every rule here is a cross-reference between the two declarations: a planned field must be one the item declares, its own type must be one an item planner fills — text, a date, an email, a phone, a url, a select key, an asset, or a list of those — and it must not be source-bound: a member of its row bakes that field, so a fill over it is a second author for one value. A row field is filled by a pick of an element, which contract/fill-verb grades instead.

A section built by a Concrete older than 9.0 declared the record as the list's own fields, which the model wrote top to bottom: there, a field's fill also reads only the fields declared before it, since a later field has no value yet. An object item's fields are filled in the order their reads impose, which contract/reads-acyclic grades.

Type-caught, and refused a second time before the contract venue runs. A slot has one source:, so a fill beside a binding cannot be written; the planned field set is the item's own field map, so a name the item does not declare cannot be filled; and the build rejects a field of a type no item planner fills — a number — while it extracts the fill spec, at the stage before this one. What reaches this rule is a fill spec assembled outside the builders — publishing re-runs the venue over the artifact.

Fix

Drop the fill from the bound field, or drop the binding. A field is baked from a row's member or written by a fill, never both; list is where the item's fields, its bounds and that axis are declared, once.

Before and after

// A slot has one `source:`, so this half does not compile.
// @noErrors
import { fact, fill, list, number, object, row, text } from "@homepages/concrete";

list({
  label: "Units",
  source: fact.property.units,
  item: (el) => {
    const unit = row({ label: "Unit", from: fact.property.units, source: el });
    return object({
      fields: {
        unit,
        unit_label: text.medium({
          label: "Unit name",
          cap: 40,
          source: unit.label,
          source: fill.write({ reads: [fact.property.description], brief: "The unit's own label, bare." }),
        }),
        beds: number({ label: "Beds", source: unit.beds }),
      },
    });
  },
});
import { fact, list, number, object, row, text } from "@homepages/concrete";

list({
  label: "Units",
  source: fact.property.units,
  item: (el) => {
    const unit = row({ label: "Unit", from: fact.property.units, source: el });
    return object({
      fields: {
        unit,
        unit_label: text.medium({ label: "Unit name", source: unit.label }),
        beds: number({ label: "Beds", source: unit.beds }),
      },
    });
  },
});

On this page