Architecture hardening: enforce renderer parity, decompose god-files, fix shadow seams - #85
Open
apresmoi wants to merge 28 commits into
Open
Architecture hardening: enforce renderer parity, decompose god-files, fix shadow seams#85apresmoi wants to merge 28 commits into
apresmoi wants to merge 28 commits into
Conversation
…angle detection, core helper dedup)
…r/override/dedup caches
… throttle, zero-light ground gate)
…d+exported, PolyThreeMesh parity, morph core dep)
…hrottle hardening
…ametric-only controls
…d on member parity
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.
Architecture hardening pass over the whole monorepo, plus a shadow-quality
investigation that started from a visible artifact and ended in core.
All 23 commits are gated: 3,121 tests green, 0 typecheck errors, package +
website builds clean, mirror/boundary checks passing at every commit boundary.
Why
An audit of module boundaries, duplication, defaults, types and performance
turned up one root cause behind most of it: the three-renderer copy discipline
(vanilla / React / Vue) was enforced by prose in
AGENTS.mdand a PR checklist,with nothing mechanical behind it. It had already failed — several fixes existed
in one renderer only, producing live rendering bugs.
What landed
Enforcement (the reason the rest stays fixed)
pnpm check:boundaries— package dependency rules, deep-import bans, node-builtincontainment.
pnpm check:mirrors— byte-identity for react↔vue clones; hash-pinned lock for thestructurally-divergent vanilla↔framework mirrors, so editing one fails CI until
you re-pin and confirm all three renderers got the change.
pnpm typecheckper package (now including test files), wired into CI.Live bugs fixed (each was a one-renderer fix that never got mirrored)
seamBleedsilently ignored for textured triangles.strategies.disableand the owning document.Performance
frame — they now match vanilla, which never did. Caster-items, parametric-override
and overlap-dedup caches are shared across all three renderers.
updatePolygonedits.Consistency
seamBleedunified: one core-owned resolution (raw px,"auto"= 1.5), replacingtwo divergent semantics.
maxDistance→Infinityeverywhere, an 80 ms animated-shadowthrottle in all three renderers, ground-shadow gated on a real directional light.
Decomposition (coverage-baselined first, behavior-preserving)
createPolyScene.ts2,481 → 1,286 lines + 7 concept modules; region coverage80.4% → 84.4%.
PolyMesh1,554 → 498, Vue 1,455 → 419, into 8 mirrored modules each;coverage up on every axis. All pre-existing tests pass unmodified.
Shadow quality (traced from a visible artifact to root cause)
crease boundaries between face groups now bleed correctly. The last one was only
safe once solid single-light shadows switched to painting a pre-blended colour
opaquely instead of the shadow colour at partial alpha, making overlap idempotent.
Proven pixel-identical where nothing overlaps (0 of 607,200 px at opacity 1).
non-planar imported quads pushed genuinely-shared edges past the matching epsilon and
272 real creases were misclassified as silhouette. Castle missing-shadow pixels
117 → 70, now within 1 px of the brute-force bound.
Website
from a different base: shadow strength 0 still left a dark patch and the ground
shadow read ~68% deeper than the geometry justified. Ground now bakes honestly —
shadow ratio 0.370 → 0.657 vs the model's 0.662, strength 0 is genuinely clean, and
light-dragging got ~14% faster.
Shadow color.
.voximport; per-phase shadow timers wired; renderstats now report shadow subpath and path-data counts (the real cost drivers).
Breaking changes
seamBleedis raw px everywhere;"auto"now yields 1.5 px overscan in React/Vue(was none), and values > 1.5 are no longer clamped in vanilla.
maxDistancedefault 5000 →Infinityin React/Vue (Three parity).PolySceneprops,debugShowBackfaces, theresolveColorexport,and
usePolySceneContext's ignored options parameter.ShadowOptions→PolyShadowOptions(now exported by all three);Poly*CameraOptionsFromThree→Poly*CameraStateFromThree.the shadow colour at fractional alpha.
Review notes
The commits are ordered as coherent units and can be reviewed in sequence — the
enforcement commits come first, then bug fixes, then perf, then the refactors, then
the shadow work. Happy to split this into stacked PRs if you'd prefer that shape.
Deliberately not done, needing your call: curating
polycss'sexport * from core, the three incompatiblePolyMeshHandleshapes,polycss-fontsgeneric export names, hoisting the shared
styles.tsCSS, and an optionalshadow.mode: "flat"for artistically uniform shadows.