fix(wiki): preserve page title on section updates #27

Merged
frank merged 1 commit from agent/issue-19-forge-wiki-update-kann-seite-zu-unnamed into main 2026-07-12 13:13:17 +02:00
Owner

Summary

  • Fixes #19: forge wiki update no longer renames pages to unnamed when --title is omitted
  • Forgejo requires the title in PATCH payloads; section/replace updates now send the existing page title
  • Adds PageUpdateTitle helper and regression tests for title preservation and PATCH payload

Test plan

  • go test ./internal/wiki/... ./internal/cmd/...
  • forge wiki update <page> --section … --replace-old … --replace-new … leaves title/Sub-URL unchanged
  • forge wiki update <page> --title "New Name" … still renames as expected
## Summary - Fixes #19: `forge wiki update` no longer renames pages to `unnamed` when `--title` is omitted - Forgejo requires the title in PATCH payloads; section/replace updates now send the existing page title - Adds `PageUpdateTitle` helper and regression tests for title preservation and PATCH payload ## Test plan - [x] `go test ./internal/wiki/... ./internal/cmd/...` - [ ] `forge wiki update <page> --section … --replace-old … --replace-new …` leaves title/Sub-URL unchanged - [ ] `forge wiki update <page> --title "New Name" …` still renames as expected
fix(wiki): preserve page title on section updates
All checks were successful
CI / test (pull_request) Successful in 24s
CI / race (pull_request) Successful in 24s
c795df192c
Forgejo resets wiki pages to "unnamed" when PATCH payloads omit title.
Send the existing title unless --title is set explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Author
Owner

🔗 Linked to issue #19. Babysitting CI until green…

🔗 Linked to issue #19. Babysitting CI until green…
Author
Owner

forge agent finished implementation

  • Commit: fix(wiki): preserve page title on section updates
  • Pull request: #27
  • Next: waiting for CI / babysitting fixes if needed
internal/cmd/wiki.go         |  2 +-
 internal/wiki/client.go      | 14 +++++++++--
 internal/wiki/client_test.go | 59 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 71 insertions(+), 4 deletions(-)
Agent output (tail)
Ich untersuche die Wiki-Update-Implementierung, um die Ursache für die Umbenennung zu „unnamed“ zu finden.
Ursache: Bei leerem `--title` wird kein Titel im PATCH mitgeschickt; Forgejo setzt die Seite dann auf „unnamed“. Ich behebe das und ergänze einen Regressionstest.
Tests bestanden. Als Nächstes erstelle ich den Commit.
## Zusammenfassung
**Ursache:** `forge wiki update` hat bei leerem `--title` keinen Titel im PATCH-Body mitgeschickt (`omitempty`). Forgejo setzt die Seite dann auf „unnamed“ — auch bei reinen Section-Updates.
**Fix:**
- Neue Hilfsfunktion `wiki.PageUpdateTitle(current, rename)` — liefert den bestehenden Titel, außer `--title` ist gesetzt
- `forge wiki update` übergibt den Titel der geladenen Seite an `UpdatePage`
- Regressionstests für Titel-Logik und PATCH-Payload
PR_TITLE: fix(wiki): preserve page title on section updates
PR_BODY:
## Summary
- Fixes #19: `forge wiki update` no longer renames pages to `unnamed` when `--title` is omitted
- Forgejo requires the title in PATCH payloads; section/replace updates now send the existing page title
- Adds `PageUpdateTitle` helper and regression tests for title preservation and PATCH payload
## Test plan
- [x] `go test ./internal/wiki/... ./internal/cmd/...`
- [ ] `forge wiki update <page> --section … --replace-old … --replace-new …` leaves title/Sub-URL unchanged
- [ ] `forge wiki update <page> --title "New Name" …` still renames as expected
✅ **forge agent finished implementation** - Commit: `fix(wiki): preserve page title on section updates` - Pull request: https://repository.hildebrandt.io/frank/forgecli/pulls/27 - Next: waiting for CI / babysitting fixes if needed ``` internal/cmd/wiki.go | 2 +- internal/wiki/client.go | 14 +++++++++-- internal/wiki/client_test.go | 59 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 4 deletions(-) ``` <details><summary>Agent output (tail)</summary> ``` Ich untersuche die Wiki-Update-Implementierung, um die Ursache für die Umbenennung zu „unnamed“ zu finden. Ursache: Bei leerem `--title` wird kein Titel im PATCH mitgeschickt; Forgejo setzt die Seite dann auf „unnamed“. Ich behebe das und ergänze einen Regressionstest. Tests bestanden. Als Nächstes erstelle ich den Commit. ## Zusammenfassung **Ursache:** `forge wiki update` hat bei leerem `--title` keinen Titel im PATCH-Body mitgeschickt (`omitempty`). Forgejo setzt die Seite dann auf „unnamed“ — auch bei reinen Section-Updates. **Fix:** - Neue Hilfsfunktion `wiki.PageUpdateTitle(current, rename)` — liefert den bestehenden Titel, außer `--title` ist gesetzt - `forge wiki update` übergibt den Titel der geladenen Seite an `UpdatePage` - Regressionstests für Titel-Logik und PATCH-Payload PR_TITLE: fix(wiki): preserve page title on section updates PR_BODY: ## Summary - Fixes #19: `forge wiki update` no longer renames pages to `unnamed` when `--title` is omitted - Forgejo requires the title in PATCH payloads; section/replace updates now send the existing page title - Adds `PageUpdateTitle` helper and regression tests for title preservation and PATCH payload ## Test plan - [x] `go test ./internal/wiki/... ./internal/cmd/...` - [ ] `forge wiki update <page> --section … --replace-old … --replace-new …` leaves title/Sub-URL unchanged - [ ] `forge wiki update <page> --title "New Name" …` still renames as expected ``` </details>
frank merged commit bd82e93b6c into main 2026-07-12 13:13:17 +02:00
frank deleted branch agent/issue-19-forge-wiki-update-kann-seite-zu-unnamed 2026-07-12 13:13:17 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
frank/forgecli!27
No description provided.