Merge pull request #214 from fiddlerwoaroof/wave/km71-edit-formula

improvise-km71: edit a formula from the formula panel, in place
This commit is contained in:
Ed Langley
2026-09-23 09:00:07 -07:00
committed by GitHub
31 changed files with 1114 additions and 134 deletions
+50
View File
@@ -5655,6 +5655,46 @@ across two independently built ones. If a future refactor made the fixture
share one map, or share one `RandomState`, the second assertion fails. Without
this test the law would then pass everything and look healthy.
### changing_the_target_renames_the_formula_in_its_own_place
improvise-km71. This is the test that separates "edit" from "add". The rival
was the first build: `commit-buffer formula` was resolved in `parse_commit_kind`,
where the registry's parse-first rule never reaches the mode, so every edit
became an `AddFormula`. `committing_an_edit_replaces_the_formula_in_place`
**passed** under that rival, because `add_formula` upserts by
`(target, target_category)` and an edit that keeps its target lands in the same
slot. Injected on purpose (the commit emits `AddFormula` for the replace kind):
this test, the rename-status test, the collision test, the parse-error test and
both concurrency-refusal tests fail, and the in-place test passes. A rename is the input the upsert cannot fake. The fixture has three
formulas with the cursor on index 1, so "the one under the cursor" is not also
"the first" or "the last".
### an_edit_lands_on_its_formula_after_an_earlier_one_is_deleted_meanwhile
improvise-km71. The capture is made when the editor opens and never re-read
from the cursor. Rival: `ReplaceFormula` resolves its formula from
`formula_cursor` at commit. The fixture deletes `Profit` (index 0) while the
editor is open on `Tax` (index 1), so cursor 1 now names `Margin`. The rival
rewrote `Margin`, and this test fails, along with
`an_edit_whose_formula_was_deleted_meanwhile_refuses_out_loud` and
`an_edit_whose_formula_was_changed_meanwhile_refuses_out_loud`. The other nine
formula-edit tests pass under it, because none of them moves the list.
### an_edit_whose_formula_was_changed_meanwhile_refuses_out_loud
improvise-km71. Another client rewrote `Tax`'s text but kept its target, so the
id still resolves. Only the `was` check can see this. Rival: the `was` filter
deleted. This test is the only one that fails. That is the case for keeping
`was` after improvise-sboz gives formulas a stable id: a concurrent replace
keeps the id.
### a_rename_onto_another_formulas_target_refuses_and_keeps_both
improvise-km71. Rival: `Model::replace_formula`'s collision check disabled.
This test and `replace_formula_refuses_to_displace_another_formula` fail.
Without the check, renaming `Tax` to `Margin` leaves two formulas with one
identity, and `formula(&id)` then finds the first.
### a_fresh_session_has_no_history_to_step_back_through
improvise-lxg0. `project.rs::fresh_view` built a new session's slice by folding
@@ -5930,6 +5970,16 @@ host's `Normal`, and nothing else different. `install_workbook` needs no
change of its own, because both of its callers (`LoadModel`,
`AcceptWizardModel`) run inside `apply_effects`, which settles after the batch.
### renaming_a_formula_outside_measure_refuses_and_keeps_the_editor
improvise-kb1d, found by the pre-merge review of #214 and by ChatGPT Codex (P1).
The fixture has a Region-targeted formula at index 1, between two `_Measure`
formulas, because every other km71 test used `_Measure`, whose items are
derived from the formula list and cannot show a stranded item. Rival: the guard
in `Model::replace_formula` disabled. This test fails on the formula list, and
`replace_formula_refuses_to_rename_a_target_outside_measure` in core fails too.
### `an_untouched_pivot_edit_of_a_misread_value_writes_nothing`
### `an_untouched_records_edit_of_a_misread_value_writes_nothing`