fix: relock go steps whose stored lock is not a go.mod#9995
Draft
rubenfiszel wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying windmill with
|
| Latest commit: |
78388d4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c0b90b3c.windmill.pages.dev |
| Branch Preview URL: | https://ruben-win-2141-fix-go-single.windmill.pages.dev |
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.
Fixes WIN-2141
Summary
A Go script or flow step whose stored lockfile is not actually a go.mod fails at runtime with:
That content is exactly bun's no-dependencies
package.json— a lock left over from the step's previous language (e.g. a flow step created as TypeScript, later switched to Go). Two compounding causes:skip_creating_new_lockonly special-cases bun↔bunnative), so the stale cross-language lock survives redeploys.handle_go_jobwrites the stored lock verbatim intogo.modand runsgo mod tidy, which explodes on non-go.mod content.The reported "single import fails, parenthesized import works, then single import works again" was sequencing, not parsing (
parse_go_importshandles single-line imports fine — verified): any content edit clears the module lock in the editor and forces a proper relock, and the follow-up relock is served frompip_resolution_cache(both import styles hash to the same empty-imports key), which is the "like it was using some cached version" observation.Changes
go_executor.rs: newis_go_mod_lockhelper — a usable Go lock always embeds a go.mod, which requires amoduledirective (token-based check, immune to JSON keys like"module": "esnext"). Unit tests included.go_executor.rs(handle_go_job): aResolvedlock that fails the check is ignored — a warning is appended to the job logs and the job falls back toMaybeLock::Unresolved, resolving dependencies from imports. This self-heals already-deployed scripts/flows carrying a bad lock, without redeploy. Placed before the binary-cache hash so the cache key reflects the regenerated resolution.worker_lockfiles.rs(skip_creating_new_lock, used by flow and app dependency jobs): a Go step whose existing lock is not a plausible go.mod is relocked instead of keeping the stale lock, repairing the stored flow/app value at deploy time.Test plan
cargo test -p windmill-worker --lib is_go_mod_lockpasses{"dependencies": {}}→ dep job kept the JSON lock → run failed byte-for-byte with the reportedgo tidy/unknown directive: {errormodule mymod+//go.sum) and the flow runs successfullystored lockfile is not a go.mod (likely generated for another language), ignoring it and resolving dependencies from imports🤖 Generated with Claude Code
Summary by cubic
Fixes WIN-2141. Prevents Go steps from failing when a stale non-
go.modlock (e.g., apackage.json) is stored by relocking on deploy and ignoring the bad lock at runtime.is_go_mod_lockto validate Go locks by checking for amoduledirective (with tests).handle_go_jobnow ignores a stored lock that isn’t a validgo.mod, logs a warning, and resolves deps from imports; cache key reflects the regenerated resolution.skip_creating_new_locknow relocks Go steps when the existing lock isn’t a validgo.mod, fixing stored locks during flow/app deploys.Written for commit 78388d4. Summary will update on new commits.