fix: write wasm build output to the reported artifact path#9
Merged
Conversation
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.
Summary
build wasmso the compiler writes to the same artifact path the CLI reports in JSON output--path services/orchestratorcase that previously produced a false-success buildProblem
A user reported that this sequence could return success even though
dist/app.wasmdid not exist afterward:The CLI reported:
artifact: services/orchestrator/dist/app.wasmfiles: [services/orchestrator/dist/app.wasm, ...]But the actual file was missing at that path.
Root Cause
The build service constructed the default artifact path by prefixing it with
options.Path, and then invokedgo buildwithDir=options.Path.That meant the compiler received an output path like:
while already running inside
services/orchestrator, so the effective compiler output path became a nested path like:The CLI then returned success and reported the non-nested path, which could leave users with a missing or stale artifact at the location they were told was built.
Fix
This PR:
go buildortinygoTesting
go test ./internal/service/buildgo test ./...Also verified with a real end-to-end build using a disposable nested project path matching the failure mode:
services/orchestratorflare-edge-cli build --path services/orchestrator --jsonfrom the parent directoryservices/orchestrator/dist/app.wasmexists and is a real WebAssembly binaryUser Impact
After this change, the reported artifact path and the actual compiler output path stay aligned. Builds that previously produced a silent false success should now either:
dist/app.wasmpath, or