5 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6899813df6 |
fix(preflight): share checkout lint authority (#5780)
* fix(preflight): share checkout lint authority
Move the Beads repository's native and Windows non-CGO lint policy into a checkout-owned Go driver. The supported Make/Bash wrapper and bd preflight now execute that same authority, while generic Go repositories retain their direct lint contract and formatting is rooted at the detected project.
Fixes #5300.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
* docs(lint): clarify shared driver scope and timeout limits
Address PR #5780 review 5191123668. Document existing inherited-tag semantics and distinguish the wrapper/preflight driver from standalone workflow and pre-commit callers.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* fix(lint): prefer the selected Windows Go toolchain (#6865)
Keep per-pass toolchain requests and deadlines while avoiding the extra auto-selection launcher under the linter. Nonstandard SDKs retain their original PATH.
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* fix(lint): retain PATH for SDK directories containing separators (#6865)
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* test(preflight): declare lint fixture executable for Bazel (#5300)
Agent-Signature: codex-tui-gpt-6-astra-max on behalf of Ewen Cuthiell
* fix(bazel): keep cmd/bd/testdata out of gazelle's package scan
PR #5780 adds the compilable fixture cmd/bd/testdata/preflight-go.go. Left to
itself gazelle generates a BUILD.bazel for cmd/bd/testdata, which makes it its
own package and then (a) empties cmd/bd's data = glob(["testdata/**"]) under the
default allow_empty = False and (b) puts testdata/preflight-go.go across a
package boundary from the preflight_go_fixture target that lists it.
bazel.yml's "BUILD files in sync" step runs `make bazel-sync` and fails on any
resulting drift, and fork PRs always run that job, so this was a live red whose
prescribed remedy ("commit the result") would have broken the build further.
Exclude the directory instead, and take gazelle's ordering for the data list.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(preflight): bound the lint deadline and report each check's scope
Review iteration 1 for PR #5780. Synthesis and scorecard both approve (975/1000,
no blocker or major), so this addresses non-gating findings only.
Finding 4 (Resource Lifecycle) - the 13-minute deadline could not bound the call
it guards. CombinedOutput collects through a pipe every descendant inherits, so
Wait kept blocking on a surviving golangci-lint after the context killed the
direct `go run` child. Measured on the same process shape (direct child killed at
1s, descendant holding the pipe for 8s): without WaitDelay the call returned in
8.00s, with WaitDelay in 1.50s. Sets cmd.WaitDelay so the deadline is a real
bound and the "lint check exceeded" line can actually print.
Also gates that line on err != nil, which retires the claude lane's nit (a): a
child that exits cleanly as the deadline fires is a pass, not a timeout. Measured
at the crossover, 68 of 300 passing runs would have carried a false "exceeded"
line; 0 after the gate.
Finding 1 (Change Impact) and nit 7 (Debuggability), one remedy - the PR re-roots
lint and fmt at preflightProjectRoot() but leaves runTestCheck in the caller's
cwd, so a --check run from a subdirectory mixes a repo-wide verdict with a
subtree-only one "with nothing in the output distinguishing them", and the
reported command is only reproducible from the root. CheckResult now carries the
directory each check resolved to, and the report prints it.
Took the synthesis's second arm (state the scope split) rather than re-rooting
runTestCheck, because re-rooting is a behaviour change neither lane priced: it
widens a subdirectory user's test run from 5 packages to 128, including every
Dolt-dependent package, on a repo whose full test gate the PR body already
discloses as red. The stated hazard is that the scopes are indistinguishable,
which reporting the directory discharges directly.
Finding 2 (Architectural Consistency), second clause - adds
TestBuildFlagsContractMatchesShellSource, which parses .buildflags and pins the
driver constants to it. The existing mirror test asserts today's values from the
Go side only, so the files could drift silently; buildEnvironment overrides
rather than merges -tags, so a tag added to .buildflags alone would be dropped
with every test still green. Each of the three legs was mutation-proved to red.
Declined, with the measurements that decided it:
- Finding 2's first clause (route the key comparisons through
internal/execenv.KeyEqualForOS). The two are provably equivalent today -
execenv's keyIdentityForWindows is strings.ToLower for the same documented
reason - so this is de-duplication, not a defect, and the hazard it closes
(os/exec key-identity semantics changing) is far less live than the
.buildflags drift the second clause pins. The faithful swap means threading
goos through five driver functions and ~27 test call sites in this PR's
centerpiece file, and it would put a non-stdlib dependency into pr-lint_lib,
which the binary currently does not have. Worth doing on its own footing, not
inside a non-gating cleanup.
- Nit 6 (parse GOFLAGS into fields instead of a substring test). .buildflags:22
guards its own append with `!= *gms_pure_go*`, a substring test, and the Go
code is a deliberate mirror of it. Making only the Go side stricter would
manufacture exactly the drift finding 2 warns about: on
GOFLAGS=-tags=gms_pure_go_x the shell would skip its append while the driver
performed one. The fix belongs to .buildflags and the driver together, and
.buildflags is outside this PR. The new mirror test now pins that agreement.
- Nit 5 (probe golangci-lint as well as `go`). The claude lane examined the
LookPath target change and recorded it as deliberate, with the driver's own
missing-linter error as the mitigation. The suggested alternative - have the
driver emit preflight's `--skip-lint` hint - puts a bd-specific flag into a
driver that CI also invokes, where that advice is wrong.
- Finding 3 (two false PR-body claims). Correcting the body is outward-facing
and belongs to finalize; stamped for it. Swept the in-tree copies: the PR's own
LINTING.md sentence "Toolchain requests, formatting, and lint deadlines are
unchanged" is scoped to the Windows SDK-preference paragraph it sits in and is
true there, so it is graded rather than repaired. CHANGELOG.md contains no
pr-lint entry, so the remedy's CHANGELOG half has no target in this PR.
Validation: go build, go vet and gofmt clean on the changed packages;
./scripts/pr-lint/ 12 pass / 2 Windows-only skip; ./scripts/prlintmake/ pass;
cmd/bd preflight selector pass; scripts/check-doc-freshness.sh PASSED;
make bazel-sync idempotent and bazel test //scripts/pr-lint:pr-lint_test PASSED.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(prlintmake): inject the pr-lint wrapper's gofmt shim through GOFMT
The merge with #6294 (be-gx8) left runPRLintWrapper relying on a
code path #6294 made deliberately loud. The helper put its gofmt shim
on PATH. Since #6294, fmt-check.sh resolves gofmt through
scripts/ci/gofmt-bin.sh, which ignores a PATH gofmt by design.
Both TestPRLintWrapper* tests still passed, but only via the
resolver's fallback. The go shim answers `go env GOVERSION` and
`go env GOROOT` with nothing, so gofmt-bin.sh warns "could not resolve
a gofmt from go.mod's go1.26.7 toolchain" and falls back to whatever
gofmt is first on PATH, which happened to be the shim. With GOFMT set
in the environment, which is #6294's documented override, the
resolver uses that value instead. Both tests then fail: exit status
127 from fmt-check.sh, and a missing aggregate failure diagnostic
because pr-lint.sh stops before `go run`. At the pre-merge head
(
|
||
|
|
5cc896c8f0 |
fix(lint): suppress two darwin-only gosec findings and cross-lint the darwin build in CI (#6243)
* fix(lint): suppress two darwin-only gosec findings and cross-lint the darwin build in CI scripts/ci/pr-lint.sh lints natively on the ubuntu runner plus one GOOS=windows CGO_ENABLED=0 cross-lint, so files behind //go:build darwin (and the !windows && !linux fallbacks) were never linted in CI. Linting the darwin build reports two gosec findings that are clean on linux: - internal/config/permissions_open_nonlinux.go: G304 on os.Open(path). The file comment already explains why it is safe (fixBeadsDirPermissions re-checks descriptor identity before chmod); it just had no directive. - internal/utils/path_case_darwin.go: G103 on unsafe.Pointer. A directive existed but sat on the first line of a multi-line unix.Syscall call, while gosec reports the argument line four lines down, so it never covered the finding. It now sits on its own line above the statement, the placement cmd/bd/nocow_linux.go already uses. Add a GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 cross-lint block to pr-lint.sh mirroring the windows block (same flags, same lane scoping, skipped when the native target already matches), and update the three places that described the wrapper as two passes: engdocs/LINTING.md, engdocs/CI_CLEANUP_PLAN.md and the comment in main.yml. The darwin pass is compile-only on the Linux runner: no macOS runner, no change to the pr-lint platform column. Like the windows pass it is CGO_ENABLED=0, so darwin+cgo code stays outside its reach. * docs(linting): bump the Last reviewed marker alongside the pr-lint change |
||
|
|
cff62bd631 |
Make the pre-commit lint gate trustworthy, and stop one main-side lint word from reddening every PR (#5538)
* fix(githooks): build golangci-lint with the repo's Go, not golangci-lint's
The pre-commit hook ran `go run golangci-lint@v2.10.1`. For a pkg@version
build the go command honours the TARGET module's toolchain directive, so
GOTOOLCHAIN=auto downgraded to go1.25.12 — and golangci-lint built by
go1.25 refuses this repo's `go 1.26.5` at config load:
go: github.com/golangci/golangci-lint/v2@v2.10.1 requires go >= 1.25.0; switching to go1.25.12
Error: can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26.5)
Every Go commit failed there, so the hook taught six-plus contributors to
reach for --no-verify — the one habit a lint gate must never train.
CI never hit it because actions/setup-go installs the go.mod version and
exports GOTOOLCHAIN=local, so its `go install ...@v2.10.1` compiles the
linter with go1.26.5. Pinning GOTOOLCHAIN to the go directive reproduces
that resolution on any host, including one whose base toolchain is older
than the repo's target (where a bare GOTOOLCHAIN=local would pin the
linter to that older toolchain instead).
Verified on a real staged Go change: red before with the message above,
`0 issues.` after, and still exit 1 on a planted errcheck violation.
Bead: ga-2ltro.13
* ci: lint PRs for what they introduce, sweep the whole tree on main
Both PR lint gates linted the whole tree: the `lint` job left
only-new-issues at its false default, and pr-lint-wrapper ran
`make ci-pr-lint` over ./... . So a single lint word landing on main —
twice this wave, once a prose misspell — turned EVERY open PR red for a
change it did not make, and each author had to either fix someone else's
line or wait.
The tradeoff, recorded beside the job: a pre-existing issue in untouched
code no longer blocks a PR, and because "new" is measured off the diff, a
violation carried in by a MOVE or a rename does. What it buys is that a
main-side word now reds main's own run, where it belongs. main.yml
already runs both jobs unscoped on every push, so whole-tree coverage —
including the GOOS=windows cross-lint — is unchanged; only its blast
radius moves.
The wrapper takes its scope from BD_LINT_NEW_FROM_MERGE_BASE, set only
by pr.yml, so `make ci-pr-lint` run by hand still sweeps the tree. That
makes the local wrapper STRICTER than the PR gate rather than equal to
it, which is what LINTING.md and CI_CLEANUP_PLAN.md said before and no
longer would: both now state the two-lane contract and say the local
run's extra strictness is deliberate. Their freshness markers move with
the workflow and wrapper files they are pinned to.
Bead: ga-uwix0.2
---------
Co-authored-by: Julian Knutsen <ci@beads.test>
|
||
|
|
80b13798dc |
docs(lint): align contributor guidance with CI (saa-90w) (#5317)
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell |
||
|
|
0e017821f4 |
docs: move internal/maintainer docs from docs/ to engdocs/
Relocate contributor- and maintainer-facing material out of docs/ so the directory can become the user-facing Mintlify site. Moves preserve subpaths (adr/, design/, staged-for-removal/ intact). messaging.md, UI_PHILOSOPHY.md, and AGENT_SIGNING.md move per their DOC_INVENTORY dispositions (design doc, design philosophy, maintainer convention). Inbound links updated repo-wide: root guides, CONTRIBUTING, AGENTS, workflows, lint config, scripts (check-doc-freshness now resolves the inventory at engdocs/DOC_INVENTORY.md), Go comments, and the synced website metadata page (regenerated via sync-website-docs.sh + generate-llms-full.sh). The emitted help text in cmd/bd/init_safety_help.go still references docs/adr/0002-init-safety-invariants.md; changing it would change bd's runtime output, which is out of scope for this branch (flagged in the PR). |
Renamed from docs/LINTING.md (Browse further)