Skip to content

Conversation

@sigmachirality
Copy link
Member

Allows users to specify a colocation strategy of anywhere on their auto-reserved nodes if they don't care about which zone matching their requirements they land on each hour.

Currently this flag is feature flagged for internal testing.

@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 6, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/nodes/list.tsx  69% smaller
  src/lib/nodes/create.ts  26% smaller
  src/lib/nodes/utils.ts  4% smaller
  package.json  1% smaller
  deno.lock Unsupported file format

@sigmachirality sigmachirality self-assigned this Dec 6, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 6, 2025

Greptile Overview

Greptile Summary

This PR introduces a new --any-zone flag to the sf nodes create command, enabling users to create auto-reserved nodes without specifying a particular zone. The feature implements an "anywhere" colocation strategy that allows nodes to be placed in any zone that meets their requirements. Key changes include:

  • Added a new --any-zone option that conflicts with --zone to prevent conflicting zone specifications
  • Updated validation logic to require either --zone or --any-zone when using the --auto flag
  • Enhanced display logic throughout the nodes interface to show "Any matching zone" for auto-reserved nodes without specific zones
  • Updated the nodes SDK dependency to support the new colocation strategy API
  • Modified confirmation messages to clearly indicate when nodes will be placed in any matching zone

The implementation follows established CLI patterns using Commander.js conflicts() and maintains consistency with the existing codebase structure. This feature is currently feature-flagged for internal testing and provides users with greater flexibility for cost optimization and availability.

Important Files Changed

Filename Score Overview
package.json 5/5 Updated SDK dependency to support new any-zone functionality and patched dayjs version
src/lib/nodes/create.ts 4/5 Core implementation of --any-zone flag with proper validation and API integration
src/lib/nodes/utils.ts 4/5 Updated zone display logic and removed mandatory zone requirement for better UX
src/lib/nodes/list.tsx 4/5 Enhanced zone display messaging for auto-reserved nodes without specific zones

Confidence score: 4/5

  • This PR implements a well-structured feature with proper validation and user feedback mechanisms
  • Score reflects good implementation practices but potential concerns around feature flag coordination and comprehensive testing of edge cases
  • Pay close attention to the zone validation logic in create.ts and ensure the feature flag implementation is properly coordinated across the system

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant PostHog
    participant NodesClient as "Nodes SDK Client"
    participant API as "SF Compute API"

    User->>CLI: "sf nodes create --auto --any-zone -n 1 --max-price 12.50"
    CLI->>PostHog: "Check feature flag 'custom-vm-images'"
    PostHog-->>CLI: "Feature flag status"
    CLI->>CLI: "Validate command options and arguments"
    CLI->>CLI: "Hook preAction: validate any-zone with auto flag"
    CLI->>NodesClient: "Create nodes client instance"
    NodesClient-->>CLI: "Client ready"
    CLI->>CLI: "Build NodeCreateParams with any_zone=true"
    User->>CLI: "Confirm node creation"
    CLI->>NodesClient: "nodes.create(createParams)"
    NodesClient->>API: "POST /nodes with any_zone=true"
    API-->>NodesClient: "Created nodes response"
    NodesClient-->>CLI: "Nodes creation result"
    CLI->>CLI: "Display success message and nodes table"
    CLI->>User: "Show created nodes and next steps"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@andreaanez andreaanez left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@sigmachirality sigmachirality merged commit 9d9e7d1 into main Dec 8, 2025
1 check passed
@sigmachirality sigmachirality deleted the dt/any-zone-cli-flg branch December 8, 2025 22:36
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.

3 participants