Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/36122-seeds-rollup-never-stored.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/skills': patch
---

docs(skills): the data skill's seeds reference says a seeded roll-up value is never stored, not stored as written

Clause-②: no
Metadata-protocol: none

objectstack-data's `references/seeds.md` kept the rule "never seed the roll-up" but gave a reason that stopped being true: it said a seeded `amount_paid` is stored as written and a cap on payments then refuses the payments it counts. The seed loader takes a value written for a `summary` field out of the record before the write, logs one warning per dataset naming the fields, and the child rows compute the roll-up. The sentence now says that. The record-order point stays: a rule reading a parent roll-up sees the total earlier rows left. The matching eval case in `evals/hooks-security-seeds-datasources.json` expects the same model. Text only; the sentence pays for its new wording in its own bytes.
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
{
"id": 32,
"prompt": "`payment` has a validation rule that refuses a payment above the invoice's open balance (`record.amount > record.invoice.amount - record.invoice.amount_paid`); `invoice.amount_paid` is a `sum` roll-up of its payments. Seed demo data: invoice `INV-1` for 4800, fully paid in two payments, and `INV-2` for 5000 with 2000 paid.",
"expected_output": "Two `defineSeed` sets. The invoice rows carry `number` and `amount` and no roll-up value: a seed write stores a supplied `amount_paid` as written, the rule then reads a balance already spent, and both payments on the fully paid `INV-1` are refused (the 2000 on `INV-2` still fits its 3000 open balance). The payments name their invoice by natural key (`invoice: 'INV-1'`) and each fits what the rows before it left: two that sum to 4800 on `INV-1`, one of 2000 on `INV-2`; the roll-up then computes the paid totals. Does not say seed rows skip validation rules (only `state_machine` is skipped) and does not weaken the rule to make the seed load; `os verify` fails on a dropped seed row.",
"expected_output": "Two `defineSeed` sets. The invoice rows carry `number` and `amount` and no roll-up value: the seed loader never stores a supplied `amount_paid` (it leaves the value out of the write and logs one warning per dataset naming the fields), so the rows state nothing the payments do not compute. The payments name their invoice by natural key (`invoice: 'INV-1'`) and each fits what the rows before it left: two that sum to 4800 on `INV-1`, one of 2000 on `INV-2`; the roll-up then computes the paid totals. Does not say a seeded `amount_paid` is stored or makes the rule refuse the payments. Does not say seed rows skip validation rules (only `state_machine` is skipped) and does not weaken the rule to make the seed load; `os verify` fails on a dropped seed row.",
"files": [],
"assertions": {
"must_contain": [
Expand Down
2 changes: 1 addition & 1 deletion skills/objectstack-data/references/seeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ refused row never lands. `os validate` does not run them on seed rows;
`os verify` fails on each dropped row. A rule reading a parent roll-up
(`record.invoice.amount_paid`) sees the total earlier rows left, so children
must fit in record order. ⛔ Never seed the roll-up: a seeded `amount_paid` is
stored as written, and a cap on payments refuses those it counts.
never stored (a warning per dataset); the child rows compute it.

### Dynamic values (CEL)

Expand Down
Loading