Skip to content

A filtered check selection re-keys every module object per session, so its checks never cache across sessions #15044

Open

Description

@yasyf

What happens. dagger check with a collection filter, such as dag://?check=test&<dimension>=<key> or a --skip on a collection key, wraps each module object in __withArtifactView. The view's state carries Origins, from artifactViewOrigin in core/artifact_view.go. That function hashes the recipe of the filtered collection, and the recipe holds things that differ in every session:

  • the Workspace argument: currentWorkspace on a host checkout is keyed per call, through its cachePerCall implicit input
  • the module of each rebuilt call, because calcDigest hashes the module's recipe digest, which differs per load
  • the arguments of every call beneath it, because origin rebuilds them with Append, which drops any digest the engine set on them and hashes cache-per-call inputs such as a secret's

So Origins differs in every session. The view argument differs with it, the __withArtifactView call gets a new digest, and every receiver below it does too.

Reproduction. A module whose collection is reached from a Workspace-taking function, with a leaf check that takes no Workspace:

  1. Run dagger check <module> 'dag://?check=test&<dimension>=<key>' twice from a host checkout, with a one-line README edit between the runs.
  2. Both runs evaluate every __check_test, with no CACHED span.
  3. Select the same checks through a module setting instead of the filter. The second run then reports every __check_test CACHED.

Cost. On one package of 466 test files, a run under the filter evaluates all 466 checks even when no input of any of them changed: 297 s summed across them. Every filtered selection pays this on every push, whatever changed.

Proposed fix. An origin should normalize only what varies per session and keep what tells two collections apart. A PR follows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions