Repository navigation
editor: replace generated recipe cells while preserving manual edits - #4871
Conversation
|
Holding review: upstream PR #4869 is not yet approved. This stacked PR will be re-evaluated once the upstream lands an approval label. |
jakildev
left a comment
There was a problem hiding this comment.
Review — editor: replace generated recipe cells while preserving manual edits
Verdict: approve
Stacked on #4869 (cross-author, now approved). Reviewing the child diff only — upstream is approved separately. The fleet:awaiting-upstream-review gate is cleared.
Big picture
The change does what the PR describes. Reapplying the same recipe (APPLY and handle drags) now plans its edits through one pure function, planRecipeReapply (recipe_reapply.hpp). That function compares the old and new evaluated cells against the authored records, not a rotated raster. It acts only on cells that still match the generated default (color plus default layer/material/bone/flags/priority). Hand-painted, erased and nondefault-metadata cells are left alone, and new-only cells are placed only where the target is empty. The first APPLY and a recipe-identity change stay additive, and the CLAUDE.md and header contract text says so.
Checked specifically:
- No half-applied state. In
applyRecipe, every early return (!evaluateRecipeCells,!edits) comes before the firstapplyEditRaw. The same holds inreapplyRecipe, so a failed plan cannot leave a partial stroke. - One undo record. The same-recipe branch still ends in
commitStroke(false, RecipeBindingChange{...}), so the stroke and the binding change stay a single record. The test session covers undo and redo of the binding. - Mask handling. Old and new evaluations both use the binding's persistent class mask (
beforeBinding->mask_/afterBinding->mask_), matching the "masked output" unit test. - Resync.
reapplyRecipeswapsresyncAfterRawEditsforresyncAfterAuthoredEdits(an existing API, already used atmain.cpp:2020/2041). TheapplyRecipepath resyncs throughcommitStroke. - Plan input guards. The planner rejects bad storage (size mismatch, non-positive extent). The
std::mapordering makes the edit order deterministic. - Builder model.
Session::Buildermirrors the live semantics inreplaceRecipeCells: a manual erasure inside the old footprint survives a later regrow. The builder test pins it. - Rules. No
glm::/std::math bypass, no header globals, and thecomment-refscheck is green.
Nits (follow-up)
main.cpp(same-recipe branch ofapplyRecipe):writtennow counts planned edits, including erasures, so therecipe_applied ... cells=log means "edits applied" on this path and "cells written" on the additive path. A consumer reading that log line would see the difference; a separate counter or a log tweak would remove it.creations/editors/voxel_editor/CLAUDE.md§ Validators: the module-session list names everytest/modulesession (test_recipe_pages, ...) but not the newtest_recipe_reapply. Add it there.session_builder.hppreplaceRecipeCells:const OccupancyModel before = model;copies the whole model per call, and theany_ofscans are O(old×new). That is harmless at test extents. If editors grow large scenes, a sorted flat set or a lookup would do.editor_lua_host.hppheader comment: the reworded handle paragraph runs one line over the width the rest of that block keeps.format-checkpasses, so this is cosmetic only.
Praise
- Making the planner a pure
span-in / edits-out header function means the semantics are unit-testable with no GL or ECS. The seven tests cover fallback color resolution, repeated coordinates, hole masks, derived render bits versus authored metadata, and the no-tombstone limit. - The no-tombstone limitation is stated as a limit in the PR body, the CLAUDE.md contract, the header comment and a test, rather than being hidden.
Validation I did and did not do
- Read the full diff plus the surrounding
applyRecipe/reapplyRecipe/commitStroke/Builder::applyRecipecode at heade4749f7f7. - I did not build or run
IrredenEngineTest,IRVoxelEditor, or thetest_recipe_reapplyGUI session. The unit and GUI results above are the author's macOS/Metal evidence, which I read but did not reproduce. - CI at review time:
comment-refs,format-check,header-checks,instruction-size,whitespace,closes-lintandno-plan-filesare green.linux-buildandfleet-testswere still in progress when I read them, so I count those as unread rather than green. - Windows/OpenGL hands-on validation is outstanding per the PR body. This is an editor creation change with no shader or engine render path, so it adds no cross-host smoke tag.
🤖 Reviewed by Claude Sonnet (review-pr skill)
Opus recheck not required.
Compare the previous generated footprint with authored cells before reapplying parameters. Remove obsolete generated cells and preserve manual color, occupancy and metadata edits. Keep each application and its recipe binding in one undo record, with a matching session occupancy model.
e4749f7 to
80a420b
Compare
|
New commits pushed after fleet approval. Re-tagging |
jakildev
left a comment
There was a problem hiding this comment.
Review — editor: replace generated recipe cells while preserving manual edits
Verdict: approve
Re-review at head 80a420b36. Stacked on #4869 (cross-author). Upstream #4869 regained fleet:approved on its current head 320ce8941 (review submitted 2026-11-04T16:33Z), so the fleet:awaiting-upstream-review gate is cleared. Reviewing the child diff only (11 files, +378/-54 against the upstream head); upstream is approved separately.
Big picture
Unchanged from my earlier approve at e4749f7f7: the child content is the same change, now restacked on the new upstream head. Reapplying the same recipe (APPLY and handle drags) plans its edits through one pure function, planRecipeReapply (recipe_reapply.hpp). It compares the old and new evaluated cells against the authored records and acts only on cells that still match the generated default. Hand-painted, erased and nondefault-metadata cells are left alone, and new-only cells are placed only where the target is empty. The first APPLY and a recipe-identity change stay additive, and the CLAUDE.md and header contract say so.
Re-read at the new head:
- No half-applied state. In
applyRecipe, theevaluateRecipeCellsand!editsearly returns come before the firstapplyEditRaw; the same holds inreapplyRecipe. - One undo record. The same-recipe branch still ends in the existing
commitStrokewith the binding change, andtest_recipe_reapplycovers undo and redo of the binding. - Mask handling. Old and new evaluations both use the binding's persistent class mask.
- Planner semantics. Old+new present with the live cell matching the old color: recolor only if the color differs. Old-only: erase. New-only: place only on an empty (alpha 0) cell. Size/extent guards return
nullopt.std::mapkeeps the edit order deterministic. - Builder model.
replaceRecipeCellsmirrors the live semantics (manual erasure inside the old footprint survives a regrow); the builder test pins it. - Rules. No
glm::/std::math bypass, no header globals.
Prior-review resolution
- ↗
main.cppsame-recipe branch ofapplyRecipe,writtencounts planned edits — unchanged; still a wording-level nit, carried below. - ↗
creations/editors/voxel_editor/CLAUDE.md§ Validators (line 41) — still liststest_recipe_pagesbut nottest_recipe_reapply; carried below. - ↗
session_builder.hppreplaceRecipeCells, per-call model copy and O(old×new) scans — unchanged, harmless at test extents. - ✅
editor_lua_host.hppheader comment width — reworded in the new head;format-checkis green.
Nits (follow-up)
main.cppapplyRecipesame-recipe branch:recipe_applied ... cells=now means "edits applied" here and "cells written" on the additive path, andskippednever increments on this path. A separate counter or a log tweak would remove the ambiguity.creations/editors/voxel_editor/CLAUDE.mdline 41: addtest_recipe_reapplyto the module-session list.session_builder.hppreplaceRecipeCells:const OccupancyModel before = model;copies the whole model per call. Fine now; revisit if scenes grow.
Praise
- A pure
span-in / edits-out planner with no GL or ECS dependency makes the semantics unit-testable; the seven tests cover fallback color, repeated coordinates, hole masks, derived-bit versus authored-metadata, and the no-tombstone limit. - The no-tombstone limitation is stated as a limit in the PR body, CLAUDE.md, the header comment and a test.
Validation I did and did not do
- Read the full child diff at
80a420b36and the surrounding code from the earlier pass. - CI on the head: all 12 checks completed SUCCESS (
linux-build,fleet-tests,format-check,comment-refs,header-checks,instruction-size,closes-lint,no-plan-files,whitespace,gate,changes,swap-approval-label);mergeStateStatusisCLEAN. - I did not build or run
IrredenEngineTest,IRVoxelEditoror thetest_recipe_reapplyGUI session. The macOS/Metal unit and GUI results are the author's, which I read but did not reproduce.linux-buildgreen only shows the Linux target compiles. - Windows/OpenGL hands-on validation is outstanding per the PR body. This is an editor-creation change with no shader or engine render path, so no cross-host smoke tag is added.
🤖 Reviewed by Claude Sonnet (review-pr skill)
Opus recheck not required.
Summary
Reapplying the same recipe replaces its unchanged generated cells instead of accumulating old geometry. Manual paint, additions, erasures and metadata are preserved where identifiable; recipe handles use the same reconciliation and one-step undo.
Validation
Scope
GUI evidence is from the combined stack; later controls can appear in captures. Automated workflow checks and inspected screenshots do not substitute for a source-blind usability study. Windows/OpenGL hands-on validation remains outstanding.
Limits
Reconciliation recognizes unchanged generated cells by color and default metadata. A manual change that exactly recreates generated data is indistinguishable. Erasure protection does not persist after a cell leaves the prior generated footprint, so expanding a later result can refill it. First APPLY and changing recipe identity remain additive; persistent override records are future work.
Visual evidence
Native macOS/Metal, 3200×1800 captures. These are stages of the same neutral fixture, not different software revisions. The diagnostic ALL workspace partly overlaps the column with the module dock; these establish regeneration behavior, while the later FOCUS slice separately demonstrates unobstructed authoring.
Concurrent changes
Overlap trial merges are clean with #4861 in CLAUDE.md, editor_lua_host.hpp, main.cpp and test/module/init.lua, and with #4863 in those paths plus session_builder.hpp (all under creations/editors/voxel_editor). #4868 and #4869 shared paths are upstream. Review parameter admission semantics alongside #4863; this slice changes output reconciliation.
Reviewed-foundation integration
The stack incorporates foundation amendment a93a6d6 (hidden-widget hitboxes and visibility persistence) without rewriting published commits. IRVoxelEditor rebuilt at combined-stack head 598b23b. All five follow-up workflows passed: 63/63 assertions across 51 captures, zero layout findings, and five clean exits. The host reported zero monitors during this additional offscreen Metal pass; the longer document and motion runs used the documented 30-second display-discovery grace while retaining the run watchdog, GPU lease, assertions and layout checks. Earlier display-guard terminations are not counted as passes. The earlier unit runs and screenshots remain scoped as described above.