feat: editor write path

This commit is contained in:
Florian Sylvain committed 2026-11-02 03:24:30 +01:00
1 parent d9158025d4
commit a0b3c58c52
88 files changed
+5738 -263

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
# QA: Create a translation (backend)
Backend only. Go tests in test/, black-box. No design states.
## Automated, no server (task test)
1. CreateTranslation use case over in-memory fakes (article, site, language, author and image repositories, a fake Transactor; unique type names). Table-driven over "Copy from the source version", "Start empty", "Request validation" and "One neutral answer". Assert the sentinels with errors.Is (language exists, language unavailable, language not enabled, source unavailable, source other story, setup required). The read check, the source recheck, the language check, the free-slug search, the insert and the source_revision capture run inside one Transactor.Run, and the copy and source_revision come from the same read.
2. Both endpoints reach the same use case: a spy asserts one call per request with identical arguments.
3. HTTP: NewHandler over use cases, a fresh chi router mirroring api/router.go (POST /{id}/translations and POST / inside the authtoken group, requireArticle(content.create)), validator.InitValidator(), httptest and a jwt cookie. Cover every Examples row: status, exact plain-text body, presence or absence of X-Existing-Article-Id. The three neutral situations are byte-identical in body and header set.
4. Race: two goroutines request the same language, one wins, the other gets language_unavailable.
5. Activity: a fake audit recorder receives article.create with params lang, story_id and source_article_id. Failure events contain no hidden-version data.
6. Regression: the existing POST /v1/article tests stay untouched, except the amended slice 1 scenario.
## Automated, SQLite file (task test)
7. Repository: the unique (story_id, lang) violation maps to the language-unavailable sentinel; the slug retry works within (site, lang); source_article_id and source_revision round-trip; the migration adds them without changing existing rows; a second Migrate changes nothing.
8. Concurrency: N goroutines create fr for one story, exactly one succeeds, busy retries are bounded.
## Automated, real databases (task test:mysql, task test:postgres)
9. Repeat 7-8 on MySQL 8.4, MariaDB 11 and PostgreSQL. Record NOT RUN if the daemon is down, or use the podman shim (see memory).
## Build and lint
10. task test, task lint:go and CGO_ENABLED=0 go build -tags nofrontend ./... pass. No comments in the added Go files.
11. docs/api documents the endpoint, bodies, codes and headers.
12. task mutate scoped with MUTATE_FILES to the new use case.
## Manual
None.