Skip to content

fix(views,facade): load fragment pages from the resolved Web Host URL - #248

Merged
AndrewKirkovski merged 1 commit into
masterfrom
fix/views-fragment-resolved-host-url
Nov 8, 2026
Merged

AndrewKirkovski merged 1 commit into
masterfrom
fix/views-fragment-resolved-host-url

Conversation

@AndrewKirkovski

@AndrewKirkovski AndrewKirkovski commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

With the fragment render engine, fragment pages now load the same Web Host as the shell.

Why

In the fragment engine, two places register an import map, and they read the Host URL from different sources:

  • The facade shell (index.jet) fetches /facade/config, then registers {facade_url}/import-map.json and imports the Host from facade_url. That value is resolved: the application resolver's value, then a module contribution (for example wippy/cdn-web-host), then the requirement default.
  • The views realm stub (fragment_bootstrap.lua, built by fragment_service.lua) builds each fragment realm from the static wippy.facade:fe_facade_url default: the Host import map it fetches on the server, loading.js, import-map-bootstrap.js, proxy-fragment.js, and the four Host CSS links in the page document.

The Host adds no map of its own to a realm. w-page-fragment.vue only mounts <web-fragment src="/@fragment/{id}/"> and waits on __WIPPY_IMPORT_MAP_READY__, and WippyImportMapBootstrap.register() allows one map per document. So whenever the resolved URL differs from the default, the shell and the fragment pages run different Hosts.

Measured on app-template-raw with wippy/cdn-web-host 0.0.68 (Host 1.0.68), the fragment engine, base 2778e0a against this branch:

Base This branch
Realm import map entries that differ from the shell's map 294 of 294 (CDN) 0 of 294 (app)
Host CSS links in the fragment CDN app
Host requests from the realm 22 to the CDN 22 to the app
Facade default set to Host 1.0.67, cdn-web-host still 1.0.68 shell runs 1.0.68, fragment pages run 1.0.67 (231 requests) everything runs 1.0.68

Change

  • Facade: adds wippy.facade:host_url. It returns the URL that /facade/config serves as facade_url. The config endpoint and the function share one step for the resolver and contributions (resolve_requirements). The function's actor has the config endpoint's resolver and contributor policies, without file access. Like the CSS variables handler, it calls the resolver under its own actor.
  • Views: the gateway calls wippy.facade:host_url, with a policy that allows only that call. When the function is missing (an older facade), it keeps the static default without a warning. When the call fails, it logs a warning and uses the static default.

The gateway already fetches each fragment page's HTML from PUBLIC_API_URL on the server. With a module-served Host, it now also fetches the Host import map from that URL instead of the CDN. The added facade call costs about 0.4 ms per stub or document request (median 3.6 to 4.0 ms).

Checks

  • Facade: lint clean, 116 tests pass. New tests cover the resolver step with fakes, the function against the real config endpoint with a real test contributor, and the function's policies.
  • Views: lint clean, 210 Lua tests and 15 JS tests pass. New tests cover the lookup and its fallbacks, and the call policy.
  • Consumer walk (15 pages) on this branch: fragment and iframe engines with cdn-web-host, the fragment engine without it (CDN default as before), and these views with the published facade 0.6.50 (old behavior, no warnings). All had 0 console, page or request errors, and every web component rendered.

The views fragment gateway read the static wippy.facade:fe_facade_url
default. With the fragment render engine, a Host URL from the application
resolver or a module contribution (such as wippy/cdn-web-host) reached the
shell but not the fragment pages, which still loaded the Host from the
public CDN.

Facade adds wippy.facade:host_url. It returns the URL that /facade/config
serves as facade_url, through the same resolver and contributor step as the
config endpoint. The views gateway calls it and falls back to the static
default when the function is missing (an older facade) or fails.
@AndrewKirkovski
AndrewKirkovski marked this pull request as ready for review November 8, 2026 21:08
@AndrewKirkovski
AndrewKirkovski merged commit 23f742d into master Nov 8, 2026
25 checks passed
@AndrewKirkovski
AndrewKirkovski deleted the fix/views-fragment-resolved-host-url branch November 8, 2026 21:42
@wippy-releases wippy-releases Bot mentioned this pull request Nov 8, 2026
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