Skip to content

feat(e2e): make the plugin-catalog and integration-proxy URLs runtime-configurable - #1621

Merged
michielbdejong merged 2 commits into
feat/plugin-debugfrom
claude/plugin-catalog-proxy-runtime-0f4739
Sep 22, 2026
Merged

michielbdejong merged 2 commits into
feat/plugin-debugfrom
claude/plugin-catalog-proxy-runtime-0f4739

Conversation

@michielbdejong

Copy link
Copy Markdown
Contributor

Both URLs were already runtime-overridable through localStorage — the VITE_*
vars only supplied the default. What was missing was a way to set those keys
before the first fetch, without a human in Settings and without rebuilding.
So CI baked the values into the bundle and then had to assert the bake worked,
and a binary built for one lane's ports could not serve another's. That is why
the e2e tier is the one test tier in integrations/PARALLEL_LANES.md that
could not be port-parameterized.

What this does

browser/e2e/playwright.config.ts seeds plugin-catalog-url and
integration-proxy-url through storageState, from PLUGIN_CATALOG_URL /
INTEGRATION_PROXY_URL (the VITE_* spellings are accepted under those names
too, so an invocation that used to bake a value keeps working by seeding it).
Origins are deduped and share one seed list, which the viewTransitionsEnabled
entry now lives in as well.

No production shim. A throwaway probe confirmed storageState values are
readable by the very first script on the page, so the window.__ATOMIC_RUNTIME_CONFIG__
fallback was not needed. No query-parameter override either: both values are
fetch targets for authenticated flows, and a URL parameter would make them
settable by any link.

Both validators stay on the path a seeded value takes, so a hostile catalog URL
still cannot be planted. The proxy is still origin-only and the catalog is still
a full path — they are not unified. The config rejects a bad seed loudly,
naming the value, rather than letting the app fall back and the suite report
the product broken.

Two robustness fixes the seeding exposed:

  • getIntegrationProxy() threw out of a render on a stored value that no longer
    validates. It now falls back to the default, like the catalog reader already did.
  • A VITE_* default that would never validate left every read throwing,
    including the Settings screen that could have fixed it. Ignored now.

The .localhost decision

Widened. validateCatalogUrl now shares isLoopbackHost with proxyOrigin,
which already accepted the whole .localhost TLD (RFC 6761). That is what lets
.dagger drop the bake: its proxy is http://atomic.localhost:19090, seeded on
the playwright container instead of compiled into the bundle.

Dagger's other origin, http://atomic:9883, is still not loopback and stays
rejected. Nothing seeds a catalog or proxy there, so it is unaffected.

Also here

The Pets and Notion e2e specs are deleted (second commit). Both moved to
integrations/pets/e2e/pets.spec.ts and integrations/notion/e2e/notion.spec.ts
in ontola/atomic-plugins, so keeping them would run them twice once that
repo's .atomic-server-ref is bumped to this branch. newPlugin() and
setSource() stay — the remaining specs use both, and neither moved spec did.

Note: the handoff expected six specs to remain; there were ten, so eight remain.
Its snapshot predates two additions. Exactly the two named specs were removed.

Verification

  • 10 new unit tests in browser/data-browser/src/helpers/runtimeIntegrationConfig.test.ts:
    seeded value wins over the VITE_* default, an invalid seed falls back rather
    than throwing, an invalid VITE_* default is ignored, .localhost is accepted,
    and the Settings setters still round-trip — for both helpers.
  • 490 tests across helpers / PluginRuns / Settings pass; 43 localthought
    tests pass; e2e and data-browser typecheck, lint and format are clean.
  • A throwaway Playwright probe confirmed the storageState timing, then was removed.

Not verified here: an unmodified --profile e2e binary built with neither
VITE_* running the Integrations suite green needs a full cargo + frontend
rebuild. The mechanism is verified; CI is the real check on the whole run.

What lands downstream afterwards

In ontola/atomic-plugins, once this ships and .atomic-server-ref is bumped:
drop the two VITE_* vars and the "Verify the built frontend uses this repo's
catalog and proxy URLs" step from ci.yml; delete §3's build-time-constraint-on-ports
caveat in integrations/PARALLEL_LANES.md, along with the local flock guard.
The page.route('http://127.0.0.1:19090/**', …) rewrite and ATOMIC_SERVICE_URL
go out of the Pets spec there — neither exists in this repo.

🤖 Generated with Claude Code

Michiel de Jong and others added 2 commits September 22, 2026 13:52
Both URLs were already runtime-overridable through localStorage, but nothing
could set those keys before the first fetch without a human in Settings — so
CI baked `VITE_PLUGIN_CATALOG_URL` / `VITE_INTEGRATION_PROXY_URL` into the
bundle and then had to assert the bake worked. A binary built for one lane's
ports could not serve another's, which is why the e2e tier was the one test
tier that could not be port-parameterized.

Playwright's `storageState` is applied when the browser context is created,
and a probe confirmed the values are visible to the very first script on the
page, so seeding the two keys there is enough — no production shim, and no
query-parameter override (both values are fetch targets for authenticated
flows; a URL parameter would make them settable by any link).

Both validators stay on the path a seeded value takes, so a hostile catalog
URL still cannot be planted, and the proxy is still origin-only while the
catalog is still a full path. The config rejects a bad seed loudly rather than
letting the app fall back and report the product broken.

Two robustness fixes the seeding exposed:

- `getIntegrationProxy()` threw out of a render on a stored value that no
  longer validates. It now falls back to the default, like the catalog reader
  already did.
- A `VITE_*` default that would never validate left every read throwing,
  including the Settings screen that could have fixed it. Ignored now.

`validateCatalogUrl` now shares `isLoopbackHost` with `proxyOrigin`, so the
whole `.localhost` TLD is accepted (RFC 6761), not just the bare name. That is
what lets dagger drop the bake: its proxy is `http://atomic.localhost:19090`,
seeded on the playwright container instead of compiled into the bundle. The
dagger `http://atomic:9883` alias is still not loopback and is unaffected —
nothing seeds a catalog or proxy there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both now live with the plugin they exercise — `integrations/pets/e2e/pets.spec.ts`
and `integrations/notion/e2e/notion.spec.ts` in ontola/atomic-plugins — so
keeping them here runs them twice once that repo's `.atomic-server-ref` is
bumped to this branch.

What stays is the generic plugin editor/sandbox coverage, plus `newPlugin()`
and `setSource()`: the remaining specs use both, and neither moved spec did.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@michielbdejong
michielbdejong merged commit 057e2b6 into feat/plugin-debug Sep 22, 2026
3 checks passed
@michielbdejong
michielbdejong deleted the claude/plugin-catalog-proxy-runtime-0f4739 branch September 22, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant