Skip to content

fix: Move uno-config.js out of the fingerprinted package folder - #1077

Merged
MartinZikmund merged 15 commits into
unoplatform:mainfrom
mikernet:dev/mikernet/uno-config-cache
Oct 8, 2026
Merged

MartinZikmund merged 15 commits into
unoplatform:mainfrom
mikernet:dev/mikernet/uno-config-cache

Conversation

@mikernet

@mikernet mikernet commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1076

What is the current behavior?

uno-config.js is emitted inside package_<hash>/, but the folder hash is computed over the static web content before the file is generated, and _UnoUpdateDotnetJsFingerprintPublishOutput rewrites it again at publish time with the actual dotnet.<fingerprint>.js name. Hosts cache package_* as immutable, so a publish that only changes managed code keeps the folder name and returning visitors get the previous uno-config.js. It points at a dotnet.js that no longer exists (boot fails) or still exists (the previous build runs against the new assets).

What is the new behavior?

  • uno-config.js lives at the wwwroot root next to index.html, in every shell mode, where hosts always revalidate it.
  • The bootstrapper imports it from one folder above its own module URL, so root, sub-folder, and embedded.js hosting all resolve it correctly.
  • The service worker imports it from the web app base path, and the PWA offline list references the root path.
  • WebWorker scripts fetch it from their own folder; the __unoWorkerPackagePath global is gone.
  • The publish-time fingerprint update patches the root file. The $(WasmShellOutputPackagePath) lookup is removed.
  • The version checker probes one folder above uno-bootstrap.js first, then beside it for older layouts, with the same root-first order for the embedded.js fallback.
  • config.uno_app_base and every other package-relative value are unchanged.

Docs: the deployment page gains a cache-policy table per folder, and the fingerprinting page explains where the file lives and why. Spec: specs/008-root-uno-config/spec.md, with the version checker and WebWorker specs updated to match.

Validation

  • test-fingerprint.sh: all seven scenarios pass, including a new check that the published uno-config.js is at the root and absent from every package_* folder. The log shows the build fingerprint differing from the publish fingerprint, which is the mechanism this change addresses.
  • Published Uno.Wasm.Tests.Fingerprint and loaded it in a browser from a site root and from a /app/ sub-folder: the root uno-config.js is fetched, then the fingerprinted runtime scripts, and the runtime initialises.
  • Uno.Wasm.SampleNet7 built with WasmPWAManifestFile: the service worker imports ./uno-config.js and the offline list contains the root path.
  • Uno.Wasm.VersionChecker.UnitTests: 48 passed, including two new tests for the root layout via uno-bootstrap.js and via embedded.js.
  • CI scripts (validate-boot-config.sh, validate-dotnetjs-fingerprint.sh, test-webgl-4gb.sh, test-webworker.sh) locate the file at the root.

Notes

Copilot AI lite review requested due to automatic review settings September 21, 2026 13: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.

Copilot review overview

🟡 Changes recommended

Required validation-path fixes and specification updates remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Moves uno-config.js from fingerprinted package folders to the web root, preventing stale cached boot configurations.

Changes:

  • Updates bootstrapper, service-worker, WebWorker, and version-checker resolution.
  • Adjusts publishing, validation scripts, tests, specifications, and documentation.
  • Open findings: one critical sample validation path, one moderate WebWorker validation path, and two specification nits require updates.
