Pin RecordRewrite's clear arm at the renamed record (improvise-q2mq)

A blank edit on a measure a renamed drill row lacks must clear at the renamed
key. The phg1 sparse-row test covered only the write arm, so aiming the clear
at the unrenamed key left the workspace green. The reviewer's probe fails under
that rival and nothing else does.

Also corrects the phg1(c) evidence. The swap test cannot see the narrow rival
(eager clears, deferred writes). It does catch the wider one (eager clears and
writes).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-22 23:26:44 -07:00
parent 4e451199af
commit 7e1e8afba2
2 changed files with 41 additions and 3 deletions
+23 -3
View File
@@ -5501,12 +5501,32 @@ nothing else in the workspace fails.
### every_drill_row_reads_the_model_before_any_row_clears_it
improvise-phg1(c). `RecordRewrite::merged` puts every clear after every read.
The rival lets each row's clears land before the next row reads the model, and
the uo2p swap test does not see it: a row's own clears touch only its own old
keys, which no other row reads. What separates the two is a clear aimed at
The rival lets each row's clears land before the next row reads the model, but
defers every write to the end. The uo2p swap test cannot see **that** rival: a
row's clears aimed at its own old keys touch nothing another row reads. A wider
rival, where each row's clears *and* writes land before the next row reads, is
a different fault: the swap test does catch it (uo2p's rival 2, which fails
`a_drill_that_swaps_two_records_coordinates_swaps_them` alone). So this test
exists for the narrow rival only. What separates it is a clear aimed at
**another row's** key. A blank edit on a measure the row lacks clears that
measure at the row's *renamed* coordinates. So row 0 is renamed onto row 1's
coordinates and blanks `Profit`, which only row 1 has, and row 1 is renamed
away. Row 1's `Profit` must still arrive at `Food/Jan`. Under the rival it is
cleared before row 1 reads it, `Food/Jan/Profit = 5` is lost, and nothing else
in the workspace fails. This probe is the reviewer's, from the ticket.
### a_blank_edit_on_a_measure_a_renamed_row_lacks_clears_it_at_the_renamed_record
improvise-q2mq. `RecordRewrite::of`'s second loop handles the measures a row has
no cell for. Its **clear** arm must aim at the *renamed* key, exactly as its
write arm must (improvise-phg1(b)). The phg1 sparse-row test stages a value, so
it covers only the write arm. Aiming the clear arm alone at
`row.cell_key(measure)`, unrenamed, left the whole workspace green.
The probe is the reviewer's. Row 0 (`Food/Jan`, `Revenue = 1`) is renamed onto
`Clothing`, where row 1 already holds `Profit = 5`, and blanks `Profit`, which
row 0 lacks. The blank belongs to row 0's final record at `Clothing/Jan`, so the
store is exactly `{Clothing/Jan/Revenue = 1}`. Under the rival the clear lands
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.
+18
View File
@@ -3300,6 +3300,24 @@ mod tests {
);
}
#[test]
fn a_blank_edit_on_a_measure_a_renamed_row_lacks_clears_it_at_the_renamed_record() {
assert_drill_over(
&[
(drill_cell("Food", "Jan", "Revenue"), CellValue::Number(1.0)),
(
drill_cell("Clothing", "Jan", "Profit"),
CellValue::Number(5.0),
),
],
&[
(0, category("Type"), "Clothing"),
(0, measure("Profit"), ""),
],
&["Clothing/Jan/Revenue = 1"],
);
}
#[test]
fn a_drill_row_renamed_twice_and_edited_lands_as_one_record() {
assert_drill_commits_to(