refactor(engine): point-source slot wiring registry (Phase 4)#45
Merged
refactor(engine): point-source slot wiring registry (Phase 4)#45
Conversation
Declarative registry for the 5 point-source asset slots (SDSS, 2MRS, GLADE, Famous, Synthetic) plus a helper that builds the slot, attaches the upload-on-commit body, subscribes the onCloudReady + render-wake side effects, and stores the slot in state.assetSlots.points. Sidecar slots (filaments, famous-meta, pgc-aliases) keep their bespoke inline construction — their shape diverges materially from the point-source uniform contract. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace the inline 5-source slot construction loop with a registry
loop:
for (const cfg of POINT_SOURCE_REGISTRY) {
wirePointSourceSlot(state, cfg, { cb });
}
The registry rephrases the per-source ternary (Synthetic →
syntheticPointFetcher, others → pointCloudFetcher) as data, and the
helper inlines the rest of the slot body unchanged. Behaviour is
byte-for-byte identical — slot names, commit body, ready-state
subscriber, and storage in state.assetSlots.points all match the
pre-registry loop.
Sidecar slots (filaments, famous-meta, pgc-aliases) keep their
bespoke inline construction. The boot-time arrival promise and
synthetic-fallback gate continue to look up slots by Source from
state.assetSlots.points — the registry preserves those keys.
Drops the unused module-scope `sourceName` helper (the registry
helper has its own copy) and the now-orphaned pointCloudFetcher /
syntheticPointFetcher imports.
engine.ts -73 lines.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
skymap | 4ebb8ee | Commit Preview URL Branch Preview URL |
May 08 2026, 12:34 AM |
Per code-quality review: the docblock claimed sourceName was "duplicated from engine.ts to avoid a cycle", but Phase 4 actually moved the function out of engine.ts entirely. There is no second definition to keep in sync. Replace the cycle-avoidance fiction with the real placement reason: lives here because the only consumers today are this module's slot-name + log-line strings. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
pointSourceRegistry.tsdeclares the 5 point-source slots (SDSS, 2MRS, GLADE, Famous, Synthetic) as a typedPOINT_SOURCE_REGISTRYtable plus awirePointSourceSlot(state, cfg, deps)helper.Why a registry
onCloudReadyecho,requestRenderwake, and storage instate.assetSlots.pointsall match the pre-registry loop.What stays the same
allArrivalsPromiseand the synthetic-fallback gate look up slots bySourcefromstate.assetSlots.points— registry preserves those keys.allSlotsaggregation (used bycreateLoadProgressEmitter) iteratesstate.assetSlots.pointsunchanged.setTier's per-source reload loop (lines ~1856) still iterates[Source.SDSS, Source.TwoMRS, Source.Glade, Source.Famous]and callsstate.assetSlots.points.get(source)?.load(...).Test plan
pointSourceRegistry.test.ts(7 tests) covers: registry declares 5 sources in enum order; real surveys share one fetcher and Synthetic uses a distinct one; helper builds + stores slot keyed by Source; multiple sources produce independent slots; subscriber firesonCloudReady+requestRenderonready; commit uploads to renderer + writesstate.sources.clouds; commit no-ops whenstate.gpu.rendereris null.npm run typecheckclean (src + tools).Survey table (Task 4.1)
Source.SDSSpointCloudFetcher{ source, tier: state.sources.tier }(from later block)state.gpu.renderer+ log + writestate.sources.cloudscb.onCloudReady?.(source, count)+requestRender()Source.TwoMRSpointCloudFetcherSource.GladepointCloudFetcherSource.FamouspointCloudFetcherSource.SyntheticsyntheticPointFetcherAll five share the exact same skeleton; the only axis of variance was the fetcher. The registry rephrases the ternary as one row per source.
Sidecar slots NOT in the registry:
filaments— different fetcher (filamentFetcher), different payload (FilamentCloud), different renderer target (FilamentRenderer.upload), one-shot lifecycle (no tier reload). Absorbing it would require parameterising payload, commit target, and lifecycle on every registry row.famous-meta— pure metadata, nocommitstep, custom error handling that mapskind: 'error'→ "feature off" by writing empty meta/xrefs.pgc-aliases— lazy-loaded vialoadPgcAliases()shim, not at boot. Wrong lifecycle for a boot-time registry loop.Spec:
docs/superpowers/specs/2026-05-08-engine-internal-restructure-design.md(#3)Plan:
docs/superpowers/plans/2026-05-08-engine-internal-restructure.md(Phase 4)