Skip to content

core: let serveModule pins win over version queries - #14284

Merged
eunomie merged 1 commit into
dagger:mainfrom
eunomie:serve-module-refpin-override
Sep 23, 2026
Merged

eunomie merged 1 commit into
dagger:mainfrom
eunomie:serve-module-refpin-override

Conversation

@eunomie

@eunomie eunomie commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Problem

Query.serveModule re-resolves a module address before serving it. When that address carries a full-commit refPin and a version query such as @v1, the two can disagree once the target repository publishes a newer tag: @v1 now resolves to a different commit than the pinned SHA.

A generated client embeds the exact commit its lock resolved, paired with that version query. If serving re-resolves @v1 to the newer tag instead of honoring the pin, the client is served a different module than the one it was generated against — a newer matching tag stops the client from loading the commit it expects.

Fix

serveModule now loads the full-SHA refPin directly, even when the version query has since moved to resolve to a different tag. The pinned commit wins.

Query.moduleSource and [[dependencies]] resolution are unchanged: they still enforce the existing rule that a pin and a version query must agree.

Test

TestServeModulePinnedVersionQuery (core/integration/module_serve_test.go) reproduces the divergence — a pinned commit paired with a version query that a newer tag has moved. It was verified failing before the fix and passing after. The same test keeps a regression check that moduleSource still enforces the old agreement rule.

Fixes: #13625

📄 Understanding this change

A generated client pairs a version query with the commit its lock
resolved, so a newer matching tag must not stop it from loading.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie marked this pull request as ready for review September 22, 2026 20:11
@eunomie
eunomie merged commit 8a134a7 into dagger:main Sep 23, 2026
86 checks passed
@eunomie
eunomie deleted the serve-module-refpin-override branch September 23, 2026 15:53
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.

Module dependencies are never pinned

2 participants