build(lint): fail on tracked binaries, and build the gateway binaries into bin/ - #587
Merged
Conversation
… into bin/ ## Summary ### Why? An 18MB `client` binary reached #547 and was caught only by review — nothing in CI guards against a committed binary. `go build ./service/submitqueue/gateway/client` names its output after the package directory and writes it to the *current* directory, so run from the repo root it drops a `client` there, where a broad `git add` sweeps it up. Every `service/*/server` package produces a root `server` the same way. The obvious fix — ignoring `/client` — is the wrong one. It would stop the file being committed but equally stop git mentioning it at all, so the mistake becomes invisible and the artifact quietly accumulates. It is also name-specific: it covers 8 of the 12 `main` packages and none of the other binaries anyone might add. Worse, an ignored path is never tracked, so it would hide the offender from the check below rather than complement it. ### What? `tool/linter/binaryfile` fails when any tracked file is binary. It follows the existing `licenseheader` / `messageid` / `queueshard` pattern and is wired in as `make lint-binary`, so `make lint` and the CI gate already cover it. Detection is git's own heuristic — a NUL byte in the leading 8000 bytes. The repository has no tracked binaries today, so the check starts clean and the allowlist is empty. `make build-submitqueue-gateway-client` and `make build-submitqueue-gateway-server` build with Bazel for the host platform into `bin/client` and `bin/server`, giving a sanctioned way to produce a standalone binary. `bin/` was already ignored but had no producer — the only reference to it anywhere in the Makefile, `tool/`, or `.github/` was `rm -rf bin/` in `clean`. No `.gitignore` change is needed: `bazel-bin/`, `bin/`, and `.docker-bin/` already cover every Bazel output, and the whole point of the linter is to surface a stray binary rather than hide it. ## Test Plan ✅ `bazel test //tool/linter/binaryfile:go_default_test` passes. ✅ `make lint-binary` on a clean tree reports `All 884 tracked files are text.` ✅ Reproduced #547 end to end: `go build ./service/submitqueue/gateway/client` from the repo root drops a 17,539,170-byte `client`; `git status` shows it as `?? client` rather than hiding it; after `git add client` the linter fails, naming the file and its size and pointing at Bazel. ✅ Both build targets produce Mach-O arm64 executables at `bin/client` and `bin/server`, are idempotent over Bazel's read-only output, and leave `git status` clean. ✅ `make gazelle` generates the linter's BUILD.bazel with no further drift, and `make help` lists all three new targets.
behinddwalls
force-pushed
the
sq/client-bin-target
branch
from
August 13, 2026 18:12
51d55b2 to
1ec9a3f
Compare
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.
Summary
Why?
An 18MB
clientbinary reached #547 and was caught only by review — nothing in CI guards against a committed binary.go build ./service/submitqueue/gateway/clientnames its output after the package directory and writes it to the current directory, so run from the repo root it drops aclientthere, where a broadgit addsweeps it up. Everyservice/*/serverpackage produces a rootserverthe same way.The obvious fix — ignoring
/client— is the wrong one. It would stop the file being committed but equally stop git mentioning it at all, so the mistake becomes invisible and the artifact quietly accumulates. It is also name-specific: it covers 8 of the 12mainpackages and none of the other binaries anyone might add. Worse, an ignored path is never tracked, so it would hide the offender from the check below rather than complement it.What?
tool/linter/binaryfilefails when any tracked file is binary. It follows the existinglicenseheader/messageid/queueshardpattern and is wired in asmake lint-binary, somake lintand the CI gate already cover it. Detection is git's own heuristic — a NUL byte in the leading 8000 bytes. The repository has no tracked binaries today, so the check starts clean and the allowlist is empty.make build-submitqueue-gateway-clientandmake build-submitqueue-gateway-serverbuild with Bazel for the host platform intobin/clientandbin/server, giving a sanctioned way to produce a standalone binary.bin/was already ignored but had no producer — the only reference to it anywhere in the Makefile,tool/, or.github/wasrm -rf bin/inclean.No
.gitignorechange is needed:bazel-bin/,bin/, and.docker-bin/already cover every Bazel output, and the whole point of the linter is to surface a stray binary rather than hide it.Test Plan
✅
bazel test //tool/linter/binaryfile:go_default_testpasses.✅
make lint-binaryon a clean tree reportsAll 884 tracked files are text.✅ Reproduced #547 end to end:
go build ./service/submitqueue/gateway/clientfrom the repo root drops a 17,539,170-byteclient;git statusshows it as?? clientrather than hiding it; aftergit add clientthe linter fails, naming the file and its size and pointing at Bazel.✅ Both build targets produce Mach-O arm64 executables at
bin/clientandbin/server, are idempotent over Bazel's read-only output, and leavegit statusclean.✅
make gazellegenerates the linter's BUILD.bazel with no further drift, andmake helplists all three new targets.