File Summary
src/​Uno.Wasm.VersionChecker.UnitTests/​Given_VersionCheckService.cs Adds root-layout discovery tests.
src/​Uno.Wasm.VersionChecker.Core/​VersionCheckService.cs Adds root-first configuration probing.
src/​Uno.Wasm.Tests.WebGL4Gb/​test-webgl-4gb.sh Finds the root configuration.
src/​Uno.Wasm.Tests.Fingerprint/​test-fingerprint.sh Validates configuration placement.
src/​Uno.Wasm.Bootstrap/​ts/​Uno/​WebAssembly/​WorkerBootstrapper.ts Loads worker-local configuration.
src/​Uno.Wasm.Bootstrap/​ts/​Uno/​WebAssembly/​Bootstrapper.ts Loads root configuration.
src/​Uno.Wasm.Bootstrap/​ShellTask.cs Emits root-level configuration and removes the worker global.
src/​Uno.Wasm.Bootstrap/​Embedded/​service-worker.js Imports root configuration.
src/​Uno.Wasm.Bootstrap/​build/​Uno.Wasm.Bootstrap.targets Patches root configuration during publishing.
specs/​004-root-uno-config/​spec.md Specifies the new configuration layout.
specs/​003-webworker-mode/​spec.md Updates WebWorker requirements.
specs/​003-wasm-version-checker/​spec.md Updates version-checker requirements.
doc/​features-version-checker.md Documents root configuration reporting.
doc/​features-dotnetjs-fingerprinting.md Documents configuration placement.
doc/​deploy-and-publish.md Documents cache policies.
build/​scripts/​validate-dotnetjs-fingerprint.sh Updates fingerprint validation guidance.
build/​scripts/​validate-boot-config.sh Updates boot configuration validation guidance.

💡 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 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

🔵 Needs a closer look

Two validation-script issues and one documentation issue remain unresolved.

Review effort: Lite
Findings: None

Resolved since last review (1)

@mikernet

Copy link
Copy Markdown
Contributor Author

No idea what "Two validation-script issues and one documentation issue remain unresolved" copilot is referring to...it didn't indicate anything above.

@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.

@MartinZikmund

Copy link
Copy Markdown
Member

Thanks @mikernet! We're going with this approach and closed #1099, which fixed the same bug differently. I pushed two docs commits here:

  • Caching guidance: the template's staticwebapp.config.json currently sends must-revalidate, max-age=3600 for the root files and web.config sets no cache policy, so the docs and spec no longer say they already implement the policy. Added an Azure Static Web Apps example, a note on why root files need an explicit Cache-Control (heuristic caching, CDNs caching .js by extension), and the WasmFingerprintAssets=false caveat for _framework.
  • Spec number: renamed specs/004-root-uno-config to specs/008-root-uno-config, since 004 is taken by fix: Retry and time out boot downloads #1095.

Heads-up: #1098 also edits _UnoUpdateDotnetJsFingerprintPublishOutput, so whichever merges second needs a small rebase.

MartinZikmund added a commit that referenced this pull request Oct 7, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
MartinZikmund added a commit that referenced this pull request Oct 7, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
@mikernet

mikernet commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@MartinZikmund No problem - you're welcome :)

Just in case it got missed, I also have 4 other PRs in this repo that are ready for review (not sure how frequently PRs are checked here).

@mikernet

mikernet commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

@MartinZikmund Sorry, last ping I promise - forgot to mention this somewhat related PR that fixes web.config caching (among other things) in the uno templates as well.

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

MartinZikmund added a commit that referenced this pull request Oct 7, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
MartinZikmund added a commit that referenced this pull request Oct 7, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
Copilot AI lite review requested due to automatic review settings October 7, 2026 21:24
@MartinZikmund
MartinZikmund force-pushed the dev/mikernet/uno-config-cache branch from dbc5dd2 to d272dc5 Compare October 7, 2026 21:24
@MartinZikmund

Copy link
Copy Markdown
Member

Rebased onto the latest main, which now includes #1098. The conflict in _UnoUpdateDotnetJsFingerprintPublishOutput resolves to #1098's ResolvePublishedDotnetJsTask_v0 plus the root uno-config.js path from this PR.

I also added ci: Skip package signing on pull requests. That's the cause of the Packages Windows failure you noticed: the signing step's condition: was indented under env:, so it was just an environment variable and signing ran on every build. Fork PRs don't get the signing secrets.

Locally, the bootstrap and version checker unit tests and test-fingerprint.sh (all scenarios, including 4c) pass.

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

A critical publish-path issue and validation/specification inconsistencies remain unresolved.

5 open findings

🧠 Review effort: Lite

