Skip to content

refactor(onboard): extract live FSM slice runner helper#4530

Merged
cv merged 97 commits into
mainfrom
stack/onboard-fsm-live-slice-helper
Jun 10, 2026
Merged

refactor(onboard): extract live FSM slice runner helper#4530
cv merged 97 commits into
mainfrom
stack/onboard-fsm-live-slice-helper

Conversation

@cv

@cv cv commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extract the common live FSM slice execution policy into a reusable helper. The helper runs the strict slice path only for fresh matching entry states and falls back to compatibility execution for resume/ahead-state flows.

Changes

  • Add runLiveOnboardFlowSlice() for strict-versus-compatibility slice execution.
  • Normalize single and ordered FSM result application for compatibility paths.
  • Add tests covering fresh strict execution and resume/ahead-state compatibility execution.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Refactor

    • Centralized onboarding flow execution into a single live-slice runner for more consistent resume/compatibility behavior across init, core, and final phases.
    • Improved safeguards: stricter validation of phase sequences, duplicate detection, and rejection of empty phase results to prevent out-of-order side effects.
  • Tests

    • Added thorough tests covering strict vs. compatibility execution, resume semantics, error propagation, and validation scenarios.

cv added 30 commits May 27, 2026 15:18
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>
cv added 9 commits June 9, 2026 12:42
…' into stack/onboard-fsm-use-final-slice

# Conflicts:
#	src/lib/onboard.ts
…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
…ice' into stack/onboard-fsm-use-core-slice

# Conflicts:
#	src/lib/onboard.ts
…' into stack/onboard-fsm-use-final-slice

# Conflicts:
#	src/lib/onboard.ts
@copy-pr-bot

copy-pr-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

cv added 9 commits June 9, 2026 13:39
…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
@cv cv added v0.0.63 Release target and removed v0.0.62 Release target labels Jun 10, 2026
Base automatically changed from stack/onboard-fsm-use-final-slice to main June 10, 2026 02:39
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv marked this pull request as ready for review June 10, 2026 02:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/machine/live-flow-slice.ts`:
- Around line 70-73: The current logic treats any non-resume state not in
runWhenState as compatible and calls runSlice, which incorrectly runs repair
phases for sessions that are still before the slice entry; change the guard so
compatibility fallback only happens for resume or states that are already
at/after the slice entry. Concretely: add a predicate (e.g., isBeforeEntry or
isAtOrAfterEntry) that inspects current.machine.state versus the slice entry
ordering, then replace the condition with something like "if (!resume &&
isBeforeEntry(current.machine.state)) { return /* do not run compatibility */ }
else if (!runWhenState.includes(current.machine.state)) { return runSlice({
context, runtime, phases }) }" so runSlice is only invoked for resume or
ahead/at-entry states; reference current.machine.state, resume, runWhenState,
and runSlice when making the change.
🪄 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: 2fa3273e-eaaf-4b3f-a34d-cb5a47887a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 39f20a4 and 0dc9032.

📒 Files selected for processing (5)
  • src/lib/onboard/machine/core-flow-phases.ts
  • src/lib/onboard/machine/final-flow-phases.ts
  • src/lib/onboard/machine/initial-flow-phases.ts
  • src/lib/onboard/machine/live-flow-slice.test.ts
  • src/lib/onboard/machine/live-flow-slice.ts

Comment thread src/lib/onboard/machine/live-flow-slice.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 27250016360
Target ref: 0dc9032d1eb6fb5616acdda65585030cb3b4b90a
Workflow ref: main
Requested jobs: cloud-onboard-e2e,onboard-resume-e2e,onboard-repair-e2e
Summary: 3 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success

@cv cv merged commit b3c295a into main Jun 10, 2026
34 checks passed
@cv cv deleted the stack/onboard-fsm-live-slice-helper branch June 10, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow refactor PR restructures code without intended behavior change v0.0.63 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants