Merge pull request #217 from fiddlerwoaroof/collapse-fu/ciw8

improvise-ciw8: a wire write reaches only a cell the host projects as a Record
This commit is contained in:
Ed Langley
2026-09-23 08:34:49 -07:00
committed by GitHub
5 changed files with 422 additions and 13 deletions
+63
View File
@@ -5793,6 +5793,69 @@ on `Food/Jan/Profit`, where there is nothing to clear, and
`Clothing/Jan/Profit = 5` survives. Injected alone into a full workspace run,
the rival fails this test and nothing else.
### a_wire_write_to_a_collapsed_fold_is_rejected_and_stores_nothing
improvise-ciw8, through a real `Host` frame. Q2 is collapsed, and a hand-rolled
client sends `SetCell` (then, separately, `ClearCell`) for `{Month=Q2, _Measure=Cost}`
with a caught-up basis. At `ea119bd9` both were answered `Accepted`, and the
`SetCell` stored `Month=Q2, _Measure=Cost = 7`, the non-item coordinate
improvise-gw18 exists to prevent. The test asserts `Rejected(MutationRefused)`
and an unchanged document for both. Rival: the aggregate refusal disabled. This
test and the None-axis test fail. The control is
`a_wire_write_to_a_stored_cell_beside_a_fold_is_accepted`, so a host that refused
every wire write cannot pass.
### a_wire_write_under_a_formula_is_rejected_and_stores_nothing
improvise-ciw8's `Derived` arm: `SetCell` on Feb × Profit, where
`Profit = Revenue - Cost`. At `ea119bd9` it was accepted and stored a value under
the formula. Rival: the formula refusal disabled. Only this test fails.
### a_wire_write_to_a_none_axis_aggregate_is_rejected_and_stores_nothing
improvise-ciw8's other `Aggregate`. With `Product` on `Axis::None`, the grid's
key `{Region=South, _Measure=Revenue}` is a partial key that no stored record
has, so it resolves only through the layout, where `cell_id` says `Aggregate`.
At `ea119bd9` it was accepted and stored the partial key. It fails under the
same rival as the fold test.
### a_wire_write_to_a_record_that_never_existed_is_rejected
The evidence for keeping `model_effects`' `vec![]` arm rather than turning it
into a refusal (`context/code/command.md`, "A wire write reaches only a cell the
host projects as a Record"). A lone write naming a record that never existed is
answered `RecordGone` before anything runs, both when a caught-up basis claims
it and when a hand-rolled basis omits it. The second half was expected to be
`ChainBroken`, and the test said otherwise: the create exemption covers only
commands after the first in a frame. That surprise is why it is asserted rather
than argued.
### an_empty_cell_beside_a_collapsed_measure_group_is_writable
improvise-sjdb, a regression PR #217 introduced and its review found. `_Measure`
is on Column with Revenue and Cost in a collapsed group `Money` and `Units`
ungrouped, and the Feb row is empty. The host projects Feb × Units as a
`Record`. A caught-up `SetCell` on it was answered `Rejected(MutationRefused)`
at `bc060f67`. It was accepted before #217. `aggregate_refusal` found the
unstored record by `RecordHash` alone, which drops `_Measure`, so it judged the
record at the first column on Feb's row, the `Money` fold, which `cell_id` calls
`Aggregate`. The setup asserts that the fold comes before `Units` on the row and
that the target projects as `Record`, so a fixture where the first column is
harmless cannot pass. The fix looks the cell up by its whole key. The rival is
the old lookup by record, which is this test's red commit, `6e021699`.
### a_stored_record_the_hosts_view_aggregates_is_writable
improvise-sjdb, from the #217 review. South/Revenue is stored, then `Product` is
added on `Axis::None` in the host's view, so the host projects South's position
as `Aggregate`. A stored record is a record wherever it is drawn, because
`RecordHash` is document-scoped (gotcha 44). A records-mode client, or one on
another view, may write it. The setup asserts the host really does project
`Aggregate` there, so the test cannot pass on a view that draws South plainly.
Rival: stored records sent through `cell_id` like unstored ones. That rival
fails this test and nothing else in `improvise-command`. Before this test,
nothing in the suite saw it.
### a_fresh_sessions_slice_is_the_hosts_startup_slice
improvise-v8ab. A fresh session's slice is built twice: `App::with_storage`