Skip to content

Preserve the first-layer offset when color swatches change - #178

Merged
vycdev merged 5 commits into
vycdev:developfrom
JohnSt99:codex/first-layer-snap
Nov 19, 2026
Merged

vycdev merged 5 commits into
vycdev:developfrom
JohnSt99:codex/first-layer-snap

Conversation

@JohnSt99

@JohnSt99 JohnSt99 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #164. Second focused split from #156, based independently on develop (93b4be6).

Swatch reconciliation preserves the first displayed color on the max(layerHeight, firstLayerHeight) + n * layerHeight lattice. A valid 0.28 mm height with 0.08 mm layers and a 0.20 mm first layer stays 0.28 mm after recomputation. The hook retains slider edits and avoids normalizing an outdated height array while a larger or smaller palette is being reconciled. Other colors keep normal-layer rounding.

The React-free helper has node:test coverage for repeated reconciliation with changing storage order, six layer/first-layer combinations, unchanged non-first rounding, and the actual manual swap plan. Native Playwright cases cover default order and a manually reordered first color, including resizing that changes palette size and repeated Undo/Redo.

Validation:

  • Full validation at 403fc9f: lint/build; 198 browser tests across all 8 suites; 1,154 unit tests passed, 1 skipped across 92 files using node --no-warnings --experimental-strip-types --test --test-concurrency=1 tests/*.test.ts.
  • Follow-up 656d958: fresh lint/build, 3 first-layer unit tests, and 25 related browser tests pass, including both first-layer cases, shared-canvas/history, profiled 3D exports and physical-layer preview. The manual-order case reproduced a lost height before the follow-up guard.

The aggregate npm test runner encountered a 60-second Vite SSR module-import timeout in unchanged Auto-paint/multi-head modules on this machine, both on the mounted drive and in a native Linux checkout. Per-file isolation completed the entire suite; no test-runner changes are included. Upstream CI requires maintainer action before jobs can run; the final full CI run is still pending.

Maintainer review follow-up

Three commits on top of 656d958, from the council review. They are needed because heights are now kept across swatch changes:

  • handleResetHeights updates prevOrderRef. Before this, a later swatch change brought back the old order but kept the reset heights.
  • A First Layer Height change made while no colors are shown (for example with the image removed) now applies when the colors come back.
  • Normalization skips the render where filtered changes, so the stale height array can't overwrite the reconciled heights. This replaces the length-only guard. Without it, changing First Layer Height to 0.25 mm with no image and then pressing Undo gave 0.49 mm.

Proof at 290a267, run locally:

  • Lint, build, npm test (1154 passed, 1 skipped), check:e2e, and every area e2e suite.
  • The 5 first-layer e2e cases pass 15/15. The new cases fail on the previous heads.
  • 3MF export after resize and Undo/Redo puts the first color slab at 0–0.28 mm; before the fix it was 0–0.20 mm.
  • Three smoke cases in image-decode-reuse fail here and on unchanged develop. dnd-kit blocks clicks for 50 ms after a drag, and this machine's timing triggers that. develop CI passes them.

Council review

Rounds: 4

Delegate Round 1 Round 2 Round 3 Round 4
Claude Opus 5.5 9/10 8/10 9/10 9/10
GPT-6.2 Sol 8/10 8/10 8/10 9/10

@JohnSt99
JohnSt99 marked this pull request as ready for review November 16, 2026 22:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T22:37:25.828079Z 403fc9f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

JohnSt99 and others added 4 commits November 17, 2026 00:45
The height sync now preserves edits across reconciliation, so the reset
order must reach prevOrderRef, and a First Layer Height change made while
no colors are shown must apply when they return.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The stale height array can be off the new first-layer grid after a
setting change made without an image, and normalizing it overwrote the
reconciled heights and the pending first-layer reset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants