[ENG-2326] "Now" is translated to None value as time for reserved nodes in Nodes API#215
Merged
andreaanez merged 1 commit intoOct 22, 2025
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Fixed redundant code in reserved node creation logic that was incorrectly setting start_at when user provided "NOW" as start time, and updated TypeScript schema to properly reflect that start_at can be number | null.
Key changes:
- Removed lines 259-260 in
create.tsthat setstart_atin the else clause, since line 279-284 unconditionally override this value anyway - Updated schema type for
start_atfromnumbertonumber | nullto align with API requirements - The logic now correctly handles "NOW" start times: validation passes at line 261, and final timestamp is set at lines 279-284
Confidence Score: 5/5
- This PR is safe to merge with no risk
- The changes remove redundant code that was being overridden anyway, and update the schema to match API requirements. The logic flow remains correct: when
start === "NOW", the validation passes and the final timestamp is properly set at lines 279-284. No behavioral changes, just cleanup. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/lib/nodes/create.ts | 5/5 | Removed redundant code that was setting start_at for "NOW" case since it was being overridden by lines 279-284 anyway |
| src/schema.ts | 5/5 | Updated TypeScript schema to allow start_at to be `number |
Sequence Diagram
sequenceDiagram
participant User
participant CLI
participant Parser as parseStartDateOrNow
participant Validation
participant API as Nodes API
User->>CLI: sf nodes create --start NOW --duration 1h
CLI->>Parser: parseStartDateOrNow("NOW")
Parser-->>CLI: "NOW" (string)
Note over CLI: createParams.start_at not set<br/>(lines 256-258 skipped)
CLI->>Validation: Check if "NOW" is valid
Validation-->>CLI: Valid (startDate === "NOW")
Note over CLI: Lines 279-284: Set final start_at
CLI->>CLI: start_at = Math.floor(new Date().getTime() / 1000)
CLI->>API: POST /nodes/create {start_at: <timestamp>, ...}
API-->>CLI: Node created
CLI-->>User: Success
2 files reviewed, no comments
0xJepsen
approved these changes
Oct 22, 2025
Contributor
0xJepsen
left a comment
There was a problem hiding this comment.
I am not a code owner here but these changes look fairly constrained and correct to me
Member
sigmachirality
left a comment
There was a problem hiding this comment.
small issues
- you did not regenerate the Stainless SDK.
- you directly edited the schema.ts instead of running deno task schema
- the schema.ts does not affect the Stainless SDK.
big issues:
- due to how the logic interacts with existing date hour rounding logic, this 1 line change doesn’t actually work.
Contributor
Author
|
Yikes ok. |
Contributor
Author
|
If i revert this PR can I bribe you into doing it for me? Either that or I need an education here - will be stopping by desk to ask as well |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

We are running into a race condition where confirmation steps lead to time now being past 1 min