ci(e2e): route API calls through the SPA-host proxy while PMS-618 is open #423

Closed
YousifShkara wants to merge 2 commits from chore/PMS-618-e2e-api-base-workaround into main
Owner

The mokosh-server PR CI runs e2e/scripts/health-check.mjs as a preflight (PMS-141) and deriveApiBase prepends api. to the SPA host, landing on https://api.msp.a8n.systems/api/v1/health. That subdomain is currently 404-ing on staging: the Traefik router labels for the api host are missing, so every mokosh-server PR fails at the preflight step (PR #421 and #422 both showed Staging /api/v1/health returned HTTP 404). Same failure mode as the CORS-404 storm on the user's /tickets screenshot: the SPA-derived api host does not resolve to mokosh-server.

Root-cause fix (Traefik + DNS) lives outside this repo and is tracked in PMS-618. Land the short-term unblock here so the queue moves: set E2E_API_BASE_URL to the same value as E2E_BASE_URL (the SPA host), which serves /api/v1/* correctly today via the SPA-host proxy that already exists. deriveApiBase is skipped in favour of the explicit override, so the preflight and every /api/v1/* test call go to a working host. env.opBaseURL is unaffected because it has its own explicit source (E2E_OP_BASE_URL / OIDC_ISSUER_*).

Remove this override in the same PR that closes PMS-618: the workaround should not silently outlive the routing fix. The comment on the env line points at the ticket to make that removal easy to find.

#PMS-618

The mokosh-server PR CI runs `e2e/scripts/health-check.mjs` as a preflight (PMS-141) and `deriveApiBase` prepends `api.` to the SPA host, landing on `https://api.msp.a8n.systems/api/v1/health`. That subdomain is currently 404-ing on staging: the Traefik router labels for the api host are missing, so every mokosh-server PR fails at the preflight step (PR #421 and #422 both showed `Staging /api/v1/health returned HTTP 404`). Same failure mode as the CORS-404 storm on the user's /tickets screenshot: the SPA-derived api host does not resolve to mokosh-server. Root-cause fix (Traefik + DNS) lives outside this repo and is tracked in PMS-618. Land the short-term unblock here so the queue moves: set `E2E_API_BASE_URL` to the same value as `E2E_BASE_URL` (the SPA host), which serves `/api/v1/*` correctly today via the SPA-host proxy that already exists. `deriveApiBase` is skipped in favour of the explicit override, so the preflight and every /api/v1/* test call go to a working host. `env.opBaseURL` is unaffected because it has its own explicit source (`E2E_OP_BASE_URL` / `OIDC_ISSUER_*`). Remove this override in the same PR that closes PMS-618: the workaround should not silently outlive the routing fix. The comment on the env line points at the ticket to make that removal easy to find. #PMS-618
ci(e2e): route API calls through the SPA-host proxy while PMS-618 is open
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 1m28s
Check / fmt + clippy + build + tests (pull_request) Successful in 3m38s
Integration / integration tests (pull_request) Has been cancelled
65ee68fb4f
The mokosh-server PR CI runs `e2e/scripts/health-check.mjs` as a preflight (PMS-141) and `deriveApiBase` prepends `api.` to the SPA host, landing on `https://api.msp.a8n.systems/api/v1/health`. That subdomain is currently 404-ing on staging: the Traefik router labels for the api host are missing, so every mokosh-server PR fails at the preflight step (PR #421 and #422 both showed `Staging /api/v1/health returned HTTP 404`). Same failure mode as the CORS-404 storm on the user's /tickets screenshot: the SPA-derived api host does not resolve to mokosh-server.

Root-cause fix (Traefik + DNS) lives outside this repo and is tracked in PMS-618. Land the short-term unblock here so the queue moves: set `E2E_API_BASE_URL` to the same value as `E2E_BASE_URL` (the SPA host), which serves `/api/v1/*` correctly today via the SPA-host proxy that already exists. `deriveApiBase` is skipped in favour of the explicit override, so the preflight and every /api/v1/* test call go to a working host. `env.opBaseURL` is unaffected because it has its own explicit source (`E2E_OP_BASE_URL` / `OIDC_ISSUER_*`).

Remove this override in the same PR that closes PMS-618: the workaround should not silently outlive the routing fix. The comment on the env line points at the ticket to make that removal easy to find.

#PMS-618
Revert "ci(e2e): route API calls through the SPA-host proxy while PMS-618 is open"
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 6s
Check / fmt + clippy + build + tests (pull_request) Successful in 1m26s
Integration / integration tests (pull_request) Successful in 5m11s
Create release / Gate (release-branch merges only) (pull_request) Successful in 1s
Create release / Create release from merged PR (pull_request) Has been skipped
ec8298f88b
The workaround was based on a wrong reading of the staging state. I confirmed with `curl` that `https://msp.a8n.systems/api/v1/health` returns 200 and thought that was the SPA-host proxy answering. It's not - the 200 was the mokosh SPA's index.html fallback, served for every unknown path (any-URL 200 with HTML body is exactly how a static SPA host looks). The `/api` prefix at that host is not a proxy to mokosh-server at all.

PR #423 CI (the one this workaround shipped on) confirmed it: `E2E_API_BASE_URL=https://msp.a8n.systems` cleared the preflight (that same 200 fooled `health-check.mjs`, which only inspects `res.ok`), then every real test failed. POST returned 405 (the static SPA host refuses POST) and GET returned HTML the teardown could not parse ("Unexpected token '<'...").

Net effect of the workaround: preflight green, entire test surface red. Strictly worse than the original preflight-red state, because a green preflight masks how broken staging actually is.

Reverting the env override so the CI is honest again: preflight fails at `Staging /api/v1/health returned HTTP 404`, which correctly points at PMS-618 (staging Traefik / DNS for `api.msp.<tld>` is missing). Fixing PMS-618 in the docker repo is the only real unblock; there is no other host that answers `/api/v1/*` from the outside on staging right now.

#PMS-618
YousifShkara closed this pull request 2026-07-03 12:42:01 +02:00
YousifShkara deleted branch chore/PMS-618-e2e-api-base-workaround 2026-07-03 12:42:05 +02:00
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 6s
Required
Details
Check / fmt + clippy + build + tests (pull_request) Successful in 1m26s
Required
Details
Integration / integration tests (pull_request) Successful in 5m11s
Create release / Gate (release-branch merges only) (pull_request) Successful in 1s
Create release / Create release from merged PR (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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
psa-systems/mokosh-server!423
No description provided.