Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions internal/devpkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,23 @@ func (p *Package) InputAddressedPaths() ([]string, error) {
}

func (p *Package) InputAddressedPathForOutput(output string) (string, error) {
if inCache, err := p.IsInBinaryCache(); err != nil {
// Check that this specific output is in the binary cache, rather than
// requiring every one of the package's default outputs to be cached.
//
// The flake template calls this per-output, and only for outputs it has
// already determined are cached (via GetOutputsWithCache, which checks each
// output individually). A multi-output package can have the requested
// output cached while some other default output is not. Guarding with the
// stricter IsInBinaryCache (which requires all default outputs) would
// spuriously fail in that case with "cannot be fetched from binary cache
// store", even though the output being fetched here is present. This also
// matches InstallableForOutput, which already gates on IsOutputInBinaryCache.
// See issue #2921.
Comment on lines +605 to +616

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, but I don't think this comment should be added here in the source code. Outside of this specific issue's bug fix, we don't need this comment's information for understanding the functionality of this function.

if inCache, err := p.IsOutputInBinaryCache(output); err != nil {
return "", err
} else if !inCache {
return "",
errors.Errorf("Package %q cannot be fetched from binary cache store", p.Raw)
errors.Errorf("Package %q output %q cannot be fetched from binary cache store", p.Raw, output)
}

entry, err := p.lockfile.Resolve(p.LockfileKey())
Expand Down
Loading