Files
waggle-os/docs/production-readiness/01B-DEPLOYMENT_PHASES.md
Oleg Maslov 0c3e2ead3b
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled
moving
2026-09-02 10:10:29 +02:00

141 lines
15 KiB
Markdown

# Phase 1B: Deployment, Phases & PM Features Audit
**Date**: 2026-03-20
**Auditor**: Claude (automated analysis)
**Scope**: Wave 9D (Deployment), Phase 7 (KVARK), Phase 8 status, PM Features (6)
---
## Wave 9D: Deployment (7 slices)
| Slice | Description | Status | Evidence | Gaps |
|-------|------------|--------|----------|------|
| 9D-1 | Tauri Windows build config | DONE | `app/src-tauri/tauri.conf.json` — NSIS installer configured: `"targets": ["nsis"]`, install mode `currentUser`, installer icon, English language. Resources bundled via `"resources": ["resources/*"]`. | No MSI target (NSIS only). No WiX installer alternative for enterprise IT deployment. |
| 9D-2 | Tauri macOS build config | NOT STARTED | `tauri.conf.json` has no DMG section, no macOS-specific bundle config, no universal binary settings, no code signing placeholders. No `Cargo.toml` found in `app/src-tauri/`. | Missing: DMG target, universal binary (aarch64 + x86_64), code signing identity placeholder, notarization config, entitlements file. |
| 9D-3 | `npx waggle` launcher | DONE | `packages/launcher/package.json``"bin": { "waggle": "./src/cli.ts" }`, name `"waggle"`. CLI entry point at `packages/launcher/src/cli.ts` with `--port`, `--skip-litellm`, `--no-open` flags. Opens browser on start. | `bin` points to `.ts` file directly (requires `tsx` at runtime). No pre-compiled JS entry point for `npx` distribution. No `prepublishOnly` build script. |
| 9D-4 | Web frontend prod build | PARTIAL | `app/vite.config.ts` — output to `dist/`, source maps enabled, `@tauri-apps/*` marked as external. Rollup handles Tauri API conditionals. Dockerfile runs `cd app && npm run build`. | Tauri packages are excluded via `external` — good for Tauri mode, but web-only mode needs runtime guards or stubs. No explicit `define` for `__TAURI__` environment detection. |
| 9D-5 | Docker Compose | DONE | `docker-compose.production.yml` — 3 services (waggle, postgres:16-alpine, redis:7-alpine). Health checks on all services. Named volumes for persistence. Environment variables for API keys. `Dockerfile` is a proper multi-stage build (node:20-alpine builder + production). | No TLS/HTTPS configuration. No resource limits (memory, CPU). No log rotation config. |
| 9D-6 | Render blueprint | DONE | `render.yaml` — web service (node runtime, starter plan), managed PostgreSQL, managed Redis. Health check on `/health`. 10GB persistent disk. Auto-deploy enabled. All required env vars listed with `sync: false` for secrets. | Plan is `starter` (may be insufficient for production load). No scaling config. No custom domain setup. |
| 9D-7 | Auto-update | PARTIAL | `tauri.conf.json` plugins section has `"updater"` with endpoint pointing to `https://github.com/marolinik/waggle/releases/latest/download/latest.json`. | `pubkey` is empty string — updates won't verify without a signing key. No frontend UI for update notifications found. No Tauri updater plugin usage in frontend code. |
### Wave 9D Summary
- **Done**: 3/7 (Docker Compose, Render blueprint, npx launcher)
- **Partial**: 2/7 (Web frontend prod build, Auto-update)
- **Not Started**: 1/7 (macOS build config)
- **Done but with gaps**: 1/7 (Windows build config)
---
## Phase 7: KVARK Integration Status
### Source Files
| File | Path | Lines | Status |
|------|------|-------|--------|
| kvark-types.ts | `packages/server/src/kvark/kvark-types.ts` | 203 | REAL — Full TypeScript types verified from KVARK Pydantic DTOs. Covers: auth, search, document ask, feedback, governed actions, chat SSE events, 5 typed error classes. |
| kvark-auth.ts | `packages/server/src/kvark/kvark-auth.ts` | 107 | REAL — JWT login, token caching, auto-invalidation on 401. Injectable fetch for testing. |
| kvark-client.ts | `packages/server/src/kvark/kvark-client.ts` | 217 | REAL — Full HTTP client: search, askDocument, feedback, action, ping. 401 retry logic. Timeout handling. Proper error classification (auth/404/501/5xx). |
| kvark-config.ts | `packages/server/src/kvark/kvark-config.ts` | 45 | REAL — Loads KVARK connection config from Waggle vault (`kvark:connection` key). |
| index.ts | `packages/server/src/kvark/index.ts` | 24 | Barrel export — re-exports all types and classes. |
### Test Files
| Test File | Path | Coverage |
|-----------|------|----------|
| kvark-client.test.ts | `packages/server/tests/kvark/kvark-client.test.ts` | Mocked fetch: search, askDocument, ping, error handling, 401 retry |
| kvark-auth.test.ts | `packages/server/tests/kvark/kvark-auth.test.ts` | Login, token caching, invalidation |
| kvark-config.test.ts | `packages/server/tests/kvark/kvark-config.test.ts` | Vault config loading |
| kvark-types.test.ts | `packages/server/tests/kvark/kvark-types.test.ts` | Type/error class verification |
| kvark-integration-smoke.test.ts | `packages/server/tests/kvark/kvark-integration-smoke.test.ts` | Full chain: vault config -> client -> auth -> tools -> output (mocked HTTP) |
| kvark-wiring.test.ts | `packages/server/tests/kvark/kvark-wiring.test.ts` | Wiring verification |
### Agent-Side KVARK Integration
| Component | Path | Status |
|-----------|------|--------|
| kvark-tools.ts | `packages/agent/src/kvark-tools.ts` | REAL — `kvark_search` and `kvark_ask_document` agent tools. Interface-based dependency (`KvarkClientLike`). Structured result parsing with attribution. |
| combined-retrieval.ts | `packages/agent/src/combined-retrieval.ts` | REAL — Milestone B combined retrieval engine. Merges workspace memory + personal memory + KVARK results. Source attribution, conflict detection, graceful KVARK degradation. |
### KVARK Wiring Status
| Milestone | Description | Status | Evidence |
|-----------|------------|--------|----------|
| A: Retrieval Bridge | Client, auth, config, kvark_search/kvark_ask tools | DONE | 5 source files, 6 test files, all real implementations |
| B: Combined Retrieval | Memory + KVARK merge, source attribution | DONE | `combined-retrieval.ts` implements merge engine with conflict detection |
| C: Feedback Loop | kvark_feedback tool | DONE | `KvarkClient.feedback()` implemented, `KvarkFeedbackRequest/Response` types present |
| D: Governed Actions | kvark_action tool, connector awareness | DONE | `KvarkClient.action()` implemented with governance payload, `KvarkActionRequest/Response` types |
| E: Product Hardening | UI, error handling, integration tests | PARTIAL | Integration smoke test exists. Error handling robust (5 typed error classes). **No KVARK UI in frontend.** KvarkClient is NOT wired into server index.ts. |
### Phase 7 Assessment
**Milestone A-D: COMPLETE.** All client-side code, types, and tools are real implementations with tests.
**Milestone E: PARTIAL.** The KvarkClient is not imported or instantiated in `packages/server/src/local/index.ts` — it exists as library code but is not wired into the running server. No KVARK-specific UI components found in the frontend. The marketplace route checks `getKvarkConfig()` for enterprise packs, which is the only live KVARK reference in server routes.
---
## Phase 8: Activate, Execute, Harden
### Design Spec
No Phase 8 design spec found at the expected path (`docs/superpowers/specs/2026-03-18-phase8-activate-execute-harden-design.md`). However, two Phase 8 review documents confirm waves 8A-8D were implemented:
- `docs/phase8-review-findings.md` — Code review of 73 files, 11,498 lines across 8A-8D
- `docs/phase8-simplification-report.md` — Clean bill of health, no dead code
### Wave Status
| Wave | Description | Status | Evidence |
|------|------------|--------|----------|
| 8A | Activate the Arsenal (marketplace, auto-routing, agent intelligence) | DONE | `packages/marketplace/src/security.ts` — SecurityGate with 4-layer verification (Gen Trust Hub, Cisco Scanner, MCP Guardian, heuristics). Enterprise packs gated by KVARK config. |
| 8B | Tool Parity + Extensions (LSP, browser, enhanced tools) | DONE | `packages/agent/src/browser-tools.ts`, `packages/agent/src/lsp-tools.ts`, `packages/agent/src/cli-tools.ts` all exist in agent src directory. |
| 8C | Execution Layer (connector SDK, core connectors, CLI-Anything) | DONE | `packages/agent/src/connector-sdk.ts`, `packages/agent/src/connector-registry.ts`, 28 connectors in `packages/agent/src/connectors/` (GitHub, Slack, Jira, Email, GCal, Discord, Linear, Asana, Trello, Monday, Notion, Confluence, Obsidian, HubSpot, Salesforce, Pipedrive, Airtable, GitLab, Bitbucket, Dropbox, Postgres, Gmail, Google Docs/Drive/Sheets, Composio, MS Teams, Outlook, OneDrive). Phase 8 review confirms all critical security findings FIXED. |
| 8D | Swarm & Parallel (Waggle Dance live, parallel workspaces) | DONE | `packages/waggle-dance/` package with protocol, dispatcher, and hive-query modules. `packages/worker/src/handlers/waggle-handler.ts` for worker dispatch. Integration + dispatcher tests present. |
| 8E | Harden & Ship (E2E scenarios, benchmarks, installer, regression) | PARTIAL | NSIS installer configured. Regression test exists (`app/tests/e2e/regression.test.ts`). No benchmark framework found. Phase 8 review doc confirms code review completed. |
| 8F | UI/UX Overhaul (shadcn/ui, surface hidden features) | EVIDENCE UNCLEAR | No explicit Phase 8F marker. shadcn/ui components present in `app/src/components/ui/` (Card, etc.) but unclear if this was Phase 8F work or pre-existing. |
| 8G | Fortify (code review, security audit, dependency cleanup) | DONE | `docs/phase8-review-findings.md` documents 73-file review. All Critical and High findings FIXED (URL path encoding, approval gate bypass, Map mutation, orphaned vault entries, sequential strategy output, coordinator synthesis). `docs/phase8-simplification-report.md` confirms clean code. |
### Phase 8 Assessment
**Waves 8A-8D: CONFIRMED COMPLETE** by code review docs (73 files, 11,498 lines).
**Wave 8E: PARTIAL** — installer present, regression test exists, but no benchmark suite.
**Wave 8F: UNCLEAR** — evidence of shadcn/ui components but no explicit Phase 8F tracking.
**Wave 8G: COMPLETE** — comprehensive security review with all critical/high findings resolved.
---
## PM Features (6)
| # | Feature | Status | Evidence | Gaps |
|---|---------|--------|----------|------|
| PM-1 | Workspace Templates | DONE | `packages/server/src/local/routes/workspace-templates.ts` — 6 built-in templates (Sales Pipeline, Research Project, Code Review, Marketing Campaign, Product Launch, Legal Review). Each template defines persona, connectors, suggested commands, and starter memory. GET/POST endpoints. `packages/ui/src/components/workspace/CreateWorkspaceDialog.tsx` supports "Use template" mode with template picker. | No template deletion endpoint. No template preview/edit UI. |
| PM-2 | GDPR Export | DONE | `packages/server/src/local/routes/export.ts``POST /api/export` generates a ZIP containing: memories (personal + workspace frames as JSON), sessions (as markdown transcripts), workspace configs, settings (API keys masked), vault metadata (names only, NO secret values), telemetry. Uses `archiver` for ZIP creation. | No UI button found for triggering export. No data deletion endpoint ("right to erasure"). No export progress indicator. |
| PM-3 | Session Replay | DONE | `packages/ui/src/components/events/SessionTimeline.tsx` — clickable vertical timeline of tool events with timestamps, tool name, status dot, duration. Expand to see full input/output as JSON. Sub-agent calls render as nested child events. `app/src/views/EventsView.tsx` wraps it with "live" vs "replay" tab toggle. Session list loaded from `/api/workspaces/:id/sessions`. | Timeline is tool-event focused, not a full conversational replay (no message text in timeline). |
| PM-4 | Cost Dashboard | DONE | `app/src/components/cockpit/CostDashboardCard.tsx` — full-featured cost card: today's token usage (input/output/cost), daily budget alert with progress bar, 7-day trend bar chart, per-workspace breakdown (top 5), all-time totals. `packages/server/src/local/routes/cost.ts` — REST API with `/api/cost/summary` and `/api/cost/by-workspace`. `packages/agent/src/cost-tracker.ts` tracks per-turn usage. | Costs are estimates (acknowledged in UI disclaimer). Data resets on server restart (in-memory only). No historical cost persistence. |
| PM-5 | Backup/Restore | DONE | `packages/server/src/local/routes/backup.ts` — 3 endpoints: `POST /api/backup` (create encrypted archive), `POST /api/restore` (restore from archive, supports preview mode), `GET /api/backup/metadata` (last backup info). AES-256-GCM encryption using vault key. Gzip compression. `.waggle-backup` file format with magic header. Path traversal prevention. Conflict detection. Excludes marketplace.db (auto-resyncs). | No scheduled/automatic backups. No UI for backup/restore in Settings. Unencrypted fallback when no vault key exists. |
| PM-6 | Offline Mode | DONE | `packages/server/src/local/offline-manager.ts` — OfflineManager class with periodic LLM health checks (30s default), offline state tracking, persistent message queue. Emits SSE notifications on state transitions ("Back online" / "Offline"). `packages/server/src/local/routes/offline.ts` — 5 REST endpoints (status, queue CRUD). `app/src/App.tsx` polls `/api/offline/status` and passes offline state to UI. | No offline indicator component visible in main UI. Message queue replay is manual (no auto-send on reconnect). Health check probes LLM endpoint only, not local services. |
### PM Features Summary
- **All 6 PM features: DONE** with server-side implementations
- **Common gap**: Several features have API routes but limited or missing frontend UI integration (GDPR export button, backup/restore settings panel, offline indicator)
---
## Cross-Cutting Findings
### Critical Gaps
1. **macOS deployment entirely missing** — No DMG, no code signing, no universal binary, no notarization. Cannot ship to macOS users.
2. **Auto-update pubkey empty** — Tauri updater is configured but `pubkey: ""` means updates cannot be verified. Must generate and embed a signing key before release.
3. **KVARK not wired into running server** — All Milestone A-D code exists as library code but KvarkClient is never instantiated in the server boot path. Enterprise users cannot use KVARK search.
4. **`npx waggle` bin points to .ts** — The launcher package `bin` field points to `./src/cli.ts` which requires `tsx` runtime. This will fail for users who run `npx waggle` without `tsx` installed globally.
### Notable Strengths
1. **28 connectors implemented** — Far exceeding the "5 core" target from the V1 plan.
2. **Docker production setup is solid** — Multi-stage Dockerfile, health checks on all services, proper volume management.
3. **Backup/restore uses AES-256-GCM** — Enterprise-grade encryption for data portability.
4. **Cost tracking is comprehensive** — Per-workspace breakdown, budget alerts, 7-day trends.
5. **Phase 8 security review completed** — All critical and high findings resolved.
### Recommendations for V1 Ship
1. Generate Tauri updater signing key and embed pubkey
2. Add macOS bundle config (DMG + code signing) or explicitly defer to V1.1
3. Wire KvarkClient into server index.ts or document KVARK as V1.1
4. Add `prepublishOnly` build script to launcher package to compile TS -> JS
5. Add frontend UI for GDPR export, backup/restore, and offline indicator
6. Persist cost data to SQLite to survive server restarts