Skip to content

Latest commit

 

History

History
243 lines (204 loc) · 17.6 KB

README.md

File metadata and controls

243 lines (204 loc) · 17.6 KB

visomi.dev stack migration

Provenance and constraints

The integration branch starts at website main 9511109c233f2a6a7604c80fa1597aa338e9135d. It incorporates PR #41 head ad095e9bf51276201c5a39330575b686c9f51f47 and PR #42 head 051ef523cc5208154e88376e65cabc1815899b08, without conflicts, at f2cfa9c. The PRs remain closed; neither is reopened or merged on GitHub. The initial source stack was revalidated after the owner's update at c7e362b6fe4dc14ede081ba9090a5345ba5b7bcb. Both source checkouts were clean at that baseline. The follow-up incorporates the applicable changes from stack PR #17, merged as 07f03a567f994aa4c2abdd22346b2f8e6b09c786. The sibling working tree was left untouched. The current inventory targets that exact merged ref; this is an explicit adaptation, not an automatic inclusion of subsequent stack changes.

baseline.json records source hashes before migration. stack-files.json inventories all tracked source-stack files, including hidden files, with copy destinations and exclusions. The current scope matrix records decisions for capabilities added after that baseline. Only tracked files were read/copied; no local env files, credentials, sessions or database contents were imported. MCP configuration is versioned without starting its connections.

PR #17 adaptations include the responsive shared shell helpers, composed MJML verification/security frame, formatted-placeholder support and Google/passkey account-continuity regressions. The private owner controls also show busy feedback on the initiating buttons. Public registration/account-management screens and their full auth navigation are excluded because this app remains a private contact/metrics surface. The source stack's live-account/Railway review evidence is not copied or asserted for this project. Each new/changed source file remains accounted for in stack-files.json.

The owner's decision is to reuse stack authentication. Authorization requires an explicitly configured owner with a verified email; no default identity or first-user enrollment is used. The confirmed address belongs in operator configuration, not hardcoded application policy. No merge, deployment, infrastructure provisioning, DNS change, credential change or real-data migration has been performed. These operations are separate release gates.

Public baseline

English is unprefixed: /, /journey/, /projects/, /resume/, /contact/. Spanish equivalents are /es/, /es/journey/, /es/projects/, /es/resume/, /es/contact/. Keep trailing-slash redirects, canonical/hreflang links, sitemap, social-image URLs, project content/assets, theme state, ClientRouter reinitialization, WebGL and printable CV. The contact persistence boundary changes; its visible form remains the original. Minimal required accessibility corrections are documented below.

The integrated production build passed using only synthetic database configuration. parity/baseline contains 40 production-browser captures and content/SEO manifests: 10 destinations × 2 themes × mobile (375×812) / desktop (1440×900). The capture hides canvas pixels because procedural WebGL output varies between frames; WebGL behavior is verified separately. VIS-34 additionally restores only the home-link's original artwork/text in the comparison DOM, as described below. Other content, layout, fonts and metadata are compared. A per-channel tolerance of 20 and maximum changed-pixel ratio of 0.2% permits rasterization noise; page dimensions and normalized body text/SEO must match exactly. Captures disable LCD text antialiasing so host Fontconfig cannot add colored subpixels. The same 40 stored references match with zero changed pixels on both the developer host and Ubuntu Playwright image. Run the website-parity Nx target against the current artifact on loopback; keep both recorded reference sets intact.

Runtime and configuration inventory

Before: gateway server, API and realtime bootstrap, Angular social-card preview, Astro public portfolio/contact action + Astro DB/Turso, BullMQ social-image worker + Redis, static social-image manifests/PNG promotion. The API main was also imported as an entrypoint; the migration replaces this with the stack's side-effect-free module loader.

After: stack gateway/API/Angular/realtime composition and shared backend/tooling, original Astro portfolio, PostgreSQL contact API/owner dashboard, existing BullMQ social-image worker. Redis remains one existing dependency. No template website, public signup or unrelated product screens are carried into the application's routes.

Configuration is listed by name only: HOST, PORT, SITE_URL, DATABASE_URL, REDIS_URL, AUTH_ORIGIN, AUTH_RP_ID, SESSION_SECRET, OWNER_EMAIL, OWNER_USER_ID, AUTH_TOTP_ENCRYPTION_KEY, SMTP_HOST, SMTP_PORT, SMTP_FROM, SMTP_USER, SMTP_PASSWORD, SOCIAL_IMAGE_INTERNAL_TOKEN, DISABLE_WORKER, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_HEADERS, CONTACT_LEGACY_DATABASE_URL, CONTACT_LEGACY_DATABASE_AUTH_TOKEN. Legacy migration input is an explicit offline export; the application no longer requires ASTRO_DB_REMOTE_URL or ASTRO_DB_APP_TOKEN.

The VISOMI_E2E_* and VISOMI_TEST_* families configure synthetic test fixtures. __VISOMI_CSP_NONCE__ is the Angular HTML placeholder for the per-response CSP nonce.

