fix(webapp): "Link it" on Wiki health makes the link (#1157) #1164

Merged
claude-bot merged 20 commits from fix/1157-wiki-health-link-it into main 2026-10-13 03:42:37 +00:00
Collaborator

Closes #1157 (D301).

"Link it" beside an unlinked mention used to open the editor. It now makes the link in one press, with Undo.

  • Route: POST /campaigns/{id}/lore/{entry_id}/link-mention {to}, GM only. Saves through update_lore_entry as the acting GM (version row, link index, wiki event), and writes an audit event lore.mention_linked.
  • What is written: [[Title]] when the words equal the title exactly, else [[Title|the words]], so the GM's prose is kept. The editor's own suggestion now does the same.
  • What counts as a mention: wiki_health._bare_text blanks everything a renderer does not draw as prose (code, fences, links and embeds, web links and images, footnotes and their definitions, anchors, headings, marker lines). Where the server's reading and the frontend's could differ, the text is treated as not prose. The report and the route share it, so such mentions also leave the report.
  • Refusals: a target not shared with the table (422, so a hidden title never lands in text a player can read); an ambiguous title with no unique alias; a result over the body limit; a mention that is gone (409). Missing, other-campaign and trashed pages give the same 404.
  • Undo: the existing restore route with a new optional ?if_version_id=; refused with 409 if the page has changed since. The comparison is now made under the row lock.

Additive only; no bot contract change, no migration.

Review

An independent review found two must-fix defects (headings; footnote definitions masking a later mention) and nine smaller ones (blockquote grouping, fence disagreements, length caps, !/\ prefixes, unlinkable titles, two concurrency gaps, body limit and audit, Health page focus and refresh, editor agreement). All eleven are fixed, each with a test using the reviewer's input. The review found no authorisation or disclosure problem and no super-linear pattern at 200,000 characters.

Verified

On docker-test: tests/wiki in full (1626 passed, 1 failed: a title-reader guard, then fixed; only that file and two others were re-run, 92 passed). Ruff clean. Frontend lint clean, full vitest 4017 passed. Changelog check OK.

Not run: e2e/j8-wiki-health-link-it.spec.js (CI will); no race test for the locking.

Known limits: a pair whose only mentions sit in quote lines, lists or near a length cap can still be listed while the route refuses; it never writes wrongly. The audit row is a second commit after the link.

🤖 Generated with Claude Code

Closes #1157 (D301). "Link it" beside an unlinked mention used to open the editor. It now makes the link in one press, with Undo. - **Route**: `POST /campaigns/{id}/lore/{entry_id}/link-mention {to}`, GM only. Saves through `update_lore_entry` as the acting GM (version row, link index, wiki event), and writes an audit event `lore.mention_linked`. - **What is written**: `[[Title]]` when the words equal the title exactly, else `[[Title|the words]]`, so the GM's prose is kept. The editor's own suggestion now does the same. - **What counts as a mention**: `wiki_health._bare_text` blanks everything a renderer does not draw as prose (code, fences, links and embeds, web links and images, footnotes and their definitions, anchors, headings, marker lines). Where the server's reading and the frontend's could differ, the text is treated as not prose. The report and the route share it, so such mentions also leave the report. - **Refusals**: a target not shared with the table (422, so a hidden title never lands in text a player can read); an ambiguous title with no unique alias; a result over the body limit; a mention that is gone (409). Missing, other-campaign and trashed pages give the same 404. - **Undo**: the existing restore route with a new optional `?if_version_id=`; refused with 409 if the page has changed since. The comparison is now made under the row lock. Additive only; no bot contract change, no migration. ## Review An independent review found two must-fix defects (headings; footnote definitions masking a later mention) and nine smaller ones (blockquote grouping, fence disagreements, length caps, `!`/`\` prefixes, unlinkable titles, two concurrency gaps, body limit and audit, Health page focus and refresh, editor agreement). All eleven are fixed, each with a test using the reviewer's input. The review found no authorisation or disclosure problem and no super-linear pattern at 200,000 characters. ## Verified On `docker-test`: `tests/wiki` in full (1626 passed, 1 failed: a title-reader guard, then fixed; only that file and two others were re-run, 92 passed). Ruff clean. Frontend lint clean, full vitest 4017 passed. Changelog check OK. Not run: `e2e/j8-wiki-health-link-it.spec.js` (CI will); no race test for the locking. Known limits: a pair whose only mentions sit in quote lines, lists or near a length cap can still be listed while the route refuses; it never writes wrongly. The audit row is a second commit after the link. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test: list the title read in the report (#1157)
Some checks failed
CI / Bot/backend version sync (pull_request) Successful in 34s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Does this change touch the recording path? (pull_request) Successful in 24s
CI / Backend lint (ruff) (pull_request) Successful in 48s
CI / End-to-end journeys (desktop) (pull_request) Has been cancelled
CI / End-to-end journeys (keyboard) (pull_request) Has been cancelled
CI / End-to-end journeys (phone) (pull_request) Has been cancelled
CI / Backend migration, tests, and audit (pull_request) Has been cancelled
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Has been cancelled
CI / Frontend (shard 1/2) (pull_request) Has been cancelled
CI / Docker image build (pull_request) Has been cancelled
CI / Frontend (shard 2/2) (pull_request) Has been cancelled
CI / Feedback site tests (pull_request) Has been cancelled
CI / Bot tests and audit (pull_request) Has been cancelled
0329af3b1b
fix(e2e): j8 spec takes a fixture argument, uses the seeded campaign name (#1157)
Some checks failed
CI / Backend lint (ruff) (pull_request) Successful in 33s
CI / Feedback site tests (pull_request) Successful in 48s
CI / Does this change touch the recording path? (pull_request) Successful in 24s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Bot/backend version sync (pull_request) Successful in 47s
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m49s
CI / Bot tests and audit (pull_request) Successful in 2m9s
CI / Docker image build (pull_request) Successful in 5m52s
CI / Frontend (shard 2/2) (pull_request) Successful in 13m24s
CI / Frontend (shard 1/2) (pull_request) Successful in 16m38s
CI / End-to-end journeys (phone) (pull_request) Failing after 13m0s
CI / End-to-end journeys (keyboard) (pull_request) Failing after 20m6s
CI / End-to-end journeys (desktop) (pull_request) Failing after 20m19s
CI / Backend migration, tests, and audit (pull_request) Has been cancelled
52d2c63842
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(e2e): j8 reads the page from the GET's entry wrapper (#1157)
All checks were successful
CI / Backend lint (ruff) (pull_request) Successful in 34s
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m13s
CI / Bot/backend version sync (pull_request) Successful in 28s
CI / Feedback site tests (pull_request) Successful in 49s
CI / Docker image build (pull_request) Successful in 46s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Does this change touch the recording path? (pull_request) Successful in 30s
CI / Bot tests and audit (pull_request) Successful in 2m21s
CI / Frontend (shard 2/2) (pull_request) Successful in 10m4s
CI / Frontend (shard 1/2) (pull_request) Successful in 11m58s
CI / End-to-end journeys (phone) (pull_request) Successful in 12m21s
CI / End-to-end journeys (keyboard) (pull_request) Successful in 19m8s
CI / End-to-end journeys (desktop) (pull_request) Successful in 19m44s
CI / Backend migration, tests, and audit (pull_request) Successful in 33m39s
c92b99954e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-bot deleted branch fix/1157-wiki-health-link-it 2026-10-13 03:42:38 +00:00
Sign in to join this conversation.
No description provided.