0017 - Codebase Fitness Functions as a Policy Layer over Existing Checks¶
Status¶
Accepted 2026-10-19 by the owner in Taskbase decision task #1201: option C, with the gate shortened to four weeks of the pilot running (see Decision). Evaluated in Taskbase task #1200, from request #1199 by dunk; decision recorded in task #1207. The findings below are the evaluation as measured on 2026-10-19 and are left unchanged. This record changes no code or CI in any repository; the work is planned from it (Phase 1: epic #64).
- Research notes: 0017-codebase-fitness-functions-notes/ (measurement log, commands, raw counts, source retrieval log)
- Pilot gate, 2026-11-16 (task #1216): evaluation. The gate is passed because the reviewer uses the lists. The runner itself blocked one change in four weeks. Keeping the runner or dropping it is decided in #1217.
Date¶
2026-10-19
Decision¶
Option C, introduced in phases, with the gate after four weeks of the pilot running instead of eight. The owner's answer in #1201, 2026-10-19:
C, with a shorter gate — 4 weeks instead of 8. Phase 1: wire existing checks into CI and keep a short expectation list per repository (checked vs documented-only, the latter marked as not verified). Phase 2: pilot a small runner in Taskbase with about eight expectations, distinct exit codes for pass, violation and tool error, limits changed only by pull request. Gate after four weeks of the pilot running: it blocked a change tests and reviewer would have let through, or the reviewer uses the list; otherwise drop the runner. Phase 3: generalise only after the gate. Conditions: never remove an existing lint or test step; a tool that fails to run is never counted as zero findings; no automatic ratchet; documented-only expectations never shown as verified.
Option C below describes the phases; its gate has been changed to match this answer. The Phase 1 expectation lists follow the format in the next section.
Expectation list format¶
Every repository's Phase 1 list has the same shape, so the lists read alike and a Phase 2 runner can read them later.
- Where. A file
FITNESS.mdat the repository root. Where a repository forbids Markdown documents (Taskbase, by itsCLAUDE.md), a## Fitness expectationssection in its instruction file instead. - One table, with these columns in this order:
| Column | Content |
|---|---|
| id | Short stable identifier, unique in the repository |
| expectation | What must hold, in one sentence |
| category | What kind of expectation it is, for example convention, structure, dependency, size |
| check | The exact command or CI job that checks it, or not verified |
| limit | The count of findings allowed today; 0 for a pass/fail check |
| guidance | What to do when it fails, or a link to the page that says |
- Documented-only rows say not verified in the check column and are never described as checked, in the list or anywhere else.
- Limits change only through a pull request that edits the list. There is no automatic ratchet; the reviewer treats a raised limit as a decision to call out.
- A check that fails to run is a tool error, never zero findings.
Example rows (illustrative; the real rows come from each repository's Phase 1 task):
| id | expectation | category | check | limit | guidance |
|---|---|---|---|---|---|
| helmrelease-remediation | Every HelmRelease in components/ sets install and upgrade remediation |
convention | not verified | 0 | See Conventions |
| go-vet | go vet reports no findings |
correctness | go vet ./... |
0 | Fix the reported finding |
Context¶
Scope¶
Question. Can automated codebase fitness functions, as the concept below defines them, be applied generically across every Skatzi repository that contains software, and is introducing them worth the effort? Decision it informs: the owner decides in #1201 whether to introduce them, and on what conditions; the project manager then plans any implementation.
The concept (request #1199). A fitness function is an explicit expectation about a codebase that can be checked repeatedly, so that architectural drift and quality regressions are caught as developers or AI agents change the code. Expectations are declared (for example in YAML) with a title, a category, the checking tool, the relevant rule ids, an allowed violation count and optional corrective guidance. Tool adapters run existing linters, type checkers or custom checks and translate their output into standardized findings; a central runner maps findings to expectations; an expectation passes when its finding count is at or below its limit; the checks run locally and in CI. Four distinctions are part of the concept and this evaluation keeps to them:
- It is a policy layer over linters and tests, never a replacement for them.
- A tool execution error (the tool did not run or crashed) is distinct from a policy violation, and is reported and handled differently.
- Limits may accommodate existing debt, but are lowered only by an explicit change; there is no automatic ratchet.
- An expectation without an automated check may be documented, but is never presented as automatically verified.
In scope. The five repositories with software in the Skatzi organization: Skatzi/platform, Skatzi/taskbase, Skatzi/agent-runner, Skatzi/skatzi-agents and Skatzi/emiliero (infra-manager has no repository). For each: whether the concept applies, which existing tools could be adapters and what each would need to emit standardized findings, the expectations checkable automatically today with their current violation counts, and the expectations that could only be documented. Across repositories: whether one runner and one expectation format can serve Go, JS/TS, YAML/Kubernetes and Markdown; off-the-shelf options against a small in-house runner; benefit against cost.
Out of scope. Implementing a runner, adapters or a prototype; replacing existing linters or tests; quiet.sh (a separate concept that runs commands sequentially and shows diagnostics only on failure); choosing an implementation (the options are presented with trade-offs, and #1201 decides).
Sources and method. Each repository was cloned at its current head on 2026-10-19 and its languages, CI workflows, build files, lint configuration, tests and documented conventions were read. Where a tool was available or could be run without changing a repository, the candidate expectations were measured read-only and the raw counts are in the research notes. Off-the-shelf tools were checked against their own documentation pages, retrieved the same day. Findings are graded Shown (a primary source states it), Indicated (several sourced facts point that way) or Plausible, not shown (consistent with the evidence, untested).
Assumptions. (a) "Worth the effort" is judged for a team of one owner plus AI agents producing most pull requests, as the recent history of all five repositories shows; (b) CI time is a cost only above roughly two added minutes per pull request, since every repository already runs a multi-minute pipeline; © the counts measured here are the limits a first expectation file would start from; (d) checks that need Harbor credentials (the platform manifest render) count as "checkable today" because CI already runs them, even though they were not re-run locally.
Deliverable. This record, its research notes, and the options for #1201.
Summary¶
Answer: yes, the concept applies generically, and introducing it is worth the effort only in phases with a gate (Indicated). Every one of the five repositories already has checks that produce countable, rule-tagged findings or pass/fail results, and Taskbase already contains about seventeen fitness functions written as ordinary tests, so no new checking technology is needed. What is missing is not tools but the policy layer: a reviewable list of expectations with limits, and in several places the existing checks are not even wired into CI. The cheapest value lies there, and it needs no runner. A small runner is justified only if a pilot in one repository shows it catches drift that reviewers and tests miss. The findings that carry this:
- Every repository can be served by adapters over tools it already uses or that run read-only today, and all of them emit machine-readable output or a countable pass/fail (Shown, F1).
- Drift that a written expectation would have caught exists today in four of the five repositories (Shown): five of sixteen platform HelmReleases lack the rollback strategy that the repository's own convention requires; Taskbase's UI tests, lint and type check run nowhere in CI; Taskbase holds ten Markdown documents under a
CLAUDE.mdrule that forbids them; three of nine Go files in emiliero are not gofmt-formatted; one persona breaks the section order the skatzi-agents README prescribes (F2). - Taskbase already practises the concept without the policy layer (Shown): fifteen UI tests read source files and assert conventions, and two authorization tests hold the route table and the registered routes to each other (F3).
- Off-the-shelf tools cover the checking but not the policy layer (Shown for each tool, Indicated for the gap): golangci-lint, ESLint, dependency-cruiser, go-arch-lint, conftest, Semgrep and MegaLinter all check and all emit JSON or SARIF, but none offers a per-expectation limit, a tool-error distinction across tools, or an expectation file that also lists documented-only expectations (F4).
- The cost is dominated by custom checks and limit maintenance, not by CI time (Indicated): the measured tools finish in seconds, but every custom rule written during this evaluation needed a second pass to remove false positives (F5).
Findings¶
F1. One runner and one format can serve all five repositories¶
Finding. The checks that exist or can run today in the five repositories reduce to one shape: run a command, parse its output into findings tagged with a rule id and a location, count them, and compare the count with a limit. Every tool measured below either emits JSON, emits a line-oriented text format with a rule id, or is a test whose pass/fail count is the finding count. Grade: Shown for the output formats (each tool's own documentation or its observed output, sources S8–S20 and the measurement log); Indicated for "one runner serves all", since no runner was built.
| Tool | Where used today | Output a runner can consume | Rule ids |
|---|---|---|---|
go vet |
taskbase api+mcp, agent-runner, emiliero CI | -json |
analyzer name |
gofmt -l |
none in CI (measured here) | file list | one implicit rule |
| staticcheck | none (measured here) | -f json |
SA…, ST…, U… |
| golangci-lint | none | json, sarif output formats (S11) |
linter + rule |
| ESLint | taskbase npm run lint (not in CI) |
-f json (S16) |
rule name |
tsc |
taskbase npm run typecheck (not in CI) |
text, one line per error with TS code |
TSnnnn |
vitest / node --test |
taskbase, emiliero | JSON and TAP reporters; test name is the expectation | test name |
go test |
all Go modules | -json |
test name |
| kubeconform | platform ci-manifests, agent-runner helm job |
-output json (S19) |
schema path |
helm lint --strict |
agent-runner | text | message |
| yamllint | none (measured here) | -f parsable with rule in parentheses |
rule name |
| markdownlint-cli2 | none (measured here) | pluggable formatters incl. JSON (S20) | MDnnn |
| custom scripts (Python, Node, Go) | taskbase guard tests, agent-runner chart check, platform render script | whatever the script prints | script-defined |
SARIF 2.1.0 (S17) is the standard interchange format for exactly this and separates results from toolExecutionNotifications, which is the concept's tool-error distinction in standard form. A runner that reads SARIF from the tools that emit it (golangci-lint, Semgrep, MegaLinter) and converts the rest would not need its own schema. The simpler alternative is one small internal findings record (tool, rule, file, line, message) that each adapter fills in; that is what an in-house runner would do.
Documented-only expectations fit the same file. An expectation with check: none carries a title, category and guidance but no tool, and the runner lists it as "documented, not verified" rather than passing it. This keeps distinction 4 and keeps the inventory in one place, which is the part of the concept no existing tool provides.
F2. Measured drift today¶
Each repository was checked against its own written conventions and against the standard tools. The counts are the state at the heads listed in the research notes; they are the limits a first expectation file would start from. Grade for each count: Shown (measured, commands and raw output in the notes). Grade for "a fitness function would have caught it": Indicated for the convention checks (the convention is written, the check is mechanical), Plausible, not shown for whether a reviewer would have let it through anyway.
Platform (Skatzi/platform, head bdee22a)¶
Languages: Kubernetes YAML (216 files under components/ and cluster/), Terraform (35 files), Markdown (83 pages), one Python render script, Dockerfiles. CI: ci-manifests.yaml renders every cluster with kustomize and helm and validates with kubeconform on every pull request; the docs image is built only on a tag, so the docs site is not built for a pull request; Terraform validate runs only inside the manually dispatched plan and apply workflows; there is no YAML, Markdown or link check. Written conventions (docs/content/contribution/onboarding/conventions.md): manifest files are named after their kind, same-kind manifests share one file, every HelmRelease sets install and upgrade remediation with strategy: rollback, and cluster-specific values never sit in components/.
| Expectation | Check | Count today |
|---|---|---|
| Rendered manifests validate against their schemas | kubeconform in ci-manifests |
0 (CI gate; not re-run locally, helm and kustomize are absent on this machine) |
Every HelmRelease in components/ sets upgrade remediation.strategy: rollback |
custom YAML walk | 5 of 16 lack the strategy (argocd, prometheus-stack, hetzner-csi, canary-checker, agent-runner runner); all 16 set retries |
| Manifest files are named after a kind they contain | custom YAML walk, lenient (hyphens ignored, prefix and plural allowed) | 23 of 133 (strict kebab-case as the convention literally reads: 85) |
| Same-kind manifests in one file per directory | custom YAML walk | 3 directories |
No literal prod.skatzi.com hostname in components/ |
grep | 49 lines in 21 files |
| YAML style | yamllint, default rules | 4,023, of which 3,274 are line-length in the vendored Gateway API CRD file; 368 outside crds/ and realm imports |
| Markdown style | markdownlint-cli2, default rules | 6,876, of which 5,176 are line length (MD013) |
Relative links in docs/content resolve |
custom link walk | 1 real (ADR-0002 links ../../../docs/Dockerfile), plus 3 the check cannot judge |
| Every ADR is listed in the ADR index | custom | 0 (the template file is unlisted by design; it is also empty, 0 bytes) |
| Terraform is formatted and valid | terraform fmt -check, validate -json |
not measured: terraform is absent on this machine |
Adapters needed: the existing render script plus kubeconform (a render failure is a tool error, a kubeconform finding is a violation); a small YAML-walking script for the four structural conventions (or conftest with Rego over the rendered output, S14); yamllint; markdownlint-cli2; a link checker. The first HelmRelease count is a real conflict: either the five releases change or the convention text does, and a limit of 5 with the list in the guidance would make that choice explicit and reviewable.
Documented only (no automated check exists today): "cluster-specific values belong at the cluster level" in general (the hostname grep is a partial proxy; replica counts and credential paths are not detectable without judgement); "components are generic"; "documentation is updated in the same pull request"; the deployment order in each cluster root is correct; ADR status words follow one workflow.
Taskbase (Skatzi/taskbase, head 3f95930)¶
Languages: Go API (api/, Go 1.24, 343 files, 25 internal packages), Go MCP server (mcp/, Go 1.25, 26 files), React UI (JS and JSX, 86 test files; a TypeScript corner in ui/src/diagramLayout). CI (ci.yaml): tidy, build, test and vet for api/ and mcp/, plus a shell test of the prod promotion gate. No job runs npm test, npm run lint or npm run typecheck; the UI image build runs npm ci and npm run build only. Documented architecture (platform docs, Taskbase API architecture, S6): one package per resource, each with a Store interface, an in-memory store for tests and a PostgreSQL store; CLAUDE.md says no Markdown documentation is created in the repository.
| Expectation | Check | Count today |
|---|---|---|
go vet clean (api, mcp) |
CI | 0, 0 |
| gofmt clean | gofmt -l |
0, 0 |
| staticcheck clean | staticcheck v0.8.2 | api 6 (U1000 2, ST1018 2, ST1005 1, SA4006 1); mcp 4 (ST1005) |
| ESLint clean | repo config, eslint src |
2 (no-unused-vars, warnings) |
| TypeScript corner type-checks | npm run typecheck |
0 |
| UI guard tests pass (colour tokens, themes, spacing, selects, a11y landmarks, …) | node --test, vitest |
0 failures in the three named tests (14 tests); 15 test files read source files |
| Every registered route has an authorization rule, and the table has no stale route | TestGuardRouteTableMatchesRegisteredRoutes, TestEveryRegisteredRouteIsAuthorized |
0 |
PostgreSQL stores are referenced only by cmd/server/main.go and their own package |
go list import walk, grep |
0 cross-package references; 28 in main.go |
| Non-test Go files stay under 1,000 lines | wc -l |
api 6 (largest runner/store_pg.go, 1,943) |
| UI source files stay under 1,000 lines | wc -l |
2 (App.jsx 5,592; DiagramCanvas.jsx 1,063) |
No panic( outside tests; no os.Exit outside main |
grep (forbidigo in golangci-lint does the same, S10) | 2; 1 |
No Markdown documentation in the repository (CLAUDE.md) |
git ls-files '*.md' |
10 files under docs/, one of which ADR-0012 links to |
| Dependency direction between internal packages | none written | not checkable: no rule is documented (the import graph is in the notes: runner and sessionframe each import eight sibling packages) |
Adapters needed: go vet -json, staticcheck or golangci-lint JSON, ESLint JSON, a tsc line parser, a test reporter that maps named tests to expectations, and the import walk (go-arch-lint, S9, or golangci-lint's depguard, S10, once a rule is written).
Documented only: the OpenAPI document matches the registered routes; schema docs are updated with each migration; "the chat changes nothing by itself" and the other behavioural rules of ADR-0013 to ADR-0016 (tests cover parts, no check covers the rule); the UI design direction page.
agent-runner (Skatzi/agent-runner, head 41bb238)¶
Languages: Go (183 files in the runner module, 55 in desktop/, 42 with build constraints), shell scripts, a Helm chart, 17 Markdown pages. CI (ci.yml): build, vet and test on Linux, Windows cross-build and vet, macOS build and full test on the Mac mini runner, the NSIS installer, and scripts/check-helm-chart.sh, which lints the chart strictly, renders each CI values file, validates with kubeconform and loads the generated config with the runner itself. The chart check also asserts that the chart's copy of the Claude MCP template equals templates/claude-mcp.json, a fitness function in all but name.
| Expectation | Check | Count today |
|---|---|---|
go vet and gofmt clean (runner, desktop) |
CI; gofmt -l |
0, 0; 0, 0 |
| staticcheck clean | staticcheck v0.8.2 | runner 2 (U1000, ST1005); desktop 11 (ST1005 10, U1000 1) |
| Windows and macOS files compile | CI cross-build and macOS job | 0 |
| Chart renders, validates and loads with the runner | check-helm-chart.sh in CI |
0 (not re-run locally, helm is absent) |
Internal packages keep their direction (config imports only secrets; runner never imports adapter) |
go list walk |
0 today, but no rule is written |
| Non-test Go files stay under 1,000 lines | wc -l |
0 (largest main.go, 938) |
No os.Exit outside main |
grep | 3 |
Adapters: the same Go adapters as Taskbase; the chart script already distinguishes a tool error (set -e, exit 1 on a missing tool) from a check failure only by message, so an adapter would wrap it.
Documented only: "secret values never appear in logs, status --json or command arguments" (docs/secrets.md); a session turn runs with no clone, shell, file or web tools (docs/chat-turns.md); the runner updates only from signed releases. A Semgrep taint rule could approximate the first (S12); none of the three has a check today.
skatzi-agents (Skatzi/skatzi-agents, head 8ef1907)¶
Languages: Markdown only (10 persona files, README, CREDITS, one survey). There is no CI; .gitea/workflows/ does not exist. The only gate is Taskbase's sync, after merge: ParsePersona accepts only name, description, kind and default_model, and a persona with any other key is skipped, so a bad frontmatter disappears from Taskbase silently rather than failing a pull request. The README prescribes the frontmatter keys, that filenames match name, the section order Role, Responsibilities, Out of scope, Workflow, Output, neutral verbs, and no model names.
| Expectation | Check | Count today |
|---|---|---|
| Frontmatter has only the four allowed keys | custom script (mirrors parse.go) |
0 |
Filename equals name |
custom | 0 |
| Sections in the prescribed order | custom | 1 (project-manager.md has an extra top-level section, Requests from a project's request box, between Responsibilities and Out of scope) |
| No model named in a persona body | word list | 0 real; a naive regex gave 4 false positives on CLAUDE.md file references |
| Persona length budget (prompt cost) | word count | 0 at a 3,000-word limit (longest senior-developer.md, 2,792) |
| Markdown style | markdownlint-cli2, default rules | 515 (MD013 333) |
Adapters: one small script (Node or Python) for the structural rules, or a Go command in Taskbase that exposes ParsePersona so the repository and the sync use one parser; markdownlint-cli2; a prose linter such as Vale for the verb rule (not evaluated). The concept applies here as much as to code, and the value is highest relative to effort because today nothing runs before merge.
Documented only: neutral verbs and no runtime affordances (a word list catches some); procedures from outside skills are rewritten and credited in CREDITS.md; the description is phrased as a routing rule.
emiliero (Skatzi/emiliero, head f7e9f52)¶
Languages: Go API (9 files, 1,698 lines), React UI (App.jsx 1,538 lines, index.css 2,139 lines, one test file with 6 tests), 10 Kubernetes manifests under deploy/prod/. CI (ci.yaml): API tidy, build, test, vet; UI npm ci, npm test, build. No ESLint configuration, no type check, no manifest validation.
| Expectation | Check | Count today |
|---|---|---|
go vet clean |
CI | 0 |
| gofmt clean | gofmt -l |
3 of 9 files (cmd/server/main.go, internal/db/db.go, internal/imaging/resize.go) |
| staticcheck clean | staticcheck v0.8.2 | 5 (all U1000, unused code) |
| ESLint clean | Taskbase's config with Node globals, run ad hoc | 5 (no-unused-vars 4, no-undef 1) |
| UI tests pass | vitest, CI | 0 failures (6 tests) |
| Source files stay under 1,000 lines | wc -l |
2 (App.jsx, index.css) |
| Manifests validate | kubeconform | not measured (absent locally; not in CI) |
Adapters: the same Go and JS adapters as Taskbase; kubeconform for deploy/prod/. The concept applies; the repository is small enough that an expectation file would be short, and the gofmt and unused-code counts are the kind of regression an agent introduces in one change and nobody notices.
Documented only: Danish UI text throughout; images are processed line art; access limited to the Keycloak members group (the code checks it, no test asserts it, not verified here).
F3. Taskbase already has fitness functions as tests¶
Fifteen of the 86 UI test files read source files with readFileSync or readdirSync and assert a convention over them: tokens.test.js forbids literal colours outside the token blocks of app.css and in JSX; Spacing.test.jsx requires every <select> to use the shared style; themes.test.js pins the theme list; the a11y tests check landmarks and scrollable regions. In the API, routes_test.go holds the guard's route table and the registered routes to each other in both directions. The agent-runner chart script does the same for the MCP template copy. Grade: Shown (the files, read 2026-10-19).
What these lack is only the policy layer: each limit is 0 and lives in the test; there is no list of them, no category, no corrective guidance beyond comments, and a failing one looks like any other failing test. They also show the cheapest adapter: a test runner's reporter, where the expectation is the test name. This matters for the options below, because the repository with the most expectations already has a working mechanism that costs nothing extra.
F4. Off-the-shelf tools check; they do not govern¶
Each candidate was checked against its own documentation on 2026-10-19 (sources S8–S18). Grade: Shown for what each does; Indicated for the gap, which follows from reading all of them and finding no per-expectation limit in any.
| Option | Languages | What it gives | What it does not give |
|---|---|---|---|
| golangci-lint (S10, S11) | Go | one runner for staticcheck, depguard (import rules), forbidigo (forbidden identifiers), funlen, lll and more; JSON and SARIF output; max-issues-per-linter and new-from-rev |
limits are caps on reporting or a diff baseline, not reviewable counts per expectation; new-from-rev hides debt instead of counting it |
| ESLint (S16) | JS/TS | max-lines, no-restricted-imports, JSON output, --max-warnings |
one global warning budget, not per rule |
| dependency-cruiser (S8) | JS/TS | dependency rules (forbidden, allowed) in a config file, JSON output, graphs |
JS/TS only; the Taskbase UI has few modules to rule over |
| go-arch-lint (S9) | Go | architecture rules in .go-arch-lint.yml (components, allowed dependencies), JSON output, made for CI |
Go only; no rule is written yet in any Skatzi module |
| conftest / OPA (S14) | YAML, JSON, HCL, Dockerfile | Rego policies over structured config, deny rules, JSON output |
a policy language to learn; best on the rendered manifests, which needs the render step first |
| Semgrep (S12, S13) | Go, JS/TS, YAML, generic text | YAML rules, custom patterns, --json and --sarif, --error to fail |
not type-aware in the open-source engine; another runtime (Python) in CI; no limits |
| MegaLinter (S15) | 100+ linters | one Docker image, SARIF reporter, GitHub Action | heavy image; default rule sets produce the thousands of findings measured above; Gitea Actions support not verified; still no per-expectation limits |
| ArchUnit, ArchUnitNET, ts-arch (S18) | Java, C#, TypeScript | architecture rules as unit tests | Java and C# are not used here; ts-arch is the same pattern Taskbase already follows with plain tests |
| Tests as fitness functions (F3) | any | zero infrastructure, runs in existing CI, tool error and failure are naturally distinct (a crashing test is an error) | no limits above 0 without encoding the number in the test; no inventory; no documented-only entries |
| Small in-house runner | any | the concept exactly: one expectation file per repository, limits, categories, guidance, documented-only entries, a tool-error exit code | code to write and keep (adapters for about ten tools), one more thing for agents to learn, needs a home repository and a distribution method |
None of the off-the-shelf tools gives per-expectation limits that a reviewer changes by a visible diff, the cross-tool tool-error distinction, or a single inventory that also holds documented-only expectations. Those three are the concept's substance. They are also small: the runner is a loop over an expectation list that runs a command, parses, counts and compares.
F5. Cost drivers¶
Grade: Indicated (from the measurements and the time this evaluation took; no implementation was timed).
- CI time is not the cost. staticcheck,
gofmt -l, ESLint,tsc, yamllint, markdownlint and the custom scripts each finished in seconds on these repositories. The expensive steps (npm ci, the manifest render with helm, the macOS job) already run. - Custom checks are. Every custom rule in this evaluation needed a second pass: the kind-naming check gave 85 then 23 depending on how literally the convention is read; the model-name regex gave 4 false positives; the link check gave 3 it could not judge; the first staticcheck release tried could not read the local Go toolchain at all (a tool execution error, not a finding, and the reason distinction 2 matters). Each custom rule is code someone maintains.
- Limits need an owner. A limit of 5 HelmReleases or 368 yamllint findings is honest only while someone decides, per pull request, whether a change that raises it is acceptable. With no ratchet, limits drift upward unless the review (human or the reviewer persona) treats a raised limit as a decision.
- Default rule sets are noise. yamllint and markdownlint at defaults produce 4,023 and 6,876 findings; a first expectation file either configures them down to the rules that matter or sets large limits that mean little. Either is work.
- Benefit is real but modest per repository. The drift found (F2) is the kind agents introduce; four of five repositories have examples today. Whether the reviewer persona becomes cheaper with an executable list is plausible, not shown: the reviewer reads the architecture docs today and would read an expectation file instead.
Options and recommendation¶
Options¶
Option C (recommended): introduce in phases, with a gate before any runner.
- Phase 1, no runner. In each repository, wire the checks it already has into CI and set the handful of expectations that are pass/fail today as plain CI steps or tests: Taskbase runs
npm test,npm run lintandnpm run typecheck; emiliero addsgofmt -land an ESLint config; skatzi-agents gets a workflow with a persona structure check; platform decides the HelmRelease convention conflict. Each repository gets a shortFITNESS.md(or a section in its instruction file) that lists its expectations, checked and documented-only, with the documented-only ones marked as such. Cost: a few small developer tasks. Delivers: the inventory, and the drift found in F2 fixed or explicitly accepted. - Phase 2, pilot. One small runner, in Taskbase first (most expectations, most agent traffic, the test-as-fitness-function pattern already there), with an expectation file of about eight entries including two with non-zero limits (file size budget, staticcheck) and two documented-only entries. Adapters:
go vet, staticcheck, ESLint,tsc, test reporters. The runner distinguishes exit codes for pass, violation and tool error. Gate after four weeks of the pilot running (eight in the original recommendation; shortened by the decision in #1201): it has blocked at least one change that the existing tests and reviewer would have let through, or the reviewer persona reports it uses the list; otherwise the runner is dropped and Phase 1 stays. - Phase 3, generalise. Only after the gate: move the runner to its own repository, add the YAML, Markdown and manifest adapters, and roll it out to the other four repositories with the counts in F2 as starting limits.
- Conditions that hold in every phase: never remove an existing lint or test step; a tool that fails to run is reported as an error and never counted as zero findings; a limit changes only by a pull request that edits the expectation file, and the reviewer treats a raised limit as a decision to call out; documented-only expectations are listed in the same file and shown as "not verified".
- Risk: Phase 1 alone may be judged enough and the runner never built, which is an acceptable outcome of the gate.
Option A: introduce now, all repositories. Build the in-house runner and roll it out to all five with the F2 tables as the first expectation files. Delivers the concept whole. Cost: about ten adapters plus five expectation files up front, and the maintenance in F5, before any evidence that it catches more than the tests do. Risk: it becomes a sixth repository to keep green rather than a safety net.
Option B: no runner, tests and configs only. Encode every checkable expectation as a native test or a linter rule in each repository (the Taskbase pattern), keep the inventory in documentation, and stop there. Cost: lowest. Risk: no limits above zero, so debt either blocks or is never counted; the inventory in prose drifts the way the conventions in F2 did.
Option D: off-the-shelf only. golangci-lint and ESLint with their rule sets, go-arch-lint and dependency-cruiser for boundaries, conftest over rendered manifests, markdownlint; pass/fail per tool. Cost: configuration only. Risk: as F4 shows, no policy layer; thresholds are global per tool; documented-only expectations have no home.
Option E: do not introduce. Keep conventions in documentation and rely on tests and the reviewer persona. Cost: none. Risk: the drift in F2 continues to accumulate unnoticed.
Recommendation¶
Option C. The evidence supports the concept (F1, F3) and shows drift it would catch (F2), but it does not show that a runner catches more than well-placed tests and CI steps do, and the cost sits in custom rules and limit ownership rather than in tooling (F4, F5). Phasing takes the certain value first and makes the runner earn its place. Grade of the recommendation: Indicated.
Decisions that follow¶
- Introduce or not, and on which option (#1201, the owner). Decided 2026-10-19: option C with a four-week gate; see Decision.
- If Option C or A: where the runner lives (a new
Skatzi/fitnessrepository, a Go command in agent-runner, or scripts copied per repository) and how repositories obtain it. Depends on 1. Suggested order: after the Phase 2 gate. - The HelmRelease remediation conflict in platform: change the five releases or the convention text. Independent of 1; a small platform task.
Consequences¶
As decided (option C, four-week gate): Phase 1 adds CI steps and short expectation lists to the repositories and fixes or accepts the drift in F2; Phase 2 adds one small runner and one expectation file to Taskbase; nothing else changes until the gate, four weeks after the pilot starts running. Existing linters and tests stay as they are in every phase. Reviewers, human or agent, gain a list to check against and a visible diff whenever a limit moves. If the gate is not met, the runner is dropped and the Phase 1 lists and CI steps stay.
Open questions¶
- Whether the reviewer persona's review becomes measurably cheaper with an executable expectation list; nothing measures review cost today. The Phase 2 gate is written to answer it.
- Whether the five HelmReleases without a rollback strategy are intended exceptions (CRD-carrying charts where rollback is only a first line, as the conventions page itself notes) or omissions. The convention text does not say.
- Whether Taskbase's rule against Markdown documentation in the repository still stands, given ten files and an ADR that links to one. Either the rule or the files should change.
- Whether MegaLinter runs under Gitea Actions; not verified, and not needed unless Option D is chosen with it.
- Which rules a tuned yamllint and markdownlint configuration should keep; the default-rule counts are not useful as limits.
Limitations¶
- Counts are from one day and one commit per repository; they move with every merge.
- The platform manifest render, kubeconform, helm and terraform checks were not re-run locally because the tools are absent on the machine used; their state is taken from CI configuration, not from a run.
- The staticcheck counts come from version 0.8.2 run with Go 1.27; the repositories pin Go 1.24 and 1.25, and a different version may count differently.
- The emiliero ESLint count uses Taskbase's configuration with Node globals added, since emiliero has none; a configuration of its own would differ.
- The custom checks written for this evaluation are throwaway measurements, not proposed implementations; their false positives are documented in F5 and the notes.
- Time to build a runner and adapters was not estimated in hours; F5 ranks the cost drivers without sizing them.
- The off-the-shelf comparison reads each tool's documentation; none was installed and run against these repositories except staticcheck, ESLint, yamllint and markdownlint-cli2.
Sources¶
| id | title | publisher | address | primary or secondary | retrieved |
|---|---|---|---|---|---|
| S1 | Skatzi/platform at bdee22a: docs/content/contribution/onboarding/conventions.md, repository-structure.md, .gitea/workflows/, components/, cluster/, docs/content/ |
Skatzi | https://gitea.prod.skatzi.com/Skatzi/platform | primary | 2026-10-19 |
| S2 | Skatzi/taskbase at 3f95930: .gitea/workflows/ci.yaml, Makefile, CLAUDE.md, ui/package.json, ui/eslint.config.js, ui/tsconfig.json, ui/src/*.test.*, api/internal/authz/routes_test.go, api/internal/agenttype/parse.go |
Skatzi | https://gitea.prod.skatzi.com/Skatzi/taskbase | primary | 2026-10-19 |
| S3 | Skatzi/agent-runner at 41bb238: .gitea/workflows/ci.yml, Makefile, scripts/check-helm-chart.sh, docs/secrets.md, docs/chat-turns.md, README.md |
Skatzi | https://gitea.prod.skatzi.com/Skatzi/agent-runner | primary | 2026-10-19 |
| S4 | Skatzi/skatzi-agents at 8ef1907: README.md, personas/*.md |
Skatzi | https://gitea.prod.skatzi.com/Skatzi/skatzi-agents | primary | 2026-10-19 |
| S5 | Skatzi/emiliero at f7e9f52: .gitea/workflows/ci.yaml, Makefile, CLAUDE.md, ui/package.json, api/, ui/src/ |
Skatzi | https://gitea.prod.skatzi.com/Skatzi/emiliero | primary | 2026-10-19 |
| S6 | Taskbase API — Architecture (package layout) | Skatzi platform docs | components/taskbase/api-architecture.md | primary | 2026-10-19 |
| S7 | Fitness function-driven development | Thoughtworks | https://www.thoughtworks.com/insights/articles/fitness-function-driven-development | primary (the concept's originators) | 2026-10-19 |
| S8 | dependency-cruiser: Validate and visualize dependencies | sverweij, GitHub | https://github.com/sverweij/dependency-cruiser | primary | 2026-10-19 |
| S9 | go-arch-lint: GoLang architecture linter | fe3dback, GitHub | https://github.com/fe3dback/go-arch-lint | primary | 2026-10-19 |
| S10 | Linters | golangci-lint | https://golangci-lint.run/docs/linters/ | primary | 2026-10-19 |
| S11 | Configuration File | golangci-lint | https://golangci-lint.run/docs/configuration/file/ | primary | 2026-10-19 |
| S12 | Write rules | Semgrep | https://semgrep.dev/docs/writing-rules/overview | primary | 2026-10-19 |
| S13 | CLI reference | Semgrep | https://semgrep.dev/docs/cli-reference | primary | 2026-10-19 |
| S14 | Conftest | Open Policy Agent | https://www.conftest.dev/ and https://github.com/open-policy-agent/conftest | primary | 2026-10-19 |
| S15 | MegaLinter | OX Security | https://megalinter.io/latest/ | primary | 2026-10-19 |
| S16 | max-lines; no-restricted-imports; Command Line Interface Reference | ESLint | https://eslint.org/docs/latest/rules/max-lines, https://eslint.org/docs/latest/rules/no-restricted-imports, https://eslint.org/docs/latest/use/command-line-interface | primary | 2026-10-19 |
| S17 | Static Analysis Results Interchange Format (SARIF) Version 2.1.0 | OASIS | https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html | primary | 2026-10-19 |
| S18 | ArchUnit; ArchUnitNET; ts-arch | TNG and ts-arch, GitHub | https://www.archunit.org/, https://github.com/TNG/ArchUnitNET, https://github.com/ts-arch/ts-arch | primary | 2026-10-19 |
| S19 | kubeconform: a FAST Kubernetes manifests validator | yannh, GitHub | https://github.com/yannh/kubeconform | primary | 2026-10-19 |
| S20 | markdownlint-cli2 | DavidAnson, GitHub | https://github.com/DavidAnson/markdownlint-cli2 | primary | 2026-10-19 |
| S21 | Measurement log for this record (commands, versions, raw output) | this repository | 0017-codebase-fitness-functions-notes/measurements.md | primary | 2026-10-19 |
| T1 | Taskbase task #1200, request #1199, decision task #1201 | Skatzi Taskbase | https://taskbase.skatzi.com | primary | 2026-10-19 |