Skip to content

editor: replace generated recipe cells while preserving manual edits - #4871

Merged
jakildev merged 1 commit into
codex/editor-local-canvasfrom
codex/editor-recipe-iteration
Nov 5, 2026
Merged

jakildev merged 1 commit into
codex/editor-local-canvasfrom
codex/editor-recipe-iteration

Conversation

@jakildev

@jakildev jakildev commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

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

  • Built IRVoxelEditor and IrredenEngineTest on macOS/Metal against the combined stack.
  • Focused combined-stack suite: 116 tests, 114 passed, two platform-specific /dev/full skips.
  • Seven recipe reconciliation unit tests passed. Neutral test_recipe_reapply passed 16/16 GUI assertions across seven captures, with zero layout findings: shrink/expand replaces geometry, undo/redo restores recipe bindings and cells, and hand-painted color survives reapplication.

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.

Generated Shrunk Manual color retained

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.

@jakildev jakildev added fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend labels Nov 2, 2026
@jakildev
jakildev added this pull request to stack #4870 November 2, 2026 07:06
@jakildev jakildev added the fleet:awaiting-upstream-review Stacked PR; reviewer is holding verdict until upstream PR is approved label Nov 2, 2026
@jakildev

jakildev commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Holding review: upstream PR #4869 is not yet approved. This stacked PR will be re-evaluated once the upstream lands an approval label.

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 first applyEditRaw. The same holds in reapplyRecipe, 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. reapplyRecipe swaps resyncAfterRawEdits for resyncAfterAuthoredEdits (an existing API, already used at main.cpp:2020/2041). The applyRecipe path resyncs through commitStroke.
  • Plan input guards. The planner rejects bad storage (size mismatch, non-positive extent). The std::map ordering makes the edit order deterministic.
  • Builder model. Session::Builder mirrors the live semantics in replaceRecipeCells: 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 the comment-refs check is green.

Nits (follow-up)

  • main.cpp (same-recipe branch of applyRecipe): written now counts planned edits, including erasures, so the recipe_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 every test/module session (test_recipe_pages, ...) but not the new test_recipe_reapply. Add it there.
  • session_builder.hpp replaceRecipeCells: const OccupancyModel before = model; copies the whole model per call, and the any_of scans 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.hpp header comment: the reworded handle paragraph runs one line over the width the rest of that block keeps. format-check passes, 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::applyRecipe code at head e4749f7f7.
  • I did not build or run IrredenEngineTest, IRVoxelEditor, or the test_recipe_reapply GUI 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-lint and no-plan-files are green. linux-build and fleet-tests were 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.

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:reviewing-mac-pool-1 labels Nov 2, 2026
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.
@jakildev
jakildev force-pushed the codex/editor-recipe-iteration branch from e4749f7 to 80a420b Compare November 4, 2026 05:54
@github-actions github-actions Bot added human:re-review Human pushed changes to an approved PR — fleet should re-review and removed fleet:approved Fleet reviewer approved — ready for human merge labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

New commits pushed after fleet approval. Re-tagging human:re-review so the fleet picks it up again.

@jakildev jakildev added fleet:awaiting-upstream-review Stacked PR; reviewer is holding verdict until upstream PR is approved and removed human:re-review Human pushed changes to an approved PR — fleet should re-review labels Nov 4, 2026
@jakildev

jakildev commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

Holding review: upstream PR #4869 is not yet approved (new commits at 320ce89 reset its approval; it is being re-reviewed). This stacked PR will be re-evaluated once the upstream lands an approval label.

@jakildev jakildev removed the fleet:awaiting-upstream-review Stacked PR; reviewer is holding verdict until upstream PR is approved label Nov 4, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, the evaluateRecipeCells and !edits early returns come before the first applyEditRaw; the same holds in reapplyRecipe.
  • One undo record. The same-recipe branch still ends in the existing commitStroke with the binding change, and test_recipe_reapply covers 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::map keeps the edit order deterministic.
  • Builder model. replaceRecipeCells mirrors 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.cpp same-recipe branch of applyRecipe, written counts planned edits — unchanged; still a wording-level nit, carried below.
  • ↗ creations/editors/voxel_editor/CLAUDE.md § Validators (line 41) — still lists test_recipe_pages but not test_recipe_reapply; carried below.
  • ↗ session_builder.hpp replaceRecipeCells, per-call model copy and O(old×new) scans — unchanged, harmless at test extents.
  • ✅ editor_lua_host.hpp header comment width — reworded in the new head; format-check is green.

Nits (follow-up)

  • main.cpp applyRecipe same-recipe branch: recipe_applied ... cells= now means "edits applied" here and "cells written" on the additive path, and skipped never increments on this path. A separate counter or a log tweak would remove the ambiguity.
  • creations/editors/voxel_editor/CLAUDE.md line 41: add test_recipe_reapply to the module-session list.
  • session_builder.hpp replaceRecipeCells: 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 80a420b36 and 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); mergeStateStatus is CLEAN.
  • I did not build or run IrredenEngineTest, IRVoxelEditor or the test_recipe_reapply GUI session. The macOS/Metal unit and GUI results are the author's, which I read but did not reproduce. linux-build green 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.

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:reviewing-mac-pool-1 labels Nov 4, 2026
@jakildev
jakildev merged commit 72e2328 into master Nov 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:approved Fleet reviewer approved — ready for human merge fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant