Repository navigation
Closed
Description
Weekly architecture run 2026-11-04, quality-gate rollout. The standard covers every active repo and works as a ratchet: it gates changed code only, so existing debt never blocks a PR.
Today (farzai/github-runner-railway at 68e3e6d)
Stack: Go controller and runner images.
CI: ci.yml on ubuntu-latest: go vet, go test -race, then image builds and smoke tests. No format check and no coverage.
| Gate | In CI today | To add |
|---|---|---|
| Lint and format | go vet only | gofmt -l (and golangci-lint if wanted) |
| Typecheck | yes: go vet and build | nothing |
| Tests, coverage must not drop | tests yes, coverage no | -coverprofile compared with the baseline |
| CRAP under 10 on changed functions | no | crapper (Go) |
| No new duplicate at 0.8 or above | no | dryer --threshold 0.8 |
| Mutation on changed files | no | mutator --changed |
| .quality/baseline.json | no | add |
Tools, checked on this repo on 2026-11-04
- CRAP: unclebob/crapper ran, exit 0; it runs
go test ./... -coverprofileitself. - Duplication: unclebob/dryer ran, exit 0.
- Mutation: unclebob/mutator
--scanparsedinternal/webhook/webhook.go, exit 0. Fallback: go-mutesting.
Baseline measured on 2026-11-04 (static run, tests excluded)
- Functions: 49. Over cyclomatic complexity 10: 11. Worst:
reconcile.Make(33),config.Load(25),ghapp.Client.call(19). - Duplicate pairs at 0.8 or above: 0.
- Coverage and mutation score were not measured here (they need a test run). Record them from the first green run of the new job.
Acceptance
- A
qualityjob in.github/workflows/ci.ymlruns on every pull request onubuntu-latestand adds at most about 5 minutes. -
gofmt -lis clean on the PR's changed files. - CRAP: the job fails when a function the PR adds or changes scores 10 or more. Functions the PR does not touch are not gated.
- Duplication: the job fails when the PR adds a pair at 0.8 similarity or above.
- Mutation: runs on the PR's changed files only (
mutator --changed). A surviving mutant fails the job unless the PR body says why it is equivalent. - Coverage is reported on every PR, and the job fails when repo coverage drops below the baseline.
-
.quality/baseline.jsonis committed with coverage, functions over CRAP 10, duplicate pairs and mutation score measured on the default branch. A PR that improves a number updates the file. - No threshold is lowered or gate removed to get a PR through.
Metadata
Metadata
Assignees
Labels
No labels
Activity
parsilver commentedon Nov 20, 2026
Moved to Ready and work has started: the quality job per the acceptance above, ratcheting changed code only. The controller images are not redeployed by this change.
parsilver commentedon Nov 20, 2026
Plan
A
qualityjob inci.yml(ubuntu-latest, every pull request, forks included since the repo is public and the job only reads) that runs one script,.quality/gate.py. The script follows the shape the other repos on the standard already use (crapper, dryer and mutator pinned to commits in.quality/requirements.txt), adapted to Go. It judges only what the PR adds or changes.Scope. Go source under
cmd/andinternal/, minus*_test.goandtestdata/. Changed lines come fromgit diff -U0 --numstat -zbetween the PR's base (HEAD^1of the merge checkout) andHEAD. Pure-deletion hunks add no line. An unsafe path name, a binary file, a symlink, or hunks that do not add up to git's count stop the gate rather than pass it.Checks
gofmt -llists a changed.gofile (tests included)Equivalent mutant: <file>:<line> <reason>paragraph. Budget sized to the change, 5 to 30 minutes, failing cleanly with a partial reportGo specifics found while checking the tools
go test -coverprofilewrites module paths (github.com/farzai/github-runner-railway/internal/...). At the pinned commit mutator matches a profile entry only when the checkout path ends with the module path, so on CI it marks every site UNCOVERED and mutates nothing. The gate therefore reads the raw profile and writes a repo-relative copy totarget/coverage/coverage.out, which both crapper and mutator read. Checked: with it,internal/webhook/webhook.gogoes from 15 uncovered sites to 15 killed.go test -count=1on its own package (mutator's default for Go) through a smallmutant-tests.shthat also logs each verdict, so a run stopped at the budget still reports what it finished. Mutants run in parallel, one worker per CPU from the cgroup quota when there is one.Coverage rule. The issue asks for a failure when repo coverage drops below the baseline. The engineering quality standard (2026-11-04) reads that as "no new uncovered code": a drop caused only by deleting covered code does not fail a PR. I follow the standard: changed lines must be covered, the repo total is reported and ratcheted in
baseline.json. Flagging it here in case you want the stricter reading.Baseline measured on main and committed in
.quality/baseline.json: line coverage of the scope, functions measured and over CRAP 10, duplicate pairs at 0.8, and a full mutation run (sites, killed, survived, score).Invariants not to break
test,images,exampleand variant jobs stay as they are.imagesdoes not depend onquality.Tests
python -m unittest) run in the job before the gate: changed-line parsing incl. pure deletions and unsafe names, Go profile parsing and line hits, the CRAP ratchet (new, under on base, over and no worse, over and worse), duplicate matching, waiver parsing from rendered HTML, mutation budget and scan parsing.qualityjob green on the PR itself.parsilver commentedon Nov 20, 2026
In progress. The gate's self-tests are pushed on
feat/43-quality-gateswith draft PR #54; next come the gate, thequalityjob and the measured baseline.Plan review changes, on top of the plan above:
mutator --changed, which readsgit statusand so finds nothing on a clean CI checkout. Coverage follows the standard's "Coverage on deletions" section; review, not the gate, keepsbaseline.jsonfrom getting worse.Equivalent mutant:paragraph also waives one uncovered line, so a change tofunc main(no test runs it) can pass with a stated reason.persist-credentials: false, gives setup-go and setup-python no token, and sets its permissions explicitly. A PR runs its own copy of the gate, so review of.quality/and.github/stays the control..quality/README.mdand the CI line inCONTRIBUTING.md.ci.ymlmakes the images job rebuild all six images, and a merge pushes their sha tags to GHCR. Nothing deploys.parsilver commentedon Nov 20, 2026
Ready for review: #54. The
qualityjob is green on the PR (59 s, all checks passing),baseline.jsonis measured on main, and the PR body lists each acceptance criterion with its evidence. It waits on review and merge.Notes:
relative_profilein.quality/gate.py).func mainhas no test, so a PR that changes it needs a waiver line or a refactor to pass Coverage.baseline.json). Each is worth its own refactor issue.