Repository navigation
Closed
Description
Quality-gate rollout, weekly architecture run 2026-11-18. The engineering quality standard covers every active repo and works as a ratchet: it gates changed code only, so existing debt never blocks a PR.
Today (farzai/tether at 41d3e6c)
Stack: Bun 1.4.2 and TypeScript (tsc), Biome, Vitest, Ajv: the protocol schemas, the CLI client and the conformance runner.
CI: ci.yml check on ubuntu-latest and macos-latest, push to main and every pull request: biome check, tsc --noEmit, Vitest (on macOS also the real launchd service test).
| Gate | In CI today | To add |
|---|---|---|
| Lint and format | yes: Biome | nothing |
| Typecheck | yes: tsc --noEmit |
nothing |
| Tests, coverage must not drop | tests yes; no coverage in CI (bun run coverage exists) |
run Vitest --coverage in CI, compared with the baseline |
| CRAP under 10 on changed functions | no | crapper (TypeScript) |
| 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-18
- CRAP: unclebob/crapper ran on
srcwith--no-coverage, exit 0, TypeScript detected. Coverage needs--coverage-commandwith the Vitest lcov output. - Duplication: unclebob/dryer
--threshold 0.8ran onsrc, exit 0. - Mutation: unclebob/mutator
--scanparsedsrc/protocol/urls.ts(7 sites), exit 0.
Baseline measured on 2026-11-18 (static run, tests excluded)
- Functions: 242 in
src. - Over cyclomatic complexity 10: 0.
- 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-latest(one OS is enough for the quality job) and adds at most about 5 minutes. - CRAP: the job fails when a function the PR adds or changes scores 10 or more. A function that already scored 10 or more on the base passes when its score is no higher than on the base; 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 --test-command "bun run test"), with a time budget that fails cleanly and still publishes the partial report. A surviving mutant, or a changed executable line no test runs, fails the job unless the PR body says why, line by line. - Coverage is reported on every PR; changed lines must be covered, and the repo total is compared with 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 (that needs an owner decision).
Metadata
Metadata
Assignees
Labels
No labels
Activity
parsilver commentedon Nov 18, 2026
Moved to Ready and started: add the coverage, CRAP, duplication and mutation gates with a baseline.
parsilver commentedon Nov 18, 2026
Plan for the quality gates.
Approach. Port the changed-line gate already running in buildboard (
.quality/gate.pywith its self-tests), adapted to Vitest, and add aqualityjob toci.ymlonubuntu-latestfor pull requests only. Everything lives in.quality/plus that one job, so one revert removes it.vitest run --coverage(v8, lcov) itself after deleting any old report. Every executable line the PR adds or changes undersrc/must have a hit. The repo total (lines and functions,src/only) is reported against.quality/baseline.json; a drop alone does not fail (deleting covered code can cause it), a rise asks for the baseline update.--threshold 0.8, pinned): fails when a pair touching a changed line is new compared with base.vitest related --run --bail=1for the file, then the whole suite only for a survivor (the CLI entry points are run as subprocesses, whichrelatedcannot see). Budget sized to the change, 5 to 30 minutes, fails cleanly and still prints the partial report. A changed executable line with 0 hits counts like a survivor.Equivalent mutant: <file>:<line> <reason>as its own paragraph in the PR description, read from GitHub's rendering fetched before any PR code runs (hash pinned), one line per waiver.src/, measured on main at41d3e6c.Invariants. No threshold lowered. No token reaches a step that runs PR code. Tests under the gate never install a real launchd agent (
TETHER_REAL_SERVICEis dropped). The existingcheckmatrix is unchanged.Tests per criterion.
parsilver commentedon Nov 18, 2026
Started. The gate, its self-tests and the Vitest mutant command are on the draft PR #21. Next: the quality job in ci.yml and the baseline measured on main. The plan above was reviewed with fresh eyes; the changes from that review: a file with no related tests or a broken test harness can never count as a killed mutant, the gate and every mutant run with the keychain off and the real launchd test dropped, and the CLI entry points (only run as child processes) are judged line by line with waivers.
parsilver commentedon Nov 18, 2026
PR #21 is ready for review. The quality job passes on its own PR (1m15s: self-tests, then coverage, CRAP, duplication, mutation), and check passes on both OSes at 73beec5. The baseline is recorded from main at 41d3e6c: lines 97.11%, functions 98.96%, 242 functions with none over CRAP 10, no duplicate pairs, mutation score 81.3% across all 636 sites. An end-to-end local run on a throwaway src change caught a real (equivalent) survivor. Not yet seen on CI: a PR that changes src/ lines, and a live waiver.
Notes:
test/service-real.test.ts:93(launchctl print right after bootout) andtest/cli.test.ts"kills the agent on timeout" are flaky; both failed once and passed on re-run while this was built.