Comment thread src/Uno.Wasm.Bootstrap/ShellTask.cs Resolved
Comment thread build/scripts/validate-boot-config.sh Resolved
Comment thread specs/003-webworker-mode/spec.md Resolved
Comment thread specs/008-root-uno-config/spec.md Resolved
@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 fingerprint test can still select a stale package copy, and deployment docs need a WebWorker cache-policy exception.

0 open findings

5 resolved since last review

🧠 Review effort: Lite


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

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

Copy link
Copy Markdown
Member

Pushed a few follow-ups from a final review pass, each as its own commit:

  • 5191155b: the service worker is registered with updateViaCache: 'none'. It imports the root uno-config.js, whose URL no longer changes between deployments, so with the default an updated worker could install with the previous config.
  • f269c242 / 2b910d6b: the version checker only accepts a probe that actually serves an Uno config. Single-page-app hosts answer /uno-config.js with index.html, which hid the package folder config of older sites. A network error on a probe now falls through to the next candidate. Both cases have tests.
  • 51b59f54: the server publish warns when several legacy package_*/uno-config.js match and none can be updated.
  • 7ff15adb: test-fingerprint.sh and test-webworker.sh read the root config directly.
  • b5e3070c: dropped the now-unused $(REMOTE_BASE_PATH) replacement.

Checked locally: bootstrap and version checker unit tests, test-fingerprint.sh, and the full WebWorker test, including the Puppeteer run.

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

Deployment cache guidance and version-checker specification wording need clarification and alignment.

0 open findings

🧠 Review effort: Lite


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

mikernet and others added 15 commits October 8, 2026 09:10
The package_<hash> folder name is computed over the static web content
before uno-config.js is generated, and the publish-time fingerprint
update rewrites the file again after the folder name is baked into
index.html. Hosts cache package_* as immutable, so a publish that only
changed managed code kept the folder name and served the previous
uno-config.js to returning visitors, which pointed at a dotnet.js that
no longer existed or booted the previous build.

uno-config.js now lives next to index.html, where hosts always
revalidate. The bootstrapper imports it one level above its own folder,
the service worker and offline file list reference it at the web app
base path, WebWorker scripts fetch it from their own folder, and the
publish-time update patches it at the root.

Fixes unoplatform#1076
The bootstrapper now lives in the hashed package folder while the
configuration sits next to the page that loads it. Pages referencing
uno-bootstrap.js are probed one folder above the bootstrapper first,
then next to it for older layouts, and the embedded.js fallback probes
the site root before the package folder.
The RayTracer sample's publish validation and the PowerShell
fingerprint validation still looked for uno-config.js inside the
package folder.
The template's staticwebapp.config.json caches the root files for an hour
and web.config sets no cache policy, so neither implements the policy yet.
Add an Azure Static Web Apps example and the WasmFingerprintAssets caveat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
004 is taken by the resilient loading spec. The template's hosting files
don't revalidate the root files yet, so the spec no longer claims they do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
The recursive glob also matched WebWorker copies, giving a
semicolon-separated path. Use wwwroot/uno-config.js, falling back to
package_*/uno-config.js for apps built with an older bootstrapper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
A stale copy under package_* could otherwise satisfy the validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
The worker imports the root uno-config.js, whose URL no longer changes
between deployments. With the default updateViaCache, an updated worker
could install with the previous deployment's config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
Single-page-app hosts answer the root uno-config.js probe with index.html,
which hid the package folder config of older layouts. A network failure on
a probe now moves on to the next candidate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
@MartinZikmund
MartinZikmund force-pushed the dev/mikernet/uno-config-cache branch from d4eaafa to e56e6df Compare October 8, 2026 07:10
@MartinZikmund
MartinZikmund merged commit c7316b6 into unoplatform:main Oct 8, 2026
15 checks passed
MartinZikmund added a commit that referenced this pull request Oct 8, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
MartinZikmund added a commit that referenced this pull request Oct 8, 2026
The config is versioned no more, and moves next to index.html with #1077.
Preload it from there when it is, otherwise from the package folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
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.

uno-config.js is rewritten inside the fingerprinted package_* folder, so cached copies boot the previous build

3 participants