Skip to content

fix: Normalize WasmShellWebAppBasePath - #1082

Merged
MartinZikmund merged 3 commits into
unoplatform:mainfrom
mikernet:dev/mikernet/base-path-normalization
Oct 8, 2026
Merged

MartinZikmund merged 3 commits into
unoplatform:mainfrom
mikernet:dev/mikernet/base-path-normalization

Conversation

@mikernet

Copy link
Copy Markdown
Contributor

Fixes #1081

What is the current behavior?

WasmShellWebAppBasePath is concatenated verbatim into every generated reference. /app yields /apppackage_<hash>/..., app/ is resolved relative to the current document and breaks on deep links, and an empty value makes the index.html rewrite match every quote in the template.

What is the new behavior?

ShellTask.ParseProperties() normalizes the value through a new WebAppBasePathHelper, so every consumer sees the same string:

  • empty or whitespace → ./ (the bootstrapper default)
  • starts with . → kept relative, trailing slash added
  • contains :// → kept as written, trailing slash added
  • anything else → leading and trailing slash added; backslashes become slashes

app, app/, /app and /app/ now all produce /app/.

Docs updated (features-deep-linking.md, features-environment-variables.md) and a spec added under specs/005-web-app-base-path-normalization.

Validation

  • Given_WebAppBasePathHelper unit tests cover each rule (17 cases); the unit test project passes, 59 tests.
  • Uno.Wasm.Tests.Fingerprint built with -p:WasmShellWebAppBasePath=app and with /app/ produces identical index.html script references and service worker import (/app/package_<hash>/uno-bootstrap.js).

Copilot AI lite review requested due to automatic review settings September 21, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Absolute URL dependency generation has a critical unresolved issue, with additional documentation and spec nits.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Normalizes WasmShellWebAppBasePath for consistent generated Wasm asset paths.

Changes:

  • Added centralized base-path normalization.
  • Integrated normalization into ShellTask.
  • Added unit tests, specification, and documentation updates.
File Summary
src/​Uno.Wasm.Bootstrap/​WebAppBasePathHelper.cs Implements base-path normalization.
src/​Uno.Wasm.Bootstrap/​ShellTask.cs Applies normalization; critical issue remains for absolute URL dependency paths (1 vote).
src/​Uno.Wasm.Bootstrap.UnitTests/​Given_WebAppBasePathHelper.cs Covers normalization rules.
specs/​005-web-app-base-path-normalization/​spec.md Documents requirements; nit: use the next sequential spec prefix (1 vote).
doc/​features-environment-variables.md Updates environment-variable guidance; nit: document absolute URL handling (1 vote).
doc/​features-deep-linking.md Updates deep-linking guidance; nit: document absolute URL handling (1 vote).

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Uno.Wasm.Bootstrap/ShellTask.cs Resolved
Copilot AI review requested due to automatic review settings September 21, 2026 14:58
@mikernet
mikernet force-pushed the dev/mikernet/base-path-normalization branch from 5c398de to 7d65231 Compare September 21, 2026 14:59
@mikernet
mikernet force-pushed the dev/mikernet/base-path-normalization branch from 7d65231 to 62eb5fe Compare September 21, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation is tested and the remaining specification feedback is a non-blocking nit.

Review effort: Lite
Findings: 1 High severity

Open (1)

Copilot AI review requested due to automatic review settings September 21, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: 1 High severity

Open (1)

@mikernet

mikernet commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

The Packages Windows failure here is not related to this change. The only failing task is Authenticode Sign Packages: the sign tool rejects an empty Azure tenant id for every package because PR builds don't receive the signing secrets. Every other job (Linux, Windows and macOS tests, docs checks, and the package build itself) passes.

The signing step is meant to be skipped on pull requests, but its condition in build/ci/stage-build-packages.yml is indented under the task's parameters, so the pipeline ignores it. #1080 moves that line to the task level and is the only one of my open PRs with a green Packages Windows job. Once #1080 is in, a re-run against master will clear this.

Copilot AI lite review requested due to automatic review settings October 8, 2026 06:09
@MartinZikmund

Copy link
Copy Markdown
Member

🤖 Addressed PR comments up to this point

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The specification uses an inconsistent numeric prefix and should be renamed before approval.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Low severity Use the correct next spec prefix and update references

specs/​010-web-app-base-path-normalization/​spec.md:1

The repository currently has spec prefixes 001, 002, and 003, so 010 is not the next available numeric prefix; the PR description also refers to specs/005. Please move this spec to the intended next prefix and update any references so the required spec can be found consistently.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

mikernet and others added 3 commits October 8, 2026 09:09
Every generated reference concatenates the base path directly, so a
value without a trailing slash produced paths like /apppackage_<hash>,
and a value without a leading slash was resolved relative to the
current document and broke on deep links. The value is now normalized
once when the task reads its properties: empty becomes ./, a value
starting with a dot stays relative, a URL stays as is, and anything
else gets a leading and a trailing slash.
BuildDependencyPath treated only a site path as absolute, so a URL
base path produced require.js module ids without the prefix.
Spec 005 is already claimed by the PWA service worker spec, so this
moves to 010. Adds the dependency entry requirement and notes in the
docs that an absolute URL base is kept as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ADrzrqtw3RQdHan77rypBM
Copilot AI lite review requested due to automatic review settings October 8, 2026 07:09
@MartinZikmund
MartinZikmund force-pushed the dev/mikernet/base-path-normalization branch from d17c09f to c123e94 Compare October 8, 2026 07:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Absolute URLs with query strings or fragments are not handled correctly and can produce invalid asset paths.

1 open finding

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@MartinZikmund
MartinZikmund disabled auto-merge October 8, 2026 08:19
@MartinZikmund
MartinZikmund merged commit c56ebc9 into unoplatform:main Oct 8, 2026
15 checks passed
@mergify

mergify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

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.

WasmShellWebAppBasePath is not normalized: missing leading or trailing slash corrupts generated paths

3 participants