bazel-diff icon indicating copy to clipboard operation
bazel-diff copied to clipboard

No impacted targets when a file in an external repository changes

Open mvgijssel opened this issue 2 years ago • 7 comments

In https://github.com/vgijssel/setup/pull/617 I'm surprised that a change to a file rules/rules_release/tools/lib/repositories/BazelDiffRepository.mjs which is part of a filegroup @rules_release//:all_files is not reporting as changed. @rules_release is an external repository which is located within the same git repository. I've configured bazel-diff to use --fineGrainedHashExternalRepos=rules_release,. Thoughts on what could be the issue? I'm using the latest version:

    http_jar(
        name = "bazel_diff",
        sha256 = "7943790f690ad5115493da8495372c89f7895b09334cb4fee5174a8f213654dd",
        urls = [
            "https://github.com/Tinder/bazel-diff/releases/download/5.0.0/bazel-diff_deploy.jar",
        ],
    )
~/Development/setup mg/451/fix-provisioner-deploy
(devbox) nix-shell-env ❯ bazel query 'deps(@rules_release//:all_files)'
@rules_release//:.bazelignore
@rules_release//:.bazelrc
@rules_release//:.bazelversion
@rules_release//:BUILD.bazel
@rules_release//:CHANGELOG.md
@rules_release//:MODULE.bazel
@rules_release//:WORKSPACE
@rules_release//:all_files
@rules_release//:package.json
@rules_release//:pnpm-lock.yaml
@rules_release//:version.txt
@rules_release//release:BUILD.bazel
@rules_release//release:all_files
@rules_release//release:changesets_cli.mjs
@rules_release//release:cli.mjs
@rules_release//release:defs.bzl
@rules_release//release:extensions.bzl
@rules_release//release:lib/actions/GenerateAction.mjs
@rules_release//release:lib/actions/PublishAction.mjs
@rules_release//release:lib/actions/VersionAction.mjs
@rules_release//release:lib/repositories/ChangelogRepository.mjs
@rules_release//release:lib/repositories/ChangesetRepository.mjs
@rules_release//release:lib/repositories/ConfigRepository.mjs
@rules_release//release:lib/repositories/PackageRepository.mjs
@rules_release//release:lib/repositories/PublishRepository.mjs
@rules_release//release:lib/repositories/ReleaseRepository.mjs
@rules_release//release:lib/repositories/VersionRepository.mjs
@rules_release//release:lib/utils.mjs
@rules_release//release:repositories.bzl
@rules_release//release:repository_primary_deps.bzl
@rules_release//release:repository_secondary_deps.bzl
@rules_release//release/private:BUILD.bazel
@rules_release//release/private:all_files
@rules_release//release/private:release.bzl
@rules_release//release/private:release_info.bzl
@rules_release//release/private:release_manager.bzl
@rules_release//release/private:utils.bzl
@rules_release//release/private:version_changelog.mjs
@rules_release//tools:BUILD.bazel
@rules_release//tools:all_files
@rules_release//tools:bazel_diff_change_cli.mjs
@rules_release//tools:defs.bzl
@rules_release//tools:lib/actions/BazelDiffChangeAction.mjs
@rules_release//tools:lib/repositories/BazelDiffRepository.mjs
@rules_release//tools/private:BUILD.bazel
@rules_release//tools/private:all_files
@rules_release//tools/private:bazel_diff_release.bzl
@rules_release//tools/private:publish_github_release.bzl
@rules_release//tools/private:publish_oci_image.bzl
Loading: 0 packages loaded

mvgijssel avatar Dec 19 '23 09:12 mvgijssel

If I list out all files explicitly

find $PWD/rules/rules_release -type f > /tmp/files

And specifying

--seed-filepaths=/tmp/files --fineGrainedHashExternalRepos=rules_release

It does list as changed, but not sure what the implications are exactly 🤔. Checking the changed targets file shows now that basically all files have changed 😅

mvgijssel avatar Dec 19 '23 10:12 mvgijssel

Could this be the same as https://github.com/Tinder/bazel-diff/issues/134?

faximan avatar Feb 09 '24 12:02 faximan

Yeah I guess so! But is it also expected that if you provide the —seed-filepaths flag it will always flag as changed?

mvgijssel avatar Feb 09 '24 14:02 mvgijssel

I don't have an answer, but as a meta comment think the --seed-filepaths flag should be better documented. I have seen it suggested in a few places but I keep re-reading the docs

    A text file containing a newline separated list of
                            filepaths, each of these filepaths will be read and
                            used as a seed for all targets.

and I just don't understand what that means.

faximan avatar Feb 09 '24 14:02 faximan

bump on this. I'm also getting the same behaviour where if setting the --seed-filepaths option every single target is listed as affected. I keep seeing comments like such: https://github.com/Tinder/bazel-diff/issues/184#issuecomment-1710498589 which makes me believe this is the correct route however having no other explanation on how that is achieved is making the project unusable

s6eskand avatar Jul 11 '25 00:07 s6eskand

bump on this. I'm also getting the same behaviour where if setting the --seed-filepaths option every single target is listed as affected. I keep seeing comments like such: #184 (comment) which makes me believe this is the correct route however having no other explanation on how that is achieved is making the project unusable

Seed file paths is a seed in the hash for every target in your graph, meaning if you edit any path using that flag it will invalidate all targets in your graph. It has legitimate uses for certain files you want to invalidate the graph

tinder-maxwellelliott avatar Oct 21 '25 16:10 tinder-maxwellelliott

I don't have an answer, but as a meta comment think the --seed-filepaths flag should be better documented. I have seen it suggested in a few places but I keep re-reading the docs

    A text file containing a newline separated list of
                            filepaths, each of these filepaths will be read and
                            used as a seed for all targets.

and I just don't understand what that means.

https://github.com/Tinder/bazel-diff/pull/291

tinder-maxwellelliott avatar Oct 21 '25 16:10 tinder-maxwellelliott