mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-05 09:53:29 +01:00
fix(registers): RevampIT is not a client; Kivvi is a product; business-facts check (#188)
Co-authored-by: catomean <catomean@users.noreply.github.com>
This commit is contained in:
1 parent
f8b253a7ff
commit
2fbac8cce0
5 files changed
+109
-5
No files matched your search
@@ -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
|
||||
+30
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -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)"
|
||||
},
|
||||
{
|
||||
|
||||
Executable
+50
@@ -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
|
||||
Reference in new issue
Block a user