60 lines
5.6 KiB
Markdown
60 lines
5.6 KiB
Markdown
# CP V2 — Agent Handover and Release Workflow
|
|
|
|
Updated: 2026-11-12. Source of truth: Forgejo `unimatrix/MC`.
|
|
Status must be checked live; do not assume this document means deployment succeeded.
|
|
|
|
## Non-negotiable rules
|
|
|
|
1. Preserve the live CP V1 at `https://cp.dunerealms.com/`. CP V2 is isolated at `https://cp.dunerealms.com/v2/` and must not replace V1.
|
|
2. Develop **one page at a time**, with reviewable commits per page. Current page: **Staff / Imperial Bureau → Citizens Registry** (`#bureau/user-management`). Next page only after this page is tested and accepted: **Imperial Permissions**.
|
|
3. Reuse actual V1 API contracts and artwork. Do not invent backend endpoints, claim unverified data is live, or enable untested destructive actions. Missing features get stable, responsive, static placeholders with clear integration status.
|
|
4. Design was accepted by the user. Preserve the approved dark forest-green/gold Alphastyle interface, V1 `sietch.webp` page banners, header/footer, compact balanced left/right menus, unique category/submenu icons and mobile layout.
|
|
5. **Preview after deployment must be the live `/v2/` staging route**, not GitHack. GitHack is historical design reference only.
|
|
6. User explicitly requests coding directly without Work mode. Avoid unnecessary repeated explanations.
|
|
7. Do not publish secrets, database credentials, temporary passwords or user data in screenshots, logs or previews.
|
|
|
|
## Repository locations
|
|
|
|
- CP server router: `website/control-panel/server.mjs`.
|
|
- Citizens API: `website/node/admin-registration.mjs`.
|
|
- V2 staged interface: `website/control-panel/public/cp-v2/index.html`.
|
|
- V2 citizen module: `website/control-panel/public/cp-v2/citizens-registry.mjs`.
|
|
- V1 frontend and styling: `website/control-panel/public/` (especially `panel.css`, `panel-layout.mjs`, `admin-registration.mjs`).
|
|
- Website CI/deploy: `.forgejo/workflows/web-deploy.yml`.
|
|
- CP V2 design-only PR: #202. Staff staging PR: #203 (merged 2026-11-12; verify status).
|
|
- Previous staging development branch: `feature/cp-v2-staff-citizens-api-20261112`.
|
|
- Historical GitHub design branch: `unimatrixgit/mcdune:preview/cp-v2-compact-unfolded-20261112`.
|
|
|
|
## Verified API contracts
|
|
|
|
`GET /api/admin/register-user`: existing V1 owner-authorized list of valid access ranks.
|
|
`POST /api/admin/register-user`: existing V1 owner-authorized registration; JSON `{username,email,ageBand,ranks}`, same-origin check, audited creation, first-login reset and one-time credentials. Never expose credentials after initial response.
|
|
`GET /api/admin/register-user?view=accounts&page=N`: newly added owner-authorized paginated listing. Returns `{accounts:[{id,username,displayName,primaryRank,createdAt}],page,pageSize,hasMore}`; page size 25.
|
|
`GET /api/auth/session`: existing session endpoint.
|
|
|
|
Owner checks occur server-side. V2 route is owner-restricted. Future per-role access must be implemented server-side before broadening access.
|
|
|
|
## Page-by-page engineering and release
|
|
|
|
1. Inspect V1 code and actual API contract, permission checks, database tables and current branch status.
|
|
2. Implement a **single page** in an isolated Forgejo branch, including UI, server routes, authorization, safe loading/empty/error states and meaningful tests.
|
|
3. Run `cd website && corepack pnpm install --frozen-lockfile && corepack pnpm build && corepack pnpm test`. Fix failures. Also run focused API/auth/security and UI tests. **Syntax-only checks are not enough to call a page complete.**
|
|
4. Review for V1 regressions, authentication bypass, unintended writes, missing audit, XSS and mobile issues. Preserve V1.
|
|
5. Open a PR to `main`; merge only after required checks pass and deployment is authorized. No force merge.
|
|
6. The Forgejo workflow `.forgejo/workflows/web-deploy.yml` triggers on `main` changes under `website/**`, runs Node 22, `pnpm build` and `pnpm test`, then SSHes the tested commit to the deployment process. **A development-branch commit does not deploy.**
|
|
7. Inspect the exact Actions run and deploy result. Test `https://cp.dunerealms.com/v2/` with a valid Owner session, then test API reads, forbidden access, pagination and registration in a controlled test account. Unauthenticated/unauthorized requests should be denied, not expose user data.
|
|
8. Verify V1 at `https://cp.dunerealms.com/` still works. Record commit, PR, CI run, deploy outcome and any blockers before moving to the next page.
|
|
9. If CI or deployment fails, fix on a new branch/commit; never claim the live URL works until verified. Do not bypass CI or overwrite V1.
|
|
|
|
## Current checkpoint (verify before resuming)
|
|
|
|
- PR #203: `https://www.dunerealms.com/git/unimatrix/MC/pulls/203`; merge accepted.
|
|
- Forgejo web CI run #33: `https://www.dunerealms.com/git/unimatrix/MC/actions/runs/33`. Last observed status: **running**; this is a snapshot, not a live assertion.
|
|
- Staging URL: `https://cp.dunerealms.com/v2/`. Previously returned Not Found before deployment. Do not call it live until verified.
|
|
- Citizens Registry frontend is mounted in staged V2 HTML and calls the new API; syntax and static route assertions passed. Full DB/browser/live checks were not yet established.
|
|
- If the URL is still Not Found after CI success, investigate the deployed server revision, the CP service restart and reverse-proxy path routing before modifying frontend design.
|
|
- User wants page-by-page live testing and a separate V2 link; next work remains Citizens Registry until it is functionally verified.
|
|
|
|
## Agent recovery checklist
|
|
|
|
Read this file, inspect PR #203 and Actions run #33, verify current `main` HEAD and deployed commit, inspect live `/v2/`, check V1 unaffected, run relevant tests, then continue the single active page. Report what was **actually** tested, not merely coded.
|

Staff