Skip to content

Conversation

@pavelsavara
Copy link
Member

  • Add gitHash into each JS file/module and check the consistency during startup
  • This is fail fast for scenarios where HTTP cache or build folders contain inconsistent versions of JS files.

@pavelsavara pavelsavara added this to the 11.0.0 milestone Dec 31, 2025
@pavelsavara pavelsavara self-assigned this Dec 31, 2025
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Dec 31, 2025
Copilot AI review requested due to automatic review settings December 31, 2025 14:01
@pavelsavara pavelsavara added area-Host os-browser Browser variant of arch-wasm labels Dec 31, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds git hash consistency checking across JavaScript modules in the browser CoreCLR runtime. The implementation adds a gitHash to each JS module and validates during startup that all modules were built from the same git commit, providing fail-fast detection for scenarios where HTTP caches or build folders contain mismatched versions of JS files.

Key Changes:

  • Imports GitHash from "consts:gitHash" in each module and exports it for runtime access
  • Adds validation logic in dotnetInitializeModule functions to compare the loader's gitHash with each module's gitHash
  • Updates footer.js files to export the gitHash and exclude it from automatic export iteration
  • Changes corerun's gitHash from "corerun" to null to skip validation for development builds

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/native/libs/System.Runtime.InteropServices.JavaScript.Native/native/index.ts Adds gitHash import, export, and consistency check comparing with DOTNET_INTEROP.gitHash
src/native/libs/System.Runtime.InteropServices.JavaScript.Native/native/cross-linked.ts Declares DOTNET_INTEROP as a global constant
src/native/libs/System.Runtime.InteropServices.JavaScript.Native/libSystem.Runtime.InteropServices.JavaScript.Native.footer.js Exports gitHash on DOTNET_INTEROP object and excludes it from export iteration
src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/index.ts Adds gitHash import and consistency check, refactors to get runtimeApi earlier for validation
src/native/libs/System.Native.Browser/utils/index.ts Adds gitHash import and consistency check, moves initPolyfills after validation
src/native/libs/System.Native.Browser/native/index.ts Adds gitHash import, export, and consistency check comparing with DOTNET.gitHash
src/native/libs/System.Native.Browser/libSystem.Native.Browser.footer.js Exports gitHash on DOTNET object and excludes it from export iteration
src/native/libs/System.Native.Browser/diagnostics/index.ts Adds gitHash import and consistency check
src/native/corehost/browserhost/host/index.ts Adds gitHash import and consistency check after Object.assign
src/coreclr/hosts/corerun/wasm/libCorerun.extpost.js Changes gitHash from "corerun" string to null to skip validation

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

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant