fast-checks, PR Policy, and the Linux leg of check-doc-freshness-platforms ran repository guards on GitHub runners. They now run as Bazel tests in bazel.yml's `test` lane (remote, cached), each over only the files it reads: - tools/bazel/repo_subset.bzl picks a narrow, path-selected slice of //:repo_files at analysis time. scripts/repochecks/run_check.sh copies that slice into a throwaway git checkout and runs the unchanged guard there. - //scripts/repochecks: build_tags, workflow_tags, go_install_guidance, winget_portable_alias, migration_hygiene (checks A and B), fmt (registered SDK gofmt), doc_freshness, workapi_frontend_boundary, types_gen_drift (`make api-check` drift, oapi-codegen from go.mod). - //scripts:doc_freshness_required_test (integration lane, -required-suite) and //scripts/gitattributespolicy:gitattributespolicy_required_host_test cover the Linux doc-freshness leg. - check-versions stays covered by //internal/versioncheck:versioncheck_test. check-testing-short stays covered by //scripts:scripts_test. pr-policy-wrapper is deleted. fast-checks keeps only the two checks that need the PR base: migration hygiene's delta half (MIGRATION_HYGIENE_SCOPE= delta) and the .beads diff. check-doc-flags stays, because it builds bd from the pinned release tag. The example Go modules leave .bazelignore so gofmt and the grep guards see them. check_testcases.py now accepts --not-go //pkg:all. Refs: ga-96smfk.20 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
Bash
Executable file
37 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# internal/workapi must not read cwd- or environment-derived state.
|
|
#
|
|
# The import half of this boundary is the workapi-frontend-boundary depguard
|
|
# rule in .golangci.yml. This is the symbol half depguard cannot express:
|
|
# internal/workapi legitimately imports internal/config (for
|
|
# GetCustomTypesFromYAML, a workspace-scoped read), but process-local reads
|
|
# derived from a client's cwd or environment are meaningless in a long-lived
|
|
# server and must not leak into the shared contract.
|
|
#
|
|
# Runs in scripts/ci/pr-policy.sh and as
|
|
# //scripts/repochecks:workapi_frontend_boundary_test.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
banned='config\.GetDirectoryLabels|os\.Getenv'
|
|
|
|
if [[ ! -d internal/workapi ]]; then
|
|
printf 'internal/workapi does not exist; skipping frontend-boundary check.\n'
|
|
exit 0
|
|
fi
|
|
|
|
if grep -rnE "$banned" internal/workapi --include='*.go'; then
|
|
cat >&2 <<'MSG'
|
|
|
|
internal/workapi must not read cwd- or environment-derived state.
|
|
|
|
Those reads describe the client's process, which a server process does not
|
|
share. Resolve them in the frontend and pass the result in as a parameter.
|
|
See internal/workapi/doc.go.
|
|
MSG
|
|
exit 1
|
|
fi
|
|
|
|
printf 'No banned cwd/env accessors in internal/workapi.\n'
|