Skip to content

Keep a structure's pieces when Update changes nothing - #1379

Merged
saworbit merged 2 commits into
mainfrom
fix/structure-update-noop
Oct 21, 2026
Merged

saworbit merged 2 commits into
mainfrom
fix/structure-update-noop

Conversation

@saworbit

@saworbit saworbit commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Update on a structure nobody changed rebuilt every piece under a new id and recorded a step. That broke anything that named the old ids (a wire, a cordon round them, a prefab record) and left an undo step that undid nothing.

  • HFGeneratorSystem.update_changes_nothing(generator_id, settings) is the one check. It is true when the settings build the same structure as the record's and every piece the record names is still there, still this structure's, and still the shape and place it was built in (edited_brush_ids() empty). A piece with no signature, or whose id now names a brush that is not ours ([Review] Rebuilds: prefab and generator rebuilds each re-carry per-copy state field by field, so every new property is lost until reported #1221), counts as a change, so the rebuild goes ahead as before.
  • same_settings() reads both sides through the schema's merge and compares floats with is_equal_approx. A plain == fails on 4 against 4.0, and a SpinBox hands back some on-step values a rounding away (0.4, 1.2, 1.7 on a 0.05 step).
  • The dock's Update (the section's button, the toolbar's Upd, the palette) says "Nothing to update" and records no step. Over the bridge, update_structure keeps every id and answers no_change: true. With Record no bridge step for a call that changed nothing, and replace the default cordon #1378 the dispatcher then records no step either; tested together locally.
  • A structure moved or turned as a whole still counts as unchanged, because a rebuild puts it back where it stands. regenerate() itself still always rebuilds.

Tests: seven in test_structure_dock_commands.gd (unchanged Update from the toolbar and the section keeps ids and records no step; every type at its defaults; settings from outside the dock with 1.7/0.4/1.2; a setting change, an edited piece, a piece moved on its own and a deleted piece still rebuild with one step). Two in test_mcp_dispatcher_structures.gd, fifteen predicate tests in test_generator_system.gd, one line in the MCP structures vibe scenario. Mutation checked on each guard. Local: test_generator_system 104, test_structure_dock_commands 29, test_mcp_dispatcher_structures 16, test_live_generator 45, test_mcp_command_sweep, and more, all green. With #1378 merged in on a scratch branch: the sweep, the structure and command dispatcher tests and the structures scenario pass.

Also folded in: the dock committed Update without the absolute redo Create got in #1275, so a redo of an Update minted new piece ids and a later step that named one found nothing. One argument in dock_brush_handler.gd, pinned by test_redo_of_an_update_gives_back_the_pieces_it_made (failed on the old call).

Fixes #1368

@saworbit
saworbit enabled auto-merge (squash) October 21, 2026 00:18
@github-actions github-actions Bot added area: build Brushes, drawing, vertex/edge editing (Build tab) area: architecture Subsystem structure, decomposition, code quality area: docs README, guides, spec, roadmap, changelog area: ci Workflows, contributor tooling, dependency pins tests The GUT suite and its fixtures labels Oct 21, 2026
@saworbit
saworbit merged commit cb389b4 into main Oct 21, 2026
11 checks passed
@saworbit
saworbit deleted the fix/structure-update-noop branch October 21, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Subsystem structure, decomposition, code quality area: build Brushes, drawing, vertex/edge editing (Build tab) area: ci Workflows, contributor tooling, dependency pins area: docs README, guides, spec, roadmap, changelog tests The GUT suite and its fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Structures] Update with unchanged settings rebuilds the pieces and records a step

1 participant