Add authenticated real-product preview slots on dev-02 #1099

Closed
kayg wants to merge 0 commits from t3/product-preview-slot into dev
Owner

The preview host serves static mockups today. This adds scripts/preview-product.sh BRANCH SLOT to build the real Rust server and apps/web on dev-02, then run normal passkey authentication at https://SLOT.preview.calternal.cloud/. The notes-float slot is deployed from port/notes-float. Tracks #1098, which holds account instructions and screenshots.

Design: each slot has a dedicated build worktree under ~/Developer/Worktrees, private throwaway Homes/state and immutable releases under ~/preview-product/SLOT, a fixed loopback port in 25080–25179, and a persistent calternal-preview-SLOT user service. Data/state flags are explicit and inherited path settings are removed. No dev-user bypass, production data, production services, or merges. Bootstrap output and the fragment-based enrollment link remain private files. Redeploy retains accounts, passkeys and notes.

A dedicated hostname is necessary because API, assets and the service worker use root-relative paths. DNS updates are restricted to one A record below preview.calternal.cloud. The existing private DNS credential provisions a per-slot DNS-01 certificate and weekly renewal timer. Caddy binds only NetBird addresses; existing mockup routes remain. Configuration validation/restart failure restores the prior proxy config.

Builds run inside Nix through ~/bin/slot, with cargo -j4 and disposable executable runtime-tmpfs output. The script checks the brief's 50 GB disk floor before each heavy step. An unchanged deployed commit reuses its complete build; a changed branch tip builds new assets and executable before activation. Work is linear in asset size, port selection scans at most 100 entries, and slot/routing mutations are serialized. No application runtime hot path changes.

Failure → effect → detection → recovery: build failure → live release retained → command error → retry; disk below floor → no build → byte-count check → retry when space is available; DNS/certificate failure → activation stops → helper failure → fix preview configuration and retry; invalid proxy config → old config restored → Caddy validation/restart → retry; unhealthy product service → command fails and previous executable/assets restored → user-service and HTTP health checks → inspect private log and retry. Preview state is never automatically rolled back or reset.

Validated: actual Nix/slot Rust and web build and HTTPS deployment; repeated same-slot activation with enrollment file unchanged; refusal below the disk floor with live service retained; Bash syntax and shellcheck; 6 Python DNS scope/conflict/idempotency tests. Commands and evidence are on #1098. Real WebAuthn enrollment, logout, fresh-browser sign-in and opening a seeded note passed in Chrome on macos-01 through its Nix/slot. Real Mac Safari authenticated-note checks and light/dark screenshots passed using the resulting test session. Real iPhone simulator Safari authenticated-note checks and inspected light/dark screenshots also passed with a restored synthetic QA session; native Safari virtual-passkey completion is not claimed (macOS driver credential inspection returns HTTP 501, Studio iOS driver finds no eligible session host).

The preview host serves static mockups today. This adds scripts/preview-product.sh BRANCH SLOT to build the real Rust server and apps/web on dev-02, then run normal passkey authentication at https://SLOT.preview.calternal.cloud/. The notes-float slot is deployed from port/notes-float. Tracks #1098, which holds account instructions and screenshots. Design: each slot has a dedicated build worktree under ~/Developer/Worktrees, private throwaway Homes/state and immutable releases under ~/preview-product/SLOT, a fixed loopback port in 25080–25179, and a persistent calternal-preview-SLOT user service. Data/state flags are explicit and inherited path settings are removed. No dev-user bypass, production data, production services, or merges. Bootstrap output and the fragment-based enrollment link remain private files. Redeploy retains accounts, passkeys and notes. A dedicated hostname is necessary because API, assets and the service worker use root-relative paths. DNS updates are restricted to one A record below preview.calternal.cloud. The existing private DNS credential provisions a per-slot DNS-01 certificate and weekly renewal timer. Caddy binds only NetBird addresses; existing mockup routes remain. Configuration validation/restart failure restores the prior proxy config. Builds run inside Nix through ~/bin/slot, with cargo -j4 and disposable executable runtime-tmpfs output. The script checks the brief's 50 GB disk floor before each heavy step. An unchanged deployed commit reuses its complete build; a changed branch tip builds new assets and executable before activation. Work is linear in asset size, port selection scans at most 100 entries, and slot/routing mutations are serialized. No application runtime hot path changes. Failure → effect → detection → recovery: build failure → live release retained → command error → retry; disk below floor → no build → byte-count check → retry when space is available; DNS/certificate failure → activation stops → helper failure → fix preview configuration and retry; invalid proxy config → old config restored → Caddy validation/restart → retry; unhealthy product service → command fails and previous executable/assets restored → user-service and HTTP health checks → inspect private log and retry. Preview state is never automatically rolled back or reset. Validated: actual Nix/slot Rust and web build and HTTPS deployment; repeated same-slot activation with enrollment file unchanged; refusal below the disk floor with live service retained; Bash syntax and shellcheck; 6 Python DNS scope/conflict/idempotency tests. Commands and evidence are on #1098. Real WebAuthn enrollment, logout, fresh-browser sign-in and opening a seeded note passed in Chrome on macos-01 through its Nix/slot. Real Mac Safari authenticated-note checks and light/dark screenshots passed using the resulting test session. Real iPhone simulator Safari authenticated-note checks and inspected light/dark screenshots also passed with a restored synthetic QA session; native Safari virtual-passkey completion is not claimed (macOS driver credential inspection returns HTTP 501, Studio iOS driver finds no eligible session host).
Add isolated authenticated product preview deployment
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
24220bfef1
Author
Owner

Merged to dev as 5fba67585 (orchestrator): scripts only, token read from env, no runtime product change.

Merged to dev as 5fba67585 (orchestrator): scripts only, token read from env, no runtime product change.
kayg closed this pull request 2026-11-12 17:25:04 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!1099
No description provided.