# Phase register and scope locks Implement one explicitly approved phase at a time. Keep out-of-scope files, existing authentication machinery and production systems unchanged. ## P01 — Foundation (COMPLETE) - Baseline commit `8f54ccb30426f2955472c0cd40fb94d0b18e86ac`. - Initial monorepo folder structure, docs, project Git identity and clean commit completed. ## P02 — ZITADEL local backend (APPROVED 2026-11-22) - **Allowed source writes:** `core/backend/zitadel/**`, `deployment/docker/compose.backend.dev.yaml`, `.env.example`, backend-focused `tests/**`, and narrow `docs/**` / `README.md`. - Official versioned ZITADEL v4 backend image, local PostgreSQL persistence, secure random dev secret generation, first-admin bootstrap and health checks. - Official prebuilt Login V2 image as a **runtime dependency only** (v4 Admin Console login requires it); no Login V2 source import. - No backend Go source vendoring, UI redesign, public domain, Coolify deploy, production keys, remote push or changes to unrelated files. - Verify: static focused test/patch audit; with Docker available, live startup/ready/Admin Console, persistent DB after restart and shutdown. - **Execution evidence:** Docker CLI/Desktop absent on connected Windows PC; live Compose startup, admin login and persistence remain NOT VERIFIED. Prior P02 static checks are recorded in `docs/P02-EVIDENCE.md`. - **P02-RUNTIME-ACCEPTANCE-01 instruction update (2026-11-22):** user explicitly deferred all local test/dev execution to a future Gitea Actions phase; this is a source handoff, **not** runtime acceptance. Existing source is committed; authorized push to `vibtools/ZitPlane` is in scope. CI workflow creation and UI import remain outside P02. - Existing unrelated untracked `AI_INSTRUCTIONS.md` must remain untouched. ## P03 — Official Login V2 source import (APPROVED 2026-11-22; SOURCE IMPLEMENTED) - **Baseline:** `eadd0e558b459061e48583192badfc0579e95140`. - **Write Scope:** `auth/ui/v2/**` (Login V2 and required upstream workspace files), narrow `README.md` and `docs/**` (P03 source/phase notes). No other files. - **Upstream tag:** `v4.20.4` at `384bb9ec96b501ad39dc232ee2061a40fe180bbd`, matching P02 Go backend image. - Import `apps/login`, `packages/zitadel-client`, `packages/zitadel-proto`, `proto`, root pnpm/Nx/build files and licensing **nested under `auth/ui/v2/`**. Preserve auth/UI behavior. Exclude upstream environment files; never commit secrets. - User explicitly requested **no local builds, tests, dev servers or deployments**. Only source/provenance/patch audit, documentation, Git commit and approved Gitea push. CI deferred. - P02 prebuilt Login UI remains configured in the development Compose; do **not** replace it or call runtime acceptance complete. - Evidence and known gaps: `docs/P03-SOURCE-IMPORT.md`. CI workflow not part of this scope. ## P04 — User Account Portal foundation (APPROVED 2026-11-22; SOURCE IMPLEMENTED) - **Baseline:** `4404849fc4bd30c7b4b7cabe7caed54cbd7cd37d`. - **Exact Write Scope:** `users/ui/**`, narrow project `README.md` and relevant `docs/**` (phase/evidence/architecture/developer guide). **P02/P03 source read-only.** - Separate compact Next.js portal, ZITADEL OIDC/PKCE authentication, server-protected user routes, read-only profile and security settings structure. - Real OIDC only; no fake production auth, browser admin credentials, billing or user-management mutation endpoints. Existing ZITADEL core/Login V2 untouched. - Explicitly **no local builds, tests, dev server, Docker or deployment**. Source-level audit only, Git commit and approved Gitea main push. Gitea Actions testing deferred; no CI workflow in this scope. - Evidence and pending runtime acceptance: `docs/P04-ACCOUNT-PORTAL.md`. ## P05 — Integration (proposed, NOT approved) Local development, shared UI tokens as needed, production-safe Docker topology, routing drafts, tests/docs. No live deployment. ## P06 — UI redesign (proposed, NOT approved) Compact login and account UI, accessibility, responsive design and scoped regressions. Protected authentication semantics unchanged. ## P07 — Production deployment (proposed, NOT approved) Coolify, HTTPS, secrets, backups, durable storage and focused production readiness; explicit approval required.