Necessary exceptions to the source stack

  • Keep original Astro components, CSS, fonts, content, scripts, assets, unprefixed English URLs, prerender/cache/CV improvements and identity. Template public pages are excluded.
  • Keep existing social-image generation, BullMQ/Redis worker, contracts and public artifact URLs.
  • Use cloud-only persistence for visomi.dev. Keep its PostgreSQL contracts and migrations for contacts, authentication, sessions and visit aggregates. The stack's optional offline vault, local key custody, PIN/PRF unlock and encrypted sync are outside this product's parity scope.
  • Use the shared PinInput for six-digit email and TOTP verification in the owner sign-in flow. Preserve the server-side owner check, CSRF, cookie and private no-store contracts.
  • Angular provides owner contact list/detail, technical metrics and a separate private sign-in under the adapted stack shell; template public login/signup and account-management screens are excluded.
  • Adapt source package/repository/domain names and commands; remove developer-specific PATH values.
  • PostgreSQL/Redis infrastructure from VIS-16 is reused; no second database/broker or Jaeger service is provisioned. Exporting operational telemetry is explicit opt-in and must exclude request data.
  • Worker builds use the matching Nx esbuild executor; its tests and the migrated runtimes use Vitest. Backend artifacts use Rolldown. These are compatibility tasks, not alternate production architecture.

Implementation and verification evidence will be recorded per issue and in the final PR.

Final architecture adaptations

  • Private Angular entrypoints preserve the stack's /app/en/ and /app/es/ locale bases. Both roots return 404. The owner's password and second-factor flow is at /app/en/admin/auth/sign-in or /app/es/admin/auth/sign-in. Retired entrypoints return 404; there are no legacy aliases or login redirects. Guards and resolvers fetch essential list/detail data before activation; private routes render with RenderMode.Server. A read-only, request-scoped interceptor forwards only the current request cookie to allowlisted private endpoints. Authenticated HTML may contain private contact data and must use private, no-store without an ETag. HTTP transfer caching is disabled.
  • Original public content was split into typed English/Spanish/project data modules without changing values. A stale predecessor assertion expected 06 // Idiomas; the integrated baseline already rendered Idiomas, which remains unchanged.
  • Mandatory repository conventions require direct source imports, type-only imports and strict checking. New stack barrel entrypoints were replaced with direct modules. Lifecycle tests still load executable modules dynamically to verify import/startup boundaries. Production Nx readiness uses the same Nx 24 framed JSON protocol through a tiny Node socket helper, avoiding eval and build-tool runtime dependencies.
  • Public CSP permits only hashes of trusted compiled snippets. Styles and font assets are external; ClientRouter receives the finite cross-route hash set. No unsafe-inline or unsafe-eval exception was introduced. Source maps and private browser routes retain their separate boundaries.
  • Generic stack auth infrastructure remains covered with a test-only loopback router; production exposes only session, password sign-in/verification and logout. Template registration/account-management E2Es were replaced with real owner-only API/browser tests. The worker E2E uses real Redis and Chromium, including interruption/recovery, and writes only into an owned temporary workspace.
  • Local Compose omits unrelated MinIO and opaque-sync services. The Railway definition models the existing production estate. The VIS-62 runbook records the read-only plan.

Accessibility and visual evidence

The original baseline has AXE contrast, landmark and accessible-name failures (see parity/baseline-accessibility.json). Minimal corrections make the footer semantic, preserve visible link names, and increase secondary text contrast. VIS-34 adds the explicitly requested branding replacement described below. Outside these exceptions, geometry, typography, content and public URLs are preserved. The 40 comparisons, with the approved brand link normalized, have zero changed pixels against the contrast reference; the largest raw difference from the untouched baseline is 0.2503%, entirely explained by the enumerated contrast changes.

parity/baseline retains the original integrated artifact captures. parity/accessibility-baseline replays only the enumerated text-color corrections on that original DOM, using the recorded color manifests; it cannot alter layout, text, assets or fonts. scripts/parity-accessibility.mjs enumerates those rules. The comparison keeps the original 0.2% rasterization tolerance against this contrast reference and records the raw difference against the unmodified baseline too. Canvas pixels are hidden and frame callbacks stopped after page readiness; WebGL behavior is tested separately.

VIS-34 applies the approved assets/brand logotype to desktop navigation, the isotype to mobile navigation, the ribbon animation to ClientRouter loading, and the new favicon to the public website. Black artwork is inverted in dark page themes. The favicon also follows the browser color scheme; its ribbon geometry is unchanged. /favicon.svg is prerendered from the same canonical source, while the page links to a fingerprinted URL to avoid the previous icon's cached contents. The SVG loader retains its reduced-motion fallback and stops after successful or failed loading.

The original 80 reference PNGs and their manifests remain unchanged. Only the marked home-link's children are restored to their original markup during parity comparison, preserving comparisons of the surrounding navigation, page layout, content and SEO at the existing tolerance. The real branding is checked separately in website-branding.spec.ts: both themes, both locales, mobile/desktop, production SVG responses, delayed navigation, reduced motion and screenshot evidence. Those screenshots are taken before parity normalization and do not replace the original baseline. The targeted branding captures pause/hide the procedural WebGL background to avoid software-rendering contention on hosted CI. They retain the real theme, SVG animation, ClientRouter and network delay; the existing WebGL lifecycle tests run separately with the real background enabled.

