fix(orientation): defensive coerce in hashSeed to handle undefined objID#16
Merged
fix(orientation): defensive coerce in hashSeed to handle undefined objID#16
Conversation
The pointInfoBuilder occasionally calls fallbackOrientation with a cloud.objIDs[idx] value of `undefined` — happens during a tier swap when the GPU pick texture briefly returns an index that out-runs the just-uploaded cloud buffers, and `BigUint64Array[oob]` returns undefined. `undefined & 0xffffffffn` then throws "Cannot mix BigInt and other types" and the hover handler crashes. Coerce to 0n at hashSeed entry — the resulting orientation is still deterministic (derived from RA/Dec) and matches what unmatched rows already produce, so behavior is consistent with the existing "objID = 0n" path documented in the module header. Adds a regression test covering the undefined input case. 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
Fixes the intermittent runtime crash on hover:
Root cause
pointInfoBuildercallsfallbackOrientation(cloud.objIDs[idx]!, ra, dec). During a tier swap, the GPU pick texture can briefly return a global index that out-runs the just-uploaded cloud buffers —idxis out-of-bounds,BigUint64Array[oob]returnsundefined, the!non-null assertion is a TS-only lie, andundefined & 0xffffffffnthrows.Fix
Defensive coerce
objIDto0nathashSeedentry when it isn't a bigint. The resulting orientation stays deterministic (derived from RA/Dec, which is always valid) and produces exactly the same value an unmatched row would — so the user sees a stable orientation that matches the rest of the catalogue's "objID = 0n" path documented in the module header.The deeper engine-side race (pick-texture index can briefly desync from the freshly-uploaded cloud buffer) is a separate concern. This PR keeps the renderer crash-free while that's investigated.
Test plan
npm run typecheckcleanfallbackOrientation(undefined as any, ra, dec)— passes🤖 Generated with Claude Code