Repository navigation
perf(ci): check only the Go packages a PR can affect - #27
Merged
Merged
Conversation
jayleaton
marked this pull request as ready for review
October 22, 2026 09:01
scripts/affected.sh maps changed files to packages (go list file and embed lists, nearest package dir otherwise) and adds every package whose code or tests import them (go list -test -deps). PR runs build, lint, test and coverage-check only those, and rerun only the generators whose inputs or outputs changed (sqlc, templ, per-package go:generate). go.mod/go.sum, tools, scripts, workflows, lint config, Makefile, migrations and sqlc config force a full run, as do pushes to main, the merge queue and manual runs. The layering and test-boundary probes run on full runs, which is when their inputs change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adminrepo has its own queries and generated packages in the same sqlc.yaml; a change there must rerun sqlc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jayleaton
force-pushed
the
perf/ci-affected
branch
from
October 22, 2026 09:06
1793fdb to
8037604
Compare
This was referenced Oct 22, 2026
Merged
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.
Problem
Every PR that touched Go ran the whole suite: build, lint and
go test -race ./...across all packages, and every generator. With ~200 PRs/day and all full checks now running on Actions, that costs wall time and minutes. For example, a one-line change inapps/web/uilinted and testedpackages/auth,packages/databaseand the API.How
scripts/affected.sh(bash +go list, about 2 s in CI) writesfull,packages,dirs,sqlc,templandgenerateoutputs.make affectedprints them locally, andAFFECTED_FILES=…takes an explicit file list.HEAD^1is the base.check-coverage.shtakesTESTED=<pkgs>and checks only floors of packages that were tested. An affected floor package still has to be in the profile.scripts/,.golangci.yml) change. The cheap test-location check always runs.packages/database/adminrepoand its sqlc packages are handled by the same package graph. sqlc query/output paths are read fromsqlc.yaml, so adminrepo query changes rerun sqlc. adminrepo migrations force a full run. The admin layering probes and test-boundary probes run on full runs, and the adminrepo/admin coverage floors are checked when those packages are affected. Both UIs are templ-generated when a.templchanges.Evidence
Scratch PRs, all four of each phase run at the same time. Before: #18–#21 against main's workflow. After: #22–#25 stacked on this branch, so only the scenario change is in their diff. All are closed; branches and caches deleted.
docs/BUILD-PLAN.md)apps/web/ui/helpers.go)packages/auth/password.go)apps/admin/internal/services/services.go; #29 → #30, after rebase onto #26)full run: go.mod); same work as before, the difference is runner variancepackages/authfunction used only byapps/web/cmd/servermade CI fail in Build withapps/web/cmd/server/main.go:155:68: undefined: auth.MobileTrustedOrigins, and ci-ok went red. Dependents are checked, not just the changed package.AFFECTED_FILES(docs, mobile, web/templ, services, hand-edited mocks, SQL query, embedded template, go.mod).actionlintis clean; gofmt,go vet ./...andgo build ./...pass. Full checks ran on Actions under the compute rule; this PR's own run is a full run, since it changes the workflow and scripts.Merge Danger
Door: two-way. Reverting the workflow restores full PR runs.
Blast Radius: CI.
🤖 Generated with Claude Code