archive: omeka-reconcile shells a nonexistent omeka-s-cli api-key:ensure and ||true-swallows it — health key never provisioned, drive leg guaranteed red #1213

Closed
opened 2026-09-04 09:32:46 +00:00 by ben · 2 comments
Owner

What is broken

omeka-reconcile (internal/clan/archive.go:372, landed by #1185) shells:

podman exec omeka omeka-s-cli api-key:ensure --identity="$identity" --credential="$cred" || true

Two defects compound:

  1. The verb does not exist. The GhentCDH omeka-s-cli bundled in erseco/alpine-omeka-s has user:create-api-key <user> <label> — which GENERATES a credential and prints it; it does not accept one — and no api-key:ensure command at all (primary-source finding, docs/research/2026-09-04-catalogue-service-theming-capability.md, surprise 2).
  2. The failure is swallowed. The || true makes the reconciler exit success with no key provisioned — a silent no-op, the cannot-fail class (ADR 0100). The archive HealthCheck (archivehealth.go) then drives /api/items with a key_credential that was never created: the keep→serve→refuse loop can never authenticate, the tile can never go Active, and the #1203 drive's leg 7 is guaranteed red.

#1185's close-report flagged the exact invocation as "the deferred clan-lab drive's fidelity concern" — this ticket is that concern, now confirmed broken rather than merely unverified.

What to build

An API-key handshake that actually exists on the image and stays idempotent:

  • Invert the flow to match the real CLI: the reconciler runs user:create-api-key for the idss-health identity, captures the generated key_identity/key_credential from stdout, and lands it where the health check reads its credential (the same clan-var/LoadCredential seam, now written by the reconciler rather than pre-seeded) — or an equivalent honest design if a better seam exists. Idempotency must be real: a re-run must not mint a second key that orphans the stored one (check for an existing key first, or delete-and-recreate atomically with the store update).
  • Remove the || true. The reconciler fails loud when the key handshake fails; its unit status is the truth the drive and monitoring read.
  • The health check and the reconciler must provably read/write the SAME credential — a test that breaks the handshake (wrong identity, absent key) must red.

Acceptance criteria

  • omeka-reconcile's script only invokes verbs that exist in the pinned image's omeka-s-cli (assert the verb list in a test or the render).
  • Reconciler failure is loud: no || true on the key path; unit fails when the key cannot be ensured.
  • Idempotent across re-runs (kit re-applies, redeploys): exactly one live health key, and the stored credential always matches it.
  • The existing archive health tests still pass, plus a failure-path test where the key handshake broke and health reds.

Why now

Blocks arming the #1203 P4 catalogue drive — leg 7 (archive healthy) is guaranteed red until this lands.

Blocked by

None — can start immediately.

## What is broken `omeka-reconcile` (internal/clan/archive.go:372, landed by #1185) shells: podman exec omeka omeka-s-cli api-key:ensure --identity="$identity" --credential="$cred" || true Two defects compound: 1. **The verb does not exist.** The GhentCDH `omeka-s-cli` bundled in `erseco/alpine-omeka-s` has `user:create-api-key <user> <label>` — which GENERATES a credential and prints it; it does not accept one — and no `api-key:ensure` command at all (primary-source finding, docs/research/2026-09-04-catalogue-service-theming-capability.md, surprise 2). 2. **The failure is swallowed.** The `|| true` makes the reconciler exit success with no key provisioned — a silent no-op, the cannot-fail class (ADR 0100). The archive HealthCheck (archivehealth.go) then drives `/api/items` with a `key_credential` that was never created: the keep→serve→refuse loop can never authenticate, the tile can never go Active, and the #1203 drive's leg 7 is guaranteed red. #1185's close-report flagged the exact invocation as "the deferred clan-lab drive's fidelity concern" — this ticket is that concern, now confirmed broken rather than merely unverified. ## What to build An API-key handshake that actually exists on the image and stays idempotent: - Invert the flow to match the real CLI: the reconciler runs `user:create-api-key` for the `idss-health` identity, captures the generated key_identity/key_credential from stdout, and lands it where the health check reads its credential (the same clan-var/LoadCredential seam, now written by the reconciler rather than pre-seeded) — or an equivalent honest design if a better seam exists. Idempotency must be real: a re-run must not mint a second key that orphans the stored one (check for an existing key first, or delete-and-recreate atomically with the store update). - **Remove the `|| true`.** The reconciler fails loud when the key handshake fails; its unit status is the truth the drive and monitoring read. - The health check and the reconciler must provably read/write the SAME credential — a test that breaks the handshake (wrong identity, absent key) must red. ## Acceptance criteria - [ ] `omeka-reconcile`'s script only invokes verbs that exist in the pinned image's `omeka-s-cli` (assert the verb list in a test or the render). - [ ] Reconciler failure is loud: no `|| true` on the key path; unit fails when the key cannot be ensured. - [ ] Idempotent across re-runs (kit re-applies, redeploys): exactly one live health key, and the stored credential always matches it. - [ ] The existing archive health tests still pass, plus a failure-path test where the key handshake broke and health reds. ## Why now Blocks arming the #1203 P4 catalogue drive — leg 7 (archive healthy) is guaranteed red until this lands. ## Blocked by None — can start immediately.

swarm-claim host=matou-dev-server-01 run=17682
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=17682 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1213 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1213,
  "status": "success",
  "commits": [
    "6fafe5ed7543f89419709c3f4283e7e76c52909c"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/archivehealth.go",
    "control-plane/cmd/control-plane/main.go",
    "control-plane/cmd/control-plane/provision_archive_health_test.go",
    "control-plane/cmd/control-plane/six_port_health_wiring_test.go",
    "docs/GOTCHAS.md",
    "internal/clan/archive.go",
    "internal/clan/archive_attach.go",
    "internal/clan/archive_attach_test.go",
    "internal/clan/archive_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/clan/*.go control-plane/cmd/control-plane/*.go",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan/... ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "nix-instantiate --parse <rendered archive.nix>",
      "exit_code": 0
    }
  ],
  "criteria": {
    "omeka-reconcile's script only invokes verbs that exist in the pinned image's omeka-s-cli (assert the verb list in a test or the render)": "TestRenderArchive_ReconcilerOnlyInvokesRealVerbs (internal/clan/archive_test.go) scans the invocation lines (podman exec omeka omeka-s-cli <verb>) against the allowlist {module:enable, user:create-api-key}; api-key:ensure is gone from renderOmekaReconcile (internal/clan/archive.go).",
    "Reconciler failure is loud: no || true on the key path; unit fails when the key cannot be ensured": "TestRenderArchive_ReconcilerKeyPathIsLoud asserts set -euo pipefail, no || true on the user:create-api-key line, and an explicit exit 1 on parse/mint failure; the render carries no || true on the key path (module:enable keeps its narrow already-enabled tolerance).",
    "Idempotent across re-runs (kit re-applies, redeploys): exactly one live health key, and the stored credential always matches it": "TestRenderArchive_ReconcilerKeyIsIdempotentAndStored asserts the store-presence guard (if [ -s \"$store\" ]; then exit 0) skips minting when a key exists, and the atomic printf identity/credential > tmp; mv tmp store lands BOTH generated fields; TestArchiveHealth_KeyStoreSameSeamAsReconciler proves lazyArchiveKey parses exactly that two-line write.",
    "The existing archive health tests still pass, plus a failure-path test where the key handshake broke and health reds": "go test ./control-plane/cmd/control-plane green (existing TestComposeProvision_ArchiveActivatesOnlyOnARealKeepServeRefuse, TestArchiveHealth_*, TestSixPortHealthWiring_* updated to the new ArchiveAdmin.Key seam and pass); new TestArchiveHealth_BrokenKeyHandshakeReds reds on both a wrong credential and a wrong identity."
  },
  "summary": "Rebuilt the archive port's omeka-reconcile to MINT its admin API key with the real user:create-api-key verb (idempotent, loud, both generated fields landed in a store the health check reads), replacing the nonexistent api-key:ensure it || true-swallowed.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1213 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1213, "status": "success", "commits": [ "6fafe5ed7543f89419709c3f4283e7e76c52909c" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/archivehealth.go", "control-plane/cmd/control-plane/main.go", "control-plane/cmd/control-plane/provision_archive_health_test.go", "control-plane/cmd/control-plane/six_port_health_wiring_test.go", "docs/GOTCHAS.md", "internal/clan/archive.go", "internal/clan/archive_attach.go", "internal/clan/archive_attach_test.go", "internal/clan/archive_test.go" ], "tests": [ { "command": "go test ./internal/clan/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "gofmt -l internal/clan/*.go control-plane/cmd/control-plane/*.go", "exit_code": 0 }, { "command": "go vet ./internal/clan/... ./control-plane/...", "exit_code": 0 }, { "command": "nix-instantiate --parse <rendered archive.nix>", "exit_code": 0 } ], "criteria": { "omeka-reconcile's script only invokes verbs that exist in the pinned image's omeka-s-cli (assert the verb list in a test or the render)": "TestRenderArchive_ReconcilerOnlyInvokesRealVerbs (internal/clan/archive_test.go) scans the invocation lines (podman exec omeka omeka-s-cli <verb>) against the allowlist {module:enable, user:create-api-key}; api-key:ensure is gone from renderOmekaReconcile (internal/clan/archive.go).", "Reconciler failure is loud: no || true on the key path; unit fails when the key cannot be ensured": "TestRenderArchive_ReconcilerKeyPathIsLoud asserts set -euo pipefail, no || true on the user:create-api-key line, and an explicit exit 1 on parse/mint failure; the render carries no || true on the key path (module:enable keeps its narrow already-enabled tolerance).", "Idempotent across re-runs (kit re-applies, redeploys): exactly one live health key, and the stored credential always matches it": "TestRenderArchive_ReconcilerKeyIsIdempotentAndStored asserts the store-presence guard (if [ -s \"$store\" ]; then exit 0) skips minting when a key exists, and the atomic printf identity/credential > tmp; mv tmp store lands BOTH generated fields; TestArchiveHealth_KeyStoreSameSeamAsReconciler proves lazyArchiveKey parses exactly that two-line write.", "The existing archive health tests still pass, plus a failure-path test where the key handshake broke and health reds": "go test ./control-plane/cmd/control-plane green (existing TestComposeProvision_ArchiveActivatesOnlyOnARealKeepServeRefuse, TestArchiveHealth_*, TestSixPortHealthWiring_* updated to the new ArchiveAdmin.Key seam and pass); new TestArchiveHealth_BrokenKeyHandshakeReds reds on both a wrong credential and a wrong identity." }, "summary": "Rebuilt the archive port's omeka-reconcile to MINT its admin API key with the real user:create-api-key verb (idempotent, loud, both generated fields landed in a store the health check reads), replacing the nonexistent api-key:ensure it || true-swallowed.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1213
No description provided.