beads/scripts/check-workapi-frontend-boundary.sh
Julian Knutsen 9d13485b71
ci(bazel): retire main.yml's Linux jobs, nightly's go test jobs and ci-measurements (#7354)
Push to main and the nightly schedule no longer run go test or repo checks
on GitHub runners (ga-96smfk.22, ga-96smfk.58):

- main.yml keeps only the macOS -race -short suite, the Windows smoke build
  and the push-to-main savers of the GOCACHEs pr.yml's Windows/macOS jobs
  restore. Its Linux jobs (migration hygiene, build artifacts, build tags,
  versions, duplicate migrations, doc flags, package gates, PR policy
  wrapper, gofmt, the Linux and setup-go cache seeders, the Nix flake
  check) are gated on the merge queue's pr.yml/pr-risk.yml run of the
  same commit and re-run as Bazel targets by bazel.yml's push run.
- nightly.yml is the fresh bazel.yml call plus the worker-env check; its
  Full Test Suite, PR Core go-test-json side and measure dispatch are gone,
  as are ci-measurements.yml and bazel.yml's go-test-json-artifact input.
- The non-race embedded batch-apply step becomes
  //internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test
  (go_test_race_off, BEADS_TEST_EMBEDDED_DOLT=1) in the embedded tier.
- make ci-pr-policy and scripts/ci/pr-policy.sh go: every check it ran is
  a Bazel test (TestPRPolicyChecksRunAsBazelTargets).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 10:06:59 +00:00

36 lines
1.2 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 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'