REUSE: a setting the app writes back goes through its API in after_install (and is read back)
gates / gates (push) Successful in 3s

Two rows earned by the qBittorrent/Transmission build:
- pattern: a value seeded into a config file the APP owns is only a request — qBittorrent
  ignores a seeded UseUPnP at first start and rewrites a semicolon host list down to one
  entry, which then refuses the controller's probe. Both go through setPreferences in
  after_install, whose marker depends on the readback, not on the call's exit code.
- lookalike: `curl -f` exits 22 on a 401, so a curl -f healthcheck on an app that requires
  authentication is unhealthy for ever. Decide on the code (200|401), proven both ways.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117kRTSgs3rJWUFGxyoWN6Y
This commit is contained in:
adminandClaude Opus 5 committed 2026-10-12 20:59:58 +02:00
1 parent 9081a47e11
commit cb4ececf1f
1 file changed
+2
+2
View File
@@ -31,6 +31,7 @@ Templates are config; the few script helpers other scripts must REUSE, never re-
| **The app's own sign-up switch → `after_setup:`** (decisions 47/49, controller ≥ 0.282.0) | `templates/homebox/` (compose `HBOX_OPTIONS_ALLOW_REGISTRATION=${SIGNUP_OPEN:-true}` + `.felhom.yml` `after_setup.env`) | compose default OPEN; `after_setup: {env: {SIGNUP_CLOSED: "true"}}` | TRAPS: the default must be OPEN (an installed app is unchanged by the catalog); several apps' switch also refuses the household's FIRST account, so never set it at install; an app with no env switch (opengist, wishlist) keeps the block alone — make that block case-insensitive. |
| **A same-tag security fix → a RE-TEST step** (`09` decision 52, 2026-09-30) | `scripts/retest-floating.py` (the ONE monthly command), `scripts/retest_box.py` (the box venue), `scripts/box_walk.py` (the 9202 client), `upgrade-test.py --retest` + `--write-ladder` | An entry whose `from` == `to`, with `digest_from` (the tested digest it started from) and `box_evidence`. `--dry-run` lists; `--engines-only` is the ruled start. Runbook `felhom.eu/documentation/runbooks/monthly-floating-retest.md`. TRAPS: never write one by hand (the gates refuse no new digest, a digest the registry stopped serving, a missing box proof, a `digest_from` that is not the previous entry's digest); `image_digest.resolve` IGNORES a `@digest` in its argument — ask the registry by manifest for a digest. |
| **A bench-only environment override** (R-739) | `upgrade-test.py` `BENCH_ENV_OVERRIDES` | Only for an app that cannot run on the bench at all (wanderer: its web server calls the DB at the public https name). Every verdict carries `bench_overrides`. Never a template change. |
| **A setting the app WRITES BACK -> set it through the app's API in `after_install`, and read it back** (2026-10-12, qbittorrent) | `templates/qbittorrent/.felhom.yml` (`after_install:`) + its compose header | A value seeded into a config file is only a REQUEST: an app that owns that file may ignore it at first start and may rewrite it in its own dialect. Measured on 9202: `Session\UseUPnP=false` is in the file and the app still reports `"upnp": true` and tries a mapping; a semicolon host list in the file comes back as one entry, after which the controller's probe (which dials by CONTAINER NAME) is refused. Both settings go through `/api/v2/app/setPreferences` in `after_install`, which then **reads each one back** and prints its marker only if both answer. TRAPS: `after_install` runs once after a FRESH install, so anything it sets must also survive a restart (verify, do not assume); the marker must depend on the READBACK, not on the setting call's exit code (an API that accepts and discards returns 200); and the host list must contain the container name, or the health probe dies the moment the app rewrites the file. |
| Controller-side health probe | `templates/vaultwarden/.felhom.yml` (`healthcheck:` block) | `healthcheck.checks[]` with `type: http` (port only), `type: api` (port + `path` + `expect.status: 200`), or `type: tcp` (port only — mealie, crafty-controller). Prefer `api` with a real health path when the app has one. |
| App lifecycle (`available`/`hidden`/`abandoned`) | `templates/plant-it/.felhom.yml` (`lifecycle:` block) | Optional top-level `lifecycle:` in `.felhom.yml`. Absent/empty ≡ `available`. `hidden` = not offered for new installs; `abandoned` = same, PLUS a permanent "Nem karbantartott" badge + notice on every box already running it. **Deployed instances keep full function in both states** — lifecycle governs what is OFFERED, never what runs; the controller refuses a deploy of a non-available template server-side (fail-closed, so a stale link or direct POST cannot install one). Unknown value → treated as `available` + one WARN, never a broken template. **Do NOT take an app out of circulation by deleting or moving its directory** — that orphans every customer already running it, which is what the 2026-07-21 `retired/` experiment got wrong. The resolvability gate skips non-available apps, so an abandoned app's dead image is not a standing red. |
| **Catalog gates — THE entry point** | `scripts/catalog_gates.py` | **Run `python3 scripts/catalog_gates.py <app>` after ANY template change** (mandated in `CLAUDE.md`). Runs all four gates below in order — image-pins, image-resolvable, volume-persistence, engine-major (2026-09-13; git-history diff, hook-only until CI fetches deeper, R-452) — and exits **non-zero if any fails**; **2 (UNDETERMINED) is reported distinctly and is never a pass**, 1 (convicted) outranks 2 in the summary. Naming app(s) scopes the two gates that accept scoping, which is the normal after-a-change run; with no names the RUNTIME gate deploys every template, so that form is **scratch host only**. **Why a runner** (operator ruling 2026-08-02, R-161): the only gates in this project that ever get run are the ones with a single entry point named in a CLAUDE.md — `felhom.eu/scripts/site_gates.py` is run, R-29's three orphans are named nowhere and have stopped nothing. Controller-side enforcement was rejected because a load-time check reads only the file and a static audit reports the catalog clean **including papra** — it would pass on the very defect it exists to catch; CI was rejected for now (neither repo has any, no users yet). Adding a fourth gate here means adding it to `GATES` in this file — nothing else. |
@@ -57,6 +58,7 @@ Templates are config; the few script helpers other scripts must REUSE, never re-
| Trap | Why it bites | Use instead |
|---|---|---|
| `templates/gokapi/docker-compose.yml` custom `entrypoint` seeding `config.json` + `--deployment-password` | One-off hack because Gokapi has no env-var headless setup (pinned to ConfigVersion 21 / v1.9.6). Copying this entrypoint pattern to another app will break on image updates. | Normal env-var config via `deploy_fields`; entrypoint-seeding only as last resort. |
| A healthcheck that uses `curl -f` on an app which requires authentication | `curl -f` exits **22** on a 401, so the container is `unhealthy` for ever while the app serves perfectly. Transmission answers 401 on every path (measured 2026-10-12, `transmission-bench/08-health.txt`). | Decide on the CODE, not on curl's exit: `["CMD-SHELL", "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:<port>/ \| grep -qE '^(200\|401)$$'"]` - `templates/transmission/docker-compose.yml`. Prove it in both directions (a port nothing serves must fail), and admit the probe's own Host name if the app filters on it. |
| `templates.json` + `scripts/generate-customer.sh` | LEGACY Portainer-only mechanism (marked so in README.md). New apps do NOT need entries here; the controller syncs `templates/<app>/` directly. | Just `templates/<app>/{docker-compose.yml,.felhom.yml}`. |
| `templates/uptime-kuma/docker-compose.yml` `test: ["CMD", "extra/healthcheck"]` | Image-provided binary, unique to this image — not a portable pattern. | Pick the wget/curl/node/python family matching your image (§2). |