FVHQ-ROUTING-01

Lane: ID47 (Mavis)  |  Instance: https://fvhq.freshvibeapps.com  |  Deployed revision: a0da707  |  Date: 2026-11-19

Outcome: the Settings URL and every other client-side route now answer on the instance, the Freshvibe HQ surface is listed in the navigation, and 17 of 17 live acceptance tests pass.

FVHQ-ROUTING-01 -- The FVHQ deployment: deep links, Settings URLs, and a surface the operator can find

Dispatch lane: ID47 (Mavis, FVHQ proof and finish)

Target instance: `https://fvhq.freshvibeapps.com`

Base revision: `fd50794` (the deployed artifact) -> branch `feat/id47-fvhq-finish-rest` (`35a628a`) -> branch `fix/id47-fvhq-deep-link-routing`

Repository: `avidtech6/freshcards`

Date: 2026-11-19

---

1. WHAT THE OPERATOR REPORTED

1. The FreshCards version on FVHQ looks older than the one on `https://freshcards.freshvibeapps.com`.

2. The FreshCards host has proper Settings URLs; the FVHQ one does not.

3. The Freshvibe HQ surface that appears in the screenshot is not listed under Pages or Databases.

4. There is a message for this lane from ID 84.

2. WHAT WAS MEASURED (not assumed)

MeasurementResult `https://fvhq.freshvibeapps.com/version.json``version 2.28.12`, `buildHash fd50794`, `deployedAt 1795022194020` `https://freshcards.freshvibeapps.com/version.json``version 2.28.12`, `buildHash a2fb27b`, `deployedAt 1794448270609` `git merge-base --is-ancestor a2fb27b fd50794`TRUE -- the FreshCards host runs the build **22 commits BEHIND** the FVHQ build `git merge-base --is-ancestor fd50794 a2fb27b`FALSE -- the FVHQ build is the NEWER one `GET https://fvhq.freshvibeapps.com/settings`**HTTP 404**, body `Not found` (9 bytes) `GET https://freshcards.freshvibeapps.com/settings`HTTP 200, the app shell `GET https://fvhq.freshvibeapps.com/hq`HTTP 200, the app shell (2536 bytes) `GET https://fvhq.freshvibeapps.com/`HTTP 200, the app shell (2536 bytes) The two `index.html` bodiesidentical except the hashed asset name (`index-5BVySeAx.js` vs `index-BkmhBx0P.js`) The operator's own screenshotDatabases section OPEN and EMPTY; Pages: Product Requirements D..., Getting Started, Daily Notes The FVHQ nginx vhost`location / { proxy_pass http://127.0.0.1:5194; }` -- no SPA fallback The FreshCards nginx vhost`location / { try_files $uri $uri/ /index.html; }` -- SPA fallback `src/fvhq/server/http.ts` (the handler behind :5194)the shell was served for `/`, `/hq` and `/hq/*` ONLY; every other path was resolved as a FILE on disk

The root cause

**The FVHQ instance is NOT older. It is 22 commits newer, and it runs the same bundle lineage as the FreshCards host. The fault is in the INSTANCE'S STATIC HANDLER, not in the build.**

`src/fvhq/server/http.ts` mapped only three path shapes to the application shell and resolved every other path as a file on disk. The FreshCards app is ONE document with client-side routes (`/settings`, `/settings/:tab`, `/page/:pageId`, `/database/:id`, `/peek/*`), so every one of those routes answered HTTP 404 `Not found` before the React app ever ran. The FreshCards host serves the shell for every path, which is why `/settings` works there.

=>=> **THE SAME VERSION STRING IS NOT THE SAME BUILD.** Both hosts report `2.28.12` because that is the package version, baked into the bundle at build time. The build hash is the thing that distinguishes them, and the build hash said the opposite of the operator's impression.

=>=> **A 404 ON A DEEP LINK IS A HOST-ROUTING FAULT, NOT A BUILD FAULT.** The proof is that two hosts serving the same bundle answered differently for the same path.

The second defect (discoverability)

The Freshvibe HQ surface is a ROUTE (`/hq`), not a row in the `freshcards:databases` map, and the app's sidebar lists only pages and databases. It was therefore reachable only by being told the URL -- exactly the operator's report.

The third defect (a one-way street)

`/hq` renders the Freshvibe HQ surface INSTEAD of the workspace, so the sidebar is not on that route. A navigation entry into it would have been a one-way street.

3. THE CHANGE (branch `fix/id47-fvhq-deep-link-routing`, base `35a628a`)

3.1 `src/fvhq/server/http.ts` -- the SPA fallback

