diff --git a/.bazelignore b/.bazelignore index 541477a1d..02f8e8fdb 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1,9 +1,9 @@ examples/library-usage examples/bd-example-extension-go -npm-package +npm-package/node_modules website node_modules -.claude +.claude/worktrees .worktrees .beads .dolt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a05c26274..b9ff6ec52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,18 +102,13 @@ jobs: # pr-preflight-platforms ubuntu legs compile several ./scripts and # ./cmd/bd test binaries but, before this, used no GOCACHE at all (every # run cold-compiled them). This warms the non-race GOCACHE this job - # already saves (below) with exactly those packages, plus the - # allowlisted-go-tests packages scripts-go-checks' allowlisted leg - # needs (--compile-only: the allowlist's own packages, so this can - # never drift from what that leg runs). Shared with + # already saves (below) with exactly those packages. Shared with # blacksmith-go-build-cache's non-race leg (the same-repo-PR path's # seed) so the two paths can never drift apart (F7b spec 4.2). - - name: Warm non-race GOCACHE for preflight/doc-freshness/allowlisted + - name: Warm non-race GOCACHE for preflight/doc-freshness env: GOCACHE: ${{ runner.temp }}/go-cache/non-race - run: | - bash scripts/ci/warm-non-race-cache.sh - python3 tools/bazel/run_allowlisted_go_tests.py --compile-only + run: bash scripts/ci/warm-non-race-cache.sh - name: Save Go module cache if: steps.restore-go-module-cache.outputs.cache-hit != 'true' @@ -844,14 +839,14 @@ jobs: path: ${{ runner.temp }}/go-cache/vet key: beads-go-vet-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-vet-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }} - # F7b: pr.yml's scripts-go-checks moved to same-repo Blacksmith - # (blacksmith-4vcpu-ubuntu-2404); this is that path's saver for the race and - # non-race GOCACHEs its scripts-test and allowlisted legs restore (the vet - # leg is already covered by go-vet-cache's venue matrix above). Blacksmith - # runners cannot see caches `actions/cache` saved from a GitHub-hosted - # runner (and vice versa) even for an identical key, so without this every - # same-repo PR's scripts-go-checks race/non-race legs would stay cold - # forever. + # F7b: the saver for the race and non-race GOCACHEs that same-repo-PR + # (Blacksmith, blacksmith-4vcpu-ubuntu-2404) jobs restore: the non-race one + # for pr-preflight-platforms' and check-doc-freshness-platforms' ubuntu + # legs; the race one compiles ./scripts/... with -race (once the compile + # set of scripts-go-checks' retired scripts-test leg). Blacksmith runners + # cannot see caches `actions/cache` saved from a GitHub-hosted runner (and + # vice versa) even for an identical key, so without this those legs would + # stay cold forever. # # The `venue` matrix also seeds the ubuntu-latest (fork/Dependabot) path's # race cache, which the legacy embedded build used to save before Bazel @@ -934,27 +929,22 @@ jobs: key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }} restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race- - # scripts-go-checks' scripts-test leg's exact compile set. -run '^$' - # selects no tests (only compiles), so this needs no Dolt/test-env setup. - - name: Warm race GOCACHE (scripts-go-checks scripts-test leg) + # -run '^$' selects no tests (only compiles), so this needs no + # Dolt/test-env setup. + - name: Warm race GOCACHE if: matrix.flavor == 'race' env: GOCACHE: ${{ runner.temp }}/go-cache/race run: go test -race -run '^$' -tags gms_pure_go ./scripts/... - # scripts-go-checks' allowlisted leg (run_allowlisted_go_tests.py - # --compile-only: the allowlist's own packages, so this can never drift - # from what that leg actually runs) plus pr-preflight-platforms'/ - # check-doc-freshness-platforms' ubuntu legs via warm-non-race-cache.sh, - # shared with build-artifacts' identical steps so the two paths can - # never drift apart (F7b spec 4.2). - - name: Warm non-race GOCACHE (scripts-go-checks allowlisted leg + preflight/doc-freshness) + # pr-preflight-platforms'/check-doc-freshness-platforms' ubuntu legs via + # warm-non-race-cache.sh, shared with build-artifacts' identical step so + # the two paths can never drift apart (F7b spec 4.2). + - name: Warm non-race GOCACHE (preflight/doc-freshness) if: matrix.flavor == 'non-race' env: GOCACHE: ${{ runner.temp }}/go-cache/non-race - run: | - bash scripts/ci/warm-non-race-cache.sh - python3 tools/bazel/run_allowlisted_go_tests.py --compile-only + run: bash scripts/ci/warm-non-race-cache.sh - name: Save race Go build cache if: ${{ !cancelled() && matrix.flavor == 'race' && steps.restore-race-go-build-cache.outputs.cache-hit != 'true' }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 1a1fda034..fcb011073 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1070,6 +1070,16 @@ jobs: GOCACHE: ${{ runner.temp }}/go-cache/non-race run: go test '-tags=gms_pure_go' -count=1 -run '^TestGeneratedHookTimeoutProcessBoundary$' ./cmd/bd + # Plain go test's own bd build fallback (BEADS_TEST_BD_BINARY unset), + # which Bazel never takes, on every OS developers run go test on: the + # tests tools/bazel/equivalence_allowlist.txt lists as skipped under + # Bazel. Same build as the step above, so no second compile. + - name: Exercise go test's bd build fallback + shell: bash + env: + GOCACHE: ${{ runner.temp }}/go-cache/non-race + run: go test '-tags=gms_pure_go' -count=1 -run '^(TestGOMODCACHENotUnderTestHome|TestGoBuildBDCommandIsCWDIndependent)$' ./cmd/bd + # This step recompiles ./cmd/bd's test binary. It must share the restored # GOCACHE with the hook-timeout step above (same tags, same platform # default CGO_ENABLED, see the script's header) so it is a relink rather @@ -1202,7 +1212,7 @@ jobs: # D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel / # test (`bazel test //... --config=ci`, the same selection, checked by its # equivalence step) runs it, and scripts-go-checks runs what Bazel does not - # (./scripts/... and the allowlisted tests under go test, go test's vet). + # (go test's vet). pr-core-wrapper: name: PR Core (wrapper timing) runs-on: ubuntu-latest @@ -1262,20 +1272,15 @@ jobs: GOCACHE: ${{ runner.temp }}/go-cache/race run: make ci-pr-core - # PR Core's duties the Bazel lanes do not take over (D2 step 3), on every - # PR whatever bazel-coverage says, in PR Core's environment (dolt, git and - # dolt identity, scripts/ci/lib/test-env.sh): - # - `go test ./scripts/...` with PR Core's flags: the repository policy - # tests, several of which check part or all of their rules under go test - # only (scripts/bazel_skip_allowlist_test.go keeps such parts there); - # - go test's own vet checks over ./... (rules_go's go_test runs none); - # - the Go tests `bazel test --config=ci` does not run or skips - # (tools/bazel/equivalence_allowlist.txt), each required to pass. + # PR Core's duty the Bazel lanes do not take over (D2 step 3), on every PR + # whatever bazel-coverage says: go test's own vet checks over ./... + # (rules_go's go_test runs none). The repository policy tests in + # ./scripts/... and the source-walking tests run under Bazel + # (//scripts:scripts_test, //test/docsync over //:repo_files), remotely. # F7b: same-repo Blacksmith (blacksmith-4vcpu-ubuntu-2404) for same-repo # PRs/merge_group, falling back to ubuntu-latest for forks/Dependabot, same # pattern as advisory-reports/pr-policy-wrapper/pr-core-wrapper above. - # main.yml's blacksmith-go-build-cache job seeds this leg's race and - # non-race GOCACHEs; go-vet-cache's venue matrix seeds the vet leg's. + # main.yml's go-vet-cache venue matrix seeds the vet leg's GOCACHE. scripts-go-checks: name: Go checks (${{ matrix.check }}) runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} @@ -1283,7 +1288,7 @@ jobs: strategy: fail-fast: false matrix: - check: [scripts-test, vet, allowlisted] + check: [vet] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 @@ -1301,14 +1306,6 @@ jobs: key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }} restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}- - - name: Restore race Go build cache - if: matrix.check == 'scripts-test' - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ runner.temp }}/go-cache/race - key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ github.sha }} - restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race- - - name: Restore vet Go build cache if: matrix.check == 'vet' uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 @@ -1321,45 +1318,12 @@ jobs: # match is always filtered out (SF-5). restore-keys: beads-go-vet-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-vet- - - name: Restore non-race Go build cache - if: matrix.check == 'allowlisted' - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ runner.temp }}/go-cache/non-race - key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }} - restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race- - - - name: Install Dolt - if: matrix.check == 'scripts-test' || matrix.check == 'allowlisted' - run: ./scripts/ci/install-dolt.sh - - - name: Configure Git and Dolt identity - if: matrix.check == 'scripts-test' || matrix.check == 'allowlisted' - run: | - git config --global user.name "CI Bot" - git config --global user.email "ci@beads.test" - dolt config --global --add user.name "CI Bot" - dolt config --global --add user.email "ci@beads.test" - - - name: Go test the scripts packages - if: matrix.check == 'scripts-test' - env: - BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION: '1' - GOCACHE: ${{ runner.temp }}/go-cache/race - run: bash scripts/ci/scripts-go-test.sh - - name: Go vet with go test's checks if: ${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'vet' }} env: GOCACHE: ${{ runner.temp }}/go-cache/vet run: bash scripts/ci/go-test-vet.sh - - name: Run the Go tests the Bazel lane skips - if: ${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'allowlisted' }} - env: - GOCACHE: ${{ runner.temp }}/go-cache/non-race - run: bash scripts/ci/allowlisted-go-tests.sh - # F7b: same-repo Blacksmith (blacksmith-4vcpu-ubuntu-2404) for same-repo # PRs/merge_group, falling back to ubuntu-latest for forks/Dependabot. # main.yml's pr-lint-wrapper `venue` matrix seeds this leg's golangci-lint diff --git a/BUILD.bazel b/BUILD.bazel index 91c33c0b0..ee65c07ea 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -8,7 +8,8 @@ load("@rules_go//go:def.bzl", "go_library", "go_test") # out of every build except --config=integration (.bazelrc), which sets the tag. # gazelle:build_tags gms_pure_go,integration # integrations/ holds no Go; it stays visible to Bazel (not in .bazelignore) -# only so //test/docsync can declare the markdown its link checks resolve. +# so //:repo_files covers it for //test/docsync's link checks and the +# repository-policy tests in //scripts. # gazelle:exclude integrations gazelle(name = "gazelle") @@ -32,24 +33,6 @@ exports_files( visibility = ["//scripts/gitattributespolicy:__pkg__"], ) -# //scripts:scripts_test checks the pinned golangci-lint version/sha256 in -# engdocs/LINTING.md and the pre-commit hook's separate `go run` pin against -# scripts/ci/install-golangci-lint.sh, so both must be readable as data. -exports_files( - [ - "engdocs/LINTING.md", - ".githooks/pre-commit", - ], - visibility = ["//scripts:__pkg__"], -) - -# //scripts:scripts_test keeps pr.yml's release-target cross-compilation matrix -# in lockstep with the release targets .goreleaser.yml declares. -exports_files( - [".goreleaser.yml"], - visibility = ["//scripts:__pkg__"], -) - # //cmd/bd:bd_test: tracked git hooks (generator parity) and the formula # primitive fixtures. filegroup( @@ -66,37 +49,6 @@ exports_files( visibility = ["//cmd/bd/setup:__pkg__"], ) -# //test/docsync: the Mintlify site, engdocs, root markdown, and the files -# outside those trees that their local links point at. -# -# The out-of-tree link targets are hand-listed: a new docs/engdocs link to a -# file outside these globs passes `go test` but fails under Bazel until the -# target is added here. The globs stop at package boundaries, so no BUILD file -# may live under docs/ or engdocs/ (enforced by scripts/bazel_policy_test.go). -filegroup( - name = "docsync_files", - srcs = glob([ - "*.md", - "docs/**", - "engdocs/**", - ]) + [ - "integrations/beads-mcp/PYPI.md", - "//cmd/bd:AGENTS.md", - "//internal/storage/schema:migrations/README.md", - "//scripts:README.md", - ], - visibility = ["//test/docsync:__pkg__"], -) - -# //scripts:scripts_test workflow-policy and CI-script tests: the whole -# .github tree (workflows, composite actions, CI helper scripts) they parse -# and run. The one whole-tree input the plan allows (it is small). -filegroup( - name = "workflow_files", - srcs = glob([".github/**"]), - visibility = ["//scripts:__pkg__"], -) - # PR Risk's manifest-sharded tiers' shard scripts and their committed # manifests (embedded-Dolt cmd and storage, proxied-server cmd, server-Dolt # storage). The variants (//cmd/bd:bd_embedded_test, //cmd/bd:bd_proxied_test, @@ -122,17 +74,6 @@ exports_files( ], ) -# //scripts:scripts_test runs scripts/test.sh, which sources the canonical -# build flags and reads the known-broken-test skip list. -filegroup( - name = "test_sh_files", - srcs = [ - ".buildflags", - ".test-skip", - ], - visibility = ["//scripts:__pkg__"], -) - # //internal/versioncheck and //scripts/check-versions release-gate tests: the # metadata surfaces versioncheck.releaseSources gates, plus the canonical # version it compares them against and the tracked git hooks whose version @@ -141,12 +82,6 @@ filegroup( # Hand-listed rather than globbed because releaseSources is itself a closed # list: a newly gated surface must be added here too, and until it is the test # fails under Bazel (it passes under `go test`, which sees the whole checkout). -# -# The exception is npm-package/package.json: npm-package/ is in .bazelignore, -# so no target can declare it. Listing it anyway passes under remote execution -# but fails in a local sandbox, which is how fork-PR CI runs. -# TestRepositoryReleaseVersionsMatch tolerates exactly its absence under -# Bazel; `go test` still checks it. filegroup( name = "release_metadata_files", srcs = [ @@ -154,6 +89,7 @@ filegroup( "integrations/beads-mcp/pyproject.toml", "integrations/beads-mcp/src/beads_mcp/__init__.py", "integrations/beads-mcp/uv.lock", + "npm-package/package.json", "//cmd/bd:version.go", "//cmd/bd:winres/manifest.xml", "//cmd/bd:winres/winres.json", @@ -167,35 +103,6 @@ filegroup( ], ) -# Inputs of the Bazel policy tests in //scripts (bazel_policy_test.go), so they -# run under `bazel test` as well as `go test`. -filegroup( - name = "bazel_policy_files", - srcs = [ - ".bazelrc", - ".bazelversion", - ".gitignore", - "BUILD.bazel", - "MODULE.bazel", - "go.mod", - ], - visibility = ["//scripts:__pkg__"], -) - -# F3: TestMCPPytestWorkerCountPinned (ci_workflow_test.go) reads the MCP -# package's pytest-xdist pin directly from its manifest and lock file, so it -# runs under `bazel test` as well as `go test`. integrations/beads-mcp has no -# BUILD.bazel of its own (unlike npm-package/, it is not .bazelignore'd), so -# these are ordinary sources under this package. -filegroup( - name = "mcp_package_policy_files", - srcs = [ - "integrations/beads-mcp/pyproject.toml", - "integrations/beads-mcp/uv.lock", - ], - visibility = ["//scripts:__pkg__"], -) - go_library( name = "beads", srcs = [ @@ -261,3 +168,212 @@ exports_files( ["engdocs/design/http-divergence-ledger.md"], visibility = ["//internal/httpclient/encode:__pkg__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ".agents/**", + ".amp/**", + ".augment/**", + ".bazelrc.local", + ".claude/*.lock", + ".claude/*.log", + ".claude/settings.local.json", + ".codex/**", + ".cursor/**", + ".direnv/**", + ".envrc", + ".git/**", + ".idea/**", + ".logs/**", + ".vscode/**", + "bazel-*/**", + "bd", + "bd-fixed", + "bd-original", + "bd-test", + "bd_test", + "beads", + "go.work", + "go.work.sum", + "history/**", + "mcp_agent_mail/**", + "npm-package/bin/*.tar.gz", + "npm-package/bin/*.zip", + "npm-package/bin/CHANGELOG.md", + "npm-package/bin/LICENSE", + "npm-package/bin/README.md", + "npm-package/bin/bd", + "npm-package/package-lock.json", + "output", + "result", + "state.json", + "user.bazelrc", + ], + ) + [ + "//backend:repo_files", + "//backend/conformance:repo_files", + "//beadserrors:repo_files", + "//cmd/bd:repo_files", + "//cmd/bd/doctor:repo_files", + "//cmd/bd/doctor/fix:repo_files", + "//cmd/bd/protocol:repo_files", + "//cmd/bd/setup:repo_files", + "//format:repo_files", + "//internal/ado:repo_files", + "//internal/atomicfile:repo_files", + "//internal/audit:repo_files", + "//internal/beads:repo_files", + "//internal/ceiling:repo_files", + "//internal/compact:repo_files", + "//internal/config:repo_files", + "//internal/configfile:repo_files", + "//internal/creds:repo_files", + "//internal/debug:repo_files", + "//internal/doltremote:repo_files", + "//internal/doltserver:repo_files", + "//internal/doltversion:repo_files", + "//internal/eventsjournal:repo_files", + "//internal/execenv:repo_files", + "//internal/fdhygiene:repo_files", + "//internal/formula:repo_files", + "//internal/formula/cmd/schemagen:repo_files", + "//internal/formula/schemagen:repo_files", + "//internal/git:repo_files", + "//internal/gitenv:repo_files", + "//internal/githooksenv:repo_files", + "//internal/github:repo_files", + "//internal/gitignore:repo_files", + "//internal/gitlab:repo_files", + "//internal/gittraceenv:repo_files", + "//internal/hooks:repo_files", + "//internal/httpapi:repo_files", + "//internal/httpapi/apigen:repo_files", + "//internal/httpapi/spec:repo_files", + "//internal/httpapi/wireshape:repo_files", + "//internal/httpapi/wireshape/cmd/gendigest:repo_files", + "//internal/httpclient:repo_files", + "//internal/httpclient/encode:repo_files", + "//internal/httpclient/wire:repo_files", + "//internal/idgen:repo_files", + "//internal/jira:repo_files", + "//internal/linear:repo_files", + "//internal/lockfile:repo_files", + "//internal/memoryapi:repo_files", + "//internal/metrics:repo_files", + "//internal/migration:repo_files", + "//internal/migration/legacysqlite:repo_files", + "//internal/molecules:repo_files", + "//internal/notion:repo_files", + "//internal/procid:repo_files", + "//internal/query:repo_files", + "//internal/recipes:repo_files", + "//internal/remotecache:repo_files", + "//internal/routing:repo_files", + "//internal/storage:repo_files", + "//internal/storage/backendnames:repo_files", + "//internal/storage/backends:repo_files", + "//internal/storage/batchbench:repo_files", + "//internal/storage/batchfixtures:repo_files", + "//internal/storage/contextinfo:repo_files", + "//internal/storage/createbatchequiv:repo_files", + "//internal/storage/dberrors:repo_files", + "//internal/storage/dbproxy/identity:repo_files", + "//internal/storage/dbproxy/pidfile:repo_files", + "//internal/storage/dbproxy/proxy:repo_files", + "//internal/storage/dbproxy/server:repo_files", + "//internal/storage/dbproxy/util:repo_files", + "//internal/storage/depid:repo_files", + "//internal/storage/dolt:repo_files", + "//internal/storage/doltutil:repo_files", + "//internal/storage/domain:repo_files", + "//internal/storage/domain/db:repo_files", + "//internal/storage/domain/fs:repo_files", + "//internal/storage/domain/git:repo_files", + "//internal/storage/embeddeddolt:repo_files", + "//internal/storage/embeddeddolt/cmd:repo_files", + "//internal/storage/externaldeps:repo_files", + "//internal/storage/fs:repo_files", + "//internal/storage/git:repo_files", + "//internal/storage/issueops:repo_files", + "//internal/storage/journalscan:repo_files", + "//internal/storage/kvkeys:repo_files", + "//internal/storage/memoryops:repo_files", + "//internal/storage/rowid:repo_files", + "//internal/storage/schema:repo_files", + "//internal/storage/sqlbuild:repo_files", + "//internal/storage/sqlclass:repo_files", + "//internal/storage/sqlcount:repo_files", + "//internal/storage/storagecontract:repo_files", + "//internal/storage/uow:repo_files", + "//internal/storage/versioncontrolops:repo_files", + "//internal/telemetry:repo_files", + "//internal/templates:repo_files", + "//internal/templates/agents:repo_files", + "//internal/testutil:repo_files", + "//internal/testutil/bazeltest:repo_files", + "//internal/testutil/credentialcmd:repo_files", + "//internal/testutil/fixtures:repo_files", + "//internal/testutil/integration:repo_files", + "//internal/timeparsing:repo_files", + "//internal/tracker:repo_files", + "//internal/tracker/conformance:repo_files", + "//internal/types:repo_files", + "//internal/ui:repo_files", + "//internal/uimd:repo_files", + "//internal/utils:repo_files", + "//internal/validation:repo_files", + "//internal/versioncheck:repo_files", + "//internal/workapi:repo_files", + "//internal/workapi/storecounter:repo_files", + "//internal/workapi/storequerier:repo_files", + "//internal/workapi/storereader:repo_files", + "//internal/workapi/storereadycounter:repo_files", + "//internal/workapi/storestats:repo_files", + "//internal/workapi/storeversionreconciler:repo_files", + "//internal/workapi/storeworkspaceconfig:repo_files", + "//internal/workspacegate:repo_files", + "//internal/worktreeremove:repo_files", + "//issueops:repo_files", + "//journalops:repo_files", + "//memoryops:repo_files", + "//plugins/beads:repo_files", + "//schema:repo_files", + "//scripts:repo_files", + "//scripts/bench-ready-indexes:repo_files", + "//scripts/check-versions:repo_files", + "//scripts/checkworkflowtags:repo_files", + "//scripts/gitattributespolicy:repo_files", + "//scripts/internal/testbash:repo_files", + "//scripts/migration-test/catalog:repo_files", + "//scripts/pr-lint:repo_files", + "//scripts/prlintmake:repo_files", + "//scripts/repro-dolt-hang:repo_files", + "//scripts/repro-dolt-prod-timeouts:repo_files", + "//scripts/workflowtags:repo_files", + "//test/conformance:repo_files", + "//test/docsync:repo_files", + "//test/testmainconvention:repo_files", + "//third_party/patches:repo_files", + "//tools/bazel:repo_files", + "//tools/docsmint:repo_files", + ], + visibility = [ + "//scripts:__pkg__", + "//test/docsync:__pkg__", + ], +) + +# --- end repo_files --- diff --git a/MODULE.bazel b/MODULE.bazel index ff3e3cafb..e5fe1df52 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -76,3 +76,18 @@ dolt_release( name = "dolt_darwin_arm64", platform = "darwin-arm64", ) + +# The tracked release formula, for //scripts:scripts_test. .beads/ also holds +# live bd data and is in .bazelignore, so no main-repo target can declare the +# formula; this local repository exposes only .beads/formulas. +new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") + +new_local_repository( + name = "beads_formulas", + build_file_content = """exports_files( + glob(["*.formula.toml"]), + visibility = ["@@//scripts:__pkg__"], +) +""", + path = ".beads/formulas", +) diff --git a/backend/BUILD.bazel b/backend/BUILD.bazel index 0f7dac0be..efaf0d7b9 100644 --- a/backend/BUILD.bazel +++ b/backend/BUILD.bazel @@ -43,3 +43,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/backend/conformance/BUILD.bazel b/backend/conformance/BUILD.bazel index 1bd7e0271..3ff778c49 100644 --- a/backend/conformance/BUILD.bazel +++ b/backend/conformance/BUILD.bazel @@ -111,3 +111,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/beadserrors/BUILD.bazel b/beadserrors/BUILD.bazel index 5285eb578..51c339a62 100644 --- a/beadserrors/BUILD.bazel +++ b/beadserrors/BUILD.bazel @@ -19,3 +19,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/BUILD.bazel b/cmd/bd/BUILD.bazel index 624205455..10f006ac9 100644 --- a/cmd/bd/BUILD.bazel +++ b/cmd/bd/BUILD.bazel @@ -1552,19 +1552,6 @@ exports_files( visibility = ["//internal/httpapi:__pkg__"], ) -# Init-safety help text pinned by //test/docsync recovery-doc tests. -exports_files( - ["init_safety_help.go"], - visibility = ["//test/docsync:__pkg__"], -) - -# Contributor agent instructions; root AGENTS.md links them and -# //:docsync_files checks those links. -exports_files( - ["AGENTS.md"], - visibility = ["//:__pkg__"], -) - # Release-metadata surfaces gated by //internal/versioncheck's releaseSources # table: the canonical version and the Windows PE resource files. Aggregated # into //:release_metadata_files, which is what the tests declare as data. @@ -1589,3 +1576,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/doctor/BUILD.bazel b/cmd/bd/doctor/BUILD.bazel index 5f541e3e8..cfd8abbdb 100644 --- a/cmd/bd/doctor/BUILD.bazel +++ b/cmd/bd/doctor/BUILD.bazel @@ -187,3 +187,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/doctor/fix/BUILD.bazel b/cmd/bd/doctor/fix/BUILD.bazel index 7ab6423bc..adc25eb0a 100644 --- a/cmd/bd/doctor/fix/BUILD.bazel +++ b/cmd/bd/doctor/fix/BUILD.bazel @@ -167,3 +167,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/protocol/BUILD.bazel b/cmd/bd/protocol/BUILD.bazel index d88b1110a..3d551d4fe 100644 --- a/cmd/bd/protocol/BUILD.bazel +++ b/cmd/bd/protocol/BUILD.bazel @@ -139,3 +139,25 @@ sh_test( shard_count = 8, tags = ["dolt-server"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/setup/BUILD.bazel b/cmd/bd/setup/BUILD.bazel index 1dbae3b11..c95870119 100644 --- a/cmd/bd/setup/BUILD.bazel +++ b/cmd/bd/setup/BUILD.bazel @@ -60,3 +60,25 @@ go_test( "@in_gopkg_yaml_v3//:yaml_v3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/cmd/bd/test_repo_beads_guard_test.go b/cmd/bd/test_repo_beads_guard_test.go index ce3081d01..a5fa4927a 100644 --- a/cmd/bd/test_repo_beads_guard_test.go +++ b/cmd/bd/test_repo_beads_guard_test.go @@ -54,8 +54,14 @@ type testRunner interface { Run() int } +// preRunStdout and preRunStderr are os.Stdout/os.Stderr as runTestsAndSweep +// saw them before m.Run: TestZZStdioNotLeaked's baseline when +// TestAAAStdioBaseline did not run in this process. +var preRunStdout, preRunStderr *os.File + func runTestsAndSweep(m testRunner) int { stdout, stderr := os.Stdout, os.Stderr + preRunStdout, preRunStderr = stdout, stderr code := m.Run() code = checkStdioAfterRun(code, stdout, stderr) swept := doltserver.SweepSuiteTestServers(testTempRoot) diff --git a/cmd/bd/zz_stdio_leak_guard_test.go b/cmd/bd/zz_stdio_leak_guard_test.go index 66bfc4cbd..6784acc2f 100644 --- a/cmd/bd/zz_stdio_leak_guard_test.go +++ b/cmd/bd/zz_stdio_leak_guard_test.go @@ -18,25 +18,33 @@ import ( // // It only sees tests that ran before it in this process. TestMain repeats the // check after m.Run (checkStdioAfterRun), which covers every test in the -// process, including each Bazel shard, where this test runs in one shard only. +// process, including each Bazel shard. +// +// Where TestAAAStdioBaseline did not run in this process (a -run filter, or a +// Bazel shard that holds this test but not that one), the baseline is the +// streams TestMain saw before m.Run, with checkStdioAfterRun's one allowance: +// the framework's own -json swap, os.Stderr = os.Stdout. func TestZZStdioNotLeaked(t *testing.T) { - if baselineStdout == nil || baselineStderr == nil { - // TestAAAStdioBaseline did not run in this process (-run filtered it - // out, or Bazel sharding put it in another shard); TestMain's check - // after m.Run still applies. - t.Skip("no baseline in this process; checkStdioAfterRun covers it") + wantStdout, wantStderr := baselineStdout, baselineStderr + frameworkSwapAllowed := false + if wantStdout == nil || wantStderr == nil { + if preRunStdout == nil || preRunStderr == nil { + t.Fatal("neither TestAAAStdioBaseline nor TestMain recorded the streams; TestMain must run the suite through runTestsAndSweep") + } + wantStdout, wantStderr = preRunStdout, preRunStderr + frameworkSwapAllowed = true } - if os.Stdout != baselineStdout { + if os.Stdout != wantStdout { t.Errorf("os.Stdout was leaked by an earlier test (now fd=%d name=%q); "+ "a capture helper restored it on the happy path only - move the restore into a defer", os.Stdout.Fd(), os.Stdout.Name()) - os.Stdout = baselineStdout + os.Stdout = wantStdout } - if os.Stderr != baselineStderr { + if os.Stderr != wantStderr && (!frameworkSwapAllowed || os.Stderr != wantStdout) { t.Errorf("os.Stderr was leaked by an earlier test (now fd=%d name=%q); "+ "a capture helper restored it on the happy path only - move the restore into a defer", os.Stderr.Fd(), os.Stderr.Name()) - os.Stderr = baselineStderr + os.Stderr = wantStderr } } diff --git a/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md b/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md index 091d58be6..72b3c0d01 100644 --- a/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md +++ b/engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md @@ -647,7 +647,7 @@ Do not require these existing check names directly: - `Test (macos-latest)` - `Test (storage domain + uow)` - `Test (Dolt server fingerprint)` -- `Go checks (scripts-test)`, `Go checks (vet)` and `Go checks (allowlisted)` +- `Go checks (vet)` - `Contract corpus (golden + determinism + conformance)` - `PR Core (wrapper timing)` - `Build Artifacts` @@ -927,28 +927,30 @@ manifests. On those PRs they are the tiers' only pre-merge run, and `TEST_DOLT_SERVER_FINGERPRINT`). `check-release-target-cross-compilation` still `go build`s `./...` with `CGO_ENABLED=0` on every PR. - Also kept on every PR, in the required job `scripts-go-checks` - (`SCRIPTS_GO_CHECKS`; PR Core's environment: dolt, git and dolt - identity, `scripts/ci/lib/test-env.sh`): - - `go test ./scripts/...` with PR Core's flags - (`scripts/ci/scripts-go-test.sh`). The repository policy tests, - including the D2 guards, check part or all of their rules under - `go test` only (their inputs are not in `//scripts:scripts_test`'s - runfiles), so without this they would have no required pre-merge run - on covered PRs. - - `go test`'s own vet checks (cmd/go's `defaultVetFlags`, policy-tested - equal to the toolchain's) over `./...` (`scripts/ci/go-test-vet.sh`): - rules_go's `go_test` runs no vet, so a `go test` vet finding would - otherwise first fail on `main` and then on every fork PR. - - the Go tests `bazel test --config=ci` does not run or skips - (`tools/bazel/equivalence_allowlist.txt`), under `go test` - (`scripts/ci/allowlisted-go-tests.sh`); each entry must match a test - that ran and passed. + (`SCRIPTS_GO_CHECKS`, one leg, `Go checks (vet)`): `go test`'s own vet + checks (cmd/go's `defaultVetFlags`, policy-tested equal to the + toolchain's) over `./...` (`scripts/ci/go-test-vet.sh`): rules_go's + `go_test` runs no vet, so a `go test` vet finding would otherwise first + fail on `main` and then on every fork PR. + - The repository policy tests (`./scripts/...`, including the D2 guards) + and the tests that walk the checkout run only under Bazel, remotely: + `//scripts:scripts_test` and `//test/docsync:docsync_test` take + `//:repo_files` as data, the checkout as Bazel sees it (every tracked + file outside `.bazelignore`, aggregated from the `repo_files` block + `tools/bazel/go_srcs.py` keeps in every package; the BUILD sync step's + `make bazel-sync-check` fails on a package without it). The release + formula under `.bazelignore`d `.beads/` comes in as `@beads_formulas`. + Their former `go test` legs (`Go checks (scripts-test)` and + `Go checks (allowlisted)`) are gone. - `TestBazelOnlySkipsAreAllowlisted` (itself go-test-only, so in that - job) requires every top-level test with a `TEST_SRCDIR`- or + `tools/bazel/equivalence_allowlist.txt` holds only the two `cmd/bd` + tests of plain `go test`'s own bd build fallback, which Bazel never + takes; `pr-preflight-platforms` runs them on every OS ("Exercise go + test's bd build fallback"). `TestBazelOnlySkipsAreAllowlisted` (under + Bazel too) requires every top-level test with a `TEST_SRCDIR`- or `bazeltest.IsBazel()`-guarded `t.Skip` to have an allowlist `skip` - entry, and every test that runs part of its checks under `go test` - only to live under `./scripts`. + entry, and no test anywhere to run part of its checks under `go test` + only. - Package gates on a covered PR in a non-remote mode (the farm switch off) fail in their own "Check the Bazel-built bd exists" step, naming `BAZEL_PR_LANES_RETIRED`, instead of on a missing artifact. @@ -1474,7 +1476,7 @@ check read. Non-Bazel required jobs re-run in full on every merge group (approximate PR timings, 2026-10): `fast-checks` (~40 s), `pr-policy-wrapper` -(~2.5 min), `scripts-go-checks` (3 legs, up to ~3.5 min), `pr-lint-wrapper` +(~2.5 min), `scripts-go-checks` (vet only), `pr-lint-wrapper` (native/darwin/windows, up to ~4 min), `check-doc-flags` (~1.7 min), `check-doc-freshness-platforms` and `pr-preflight-platforms` (Linux, Windows and macOS legs, up to ~5 min on Windows), diff --git a/format/BUILD.bazel b/format/BUILD.bazel index 3f6bc1da5..5d295c6c6 100644 --- a/format/BUILD.bazel +++ b/format/BUILD.bazel @@ -17,3 +17,25 @@ go_test( embed = [":format"], deps = ["//internal/types"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/ado/BUILD.bazel b/internal/ado/BUILD.bazel index bdfc59ce1..6f94e9775 100644 --- a/internal/ado/BUILD.bazel +++ b/internal/ado/BUILD.bazel @@ -49,3 +49,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/atomicfile/BUILD.bazel b/internal/atomicfile/BUILD.bazel index bc13a8982..ed52ef940 100644 --- a/internal/atomicfile/BUILD.bazel +++ b/internal/atomicfile/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["atomicfile_test.go"], embed = [":atomicfile"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/audit/BUILD.bazel b/internal/audit/BUILD.bazel index 7173c27c1..1cd6e6352 100644 --- a/internal/audit/BUILD.bazel +++ b/internal/audit/BUILD.bazel @@ -19,3 +19,25 @@ go_test( ], embed = [":audit"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/beads/BUILD.bazel b/internal/beads/BUILD.bazel index ef74544f6..27c6349c1 100644 --- a/internal/beads/BUILD.bazel +++ b/internal/beads/BUILD.bazel @@ -57,3 +57,25 @@ go_test( "//internal/utils", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/ceiling/BUILD.bazel b/internal/ceiling/BUILD.bazel index 9ef453ece..7de0ab073 100644 --- a/internal/ceiling/BUILD.bazel +++ b/internal/ceiling/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["ceiling_test.go"], embed = [":ceiling"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/compact/BUILD.bazel b/internal/compact/BUILD.bazel index 4218b4b98..3ff08a678 100644 --- a/internal/compact/BUILD.bazel +++ b/internal/compact/BUILD.bazel @@ -40,3 +40,25 @@ go_test( "@com_github_anthropics_anthropic_sdk_go//:anthropic-sdk-go", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/config/BUILD.bazel b/internal/config/BUILD.bazel index b0d181fd1..f2c2496a1 100644 --- a/internal/config/BUILD.bazel +++ b/internal/config/BUILD.bazel @@ -67,3 +67,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/configfile/BUILD.bazel b/internal/configfile/BUILD.bazel index fdfb88536..0d67a72a5 100644 --- a/internal/configfile/BUILD.bazel +++ b/internal/configfile/BUILD.bazel @@ -32,3 +32,25 @@ go_test( embed = [":configfile"], deps = ["//internal/config"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/creds/BUILD.bazel b/internal/creds/BUILD.bazel index 8e19e51f6..ad796d4c1 100644 --- a/internal/creds/BUILD.bazel +++ b/internal/creds/BUILD.bazel @@ -20,3 +20,25 @@ go_test( embed = [":creds"], deps = ["//internal/testutil/credentialcmd"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/debug/BUILD.bazel b/internal/debug/BUILD.bazel index 27accb99b..f23f1e5c8 100644 --- a/internal/debug/BUILD.bazel +++ b/internal/debug/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["debug_test.go"], embed = [":debug"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/doltremote/BUILD.bazel b/internal/doltremote/BUILD.bazel index edca71b4d..d0299f657 100644 --- a/internal/doltremote/BUILD.bazel +++ b/internal/doltremote/BUILD.bazel @@ -19,3 +19,25 @@ go_test( "//internal/storage/doltutil", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/doltserver/BUILD.bazel b/internal/doltserver/BUILD.bazel index c742a1952..05e2b6db0 100644 --- a/internal/doltserver/BUILD.bazel +++ b/internal/doltserver/BUILD.bazel @@ -191,3 +191,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/doltversion/BUILD.bazel b/internal/doltversion/BUILD.bazel index d54009bb1..d49ef74b1 100644 --- a/internal/doltversion/BUILD.bazel +++ b/internal/doltversion/BUILD.bazel @@ -26,3 +26,25 @@ go_test( ], embed = [":doltversion"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/eventsjournal/BUILD.bazel b/internal/eventsjournal/BUILD.bazel index aef6f700d..2b16a7c91 100644 --- a/internal/eventsjournal/BUILD.bazel +++ b/internal/eventsjournal/BUILD.bazel @@ -29,3 +29,25 @@ go_test( "@com_github_data_dog_go_sqlmock//:go-sqlmock", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/execenv/BUILD.bazel b/internal/execenv/BUILD.bazel index a94724f43..7ab55c24f 100644 --- a/internal/execenv/BUILD.bazel +++ b/internal/execenv/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["execenv_test.go"], embed = [":execenv"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/fdhygiene/BUILD.bazel b/internal/fdhygiene/BUILD.bazel index cc99908e4..ef2066d5a 100644 --- a/internal/fdhygiene/BUILD.bazel +++ b/internal/fdhygiene/BUILD.bazel @@ -88,3 +88,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/formula/BUILD.bazel b/internal/formula/BUILD.bazel index 5e53e92d4..a7377a78d 100644 --- a/internal/formula/BUILD.bazel +++ b/internal/formula/BUILD.bazel @@ -51,3 +51,25 @@ go_test( "//internal/testutil/bazeltest", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/formula/cmd/schemagen/BUILD.bazel b/internal/formula/cmd/schemagen/BUILD.bazel index 66dd67e53..aa9497029 100644 --- a/internal/formula/cmd/schemagen/BUILD.bazel +++ b/internal/formula/cmd/schemagen/BUILD.bazel @@ -13,3 +13,25 @@ go_binary( embed = [":schemagen_lib"], visibility = ["//:__subpackages__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/formula/schemagen/BUILD.bazel b/internal/formula/schemagen/BUILD.bazel index 947eb12bc..fdcbe2f97 100644 --- a/internal/formula/schemagen/BUILD.bazel +++ b/internal/formula/schemagen/BUILD.bazel @@ -6,3 +6,25 @@ go_library( importpath = "github.com/steveyegge/beads/internal/formula/schemagen", visibility = ["//:__subpackages__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/git/BUILD.bazel b/internal/git/BUILD.bazel index 0d991c222..4d259cd16 100644 --- a/internal/git/BUILD.bazel +++ b/internal/git/BUILD.bazel @@ -15,3 +15,25 @@ go_test( ], embed = [":git"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/gitenv/BUILD.bazel b/internal/gitenv/BUILD.bazel index d98f29048..b9317dac6 100644 --- a/internal/gitenv/BUILD.bazel +++ b/internal/gitenv/BUILD.bazel @@ -13,3 +13,25 @@ go_test( srcs = ["routing_test.go"], embed = [":gitenv"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/githooksenv/BUILD.bazel b/internal/githooksenv/BUILD.bazel index b9370947f..0dfbf2c9b 100644 --- a/internal/githooksenv/BUILD.bazel +++ b/internal/githooksenv/BUILD.bazel @@ -13,3 +13,25 @@ go_test( srcs = ["githooksenv_test.go"], embed = [":githooksenv"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/github/BUILD.bazel b/internal/github/BUILD.bazel index 9fff27f23..8062dd22a 100644 --- a/internal/github/BUILD.bazel +++ b/internal/github/BUILD.bazel @@ -38,3 +38,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/gitignore/BUILD.bazel b/internal/gitignore/BUILD.bazel index ca1273b4c..3ec14028e 100644 --- a/internal/gitignore/BUILD.bazel +++ b/internal/gitignore/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["append_test.go"], embed = [":gitignore"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/gitlab/BUILD.bazel b/internal/gitlab/BUILD.bazel index cf9434480..1ae60e524 100644 --- a/internal/gitlab/BUILD.bazel +++ b/internal/gitlab/BUILD.bazel @@ -37,3 +37,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/gittraceenv/BUILD.bazel b/internal/gittraceenv/BUILD.bazel index 4514cb6a5..d3ab9ec8e 100644 --- a/internal/gittraceenv/BUILD.bazel +++ b/internal/gittraceenv/BUILD.bazel @@ -13,3 +13,25 @@ go_test( srcs = ["gittraceenv_test.go"], embed = [":gittraceenv"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/hooks/BUILD.bazel b/internal/hooks/BUILD.bazel index 004745f8f..3c6e1590b 100644 --- a/internal/hooks/BUILD.bazel +++ b/internal/hooks/BUILD.bazel @@ -213,3 +213,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpapi/BUILD.bazel b/internal/httpapi/BUILD.bazel index 4e559636e..ff7bb7787 100644 --- a/internal/httpapi/BUILD.bazel +++ b/internal/httpapi/BUILD.bazel @@ -130,3 +130,25 @@ go_test( "@in_gopkg_yaml_v3//:yaml_v3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpapi/apigen/BUILD.bazel b/internal/httpapi/apigen/BUILD.bazel index fad33f8a8..f777dcdd4 100644 --- a/internal/httpapi/apigen/BUILD.bazel +++ b/internal/httpapi/apigen/BUILD.bazel @@ -14,3 +14,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpapi/spec/BUILD.bazel b/internal/httpapi/spec/BUILD.bazel index b734489cd..5fe190f42 100644 --- a/internal/httpapi/spec/BUILD.bazel +++ b/internal/httpapi/spec/BUILD.bazel @@ -18,3 +18,25 @@ exports_files( ["openapi.v0.yaml"], visibility = ["//internal/httpclient/encode:__pkg__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpapi/wireshape/BUILD.bazel b/internal/httpapi/wireshape/BUILD.bazel index b643aa0f6..c107b8a0c 100644 --- a/internal/httpapi/wireshape/BUILD.bazel +++ b/internal/httpapi/wireshape/BUILD.bazel @@ -34,3 +34,25 @@ exports_files( ["testdata/golden.json"], visibility = ["//internal/httpclient/wire:__pkg__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpapi/wireshape/cmd/gendigest/BUILD.bazel b/internal/httpapi/wireshape/cmd/gendigest/BUILD.bazel index 425d566ef..3b3dc5d04 100644 --- a/internal/httpapi/wireshape/cmd/gendigest/BUILD.bazel +++ b/internal/httpapi/wireshape/cmd/gendigest/BUILD.bazel @@ -23,3 +23,25 @@ go_test( embed = [":gendigest_lib"], deps = ["//internal/httpapi/wireshape"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpclient/BUILD.bazel b/internal/httpclient/BUILD.bazel index b93917c93..7b9542c59 100644 --- a/internal/httpclient/BUILD.bazel +++ b/internal/httpclient/BUILD.bazel @@ -53,3 +53,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpclient/encode/BUILD.bazel b/internal/httpclient/encode/BUILD.bazel index e9faf9c17..a9b9adfd6 100644 --- a/internal/httpclient/encode/BUILD.bazel +++ b/internal/httpclient/encode/BUILD.bazel @@ -46,3 +46,25 @@ go_test( "@in_gopkg_yaml_v3//:yaml_v3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/httpclient/wire/BUILD.bazel b/internal/httpclient/wire/BUILD.bazel index 3d520f9c4..989a796b8 100644 --- a/internal/httpclient/wire/BUILD.bazel +++ b/internal/httpclient/wire/BUILD.bazel @@ -58,3 +58,25 @@ go_test( "@in_gopkg_yaml_v3//:yaml_v3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/idgen/BUILD.bazel b/internal/idgen/BUILD.bazel index baa2d1260..d85848c47 100644 --- a/internal/idgen/BUILD.bazel +++ b/internal/idgen/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["hash_test.go"], embed = [":idgen"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/jira/BUILD.bazel b/internal/jira/BUILD.bazel index e0045cdf2..f42e6ec5e 100644 --- a/internal/jira/BUILD.bazel +++ b/internal/jira/BUILD.bazel @@ -37,3 +37,25 @@ go_test( "//memoryops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/linear/BUILD.bazel b/internal/linear/BUILD.bazel index b5a2fcf3d..e660b46a2 100644 --- a/internal/linear/BUILD.bazel +++ b/internal/linear/BUILD.bazel @@ -63,3 +63,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/lockfile/BUILD.bazel b/internal/lockfile/BUILD.bazel index 59c9d3504..347cd13d9 100644 --- a/internal/lockfile/BUILD.bazel +++ b/internal/lockfile/BUILD.bazel @@ -59,3 +59,25 @@ go_test( srcs = ["lock_test.go"], embed = [":lockfile"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/memoryapi/BUILD.bazel b/internal/memoryapi/BUILD.bazel index bd5802a5d..d676833ae 100644 --- a/internal/memoryapi/BUILD.bazel +++ b/internal/memoryapi/BUILD.bazel @@ -14,3 +14,25 @@ go_test( embed = [":memoryapi"], deps = ["//memoryops"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/metrics/BUILD.bazel b/internal/metrics/BUILD.bazel index dd2301a52..eb9b7d7fa 100644 --- a/internal/metrics/BUILD.bazel +++ b/internal/metrics/BUILD.bazel @@ -38,3 +38,25 @@ go_test( "@in_gopkg_yaml_v3//:yaml_v3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/migration/BUILD.bazel b/internal/migration/BUILD.bazel index b09960e07..d3bae9093 100644 --- a/internal/migration/BUILD.bazel +++ b/internal/migration/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["freeze_test.go"], embed = [":migration"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/migration/legacysqlite/BUILD.bazel b/internal/migration/legacysqlite/BUILD.bazel index b8ea518aa..847117321 100644 --- a/internal/migration/legacysqlite/BUILD.bazel +++ b/internal/migration/legacysqlite/BUILD.bazel @@ -25,3 +25,25 @@ go_test( "@com_github_mattn_go_sqlite3//:go-sqlite3", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/molecules/BUILD.bazel b/internal/molecules/BUILD.bazel index d2f31c014..57fe6e3eb 100644 --- a/internal/molecules/BUILD.bazel +++ b/internal/molecules/BUILD.bazel @@ -26,3 +26,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/notion/BUILD.bazel b/internal/notion/BUILD.bazel index beb8b2aea..871fe68e8 100644 --- a/internal/notion/BUILD.bazel +++ b/internal/notion/BUILD.bazel @@ -36,3 +36,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/procid/BUILD.bazel b/internal/procid/BUILD.bazel index 152135fe8..14cc92d61 100644 --- a/internal/procid/BUILD.bazel +++ b/internal/procid/BUILD.bazel @@ -49,3 +49,25 @@ go_test( "//conditions:default": [], }), ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/query/BUILD.bazel b/internal/query/BUILD.bazel index acaf1e8dd..d8db3bcff 100644 --- a/internal/query/BUILD.bazel +++ b/internal/query/BUILD.bazel @@ -26,3 +26,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/recipes/BUILD.bazel b/internal/recipes/BUILD.bazel index 34a312aa7..b94f373c0 100644 --- a/internal/recipes/BUILD.bazel +++ b/internal/recipes/BUILD.bazel @@ -20,3 +20,25 @@ go_test( embed = [":recipes"], deps = ["//plugins/beads"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/remotecache/BUILD.bazel b/internal/remotecache/BUILD.bazel index b7c2fb877..69d123c65 100644 --- a/internal/remotecache/BUILD.bazel +++ b/internal/remotecache/BUILD.bazel @@ -28,3 +28,25 @@ go_test( embed = [":remotecache"], deps = ["//internal/githooksenv"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/routing/BUILD.bazel b/internal/routing/BUILD.bazel index 827dc8522..87bee6e4d 100644 --- a/internal/routing/BUILD.bazel +++ b/internal/routing/BUILD.bazel @@ -20,3 +20,25 @@ go_test( "//internal/gitenv", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/BUILD.bazel b/internal/storage/BUILD.bazel index fb8f51af9..394365aea 100644 --- a/internal/storage/BUILD.bazel +++ b/internal/storage/BUILD.bazel @@ -176,3 +176,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/backendnames/BUILD.bazel b/internal/storage/backendnames/BUILD.bazel index b41741b95..90aa5c611 100644 --- a/internal/storage/backendnames/BUILD.bazel +++ b/internal/storage/backendnames/BUILD.bazel @@ -19,3 +19,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/backends/BUILD.bazel b/internal/storage/backends/BUILD.bazel index fbdb0fdb3..d5c06c542 100644 --- a/internal/storage/backends/BUILD.bazel +++ b/internal/storage/backends/BUILD.bazel @@ -38,3 +38,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/batchbench/BUILD.bazel b/internal/storage/batchbench/BUILD.bazel index 03138e35f..7b15e3ec5 100644 --- a/internal/storage/batchbench/BUILD.bazel +++ b/internal/storage/batchbench/BUILD.bazel @@ -27,3 +27,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/batchfixtures/BUILD.bazel b/internal/storage/batchfixtures/BUILD.bazel index d25054cf4..a4718d9bf 100644 --- a/internal/storage/batchfixtures/BUILD.bazel +++ b/internal/storage/batchfixtures/BUILD.bazel @@ -39,3 +39,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/contextinfo/BUILD.bazel b/internal/storage/contextinfo/BUILD.bazel index fa37a7535..00814c404 100644 --- a/internal/storage/contextinfo/BUILD.bazel +++ b/internal/storage/contextinfo/BUILD.bazel @@ -29,3 +29,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/createbatchequiv/BUILD.bazel b/internal/storage/createbatchequiv/BUILD.bazel index 0214b7037..39cb683ac 100644 --- a/internal/storage/createbatchequiv/BUILD.bazel +++ b/internal/storage/createbatchequiv/BUILD.bazel @@ -39,3 +39,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dberrors/BUILD.bazel b/internal/storage/dberrors/BUILD.bazel index b29f0175a..5a5614ffe 100644 --- a/internal/storage/dberrors/BUILD.bazel +++ b/internal/storage/dberrors/BUILD.bazel @@ -33,3 +33,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dbproxy/identity/BUILD.bazel b/internal/storage/dbproxy/identity/BUILD.bazel index fa3c24b66..de7e8243c 100644 --- a/internal/storage/dbproxy/identity/BUILD.bazel +++ b/internal/storage/dbproxy/identity/BUILD.bazel @@ -33,3 +33,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dbproxy/pidfile/BUILD.bazel b/internal/storage/dbproxy/pidfile/BUILD.bazel index 302bb931e..47e4de2d1 100644 --- a/internal/storage/dbproxy/pidfile/BUILD.bazel +++ b/internal/storage/dbproxy/pidfile/BUILD.bazel @@ -26,3 +26,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dbproxy/proxy/BUILD.bazel b/internal/storage/dbproxy/proxy/BUILD.bazel index 5f8cdad9d..f3691c871 100644 --- a/internal/storage/dbproxy/proxy/BUILD.bazel +++ b/internal/storage/dbproxy/proxy/BUILD.bazel @@ -108,3 +108,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dbproxy/server/BUILD.bazel b/internal/storage/dbproxy/server/BUILD.bazel index fb64d1fc3..4236238be 100644 --- a/internal/storage/dbproxy/server/BUILD.bazel +++ b/internal/storage/dbproxy/server/BUILD.bazel @@ -62,3 +62,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dbproxy/util/BUILD.bazel b/internal/storage/dbproxy/util/BUILD.bazel index dcf75e375..e0a65d2f5 100644 --- a/internal/storage/dbproxy/util/BUILD.bazel +++ b/internal/storage/dbproxy/util/BUILD.bazel @@ -33,3 +33,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/depid/BUILD.bazel b/internal/storage/depid/BUILD.bazel index 759164bdc..6fa6f9f05 100644 --- a/internal/storage/depid/BUILD.bazel +++ b/internal/storage/depid/BUILD.bazel @@ -26,3 +26,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/dolt/BUILD.bazel b/internal/storage/dolt/BUILD.bazel index 6d9fad283..7263ec7bf 100644 --- a/internal/storage/dolt/BUILD.bazel +++ b/internal/storage/dolt/BUILD.bazel @@ -590,3 +590,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/doltutil/BUILD.bazel b/internal/storage/doltutil/BUILD.bazel index dbcff6704..d018dd26b 100644 --- a/internal/storage/doltutil/BUILD.bazel +++ b/internal/storage/doltutil/BUILD.bazel @@ -55,3 +55,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/domain/BUILD.bazel b/internal/storage/domain/BUILD.bazel index c35a54ac3..4393d650a 100644 --- a/internal/storage/domain/BUILD.bazel +++ b/internal/storage/domain/BUILD.bazel @@ -89,3 +89,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/domain/db/BUILD.bazel b/internal/storage/domain/db/BUILD.bazel index da2460a55..7498f62cf 100644 --- a/internal/storage/domain/db/BUILD.bazel +++ b/internal/storage/domain/db/BUILD.bazel @@ -193,3 +193,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/domain/fs/BUILD.bazel b/internal/storage/domain/fs/BUILD.bazel index 0ed0a9c9b..4d6d2e8cb 100644 --- a/internal/storage/domain/fs/BUILD.bazel +++ b/internal/storage/domain/fs/BUILD.bazel @@ -77,3 +77,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/domain/git/BUILD.bazel b/internal/storage/domain/git/BUILD.bazel index 4b802168a..7b4b8f2e0 100644 --- a/internal/storage/domain/git/BUILD.bazel +++ b/internal/storage/domain/git/BUILD.bazel @@ -64,3 +64,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/embeddeddolt/BUILD.bazel b/internal/storage/embeddeddolt/BUILD.bazel index 56949ee3c..d250bd628 100644 --- a/internal/storage/embeddeddolt/BUILD.bazel +++ b/internal/storage/embeddeddolt/BUILD.bazel @@ -373,3 +373,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/embeddeddolt/cmd/BUILD.bazel b/internal/storage/embeddeddolt/cmd/BUILD.bazel index 11a955b95..da3b5b782 100644 --- a/internal/storage/embeddeddolt/cmd/BUILD.bazel +++ b/internal/storage/embeddeddolt/cmd/BUILD.bazel @@ -26,3 +26,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/externaldeps/BUILD.bazel b/internal/storage/externaldeps/BUILD.bazel index 2b80333d8..d558c90a4 100644 --- a/internal/storage/externaldeps/BUILD.bazel +++ b/internal/storage/externaldeps/BUILD.bazel @@ -55,3 +55,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/fs/BUILD.bazel b/internal/storage/fs/BUILD.bazel index 2865f1f1e..4ef61a465 100644 --- a/internal/storage/fs/BUILD.bazel +++ b/internal/storage/fs/BUILD.bazel @@ -23,3 +23,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/git/BUILD.bazel b/internal/storage/git/BUILD.bazel index 7b22060ab..25e548a7b 100644 --- a/internal/storage/git/BUILD.bazel +++ b/internal/storage/git/BUILD.bazel @@ -23,3 +23,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/issueops/BUILD.bazel b/internal/storage/issueops/BUILD.bazel index 71512f91a..af5f9fc2e 100644 --- a/internal/storage/issueops/BUILD.bazel +++ b/internal/storage/issueops/BUILD.bazel @@ -230,3 +230,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/journalscan/BUILD.bazel b/internal/storage/journalscan/BUILD.bazel index 724b7b0d9..d1178ba0e 100644 --- a/internal/storage/journalscan/BUILD.bazel +++ b/internal/storage/journalscan/BUILD.bazel @@ -25,3 +25,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/kvkeys/BUILD.bazel b/internal/storage/kvkeys/BUILD.bazel index 3b609a2ca..ee4c8e5cd 100644 --- a/internal/storage/kvkeys/BUILD.bazel +++ b/internal/storage/kvkeys/BUILD.bazel @@ -25,3 +25,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/memoryops/BUILD.bazel b/internal/storage/memoryops/BUILD.bazel index 5bdd40d2c..9039a52f6 100644 --- a/internal/storage/memoryops/BUILD.bazel +++ b/internal/storage/memoryops/BUILD.bazel @@ -29,3 +29,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/rowid/BUILD.bazel b/internal/storage/rowid/BUILD.bazel index 180d6fea9..90788b3c9 100644 --- a/internal/storage/rowid/BUILD.bazel +++ b/internal/storage/rowid/BUILD.bazel @@ -26,3 +26,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/schema/BUILD.bazel b/internal/storage/schema/BUILD.bazel index 1975dfb22..c3deff533 100644 --- a/internal/storage/schema/BUILD.bazel +++ b/internal/storage/schema/BUILD.bazel @@ -179,12 +179,6 @@ filegroup( visibility = ["//internal/storage:__subpackages__"], ) -# Linked from the root and engdocs AGENTS.md; //:docsync_files checks those links. -exports_files( - ["migrations/README.md"], - visibility = ["//:__pkg__"], -) - # --- begin go_srcs (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- filegroup( @@ -197,3 +191,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/sqlbuild/BUILD.bazel b/internal/storage/sqlbuild/BUILD.bazel index fbbbe7d4b..8f2ce0aa2 100644 --- a/internal/storage/sqlbuild/BUILD.bazel +++ b/internal/storage/sqlbuild/BUILD.bazel @@ -52,3 +52,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/sqlclass/BUILD.bazel b/internal/storage/sqlclass/BUILD.bazel index db106a867..f169dff0d 100644 --- a/internal/storage/sqlclass/BUILD.bazel +++ b/internal/storage/sqlclass/BUILD.bazel @@ -26,3 +26,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/sqlcount/BUILD.bazel b/internal/storage/sqlcount/BUILD.bazel index 66d03210a..eaa94c1b4 100644 --- a/internal/storage/sqlcount/BUILD.bazel +++ b/internal/storage/sqlcount/BUILD.bazel @@ -19,3 +19,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/storagecontract/BUILD.bazel b/internal/storage/storagecontract/BUILD.bazel index dab3ad5b1..416cedece 100644 --- a/internal/storage/storagecontract/BUILD.bazel +++ b/internal/storage/storagecontract/BUILD.bazel @@ -20,3 +20,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/uow/BUILD.bazel b/internal/storage/uow/BUILD.bazel index fe2f3f26c..ffcd8cf28 100644 --- a/internal/storage/uow/BUILD.bazel +++ b/internal/storage/uow/BUILD.bazel @@ -280,3 +280,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/storage/versioncontrolops/BUILD.bazel b/internal/storage/versioncontrolops/BUILD.bazel index d33ea0127..17fc465ad 100644 --- a/internal/storage/versioncontrolops/BUILD.bazel +++ b/internal/storage/versioncontrolops/BUILD.bazel @@ -65,3 +65,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/telemetry/BUILD.bazel b/internal/telemetry/BUILD.bazel index a643c5b60..380b9d29a 100644 --- a/internal/telemetry/BUILD.bazel +++ b/internal/telemetry/BUILD.bazel @@ -83,3 +83,25 @@ go_test( "@io_opentelemetry_go_otel_trace//noop", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/templates/BUILD.bazel b/internal/templates/BUILD.bazel index 486d2d183..521b4505e 100644 --- a/internal/templates/BUILD.bazel +++ b/internal/templates/BUILD.bazel @@ -10,3 +10,25 @@ go_library( importpath = "github.com/steveyegge/beads/internal/templates", visibility = ["//:__subpackages__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/templates/agents/BUILD.bazel b/internal/templates/agents/BUILD.bazel index edb3fc13a..4836ed286 100644 --- a/internal/templates/agents/BUILD.bazel +++ b/internal/templates/agents/BUILD.bazel @@ -24,3 +24,25 @@ go_test( ], embed = [":agents"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/testutil/BUILD.bazel b/internal/testutil/BUILD.bazel index 7e54398e1..8cff43c52 100644 --- a/internal/testutil/BUILD.bazel +++ b/internal/testutil/BUILD.bazel @@ -125,12 +125,24 @@ go_test( ], ) -# Dolt image pin read as text by //test/docsync and the dolt pin tests in -# //scripts. -exports_files( - ["testdoltcommon.go"], - visibility = [ - "//scripts:__pkg__", - "//test/docsync:__pkg__", - ], +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], ) + +# --- end repo_files --- diff --git a/internal/testutil/bazeltest/BUILD.bazel b/internal/testutil/bazeltest/BUILD.bazel index ea4bf0b8c..a3a6c955d 100644 --- a/internal/testutil/bazeltest/BUILD.bazel +++ b/internal/testutil/bazeltest/BUILD.bazel @@ -13,3 +13,25 @@ go_test( data = glob(["testdata/**"]), embed = [":bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/testutil/credentialcmd/BUILD.bazel b/internal/testutil/credentialcmd/BUILD.bazel index 3ea66fd39..82e67577d 100644 --- a/internal/testutil/credentialcmd/BUILD.bazel +++ b/internal/testutil/credentialcmd/BUILD.bazel @@ -16,3 +16,25 @@ go_test( srcs = ["credentialcmd_test.go"], embed = [":credentialcmd"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/testutil/fixtures/BUILD.bazel b/internal/testutil/fixtures/BUILD.bazel index 4f79f92a7..aee139035 100644 --- a/internal/testutil/fixtures/BUILD.bazel +++ b/internal/testutil/fixtures/BUILD.bazel @@ -25,3 +25,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/testutil/integration/BUILD.bazel b/internal/testutil/integration/BUILD.bazel index f34816ff5..fcc3fc611 100644 --- a/internal/testutil/integration/BUILD.bazel +++ b/internal/testutil/integration/BUILD.bazel @@ -79,3 +79,25 @@ go_test( env = {"BEADS_TEST_GO_BINARY": "$(rlocationpath @go_sdk//:bin/go)"}, tags = ["integration-only"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/timeparsing/BUILD.bazel b/internal/timeparsing/BUILD.bazel index 3455ac0bc..200d3d297 100644 --- a/internal/timeparsing/BUILD.bazel +++ b/internal/timeparsing/BUILD.bazel @@ -20,3 +20,25 @@ go_test( ], embed = [":timeparsing"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/tracker/BUILD.bazel b/internal/tracker/BUILD.bazel index e0cadf8b6..491df98bd 100644 --- a/internal/tracker/BUILD.bazel +++ b/internal/tracker/BUILD.bazel @@ -108,3 +108,25 @@ sh_test( }, tags = ["dolt-server"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/tracker/conformance/BUILD.bazel b/internal/tracker/conformance/BUILD.bazel index 0fa79e36d..660c18c85 100644 --- a/internal/tracker/conformance/BUILD.bazel +++ b/internal/tracker/conformance/BUILD.bazel @@ -51,3 +51,25 @@ sh_test( }, tags = ["dolt-server"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/types/BUILD.bazel b/internal/types/BUILD.bazel index 82e7ed542..1b2a611cf 100644 --- a/internal/types/BUILD.bazel +++ b/internal/types/BUILD.bazel @@ -38,3 +38,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/ui/BUILD.bazel b/internal/ui/BUILD.bazel index b28b57666..d4bf16eb4 100644 --- a/internal/ui/BUILD.bazel +++ b/internal/ui/BUILD.bazel @@ -31,3 +31,25 @@ go_test( "@land_charm_lipgloss_v2//:lipgloss", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/uimd/BUILD.bazel b/internal/uimd/BUILD.bazel index b6bb87ea5..756358b1c 100644 --- a/internal/uimd/BUILD.bazel +++ b/internal/uimd/BUILD.bazel @@ -23,3 +23,25 @@ go_test( "@land_charm_glamour_v2//styles", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/utils/BUILD.bazel b/internal/utils/BUILD.bazel index 97d1a0e58..be3234d57 100644 --- a/internal/utils/BUILD.bazel +++ b/internal/utils/BUILD.bazel @@ -49,3 +49,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/validation/BUILD.bazel b/internal/validation/BUILD.bazel index 46bf8895d..53e2232aa 100644 --- a/internal/validation/BUILD.bazel +++ b/internal/validation/BUILD.bazel @@ -30,3 +30,25 @@ go_test( "//internal/types", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/versioncheck/BUILD.bazel b/internal/versioncheck/BUILD.bazel index b439bcb54..ffa55c8ad 100644 --- a/internal/versioncheck/BUILD.bazel +++ b/internal/versioncheck/BUILD.bazel @@ -18,3 +18,25 @@ go_test( embed = [":versioncheck"], deps = ["//internal/testutil/bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/versioncheck/check_test.go b/internal/versioncheck/check_test.go index 71c4564ba..29da1ace4 100644 --- a/internal/versioncheck/check_test.go +++ b/internal/versioncheck/check_test.go @@ -12,7 +12,7 @@ import ( func TestRepositoryReleaseVersionsMatch(t *testing.T) { root := bazeltest.RepoRoot(t) report, err := Check(root) - if err != nil && !(bazeltest.IsBazel() && onlyNPMManifestUndeclared(t, root, report)) { + if err != nil { t.Fatalf("repository release metadata is inconsistent: %v", err) } if report.CheckedSources != 12 { @@ -623,28 +623,3 @@ func writeFixtureAt(t *testing.T, root, version string) { func stringPointer(value string) *string { return &value } - -// onlyNPMManifestUndeclared reports, and logs, whether the npm manifest is the -// one failing release surface and it failed because it is absent. npm-package/ -// is in .bazelignore, so no target can declare npm-package/package.json as data -// and a Bazel run never sees it; `go test` checks it against the real checkout. -func onlyNPMManifestUndeclared(t *testing.T, root string, report Report) bool { - t.Helper() - if _, err := os.Stat(filepath.Join(root, "npm-package", "package.json")); !os.IsNotExist(err) { - return false - } - npmMissing := false - for _, source := range report.Sources { - switch { - case source.Problem == "": - case source.Description == "npm package.json": - npmMissing = true - default: - return false - } - } - if npmMissing { - t.Log("npm-package/ is in .bazelignore, so npm-package/package.json cannot be declared as data; checked under go test") - } - return npmMissing -} diff --git a/internal/workapi/BUILD.bazel b/internal/workapi/BUILD.bazel index 162b4258d..ff896671c 100644 --- a/internal/workapi/BUILD.bazel +++ b/internal/workapi/BUILD.bazel @@ -73,3 +73,25 @@ go_test( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storecounter/BUILD.bazel b/internal/workapi/storecounter/BUILD.bazel index e200739bd..04b67721e 100644 --- a/internal/workapi/storecounter/BUILD.bazel +++ b/internal/workapi/storecounter/BUILD.bazel @@ -12,3 +12,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storequerier/BUILD.bazel b/internal/workapi/storequerier/BUILD.bazel index 72cb226c6..a8d2e6149 100644 --- a/internal/workapi/storequerier/BUILD.bazel +++ b/internal/workapi/storequerier/BUILD.bazel @@ -11,3 +11,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storereader/BUILD.bazel b/internal/workapi/storereader/BUILD.bazel index 16a5105dc..84e40c33e 100644 --- a/internal/workapi/storereader/BUILD.bazel +++ b/internal/workapi/storereader/BUILD.bazel @@ -23,3 +23,25 @@ go_test( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storereadycounter/BUILD.bazel b/internal/workapi/storereadycounter/BUILD.bazel index 8ab96877b..6cde32faf 100644 --- a/internal/workapi/storereadycounter/BUILD.bazel +++ b/internal/workapi/storereadycounter/BUILD.bazel @@ -11,3 +11,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storestats/BUILD.bazel b/internal/workapi/storestats/BUILD.bazel index f29b27789..7b009776b 100644 --- a/internal/workapi/storestats/BUILD.bazel +++ b/internal/workapi/storestats/BUILD.bazel @@ -12,3 +12,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storeversionreconciler/BUILD.bazel b/internal/workapi/storeversionreconciler/BUILD.bazel index 7d5b03eec..db79c94b7 100644 --- a/internal/workapi/storeversionreconciler/BUILD.bazel +++ b/internal/workapi/storeversionreconciler/BUILD.bazel @@ -11,3 +11,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workapi/storeworkspaceconfig/BUILD.bazel b/internal/workapi/storeworkspaceconfig/BUILD.bazel index 33fe08f81..c65c1f592 100644 --- a/internal/workapi/storeworkspaceconfig/BUILD.bazel +++ b/internal/workapi/storeworkspaceconfig/BUILD.bazel @@ -11,3 +11,25 @@ go_library( "//issueops", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/workspacegate/BUILD.bazel b/internal/workspacegate/BUILD.bazel index 530171afb..db9bf9acf 100644 --- a/internal/workspacegate/BUILD.bazel +++ b/internal/workspacegate/BUILD.bazel @@ -14,3 +14,25 @@ go_test( embed = [":workspacegate"], deps = ["//internal/testutil/bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/internal/worktreeremove/BUILD.bazel b/internal/worktreeremove/BUILD.bazel index ea9020fcb..97c70cf13 100644 --- a/internal/worktreeremove/BUILD.bazel +++ b/internal/worktreeremove/BUILD.bazel @@ -12,3 +12,25 @@ go_test( srcs = ["policy_test.go"], embed = [":worktreeremove"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/issueops/BUILD.bazel b/issueops/BUILD.bazel index 3e26c2f1a..1878a4e17 100644 --- a/issueops/BUILD.bazel +++ b/issueops/BUILD.bazel @@ -68,3 +68,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/journalops/BUILD.bazel b/journalops/BUILD.bazel index 47588b368..e42f82468 100644 --- a/journalops/BUILD.bazel +++ b/journalops/BUILD.bazel @@ -23,3 +23,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/memoryops/BUILD.bazel b/memoryops/BUILD.bazel index f4d5c924c..be45b9fa1 100644 --- a/memoryops/BUILD.bazel +++ b/memoryops/BUILD.bazel @@ -24,3 +24,25 @@ filegroup( ) # --- end go_srcs --- + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/plugins/beads/BUILD.bazel b/plugins/beads/BUILD.bazel index 152264079..618b55c28 100644 --- a/plugins/beads/BUILD.bazel +++ b/plugins/beads/BUILD.bazel @@ -31,3 +31,25 @@ exports_files( ], visibility = ["//:__pkg__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/schema/BUILD.bazel b/schema/BUILD.bazel index c2de6036f..08eae5b47 100644 --- a/schema/BUILD.bazel +++ b/schema/BUILD.bazel @@ -13,3 +13,25 @@ go_test( srcs = ["schema_test.go"], deps = [":schema"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/BUILD.bazel b/scripts/BUILD.bazel index a7be32561..4f4b2e617 100644 --- a/scripts/BUILD.bazel +++ b/scripts/BUILD.bazel @@ -1,19 +1,16 @@ load("@rules_go//go:def.bzl", "go_test") -# CI and repo-policy tests: they parse the workflows and run the CI shell -# scripts against fixtures. +# CI and repo-policy tests: they parse the workflows, run the CI shell scripts +# against fixtures, and check repository-wide rules (BUILD tag taxonomy, skip +# allowlist, managed BUILD blocks, shard manifests, tracked-file scans) over +# //:repo_files, the checkout as Bazel sees it. # -# Tags: -# host-tools: the scripts and fixtures run the host's git, python3, awk, -# sed, find, grep and timeout (beyond the bash the test wrapper needs). -# Under Bazel a missing git or bash fails the test (under go test it -# skips). -# no-remote-exec: so they always run where that inventory is known (the -# developer machine or the CI runner). The farm workers do have these -# tools today (the target passes there), so this can be dropped once that -# is guaranteed. -# no-remote-cache: the action key does not cover the host's tools, so a -# result from one host is neither uploaded for nor served to another. +# No tags: they run remotely like any other target. The scripts and fixtures +# run bash, git, python3, jq, yq, curl, openssl, unzip and coreutils from the +# executor (the rbe-west worker image, or the runner in fork-cache mode); a +# missing tool fails the test under Bazel instead of skipping it +# (host_tools_test.go), so a cached pass never stands for an executor that +# could not run it. Go and the release formula come in hermetically. go_test( name = "scripts_test", srcs = [ @@ -53,22 +50,18 @@ go_test( "windows_test_binaries_manifest_test.go", ], data = [ - ":scripts_files", - "//:.githooks/pre-commit", - "//:.goreleaser.yml", - "//:bazel_policy_files", - "//:engdocs/LINTING.md", - "//:mcp_package_policy_files", - "//:test_sh_files", - "//:workflow_files", - "//internal/testutil:testdoltcommon.go", - "//tools/bazel:dolt.bzl", - ], - tags = [ - "host-tools", - "no-remote-cache", - "no-remote-exec", + "//:repo_files", + "@beads_formulas//:beads-release.formula.toml", + "@go_sdk//:bin/go", + "@go_sdk//:files", ], + # The release formula lives in .beads/ (in .bazelignore: it also holds + # live bd data), so it comes in through its own local repository. The Go + # SDK is go.mod's toolchain, whatever go the executor has on PATH. + env = { + "BEADS_TEST_GO": "$(rlocationpath @go_sdk//:bin/go)", + "BEADS_TEST_RELEASE_FORMULA": "$(rlocationpath @beads_formulas//:beads-release.formula.toml)", + }, deps = [ "//internal/formula", "//internal/testutil/bazeltest", @@ -77,20 +70,6 @@ go_test( ], ) -# The scripts scripts_test reads and runs (CI helpers, check-*.sh, release.sh, -# test.sh, conformance.sh, ...). Globs stop at subpackages, so this is only -# this package's own tree. -filegroup( - name = "scripts_files", - srcs = glob( - ["**"], - exclude = [ - "BUILD.bazel", - "**/*_test.go", - ], - ), -) - exports_files( ["migration-test/release-catalog.json"], visibility = ["//scripts/migration-test/catalog:__pkg__"], @@ -105,11 +84,6 @@ exports_files( visibility = ["//scripts/prlintmake:__pkg__"], ) -exports_files( - ["README.md"], - visibility = ["//:__pkg__"], -) - exports_files( ["ci/gofmt-bin.sh"], visibility = ["//scripts/prlintmake:__pkg__"], @@ -121,3 +95,25 @@ exports_files( ["check-versions.sh"], visibility = ["//scripts/check-versions:__pkg__"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/bazel_policy_test.go b/scripts/bazel_policy_test.go index f4eb0b6d4..adb795b6d 100644 --- a/scripts/bazel_policy_test.go +++ b/scripts/bazel_policy_test.go @@ -11,6 +11,8 @@ import ( "strconv" "strings" "testing" + + "github.com/steveyegge/beads/internal/testutil/bazeltest" ) // Policy tests for the side-by-side Bazel configuration. They are plain Go @@ -443,6 +445,68 @@ func gitRepoAvailable(root string) bool { return exec.Command("git", "-C", root, "rev-parse", "--is-inside-work-tree").Run() == nil } +// repoFiles lists the repository's tracked files under root, repo-relative and +// slash-separated, each a regular file (or, in a local runfiles tree, a +// symlink to one). Under `go test` in a git checkout that is `git ls-files` +// less what the working tree no longer holds; under Bazel it is the runfiles +// tree, whose repository part is //:repo_files (every tracked file outside +// .bazelignore, tools/bazel/go_srcs.py); elsewhere every file under root. +func repoFiles(t *testing.T, root string) []string { + t.Helper() + var files []string + if bazeltest.IsBazel() || !gitRepoAvailable(root) { + err := filepath.WalkDir(root, func(path string, d os.DirEntry, err error) error { + if err != nil { + return err + } + if d.IsDir() || !isFileOrFileLink(path, d) { + return nil + } + rel, err := filepath.Rel(root, path) + if err != nil { + return err + } + files = append(files, filepath.ToSlash(rel)) + return nil + }) + if err != nil { + t.Fatalf("walk %s: %v", root, err) + } + } else { + out, err := exec.Command("git", "-C", root, "ls-files", "-z").Output() + if err != nil { + t.Fatalf("git ls-files: %v", err) + } + for _, rel := range strings.Split(strings.TrimRight(string(out), "\x00"), "\x00") { + info, err := os.Lstat(filepath.Join(root, filepath.FromSlash(rel))) + if err != nil || !info.Mode().IsRegular() { + continue // deleted in the worktree, submodule, or symlink + } + files = append(files, rel) + } + } + // Sanity: an empty or partial runfiles tree would pass every scan. + if len(files) < 1000 { + t.Fatalf("found only %d repository files under %s; the listing is broken", len(files), root) + } + return files +} + +// isFileOrFileLink reports whether a WalkDir entry is a regular file or a +// symlink to one. Bazel's local runfiles trees are symlink forests, so a walk +// that skipped symlinks would see no file there; a symlink to a directory +// (Bazel's bazel-* convenience links in a checkout) is never followed. +func isFileOrFileLink(path string, d os.DirEntry) bool { + if d.Type().IsRegular() { + return true + } + if d.Type()&os.ModeSymlink == 0 { + return false + } + info, err := os.Stat(path) + return err == nil && info.Mode().IsRegular() +} + func TestBazelNoRemoteEndpointsInTrackedFiles(t *testing.T) { // Fixtures are assembled at runtime so this file never contains a literal // endpoint itself. @@ -554,23 +618,12 @@ func TestBazelNoRemoteEndpointsInTrackedFiles(t *testing.T) { } root := bazelPolicyRoot(t) - if !gitRepoAvailable(root) { - t.Skip("not a git checkout (e.g. Bazel sandbox); tracked-file scan runs under go test and CI") - } - out, err := exec.Command("git", "-C", root, "ls-files", "-z", "--", "*bazelrc*", "*.md", ".github").Output() - if err != nil { - t.Fatalf("git ls-files: %v", err) - } var hits []endpointHit - for _, rel := range strings.Split(strings.TrimRight(string(out), "\x00"), "\x00") { + for _, rel := range repoFiles(t, root) { scan, strict := remoteScanKind(rel) if !scan { continue } - info, err := os.Lstat(filepath.Join(root, rel)) - if err != nil || !info.Mode().IsRegular() { - continue // deleted in the worktree, submodule, or symlink - } content, err := os.ReadFile(filepath.Join(root, rel)) if err != nil { t.Fatalf("read %s: %v", rel, err) @@ -589,27 +642,28 @@ func TestBazelNoRemoteEndpointsInTrackedFiles(t *testing.T) { // this file does not match itself. func TestNoLocalPlanPathsInTrackedFiles(t *testing.T) { root := bazelPolicyRoot(t) - if !gitRepoAvailable(root) { - t.Skip("not a git checkout (e.g. Bazel sandbox); tracked-file scan runs under go test and CI") - } - needle := "beads-" + "bazel-plan" - out, err := exec.Command("git", "-C", root, "grep", "-n", "-I", "-F", "-e", needle).Output() - if err != nil { - var exitErr *exec.ExitError - if errors.As(err, &exitErr) && exitErr.ExitCode() == 1 { - return // no matches + needle := []byte("beads-" + "bazel-plan") + for _, rel := range repoFiles(t, root) { + content, err := os.ReadFile(filepath.Join(root, filepath.FromSlash(rel))) + if err != nil { + t.Fatalf("read %s: %v", rel, err) + } + if bytes.IndexByte(content, 0) >= 0 { + continue // binary, as git grep -I + } + for n, line := range bytes.Split(content, []byte("\n")) { + if bytes.Contains(line, needle) { + t.Errorf("%s:%d: tracked file references a local, non-repo %s path; point at an in-repo doc, bead or PR instead", rel, n+1, needle) + } } - t.Fatalf("git grep: %v", err) - } - for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") { - t.Errorf("%s: tracked file references a local, non-repo %s path; point at an in-repo doc, bead or PR instead", line, needle) } } // --- generated go_srcs filegroups are current ------------------------------- -// These checks walk the source checkout, which is not declared as Bazel data, -// so they run under plain `go test` (the gating lane) and skip under Bazel. +// These checks walk the source checkout: under Bazel, //:repo_files, which +// holds every package's BUILD.bazel (a package missing its repo_files block +// is what `make bazel-sync-check` fails on). var ( treeGoSrcsRe = regexp.MustCompile(`(?s)filegroup\(\s*name\s*=\s*"tree_go_srcs",\s*srcs\s*=\s*\[(.*?)\]`) @@ -682,8 +736,8 @@ func diffStringSets(want, got []string) (missing, extra []string) { } // goSrcsTrees are the tools/bazel/go_srcs.py TREES roots. A test that walks -// one of these trees under Bazel sees only the packages its tree_go_srcs -// lists, so an unlisted package makes the walk pass vacuously. +// one of these trees through its tree_go_srcs sees only the packages listed +// there, so an unlisted package makes that walk pass vacuously. var goSrcsTrees = []string{"internal/storage"} func TestBazelTreeGoSrcsListsEveryPackage(t *testing.T) { @@ -695,9 +749,6 @@ func TestBazelTreeGoSrcsListsEveryPackage(t *testing.T) { t.Errorf("diffStringSets fixture: missing=%v extra=%v", missing, extra) } - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("walks the source checkout; runs under go test") - } root := sourceRepoRoot(t) script := readPolicyFile(t, root, "tools/bazel/go_srcs.py") for _, tree := range goSrcsTrees { @@ -729,13 +780,7 @@ func TestBazelTreeGoSrcsListsEveryPackage(t *testing.T) { // TestBazelGoSrcsBlocksCurrent runs `tools/bazel/go_srcs.py --check`, which // compares every managed block with what the script would generate. func TestBazelGoSrcsBlocksCurrent(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("reads the source checkout; runs under go test") - } - python, err := exec.LookPath("python3") - if err != nil { - t.Skip("python3 not available; TestBazelTreeGoSrcsListsEveryPackage still guards tree membership") - } + python := requireHostTool(t, "python3") cmd := exec.Command(python, filepath.Join("tools", "bazel", "go_srcs.py"), "--check") cmd.Dir = sourceRepoRoot(t) if out, err := cmd.CombinedOutput(); err != nil { @@ -745,13 +790,11 @@ func TestBazelGoSrcsBlocksCurrent(t *testing.T) { // --- no Bazel packages under the docs trees --------------------------------- -// //:docsync_files globs docs/** and engdocs/**; a glob stops at a package -// boundary, so a BUILD file under either tree would silently drop that -// subtree from //test/docsync's orphan and link checks. +// docs/ and engdocs/ are content (the Mintlify site and the engineering docs) +// that the root package's repo_files glob covers; they hold no code, so a +// BUILD file under either tree is a mistake (it would also split the subtree +// into a package of its own). func TestBazelNoPackagesUnderDocsTrees(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("walks the source checkout; runs under go test") - } root := sourceRepoRoot(t) for _, tree := range []string{"docs", "engdocs"} { err := filepath.WalkDir(filepath.Join(root, tree), func(path string, d os.DirEntry, err error) error { @@ -763,7 +806,7 @@ func TestBazelNoPackagesUnderDocsTrees(t *testing.T) { } if !d.IsDir() && (d.Name() == "BUILD.bazel" || d.Name() == "BUILD") { rel, _ := filepath.Rel(root, path) - t.Errorf("%s: no Bazel package may live under %s/ (it would cut that subtree out of //:docsync_files)", filepath.ToSlash(rel), tree) + t.Errorf("%s: no Bazel package may live under %s/ (docs trees are content, not code)", filepath.ToSlash(rel), tree) } return nil }) @@ -960,9 +1003,6 @@ func TestBazelTestTagsFollowTaxonomy(t *testing.T) { } } - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("walks every BUILD file in the source checkout; runs under go test") - } root := sourceRepoRoot(t) pkgs, err := bazelPackagesUnder(root, ".") if err != nil { diff --git a/scripts/bazel_skip_allowlist_test.go b/scripts/bazel_skip_allowlist_test.go index d87d4a126..b90d6c19f 100644 --- a/scripts/bazel_skip_allowlist_test.go +++ b/scripts/bazel_skip_allowlist_test.go @@ -16,48 +16,38 @@ import ( // Every Go test that deliberately skips itself under Bazel (a t.Skip guarded // by TEST_SRCDIR or bazeltest.IsBazel(), directly or through a helper it -// calls) has a `skip` entry in tools/bazel/equivalence_allowlist.txt. +// calls) has a `skip` entry in tools/bazel/equivalence_allowlist.txt, and no +// test runs part of its checks under go test only. // // The PR run of the Bazel lane cannot tell a test that skips under Bazel from // one that runs: only nightly.yml's skip-parity check (equivalence.py // --go-test-json) can, after the merge, and a missing entry turns that // nightly red (as TestBazelGatedLanesNeverRetryFlakyTests and -// TestCheckShardCoverageScript did on 2026-10-02). The entries are also what -// keeps those tests running under go test where the Bazel lane replaces a -// go test job. This check finds them before the merge, from the source. +// TestCheckShardCoverageScript did on 2026-10-02). Bazel is where the Go +// tests run on every PR, so a go-test-only check (a Bazel-guarded return or +// continue, or a block guarded by TEST_SRCDIR == "" / !IsBazel()) would run +// nowhere: declare what it reads as data instead (//:repo_files holds the +// whole checkout). This check finds them before the merge, from the source. // // Only top-level tests are considered: a subtest's skip is invisible to // equivalence.py, which compares top-level tests. func TestBazelOnlySkipsAreAllowlisted(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("walks every _test.go file in the source checkout; runs under go test") - } root := sourceRepoRoot(t) entries := readSkipAllowlist(t, filepath.Join(root, "tools", "bazel", "equivalence_allowlist.txt")) - found, err := bazelSkippingTests(root) + found, files, err := bazelSkippingTests(root) if err != nil { t.Fatal(err) } - if len(found) < 16 { - t.Fatalf("found only %d Bazel-skipping tests (%v); the scan is broken", len(found), found) + // Under Bazel the tree is //:repo_files; a scan that parsed few files is + // not looking at it. + if files < 1000 { + t.Fatalf("parsed only %d _test.go files; the scan is broken", files) } - partial := 0 - defer func() { - if partial < 5 { - t.Errorf("found only %d tests with a go-test-only part; the scan is broken", partial) - } - }() for _, f := range found { if f.partial { - // D2 step 3: under go test, only ./scripts/... still runs on every - // PR (pr.yml's scripts-go-checks job), so a Test that runs part - // of its checks under go test only must live there. - partial++ - if f.pkg != "scripts" && !strings.HasPrefix(f.pkg, "scripts/") { - t.Errorf("%s %s runs part of its checks under go test only (%s); outside ./scripts/... nothing runs that part on every PR: move the check to ./scripts or make the test t.Skip under Bazel and allowlist it", - f.pkg, f.test, f.where) - } + t.Errorf("%s %s runs part of its checks under go test only (%s); nothing runs that part on every PR: declare its inputs as Bazel data (//:repo_files) and drop the guard", + f.pkg, f.test, f.where) continue } if !skipAllowlisted(entries, f.pkg, f.test) { @@ -185,7 +175,10 @@ FUNC TestScriptsPartial(t *testing.T) { write("sub/go.mod", "module example.com/sub\n") write("sub/s_test.go", "package s\nimport \"testing\"\nfunc TestOtherModule(t *testing.T) { if bazeltest.IsBazel() { t.Skip() } }\n") - found, err := bazelSkippingTests(dir) + found, files, err := bazelSkippingTests(dir) + if files != 2 { + t.Errorf("scan parsed %d files, want 2 (a/a_test.go, scripts/s_test.go)", files) + } if err != nil { t.Fatal(err) } @@ -257,8 +250,10 @@ var bazelGuardTestFunc = regexp.MustCompile(`^Test([^a-z].*)?$`) // bazelSkippingTests parses every _test.go file of the module rooted at // root (not nested modules, node_modules, .git, .beads or bazel-* output -// trees) and returns the top-level tests that skip under Bazel. -func bazelSkippingTests(root string) ([]bazelSkip, error) { +// trees) and returns the top-level tests that skip under Bazel and the +// number of files it parsed. +func bazelSkippingTests(root string) ([]bazelSkip, int, error) { + parsed := 0 byDir := map[string][]*ast.File{} fset := token.NewFileSet() err := filepath.WalkDir(root, func(p string, d os.DirEntry, err error) error { @@ -277,18 +272,19 @@ func bazelSkippingTests(root string) ([]bazelSkip, error) { } return nil } - if !strings.HasSuffix(p, "_test.go") || d.Type()&os.ModeSymlink != 0 { + if !strings.HasSuffix(p, "_test.go") || !isFileOrFileLink(p, d) { return nil } f, err := parser.ParseFile(fset, p, nil, 0) if err != nil { return err } + parsed++ byDir[filepath.Dir(p)] = append(byDir[filepath.Dir(p)], f) return nil }) if err != nil { - return nil, err + return nil, parsed, err } var out []bazelSkip for dir, files := range byDir { @@ -325,7 +321,7 @@ func bazelSkippingTests(root string) ([]bazelSkip, error) { } } sort.Slice(out, func(i, j int) bool { return out[i].pkg+" "+out[i].test < out[j].pkg+" "+out[j].test }) - return out, nil + return out, parsed, nil } // goTestOnlyPart: the first if statement (outside closures) that ends a diff --git a/scripts/bench-ready-indexes/BUILD.bazel b/scripts/bench-ready-indexes/BUILD.bazel index 9d64f87d8..d67926583 100644 --- a/scripts/bench-ready-indexes/BUILD.bazel +++ b/scripts/bench-ready-indexes/BUILD.bazel @@ -20,3 +20,25 @@ go_test( embed = [":bench-ready-indexes_lib"], deps = ["@com_github_data_dog_go_sqlmock//:go-sqlmock"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/check-testing-short.sh b/scripts/check-testing-short.sh index 013483e51..62d6944a4 100755 --- a/scripts/check-testing-short.sh +++ b/scripts/check-testing-short.sh @@ -19,6 +19,9 @@ EOF status=0 +# Symlinked .go files count too: under Bazel the tree is a runfiles symlink +# forest. find does not descend into symlinked directories (bazel-* links). + while IFS=: read -r file line _; do file="${file#./}" if [[ -z "$file" || -z "$line" ]]; then @@ -49,7 +52,7 @@ while IFS=: read -r file line _; do printf 'Disallowed testing.Short() at %s:%s in %s\n' "$file" "$line" "${func:-unknown}" >&2 status=1 fi -done < <(find . -type f -name '*.go' -not -path './.git/*' -exec grep -n 'testing\.Short()' {} + || true) +done < <(find . \( -type f -o -type l \) -name '*.go' -not -path './.git/*' -exec grep -n 'testing\.Short()' {} + || true) if (( status != 0 )); then cat >&2 <<'EOF' diff --git a/scripts/check-versions/BUILD.bazel b/scripts/check-versions/BUILD.bazel index 88c87eee2..6baf8b20d 100644 --- a/scripts/check-versions/BUILD.bazel +++ b/scripts/check-versions/BUILD.bazel @@ -14,14 +14,11 @@ go_binary( visibility = ["//visibility:public"], ) -# Tags: -# host-tools: pre_push_hook_test.go runs the tracked pre-push hook and the -# shell entrypoint under the host's /bin/bash, and the hook shells out to -# the host's git and coreutils. -# no-remote-exec: so it runs where that inventory is known (the developer -# machine or the CI runner) rather than on a farm worker. -# no-remote-cache: the action key does not cover the host's bash or tools, so -# a result from one host is neither uploaded for nor served to another. +# pre_push_hook_test.go runs the tracked pre-push hook and the shell +# entrypoint under the executor's /bin/bash and coreutils. Under Bazel the +# entrypoint's `go build` is stood in for by the checker built here +# (BEADS_TEST_CHECK_VERSIONS): there is no module checkout or Go toolchain in +# the runfiles to build it from. go_test( name = "check-versions_test", srcs = [ @@ -29,17 +26,37 @@ go_test( "pre_push_hook_test.go", ], data = [ + ":check-versions", + "//:go.mod", "//:release_metadata_files", "//scripts:check-versions.sh", ], embed = [":check-versions_lib"], - tags = [ - "host-tools", - "no-remote-cache", - "no-remote-exec", - ], + env = {"BEADS_TEST_CHECK_VERSIONS": "$(rlocationpath :check-versions)"}, deps = [ "//internal/testutil/bazeltest", "//internal/versioncheck", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/check-versions/pre_push_hook_test.go b/scripts/check-versions/pre_push_hook_test.go index 2b3ede171..573f32aec 100644 --- a/scripts/check-versions/pre_push_hook_test.go +++ b/scripts/check-versions/pre_push_hook_test.go @@ -42,12 +42,16 @@ func TestPrePushHookOrdinaryPushWorksWithSystemBash(t *testing.T) { // alongside the ordinary-push compatibility that brought us here. // // Unlike the ordinary push above, the entrypoint builds the Go checker from - // source at the repository root, so it needs a full module checkout there. - // Under Bazel the tree the test sees is its runfiles, which holds only the - // declared data and no go.mod, so the wrapper could only ever report its - // build failure (127); `go test` runs against the real checkout. The guard - // sits inside each subtest, not above the loop, so that the ordinary-push - // assertion above still reports as run rather than hiding behind a skip. + // source at the repository root (`go build ./scripts/check-versions`), + // which needs a module checkout and a Go toolchain. Under Bazel there is + // neither, so a stand-in `go` first on PATH "builds" by copying the checker + // Bazel built from the same source (BEADS_TEST_CHECK_VERSIONS); everything + // the contract covers (status passthrough, no launcher diagnostic, temp + // cleanup) is the entrypoint's own. + path := os.Getenv("PATH") + if bazeltest.IsBazel() { + path = fakeGoBuildDir(t) + string(os.PathListSeparator) + path + } for _, tc := range []struct { name string args []string @@ -58,11 +62,9 @@ func TestPrePushHookOrdinaryPushWorksWithSystemBash(t *testing.T) { {"version mismatch", []string{"--expect", "0.0.0-checker-test"}, 3}, } { t.Run(tc.name, func(t *testing.T) { - if bazeltest.IsBazel() { - t.Skip("entrypoint builds from source: needs the real module checkout, not runfiles") - } scratch := t.TempDir() t.Setenv("TMPDIR", scratch) + t.Setenv("PATH", path) checker := filepath.Join(repoRoot, "scripts", "check-versions.sh") cmd := exec.Command(bash, append([]string{checker}, tc.args...)...) cmd.Dir = repoRoot @@ -137,3 +139,30 @@ func TestPrePushHookDriftRefusalPointsAtCheckerRemedy(t *testing.T) { t.Errorf("hook prescribes update-versions.sh for drift:\n%s", output) } } + +// fakeGoBuildDir returns a directory holding a stand-in `go` whose `build ... +// -o OUT ...` copies the Bazel-built checker (BEADS_TEST_CHECK_VERSIONS) to +// OUT, for check-versions.sh under Bazel, where there is no module checkout +// or Go toolchain to build it from. +func fakeGoBuildDir(t *testing.T) string { + t.Helper() + built, err := bazeltest.RunfileEnv("BEADS_TEST_CHECK_VERSIONS") + if err != nil { + t.Fatal(err) + } + dir := t.TempDir() + script := `#!/bin/sh +[ "$1" = build ] || { echo "stand-in go: only build is supported" >&2; exit 2; } +out= +while [ $# -gt 0 ]; do + if [ "$1" = -o ]; then out=$2; shift; fi + shift +done +[ -n "$out" ] || { echo "stand-in go: no -o" >&2; exit 2; } +exec cp "` + built + `" "$out" +` + if err := os.WriteFile(filepath.Join(dir, "go"), []byte(script), 0o755); err != nil { + t.Fatal(err) + } + return dir +} diff --git a/scripts/check-winget-portable-alias.sh b/scripts/check-winget-portable-alias.sh index adc30c66c..52b085baa 100755 --- a/scripts/check-winget-portable-alias.sh +++ b/scripts/check-winget-portable-alias.sh @@ -10,9 +10,9 @@ # differently, e.g. jq's `any(cond)` against mikefarah's `any_c`. set -euo pipefail -# yq is outside the host-tools inventory declared in scripts/BUILD.bazel and no -# workflow job installs it, so name the missing tool instead of reporting every -# manifest as missing its alias. +# No workflow job installs yq (ubuntu-latest and the rbe-west workers ship +# it), so name a missing tool instead of reporting every manifest as missing +# its alias. if ! command -v yq >/dev/null 2>&1; then echo "FAIL: yq is required by this guard but is not installed" exit 1 diff --git a/scripts/check_testing_short_test.go b/scripts/check_testing_short_test.go index 10c7a7a96..9e1257766 100644 --- a/scripts/check_testing_short_test.go +++ b/scripts/check_testing_short_test.go @@ -70,12 +70,14 @@ func TestCheckTestingShortPassesOnCleanRepoTree(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("checker is a Bash boundary") } - if os.Getenv("TEST_SRCDIR") != "" { - // Under Bazel the tree is only this target's runfiles, so the scan - // would pass vacuously. make check-testing-short runs it in CI. - t.Skip("walks the whole source checkout; runs under go test") - } repo := sourceRepoRoot(t) + // Under Bazel the tree is //:repo_files; a tree missing the allowlisted + // call sites would let the scan pass vacuously. + for _, rel := range []string{"internal/hooks/hooks_test.go", "internal/storage/dolt/concurrent_test.go", "internal/workapi/sweep_test.go"} { + if _, err := os.Stat(filepath.Join(repo, filepath.FromSlash(rel))); err != nil { + t.Fatalf("the scanned tree lacks %s, which holds an allowlisted call: %v", rel, err) + } + } cmd := exec.Command("bash", filepath.Join(repo, "scripts", "check-testing-short.sh")) cmd.Dir = repo out, err := cmd.CombinedOutput() diff --git a/scripts/check_winget_portable_alias_test.go b/scripts/check_winget_portable_alias_test.go index e69075fbc..8a52fcc79 100644 --- a/scripts/check_winget_portable_alias_test.go +++ b/scripts/check_winget_portable_alias_test.go @@ -10,16 +10,12 @@ import ( ) // The guard's own vocabulary is shared between mikefarah yq v4 and python-yq, -// so either flavour exercises these cases. Deliberately a plain skip rather -// than requireHostTool: //scripts:scripts_test is tagged host-tools, and that -// tag's declared inventory (git, python3, awk, sed, find, grep, timeout) does -// not include yq, so failing under Bazel would red the shared target on hosts -// that keep the promise the tag actually makes. +// so either flavour exercises these cases. Under Bazel yq is part of the +// executor inventory //scripts:scripts_test relies on (the rbe-west worker +// image and ubuntu-latest ship mikefarah yq v4), so a missing yq fails there. func skipWithoutYQ(t *testing.T) { t.Helper() - if _, err := exec.LookPath("yq"); err != nil { - t.Skipf("yq not available: %v", err) - } + requireHostTool(t, "yq") } const ( diff --git a/scripts/checkworkflowtags/BUILD.bazel b/scripts/checkworkflowtags/BUILD.bazel index 35e736649..1a80d8372 100644 --- a/scripts/checkworkflowtags/BUILD.bazel +++ b/scripts/checkworkflowtags/BUILD.bazel @@ -13,3 +13,25 @@ go_binary( embed = [":checkworkflowtags_lib"], visibility = ["//visibility:public"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/ci/allowlisted-go-tests.sh b/scripts/ci/allowlisted-go-tests.sh deleted file mode 100755 index dc3b32430..000000000 --- a/scripts/ci/allowlisted-go-tests.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# The Go tests the Bazel PR-core lane does not run or skips -# (tools/bazel/equivalence_allowlist.txt), under `go test` in PR Core's test -# environment. pr.yml runs this on every PR (scripts-go-checks): -# where PR Core stands down for the Bazel lane (D2 step 3) it is their only -# pre-merge run. - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# shellcheck source=../../.buildflags -source "$REPO_ROOT/.buildflags" -# shellcheck source=lib/test-env.sh -source "$REPO_ROOT/scripts/ci/lib/test-env.sh" - -cd "$REPO_ROOT" - -beads_test_env_enter - -# As in pr.yml's PR Core step. -export BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1 - -python3 tools/bazel/run_allowlisted_go_tests.py "$@" diff --git a/scripts/ci/scripts-go-test.sh b/scripts/ci/scripts-go-test.sh deleted file mode 100755 index 14b4a062b..000000000 --- a/scripts/ci/scripts-go-test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# PR Core's `go test`, for the ./scripts/... packages only: the repository -# policy tests (workflow, Bazel and CI guards), several of which check part of -# their rules, or everything, under go test only. pr.yml runs this on every PR -# (scripts-go-checks), so they run before merge also where PR Core stands -# down for the Bazel lane (D2 step 3). Same flags and environment as -# scripts/ci/pr-core.sh. - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# shellcheck source=../../.buildflags -source "$REPO_ROOT/.buildflags" -# shellcheck source=lib/timing.sh -source "$REPO_ROOT/scripts/ci/lib/timing.sh" -# shellcheck source=lib/test-env.sh -source "$REPO_ROOT/scripts/ci/lib/test-env.sh" - -cd "$REPO_ROOT" - -beads_test_env_enter - -ci_time "scripts go test" -- \ - go test -p 4 -parallel 4 -race -short -timeout=30m -skip '^TestEmbedded' ./scripts/... diff --git a/scripts/ci_f7b_review_test.go b/scripts/ci_f7b_review_test.go index 54df07b92..3346151e2 100644 --- a/scripts/ci_f7b_review_test.go +++ b/scripts/ci_f7b_review_test.go @@ -238,23 +238,22 @@ func TestBlacksmithSaverVenueAndFlavorMatricesAreComplete(t *testing.T) { // worse, hit a non-race-compiled cache under the race key). func TestBlacksmithGoBuildCacheRaceLegActuallyUsesRace(t *testing.T) { job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-go-build-cache") - step := job.step(t, "Warm race GOCACHE (scripts-go-checks scripts-test leg)") + step := job.step(t, "Warm race GOCACHE") if !strings.Contains(step.Run, "-race") { t.Errorf("blacksmith-go-build-cache's race-leg warm step run = %q, want it to pass -race", step.Run) } } -// TestBlacksmithGoBuildCacheNonRaceLegWarmsAllowlistedCompileOnly re-pins -// mutation M7: the non-race flavor's warm step must still invoke -// run_allowlisted_go_tests.py --compile-only (not just warm-non-race-cache.sh) -// -- scripts-go-checks' allowlisted leg's own packages, so the seed can never -// silently stop covering what that PR-blocking leg actually compiles. -func TestBlacksmithGoBuildCacheNonRaceLegWarmsAllowlistedCompileOnly(t *testing.T) { +// TestBlacksmithGoBuildCacheNonRaceLegWarmsPreflightPackages re-pins mutation +// M7: the non-race flavor's warm step must run the shared +// warm-non-race-cache.sh, so the same-repo-PR seed can never silently stop +// covering what pr-preflight-platforms' and check-doc-freshness-platforms' +// ubuntu legs compile. +func TestBlacksmithGoBuildCacheNonRaceLegWarmsPreflightPackages(t *testing.T) { job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-go-build-cache") - step := job.step(t, "Warm non-race GOCACHE (scripts-go-checks allowlisted leg + preflight/doc-freshness)") - if !strings.Contains(step.Run, "bash scripts/ci/warm-non-race-cache.sh") || - !strings.Contains(step.Run, "python3 tools/bazel/run_allowlisted_go_tests.py --compile-only") { - t.Errorf("blacksmith-go-build-cache's non-race-leg warm step run = %q, want both warm-non-race-cache.sh and run_allowlisted_go_tests.py --compile-only", step.Run) + step := job.step(t, "Warm non-race GOCACHE (preflight/doc-freshness)") + if step.Run != "bash scripts/ci/warm-non-race-cache.sh" { + t.Errorf("blacksmith-go-build-cache's non-race-leg warm step run = %q, want bash scripts/ci/warm-non-race-cache.sh", step.Run) } } @@ -292,47 +291,6 @@ func TestWindowsSaverAndLivenessTimeoutsAreTwentyMinutes(t *testing.T) { } } -// TestCompileOnlyUsesBuildFlagsConstant re-pins mutation M14 (N1 fix): the -// reviewer's original mutation flipped a fragile `GO_TEST_FLAGS[-2:]` slice -// in the --compile-only path to nothing, silently dropping the -// gms_pure_go build tag from every warmed test binary. N1 replaced the slice -// with an explicit BUILD_FLAGS constant reused by both GO_TEST_FLAGS and the -// --compile-only `go test -c` command directly, which structurally removes -// the slice-drift vector mutate.py's M14 exploited; this test pins that the -// constant still exists and is still the thing actually passed to `-c`, so a -// future edit cannot quietly reintroduce the same slicing fragility. -func TestCompileOnlyUsesBuildFlagsConstant(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - return // scripts_test's runfiles hold none of tools/bazel's scripts (see TestPRRunsGoTestsBazelSkips) - } - root := sourceRepoRoot(t) - data, err := os.ReadFile(filepath.Join(root, "tools", "bazel", "run_allowlisted_go_tests.py")) - if err != nil { - t.Fatal(err) - } - src := string(data) - const wantConst = `BUILD_FLAGS = ["-tags", "gms_pure_go"]` - if !strings.Contains(src, wantConst) { - t.Errorf("tools/bazel/run_allowlisted_go_tests.py is missing %q", wantConst) - } - const wantUse = `cmd = [args.go, "test", "-c", *BUILD_FLAGS, "-o", os.devnull, "./" + pkg]` - if !strings.Contains(src, wantUse) { - t.Errorf("tools/bazel/run_allowlisted_go_tests.py's --compile-only path does not pass *BUILD_FLAGS to go test -c (want %q)", wantUse) - } - // N1's bug was live slicing code (GO_TEST_FLAGS[-2:] used as part of the - // actual `-c` command), not the historical mention of it in BUILD_FLAGS' - // own doc comment above -- only flag the pattern outside a `#` comment line. - for _, line := range strings.Split(src, "\n") { - trimmed := strings.TrimSpace(line) - if strings.HasPrefix(trimmed, "#") { - continue - } - if strings.Contains(line, "GO_TEST_FLAGS[-2:]") || strings.Contains(line, "GO_TEST_FLAGS[-2]") { - t.Errorf("tools/bazel/run_allowlisted_go_tests.py must not reintroduce slicing GO_TEST_FLAGS to get the build tags (F7b review fix N1): %q", line) - } - } -} - // blacksmithMacOSPRLegJobs are pr.yml's mixed-OS matrix jobs whose macOS leg // runs on Blacksmith macOS for same-repo PRs/merge_group. var blacksmithMacOSPRLegJobs = []string{"pr-preflight-platforms", "check-doc-freshness-platforms"} diff --git a/scripts/ci_workflow_test.go b/scripts/ci_workflow_test.go index a0a32c51b..a812b12db 100644 --- a/scripts/ci_workflow_test.go +++ b/scripts/ci_workflow_test.go @@ -1377,10 +1377,9 @@ func TestGoCacheOwnershipTopology(t *testing.T) { assertGoCacheInventory(t, workflows["pr.yml"].job(t, "pr-core-wrapper"), []goCacheStep{ restoreModuleCache(), restoreBuildCache("race"), }) - // D2 step 3: PR Core's environment for ./scripts/..., go vet and the - // Bazel-skipped tests; read-only like PR Core. + // D2 step 3: PR Core's go vet; read-only like PR Core. assertGoCacheInventory(t, workflows["pr.yml"].job(t, "scripts-go-checks"), []goCacheStep{ - restoreModuleCache(), restoreBuildCacheIf("race", "matrix.check == 'scripts-test'"), restoreVetCache(), restoreBuildCacheIf("non-race", "matrix.check == 'allowlisted'"), + restoreModuleCache(), restoreVetCache(), }) assertGoCacheInventory(t, workflows["pr.yml"].job(t, "pr-lint-wrapper"), []goCacheStep{restoreModuleCache(), restoreGolangciCache()}) assertGoCacheInventory(t, workflows["pr.yml"].job(t, "worktree-remove-windows"), []goCacheStep{ @@ -4487,11 +4486,7 @@ func TestBazelDoltJobMirrorsContainerJobs(t *testing.T) { // dolt-server target. Every such target, checked on its own, picks the // local backend and fails closed, so a broken backend fails rather than // skipping into a cached pass; the ones whose TestMain owns a server also - // set the package's own REQUIRE switch. Only under go test: scripts_test's - // runfiles hold no other package's BUILD. - if os.Getenv("TEST_SRCDIR") != "" { - return - } + // set the package's own REQUIRE switch. root := sourceRepoRoot(t) for pkg, docker := range map[string]bool{ "internal/storage/domain": false, @@ -4686,18 +4681,9 @@ func bazelRuleBlock(build, name string) string { // bazelProxiedShardCount returns cmd/bd:bd_proxied_test's own shard_count // from cmd/bd/BUILD.bazel: the single source of truth for the Bazel-only // bazel-proxied lane's shard split, which no longer has to equal PR -// Risk's/main.yml's legacy test-proxied-cmd jobs' matrix size (F2). Under -// `bazel test`, scripts_test's runfiles hold no other package's BUILD file, -// so this falls back to the literal the structural checks below pin under -// plain `go test` (TestBazelDoltServerTiersMirrorPRRisk and -// TestBazelRetiredLanesCheckListedTestsRan both fail if cmd/bd/BUILD.bazel's -// shard_count ever drifts from this fallback). +// Risk's/main.yml's legacy test-proxied-cmd jobs' matrix size (F2). func bazelProxiedShardCount(t *testing.T) int { t.Helper() - const bazelTestFallback = 30 - if os.Getenv("TEST_SRCDIR") != "" { - return bazelTestFallback - } root := sourceRepoRoot(t) rule := bazelRuleBlock(readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "bd_proxied_test") m := regexp.MustCompile(`(?m)^ shard_count = (\d+),$`).FindStringSubmatch(rule) @@ -4936,9 +4922,6 @@ func TestBazelDoltServerTiersMirrorPRRisk(t *testing.T) { if step.Env[c.env] != "1" { t.Errorf("%s %s no longer sets %s=1; update %s:%s", c.workflow, c.job, c.env, c.pkg, c.target) } - if os.Getenv("TEST_SRCDIR") != "" { - continue // scripts_test's runfiles hold no other package's BUILD - } buildShards := shards root := sourceRepoRoot(t) rule := bazelRuleBlock(readPolicyFile(t, root, c.pkg+"/BUILD.bazel"), c.target) @@ -4985,37 +4968,35 @@ func TestBazelDoltServerTiersMirrorPRRisk(t *testing.T) { t.Fatalf("parsed %v from pr-risk.yml test-server-storage %q", wantArgs, conf) } - if os.Getenv("TEST_SRCDIR") == "" { - root := sourceRepoRoot(t) - doltBuild := readPolicyFile(t, root, "internal/storage/dolt/BUILD.bazel") - rule := bazelRuleBlock(doltBuild, "dolt_server_conformance_test") - for _, w := range append(wantArgs, `"$(rootpath :dolt_race_off)",`, `srcs = ["//tools/bazel:go_test_variant.sh"],`) { - if !strings.Contains(bazelAttrBlock(rule, "args")+rule, w) { - t.Errorf("dolt:dolt_server_conformance_test does not contain %q (pr-risk.yml test-server-storage):\n%s", w, rule) - } + root := sourceRepoRoot(t) + doltBuild := readPolicyFile(t, root, "internal/storage/dolt/BUILD.bazel") + rule := bazelRuleBlock(doltBuild, "dolt_server_conformance_test") + for _, w := range append(wantArgs, `"$(rootpath :dolt_race_off)",`, `srcs = ["//tools/bazel:go_test_variant.sh"],`) { + if !strings.Contains(bazelAttrBlock(rule, "args")+rule, w) { + t.Errorf("dolt:dolt_server_conformance_test does not contain %q (pr-risk.yml test-server-storage):\n%s", w, rule) } - if strings.Contains(rule, "BEADS_TEST_ENV_RUN_DOLT") { - t.Error("dolt:dolt_server_conformance_test sets BEADS_TEST_ENV_RUN_DOLT; test-server-storage does not") + } + if strings.Contains(rule, "BEADS_TEST_ENV_RUN_DOLT") { + t.Error("dolt:dolt_server_conformance_test sets BEADS_TEST_ENV_RUN_DOLT; test-server-storage does not") + } + if r := bazelRuleBlock(doltBuild, "dolt_race_off"); !strings.Contains(r, "go_test_race_off(") || !strings.Contains(r, `test = ":dolt_test",`) { + t.Errorf("dolt:dolt_race_off must be go_test_race_off of :dolt_test (the jobs' binary is not race):\n%s", r) + } + full := bazelRuleBlock(doltBuild, "dolt_server_full_test") + for _, w := range []string{`"$(rootpath :dolt_race_off)",`, `"BEADS_TEST_SUBPROCESS_BINARY": "$(rlocationpath :dolt_race_off)"`, `"//:go.mod",`} { + if !strings.Contains(full, w) { + t.Errorf("dolt:dolt_server_full_test lacks %q (SubprocessRunner reuses the test binary; ModuleRoot needs go.mod):\n%s", w, full) } - if r := bazelRuleBlock(doltBuild, "dolt_race_off"); !strings.Contains(r, "go_test_race_off(") || !strings.Contains(r, `test = ":dolt_test",`) { - t.Errorf("dolt:dolt_race_off must be go_test_race_off of :dolt_test (the jobs' binary is not race):\n%s", r) + } + proxied := bazelRuleBlock(readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "bd_proxied_test") + for _, w := range []string{`"$(rootpath :bd_test)",`, `"BEADS_TEST_BD_BINARY": "$(rlocationpath :bd_for_tests)"`} { + if !strings.Contains(proxied, w) { + t.Errorf("cmd/bd:bd_proxied_test lacks %q (race bd_test, non-race subprocess bd, like the jobs):\n%s", w, proxied) } - full := bazelRuleBlock(doltBuild, "dolt_server_full_test") - for _, w := range []string{`"$(rootpath :dolt_race_off)",`, `"BEADS_TEST_SUBPROCESS_BINARY": "$(rlocationpath :dolt_race_off)"`, `"//:go.mod",`} { - if !strings.Contains(full, w) { - t.Errorf("dolt:dolt_server_full_test lacks %q (SubprocessRunner reuses the test binary; ModuleRoot needs go.mod):\n%s", w, full) - } - } - proxied := bazelRuleBlock(readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "bd_proxied_test") - for _, w := range []string{`"$(rootpath :bd_test)",`, `"BEADS_TEST_BD_BINARY": "$(rlocationpath :bd_for_tests)"`} { - if !strings.Contains(proxied, w) { - t.Errorf("cmd/bd:bd_proxied_test lacks %q (race bd_test, non-race subprocess bd, like the jobs):\n%s", w, proxied) - } - } - for pkg, build := range map[string]string{"cmd/bd": readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "internal/storage/dolt": doltBuild} { - for _, err := range checkDoltServerRules(pkg, build) { - t.Error(err) - } + } + for pkg, build := range map[string]string{"cmd/bd": readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "internal/storage/dolt": doltBuild} { + for _, err := range checkDoltServerRules(pkg, build) { + t.Error(err) } } @@ -5193,9 +5174,6 @@ func TestBazelEmbeddedJobMirrorsEmbeddedTier(t *testing.T) { if step.Env["BEADS_TEST_EMBEDDED_DOLT"] != "1" { t.Errorf("pr-risk.yml %s no longer sets BEADS_TEST_EMBEDDED_DOLT=1; update %s", c.job, c.target) } - if os.Getenv("TEST_SRCDIR") != "" { - continue // scripts_test's runfiles hold no other package's BUILD - } root := sourceRepoRoot(t) rule := bazelRuleBlock(readPolicyFile(t, root, c.pkg+"/BUILD.bazel"), c.target) // c.target's own shard_count is deliberately NOT asserted to equal @@ -5242,13 +5220,11 @@ func TestBazelEmbeddedJobMirrorsEmbeddedTier(t *testing.T) { } } } - if os.Getenv("TEST_SRCDIR") == "" { - // The cmd jobs' subprocess bd is the race build, as //cmd/bd:bd is - // under --config=embedded (bd_for_tests never is). - rule := bazelRuleBlock(readPolicyFile(t, sourceRepoRoot(t), "cmd/bd/BUILD.bazel"), "bd_embedded_test") - if !strings.Contains(rule, `"BEADS_TEST_BD_BINARY": "$(rlocationpath :bd)"`) { - t.Errorf("cmd/bd:bd_embedded_test must run the race //cmd/bd:bd as BEADS_TEST_BD_BINARY:\n%s", rule) - } + // The cmd jobs' subprocess bd is the race build, as //cmd/bd:bd is + // under --config=embedded (bd_for_tests never is). + rule := bazelRuleBlock(readPolicyFile(t, sourceRepoRoot(t), "cmd/bd/BUILD.bazel"), "bd_embedded_test") + if !strings.Contains(rule, `"BEADS_TEST_BD_BINARY": "$(rlocationpath :bd)"`) { + t.Errorf("cmd/bd:bd_embedded_test must run the race //cmd/bd:bd as BEADS_TEST_BD_BINARY:\n%s", rule) } conformance := risk.job(t, "test-embedded-conformance") @@ -5281,9 +5257,6 @@ func TestBazelEmbeddedJobMirrorsEmbeddedTier(t *testing.T) { if len(want) < 4 { t.Fatalf("parsed only %v from pr-risk.yml %s conformance %q", want, partition, run) } - if os.Getenv("TEST_SRCDIR") != "" { - continue - } rule := bazelRuleBlock(readPolicyFile(t, sourceRepoRoot(t), "internal/storage/embeddeddolt/BUILD.bazel"), target) for _, w := range append(want, `"BEADS_TEST_EMBEDDED_DOLT": "1"`, `"embedded"`) { if !strings.Contains(rule, w) { @@ -5350,11 +5323,9 @@ func TestBazelPureJobMirrorsPureGoJob(t *testing.T) { t.Errorf("pure artifact start step does not contain %q:\n%s", required, start) } } - if os.Getenv("TEST_SRCDIR") == "" { - patch := readPolicyFile(t, sourceRepoRoot(t), "third_party/patches/gozstd_nocgo.patch") - if !strings.Contains(patch, "+func init() { panic(") { - t.Error("gozstd_nocgo.patch stubs no longer panic in init; a contaminated pure binary would start") - } + patch := readPolicyFile(t, sourceRepoRoot(t), "third_party/patches/gozstd_nocgo.patch") + if !strings.Contains(patch, "+func init() { panic(") { + t.Error("gozstd_nocgo.patch stubs no longer panic in init; a contaminated pure binary would start") } prWasm := pr.step(t, "Run js/wasm hook boundary").Run @@ -6568,9 +6539,6 @@ func TestReleaseWorkflowRestoresNoCache(t *testing.T) { // BUILD file or macro may mark a target flaky = True (Bazel retries those up // to three times by default). func TestBazelGatedLanesNeverRetryFlakyTests(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold no other package's BUILD files") - } root := sourceRepoRoot(t) retry := regexp.MustCompile(`flaky_test_attempts|runs_per_test_detects_flakes`) // Any flaky = other than a literal False/0 (a variable or macro @@ -6590,7 +6558,7 @@ func TestBazelGatedLanesNeverRetryFlakyTests(t *testing.T) { } return nil } - if d.Type()&os.ModeSymlink != 0 { + if !isFileOrFileLink(path, d) { return nil // bazel-* convenience symlinks } base := d.Name() @@ -6622,7 +6590,8 @@ func TestBazelGatedLanesNeverRetryFlakyTests(t *testing.T) { if err != nil { t.Fatal(err) } - if checked < 10 { + // Every BUILD file: a walk that sees fewer is not looking at the tree. + if checked < 100 { t.Fatalf("checked only %d files; is the repository root right?", checked) } } @@ -6724,9 +6693,6 @@ func TestBazelCmdDoltJob(t *testing.T) { // The target: the dolt-server rules (local backend, fail closed, remote), // the integration build's bd_test with no test selection, every env // bd_test's own go_test sets, and the 4-vCPU runner shape. - if os.Getenv("TEST_SRCDIR") != "" { - return // scripts_test's runfiles hold no other package's BUILD - } build := readPolicyFile(t, sourceRepoRoot(t), "cmd/bd/BUILD.bazel") var rule, bdTest string for _, r := range bazelTopRules(stripStarlarkComments(build)) { diff --git a/scripts/embedded_shard_count_test.go b/scripts/embedded_shard_count_test.go index ebe26c5b4..3af9b1469 100644 --- a/scripts/embedded_shard_count_test.go +++ b/scripts/embedded_shard_count_test.go @@ -1,7 +1,6 @@ package scripts_test import ( - "os" "os/exec" "regexp" "strconv" @@ -20,17 +19,9 @@ var shardCountPattern = regexp.MustCompile(`(?m)^ shard_count = (\d+),$`) // longer has to equal PR Risk's/main.yml's legacy "Test (Embedded Dolt Cmd // N/20)" fork/push jobs' matrix size — mirrors bazelProxiedShardCount (F2; // see that function's doc comment in scripts/ci_workflow_test.go for the -// shared rationale, not repeated here). Under `bazel test`, scripts_test's -// runfiles hold no other package's BUILD file, so this falls back to the -// literal TestBazelRetiredLanesCheckListedTestsRan pins under plain `go -// test` for //cmd/bd:bd_embedded_test; that test fails if cmd/bd/BUILD.bazel's -// shard_count ever drifts from this fallback. +// shared rationale, not repeated here). func bazelEmbeddedCmdShardCount(t *testing.T) int { t.Helper() - const bazelTestFallback = 50 - if os.Getenv("TEST_SRCDIR") != "" { - return bazelTestFallback - } root := sourceRepoRoot(t) rule := bazelRuleBlock(readPolicyFile(t, root, "cmd/bd/BUILD.bazel"), "bd_embedded_test") m := shardCountPattern.FindStringSubmatch(rule) @@ -53,10 +44,6 @@ func bazelEmbeddedCmdShardCount(t *testing.T) int { // bazelEmbeddedCmdShardCount above; see its doc comment. func bazelEmbeddedStorageShardCount(t *testing.T) int { t.Helper() - const bazelTestFallback = 15 - if os.Getenv("TEST_SRCDIR") != "" { - return bazelTestFallback - } root := sourceRepoRoot(t) rule := bazelRuleBlock(readPolicyFile(t, root, "internal/storage/embeddeddolt/BUILD.bazel"), "embeddeddolt_embedded_test") m := shardCountPattern.FindStringSubmatch(rule) @@ -86,13 +73,7 @@ func bazelEmbeddedStorageShardCount(t *testing.T) int { // expected to report "missing" entries by design (see those generators' // module docstrings) and is not what this test runs. func TestCmdEmbeddedShardManifestGeneratorNotStale(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold neither the generator's sources nor cmd/bd") - } - python, err := exec.LookPath("python3") - if err != nil { - t.Skip("python3 not available") - } + python := requireHostTool(t, "python3") root := sourceRepoRoot(t) shards := strconv.Itoa(bazelEmbeddedCmdShardCount(t)) cmd := exec.Command(python, "scripts/ci/gen_embedded_cmd_shard_manifest.py", shards, "--weights=duration", "--check") @@ -106,13 +87,7 @@ func TestCmdEmbeddedShardManifestGeneratorNotStale(t *testing.T) { // TestCmdEmbeddedShardManifestGeneratorNotStale above for the storage tier's // Bazel-only 15-shard block; see that test's doc comment. func TestStorageEmbeddedShardManifestGeneratorNotStale(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold neither the generator's sources nor cmd/bd") - } - python, err := exec.LookPath("python3") - if err != nil { - t.Skip("python3 not available") - } + python := requireHostTool(t, "python3") root := sourceRepoRoot(t) shards := strconv.Itoa(bazelEmbeddedStorageShardCount(t)) cmd := exec.Command(python, "scripts/ci/gen_embedded_storage_shard_manifest.py", shards, "--weights=duration", "--check") diff --git a/scripts/gitattributespolicy/BUILD.bazel b/scripts/gitattributespolicy/BUILD.bazel index 20f299fff..cfe8b8098 100644 --- a/scripts/gitattributespolicy/BUILD.bazel +++ b/scripts/gitattributespolicy/BUILD.bazel @@ -9,3 +9,25 @@ go_test( ], data = ["//:.gitattributes"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/host_tools_test.go b/scripts/host_tools_test.go index 76b0874d3..0c498194b 100644 --- a/scripts/host_tools_test.go +++ b/scripts/host_tools_test.go @@ -9,13 +9,13 @@ import ( // skipOrFailWithoutHostTool handles a missing host tool. Under go test the // test skips, as it always has. Under Bazel it fails: //scripts:scripts_test -// is tagged host-tools, which promises git, python3, bash and friends on the -// host that runs it, so a skip there would hide a host that breaks that promise -// behind a green result. +// relies on the executor's bash, git, python3 and friends (the rbe-west +// worker image, or the runner in fork-cache mode), so a skip there would +// hide an executor that lacks one behind a green, cacheable result. func skipOrFailWithoutHostTool(t *testing.T, format string, args ...any) { t.Helper() if bazeltest.IsBazel() { - t.Fatalf("host-tools target: "+format, args...) + t.Fatalf("executor lacks a host tool: "+format, args...) } t.Skipf(format, args...) } @@ -30,3 +30,18 @@ func requireHostTool(t *testing.T, name string) string { } return path } + +// testGo returns the go binary to run. Under Bazel that is the registered Go +// SDK (BUILD data, BEADS_TEST_GO), which is go.mod's toolchain: the go on the +// executor's PATH may be another release. +func testGo(t *testing.T) string { + t.Helper() + if bazeltest.IsBazel() { + path, err := bazeltest.RunfileEnv("BEADS_TEST_GO") + if err != nil { + t.Fatal(err) + } + return path + } + return requireHostTool(t, "go") +} diff --git a/scripts/internal/testbash/BUILD.bazel b/scripts/internal/testbash/BUILD.bazel index 8b8ebdb72..3e1ed3c72 100644 --- a/scripts/internal/testbash/BUILD.bazel +++ b/scripts/internal/testbash/BUILD.bazel @@ -20,3 +20,25 @@ go_test( ], embed = [":testbash"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/migration-test/catalog/BUILD.bazel b/scripts/migration-test/catalog/BUILD.bazel index 32d105fe8..70e66d75a 100644 --- a/scripts/migration-test/catalog/BUILD.bazel +++ b/scripts/migration-test/catalog/BUILD.bazel @@ -19,3 +19,25 @@ go_test( data = ["//scripts:migration-test/release-catalog.json"], embed = [":catalog_lib"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/pr-lint/BUILD.bazel b/scripts/pr-lint/BUILD.bazel index 86bf04c89..906740444 100644 --- a/scripts/pr-lint/BUILD.bazel +++ b/scripts/pr-lint/BUILD.bazel @@ -20,3 +20,25 @@ go_test( embed = [":pr-lint_lib"], deps = ["//internal/testutil/bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/pr_lanes_bazel_coverage_test.go b/scripts/pr_lanes_bazel_coverage_test.go index fedfccbcb..8abcbb6c6 100644 --- a/scripts/pr_lanes_bazel_coverage_test.go +++ b/scripts/pr_lanes_bazel_coverage_test.go @@ -21,15 +21,13 @@ import ( // TestPRRiskDecisionMatchesBazelMode). Everything the retired jobs did // besides those tests keeps running on every PR: the package gates take the // Bazel-built bd, the Dolt server fingerprint has its own job, and -// scripts-go-checks runs `go test ./scripts/...`, go test's vet checks and -// the Go tests the Bazel lane does not run or skips (equivalence allowlist). +// scripts-go-checks runs go test's vet checks. const ( // The legacy jobs' if: not covered. prLaneLegacyIf = "needs." + prRiskCoverageJobName + ".outputs.pr_lanes != 'true'" prFingerprintJob = "test-dolt-server-fingerprint" prFingerprintID = "TEST_DOLT_SERVER_FINGERPRINT" - prAllowlistedStep = "Run the Go tests the Bazel lane skips" prScriptsChecksJob = "scripts-go-checks" prScriptsChecksID = "SCRIPTS_GO_CHECKS" // bazel.yml's lanes for the step add --config=sole-run whenever they @@ -592,12 +590,12 @@ func TestPRDoltServerFingerprintRunsOnEveryPR(t *testing.T) { } } -// PR Core's duties the Bazel lanes do not take over run on every PR, in -// pr.yml's required scripts-go-checks job (PR Core's environment): `go test -// ./scripts/...` with PR Core's flags (the policy tests, some of which check -// part or all of their rules under go test only), go test's vet checks over -// ./... (rules_go's go_test runs none), and the Go tests Bazel does not run -// or skips (tools/bazel/equivalence_allowlist.txt), each required to pass. +// PR Core's one duty the Bazel lanes do not take over runs on every PR, in +// pr.yml's required scripts-go-checks job: go test's vet checks over ./... +// (rules_go's go_test runs none). The repository policy tests and the Go +// tests that walk the checkout run under Bazel (//scripts:scripts_test and +// //test/docsync over //:repo_files), so no workflow runs `go test` over +// ./scripts/... or the equivalence allowlist any more. func TestPRRunsGoTestsBazelSkips(t *testing.T) { pr := readCIWorkflow(t, "pr.yml") job := pr.job(t, prScriptsChecksJob) @@ -607,12 +605,7 @@ func TestPRRunsGoTestsBazelSkips(t *testing.T) { t.Errorf("%s: if %q, continue-on-error %v, needs %v, runs-on %q, timeout %d; want an unconditional same-repo-Blacksmith job with a timeout", prScriptsChecksJob, job.If, job.ContinueOnError, job.Needs, job.RunsOn, job.TimeoutMinutes) } - // F5.3: three legs behind matrix.check, not fail-fast (a vet regression - // must not hide an allowlisted regression, or vice versa). - if job.Strategy.FailFast { - t.Errorf("%s strategy.fail-fast = true, want false", prScriptsChecksJob) - } - if want := []string{"scripts-test", "vet", "allowlisted"}; !equalStrings(job.Strategy.Matrix.Check, want) { + if want := []string{"vet"}; !equalStrings(job.Strategy.Matrix.Check, want) { t.Errorf("%s matrix.check = %v, want %v", prScriptsChecksJob, job.Strategy.Matrix.Check, want) } var names []string @@ -622,50 +615,14 @@ func TestPRRunsGoTestsBazelSkips(t *testing.T) { t.Errorf("%s step %q has continue-on-error", prScriptsChecksJob, st.Name) } } - wantNames := []string{"", "Set up Go", "Restore Go module cache", "Restore race Go build cache", "Restore vet Go build cache", - "Restore non-race Go build cache", "Install Dolt", "Configure Git and Dolt identity", "Go test the scripts packages", - "Go vet with go test's checks", prAllowlistedStep} + wantNames := []string{"", "Set up Go", "Restore Go module cache", "Restore vet Go build cache", "Go vet with go test's checks"} if !reflect.DeepEqual(names, wantNames) { t.Errorf("%s steps %q, want %q", prScriptsChecksJob, names, wantNames) } - // The environment PR Core's job gives its go test (the race leg's cache - // restore and Dolt setup stay byte-for-byte the same as pr-core-wrapper's). - core := pr.job(t, "pr-core-wrapper") - for _, name := range []string{"Install Dolt", "Configure Git and Dolt identity", "Restore race Go build cache"} { - if got, want := job.step(t, name), core.step(t, name); got.Run != want.Run || !reflect.DeepEqual(got.With, want.With) || got.Uses != want.Uses { - t.Errorf("%s step %q differs from pr-core-wrapper's", prScriptsChecksJob, name) - } - } - legIf := func(checks ...string) string { - parts := make([]string, len(checks)) - for i, c := range checks { - parts[i] = "matrix.check == '" + c + "'" - } - return strings.Join(parts, " || ") - } - // Dolt is only needed by the legs that use it; the vet leg skips it. - for _, name := range []string{"Install Dolt", "Configure Git and Dolt identity"} { - if got, want := job.step(t, name).If, legIf("scripts-test", "allowlisted"); got != want { - t.Errorf("%s step %q if = %q, want %q", prScriptsChecksJob, name, got, want) - } - } - for name, want := range map[string]struct { - run, ifc string - env map[string]string - }{ - "Go test the scripts packages": {"bash scripts/ci/scripts-go-test.sh", legIf("scripts-test"), map[string]string{ - "BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION": "1", "GOCACHE": "${{ runner.temp }}/go-cache/race"}}, - "Go vet with go test's checks": {"bash scripts/ci/go-test-vet.sh", - "${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'vet' }}", - map[string]string{"GOCACHE": "${{ runner.temp }}/go-cache/vet"}}, - prAllowlistedStep: {"bash scripts/ci/allowlisted-go-tests.sh", - "${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'allowlisted' }}", - map[string]string{"GOCACHE": "${{ runner.temp }}/go-cache/non-race"}}, - } { - st := job.step(t, name) - if st.Run != want.run || st.If != want.ifc || st.Shell != "" || (len(st.Env) != 0 || len(want.env) != 0) && !reflect.DeepEqual(st.Env, want.env) { - t.Errorf("%s step %q: run %q, if %q, shell %q, env %v; want run %q, if %q, env %v", prScriptsChecksJob, name, st.Run, st.If, st.Shell, st.Env, want.run, want.ifc, want.env) - } + st := job.step(t, "Go vet with go test's checks") + if want := "bash scripts/ci/go-test-vet.sh"; st.Run != want || st.If != "${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'vet' }}" || + !reflect.DeepEqual(st.Env, map[string]string{"GOCACHE": "${{ runner.temp }}/go-cache/vet"}) { + t.Errorf("%s vet step: run %q, if %q, env %v", prScriptsChecksJob, st.Run, st.If, st.Env) } gate := pr.job(t, "ci-gate") env := gate.step(t, "Evaluate CI gate").Env @@ -673,109 +630,88 @@ func TestPRRunsGoTestsBazelSkips(t *testing.T) { !contains(strings.Fields(env["CI_GATE_REQUIRED"]), prScriptsChecksID) { t.Errorf("ci-gate does not require %s", prScriptsChecksID) } - // Nothing else in pr.yml runs these (one place to look). + // Nothing else in pr.yml runs go-test-vet.sh, and no workflow brings back + // a go test of the scripts packages or of the allowlist (they run under + // Bazel). for name, j := range pr.Jobs { for _, st := range j.Steps { - for _, script := range []string{"allowlisted-go-tests.sh", "scripts-go-test.sh", "go-test-vet.sh"} { - if strings.Contains(st.Run, script) && name != prScriptsChecksJob { - t.Errorf("%s step %q runs %s; only %s does", name, st.Name, script, prScriptsChecksJob) + if strings.Contains(st.Run, "go-test-vet.sh") && name != prScriptsChecksJob { + t.Errorf("%s step %q runs go-test-vet.sh; only %s does", name, st.Name, prScriptsChecksJob) + } + } + } + retired := regexp.MustCompile(`allowlisted-go-tests\.sh|scripts-go-test\.sh|run_allowlisted_go_tests\.py|go test[^\n]* \./scripts/\.\.\.`) + for _, wf := range []string{"pr.yml", "main.yml", "nightly.yml", "pr-risk.yml", bazelWorkflowName} { + for name, j := range readCIWorkflow(t, wf).Jobs { + for _, st := range j.Steps { + // A compile-only cache warm (-run '^$') runs no test. + if m := retired.FindString(st.Run); m != "" && !strings.Contains(m, "-run '^$'") { + t.Errorf("%s %s step %q runs %q; the scripts packages and the allowlisted tests run under Bazel", wf, name, st.Name, m) } } } } // main.yml's push-only go-vet-cache job (F5.3) is the one explicit // exception: it warms the vet cache pr.yml's vet leg restores, and - // nothing else in main.yml may run these scripts either. + // nothing else in main.yml may run go-test-vet.sh either. for name, j := range readCIWorkflow(t, "main.yml").Jobs { for _, st := range j.Steps { - for _, script := range []string{"allowlisted-go-tests.sh", "scripts-go-test.sh", "go-test-vet.sh"} { - if strings.Contains(st.Run, script) && name != "go-vet-cache" { - t.Errorf("main.yml %s step %q runs %s; only go-vet-cache may (go-test-vet.sh)", name, st.Name, script) - } + if strings.Contains(st.Run, "go-test-vet.sh") && name != "go-vet-cache" { + t.Errorf("main.yml %s step %q runs go-test-vet.sh; only go-vet-cache may", name, st.Name) } } } if got := readCIWorkflow(t, "main.yml").job(t, "go-vet-cache").step(t, "Go vet with go test's checks").Run; got != "bash scripts/ci/go-test-vet.sh" { t.Errorf("main.yml go-vet-cache does not run go-test-vet.sh: %q", got) } - if os.Getenv("TEST_SRCDIR") != "" { - return // scripts_test's runfiles hold none of the scripts (this part runs in that job itself) - } root := sourceRepoRoot(t) + for _, gone := range []string{"scripts/ci/allowlisted-go-tests.sh", "scripts/ci/scripts-go-test.sh", "tools/bazel/run_allowlisted_go_tests.py"} { + if _, err := os.Stat(filepath.Join(root, filepath.FromSlash(gone))); err == nil { + t.Errorf("%s is back; the tests it ran under go test run under Bazel", gone) + } + } prelude := []string{ "set -euo pipefail", `SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"`, `REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"`, `source "$REPO_ROOT/.buildflags"`, + `source "$REPO_ROOT/scripts/ci/lib/timing.sh"`, + `cd "$REPO_ROOT"`, + "GO_TEST_VET_FLAGS=(" + strings.Join(goTestDefaultVetFlags(t), " ") + ")", + `ci_time "go vet (go test's checks)" -- \`, + `go vet -tags gms_pure_go "${GO_TEST_VET_FLAGS[@]}" ./...`, } - for script, rest := range map[string][]string{ - "scripts/ci/allowlisted-go-tests.sh": { - `source "$REPO_ROOT/scripts/ci/lib/test-env.sh"`, - `cd "$REPO_ROOT"`, - "beads_test_env_enter", - "export BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1", - `python3 tools/bazel/run_allowlisted_go_tests.py "$@"`, - }, - "scripts/ci/scripts-go-test.sh": { - `source "$REPO_ROOT/scripts/ci/lib/timing.sh"`, - `source "$REPO_ROOT/scripts/ci/lib/test-env.sh"`, - `cd "$REPO_ROOT"`, - "beads_test_env_enter", - `ci_time "scripts go test" -- \`, - `go test -p 4 -parallel 4 -race -short -timeout=30m -skip '^TestEmbedded' ./scripts/...`, - }, - "scripts/ci/go-test-vet.sh": { - `source "$REPO_ROOT/scripts/ci/lib/timing.sh"`, - `cd "$REPO_ROOT"`, - "GO_TEST_VET_FLAGS=(" + strings.Join(goTestDefaultVetFlags(t), " ") + ")", - `ci_time "go vet (go test's checks)" -- \`, - `go vet -tags gms_pure_go "${GO_TEST_VET_FLAGS[@]}" ./...`, - }, - } { - var code []string - for _, line := range strings.Split(readPolicyFile(t, root, script), "\n") { - if l := strings.TrimSpace(line); l != "" && !strings.HasPrefix(l, "#") { - code = append(code, l) - } - } - if want := append(append([]string{}, prelude...), rest...); !reflect.DeepEqual(code, want) { - t.Errorf("%s code changed:\n%s\nwant:\n%s", script, strings.Join(code, "\n"), strings.Join(want, "\n")) + var code []string + for _, line := range strings.Split(readPolicyFile(t, root, "scripts/ci/go-test-vet.sh"), "\n") { + if l := strings.TrimSpace(line); l != "" && !strings.HasPrefix(l, "#") { + code = append(code, l) } } - // PR Core's own test command: the scripts step must keep its flags. - if core := readPolicyFile(t, root, "scripts/ci/pr-core.sh"); !strings.Contains(core, - `go_test -p "$GO_TEST_PKG_PARALLEL" -parallel "$GO_TEST_PARALLEL" -race -short -timeout=30m -skip '^TestEmbedded' ./...`) { - t.Errorf("scripts/ci/pr-core.sh's go test changed; keep scripts/ci/scripts-go-test.sh's flags equal to it") - } - - // The real allowlist plans: every entry maps to a package go test runs. - python := requireHostTool(t, "python3") - runner := filepath.Join(root, "tools", "bazel", "run_allowlisted_go_tests.py") - out, err := exec.Command(python, runner, "--dry-run").CombinedOutput() - if err != nil { - t.Fatalf("dry run of the real allowlist: %v\n%s", err, out) + if !reflect.DeepEqual(code, prelude) { + t.Errorf("scripts/ci/go-test-vet.sh code changed:\n%s\nwant:\n%s", strings.Join(code, "\n"), strings.Join(prelude, "\n")) } + // The allowlist's remaining skip entries run in pr-preflight-platforms + // (every OS), each named in its go test selector. + fallback := pr.job(t, "pr-preflight-platforms").step(t, "Exercise go test's bd build fallback").Run for _, line := range strings.Split(readPolicyFile(t, root, "tools/bazel/equivalence_allowlist.txt"), "\n") { body, _, _ := strings.Cut(line, "#") f := strings.Fields(body) if len(f) == 0 { continue } - if !strings.Contains(string(out), " ./"+f[0]+"\n") { - t.Errorf("allowlist entry %q: no go test of ./%s planned:\n%s", line, f[0], out) - } - if f[1] != "*" && !strings.Contains(string(out), regexp.QuoteMeta(strings.TrimSuffix(f[1], "*"))) { - t.Errorf("allowlist entry %q: not selected:\n%s", line, out) + if len(f) != 3 || f[0] != "cmd/bd" || f[2] != "skip" || !strings.Contains(fallback, f[1]) || !strings.HasSuffix(fallback, " ./cmd/bd") { + t.Errorf("allowlist entry %q is not a cmd/bd skip run by pr-preflight-platforms' bd build fallback step (%q)", line, fallback) } } } -// goTestDefaultVetFlags: the vet checks the Go toolchain running this test -// gives `go test` (cmd/go's defaultVetFlags), read from its source, so a Go -// upgrade that changes them fails here until go-test-vet.sh follows. +// goTestDefaultVetFlags: the vet checks go.mod's Go toolchain gives `go test` +// (cmd/go's defaultVetFlags), read from its source, so a Go upgrade that +// changes them fails here until go-test-vet.sh follows. Under Bazel the +// toolchain is the registered SDK (testGo). func goTestDefaultVetFlags(t *testing.T) []string { t.Helper() - goroot, err := exec.Command(requireHostTool(t, "go"), "env", "GOROOT").Output() + goroot, err := exec.Command(testGo(t), "env", "GOROOT").Output() if err != nil { t.Fatal(err) } @@ -801,92 +737,6 @@ func goTestDefaultVetFlags(t *testing.T) []string { return flags } -// run_allowlisted_go_tests.py on a synthetic allowlist and a fake go that -// reports given results: every entry must match a test that ran and passed. -func TestRunAllowlistedGoTestsScript(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold no tools/bazel Python") - } - requireHostTool(t, "bash") - python := requireHostTool(t, "python3") - runner := filepath.Join(sourceRepoRoot(t), "tools", "bazel", "run_allowlisted_go_tests.py") - dir := t.TempDir() - fakeGo := filepath.Join(dir, "go") - // Emits one top-level event per FAKE_="Test:action ..." pair and - // records its arguments; exits FAKE_RC. - if err := os.WriteFile(fakeGo, []byte(`#!/usr/bin/env bash -echo "$*" >> "$FAKE_LOG" -pkg="${!#}"; key="FAKE_$(printf '%s' "${pkg#./}" | tr -c 'A-Za-z0-9' '_')" -for pair in ${!key}; do - printf '{"Action":"%s","Package":"x","Test":"%s"}\n' "${pair#*:}" "${pair%%:*}" -done -exit "${FAKE_RC:-0}" -`), 0o755); err != nil { - t.Fatal(err) - } - allow := filepath.Join(dir, "allow.txt") - if err := os.WriteFile(allow, []byte(`# comment -cmd/bd TestZZStdioNotLeaked skip # needs its baseline -scripts TestA skip # why -scripts TestGlob* skip # why -`), 0o644); err != nil { - t.Fatal(err) - } - run := func(env ...string) (string, error) { - log := filepath.Join(dir, "log") - _ = os.Remove(log) - cmd := exec.Command(python, runner, "--allowlist", allow, "--go", fakeGo) - cmd.Env = append(os.Environ(), append([]string{"FAKE_LOG=" + log}, env...)...) - out, err := cmd.CombinedOutput() - args, _ := os.ReadFile(log) - return string(out) + "\nARGS:\n" + string(args), err - } - good := []string{ - "FAKE_cmd_bd=TestAAAStdioBaseline:pass TestZZStdioNotLeaked:pass", - "FAKE_scripts=TestA:pass TestGlobOne:pass TestGlobTwo:pass", - } - out, err := run(good...) - if err != nil { - t.Fatalf("all passed: %v\n%s", err, out) - } - for _, want := range []string{ - "-run ^(TestAAAStdioBaseline|TestZZStdioNotLeaked)$ ./cmd/bd", - "-run ^(TestA|TestGlob.*)$ ./scripts", - "test -json -short -count=1 -timeout=30m -skip ^TestEmbedded -tags gms_pure_go", - } { - if !strings.Contains(out, want) { - t.Errorf("go invocations lack %q:\n%s", want, out) - } - } - for name, env := range map[string][]string{ - "entry skipped": {good[0], "FAKE_scripts=TestA:skip TestGlobOne:pass"}, - "glob member skipped": {good[0], "FAKE_scripts=TestA:pass TestGlobOne:pass TestGlobTwo:skip"}, - "entry missing": {good[0], "FAKE_scripts=TestGlobOne:pass"}, - "glob matched none": {good[0], "FAKE_scripts=TestA:pass"}, - "companion only": {"FAKE_cmd_bd=TestAAAStdioBaseline:pass", good[1]}, - "other test failed": {good[0], good[1] + " TestOther:fail"}, - "go test failed": append([]string{"FAKE_RC=1"}, good...), - "package not run": {good[1]}, - } { - if out, err := run(env...); err == nil { - t.Errorf("%s: runner passed:\n%s", name, out) - } - } - // Entries it cannot run. - for name, body := range map[string]string{ - "package glob": "cmd/* TestX skip # why\n", - "bad name": "scripts Test(X) skip # why\n", - "no reason": "scripts TestX skip\n", - } { - if err := os.WriteFile(allow, []byte(body), 0o644); err != nil { - t.Fatal(err) - } - if out, err := run(good...); err == nil { - t.Errorf("%s: runner accepted the allowlist:\n%s", name, out) - } - } -} - // bazel.yml's step-3 lanes: in mode remote (always, on covered PRs) every // `bazel test` adds --config=sole-run, whose lines are exactly no cached // test results and no whole-invocation retry after a remote cache eviction; diff --git a/scripts/pr_risk_bazel_coverage_test.go b/scripts/pr_risk_bazel_coverage_test.go index 90106e551..0fc4c84e8 100644 --- a/scripts/pr_risk_bazel_coverage_test.go +++ b/scripts/pr_risk_bazel_coverage_test.go @@ -1204,9 +1204,6 @@ func TestBazelRetiredLanesCheckListedTestsRan(t *testing.T) { // check_shard_coverage.py itself, on a synthetic BEP, test.xml files and // shard script. func TestCheckShardCoverageScript(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold no tools/bazel Python") - } requireHostTool(t, "bash") python := requireHostTool(t, "python3") script := filepath.Join(sourceRepoRoot(t), "tools", "bazel", "check_shard_coverage.py") @@ -1371,9 +1368,6 @@ esac // must really not be a test (TestMain takes *testing.M). Otherwise the // checker reports a listed test that "did not run" on every real run. func TestShardScriptsListOnlyRealTests(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold neither the shard scripts' sources nor tools/bazel") - } // The CI shard scripts use bash 4 associative arrays (Linux runners only). requireAutofixBash(t) root := sourceRepoRoot(t) @@ -1550,13 +1544,7 @@ func TestShardScriptsListOnlyRealTests(t *testing.T) { // .github/scripts/proxied-cmd-test-shards.txt and engdocs/TESTING.md), so a // --check against it would always fail by design. func TestProxiedShardManifestGeneratorNotStale(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold neither the generator's sources nor cmd/bd") - } - python, err := exec.LookPath("python3") - if err != nil { - t.Skip("python3 not available") - } + python := requireHostTool(t, "python3") root := sourceRepoRoot(t) cmd := exec.Command(python, "scripts/ci/gen_proxied_shard_manifest.py", "30", "--weights=duration", "--check") cmd.Dir = root @@ -1666,49 +1654,39 @@ func TestBazelRetiredLanesCannotBeNarrowed(t *testing.T) { // Committed rc files: only .bazelrc. .bazelrc.local and user.bazelrc are // developer-local (gitignored) and would be try-imported into CI runs. - if os.Getenv("TEST_SRCDIR") == "" { - if git, err := exec.LookPath("git"); err == nil { - out, err := exec.Command(git, "-C", root, "ls-files").Output() - if err != nil { - t.Fatal(err) - } - for _, f := range strings.Split(strings.TrimSpace(string(out)), "\n") { - base := filepath.Base(f) - if strings.Contains(base, "bazelrc") && f != ".bazelrc" && f != setupBazelActionDir+"/write-bazelrc.sh" { - t.Errorf("committed rc file %s: .bazelrc's try-import would load it into every CI run", f) - } - } + for _, f := range repoFiles(t, root) { + base := filepath.Base(f) + if strings.Contains(base, "bazelrc") && f != ".bazelrc" && f != setupBazelActionDir+"/write-bazelrc.sh" { + t.Errorf("committed rc file %s: .bazelrc's try-import would load it into every CI run", f) } } // The scripts every lane's test runs under or through, and the whole // setup-bazel action (its generated rc applies to every command). - if os.Getenv("TEST_SRCDIR") == "" { - scriptNarrow := regexp.MustCompile(`-test\.(short|run|skip|list|bench)|BEADS_TEST_SKIP|BEADS_TEST_EMBEDDED_DOLT|BEADS_TEST_PROXIED_SERVER|BEADS_TEST_ENV_RUN_DOLT|BEADS_TEST_REQUIRE_DOLT_CONTAINER|BEADS_TEST_DOLT_SERVER\b|TESTBRIDGE_TEST_ONLY|test_filter|test_arg|_filters\b|cache_test_results|eviction_retries|flaky|runs_per_test|test_sharding_strategy`) - files, _ := filepath.Glob(filepath.Join(root, "tools", "bazel", "*.sh")) - action, _ := filepath.Glob(filepath.Join(root, setupBazelActionDir, "*")) - files = append(files, action...) - if len(files) < 5 { - t.Fatalf("found only %v", files) + scriptNarrow := regexp.MustCompile(`-test\.(short|run|skip|list|bench)|BEADS_TEST_SKIP|BEADS_TEST_EMBEDDED_DOLT|BEADS_TEST_PROXIED_SERVER|BEADS_TEST_ENV_RUN_DOLT|BEADS_TEST_REQUIRE_DOLT_CONTAINER|BEADS_TEST_DOLT_SERVER\b|TESTBRIDGE_TEST_ONLY|test_filter|test_arg|_filters\b|cache_test_results|eviction_retries|flaky|runs_per_test|test_sharding_strategy`) + files, _ := filepath.Glob(filepath.Join(root, "tools", "bazel", "*.sh")) + action, _ := filepath.Glob(filepath.Join(root, setupBazelActionDir, "*")) + files = append(files, action...) + if len(files) < 5 { + t.Fatalf("found only %v", files) + } + for _, f := range files { + rel, _ := filepath.Rel(root, f) + data, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) } - for _, f := range files { - rel, _ := filepath.Rel(root, f) - data, err := os.ReadFile(f) - if err != nil { - t.Fatal(err) + for i, line := range strings.Split(string(data), "\n") { + code := strings.TrimSpace(line) + if strings.HasPrefix(code, "#") { + continue } - for i, line := range strings.Split(string(data), "\n") { - code := strings.TrimSpace(line) - if strings.HasPrefix(code, "#") { - continue - } - if scriptNarrow.MatchString(code) { - t.Errorf("%s:%d %q can select, skip or re-run the retired tiers' lanes' tests", rel, i+1, code) - } - for _, m := range regexp.MustCompile(`--config=([A-Za-z0-9_-]+)`).FindAllStringSubmatch(code, -1) { - if !rcEnabled[m[1]] { - t.Errorf("%s:%d enables --config=%s for every command", rel, i+1, m[1]) - } + if scriptNarrow.MatchString(code) { + t.Errorf("%s:%d %q can select, skip or re-run the retired tiers' lanes' tests", rel, i+1, code) + } + for _, m := range regexp.MustCompile(`--config=([A-Za-z0-9_-]+)`).FindAllStringSubmatch(code, -1) { + if !rcEnabled[m[1]] { + t.Errorf("%s:%d enables --config=%s for every command", rel, i+1, m[1]) } } } @@ -1718,20 +1696,15 @@ func TestBazelRetiredLanesCannotBeNarrowed(t *testing.T) { // legacy jobs run the same scripts, so they are not changed here): the // command that runs the selected tests is pinned exactly, and nothing // else in them may select, skip, export a tier switch or run tests. - if os.Getenv("TEST_SRCDIR") == "" { - for _, c := range bazelShardScripts { - for _, e := range shardScriptNarrowing(c, readPolicyFile(t, root, c.script)) { - t.Error(e) - } + for _, c := range bazelShardScripts { + for _, e := range shardScriptNarrowing(c, readPolicyFile(t, root, c.script)) { + t.Error(e) } } // The lanes' targets (tagged embedded, dolt-server-proxied or // dolt-server-integration): exactly these, with exactly these args and // env (the legacy jobs' flags; the shard scripts add the rest). - if os.Getenv("TEST_SRCDIR") != "" { - return // scripts_test's runfiles hold no other package's BUILD - } type target struct { args []string env map[string]string @@ -2099,9 +2072,6 @@ func shardScriptNarrowing(c bazelShardScript, src string) []string { // The shard script check itself, on the real scripts and on narrowing edits // of one (review F2 mutations m2 and m3). func TestShardScriptNarrowingCheck(t *testing.T) { - if os.Getenv("TEST_SRCDIR") != "" { - t.Skip("scripts_test's runfiles hold no .github/scripts") - } root := sourceRepoRoot(t) scripts := map[string]bool{} for _, c := range bazelShardScripts { diff --git a/scripts/prlintmake/BUILD.bazel b/scripts/prlintmake/BUILD.bazel index a551175b0..e1fd0fd90 100644 --- a/scripts/prlintmake/BUILD.bazel +++ b/scripts/prlintmake/BUILD.bazel @@ -22,3 +22,25 @@ go_test( env = {"BEADS_TEST_GO": "$(rlocationpath @go_sdk//:bin/go)"}, deps = ["//internal/testutil/bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/release_script_test.go b/scripts/release_script_test.go index 89a811de1..a4d7442a4 100644 --- a/scripts/release_script_test.go +++ b/scripts/release_script_test.go @@ -85,9 +85,7 @@ echo '{"source":"/tmp/stale.formula.toml"}' } func TestReleaseFormulaCleanupStaleDoltOrphansHandlesLocalModeWithoutJQ(t *testing.T) { - skipReleaseFormulaUnderBazel(t) - repoRoot := sourceRepoRoot(t) - formulaPath := filepath.Join(repoRoot, ".beads", "formulas", "beads-release.formula.toml") + formulaPath := releaseFormulaPath(t) if _, err := formula.NewParser().ParseFile(formulaPath); err != nil { t.Fatalf("beads-release formula does not parse: %v", err) } @@ -119,9 +117,7 @@ func TestReleaseFormulaCleanupStaleDoltOrphansHandlesLocalModeWithoutJQ(t *testi } func TestReleaseFormulaHomebrewCoreProcedureCoversTemplateAndBottles(t *testing.T) { - skipReleaseFormulaUnderBazel(t) - repoRoot := sourceRepoRoot(t) - formulaPath := filepath.Join(repoRoot, ".beads", "formulas", "beads-release.formula.toml") + formulaPath := releaseFormulaPath(t) if _, err := formula.NewParser().ParseFile(formulaPath); err != nil { t.Fatalf("beads-release formula does not parse: %v", err) } @@ -206,15 +202,20 @@ func releaseTestTempDir(t *testing.T) string { return t.TempDir() } -// skipReleaseFormulaUnderBazel skips tests that read -// .beads/formulas/beads-release.formula.toml under Bazel: .beads holds live -// Dolt data and is in .bazelignore, so no target can declare the formula. -// These tests run under `go test`. -func skipReleaseFormulaUnderBazel(t *testing.T) { +// releaseFormulaPath returns the checked-in beads-release formula. Under +// Bazel it comes from BEADS_TEST_RELEASE_FORMULA: .beads/ also holds live bd +// data and is in .bazelignore, so the formula is not under //:repo_files but +// in its own local repository (@beads_formulas, MODULE.bazel). +func releaseFormulaPath(t *testing.T) string { t.Helper() if bazeltest.IsBazel() { - t.Skip(".beads/ is in .bazelignore, so the release formula cannot be declared as data; runs under go test") + path, err := bazeltest.RunfileEnv("BEADS_TEST_RELEASE_FORMULA") + if err != nil { + t.Fatal(err) + } + return path } + return filepath.Join(sourceRepoRoot(t), ".beads", "formulas", "beads-release.formula.toml") } func sourceRepoRoot(t *testing.T) string { diff --git a/scripts/repro-dolt-hang/BUILD.bazel b/scripts/repro-dolt-hang/BUILD.bazel index 87208ed30..9c219dbf9 100644 --- a/scripts/repro-dolt-hang/BUILD.bazel +++ b/scripts/repro-dolt-hang/BUILD.bazel @@ -16,3 +16,25 @@ go_binary( embed = [":repro-dolt-hang_lib"], visibility = ["//visibility:public"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/repro-dolt-prod-timeouts/BUILD.bazel b/scripts/repro-dolt-prod-timeouts/BUILD.bazel index f2066005f..ee97e8e8f 100644 --- a/scripts/repro-dolt-prod-timeouts/BUILD.bazel +++ b/scripts/repro-dolt-prod-timeouts/BUILD.bazel @@ -32,3 +32,25 @@ go_test( "@com_github_data_dog_go_sqlmock//:go-sqlmock", ], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/scripts/test_script_test.go b/scripts/test_script_test.go index 02d17d3e3..a1b67b65d 100644 --- a/scripts/test_script_test.go +++ b/scripts/test_script_test.go @@ -457,19 +457,18 @@ func runTestScriptPrebuiltBinary(t *testing.T, repoRoot string, args []string) ( // at the mercy of whatever test size this target happens to run under; // go test does not set this variable, so only Bazel needs the filter. // - // scripts/ci/scripts-go-test.sh (the CI driver for this very package's - // `go test ./scripts/...` run) calls beads_test_env_enter in its own - // shell before invoking go test, so this process's own os.Environ() can - // already carry an inherited BEADS_TEST_ENV_ACTIVE=1 / BEADS_TEST_ENV_ROOT - // / BEADS_TEST_ENV_DISABLE / BEADS_TEST_ENV_KEEP from that outer, - // longer-lived shell. If left in the child env below, scripts/test.sh's + // A caller that runs `go test ./scripts/...` inside an entered hermetic + // env (scripts/ci/pr-core.sh calls beads_test_env_enter in its own shell + // before invoking go test) hands this process an inherited + // BEADS_TEST_ENV_ACTIVE=1 / BEADS_TEST_ENV_ROOT / BEADS_TEST_ENV_DISABLE / + // BEADS_TEST_ENV_KEEP from that outer, longer-lived shell. If left in the child env below, scripts/test.sh's // own beads_test_env_enter call (scripts/test.sh:17) sees the // already-active guard and no-ops: no new root, no new EXIT trap - so the // directory observed by the fake binary is the outer root, which is // still alive (and rightly so: it's owned by the outer process) when // scripts/test.sh exits. That makes the "cleans up BEADS_TEST_ENV_ROOT" // subtest below fail only when this test binary happens to run nested - // under scripts-go-test.sh, even though the SF-4 fix it is guarding is + // under such a caller, even though the SF-4 fix it is guarding is // correct. Every real production caller of scripts/test.sh's prebuilt // path (pr.yml's Windows liveness/worktree-remove prebuilt steps) runs it // as the first command of a fresh GitHub Actions `run:` step, never diff --git a/scripts/workflowtags/BUILD.bazel b/scripts/workflowtags/BUILD.bazel index 06ccb766f..f5ff5af79 100644 --- a/scripts/workflowtags/BUILD.bazel +++ b/scripts/workflowtags/BUILD.bazel @@ -13,3 +13,25 @@ go_test( srcs = ["workflowtags_test.go"], embed = [":workflowtags"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/test/conformance/BUILD.bazel b/test/conformance/BUILD.bazel index 115d75c1d..eebe95038 100644 --- a/test/conformance/BUILD.bazel +++ b/test/conformance/BUILD.bazel @@ -6,3 +6,25 @@ go_library( importpath = "github.com/steveyegge/beads/test/conformance", visibility = ["//visibility:public"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/test/docsync/BUILD.bazel b/test/docsync/BUILD.bazel index 20fb12ae9..dcf713b95 100644 --- a/test/docsync/BUILD.bazel +++ b/test/docsync/BUILD.bazel @@ -8,10 +8,30 @@ go_test( "doltpin_test.go", "init_safety_recovery_test.go", ], - data = [ - "//:docsync_files", - "//cmd/bd:init_safety_help.go", - "//internal/testutil:testdoltcommon.go", - ], + # The checkout as Bazel sees it: the docs trees, every link target, and + # every AGENTS.md and test file the agent-instruction checks resolve. + data = ["//:repo_files"], deps = ["//internal/testutil/bazeltest"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/test/docsync/agentfiles_test.go b/test/docsync/agentfiles_test.go index f37e53937..6547dc137 100644 --- a/test/docsync/agentfiles_test.go +++ b/test/docsync/agentfiles_test.go @@ -9,8 +9,6 @@ import ( "sort" "strings" "testing" - - "github.com/steveyegge/beads/internal/testutil/bazeltest" ) // rootAgentsMaxBytes caps the root AGENTS.md. Agent tools load it into every @@ -80,14 +78,14 @@ func contributorAgentFiles(t *testing.T, root string) []string { } // TestAgentInstructionFilesAreLinkedAndRouted: every contributor AGENTS.md has -// a sibling CLAUDE.md symlink (Claude Code skips AGENTS.md files when a -// CLAUDE.md exists above them), every nested one is listed in the root routing -// table, and every local link, backticked repo path, and backticked guard-test -// name in them resolves. Make targets are not checked. +// a sibling CLAUDE.md that resolves to it (a symlink, `ln -s AGENTS.md +// CLAUDE.md`: Claude Code skips AGENTS.md files when a CLAUDE.md exists above +// them), every nested one is listed in the root routing table, and every +// local link, backticked repo path, and backticked guard-test name in them +// resolves. Make targets are not checked. Under Bazel the checkout is +// //:repo_files, where a source symlink arrives as its target's content, so +// CLAUDE.md is checked by content: a copy that drifts from AGENTS.md fails. func TestAgentInstructionFilesAreLinkedAndRouted(t *testing.T) { - if bazeltest.IsBazel() { - t.Skip("walks the source checkout; Bazel runfiles hold only declared data, so this runs under go test") - } root := repoRoot() agentFiles := contributorAgentFiles(t, root) if len(agentFiles) < 2 { @@ -102,17 +100,13 @@ func TestAgentInstructionFilesAreLinkedAndRouted(t *testing.T) { agentsPath := filepath.Join(root, filepath.FromSlash(rel)) claudePath := filepath.Join(filepath.Dir(agentsPath), "CLAUDE.md") claudeRel := filepath.ToSlash(filepath.Join(filepath.Dir(rel), "CLAUDE.md")) - info, err := os.Lstat(claudePath) - switch { - case err != nil: + if _, err := os.Lstat(claudePath); err != nil { t.Errorf("%s has no sibling CLAUDE.md; add one with `ln -s AGENTS.md CLAUDE.md`", rel) - case info.Mode()&os.ModeSymlink == 0: - t.Errorf("%s is a regular file; replace it with a symlink to AGENTS.md", claudeRel) - default: + } else { agents, aerr := os.ReadFile(agentsPath) claude, cerr := os.ReadFile(claudePath) if aerr != nil || cerr != nil || !bytes.Equal(agents, claude) { - t.Errorf("%s does not resolve to its sibling AGENTS.md", claudeRel) + t.Errorf("%s does not resolve to its sibling AGENTS.md; replace it with `ln -s AGENTS.md CLAUDE.md`", claudeRel) } } if rel != "AGENTS.md" && !bytes.Contains(rootAgents, []byte("("+rel+")")) { diff --git a/test/testmainconvention/BUILD.bazel b/test/testmainconvention/BUILD.bazel index 68121c2c6..cdb841788 100644 --- a/test/testmainconvention/BUILD.bazel +++ b/test/testmainconvention/BUILD.bazel @@ -4,3 +4,25 @@ go_test( name = "testmainconvention_test", srcs = ["testmain_convention_test.go"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/third_party/patches/BUILD.bazel b/third_party/patches/BUILD.bazel index 247e7f244..f15db188c 100644 --- a/third_party/patches/BUILD.bazel +++ b/third_party/patches/BUILD.bazel @@ -15,3 +15,25 @@ package(default_visibility = ["//visibility:public"]) exports_files(glob(["*.patch"])) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/tools/bazel/BUILD.bazel b/tools/bazel/BUILD.bazel index 19e36ec2e..8c05827d0 100644 --- a/tools/bazel/BUILD.bazel +++ b/tools/bazel/BUILD.bazel @@ -12,12 +12,6 @@ _DOLT_PLATFORMS_ONLY = select({ "//conditions:default": ["@platforms//:incompatible"], }) -# DOLT_VERSION is read as text by the dolt pin tests in //scripts. -exports_files( - ["dolt.bzl"], - visibility = ["//scripts:__pkg__"], -) - # sh_test src for a second test target over an existing go_test binary (see # the script header), e.g. //cmd/bd/doctor/fix:fix_docker_test. exports_files( @@ -97,3 +91,25 @@ filegroup( for os in ("darwin", "linux") for cpu in ("amd64", "arm64") ] + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files --- diff --git a/tools/bazel/equivalence_allowlist.txt b/tools/bazel/equivalence_allowlist.txt index 7d95926b5..374308a3b 100644 --- a/tools/bazel/equivalence_allowlist.txt +++ b/tools/bazel/equivalence_allowlist.txt @@ -12,37 +12,9 @@ # is a test the Bazel lane does not exercise. The checker reports entries that # no longer match anything. -# The in-test `go build` of bd that this test guards does not happen under -# Bazel (bd comes in through BEADS_TEST_BD_BINARY); go test still runs it. -cmd/bd TestGOMODCACHENotUnderTestHome skip # no in-test go build under Bazel; guarded by go test -# Same: it checks the fallback `go build` of bd, which Bazel never takes. -cmd/bd TestGoBuildBDCommandIsCWDIndependent skip # no in-test go build under Bazel; guarded by go test -# Needs TestAAAStdioBaseline in the same process; sharding splits them. -# TestMain's checkStdioAfterRun still checks every shard. -cmd/bd TestZZStdioNotLeaked skip # baseline test lands in another shard; checkStdioAfterRun covers each shard - -# Repository-policy tests that walk the whole source checkout (git ls-files, -# every BUILD file, .beads/ formulas). Bazel's runfiles hold only declared -# data, so they skip under TEST_SRCDIR; PR Core's go test runs them. -scripts TestBazelGoSrcsBlocksCurrent skip # walks the source checkout; runs under go test -scripts TestBazelNoPackagesUnderDocsTrees skip # walks the source checkout; runs under go test -scripts TestBazelNoRemoteEndpointsInTrackedFiles skip # scans git-tracked files; runs under go test -scripts TestBazelTestTagsFollowTaxonomy skip # reads every BUILD file in the checkout; runs under go test -scripts TestBazelTreeGoSrcsListsEveryPackage skip # walks the source checkout; runs under go test -scripts TestCheckTestingShortPassesOnCleanRepoTree skip # walks the whole checkout; runs under go test -test/docsync TestAgentInstructionFilesAreLinkedAndRouted skip # walks the source checkout for every AGENTS.md; runs under go test -scripts TestReleaseFormula* skip # .beads/ is in .bazelignore, so the formula cannot be data; runs under go test - -# Policy tests whose inputs (other packages' BUILD files, .github/scripts, -# tools/bazel Python) are not in //scripts:scripts_test's runfiles. Missing -# here, they turned nightly.yml's skip-parity check red (2026-10-02). -# scripts TestBazelOnlySkipsAreAllowlisted keeps this list complete. -scripts TestBazelGatedLanesNeverRetryFlakyTests skip # reads every BUILD and .bzl file in the checkout; runs under go test -scripts TestCheckShardCoverageScript skip # runs tools/bazel/check_shard_coverage.py, not in the runfiles; runs under go test -scripts TestShardScriptsListOnlyRealTests skip # runs the real .github/scripts shard scripts over the source tree; runs under go test -scripts TestProxiedShardManifestGeneratorNotStale skip # runs scripts/ci/gen_proxied_shard_manifest.py --check, not in the runfiles; runs under go test -scripts TestCmdEmbeddedShardManifestGeneratorNotStale skip # runs scripts/ci/gen_embedded_cmd_shard_manifest.py --check, not in the runfiles; runs under go test -scripts TestStorageEmbeddedShardManifestGeneratorNotStale skip # runs scripts/ci/gen_embedded_storage_shard_manifest.py --check, not in the runfiles; runs under go test -scripts TestShardScriptNarrowingCheck skip # reads the real .github/scripts shard scripts; runs under go test -scripts TestBazelOnlySkipsAreAllowlisted skip # parses every _test.go file in the checkout; runs under go test -scripts TestRunAllowlistedGoTestsScript skip # runs tools/bazel/run_allowlisted_go_tests.py, not in the runfiles; runs under go test +# Plain go test's own bd build fallback (BEADS_TEST_BD_BINARY unset), which +# Bazel never takes (bd comes in through BEADS_TEST_BD_BINARY). pr.yml's +# pr-preflight-platforms runs both on Linux, macOS and Windows ("Exercise go +# test's bd build fallback"). +cmd/bd TestGOMODCACHENotUnderTestHome skip # no in-test go build under Bazel; pr-preflight-platforms runs it +cmd/bd TestGoBuildBDCommandIsCWDIndependent skip # no in-test go build under Bazel; pr-preflight-platforms runs it diff --git a/tools/bazel/go_srcs.py b/tools/bazel/go_srcs.py index 763e46264..c06af7cfa 100755 --- a/tools/bazel/go_srcs.py +++ b/tools/bazel/go_srcs.py @@ -21,6 +21,17 @@ Blocks in packages that are no longer listed are removed. Run from the repository root after gazelle (see `make bazel-sync`). Output is deterministic and gazelle-stable, so a clean sync leaves git clean. +Every package also gets a managed `repo_files` block: a filegroup of all of +the package's own files (`glob(["**"])` less local build and editor debris), +and the root package's aggregates every package's into `//:repo_files`. That +is the checkout as Bazel sees it, the `data` of the repository-policy tests +that walk the whole tree (every BUILD file, every test file, every tracked +Markdown file). A package without the block would drop out of their view and +pass them vacuously, which is why `make bazel-sync-check` (bazel.yml's BUILD +sync step, on every PR) fails on a missing or stale block. Trees in +.bazelignore (.beads, website, the nested example modules, agent worktrees, +node_modules) are outside Bazel and so outside //:repo_files. + With --check nothing is written: stale blocks are printed as a diff and the exit status is 1 (see `make bazel-sync-check`). """ @@ -54,9 +65,77 @@ TREES = ( BEGIN = "# --- begin go_srcs (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) ---" END = "# --- end go_srcs ---" -BLOCK_RE = re.compile(r"\n*" + re.escape(BEGIN) + r".*?" + re.escape(END) + r"\n*", re.DOTALL) +REPO_BEGIN = "# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) ---" +REPO_END = "# --- end repo_files ---" +BLOCK_RES = tuple( + re.compile(r"\n*" + re.escape(begin) + r".*?" + re.escape(end) + r"\n*", re.DOTALL) + for begin, end in ((BEGIN, END), (REPO_BEGIN, REPO_END)) +) SKIP_DIRS = {"testdata", "node_modules"} +# Untracked build output and debris (.gitignore's patterns that can appear in +# any directory) that must not become test inputs on a developer machine. No +# tracked file matches them. +REPO_FILES_EXCLUDE = ( + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", +) + +# The same at the repository root only: the git directory, Bazel's convenience +# symlinks (a glob follows them into the output tree), local binaries, +# per-developer Bazel rc files (they hold remote endpoints) and tool state. +ROOT_REPO_FILES_EXCLUDE = ( + ".agents/**", + ".claude/*.lock", + ".claude/*.log", + ".claude/settings.local.json", + ".amp/**", + ".augment/**", + ".bazelrc.local", + ".codex/**", + ".cursor/**", + ".direnv/**", + ".envrc", + ".git/**", + ".idea/**", + ".logs/**", + ".vscode/**", + "bazel-*/**", + "bd", + "bd-fixed", + "bd-original", + "bd-test", + "bd_test", + "beads", + "go.work", + "go.work.sum", + "history/**", + "mcp_agent_mail/**", + "npm-package/bin/*.tar.gz", + "npm-package/bin/*.zip", + "npm-package/bin/CHANGELOG.md", + "npm-package/bin/LICENSE", + "npm-package/bin/README.md", + "npm-package/bin/bd", + "npm-package/package-lock.json", + "output", + "result", + "state.json", + "user.bazelrc", +) + +# Who may read //:repo_files: the repository-policy tests. +REPO_FILES_VISIBILITY = ( + "//scripts:__pkg__", + "//test/docsync:__pkg__", +) + def packages_under(root: str) -> list[str]: found = [] @@ -98,15 +177,47 @@ def block(pkg: str, tree_members: list[str] | None) -> str: return "\n".join(lines) + "\n" -def rewrite(path: str, new_block: str | None, check: bool) -> bool: - """Bring path's managed block up to date; return True if it was stale. +def repo_files_block(pkg: str, packages: list[str]) -> str: + """The repo_files block of pkg ("." is the root, which aggregates).""" + root = pkg == "." + exclude = REPO_FILES_EXCLUDE + (ROOT_REPO_FILES_EXCLUDE if root else ()) + lines = [ + REPO_BEGIN, + "", + "filegroup(", + ' name = "repo_files",', + " srcs = glob(", + ' ["**"],', + " exclude = [", + ] + lines += [f' "{e}",' for e in sorted(exclude)] + # No allow_empty: every package holds at least its BUILD.bazel. + lines += [" ],"] + if root: + lines += [" ) + ["] + lines += [f' "//{p}:repo_files",' for p in packages if p != "."] + lines += [" ],", " visibility = ["] + lines += [f' "{v}",' for v in REPO_FILES_VISIBILITY] + lines += [" ],"] + else: + lines += [" ),", ' visibility = ["//:__pkg__"],'] + lines += [")", "", REPO_END] + return "\n".join(lines) + "\n" + + +def rewrite(path: str, new_blocks: list[str], check: bool) -> bool: + """Bring path's managed blocks up to date; return True if any was stale. In check mode the file is left alone and the needed change is printed. """ with open(path) as f: src = f.read() - stripped = BLOCK_RE.sub("\n", src).rstrip("\n") + "\n" - out = stripped if new_block is None else stripped + "\n" + new_block + stripped = src + for block_re in BLOCK_RES: + stripped = block_re.sub("\n", stripped) + out = stripped.rstrip("\n") + "\n" + for new_block in new_blocks: + out += "\n" + new_block if out == src: return False if check: @@ -150,18 +261,17 @@ def main(argv: list[str]) -> int: wanted.setdefault(pkg, None) wanted[root] = members stale = [] - for pkg in packages_under("."): + packages = packages_under(".") + for pkg in packages: path = os.path.join(pkg, "BUILD.bazel") - if pkg in wanted: - changed = rewrite(path, block(pkg, wanted[pkg]), check) - else: - with open(path) as f: - changed = BEGIN in f.read() and rewrite(path, None, check) + blocks = [block(pkg, wanted[pkg])] if pkg in wanted else [] + blocks.append(repo_files_block(pkg, packages)) + changed = rewrite(path, blocks, check) if changed: stale.append(path) if check and stale: print( - f"go_srcs.py: {len(stale)} stale go_srcs block(s): {', '.join(stale)}; run `make bazel-sync`", + f"go_srcs.py: {len(stale)} stale managed block(s): {', '.join(stale)}; run `make bazel-sync`", file=sys.stderr, ) return 1 diff --git a/tools/bazel/run_allowlisted_go_tests.py b/tools/bazel/run_allowlisted_go_tests.py deleted file mode 100755 index 5111dc074..000000000 --- a/tools/bazel/run_allowlisted_go_tests.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python3 -"""Run, under `go test`, the Go tests the Bazel PR-core lane does not run. - -tools/bazel/equivalence_allowlist.txt lists every Go test that PR Core's -`go test` runs and `bazel test //... --config=ci` does not run (kind "run") -or skips (kind "skip"), each with a reason. Where pr.yml's legacy PR Core job -stands down for the Bazel lane (D2 step 3), nothing else would run those -tests before merge, so this runs exactly them, with PR Core's test flags -(-short, -skip '^TestEmbedded', gms_pure_go; not -race: the build is shared -with the job's other non-race `go test` steps), and requires each entry to -have matched at least one top-level test and every matched test to have -passed: a test that now skips, fails or no longer exists fails the step -instead of passing silently. - -A package glob is refused (`go test` needs real package paths); a test name -of `*` runs the whole package. Call it through -scripts/ci/allowlisted-go-tests.sh, which gives the tests PR Core's -environment (scripts/ci/lib/test-env.sh). - -Usage: run_allowlisted_go_tests.py [--allowlist FILE] [--go GO] [--dry-run] -""" -import argparse -import json -import os -import re -import subprocess -import sys - -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -from equivalence import DEFAULT_ALLOWLIST, load_allowlist # noqa: E402 - -# The build tag(s) PR Core's test flags apply (tags come from .buildflags' -# GOFLAGS too). Factored out so --compile-only's `go test -c` command below -# can reuse it directly instead of slicing GO_TEST_FLAGS (F7b review fix N1: -# `GO_TEST_FLAGS[-2:]` silently assumed these were always the last two -# elements of GO_TEST_FLAGS; any future reordering or addition there would -# have fed `-c` the wrong flags with no error, just a tag-less compile). -BUILD_FLAGS = ["-tags", "gms_pure_go"] -# PR Core's test flags (scripts/ci/pr-core.sh), less -race, -p/-parallel and -# -timeout's package count. -GO_TEST_FLAGS = ["-short", "-count=1", "-timeout=30m", "-skip", "^TestEmbedded", *BUILD_FLAGS] -# Tests an allowlisted test needs in the same process, run alongside it: -# TestZZStdioNotLeaked compares against the streams TestAAAStdioBaseline -# recorded (and skips without it), which is why Bazel's sharding skips it. -COMPANIONS = {("cmd/bd", "TestZZStdioNotLeaked"): ["TestAAAStdioBaseline"]} -NAME_RE = re.compile(r"^[A-Za-z0-9_*]+$") -PKG_RE = re.compile(r"^[A-Za-z0-9_./-]+$") - - -def plan(entries): - """{pkg: [entry, ...]} in allowlist order, or raise ValueError.""" - out = {} - for e in entries: - if not PKG_RE.match(e["pkg"]) or e["pkg"].startswith(("/", "..")) or "*" in e["pkg"]: - raise ValueError(f"allowlist line {e['line']}: package {e['pkg']!r} is not a literal package directory") - if not NAME_RE.match(e["test"]): - raise ValueError(f"allowlist line {e['line']}: test {e['test']!r} is not a Test name or glob") - out.setdefault(e["pkg"], []).append(e) - return out - - -def glob_re(name): - return re.compile("^" + ".*".join(re.escape(p) for p in name.split("*")) + "$") - - -def run_regex(group): - """-run selector for a package's entries, or None for the whole package.""" - if any(e["test"] == "*" for e in group): - return None - names = [] - for e in group: - names += COMPANIONS.get((e["pkg"], e["test"]), []) + [e["test"]] - return "^(" + "|".join(".*".join(re.escape(p) for p in n.split("*")) for n in names) + ")$" - - -def top_level_results(output): - """{test: final action} for top-level tests in `go test -json` output.""" - res = {} - for line in output.splitlines(): - if not line.startswith("{"): - continue - try: - ev = json.loads(line) - except ValueError: - continue - test, action = ev.get("Test"), ev.get("Action") - if test and "/" not in test and action in ("pass", "fail", "skip"): - res[test] = action - return res - - -def check(group, results): - """Problems for one package's entries given its top-level results.""" - problems = [] - for e in group: - matched = sorted(t for t in results if glob_re(e["test"]).match(t)) - if not matched: - problems.append(f"{e['pkg']} {e['test']} (allowlist line {e['line']}): matched no test that ran") - for t in matched: - if results[t] != "pass": - problems.append(f"{e['pkg']} {t} (allowlist line {e['line']}): {results[t]}, want pass") - for t, action in sorted(results.items()): - if action == "fail": - problems.append(f"{group[0]['pkg']} {t}: fail") - return problems - - -def main(argv=None): - ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - ap.add_argument("--allowlist", default=DEFAULT_ALLOWLIST) - ap.add_argument("--go", default="go") - ap.add_argument("--dry-run", action="store_true", help="print the go test commands only") - ap.add_argument( - "--compile-only", - action="store_true", - help=( - "compile each allowlisted package's test binary (go test -c -o " - "/dev/null) instead of running it; used by main.yml's " - "blacksmith-go-build-cache seed to warm the non-race GOCACHE for " - "exactly the packages this script's real run needs, with zero " - "risk of the package list drifting from the allowlist (F7b)." - ), - ) - args = ap.parse_args(argv) - - if not os.path.exists(args.allowlist): - print(f"{args.allowlist}: no such allowlist", file=sys.stderr) - return 1 - entries, errors = load_allowlist(args.allowlist) - if errors: - print("\n".join(errors), file=sys.stderr) - return 1 - try: - pkgs = plan(entries) - except ValueError as err: - print(err, file=sys.stderr) - return 1 - - if args.compile_only: - problems = [] - for pkg in pkgs: - cmd = [args.go, "test", "-c", *BUILD_FLAGS, "-o", os.devnull, "./" + pkg] - print("+ " + " ".join(cmd), flush=True) - if args.dry_run: - continue - proc = subprocess.run(cmd) - if proc.returncode != 0: - problems.append(f"{pkg}: go test -c exited {proc.returncode}") - if args.dry_run: - return 0 - if problems: - print("\nFAIL: compiling allowlisted packages' test binaries:", file=sys.stderr) - print("\n".join(" " + p for p in problems), file=sys.stderr) - return 1 - print(f"\nok: compiled {len(pkgs)} allowlisted package test binaries") - return 0 - - problems, ran = [], 0 - for pkg, group in pkgs.items(): - cmd = [args.go, "test", "-json", *GO_TEST_FLAGS] - sel = run_regex(group) - if sel is not None: - cmd += ["-run", sel] - cmd.append("./" + pkg) - print("+ " + " ".join(cmd), flush=True) - if args.dry_run: - continue - proc = subprocess.run(cmd, capture_output=True, text=True) - for line in proc.stdout.splitlines(): - try: - out = json.loads(line).get("Output") - except ValueError: - out = line + "\n" - if out: - sys.stdout.write(out) - sys.stdout.write(proc.stderr) - results = top_level_results(proc.stdout) - ran += len(results) - problems += check(group, results) - if proc.returncode != 0: - problems.append(f"{pkg}: go test exited {proc.returncode}") - if args.dry_run: - return 0 - if problems: - print("\nFAIL: the Go tests the Bazel PR-core lane does not run did not all pass here:", file=sys.stderr) - print("\n".join(" " + p for p in problems), file=sys.stderr) - return 1 - print(f"\nok: {len(entries)} allowlist entries, {ran} top-level tests passed under go test") - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/docsmint/BUILD.bazel b/tools/docsmint/BUILD.bazel index 23dd7578d..da07e7a9b 100644 --- a/tools/docsmint/BUILD.bazel +++ b/tools/docsmint/BUILD.bazel @@ -25,3 +25,25 @@ go_test( ], embed = [":docsmint_lib"], ) + +# --- begin repo_files (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) --- + +filegroup( + name = "repo_files", + srcs = glob( + ["**"], + exclude = [ + "**/*.db", + "**/*.exe", + "**/*.out", + "**/*.prof", + "**/*.pyc", + "**/*.test", + "**/__pycache__/**", + "**/node_modules/**", + ], + ), + visibility = ["//:__pkg__"], +) + +# --- end repo_files ---