Repository navigation
Embed native assets in the integration test snapshot - #4888
Merged
Merged
Conversation
mosuem
force-pushed
the
use-dart-build-cli
branch
11 times, most recently
from
August 28, 2026 11:14
8966a9f to
aaf5234
Compare
mosuem
marked this pull request as ready for review
August 28, 2026 12:49
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Sep 3, 2026
Needed for dart-lang/pub#4888. In dart-lang/pub tests, pub was previously precompiled to a snapshot for fast execution. However, snapshot compilation does not support native assets. Switching to `dart build cli` creates a standalone binary, causing `Platform.resolvedExecutable` to point to the standalone executable rather than `dart`. Previously, `FrontendServerClient.start` only used `sdkRoot` as a child compiler argument, but resolved `dartaotruntime` and snapshot binaries relative to `Platform.resolvedExecutable`. This caused compiler spawning failures when running from standalone CLI tools. Also removes dead IA32 code in the scope. TESTED=pkg/frontend_server_client/test/frontend_server_client_test.dart Change-Id: Ib94c15f8fc1cad71b664d0e184a4fd3b90cf96ff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/542720 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Moritz Sümmermann <mosum@google.com>
sigurdm
reviewed
Sep 4, 2026
sigurdm
reviewed
Sep 4, 2026
sigurdm
reviewed
Sep 4, 2026
sigurdm
requested changes
Sep 4, 2026
sigurdm
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this! A few observations:
- The CI test failures (
Could not find an option named "--sdk-root") are becausefrontend_server_clientresolves the SDK relative toPlatform.resolvedExecutable, which points topubinstead ofdartwhen running as an AOT binary. I saw you landed the fix in the SDK repo (commit 26b1e4c). That package will need to be published to pub.dev andpubspec.yamlupdated here before CI can turn green. masterrecently received workflow fixes (#4900), so this will need a rebase onmaster.- See inline comments regarding binstub generation in production, running tests with assertions enabled, and Windows path quoting.
mosuem
force-pushed
the
use-dart-build-cli
branch
from
October 12, 2026 07:34
aaf5234 to
65a1cea
Compare
mosuem
force-pushed
the
use-dart-build-cli
branch
from
October 12, 2026 07:50
65a1cea to
c3fe8ce
Compare
mosuem
added a commit
to dart-lang/pub-dev
that referenced
this pull request
Oct 12, 2026
…pshot `package:sigstore` calls into `libsigstore_ffi.so` through `@Native` bindings, which the VM resolves through a native assets mapping. `dart run` produces that mapping by executing build hooks and embeds it in the kernel it runs; `dart compile jit-snapshot` does not, so the server snapshot in `Dockerfile.app` could not load the library at runtime. - `tool/build-server-snapshot.sh` compiles the server to kernel, compiles a mapping (asset id -> path of the library in the image) to a kernel component with the frontend server, concatenates the two and creates the app-JIT snapshot from the result. The VM keeps the mapping in the snapshot, so no hooks or package sources are needed at runtime. This is the mechanism `dart run` uses (cf. dart-lang/pub#4888). - `Dockerfile.app` builds the snapshot with that script, compiles the library from the Rust source bundled with the package in a `rust-build` stage (no prebuilt binaries are downloaded), and copies it - together with `libgcc_s`, which it needs and which is not in the Dart image's `/runtime` - into the final image. - `server.jit self-check` (hidden command) calls into the native library; `dockerfile_app_build_test.dart` runs it in the built image, and the frontend entrypoint performs the same check at startup so that a broken image fails to boot instead of failing every attested upload.
sigurdm
approved these changes
Oct 12, 2026
sigurdm
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks for the rewrite.
mosuem
added a commit
to dart-lang/pub-dev
that referenced
this pull request
Oct 12, 2026
Adds `package:sigstore` and an `AttestationVerifier` service that verifies the Sigstore bundle uploaded with a package archive before the version is published: - verifies the Fulcio certificate signer identity against the trusted reusable publishing workflows (`defaultTrustedSignerWorkflows`), over the archive's sha256 digest that `publishUploadedBlob` already computed (`SigstoreClient.verify(..., isDigest: true)`), so the archive is neither read into memory nor hashed again, - parses the in-toto SLSA v1 DSSE provenance statement from the same bundle JSON (`BuildProvenance.parseBundle`), - enforces the provenance policy (`checkProvenancePolicy`): binds the archive sha256 and subject name, verifies `provenance.sourceRepository` against the `repository:` of the uploaded `pubspec.yaml`, and - when GitHub Actions automated publishing is enabled for the package - also against `publishingConfig.githubConfig.repository`, - rejects the upload with `PackageRejectedException` when the attestation is invalid or fails verification; internal errors (e.g. the native library missing) propagate as a 500 instead of blaming the upload. `AttestationVerifier` is a registered service (`registerAttestationVerifier` / `attestationVerifier`); `withFakeServices` registers a `FakeAttestationVerifier` that replaces only the cryptographic step and trusts the builder self-reported in the statement, so tests exercise the real provenance parsing and policy with hand-crafted bundles. An end-to-end test verifies a real signed bundle. Deployment: `package:sigstore` calls into `libsigstore_ffi.so` through `@Native` bindings, which the VM resolves through a native assets mapping that `dart compile jit-snapshot` does not produce. `tool/build-server- snapshot.sh` compiles the server to kernel, compiles the mapping (asset id -> path of the library in the image) to a kernel component with the frontend server, concatenates the two and creates the app-JIT snapshot from the result; the VM keeps the mapping in the snapshot, so no hooks or package sources are needed at runtime (the mechanism `dart run` uses, cf. dart-lang/pub#4888). `Dockerfile.app` builds the library from the Rust source bundled with the package in a `rust-build` stage (no prebuilt binaries are downloaded) and copies it, with `libgcc_s`, into the final image. `server.jit self-check` calls into the native library; `dockerfile_app_build_test.dart` runs it in the built image, and the frontend entrypoint performs the same check at startup so that a broken image fails to boot instead of failing every attested upload.
mosuem
added a commit
to dart-lang/pub-dev
that referenced
this pull request
Oct 12, 2026
Adds `package:sigstore` and an `AttestationVerifier` service that verifies the Sigstore bundle uploaded with a package archive before the version is published: - verifies the Fulcio certificate signer identity against the trusted reusable publishing workflows (`defaultTrustedSignerWorkflows`), over the archive's sha256 digest that `publishUploadedBlob` already computed (`SigstoreClient.verify(..., isDigest: true)`), so the archive is neither read into memory nor hashed again, - parses the in-toto SLSA v1 DSSE provenance statement from the same bundle JSON (`BuildProvenance.parseBundle`), - enforces the provenance policy (`checkProvenancePolicy`): binds the archive sha256 and subject name, verifies `provenance.sourceRepository` against the `repository:` of the uploaded `pubspec.yaml`, and - when GitHub Actions automated publishing is enabled for the package - also against `publishingConfig.githubConfig.repository`, - rejects the upload with `PackageRejectedException` when the attestation is invalid or fails verification; internal errors (e.g. the native library missing) propagate as a 500 instead of blaming the upload. `AttestationVerifier` is a registered service (`registerAttestationVerifier` / `attestationVerifier`); `withFakeServices` registers a `FakeAttestationVerifier` that replaces only the cryptographic step and trusts the builder self-reported in the statement, so tests exercise the real provenance parsing and policy with hand-crafted bundles. An end-to-end test verifies a real signed bundle. Deployment: `package:sigstore` calls into `libsigstore_ffi.so` through `@Native` bindings, which the VM resolves through a native assets mapping that `dart compile jit-snapshot` does not produce. `tool/build-server- snapshot.sh` compiles the server to kernel, compiles the mapping (asset id -> path of the library in the image) to a kernel component with the frontend server, concatenates the two and creates the app-JIT snapshot from the result; the VM keeps the mapping in the snapshot, so no hooks or package sources are needed at runtime (the mechanism `dart run` uses, cf. dart-lang/pub#4888). `Dockerfile.app` builds the library from the Rust source bundled with the package in a `rust-build` stage (no prebuilt binaries are downloaded) and copies it, with `libgcc_s`, into the final image. `server.jit self-check` calls into the native library; `dockerfile_app_build_test.dart` runs it in the built image, and the frontend entrypoint performs the same check at startup so that a broken image fails to boot instead of failing every attested upload.
Run the integration tests through `dart run tool/test.dart` in CI, and pass the native assets mapping written by `dart run` (.dart_tool/native_assets.yaml) to `precompile` so that it is embedded in the pub snapshot used by the tests. This re-adds the `nativeAssets` pass-through to `precompile` that was removed in #4910. This prepares the test setup for dependencies with native assets (package:sigstore in #4875) without changing how pub locates the SDK: pub keeps running under the `dart` VM with assertions enabled, as in production.
sigurdm
force-pushed
the
use-dart-build-cli
branch
from
October 12, 2026 14:02
0bc2bd8 to
7caaabd
Compare
sigurdm
removed this pull request from stack #4904
October 12, 2026 14:16
sigurdm
added this pull request to stack #4944
October 12, 2026 14:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.
Prepares the integration test setup for dependencies with native assets (
package:sigstorein #4875).tool/test.dartpasses the native assets mapping written bydart run(.dart_tool/native_assets.yaml, if present) toprecompile(nativeAssets: ...), so it is embedded in the pub snapshot that the tests execute. This re-adds thenativeAssetspass-through toprecompileinlib/src/dart.dartthat was removed in Remove local executable precompilation and deprecate --precompile #4910.dart run tool/test.dart --preset ci ..., which executes the build hooks, builds the snapshot and forwards the arguments todart test. This replaces the separatedart --snapshotstep (_PUB_TEST_SNAPSHOTis now set bytool/test.dart).Pub keeps running under the
dartVM with assertions enabled in the tests, as in production, so no changes to how pub locates the SDK are needed.This supersedes the earlier
dart build cliapproach in this PR (see the review discussion): running pub as a standalone AOT executable madePlatform.resolvedExecutablepoint at pub instead ofdart, which brokeprecompileand required workarounds in production code.