Skip to content

core: test exec reuse across commits of a remote workspace - #14939

Merged
sipsma merged 2 commits into
mainfrom
sipsma/remote-workspace-exec-reuse-test
Oct 29, 2026
Merged

sipsma merged 2 commits into
mainfrom
sipsma/remote-workspace-exec-reuse-test

Conversation

@sipsma

@sipsma sipsma commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What this adds

A regression test for #14903: with -W <repo>@<sha>, an exec that mounts a filtered Workspace.directory read re-ran on every commit, even when the files it read were unchanged.

#14829 fixed this by keying filtered reads by the content of the files they select, not by their recipe over the Git root, whose identity is its commit. Its tests load a Git ref as a workspace through the API. This test covers the flow from the issue:

  • a Dang module inside the repository, called with dagger -W <repo>@<sha> call;
  • a new engine session for each call, as in CI;
  • ws.directory("/", include: ["app/**"], gitignore: true) mounted next to a cache volume, under an exec whose output is random.

A second session at the same commit and a README-only commit must both reuse the exec. A commit that changes the selected files must re-run it.

Tests

New subtest: TestContextualWorkspace/TestContextualWorkspaceCaching/unrelated_commits_of_a_remote_workspace_do_not_invalidate_scoped_workspace_inputs. It runs in the testBase check.

Closes #14903.

A module function run with `-W <repo>@<sha>` reads its workspace from a
Git tree, whose identity is its commit. Exec work on a filtered
Workspace.directory read must be reused across commits that leave the
selected files unchanged, as it is for a local checkout.

Content-keyed filtered workspace reads (#14829) made that so. Its tests
load a Git ref as a workspace through the API; this adds the CLI flow:
a module in the repository, a fresh session per commit, a read with
include and gitignore mounted next to a cache volume, and an exec
whose output is random. A README-only commit must reuse the exec; a
commit inside the selection must re-run it.

The test fails with #14829's content keying removed, on the
README-only commit.

Signed-off-by: Erik Sipsma <[email protected]>
A CLI started in a container joins the test's session unless the exec
asks for a new one. Run each call in its own session, as each CI run
is, so only the cache connects one call to the next.

Signed-off-by: Erik Sipsma <[email protected]>
@grouville
grouville self-requested a review October 29, 2026 06:29
@sipsma
sipsma merged commit 1048111 into main Oct 29, 2026
93 checks passed
@sipsma
sipsma deleted the sipsma/remote-workspace-exec-reuse-test branch October 29, 2026 06:31
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.

🐞 Git-remote workspace (-W <remote>@<sha>) re-runs execs on every commit even when the mounted Workspace.directory is identical

2 participants