mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 12:27:28 +01:00
* feat(register): one register for every project, joined from the owners of each fact
"Which projects do we have, and which one has a site, a FleetCrown profile, an
OrangeCat profile, a Solon organisation?" had no answer. It had seven: apps.conf,
this database, OrangeCat's, Solon's, bitbaum's companies.json, the public footer's
config, and 24 markdown dossiers. Each is right about its own facts and wrong
about the others; joined by hand they disagreed on 5 names, the footer named a
host that had been renamed and missed 12 live ones, the showcase listed hosts
the hosting register did not know, and Caddy served 38 vhosts of which the
register knew 23.
This does not add an eighth list. It adds the JOIN, computed from the owners:
src/lib/register/apps-conf.ts the one parser for apps.conf (hosting SSOT)
src/lib/register/build.ts pure join keyed on the canonical slug
src/lib/register/solon.ts Solon membership via its public org endpoint,
reported UNCHECKED (not "none") when unreachable
GET /api/fleet/register public JSON — consumers derive, never copy
/fleet the same join, rendered
The join key is the repository name. Names have drifted into several spellings
(aoz-housing/aoz-wohnen, datacat/datacat-web, s-ink/sink, sbb-fundbuero/
sbb-lost-found, wild-spirit/annushka); `canonicalSlug` folds every alias that
has actually bitten, and each is pinned by a test. The durable fix is three
nullable columns on user_projects — slug, hosted_app, solon_org_slug — with
scripts/backfill-project-registry.ts to assign them once (drizzle/0065; the
applier is filename-based, matching how 0064 was shipped).
The footer stops being a list anyone edits. src/config/fleet-sites.ts is now
GENERATED from apps.conf by scripts/generate-fleet-sites.ts (the footer is a
client component and cannot read the register at render, and Atlas needs static
anchors), with editorial copy kept in fleet-site-copy.ts keyed by slug. A gate,
scripts/test/fleet-sites-derived.ts, fails the moment the file drifts.
apps.conf itself gets two corrections found by comparing it with the box:
evig (live on 4004 from the main Caddyfile, never registered) and
hirnli.orangecat.ch, which revamp-info's app serves.
Not done here, on purpose: the bitbaum showcase still renders its own
companies.json — it moves to the API once this is live; annushka and bitbaum are
static Caddy roots with no app process and do not fit the register's app shape.
Verified: 145/145 unit files (24 new assertions in fleet-register, drift gate
green), tsc clean, register gates (port-alloc, register-reality, client-ledger)
green with the new rows.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
* fix(register): evig row names its host database, revampit
The deploy-ready gate found drizzle migrations in the evig checkout and a
db of '-', which is the shape that let botsmann serve PGRST205 for months.
evig is not deployed by deploy.sh at all — its own workflow applies its
migrations — but the register should still say which database that is.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
* fix(watchdog): evig left the hand-list the day it entered the register
The hand-list is built to die one row at a time: the test that failed is
the one that forces a duplicate out the moment apps.conf registers it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
// src/config/fleet-sites.ts must equal what apps.conf generates. If this fails,
|
|
// someone edited the list by hand or changed the register without regenerating:
|
|
// npx tsx scripts/generate-fleet-sites.ts
|
|
// Run: npx tsx scripts/test/fleet-sites-derived.ts
|
|
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { readAppsConf } from "@/lib/register/apps-conf";
|
|
import { renderFleetSites, listedSites } from "../generate-fleet-sites";
|
|
|
|
const root = process.cwd();
|
|
const apps = readAppsConf(root);
|
|
const expected = renderFleetSites(apps);
|
|
const actual = readFileSync(join(root, "src/config/fleet-sites.ts"), "utf8");
|
|
|
|
let fail = 0;
|
|
if (apps.length === 0) {
|
|
console.error("✗ apps.conf not readable from", root);
|
|
fail++;
|
|
}
|
|
if (actual !== expected) {
|
|
console.error(
|
|
"✗ src/config/fleet-sites.ts drifted from apps.conf — run: npx tsx scripts/generate-fleet-sites.ts",
|
|
);
|
|
fail++;
|
|
}
|
|
const listed = listedSites(apps);
|
|
if (listed.length < 5) {
|
|
console.error(`✗ suspiciously few listed sites (${listed.length}) — filter or register broken?`);
|
|
fail++;
|
|
}
|
|
console.log(
|
|
`fleet-sites-derived: ${fail === 0 ? "in sync" : "DRIFT"} (${listed.length} listed sites)`,
|
|
);
|
|
process.exit(fail === 0 ? 0 : 1);
|