Floors: reorder from the editor + repair hand-edited ids — closes #66#69
Open
nicosandller wants to merge 1 commit into
Open
Floors: reorder from the editor + repair hand-edited ids — closes #66#69nicosandller wants to merge 1 commit into
nicosandller wants to merge 1 commit into
Conversation
Feature: the floor gear popover gains an Order row — move the active floor up/down the list (disabled at the ends, undoable). List position is the dropdown and floor-switcher order, so a roof stuck in the basement is two clicks from the top. Bug half: reordering floors by cut-and-paste in YAML routinely drops or duplicates floor ids. Reproduced the damage: a duplicated id makes every commit patch BOTH floors (edits silently land on the wrong floor); a missing id kills floor switching. getFloors now repairs both — missing ids backfill deterministically by position (floor_N), collisions get a positional suffix, first occurrence keeps its id — so the repair is stable across renders and persists on the next editor commit. Also: the floor <select> binds .selected (live property) instead of ?selected (default-only attribute), so a reorder can't strand the browser's index-based selection on the wrong floor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #66 is two complaints in one — "editing the order of floors in YAML causes configuration errors" and "let me reorder floors without YAML". This PR does both.
The feature: ▲/▼ in the floor gear
The floor gear popover gains an Order row: move the active floor up/down the list. Position in the list is what the editor dropdown and the card's floor switcher display, so the reporter's roof-stuck-in-the-basement is two clicks from the top. Buttons disable at the ends, the move commits through history (a mis-move is one Ctrl+Z away), and the logic is a pure, unit-tested
moveFloor().The bug: what hand-reordering actually breaks
Reordering floor blocks in YAML is cut-and-paste, and cut-and-paste routinely drops or duplicates the
id:line. Reproduced both in the harness against main:getFloorsnow repairs both at the normalization boundary: missing ids backfill deterministically by position (floor_1,floor_2, …), collisions keep the first occurrence and suffix the rest. Deterministic-by-position means the repair is stable across renders (lookups don't churn) and persists into the YAML on the next editor commit.Also fixed while here: the floor
<select>bound?selected— the default-selection attribute — so after a reorder the browser's index-based live selection could point at the wrong floor. It now binds the.selectedproperty.Verification
tscclean, 211/211 tests (206 on main + 5: id repair incl. stability and name/id pairing,moveFloormoves/ends/unknown-id/immutability).Roof, Basement, Ground, ▲ now disabled at the top, ▼ was disabled at the bottom; Ctrl+Z ×2 restores the original order; the card's floor switcher renders in the new order. Duplicate-id config before/after: an edit used to land on both floors (One:1 | Two:1), now on exactly the edited one (One:0 | Two:1).Backwards compatibility
Well-formed configs pass through byte-identical (same ids, same order). Only configs that were already broken (missing/colliding ids) change — they get working ids, which is the repair. No schema additions.
Closes #66.
🤖 Generated with Claude Code