refactor(cli): add onboard FSM transition types#3848
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds an onboarding finite-state machine: typed state/event vocabularies, explicit and failure transitions combined into a transition graph, navigation and validation helpers (including a custom invalid-transition error), and tests validating graph invariants. ChangesOnboarding FSM Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Selective E2E Results — ✅ All requested jobs passedRun: 26137466357
|
PR Review AdvisorRecommendation: info only This is an automated advisory review. A human maintainer must make the final merge decision. Limitations: Advisor execution failed: Could not configure advisor model openai/openai/gpt-5.5 Full advisor summaryPR Review AdvisorBase: PR review advisor failed: Could not configure advisor model openai/openai/gpt-5.5 Gate status
🔴 Blockers
🟡 Warnings
🔵 Suggestions
Acceptance coverage
Security review
Test / E2E status
✅ What looks good
Review completeness
|
Selective E2E Results — ✅ All requested jobs passedRun: 26170203727
|
|
✨Related open issues: |
## Summary Emit structured, redacted onboarding machine events from the existing session step mutation helpers. This stacks on #3848 and keeps event delivery process-local/non-persistent as the PR 2 foundation for the #3802 FSM workstream. ## Related Issue Refs #3802 Stacked on #3848 ## Changes - Added `src/lib/onboard/machine/events.ts` with structured event creation, redacted context building, session-step-to-machine-state mapping, and process-local listeners. - Augmented `markStepStarted`, `markStepComplete`, `markStepSkipped`, `markStepFailed`, and `completeSession` to emit `state.*`, `context.updated`, and onboarding terminal events after persisted session mutations. - Added session tests that verify event ordering, redaction, observer failure isolation, unknown-step behavior, and that full event logs are not persisted by default. ## Type of Change - [x] 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 - [x] `npx prek run --all-files` passes - [x] `npm test` passes - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `make docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Onboarding now emits structured events for step/state transitions and context updates, with sanitized metadata and origin parsing. * **Bug Fixes** * Listener errors are isolated so they cannot disrupt onboarding progression. * Emissions guarded to avoid duplicate or spurious events for unknown or no-op transitions; events emit only on real state changes. * **Tests** * Added tests validating event ordering, redaction of sensitive data, persistence excludes events, and observer-failure isolation. * **Chores** * Updated test harness command invocation argument order for sandboxed checks. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3849?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Julie Yaunches <jyaunches@nvidia.com>
Summary
Add the first observable onboarding FSM shell primitives: coarse machine state names, event vocabulary, transition metadata, and validation helpers. This is the no-behavior-change foundation for the #3802 onboarding FSM workstream.
Related Issue
Refs #3802
Changes
src/lib/onboard/machine/types.tswith onboarding machine states, event types, transition/context types, and terminal-state vocabulary.src/lib/onboard/machine/transitions.tswith the canonical transition graph, failure transitions from non-terminal states, lookup helpers, and invalid-transition errors.src/lib/onboard/machine/transitions.test.tscovering vocabulary, transition ordering, retry/branch/failure classification, terminal states, and duplicate edge protection.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores