files: the richdocuments oneshot sets wopi_url but never activates it — Nextcloud never fetches Collabora's capabilities, so Files has no New document/spreadsheet while every surface reads green (Whakatōhea demo) #1827

Closed
opened 2026-09-24 17:11:54 +00:00 by ben · 2 comments
Owner

Symptom

Whakatōhea Demo run #2 (founded by hand 2026-09-23, gateway 134.199.167.181, build ff4a5263): the panel shows docs-editing (Collabora) Active, docs-editing.<apex>/hosting/discovery answers 200, coolwsd is up — and in Files the "+ New" menu offers no New document / New spreadsheet / New presentation. Ben reported it 2026-09-24. No panel card, health check or drive leg said anything.

Cause (traced on the box, read-only)

richdocuments 9.2.2 registers the New-document creators in RegisterTemplateFileCreatorListener::handle, which returns early when CapabilitiesService::getCapabilities() is empty. CachedRequestService::get() only reads the cache (Redis richdocuments/capabilities, then the appdata file richdocuments/remoteData/capabilities) — it never fetches. A fetch happens in exactly three places:

  1. the hourly background job OCA\Richdocuments\Backgroundjobs\ObtainCapabilities,
  2. occ richdocuments:activate-config,
  3. saving the Nextcloud Office admin settings page (SettingsController → fetch()).

Our oneshot nextcloud-richdocuments.service (internal/clan/files.go, renderNextcloudRichdocuments) runs only app:install richdocuments + config:app:set richdocuments wopi_url. It relies on (1) — and on the demo the job no longer exists (deleted by the founding's cron race, filed separately, #1828). remoteData/ was empty 19 h after founding; Redis had no key.

Everything else was right: wopi_url correct, WOPI allow-list (#1620), ADR 0258 callback bypass rendered, files.<apex> pinned to loopback, PHP as the nextcloud user fetched /hosting/capabilities fine.

Demo repair applied 2026-09-24 17:09Z: nextcloud-occ richdocuments:activate-config → all checks ✓, remoteData/{capabilities,discovery} written.

Fix

In renderNextcloudRichdocuments, after setting wopi_url, run $occ richdocuments:activate-config and fail the oneshot if it fails (a red switch is the honest signal — GOTCHAS #266's shape). coolwsd binds the mesh and orders on netbird (meshBound, #964), so on a co-host it may come up after the files oneshot: wrap the call in a bounded retry (e.g. up to ~5 min, 15 s apart) and fail loud after that. Do not add after = coolwsd.service unconditionally — the render does not know the placement (docs-editing may live on another node).

Note activate-config resets wopi_callback_url to '' (autodetect) — that is the state we want (ADR 0258 relies on the browser-facing URL).

Acceptance criteria

  • TestRenderFiles_* (internal/clan/files_test.go) pins that a DocsEditingHost render emits richdocuments:activate-config after the wopi_url set, inside a bounded retry, and that a files-only render still emits nothing richdocuments.
  • The oneshot exits non-zero when Collabora never answers (a render test on the script text is enough; the drive proves the live half).
  • The rented-services / roles-proof drive's docs-editing leg opens "+ New" → New document on a fresh founding before any visit to /settings/admin/richdocuments (rolesProof.ts:355 visits the admin page, whose Save fetches capabilities — which is why drives never saw this). The pass is the created .docx/.odt opening in the editor; the red is the menu lacking the entry.
  • GOTCHAS entry (same commit): "a wopi_url set by occ is not an activated editor — richdocuments never fetches on read; without the hourly job or activate-config the New menu is empty and every health surface reads green".

Why it matters

A founded community with Collabora "installed" cannot create a single document until an hourly job runs — and that job is gone on any founding that raced cron (see #1828). The demo sat like this for 19 h.

## Symptom Whakatōhea Demo run #2 (founded by hand 2026-09-23, gateway `134.199.167.181`, build `ff4a5263`): the panel shows docs-editing (Collabora) Active, `docs-editing.<apex>/hosting/discovery` answers 200, coolwsd is up — and in Files the "+ New" menu offers **no** New document / New spreadsheet / New presentation. Ben reported it 2026-09-24. No panel card, health check or drive leg said anything. ## Cause (traced on the box, read-only) richdocuments 9.2.2 registers the New-document creators in `RegisterTemplateFileCreatorListener::handle`, which returns early when `CapabilitiesService::getCapabilities()` is empty. `CachedRequestService::get()` only **reads** the cache (Redis `richdocuments/capabilities`, then the appdata file `richdocuments/remoteData/capabilities`) — it never fetches. A fetch happens in exactly three places: 1. the hourly background job `OCA\Richdocuments\Backgroundjobs\ObtainCapabilities`, 2. `occ richdocuments:activate-config`, 3. saving the Nextcloud Office admin settings page (`SettingsController` → `fetch()`). Our oneshot `nextcloud-richdocuments.service` (`internal/clan/files.go`, `renderNextcloudRichdocuments`) runs only `app:install richdocuments` + `config:app:set richdocuments wopi_url`. It relies on (1) — and on the demo the job no longer exists (deleted by the founding's cron race, filed separately, #1828). `remoteData/` was empty 19 h after founding; Redis had no key. Everything else was right: wopi_url correct, WOPI allow-list (#1620), ADR 0258 callback bypass rendered, `files.<apex>` pinned to loopback, PHP as the nextcloud user fetched `/hosting/capabilities` fine. **Demo repair applied 2026-09-24 17:09Z:** `nextcloud-occ richdocuments:activate-config` → all checks ✓, `remoteData/{capabilities,discovery}` written. ## Fix In `renderNextcloudRichdocuments`, after setting `wopi_url`, run `$occ richdocuments:activate-config` and **fail the oneshot if it fails** (a red switch is the honest signal — GOTCHAS #266's shape). coolwsd binds the mesh and orders on netbird (`meshBound`, #964), so on a co-host it may come up after the files oneshot: wrap the call in a bounded retry (e.g. up to ~5 min, 15 s apart) and fail loud after that. Do not add `after = coolwsd.service` unconditionally — the render does not know the placement (docs-editing may live on another node). Note `activate-config` resets `wopi_callback_url` to '' (autodetect) — that is the state we want (ADR 0258 relies on the browser-facing URL). ## Acceptance criteria - `TestRenderFiles_*` (`internal/clan/files_test.go`) pins that a `DocsEditingHost` render emits `richdocuments:activate-config` after the `wopi_url` set, inside a bounded retry, and that a files-only render still emits nothing richdocuments. - The oneshot exits non-zero when Collabora never answers (a render test on the script text is enough; the drive proves the live half). - The rented-services / roles-proof drive's docs-editing leg opens **"+ New" → New document** on a fresh founding **before** any visit to `/settings/admin/richdocuments` (`rolesProof.ts:355` visits the admin page, whose Save fetches capabilities — which is why drives never saw this). The pass is the created `.docx`/`.odt` opening in the editor; the red is the menu lacking the entry. - GOTCHAS entry (same commit): "a wopi_url set by occ is not an activated editor — richdocuments never fetches on read; without the hourly job or activate-config the New menu is empty and every health surface reads green". ## Why it matters A founded community with Collabora "installed" cannot create a single document until an hourly job runs — and that job is gone on any founding that raced cron (see #1828). The demo sat like this for 19 h.

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

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

close-report for #1827 — status success

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

envelope
{
  "issue": 1827,
  "status": "success",
  "commits": [
    "1ef11ae91ca67ca9d723f630b976a658c24adc67"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/roleDoors.ts",
    "docs/GOTCHAS.md",
    "internal/clan/files.go",
    "internal/clan/files_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go test ./internal/clan/ -run TestRenderFiles_ParsesUnderNix -v",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command gofmt -l internal/clan/files.go internal/clan/files_test.go",
      "exit_code": 0
    }
  ],
  "criteria": {
    "TestRenderFiles_* pins a DocsEditingHost render emits richdocuments:activate-config after the wopi_url set, inside a bounded retry, and a files-only render emits nothing richdocuments": "internal/clan/files_test.go TestRenderFiles_RichdocumentsActivatesConfigInBoundedRetry (activate-config after wopi_url set, inside `for _ in $(seq 1 20)` with `if $occ richdocuments:activate-config; then exit 0`, `sleep 15`) + TestRenderFiles_NoDocsEditingNoActivateConfig + existing TestRenderFiles_NoDocsEditingNoRichdocuments",
    "The oneshot exits non-zero when Collabora never answers (render test on script text)": "TestRenderFiles_RichdocumentsActivatesConfigInBoundedRetry asserts a trailing `exit 1` after the retry loop `done`; files.go emits it",
    "The roles-proof drive's docs-editing leg opens + New -> New document on a fresh founding before any visit to /settings/admin/richdocuments": "app/tests/e2e/fixtures/roleDoors.ts openCollaboraDocument now calls assertNewDocumentInFilesMenu FIRST (before templates/create and before proveDoorAs's assertAdminReached/assertAdminRefused visit to /settings/admin/richdocuments); the empty menu is the red, the templates OCS API it created through needs no capabilities",
    "GOTCHAS entry (same commit)": "docs/GOTCHAS.md #335 — a wopi_url set by occ is not an activated editor; richdocuments never fetches on read; without the hourly job or activate-config the New menu is empty and every health surface reads green"
  },
  "summary": "The files richdocuments oneshot now runs occ richdocuments:activate-config after the wopi_url set, in a bounded ~5 min retry that fails loud, so a founded community's editor is actually activated rather than left with an empty + New menu behind a green surface.",
  "blockers": []
}
**close-report** for #1827 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1827, "status": "success", "commits": [ "1ef11ae91ca67ca9d723f630b976a658c24adc67" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/roleDoors.ts", "docs/GOTCHAS.md", "internal/clan/files.go", "internal/clan/files_test.go" ], "tests": [ { "command": "nix develop .#go-ci --command go test ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go test ./internal/clan/ -run TestRenderFiles_ParsesUnderNix -v", "exit_code": 0 }, { "command": "nix develop .#go-ci --command gofmt -l internal/clan/files.go internal/clan/files_test.go", "exit_code": 0 } ], "criteria": { "TestRenderFiles_* pins a DocsEditingHost render emits richdocuments:activate-config after the wopi_url set, inside a bounded retry, and a files-only render emits nothing richdocuments": "internal/clan/files_test.go TestRenderFiles_RichdocumentsActivatesConfigInBoundedRetry (activate-config after wopi_url set, inside `for _ in $(seq 1 20)` with `if $occ richdocuments:activate-config; then exit 0`, `sleep 15`) + TestRenderFiles_NoDocsEditingNoActivateConfig + existing TestRenderFiles_NoDocsEditingNoRichdocuments", "The oneshot exits non-zero when Collabora never answers (render test on script text)": "TestRenderFiles_RichdocumentsActivatesConfigInBoundedRetry asserts a trailing `exit 1` after the retry loop `done`; files.go emits it", "The roles-proof drive's docs-editing leg opens + New -> New document on a fresh founding before any visit to /settings/admin/richdocuments": "app/tests/e2e/fixtures/roleDoors.ts openCollaboraDocument now calls assertNewDocumentInFilesMenu FIRST (before templates/create and before proveDoorAs's assertAdminReached/assertAdminRefused visit to /settings/admin/richdocuments); the empty menu is the red, the templates OCS API it created through needs no capabilities", "GOTCHAS entry (same commit)": "docs/GOTCHAS.md #335 — a wopi_url set by occ is not an activated editor; richdocuments never fetches on read; without the hourly job or activate-config the New menu is empty and every health surface reads green" }, "summary": "The files richdocuments oneshot now runs occ richdocuments:activate-config after the wopi_url set, in a bounded ~5 min retry that fails loud, so a founded community's editor is actually activated rather than left with an empty + New menu behind a green surface.", "blockers": [] } ``` </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#1827
No description provided.