From 2fbac8cce0120f2d43aff548dcfea8a2181b5a50 Mon Sep 17 00:00:00 2001 From: Cato <41178744+catomean@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:31:05 +0200 Subject: [PATCH] fix(registers): RevampIT is not a client; Kivvi is a product; business-facts check (#188) Co-authored-by: catomean --- .github/workflows/business-facts.yml | 25 ++++++++++++++ registers/org.json | 31 ++++++++++++++++- registers/readings.json | 6 ++-- registers/retired.json | 2 +- scripts/ci/business-facts-audit.sh | 50 ++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/business-facts.yml create mode 100755 scripts/ci/business-facts-audit.sh diff --git a/.github/workflows/business-facts.yml b/.github/workflows/business-facts.yml new file mode 100644 index 0000000..f507676 --- /dev/null +++ b/.github/workflows/business-facts.yml @@ -0,0 +1,25 @@ +# Do apps.conf owners and readings.json counts agree with org.json businessFacts? +# See scripts/ci/business-facts-audit.sh. Runs when the registers change, and +# weekly to catch an apps.conf edit in loki. +name: Business facts + +on: + pull_request: + paths: ['registers/**', 'scripts/ci/business-facts-audit.sh', '.github/workflows/business-facts.yml'] + schedule: + - cron: '41 7 * * 3' + workflow_dispatch: + +permissions: + contents: read + +jobs: + audit: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v7 + - name: Registers agree with business facts + env: + GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }} + run: bash scripts/ci/business-facts-audit.sh diff --git a/registers/org.json b/registers/org.json index d5bb279..9063546 100644 --- a/registers/org.json +++ b/registers/org.json @@ -47,6 +47,35 @@ { "pattern": "Georgy Butaev", "why": "the public name is Cato; the legal personal name does not go on public surfaces" + }, + { + "pattern": "RevampIT\\W+(is|was|as)\\W+(a\\W+|an\\W+|our\\W+)?(paying\\W+)?(client|customer|owner|partner)", + "why": "RevampIT dropped G; it is not a client, owner or partner. evig is G's own independent project; Kivvi is a bitbaum product." + }, + { + "pattern": "(client|customer|partner)\\W+(is\\W+)?RevampIT", + "why": "RevampIT is not a client, customer or partner of bitbaum." + }, + { + "pattern": "RevampIT\\|client", + "why": "apps.conf: no row is owned by RevampIT; Kivvi is bitbaum|product." } - ] + ], + "businessFacts": { + "_why": "Facts with no other producer. scripts/ci/business-facts-audit.sh fails when apps.conf or readings.json contradict them.", + "notClients": [ + "RevampIT", + "Revamp-IT", + "revamp-it" + ], + "favourClients": [ + "AOZ", + "vitareba", + "S-Ink" + ], + "products": { + "kivvi": "bitbaum product; evig is its first user", + "evig": "G's own independent project" + } + } } diff --git a/registers/readings.json b/registers/readings.json index 381247d..cd76163 100644 --- a/registers/readings.json +++ b/registers/readings.json @@ -22,10 +22,10 @@ }, "clients": { "live": 14, - "products": 10, - "clients": 4, + "products": 11, + "clients": 3, "paying": 0, - "favours": 4, + "favours": 3, "unknown": 0, "mrrChf": 0 }, diff --git a/registers/retired.json b/registers/retired.json index 4334d67..3c0fe44 100644 --- a/registers/retired.json +++ b/registers/retired.json @@ -34,7 +34,7 @@ "from": "revampit.orangecat.ch", "to": "evig.orangecat.ch", "since": "2026-09-10", - "why": "The organisation renamed to evig.", + "why": "evig is G's own independent project; it moved to its own host. revampit.orangecat.ch is a leftover alias (308).", "verified": "curl -L resolves to https://evig.orangecat.ch/ (200)" }, { diff --git a/scripts/ci/business-facts-audit.sh b/scripts/ci/business-facts-audit.sh new file mode 100755 index 0000000..5638b41 --- /dev/null +++ b/scripts/ci/business-facts-audit.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# Fleet audit: do the registers contradict the business facts? +# +# business-facts-audit.sh (reads loki's apps.conf via gh) +# APPS_CONF=path business-facts-audit.sh +# +# WHY: 2026-10-21 apps.conf listed Kivvi as RevampIT|client-app|favour after +# RevampIT had dropped G, and readings.json counted 4 clients because of it. +# Ownership and client status come from registers/org.json -> businessFacts; +# this fails when apps.conf owners or readings.json counts disagree. Prose in +# docs is covered by org-drift-audit.sh via org.json forbiddenClaims. +set -euo pipefail +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" +ORG="$HERE/../../registers/org.json" +READINGS="$HERE/../../registers/readings.json" +conf="$(mktemp)"; trap 'rm -f "$conf"' EXIT +if [[ -n "${APPS_CONF:-}" ]]; then cp "$APPS_CONF" "$conf" +else gh api repos/bitbaum/loki/contents/scripts/hetzner/apps.conf -H 'Accept: application/vnd.github.raw' > "$conf"; fi +python3 - "$ORG" "$READINGS" "$conf" <<'PY' +import json, sys +org, readings, conf = sys.argv[1:] +facts = json.load(open(org))["businessFacts"] +bad = {n.lower() for n in facts["notClients"]} +favours = {n.lower() for n in facts["favourClients"]} +fails = []; clients = []; fav = [] +for line in open(conf): + if not line.strip() or line.lstrip().startswith("#"): continue + f = line.rstrip("\n").split("|") + if len(f) < 9: continue + app, owner, kind, state = f[0], f[6], f[7], f[8] + pay = f[9] if len(f) > 9 else "-" + if owner.lower() in bad: + fails.append(f"apps.conf {app}: owner {owner} is listed in businessFacts.notClients") + if state == "live" and owner != "bitbaum" and kind.startswith("client"): + clients.append(app) + if pay == "favour": fav.append((app, owner)) +for app, owner in fav: + if owner.lower() not in favours and app.lower() not in favours: + fails.append(f"apps.conf {app}: favour client {owner} is not in businessFacts.favourClients") +r = json.load(open(readings)) +c = next((v for v in r.values() if isinstance(v, dict) and "clients" in v and isinstance(v["clients"], dict)), {}).get("clients", {}) +if c and c.get("favours") != len(fav): + fails.append(f"readings.json favours={c.get('favours')} but apps.conf has {len(fav)} live favour clients") +if len(fav) != len(favours): + fails.append(f"apps.conf has {len(fav)} favour clients {[a for a,_ in fav]}; businessFacts.favourClients lists {len(favours)}") +print(f"live client rows: {len(clients)} {clients}; favours: {len(fav)}") +for x in fails: print("✗", x) +sys.exit(1 if fails else 0) +PY