Skip to content

test: cover platform-driven region discovery - #192

Merged
jwfing merged 1 commit into
mainfrom
fix/issue-136-regions
Sep 9, 2026
Merged

test: cover platform-driven region discovery#192
jwfing merged 1 commit into
mainfrom
fix/issue-136-regions

Conversation

@jwfing

@jwfing jwfing commented Sep 8, 2026

Copy link
Copy Markdown
Member

Region discovery must follow the platform catalog when regions are retired. Add coverage for the human-readable and JSON output of insta regions, using an injected API client and the Virginia, Frankfurt, and Singapore catalog.

Part of InsForge/insta-cloud#136. The CLI continues to fetch /regions; the platform change controls availability.

Validation: npm run typecheck; npm test (799 passed, outside the sandbox for the subprocess timeout test).


Summary by cubic

Adds test coverage for insta regions so region discovery follows the platform catalog, as required by InsForge/insta-cloud#136.

  • regionsList accepts an optional injected API client for testing.
  • Tests both human-readable and JSON output using Virginia, Frankfurt, and Singapore entries.
  • Behavior is unchanged; the CLI still requests GET /regions and the platform controls availability.

Written for commit 2c55f0e. Summary will update on new commits.

Review in cubic

@jwfing
jwfing marked this pull request as ready for review September 8, 2026 21:04

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Summary
The PR adds focused coverage confirming that insta regions requests the platform catalog and renders only its returned entries in both human-readable and JSON modes. The dependency-injection change follows repository testing conventions and leaves production behavior unchanged. No correctness, security, or performance problems were found.

Requirements context
Intent was derived primarily from the PR title and description: region availability must come from the platform’s /regions catalog so retired regions disappear without a CLI release. README.md confirms that insta regions lists regions available for postgres and compute, and .claude/skills/developing-insta-cli/SKILL.md recommends dependency injection for side-effectful command tests. The linked insta-cloud#136 issue was not retrievable, and no more detailed matching requirement was found locally; assessment therefore uses the PR description and repository documentation.

Findings

Critical
(none)

Suggestion
(none)

Information

  • test/regions.test.ts:12: Focused regression coverage matches the stated behavior - The parameterized test exercises both output modes, verifies GET /regions, and compares output against the injected Virginia, Frankfurt, and Singapore catalog. Exact output comparison would expose additional hard-coded or retired entries.
  • src/commands/regions.ts:5: Dependency injection preserves production behavior - The optional API dependency is limited to the request method, while normal CLI invocation still loads ApiClient and performs the same request. This follows the repository’s documented dependency-injection testing convention.
  • Security: No security-sensitive behavior changed - The CLI command remains wired to the authenticated ApiClient; the optional injected client is used only by direct programmatic callers and introduces no new shell execution, secret handling, logging, dependency, or authorization bypass in the CLI path.
  • Performance: No performance regression identified - The production path still performs one API request and a linear pass over the returned catalog. The change adds no extra I/O, loops, dependencies, or allocations of practical significance.

Tests
git diff --check main...HEAD passed. npm run typecheck and npm test were attempted but could not execute because node_modules is absent and the local tsc/vitest binaries are unavailable; dependencies were not installed because the review environment is read-only.

Verdict
approved: Approved because the review found zero Critical findings; all observations are informational.

@Fermionic-Lyu Fermionic-Lyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, Approved.

@jwfing
jwfing merged commit 281069b into main Sep 9, 2026
3 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.

2 participants