Repository navigation
Enforce the license header, with any2bazel's checker and workflow - #2
Merged
Merged
Conversation
Two patterns removed by the operator, by hand: runs/*/target and runs/.alloc.lock. Runs live in an operator's records root, not in this repository. A reviewer of the first pull request asked whether they were a vestige.
Every source file must begin with the Apache 2.0 header, and a pull request now fails when one does not. The check is EngFlow/any2bazel's, copied from its main at 1ceba9f: infra/internal/check_copyright_headers (a Go program run with `bazel run`), .bazelversion, MODULE.bazel.lock, and the copyright job of .github/workflows/main.yml. What differs from any2bazel's copy, and why: - Two more exemptions in the checker: NOTICE, and everything under templates/ (starting files an operator copies into records of their own; one of them is the prompt every run is launched with, whose bytes a run records). - The Go import path names this repository. - The lock file. On a machine set up for the lab, Bazel fetches modules from a copy of the registry on that machine's disk, and running the check there rewrote MODULE.bazel.lock to point at that copy. So .bazelrc tells Bazel to ignore the lock file (--lockfile_mode=off). The workflow overrides that with --lockfile_mode=error, which fails unless the committed lock file is exactly right. - MODULE.bazel is new: this repository had no Bazel module. The lab's tools are not built with Bazel, and this is the one target. Six of the lab's files gained the header: lab.local.conf.example, tools/cooldown/frozen_snapshots.example.txt, tools/env/containers.conf, tools/runner/apparmor/a2b-private-tmp, and the two case files under tools/judge/examples. Each is read by a parser that skips comment lines. CLAUDE.md's conventions say how to add a file and how to run the check. Tried on a trial machine set up by SETUP.md, with Bazel 9.2.0: - The check passes on this commit, as an operator would run it and as the workflow runs it (the repository's .bazelrc alone, the public registry, --lockfile_mode=error). Neither leaves a change in the checkout. - Four planted defects each failed it and were named: a new script with no header, the header removed from a tool, another owner's name in the copyright line, and a header pushed past the first 1000 bytes. A control, a file with no header under templates/, passed. - With a dependency changed in MODULE.bazel and the lock left as it was, the workflow's command failed. - The command MODULE.bazel gives for updating the lock left it byte for byte the same when nothing had changed. - The two configuration files that gained a header were installed and used: podman read containers.conf, apparmor_parser loaded the profile, preflight ended OK, and tools/tests/run_all.sh reported 50 tests, all passing. Not tried: the workflow on GitHub's own runner, which first runs when this is pushed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
armandomontanez
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every source file must begin with the Apache 2.0 header, and a pull request now fails when one
does not.
The check is any2bazel's, copied from its
mainat1ceba9f:infra/internal/check_copyright_headers(a Go program run withbazel run),.bazelversion,MODULE.bazel.lock, and the copyright job of.github/workflows/main.yml.What differs from any2bazel's copy, and why
NOTICE, and everything undertemplates/. Those arestarting files an operator copies into records of their own. One of them is the prompt every run
is launched with, whose bytes a run records.
registry on that machine's disk, and running the check there rewrote
MODULE.bazel.locktopoint at that copy. So
.bazelrctells Bazel to ignore the lock file (--lockfile_mode=off).The workflow overrides that with
--lockfile_mode=error, which fails unless the committed lockfile is exactly right.
MODULE.bazelis new. This repository had no Bazel module. The lab's tools are not builtwith Bazel, and the checker is the one target.
What else changes
CLAUDE.md's conventions say how to add a file and how to run the check..gitignoreloses two patterns left from before the records moved out of this repository, andignores Bazel's symlinks.
How it was tried
On a trial machine set up by
SETUP.md, with Bazel 9.2.0:(the repository's
.bazelrcalone, the public registry,--lockfile_mode=error). Neitherleaves a change in the checkout.
removed from a tool, another owner's name in the copyright line, and a header pushed past the
first 1000 bytes. A control, a file with no header under
templates/, passed.MODULE.bazeland the lock left as it was, the workflow's commandfailed.
tools/env/containers.confand the AppArmor profile. With both installed, podman read the first,
apparmor_parserloadedthe second, the lab's preflight ended
OK, andtools/tests/run_all.shreported 50 tests, allpassing.
Not tried before this pull request: the workflow on GitHub's own runner. Its first run is the one
on this pull request.
🤖 Generated with Claude Code