fix(pageops): translate-plan and translate decide through one owner #281
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!281
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/275"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #275
What
planTranslation(root, page, lang, subpages)ininternal/pageops/translation.go. It decides the page's own refusal (in the translate's order:translation.exists→translation.addressTaken→translation.sourceParse) and, with subpages, which subpages are created and which are skipped (source does not parse, address taken). It needs no mode, label or schemas, and it returns the sources it read and parsed soTranslatedoes not read them again.TranslatePlanreturnslen(create) - 1from the owner. It now answers409 translation.addressTakenand422 translation.sourceParsejust as the translate does, and counts only subpages the translate will create.Translatevalidates the mode, calls the owner, then only renders (renderTranslation, the formertranslationByteswithout the parse step) and writes. The write and rollback code is unchanged.translationAddressTakenIn(tree, …)is now the body oftranslationAddressTaken, so the address rule still lives in one place and is unchanged.Decisions (as in the issue)
{subpages: number}.l10n.TranslateDocument, the front matter and the serializer. The translate fails with that error (the same 400/422 the page itself would get) and writes nothing.skippedlists only the two documented reasons. Checked:web/srcparsesskippedbut never displays it.Docs and comments
docs/api.md:GET /api/page/translate-plan: the "neither checks the address … nor parses the source" sentence and the "skipped subpages are counted" clause are gone. Its errors now list409 translation.addressTakenand422 translation.sourceParse.POST /api/page/translate: says a subpage render failure fails the translate.handlePageTranslatePlan/handlePageTranslate,TranslatePlan/Translate,fetchTranslatePlan,TranslateDialog.scaffold/site/AGENTS.mdchange: none of them describes this route (as the issue notes).Tests
internal/pageops/translation_test.go:len(Created) - 1.translation.serializeand writes and stamps nothing.internal/pageops/codes_test.go:TestTranslationErrorCodescovers the plan'stranslation.addressTaken.internal/server/translation_pages_test.go: the plan route answers the same status and coded body as the translate route for409 translation.addressTakenand422 translation.sourceParse.go vet ./...,go test ./...,gofmtand the web suite (npm test, 3213 tests) are all green.🤖 Generated with Claude Code
[autoland] verdict: pass
Verdict: CONCERNS (non-blocking). Approved, not auto-merged.
Signal relied on:
labctl pr checks 281aggregatesuccess(ci / build-and-test green, ci / release skipped) at headf8331bb. That run covers go vet/test, the docs drift tests and the route-doc test, so I did not re-run them. The head is current with main (merge-basebf70703), so there is no conflict.Conventions: the title is a Conventional Commit (
fix(pageops): …) and the body hasCloses #275. The diff stays within #275's scope (pageops owner, handler, docs/api.md, comments-only web changes). Skills and AGENTS.md are correctly left alone because the issue's out-of-scope list excludes them.Every acceptance criterion is met:
planTranslation(internal/pageops/translation.go) is the single owner, and bothTranslatePlanandTranslatecall it.translationAddressTakenInkeeps the address rule in one place.translation.addressTaken.Concern (docs drift, non-blocking):
### GET /api/page/translate-planerrors) is missing500page.read{detail}. The plan route can now return it:planTranslationreads the page and every candidate subpage throughreadTranslationSource(internal/pageops/translation.go:231, :243 → :266errInternal(apimsg.PageRead)), and before this PR the plan never read a source. The translate's list includespage.read, and the plan's list otherwise names all its 500s (page.readLanguages,page.buildTree). Fix: addpage.readto the plan's500group.Docs drift fixed in
fddd576:GET /api/page/translate-plannow lists500page.readalongsidepage.readLanguagesandpage.buildTree, sinceplanTranslationreads the page and every candidate subpage throughreadTranslationSource.go test ./docs/... ./internal/server/...is green.