fix(scale): avoid instance ID precision collisions - #950
Merged
ralyodio merged 1 commit intoAug 10, 2026
Conversation
Contributor
Author
|
Ready for review. This stays bounded to exact BigInt handling in getNextId plus a regression case beyond Number.MAX_SAFE_INTEGER. The PR records 54 scale tests passing, the workspace build passing, and git diff --check clean. Please merge if acceptable; I will invoice only after the PR is merged under the accepted uGig task. |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
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.
Fixes #949.
What changed
inst-*numeric suffixes asBigIntvalues while finding the maximumNumberprecision lossNumber.MAX_SAFE_INTEGERWhy
getNextIdpreviously parsed suffixes withNumber.parseInt. For an existing ID such asinst-9007199254740992, adding one rounded back to the same value, so the function returned an ID that was already present in the fleet.The generated identifier now remains exact and advances to
inst-9007199254740993while preserving the existing zero-padded format for normal IDs.Impact
Scale and rollout operations no longer risk duplicate generated instance IDs when a fleet snapshot contains a numeric suffix outside JavaScript's safe integer range.
Validation
corepack pnpm exec vitest run packages/cli/src/commands/scale.test.ts --reporter=verbose(54 tests passed)corepack pnpm --filter @profullstack/sh1pt... build(CLI and six workspace dependencies built successfully)git diff --check