Skip to content

Conversation

@sigmachirality
Copy link
Member

@coffinsfcompute pointed out that we don't include --start <contractToExtend.End> in the equivalent buy colocate command, making it not actually equivalent.

@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 3, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/extend/index.tsx  19% smaller

@sigmachirality sigmachirality self-assigned this Nov 3, 2025
@sigmachirality sigmachirality merged commit 1f1ed3d into main Nov 3, 2025
1 check passed
@sigmachirality sigmachirality deleted the dt/fix-deprecation-extend branch November 3, 2025 22:00
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.

Greptile Overview

Greptile Summary

Fixed the equivalent sf buy command shown by the deprecated sf extend command to include the --start parameter set to the contract's end time, making it truly equivalent to extending a contract.

Key changes:

  • Fetches contract details via API to retrieve the contract end time
  • Extracts endsAt from contract shape using getContractRange utility
  • Builds equivalent buy command with -s <contract_end_time> parameter
  • Falls back to placeholder <contract_end_time> if API fetch fails
  • Updates help text to reflect the corrected command format

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change correctly addresses the reported issue by fetching contract details and extracting the end time to build an accurate equivalent command. The implementation follows existing patterns in the codebase (using apiClient, getContractRange), includes proper error handling with fallback to a placeholder value, and maintains backward compatibility. The change is isolated to a deprecated command with clear migration messaging.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/lib/extend/index.tsx 5/5 Added API call to fetch contract details and correctly build the equivalent buy command with --start parameter set to the contract's end time

Sequence Diagram

sequenceDiagram
    participant User
    participant extendAction
    participant apiClient
    participant API as /v0/contracts/{id}
    participant getContractRange
    participant Console

    User->>extendAction: Run sf extend command
    extendAction->>apiClient: Initialize API client
    extendAction->>API: GET /v0/contracts/{id}
    alt Fetch successful
        API-->>extendAction: Return contract data
        extendAction->>getContractRange: Extract contract.shape
        getContractRange-->>extendAction: Return {startsAt, endsAt}
        extendAction->>extendAction: Build command with endsAt.toISOString()
        extendAction->>Console: Display equivalent buy command with -s flag
        extendAction->>User: Exit with code 0
    else Fetch failed
        API-->>extendAction: Return error
        extendAction->>Console: Display error and equivalent command with placeholder
        extendAction->>User: Exit with code 1
    end
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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