Skip to main content

Ratchets and quality gates

A ratchet records today's number in a baseline file and fails when a change makes it worse. Improvements are locked in with --update.

Who runs --update

Only the owner runs --update on a baseline. If your change improves a number, say so in the PR. If it makes one worse, fix the change, or explain why in the PR and ask.

GateCommandMeasuresBaseline
Kernel boundarymake check-kernel-boundaryApp crates that reach tenancy, authorization, audit, sequences, storage or config without going through medbrains-kernelcrates/medbrains-kernel/boundary.txt
Kernel has no domainmake check-kernel-no-domainNo domain crates below the kernel and no hospital words in itnone: any hit fails
Size budgetsmake check-size-budgetsKernel lines and dependencies, package and crate counts, web first-load sizescripts/size_budgets.json; a new kernel dependency needs a reasoned hand edit
UI slopmake check-ui-slopDecorative effects in the web app; any rise failsscripts/ui_slop_baseline.json
File lengthpython3 scripts/check_file_lengths.pyLines per .rs, .ts, .tsx, .scss file (450 by default)none; not wired into CI yet
Coverage ledgermake coverage-ledger-checkEnd-to-end coverage per modulescripts/coverage_ledger.baseline.json
Authz ledgermake authz-ledgerAuthorization conformance per module on four axesreports only, does not gate
Sonarsonarqube.ymlCode quality, duplication, hotspots, web coverageignores in sonar-project.properties; not a required check

Other ratchets with baselines: UI permission match, soft-delete filters, tenant leaks and runtime SQLx calls. The CI contracts job runs the kernel, size-budget and UI-slop checks.

Why ratchets​

A hospital system grows by hundreds of files a month. A rule enforced only on new code lets the old debt stand; a ratchet lets the debt only shrink, without blocking work on a big-bang cleanup.