Skip to content

fix(plugins): normalize host engine stream URLs - #554

Draft
silvertakana wants to merge 2 commits into
mainfrom
fix/plugin-host-engine-url-20261015
Draft

silvertakana wants to merge 2 commits into
mainfrom
fix/plugin-host-engine-url-20261015

Conversation

@silvertakana

Copy link
Copy Markdown
Owner

Summary

Use one canonical engine default and one stream URL normalizer for plugin routing and host globals. Avoid repeated /stream suffixes, including an existing suffix followed by trailing slashes. Preserve explicit HTTP-global overrides verbatim and keep repeat injection idempotent.

Verification

  • Regression demonstrated on the real host injection function before each fix.
  • Targeted tests: 23 passed across host globals and existing routing tests.
  • Parent full suite: 172 files / 1756 tests passed.
  • Parent typecheck, lint and package production build passed; lint retains 315 existing warnings.
  • Covers HTTP/HTTPS/WS/WSS and single/repeated trailing slashes. Query/fragment, malformed and relative inputs were not tested and no new validation policy is claimed.
  • No dependency or lockfile changes.

This PR stays draft while CI and deployment safety are assessed.

… engine host

The plugin host globals carried their own engine defaults and their own /stream
suffix logic, separate from the resolver that plugin routing uses. Two
consequences: __WWV_ENGINE_URL__ and __WWV_WS_ENGINE_URL__ pointed at a retired
engine host, and an explicit NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL that already
ended in /stream produced a doubled /stream/stream stream URL.

Both globals now derive from the canonical CLOUD_ENGINE_URL constant and the
existing toWsStreamUrl normalizer, which the resolver exports. Explicit env
overrides still win unchanged, the HTTP base global keeps mirroring the raw env
value, and the http/https to ws/wss scheme pairing is preserved. Added contract
tests for the defaults, the override path, the trailing slash, and the schemes.

Version bumped to 2.68.26 (patch, per the repo release policy).
toWsStreamUrl checked `endsWith("/stream")` before stripping trailing
slashes, so an engine env value of "https://engine.example.test/stream/"
was not recognized as already carrying the stream path and the host globals
injected "wss://engine.example.test/stream/stream". The same applied to a
value ending in repeated slashes.

Trailing slashes are now stripped first, then the suffix is checked, so
"…/stream/" yields "…/stream" and "…/" yields "…/stream" for http, https,
ws and wss. Explicit env overrides still win, the HTTP base global still
mirrors the raw env value verbatim, the scheme substitutions and the
malformed/query policy are unchanged, and repeated injection still leaves
the established globals untouched.

Added real-injection regressions for the /stream/ and repeated-slash forms
across all four supported schemes, the verbatim REST override, and a second
injection after the env changes. The test file's header no longer claims
proven out-of-tree consumers; it now says external plugins may consume the
globals and no consumer is proven.

Version bumped to 2.68.27 (patch, per the repo release policy).
@github-actions

Copy link
Copy Markdown
Contributor

Left for a person rather than auto-merged: not a Dependabot pull request. Patch and minor updates merge themselves once every check has completed green; this one is listed in the weekly dependency digest.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant