Skip to content

refactor(engine): collapse 13 dispatch-shaped setters into a table#41

Merged
rulkens merged 3 commits intomainfrom
chore/engine-settings-table
May 7, 2026
Merged

refactor(engine): collapse 13 dispatch-shaped setters into a table#41
rulkens merged 3 commits intomainfrom
chore/engine-settings-table

Conversation

@rulkens
Copy link
Copy Markdown
Owner

@rulkens rulkens commented May 7, 2026

Summary

  • New settingsTable.ts declares the 13 "field write + callback + render-request" setters as a typed descriptor table with optional clamps.
  • engine.ts public handle spreads buildSettersFromTable(...); bespoke setters (setBiasMode, setTier, setLodMode, setSourceVisible, setSpaceMouseSensitivity) stay inline.
  • engine.ts -124 lines net.

Test plan

  • settingsTable.test.ts passes (4/4 unit tests for the builder + clamps + missing-callback tolerance)
  • npx tsc --noEmit clean
  • full suite green (912/912)
  • manual smoke: every Settings panel slider/toggle still updates the renderer (visual)

Notes vs. plan

  • Added a clamp field to the descriptor (the plan omitted clamps, but setExposure and setFilamentIntensity need them and the spec author flagged "trust the code over the plan").
  • Callback names match the actual EngineCallbacks shape (no onFilamentsEnabledChange / onFilamentIntensityChange — those are App-owned with no echo).

Spec: `docs/superpowers/specs/2026-05-08-engine-internal-restructure-design.md`

🤖 Generated with Claude Code

rulkens and others added 2 commits May 8, 2026 01:12
Declarative descriptor table for the 13 boring "write field + fire
callback + requestRender" setters in the public handle.  Bespoke
setters with side-effects stay inline.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace 13 inline setters with `...buildSettersFromTable(...)` spread.
Bespoke setters (setBiasMode, setTier, setLodMode, setSourceVisible,
setSpaceMouseSensitivity) stay inline.

engine.ts -124 lines.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
skymap 89a7d16 Commit Preview URL

Branch Preview URL
May 07 2026, 11:22 PM

…site

Honour the safety net the settingsTable docstring already advertises.
The widened `(value: unknown) => void` return type is contravariant-
assignable to EngineHandle's narrower per-method signatures, but the
key-set match wasn't being checked at the spread site — `satisfies`
adds that check now, so a future drift (renamed key, accidentally
omitted entry) trips tsc here instead of at distant callers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@rulkens rulkens merged commit 5154425 into main May 7, 2026
2 checks passed
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.

1 participant