feat: accept --enable-infiniband flag on sf nodes create#264
Conversation
Changed Files
|
|
78f3d98 to
81109ce
Compare
b620823 to
7b33bf5
Compare
81109ce to
2e1124c
Compare
7b33bf5 to
e5c0c0f
Compare
9fb7eb8 to
87776f2
Compare
d7ebf2b to
db73844
Compare
--enable-infiniband flag on sf nodes create--enable-infiniband to sf nodes create
--enable-infiniband to sf nodes create--enable-infiniband flag on sf nodes create
|
@indent intelligently resolve conflicts with main |
…create`
Convert `create` to a `createCreateCommand({ enableInfiniband })` factory
so the call site can thread in the result of the `infiniband-preview`
feature-flag check. When the flag is enabled for the caller's account,
the option is mounted on `sf nodes create` and forwards
`_preview_enable_infiniband: true` to the nodes SDK. When the flag is
disabled, the surface is unchanged.
…gates resolve on first run Previously `registerNodes` (and other `register*` calls that consult `isFeatureEnabled`) ran before `account_id` was hydrated, so the very first CLI invocation after login silently saw `false` for every flag and hid gated surfaces like `--enable-infiniband` until the cache was seeded by a subsequent run. The hydration is also now awaited so the analytics block reuses the same identifier without racing the config write. Generated with [Indent](https://indent.com) Co-Authored-By: sigmachirality <sigmachirality@users.noreply.github.com>
c5d6435 to
fd12807
Compare
|
Rebased onto The base branch was effectively a no-op against main (
PR now shows a clean 4-file diff against main:
|
…ateCreateCommand
The factory now resolves its own feature-flag state instead of having
the call site pre-compute it and pass `{ enableInfiniband }` in, so the
gating concern stays co-located with the option it controls. `registerNodes`
just does `await createCreateCommand()`.
Generated with [Indent](https://indent.com)
Co-Authored-By: sigmachirality <sigmachirality@users.noreply.github.com>
apkumar-sfc
left a comment
There was a problem hiding this comment.
just a small nitpick, otherwise lgtm
| export function createCreateCommand({ | ||
| enableInfiniband, | ||
| }: { | ||
| enableInfiniband: boolean; |
There was a problem hiding this comment.
nitpick, this could be named to make it more obvious it's a feature flag rather than like a cli flag.
shouldDisplayEnableInfiniband or enableInfinibandFeatureFlag?
There was a problem hiding this comment.
Fixed by encapsulating feature flag call in createCreateCommand in 56cb42d
--enable-infiniband flag on sf nodes create--enable-infiniband flag on sf nodes create
| const config = await loadConfig(); | ||
| let exchangeAccountId = config.account_id; | ||
| if (!exchangeAccountId) { | ||
| const client = await apiClient(config.auth_token); |
There was a problem hiding this comment.
[🟡 Medium] [🔵 Bug]
The new pre-registration account hydration runs an unguarded network call before any command is parsed, so transient network/DNS failures can throw and terminate the process even for commands like help/version. ts // src/index.ts if (!exchangeAccountId) { const client = await apiClient(config.auth_token); const { data } = await client.GET("/v1/account/me", {}); if (data?.id) { This matters because command surfaces now depend on startup network reliability instead of failing open when feature-flag resolution is unavailable. Wrap this hydration block in try/catch (or otherwise treat failures as non-fatal) so CLI startup proceeds when account lookup cannot be completed.
Summary
Adds an
--enable-infinibandflag tosf nodes createthat forwards_preview_enable_infiniband: trueon the create call. The flag is gated behind theinfiniband-previewPostHog feature flag and is only mounted when that flag is enabled for the caller's account — accounts without it see no surface change. Flagged accounts do see the option insf nodes create --help; preview/experimental expectations are set out-of-band ("white glove") for those customers. Server-side allowlisting (per(account, instance SKU)) does the real enforcement, so non-allowlisted callers still get a 403.Stacked on #262 (depends on
@sfcompute/nodes-sdk-alpha@0.1.0-alpha.31which exposes_preview_enable_infinibandonNodeCreateParams).Description of changes
src/lib/posthog.ts: extendFeatureFlagswith"infiniband-preview".src/lib/nodes/create.ts:createCreateCommandnow takes{ enableInfiniband }; when true, the option is added to the command and_preview_enable_infiniband: trueis spread into the SDK params.src/lib/nodes/index.ts: resolves the feature flag and threads it into the factory.src/index.ts: hoistaccount_idhydration above theregister*calls so feature-flag-gated surfaces resolve on the very first CLI invocation after login (previously they only appeared on the second run, once the cache was seeded).Testing
bun run lint— passes (same pre-existing warnings asmain).sf nodes create --helpwhen the feature flag resolves true.