Skip to content

fix(scale): avoid instance ID precision collisions - #950

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/next-bugfix-20260809
Aug 10, 2026
Merged

fix(scale): avoid instance ID precision collisions#950
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/next-bugfix-20260809

Conversation

@aiirvizionz

Copy link
Copy Markdown
Contributor

Fixes #949.

What changed

  • keep parsed inst-* numeric suffixes as BigInt values while finding the maximum
  • increment the maximum without JavaScript Number precision loss
  • add a regression test above Number.MAX_SAFE_INTEGER

Why

getNextId previously parsed suffixes with Number.parseInt. For an existing ID such as inst-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-9007199254740993 while 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

@aiirvizionz

Copy link
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@ralyodio
ralyodio merged commit 2eb461a into profullstack:master Aug 10, 2026
6 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.

scale: getNextId repeats fleet IDs beyond the safe integer range

2 participants