Skip to content

refactor(onboard): derive session step mapping from FSM metadata#4363

Draft
cv wants to merge 1 commit into
stack/onboard-fsm-definitionfrom
stack/onboard-fsm-step-mapping
Draft

refactor(onboard): derive session step mapping from FSM metadata#4363
cv wants to merge 1 commit into
stack/onboard-fsm-definitionfrom
stack/onboard-fsm-step-mapping

Conversation

@cv
Copy link
Copy Markdown
Collaborator

@cv cv commented May 27, 2026

Summary

Derive the onboard session-step-to-machine-state mapping from the canonical FSM metadata. This removes another hand-maintained copy of the state vocabulary while keeping the exported mapping and runtime behavior unchanged.

Changes

  • Update src/lib/onboard/machine/events.ts to build ONBOARD_SESSION_STEP_TO_MACHINE_STATE from state definitions.
  • Preserve the exported OnboardSessionStepName type from the derived mapping.
  • Extend machine definition tests to assert the session step mapping matches state metadata.

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

    • Improved internal code organization for onboarding machine state management by consolidating state definitions.
  • Tests

    • Enhanced validation to ensure onboarding state mappings are properly derived from core definitions.

Review Change Stack

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this May 27, 2026
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 27, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ae975fa1-61e6-4eb3-8bc4-c9b93fb94866

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stack/onboard-fsm-step-mapping

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: onboard-resume-e2e
Optional E2E: cloud-onboard-e2e, onboard-negative-paths-e2e

Dispatch hint: onboard-resume-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/stack/onboard-fsm-definition
Head: HEAD
Confidence: high

Required E2E

  • onboard-resume-e2e (high): Directly exercises interrupted onboarding, persisted onboard-session step state, forced failure at the policies step, and nemoclaw onboard --resume; this is the closest existing E2E coverage for regressions in session-step-to-machine-state mapping.

Optional E2E

  • cloud-onboard-e2e (high): Useful baseline confidence that a normal cloud onboarding user flow still completes after changing onboarding machine event/session mapping, but the resume E2E is more targeted and should be the merge-blocking check.
  • onboard-negative-paths-e2e (high): Adjacent coverage for failed onboarding paths and diagnostics. Helpful because the changed mapping participates in failure-state reporting, but the PR mainly refactors the mapping source and adds unit coverage.

New E2E recommendations

  • onboarding machine event stream (medium): Existing E2E coverage validates persisted session/resume behavior, but does not appear to assert the emitted onboard machine event stream's step/state pairs. A lightweight forced-failure/resume E2E assertion would catch regressions where events are emitted with null or mismatched states even if the session file remains usable.
    • Suggested test: Add an onboarding event-stream validation to the existing onboard resume or negative-path E2E that records machine events and asserts each persisted step maps to the expected machine state.

Dispatch hint

  • Workflow: nightly-e2e.yaml
  • jobs input: onboard-resume-e2e

@github-actions
Copy link
Copy Markdown
Contributor

E2E Scenario Advisor Recommendation

Required scenario E2E: None
Optional scenario E2E: None

Workflow run

Full scenario advisor summary

E2E Scenario Advisor

Base: origin/stack/onboard-fsm-definition
Head: HEAD
Confidence: high

Required scenario E2E

  • None. No scenario workflow, scenario metadata, scenario runtime, or validation-suite files changed.

Optional scenario E2E

  • None.

Relevant changed files

  • None.

@github-actions
Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 0 worth checking, 0 nice ideas
Top item: No actionable findings

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@wscurran wscurran added the refactor This is a refactor of the code and/or architecture. label May 27, 2026
@cv cv added the v0.0.55 Release target label May 27, 2026
@cv cv requested a review from ericksoa May 27, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor This is a refactor of the code and/or architecture. v0.0.55 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants