{
  "updated": "2026-10-09",
  "scope": "Read-only infrastructure verification and planned Octimo-only deployment. No database, DNS or service mutation was performed for this plan.",
  "observed": [
    [
      "Public hostname",
      "octimo.worksquares.ai",
      "A record resolves to 51.195.88.132."
    ],
    [
      "DNS authority",
      "worksquares.ai",
      "ns53.domaincontrol.com and ns54.domaincontrol.com; keep the same existing zone."
    ],
    [
      "OVH host",
      "51.195.88.132",
      "SSH read-only probe succeeded; hostname dev; existing personal ovh_key used without printing credentials."
    ],
    [
      "PostgreSQL",
      "17.11",
      "One Octimo database observed: octimo_db. Owner/login role octimo_app is not superuser and has no BYPASSRLS."
    ],
    [
      "Foundation",
      "6 migrations / 22 tables",
      "Applied 2026-10-04. Schemas: core 4, iam 9, ops 6, privacy 3. Local SHA-256 prefixes match the migration ledger."
    ],
    [
      "Row security",
      "15 tables with forced RLS",
      "Counts observed: core 3, iam 6, ops 4, privacy 2. Presence of policies is not proof of tenant-isolation correctness."
    ],
    [
      "API runtime",
      "octimo-api:latest",
      "Healthy container on 127.0.0.1:3140 → 3000. Image tag is not an immutable source-commit receipt."
    ],
    [
      "Runtime mode",
      "development / dev auth",
      "DB_USER=octimo_app; DB_SSL=false. Dedicated runtime/grading roles and public production authentication remain to be implemented."
    ],
    [
      "nginx",
      "/etc/nginx/sites-available/octimo-worksquares-ai",
      "Static root /var/www/octimo. Public /api/v1/health/ is proxied; other /api/ routes return 404."
    ],
    [
      "TLS",
      "Existing Certbot certificate",
      "nginx references /etc/letsencrypt/live/octimo.worksquares.ai/. Successful external HTTPS probes verify current serving, not future renewal."
    ],
    [
      "Protected environment",
      "/opt/octimo/api.env",
      "Only non-secret configuration fields were inspected; credential values were neither printed nor added to docs."
    ],
    [
      "Independent checks",
      "Public HTTPS and DNS",
      "Landing/prototype/live/ready: HTTP 200. /api/v1/me: HTTP 404 as expected. API npm run verify: 7 suites, 17 tests, lint, typecheck and build passed."
    ]
  ],
  "targets": [
    [
      "Development",
      "octimo_db",
      "Existing octimo_app owner; introduce separate scoped runtime roles",
      "Existing development site remains the baseline; never run parallel test suites or destructive reset here."
    ],
    [
      "Automated integration",
      "Disposable PostgreSQL per test run",
      "Ephemeral test roles",
      "Run locally or in CI; never aim destructive tests at shared OVH."
    ],
    [
      "Staging",
      "octimo_staging (proposed)",
      "Separate migrator, runtime and grading/authoring privileges",
      "Separate secrets and data; test migrations, restore and full authenticated user journeys."
    ],
    [
      "Production",
      "octimo_prod (proposed)",
      "Dedicated least-privilege logins; no schema-owner runtime",
      "Provision before live learner data. Reuse the existing public hostname at the final controlled release switch."
    ]
  ],
  "steps": [
    {
      "title": "Recheck target and preserve the baseline",
      "details": "Inspect current DNS, host capacity, Octimo processes/ports, nginx path, current image IDs and database ledger. Record the exact source commits. Follow WorkSquares manual-release practices without assuming its product-specific gates or scripts already support Octimo.",
      "proof": "Release manifest identifies Octimo resources and the existing WorkSquares zone; unrelated databases/sites/containers are out of scope."
    },
    {
      "title": "Provision isolated Octimo databases and roles",
      "details": "Keep octimo_db intact. Create the named staging/production targets only after existence/owner checks; use separate migration and runtime credentials, SCRAM authentication, private or encrypted transport, scoped grants and no runtime BYPASSRLS. Put secrets in protected environment files or the existing secret store.",
      "proof": "Role/privilege matrix, RLS tests and no direct runtime access to privacy.user_private or protected keys. No password appears in Git, HTML or logs."
    },
    {
      "title": "Back up and restore before migration",
      "details": "Capture a consistent Octimo database backup and required asset/config metadata. Restore into an isolated target and verify the ledger, representative counts and login/attempt contracts. Set retention and encryption for backups.",
      "proof": "Restored backup receipt meets the selected RPO/RTO. An untested dump does not satisfy this step."
    },
    {
      "title": "Build a reproducible candidate",
      "details": "Build pinned API/UI/worker images from exact source commits, include release labels, and use protected environment configuration. Select free loopback candidate ports after inspection. Run migrations as a one-off task with advisory lock and checksum validation.",
      "proof": "Build/test receipts and exact image digests. Migrations are forward-only; already-applied SQL files are never edited."
    },
    {
      "title": "Connect identity and keep exam data private",
      "details": "Configure the selected OIDC provider and same-origin session callbacks. Run real Student/Admin/Guardian/Teacher acceptance against staging. Keep the current nginx /api/ block until public authentication is verified.",
      "proof": "No dev-header authentication exposed. Cross-tenant/relationship denial and answer-key leakage cases pass."
    },
    {
      "title": "Reuse WorkSquares DNS and TLS",
      "details": "Retain the existing octimo.worksquares.ai A record and authoritative nameservers. Add any chosen staging hostname inside the same worksquares.ai zone only if required. Check certificate coverage/renewal; validate the exact Octimo nginx candidate with nginx -t.",
      "proof": "DNS resolves correctly and HTTPS presents the expected certificate. Existing WorkSquares DNS records, delegation and product routes remain intact."
    },
    {
      "title": "Switch the Octimo release and verify externally",
      "details": "Take a deployment lock around shared nginx/Docker mutations. Switch the Octimo upstream or release symlink atomically after candidate health passes. Verify all five tracks from outside the host, including save/resume, timed submission, results, rewards and adult reports.",
      "proof": "Public authenticated browser receipt, API/UI version identity, migration ledger, zero unresolved high-severity issues and active monitoring."
    },
    {
      "title": "Exercise rollback and operate the pilot",
      "details": "Keep previous app images/static assets/configuration. Roll back app routing if health or business checks fail. Keep additive schema compatible with both releases and repair data forward; restore the database only under a deliberate recovery procedure.",
      "proof": "Rehearsed rollback and restore evidence, alert ownership, learner support and an explicit pilot acceptance record."
    }
  ],
  "risks": [
    [
      "Runtime uses database owner",
      "Source and live configuration both use octimo_app.",
      "Split roles before exposing the learning API; test grants and RLS with the actual runtime identity."
    ],
    [
      "Authentication is development-only in live config",
      "Public nginx exposes only health routes.",
      "Implement OIDC and browser sessions; do not remove the API block to make a demo appear functional."
    ],
    [
      "No separate staging or production database observed",
      "Only octimo_db currently exists for Octimo.",
      "Create isolated targets and prove restore before real learner data."
    ],
    [
      "Mutable API image tag",
      "The live tag is octimo-api:latest.",
      "Add exact commit/image labels and a release manifest before a platform release."
    ],
    [
      "Old environment records conflict",
      "Docs contained pre-scaffold and pre-migration statements.",
      "Use dated receipts and update status with each environment change."
    ],
    [
      "Broad historical PostgreSQL access settings",
      "Older docs record broad TCP access; current Octimo runtime has DB_SSL=false. Host-wide firewall/pg_hba was not audited here.",
      "Harden Octimo connectivity with the platform owner while preserving other services; verify current rules before changing them."
    ],
    [
      "Existing status command can write",
      "DatabaseMigrator.status() calls ensureLedger().",
      "Make db:status truly read-only in P01; discovery used SELECT queries inside a read-only transaction."
    ],
    [
      "Capacity and production suitability unmeasured",
      "The host is shared with other WorkSquares products.",
      "Measure CPU/RAM/storage/connections and define resource limits before staging or production rollout."
    ]
  ],
  "referencePaths": [
    "E:/WORKSQUARES/plans/direct-ovh-deployment-plan.md",
    "E:/WORKSQUARES/plans/direct-ovh-phase-2a-checkpoint-2026-08-24.md",
    "octimoui/docs/environments.md",
    "octimoapi/database/migrations/000001_bootstrap.sql through 000006_row_security.sql",
    "octimoapi/src/platform/database/migrator.ts"
  ]
}
