fix(wizard): report gateway failures before success summary #691

Merged
jason.woltje merged 1 commits from fix/wizard-gateway-health-order into next 2026-06-25 18:14:41 +00:00
Owner

Summary

  • defer the wizard success summary / "Mosaic is ready" until gateway config health and admin bootstrap have completed
  • preserve non-deferred finalizeStage behavior for direct callers while returning an idempotent showSummary callback for wizard paths
  • update Pi runtime install hint to the requested curl installer string

Verification

  • pnpm --filter @mosaicstack/mosaic test -- unified-wizard finalize-skills
  • pnpm format:check
  • pnpm typecheck
  • pnpm lint
  • pnpm build
  • pnpm test
  • Codex code review: approve
  • Codex security review: one low finding on requested Pi curl|sh hint; no wizard-ordering security finding

Fixes #15

## Summary - defer the wizard success summary / "Mosaic is ready" until gateway config health and admin bootstrap have completed - preserve non-deferred finalizeStage behavior for direct callers while returning an idempotent showSummary callback for wizard paths - update Pi runtime install hint to the requested curl installer string ## Verification - pnpm --filter @mosaicstack/mosaic test -- unified-wizard finalize-skills - pnpm format:check - pnpm typecheck - pnpm lint - pnpm build - pnpm test - Codex code review: approve - Codex security review: one low finding on requested Pi curl|sh hint; no wizard-ordering security finding Fixes #15
jason.woltje added 1 commit 2026-06-25 17:58:02 +00:00
fix(wizard): defer success summary until gateway ready
Some checks failed
ci/woodpecker/push/ci Pipeline was canceled
ci/woodpecker/pr/ci Pipeline was successful
e495d8845f
Author
Owner

REVIEW-OF-RECORD — APPROVE (#691, head e495d8845f). I reviewed the wizard gateway-health ordering change and found no blockers.

Ordering: finalizeStage now separates mutation work from terminal success messaging by returning an idempotent showSummary() callback and supporting deferSummary. Wizard/quick-start paths call finalize with deferSummary: true, then call showSummary() only after gateway config reports ready and admin bootstrap completes. If gateway health/config reports not ready, the wizard returns/aborts without printing Installation Summary or Mosaic is ready.; the new unified-wizard tests cover both success-after-health and no-summary-on-health-failure.

Compatibility: direct/non-deferred finalizeStage callers still get the old immediate summary behavior, and skipGateway wizard paths explicitly call showSummary() after finalize. The B2 skills-sync/finalize helper path logic remains intact: frameworkScriptPath() still resolves tools/_scripts first with legacy bin fallback, and the finalize-skills regression suite still passes.

Pi hint: the Pi runtime install string change is limited to the runtime detector install hint (curl -fsSL https://pi.dev/install.sh | sh). That is adjacent wizard/runtime-instruction copy, not a broader installer/runtime behavior change. Codex's low note on curl|sh is acknowledged, but this matches the requested install hint and is not a blocker for the B3 ordering fix.

Reviewer verification on head e495d884: targeted unified-wizard finalize-skills tests pass (10/10); full mosaic test suite pass (627/627); mosaic typecheck pass; mosaic lint pass; repo format:check pass; repo build pass (23/23). APPROVE.

REVIEW-OF-RECORD — APPROVE (#691, head e495d8845fa5512f3d9b89b8ccdfc729b3ae3d37). I reviewed the wizard gateway-health ordering change and found no blockers. Ordering: `finalizeStage` now separates mutation work from terminal success messaging by returning an idempotent `showSummary()` callback and supporting `deferSummary`. Wizard/quick-start paths call finalize with `deferSummary: true`, then call `showSummary()` only after gateway config reports ready and admin bootstrap completes. If gateway health/config reports not ready, the wizard returns/aborts without printing `Installation Summary` or `Mosaic is ready.`; the new unified-wizard tests cover both success-after-health and no-summary-on-health-failure. Compatibility: direct/non-deferred `finalizeStage` callers still get the old immediate summary behavior, and `skipGateway` wizard paths explicitly call `showSummary()` after finalize. The B2 skills-sync/finalize helper path logic remains intact: `frameworkScriptPath()` still resolves `tools/_scripts` first with legacy `bin` fallback, and the finalize-skills regression suite still passes. Pi hint: the Pi runtime install string change is limited to the runtime detector install hint (`curl -fsSL https://pi.dev/install.sh | sh`). That is adjacent wizard/runtime-instruction copy, not a broader installer/runtime behavior change. Codex's low note on curl|sh is acknowledged, but this matches the requested install hint and is not a blocker for the B3 ordering fix. Reviewer verification on head e495d884: targeted `unified-wizard finalize-skills` tests pass (10/10); full mosaic test suite pass (627/627); mosaic typecheck pass; mosaic lint pass; repo format:check pass; repo build pass (23/23). APPROVE.
Author
Owner

REVIEW-OF-RECORD — APPROVE

Independent review (reviewer ≠ author). Blocker B3 (greenfield wizard printed "Mosaic is ready" + Next Steps, THEN ran gateway install which failed health → false success claim).

Fix: finalizeStage no longer emits the success summary inline — it gains deferSummary and returns a showSummary() callback (idempotent via summaryShown guard). Both quickStartPath and the main wizard.ts path call finalize with deferSummary: true, run gateway config + gatewayBootstrapStage (health gate), and invoke showSummary() ONLY after those succeed — or immediately when gateway setup is explicitly skipped. On config/bootstrap failure the wizard aborts (process.exit(1)) WITHOUT the success summary. Correct ordering: real readiness now precedes the "ready" claim.

Fold-in: runtime detector installHint for Pi updated deprecated npm install -g @mariozechner/pi-coding-agentcurl -fsSL https://pi.dev/install.sh | sh (verified live; installs @earendil-works/pi-coding-agent).

Tests: new unified-wizard coverage — "prints the success summary only after gateway health succeeds" + "does not claim success when gateway health reports not ready".

CI: PR-event pipeline 1645 fully green (ci-postgres, typecheck, lint, format, test all success).

Approving for squash-merge to next.

REVIEW-OF-RECORD — APPROVE Independent review (reviewer ≠ author). Blocker **B3** (greenfield wizard printed "Mosaic is ready" + Next Steps, THEN ran gateway install which failed health → false success claim). **Fix:** `finalizeStage` no longer emits the success summary inline — it gains `deferSummary` and returns a `showSummary()` callback (idempotent via `summaryShown` guard). Both `quickStartPath` and the main `wizard.ts` path call finalize with `deferSummary: true`, run gateway config + `gatewayBootstrapStage` (health gate), and invoke `showSummary()` ONLY after those succeed — or immediately when gateway setup is explicitly skipped. On config/bootstrap failure the wizard aborts (`process.exit(1)`) WITHOUT the success summary. Correct ordering: real readiness now precedes the "ready" claim. **Fold-in:** runtime detector `installHint` for Pi updated deprecated `npm install -g @mariozechner/pi-coding-agent` → `curl -fsSL https://pi.dev/install.sh | sh` (verified live; installs @earendil-works/pi-coding-agent). **Tests:** new unified-wizard coverage — "prints the success summary only after gateway health succeeds" + "does not claim success when gateway health reports not ready". **CI:** PR-event pipeline 1645 fully green (ci-postgres, typecheck, lint, format, test all success). Approving for squash-merge to `next`.
jason.woltje merged commit b96cc7982a into next 2026-06-25 18:14:41 +00:00
jason.woltje deleted branch fix/wizard-gateway-health-order 2026-06-25 18:14:41 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#691