refactor(onboard): run initial phases through FSM slice#4499
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
…inalization-phases' into stack/onboard-fsm-flow-sequence
… into stack/onboard-fsm-initial-sequence-slice
…ce-slice' into stack/onboard-fsm-core-sequence-slice
…slice' into stack/onboard-fsm-final-sequence-slice
…-slice' into stack/onboard-fsm-use-initial-slice # Conflicts: # src/lib/onboard.ts
…board-fsm-core-sequence-slice
…rd-fsm-final-sequence-slice
…e-sequence-slice # Conflicts: # src/lib/onboard/machine/flow-slices.test.ts # src/lib/onboard/machine/flow-slices.ts
…slice' into stack/onboard-fsm-final-sequence-slice
…-slice' into stack/onboard-fsm-use-initial-slice
…al-sequence-slice # Conflicts: # src/lib/onboard/machine/flow-slices.test.ts # src/lib/onboard/machine/flow-slices.ts
…-slice' into stack/onboard-fsm-use-initial-slice
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/onboard.ts`:
- Around line 6517-6523: The code assigns session from initialContext.session
which can discard runner-updated session state; instead use the session returned
on the runner result (initialFlowResult.session) after
runInitialOnboardFlowSlice() so downstream resume sees the latest machine/step
updates—replace uses of initialContext.session for the session handoff with
initialFlowResult.session and keep reading sandboxGpuConfig/gpu from
initialContext as before.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e3a34e8f-192c-4fbc-9d6f-db03b49bf9e3
📒 Files selected for processing (5)
src/lib/onboard.tssrc/lib/onboard/machine/initial-flow-phases.test.tssrc/lib/onboard/machine/initial-flow-phases.tssrc/lib/onboard/sandbox-gpu-notes.tssrc/lib/onboard/sandbox-gpu-preflight.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/onboard/machine/initial-flow-phases.test.ts (1)
342-362: 💤 Low valueConsider using exact equality to enforce call order.
The test uses
expect.arrayContaining([...])which verifies all listed calls are present but permits additional calls and doesn't enforce exact ordering. Since the preflight→gateway flow executes operations in a deterministic sequence (context snippet 1), using exact equality would catch ordering regressions and unexpected calls:- expect(calls).toEqual( - expect.arrayContaining([ + expect(calls).toEqual([ "get-sandbox", "resume-gpu-overrides", ... "record-gateway-complete", - ]), - ); + ]);The current form still validates presence of the expected operations and throwing mocks guard against unwanted ones, so this is an optional strengthening rather than a fix.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/onboard/machine/initial-flow-phases.test.ts` around lines 342 - 362, The test currently uses expect.arrayContaining([...]) which only asserts presence and not order or extra calls; change the assertion on the calls array in initial-flow-phases.test (the expect(calls) assertion) to assert exact equality and ordering (e.g., replace expect.arrayContaining with a direct equality assertion such as expect(calls).toEqual([...]) or expect(calls).toStrictEqual([...])) so the test enforces the precise sequence and disallows extra calls, referencing the same literal list of call names shown in the diff.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/onboard/machine/initial-flow-phases.test.ts`:
- Around line 342-362: The test currently uses expect.arrayContaining([...])
which only asserts presence and not order or extra calls; change the assertion
on the calls array in initial-flow-phases.test (the expect(calls) assertion) to
assert exact equality and ordering (e.g., replace expect.arrayContaining with a
direct equality assertion such as expect(calls).toEqual([...]) or
expect(calls).toStrictEqual([...])) so the test enforces the precise sequence
and disallows extra calls, referencing the same literal list of call names shown
in the diff.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: d60de121-3c35-4b90-a51f-46dd92d27c10
📒 Files selected for processing (2)
src/lib/onboard/machine/initial-flow-phases.test.tssrc/lib/onboard/machine/initial-flow-phases.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/lib/onboard/machine/initial-flow-phases.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 27242617348
|
Summary
Move the fresh-run preflight/gateway live call site onto the initial FSM flow slice. Resume remains on the compatibility path for now so preflight and gateway backstops still run even when saved machine state is already ahead.
Changes
OnboardFlowContextinsrc/lib/onboard.tsfor preflight/gateway state.runInitialOnboardFlowSequence(...)for fresh runs that start atpreflight.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
New Features
Refactor
Tests