Skip to content

fix(core): slab-sourced wall drafts are never coerced to a ground base - #702

Open
wass08 wants to merge 1 commit into
mainfrom
fix/wall-slab-support-election
Open

fix(core): slab-sourced wall drafts are never coerced to a ground base#702
wass08 wants to merge 1 commit into
mainfrom
fix/wall-slab-support-election

Conversation

@wass08

@wass08 wass08 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes #699 — walls drawn on a slab in fresh scenes committed terrain-hosted (height = level height, supportOffset = slab elevation, supportSlabId: "ground") while rendering correctly on the slab. Mechanism and scene-structure discriminator are in the issue.

The fix (deliberately narrow)

resolveWallConstruction: a constructionSourceNodeId that resolves to a slab suppresses the flatConstructionBase ground coercion — nothing more. Normal capped support election then finds the underlying slab; caller-supplied preferredSupportSlabId semantics are untouched; genuine terrain drafts (no slab source) keep their by-design explicit height/offset stamping (#630 rule).

A first iteration also fed the source slab into preferredSlabId; the independent review pass caught that this would pin the first-click slab across cross-slab walls (overriding per-commit re-election and the elevation cap, and diverging from the 2D path). The narrowed version ships with tests for exactly those shapes.

Evidence

  • Unit, red-first: fresh-scene shape failed on unpatched code (Expected "slab_fresh_floor" / Received "ground"); the two review-derived tests (cross-slab majority wins; grazing source not pinned) failed on the broad first patch and pass on the narrowed one. Focused suites 35/35, full turbo test 13/13.
  • Acceptance e2e (private-editor, fresh org-moved project — the exact bug shape): wall-plane-bound un-fixme'd passes 2× (28.0s / 22.4s). It ships test.fixme'd over there and gets un-fixme'd in the submodule-bump PR after this merges.
  • Adjacent e2e: wall-hover-outline and undo-redo-graph green on the rebuilt packages.
  • Caller trace: resolveWallConstruction has one production caller (wall-drafting), reached from the 3D wall tool and the floorplan panel; column/fence/stair flows don't pass these options. The floorplan path has no equivalent coercion (parity checked per wiki/architecture/tools.md).

🤖 Generated with Claude Code


Note

Medium Risk
Touches wall support-host persistence, which can change committed geometry, but the change is a small, well-tested guard in one resolver.

Overview
Walls started on a slab in resolveWallConstruction no longer get flatConstructionBase treated as a ground host. That was committing fresh-scene slab drafts as terrain-hosted (GROUND_SUPPORT_ID plus stamped height/offset) even though they rendered on the slab.

The source slab is only used to suppress that coercion. Support still re-elects under the existing cap, so a first-click slab is not pinned across a longer wall. Genuine terrain drafts without a slab source keep explicit height/offset stamping.

Tests cover the fresh-scene slab case, majority support on a cross-slab span, and a grazing source that must not override the elevation cap.

Reviewed by Cursor Bugbot for commit 3ec8388. Bugbot is set up for automated code reviews on this repo. Configure here.

Fixes #699. In a fresh scene the newly drawn slab is the only registered
top surface, so the pointer resolver hands the wall tool a node-top
sourceNodeId; the tool then treated ANY source as flatConstructionBase
and resolveWallConstruction force-elected 'ground', stamping the level
height and the slab elevation as supportOffset — walls on slabs in new
projects persisted terrain-hosted. Scenes with pre-existing geometry
route the ray differently, which is why seeded fixtures never showed it.

The fix is deliberately narrow: a construction source that IS a slab
suppresses the flat-base ground coercion, nothing more — normal capped
support election picks the underlying slab, caller-supplied preferences
stay authoritative, and genuine terrain drafts keep their by-design
explicit height/offset stamping. (A first attempt pinned the source
slab as preferredSlabId; review caught that it would break cross-slab
walls, now covered by tests: majority-coverage slab wins, a grazing
source slab is not pinned, and the fresh-scene shape stays plane-bound
with live election resolving the slab.)

Acceptance: private-editor's e2e wall-plane-bound spec (fresh org
project, currently test.fixme'd on this bug) passes twice with the fix;
wall-hover and undo-redo e2e unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Walls drawn on a slab in fresh scenes commit terrain-hosted (height + supportOffset + supportSlabId 'ground')

1 participant