fix: bootstrap hotfix — DTO erasure, wizard failure, port prefill, Pi SDK copy (mosaic-v0.0.26) #440

Merged
jason.woltje merged 1 commits from fix/bootstrap-hotfix into main 2026-04-05 21:43:31 +00:00
Owner

Summary

Fixes four bugs found during real-run testing of mosaic-v0.0.25. Closes #436.

  • [CRITICAL] Bug 1 — Admin bootstrap 400: bootstrap.controller.ts used import type { BootstrapSetupDto }, erasing the class at runtime. NestJS @Body() fell back to plain Object metatype and ValidationPipe with whitelist + forbidNonWhitelisted rejected every field. Fixed by changing to a value import. Covered by a new e2e test (bootstrap.e2e.spec.ts) via @nestjs/testing + supertest + Fastify that exercises the real DI binding path.
  • Bug 2 — Wizard success after failure: wizard.ts had !bootstrapResult.completed && headlessRun — interactive-mode failures were swallowed and the wizard printed ✔ Wizard complete. Removed the && headlessRun guard; failures now abort in both modes.
  • Bug 3 — Port prompt blank: @clack/prompts uses initialValue to prefill the buffer; defaultValue is only used for empty submissions. Added initialValue to WizardPrompter.text(), the Clack and Headless adapters, and all gateway config prompts. Port 14242 now shows in the field.
  • Bug 4 — Pi SDK missing from intro copy: Updated the "What is Mosaic?" welcome note to include Pi SDK.

Release

@mosaicstack/mosaic bumped 0.0.25 → 0.0.26.

Test plan

  • pnpm test — all 570 tests pass (351 gateway + 219 mosaic)
  • pnpm typecheck — clean
  • pnpm lint — clean
  • pnpm format:check — clean
  • New e2e test src/admin/bootstrap.e2e.spec.ts — 4 tests, covers the regression

🤖 Generated with Claude Code

## Summary Fixes four bugs found during real-run testing of `mosaic-v0.0.25`. Closes #436. - **[CRITICAL] Bug 1 — Admin bootstrap 400**: `bootstrap.controller.ts` used `import type { BootstrapSetupDto }`, erasing the class at runtime. NestJS `@Body()` fell back to plain `Object` metatype and ValidationPipe with `whitelist + forbidNonWhitelisted` rejected every field. Fixed by changing to a value import. Covered by a new e2e test (`bootstrap.e2e.spec.ts`) via `@nestjs/testing` + supertest + Fastify that exercises the real DI binding path. - **Bug 2 — Wizard success after failure**: `wizard.ts` had `!bootstrapResult.completed && headlessRun` — interactive-mode failures were swallowed and the wizard printed `✔ Wizard complete`. Removed the `&& headlessRun` guard; failures now abort in both modes. - **Bug 3 — Port prompt blank**: `@clack/prompts` uses `initialValue` to prefill the buffer; `defaultValue` is only used for empty submissions. Added `initialValue` to `WizardPrompter.text()`, the Clack and Headless adapters, and all gateway config prompts. Port `14242` now shows in the field. - **Bug 4 — Pi SDK missing from intro copy**: Updated the `"What is Mosaic?"` welcome note to include Pi SDK. ## Release `@mosaicstack/mosaic` bumped `0.0.25 → 0.0.26`. ## Test plan - [ ] `pnpm test` — all 570 tests pass (351 gateway + 219 mosaic) - [ ] `pnpm typecheck` — clean - [ ] `pnpm lint` — clean - [ ] `pnpm format:check` — clean - [ ] New e2e test `src/admin/bootstrap.e2e.spec.ts` — 4 tests, covers the regression 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jason.woltje added 1 commit 2026-04-05 21:40:02 +00:00
fix: bootstrap DTO class erasure + wizard failure + port prefill + Pi SDK copy (IUV-M01, #436)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
56dde4126b
- Bug 1 [CRITICAL]: drop `import type` on BootstrapSetupDto in bootstrap.controller.ts
  so NestJS preserves the class reference for design:paramtypes; ValidationPipe now
  correctly validates the DTO instead of 400ing on every field.
  Add e2e integration test (bootstrap.e2e.spec.ts) via @nestjs/testing + supertest
  that exercises the real DI/Fastify binding path to guard against regressions.
  Configure vitest to use unplugin-swc with decoratorMetadata:true.

- Bug 2: remove `&& headlessRun` guard in wizard.ts so bootstrap failure (completed:false)
  aborts with process.exit(1) in both interactive and headless modes — no more
  silent '✔ Wizard complete' after a 400.

- Bug 3: add `initialValue` to WizardPrompter.text() interface, ClackPrompter, and
  HeadlessPrompter; use it in gateway-config.ts promptPort() so 14242 prefills the
  input buffer and users can press Enter to accept. Apply same pattern to other
  gateway config prompts (databaseUrl, valkeyUrl, corsOrigin).

- Bug 4: add Pi SDK to the 'What is Mosaic?' intro copy in welcome.ts.

- Bump @mosaicstack/mosaic 0.0.25 → 0.0.26.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jason.woltje merged commit 0ae932ab34 into main 2026-04-05 21:43:31 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#440