A path that names no file serves the application shell. Three exclusions, each measured:

  • `/api/` stays a 404: an unknown API path is a routing fault and must not hide behind a 200.
  • `/assets/` stays a 404: a missing hashed asset must not become the shell, or the browser tries to execute HTML as JavaScript (the F 126 failure mode).
  • A path whose last segment carries an extension stays a 404: that is a file request, not a route.
  • A path that escapes the static root is REFUSED OUTRIGHT (404), not served the shell.

    3.2 `src/fvhq/server/http.ts` + `src/fvhq/instance.ts` -- the instance marker

    The process that serves the document IS the instance, so it writes `<meta name="fc-instance" content="fvhq">` into the shell it serves. The app reads it synchronously from the already-loaded document.

    =>=> **A MARKER, NOT A BUILD FLAG.** The bundle is shared with the standalone FreshCards app; a build flag would have to be re-applied by hand per instance, and a forgotten flag would silently hide the instance navigation. The marker cannot drift from the deployment because the serving process writes it.

    =>=> **A SHELL THAT CANNOT CARRY THE MARKER IS A LOUD 500**, not a silent omission. The injection falls back from `<head>` to `<html>` to `<body>`; only a document that is not a document at all is refused.

    3.3 `src/ui/components/common/SidebarV2.tsx` -- the surface is listed

    The Databases section renders a `Freshvibe HQ` row when the marker is present. The row PUSHES `/hq` and dispatches the synthetic `popstate` the app subscribes to, so the app re-renders without a reload (the F 514 lesson). On the standalone FreshCards app there is no marker, so there is no row.

    3.4 `src/fvhq/FvhqLiveSurface.tsx` -- the way back

    A `Back to workspace` button on the Freshvibe HQ surface, in both the signed-out gate and the record view, so the route is not a one-way street.

    4. THE TESTS (12 new, all passing)

    `src/fvhq/__tests__/fvhq-routing.spec.ts` (9) -- the shell is served for `/settings`, `/settings/providers`, `/settings/appearance`, `/page/page-prd`, `/database/db-quick-notes`, `/peek/quick-note`; the root, `/hq` and the real files still answer; the marker is in the shell at `/`, `/hq` and `/settings`; a missing hashed asset is a 404 and is NOT the shell; an unknown API path is NOT the shell; a missing file request is a 404 and is NOT the shell; a path that escapes the root is refused; a document that is not a document is a loud 500.

    `src/ui/components/common/__tests__/fvhq-instance-navigation.spec.tsx` (4) -- the row is listed when the marker is present; it is NOT listed without a marker (the standalone app); it is NOT listed for another instance name; clicking it pushes `/hq` and dispatches the popstate.

    The negative controls are the point: a spec that cannot fail is not a spec.

    The regression run

    `src/fvhq/__tests__/` (bootstrap 54, identity 20, conflict 4, live 2, routing 9) plus the two existing sidebar specs (7 + 11) plus the new navigation spec (4): **111 passed, 0 failed, 8 skipped** (the PocketBase integration spec, skipped because no PB binary is present in this workspace).

    5. THE DEPLOYMENT

  • The change is in the INSTANCE's code path, so the deployed artifacts are the app bundle (`dist-app`) and the host bundle (`dist-host/fvhq-host.mjs`).
  • The nginx vhost does NOT change: `location /` already proxies every path to the instance, and the instance now answers a route with the shell. The vhost stays untouched by hand; the deploy template remains the only writer of that file.
  • The deploy script's rollback copy (`dist-app.prev`) and the backup script are used unchanged.
  • ID 44's MCP/OAuth service, port 5191, the OAuth configuration, the named-host routing and the working FCC API on port 5190 are NOT touched. The instance's own services (`fvhq.service` on 5194, `fvhq-agent-api.service` on 5192) are restarted by the deploy script.
  • 6. THE VERIFICATION (live, after the deploy)

    1. `GET /version.json` build hash equals the deployed revision.

    2. `GET /settings` -> 200, the shell, carrying the instance marker.

    3. `GET /settings/providers` -> 200, the shell.

    4. `GET /hq` -> 200, the shell.

    5. `GET /assets/<hashed>.js` -> 200 (a real asset, not the shell).

    6. The rendered text of `/settings` names the Settings surface (not a 404 body).

    7. The rendered sidebar of the workspace lists `Freshvibe HQ`.

    8. Clicking it opens the Freshvibe HQ surface, and `Back to workspace` returns to the workspace.

    9. The FreshCards standalone still answers `/settings` with the shell and shows NO Freshvibe HQ row.

    10. The 12 existing acceptance tests still pass against the live instance.

    7. THE HONEST LIMITS

  • The Provider/Builder gap is unchanged and is NOT closed by this dispatch: the free provider pool still answers 404/413/429, so a Builder job still produces no work. ID 84 has that open as `FVHQ-CREDENTIALS-01` and as a request to trace the empty-reply path.
  • The instance marker is a claim about which instance serves the document. It is written by the instance process, and the proof that it reached the browser is the rendered row in the operator's own sidebar.