# Original f2cfa9c artifact on loopback 8181; current artifact on loopback 8182.
PARITY_URL=http://127.0.0.1:8181 pnpm nx run visomi.dev:website-parity:baseline
PARITY_URL=http://127.0.0.1:8181 PARITY_ACCESSIBILITY_BASELINE=true pnpm nx run visomi.dev:website-parity:baseline
PARITY_URL=http://127.0.0.1:8182 pnpm nx run visomi.dev:website-parity

Never run a build that replaces the served dist tree while capturing/comparing it. Synthetic database and browser fixtures own separate ports, Compose projects and cleanup; never point them at production.

The source Cloudflare malformed-path guard is also ported as optional web-edge infrastructure. Its local build and tests do not create routes or bind an account. The smoke command requires an owned loopback origin, and its deployment target is outside this implementation's authorization.

The public E2E suite also runs the 40-view pixel/content/SEO comparison against its owned compiled gateway fixture, so CI enforces the recorded reference rather than relying only on manual captures. Browser E2Es pin hosted Ubuntu 24.04. The administrative matrix installs the lockfile's Chromium, Firefox and WebKit builds plus their required native libraries. Removing the optional CJK/X11 font packages in an isolated Ubuntu image still passed all 40 captures with zero changed pixels; en/es uses self-hosted website fonts. The browser setup has a bounded timeout and all browser/E2E gates remain required. The worker fixture first allocates an isolated Redis port, then makes that same binding explicit before starting the gateway/worker. This preserves the endpoint across Docker and Podman stop/start rehearsals. Owned browser/worker fixtures receive SIGTERM with a bounded shutdown window so they remove their synthetic Compose resources before the test runner exits. The coordinator runs directly under Node so the runner waits for resource cleanup rather than an intermediate package-manager process.

Private technical metrics

/app/en/admin/metrics and /app/es/admin/metrics are linked from the contact dashboard. A route guard and resolver load /api/private/metrics; every API request independently requires a full verified owner session and returns private/no-store responses. The route uses SSR with the same request-scoped cookie and private/no-store policy as contacts.

The API and gateway keep local HTTP aggregates without an environment switch. Capture keeps 15 one-minute buckets per running process with request count, client/server errors, aborted requests, mean latency and maximum latency. Durations are clipped to 0–60 seconds. No request body, URL/query, email, IP, user agent, identifier, token or raw exception is read into these counters. They reset on restart and are not a durable/global view across replicas. The gateway passes the same collector to its embedded API, counting each response only once.

The trace-export indicator describes whether the process has a valid authenticated private OTLP receiver configured. Delivery is verified separately with a stored trace. Browser reporting follows the origin's default-off, revocable consent. See browser privacy and rollout for the follow-up to the visit and diagnostic implementations. The private browser suite covers the real response, anonymous/non-owner denial, no-store, empty and error views, English/Spanish, mobile overflow and AXE. It also covers the disabled response for compatibility with an older API during rollout.

Deployment selection and remaining release gates

Railway IaC defines watch selection for /assets/**, styles.base.css, .postcssrc.json, application/library code, dependency patches and configuration/build inputs. watch-patterns.spec.mjs checks logo/favicon/loader-only and shared-style-only changes with Git's actual gitignore matching in an isolated repository, including root anchoring and unrelated documentation. It also checks the 18 persisted watch patterns and the gateway's build, readiness and restart settings directly. The application build declares shared styles/PostCSS and canonical brand SVGs as Nx inputs.

The Railway migration runbook records the applied production plan and the verification for the first deployment without railway.json. The removal itself matches the persisted watch list and can exercise the source trigger after an approved merge.

The owner account/configuration must also pass the read-only web-api:owner-preflight and subsequent interactive email/second-factor acceptance before enabling access. See the cutover runbook. No real account was created/modified, no real contact data was read/replayed, no exporter was enabled and no Railway setting, merge or deployment was applied by these implementation checks. Code/test completion and release/real-account acceptance are separate; VIS-26 tracks the remaining operator gates.

Functional completion review

See completion-review.md for the administrative route map, browser/SSR wiring, provenance policy and explicit decisions on post-baseline improvements. Historical verification above covers only its originally exercised paths; it did not demonstrate that the excluded browser adapters were connected.

pnpm nx run web-gateway:inventory-check validates all 1,127 historical source entries, source digest, counts, classifications and destination existence. Hashes are snapshots: migrationDestinationSha256 retains the earlier value when reconciled; destination drift is reported independently rather than prohibiting future changes. When a file moves, relocatedTo identifies its current checked destination while preserving the original source, destination and digest fields. Invalid or missing relocation targets fail validation.

See current stack reconciliation for the updated upstream comparison and visit analytics for opt-in public page views.