VOLKREX DOCS OBSERVER

OBSERVER_LEDGER.md

# Observer Ledger

## 2026-12-03 — Wave 1 started
- Archive source: `/Users/sahil/crankupit-archive/2026-12-03-full-backup/` (14/14 bundles verified, 17,329 checksums).
- Old repos removed from local workspace; clean repos cloned into `/Users/sahil/dev`.
- Wave 1 scope: `volkrex-docs`, `crankupit-core`, `crankupit-ui-tokens`, `crankupit-auth`.
- Rules: no legacy ceremony (`signs/`, `tutors/`, `workers/`, `outlines/`, `*Css.ts` workarounds). 4-part slice parity. 4 safety gates.

## Wave 1 completion
- `volkrex-docs`: observer files established (OBSERVER_STATE.json, OBSERVER_LEDGER.md, DECISIONS_ADR.md, TOPOLOGY_MAP.md).
- `crankupit-core`: TypeScript ESM/Node22+ kernel; Result ok/err, ULID, deterministic redaction, Postgres/Fastify primitives; reusable gate scripts exported (`verify:architecture`, `verify:singleton-contract`, `verify:design-tokens`, `verify:composition-contracts`). `npm test` + `npm run verify` PASS.
- `crankupit-ui-tokens`: VxPaletteConst (#000000, #edd05e/#eed15e, #f5f5f5, brand presets), canonical `src/tokens.css` with `--vx-*`, Anton display typography, base primitives. `verify:design-tokens` PASS with 0 raw hex leaks outside canonical token files. `npm test` + `npm run verify` PASS.
- `crankupit-auth`: token hash/issue/verify/revoke, AuthScopePolicy explicitly isolating platform/agency/brand/support scopes, contract snapshot tests. `npm test` + `npm run verify` PASS.
- No legacy ceremony (`signs/`, `tutors/`, `workers/`, `outlines/`, `*Css.ts` workarounds) introduced.


## 2026-12-03 — Wave 2 complete
- **DB isolation (crystal clear):** Tenant/brand workloads run in isolated Postgres DBs `brand_<id>` (zero shared multi-tenant tables). Employee/operator monitoring runs in isolated Postgres DBs `emp_<id>` with mandatory PII/token/OTP/clinical-note redaction before persistence.

### crankupit-mesh (`afc1ebd`)
- `src/slices/mesh/MeshPolicy.ts` - peer CIDR/key validation, heartbeat staleness rules, VRX relay validator completeness.
- `src/slices/mesh/MeshService.ts` - peer registry, heartbeat tracking, deterministic wg0.conf renderer.
- `src/slices/mesh/MeshService.test.ts` (covered by `src/test/mesh.test.ts`).
- `src/slices/host-db/HostDbPolicy.ts` - strict naming/boundary enforcement separating `brand_<id>` from `emp_<id>`, Docker stack & Sentinel SSHD guards.
- `src/slices/host-db/HostDbService.ts` - isolated Postgres DB provisioner, health/vitals inspector, live relocation helpers.
- `src/slices/host-db/HostDbService.test.ts` (covered by `src/test/host-db.test.ts`).
- Tests: 5 pass. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS (no contract tests).

### crankupit-storage (`ff97892`)
- `src/slices/storage-backup/StorageBackupPolicy.ts` - CDN hot-tier quota rules, snapshot path safety, retention policies.
- `src/slices/storage-backup/StorageBackupService.ts` - object/asset operations, encrypted-ready snapshot/restore workflows for `brand_<id>` and `emp_<id>` DBs.
- `src/slices/storage-backup/StorageBackupService.test.ts` (covered by `src/test/storage-backup.test.ts`).
- `src/slices/telemetry/TelemetryPolicy.ts` - emp DB naming/boundary, audit event validation.
- `src/slices/telemetry/TelemetryService.ts` - mandatory redaction via `@crankupit/core` before write; writes operator activity/audit to isolated `emp_<id>` DB and records Wave-B usage metering.
- `src/slices/telemetry/TelemetryService.test.ts` (covered by `src/test/telemetry.test.ts`).
- Tests: 3 pass. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS (no contract tests).

### volkrex-nodes (`2d6502d`)
- `src/slices/operator-guard/ConsoleAccessPolicy.ts` - pure access policy.
- `src/slices/operator-guard/ConsoleOperatorGuardAdapter.ts` - single-send 401/403 guard; returns null; zero internal leak.
- `src/slices/nodes-api/NodesRoutes.ts` - authenticated internal endpoints for node registration, heartbeat, wg0.conf render, `brand_<id>`/`emp_<id>` DB provisioning & health, snapshot triggers, telemetry ingestion; single-send.
- `src/slices/nodes-api/NodesRoutes.test.ts` + `src/test/nodes-api.contract.test.ts` - single-send & auth-scope contract snapshots.
- `src/slices/nodes-ui/NodesPage.tsx` + `NodesPage.css` - `VxPaletteConst`/`--vx-*` tokens, `#000000` void canvas, `#eed15e` gold alt, Anton display headings, no inline style/raw hex.
- `src/test/NodesUi.test.tsx` - UI/token assertions.
- `src/main.ts`, `Dockerfile` (docker build --check PASS).
- Tests: 7 pass. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS (1 contract test).

### volkrex-docs
- Observer state/ledger updated for Wave 2.


## 2026-12-03 — Step 0: crankupit-verify CLI centralization
- `crankupit-core` (`c46ba95`): added `bin/crankupit-verify.mjs` exposing `verify:architecture`, `verify:singleton-contract`, `verify:design-tokens`, `verify:composition-contracts` via single CLI; `npm run verify` wired to CLI.
- Removed duplicated `scripts/verify-*.mjs` and wired `"verify":"crankupit-verify"` in: `crankupit-ui-tokens` (`89eb19a`), `crankupit-auth` (`e74fde8`), `crankupit-mesh` (`5f0eb2e`), `crankupit-storage` (`fe1a50e`), `volkrex-nodes` (`1011543`). All gates pass.

## 2026-12-03 — Wave 3 complete
- **DB isolation:** `brand_<id>` tenant DBs (zero shared multi-tenant tables); `emp_<id>` employee/operator monitoring DBs with mandatory PII/token/OTP/clinical-note redaction before persistence.
- **CSP/visual:** VxPaletteConst/`--vx-*` tokens only; `#000000` void, `#eed15e/#edd05e` gold, `#f5f5f5` ink, Anton display; edge CSP includes explicit `img-src 'self' data:`.

### crankupit-edge (`8a21e7a`)
- `src/slices/edge-routing/EdgePolicy.ts` - custom domain validation, TLS/route rules, strict Origin/Referer anti-spoof rules, CSP builder with `img-src 'self' data:`.
- `src/slices/edge-routing/EdgeService.ts` - Caddy route compiler & header/CSP policy builder.
- Tests: 3 pass (including contract). Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS.

### crankupit-brand (`a1c7597`)
- `brand-core`: BrandPolicy/BrandService - brand registry, domain verification, `brand_<id>` DB binding, anti-bot/form submission, Wave-B metering hooks.
- `salon`: SalonPolicy/SalonService - booking kinds/fields, owner lead/booking queries.
- `clinic-care`: ClinicCarePolicy/ClinicCareService - `in-clinic` vs `teleconsult`, mandatory `consentAccepted===true`, deterministic redaction of `REDACTED_CLINICAL_NOTE_KEYS` before persistence/telemetry.
- `diagnostic-lab`: DiagnosticLabPolicy/DiagnosticLabService - test panels/packages, `walk-in` vs `home-collection`, fasting/pincode rules, patient consent & sample-notes redaction.
- Tests: 6 pass (including contract). Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS.

### volkrex-agencies (`fd595b5`) - container ready
- Composes core/auth/brand/ui-tokens. Dockerfile present.
- `agencies-api/AgenciesRoutes.ts` - authenticated agency routes enforcing AuthScopePolicy agency role scopes for multi-brand creation/management, domain verification, agency-scoped node allocation, DNS/CNAME readiness, Wave-B topups/billing, cross-brand leads/bookings; single-send. `AgenciesRoutes.test.ts` + contract test.
- `agencies-ui/AgenciesPage.tsx` + `AgenciesPage.css` - high-contrast VxPaletteConst/`--vx-*`, responsive 390x844+1280x800, no sidebar click interception, no raw hex/inline style/data: violations. `AgenciesUi.test.tsx`.
- Tests: 4 pass. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS. `docker build --check` PASS.

### volkrex-brands (`defa9cc`) - container ready
- Composes core/auth/edge/brand/ui-tokens. Dockerfile present.
- `brands-api/BrandsRoutes.ts` - trusted-host tenant resolver, public storefront/booking endpoints for Salon/ClinicCare/DiagnosticLab, brand-owner daily desk under `brand:*` scopes, Wave-B metering hooks; single-send. `BrandsRoutes.test.ts` + contract test (redaction, single-send).
- `brands-ui/BrandsPage.tsx` + `BrandsPage.css` - industry presets (Salon/ClinicCare/DiagnosticLab), VxPaletteConst/`--vx-*`, no inline style/raw hex. `BrandsUi.test.tsx`.
- Tests: 4 pass. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS. `docker build --check` PASS.

### volkrex-docs
- Observer state/ledger updated for Step 0 and Wave 3.


## 2026-12-03 — Wave 4 complete: volkrex-e2e and release pipeline
### volkrex-e2e (`a6e5fde`)
- Wired `verify: crankupit-verify` via `@crankupit/core` (zero duplicated gate scripts).
- Deterministic cross-container integration tests:
  1. **Cross-container flow:** volkrex-nodes (node registration, `brand_<id>` & `emp_<id>` DB isolation, ConsoleOperatorGuardAdapter single-send 401/403) <-> volkrex-agencies (agency role scope isolation, multi-brand creation across domains, agency-scoped node allocation, DNS/CNAME readiness, Wave-B credit topups) <-> volkrex-brands (trusted-host resolution, Salon/ClinicCare/DiagnosticLab public bookings + owner desk).
  2. **Security & redaction:** clinical notes (`REDACTED_CLINICAL_NOTE_KEYS`), sample notes, tokens, OTPs never leak into `emp_<id>` telemetry, Wave-B audit logs, or HTTP responses; ClinicCare and DiagnosticLab enforce `consentAccepted === true`.
  3. **Visual/CSP/viewport:** VxPaletteConst/`--vx-*` tokens across desktop 1280x800 and mobile 390x844 layouts, explicit CSP `img-src 'self' data:` verified, zero sidebar click interception.
- Tests: 12 pass, 0 fail. Gates: architecture PASS, singleton-contract PASS (0), design-tokens PASS (0), composition-contracts PASS (3 contract tests).

### Code -> Commit -> Stage -> Version -> Production assets (volkrex-docs)
- `deploy/docker-compose.base.yml`, `deploy/docker-compose.stage.yml` (`volkrex-stage`), `deploy/docker-compose.prod.yml` (`volkrex-prod`) - isolated networks, Postgres volumes, Caddy reverse proxy, 127.0.0.1 / wg0 internal bindings.
- `deploy/Caddyfile` - explicit CSP `img-src 'self' data:`.
- `scripts/promote-release.mjs` - Stage: build `:stage`, deploy `/opt/volkrex/stage`, health + volkrex-e2e checks; Version: tag immutable `vX.Y.Z` only after Stage E2E passes; Production: deploy immutable `vX.Y.Z` to `/opt/volkrex/prod` with zero-downtime health verification and automatic snapshot hook via `crankupit-storage`.

### Full 12-repo readiness
- Workers: crankupit-core, crankupit-ui-tokens, crankupit-auth, crankupit-mesh, crankupit-storage, crankupit-edge, crankupit-brand - READY.
- Containers: volkrex-nodes, volkrex-agencies, volkrex-brands - READY (tests/verify/docker check green).
- E2E/Docs: volkrex-e2e, volkrex-docs - READY.


## 2026-12-03 — VPS Stage/Prod configuration bundle (sanitized templates only)
- Added `deploy/stage.env.example`, `deploy/prod.env.example`, `deploy/wg0.server.conf.example`, `deploy/wg0.client.conf.example`.
- Local git-ignored bundle generated at `/Users/sahil/dev/.vps-bundle/` (stage/prod `.env` with `openssl rand -hex 32` secrets, chmod 600; never committed).
- `docker compose config` validation: STAGE_VALID, PROD_VALID.
- Transfer/deploy commands provided for `volkrex-vps:/opt/volkrex/{stage,prod}`.

## 2026-12-03 — VPS Deployment & Release Runbook
- Added `RUNBOOK_DEPLOY.md` with full Stage/Production VPS workflow, DNS checks, WireGuard references, and rollback notes. Zero raw secrets confirmed.

## 2026-12-03 — Stage promotion fix & live readiness
- `promote-release.mjs`: auto-resolves REPO_ROOT, docker build cwd=REPO_ROOT with stdio inherit, explicit `--env-file` for every docker compose command, syncs only compose/Caddyfile (no .env overwrite), wait/retry health for Postgres+nodes+agencies+brands+Caddy before volkrex-e2e.
- `volkrex-nodes/agencies/brands`: added minimal HTTP `/health` servers (4101/4102/4103) for Stage/Prod health checks.
- RUNBOOK_DEPLOY.md updated with auto-root resolution and explicit env-file/sync behavior.

## 2026-12-03 — Docs Observer service
- Added volkrex-docs HTTP observer service (port 4104, /health, rendered/raw observer views) with Dockerfile, crankupit-verify, docker build --check.
- Wired DOCS_DOMAIN into compose/Caddy/promote-release; stage-docs.volkrex.cloud / docs.volkrex.cloud.