Skip to content

fix(seed-rich-telemetry): validate services count#253

Open
suryapratapsingh26 wants to merge 1 commit into
superloglabs:mainfrom
suryapratapsingh26:fix/issue-68-audit
Open

fix(seed-rich-telemetry): validate services count#253
suryapratapsingh26 wants to merge 1 commit into
superloglabs:mainfrom
suryapratapsingh26:fix/issue-68-audit

Conversation

@suryapratapsingh26

@suryapratapsingh26 suryapratapsingh26 commented Jul 14, 2026

Copy link
Copy Markdown

What & why

Validate the --services CLI argument before using it.

Previously, passing a non-numeric value (for example --services abc) caused Number() to return NaN, which propagated through Math.max/Math.min and resulted in an invalid service count. This change validates the parsed value and throws an error for invalid input.

Addresses item #12 from Code Audit issue #68.

How to test

  • Run:

    pnpm tsx scripts/demo/seed-rich-telemetry.ts --services abc

    Verify the script exits with:

    Error: invalid services count
    
  • Run:

    pnpm tsx scripts/demo/seed-rich-telemetry.ts --services 4

    Verify the script starts normally.

AI assistance

  • None
  • [x ] Used AI for: discussing the validation approach and reviewing the implementation.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would change existing behavior)
  • Documentation
  • Tests only
  • Refactor / cleanup

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm format has been run on changed files
  • Added or updated tests where it makes sense
  • Branch is up to date with main
  • PR title follows the area-prefix style for the area being changed (e.g. worker: …, fix(slack): …)
  • Read CONTRIBUTING.md (skim counts)

Summary by cubic

Validate the --services CLI argument in scripts/demo/seed-rich-telemetry.ts to prevent NaN-based invalid service counts (addresses Code Audit issue #68, item 12). Non-numeric or infinite values now throw "invalid services count"; valid numbers are floored and clamped to 1–8.

Written for commit 601ed3d. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

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.

1 participant