bruno: replace Python generator with Go golden-writer in the drift test

The generator moves into the Go toolchain per repo preference:
internal/docs/bruno_gen.go emits the OpenCollection mirrors (same output
contract — gate-verified example-request bodies, env-var params,
device-token headers, login/register/refresh token-capture scripts) and
TestBrunoMirrorsDocs grows a -update flag: verification by default,
regeneration on demand:

  go test ./internal/docs -run TestBrunoMirrorsDocs -update

Generator and checker are now the same code — they cannot drift apart.
scripts/gen_bruno_from_docs.py deleted; opencollection.yml README points
at the go-test command.

Also fixed vs the Python pass: mirror placement follows the docs tree
folder (RelPath), not the area frontmatter (several docs — highlights,
notes, ratings, users, progress — carry a different area); docs blocks
emit the collection's mapping form (content + type), not a bare scalar;
JSON body sanity is checked at generation time.

Idempotent: back-to-back -update runs are byte-identical.
make test green (9 pkgs).
This commit is contained in:
John O'Keefe committed 2026-10-24 18:47:56 -04:00
1 parent acd82fff0a
commit cfcd95b25e
195 files changed
+1479 -1073

No files matched your search

+6 -4
View File
@@ -16,9 +16,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Get Library
docs:
content: |-
# Get Library
`GET /api/sync/koreader/library` — auth: device-token.
`GET /api/sync/koreader/library` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/get_library.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/get_library.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -16,9 +16,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Get Metadata
docs:
content: |-
# Get Metadata
`GET /api/sync/koreader/metadata/:uuid` — auth: device-token.
`GET /api/sync/koreader/metadata/:uuid` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/get_metadata.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/get_metadata.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -16,9 +16,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Get KOReader Rating
docs:
content: |-
# Get KOReader Rating
`GET /api/sync/koreader/rating` — auth: device-token.
`GET /api/sync/koreader/rating` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/get_rating.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/get_rating.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -16,9 +16,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Get KOReader Review
docs:
content: |-
# Get KOReader Review
`GET /api/sync/koreader/review` — auth: device-token.
`GET /api/sync/koreader/review` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/get_review.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/get_review.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -22,9 +22,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Push KOReader Stats
docs:
content: |-
# Push KOReader Stats
`POST /api/sync/koreader/stats` — auth: device-token.
`POST /api/sync/koreader/stats` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/push_stats.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/push_stats.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -16,9 +16,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Resolve Book:<|end|><|start|> assistant to=edit<|channel|>analysis <|constrain|>xml<|message|><rfl:parameter name="path">
docs:
content: |-
# Resolve Book:<|end|><|start|> assistant to=edit<|channel|>analysis <|constrain|>xml<|message|><rfl:parameter name="path">
`GET /api/sync/koreader/resolve` — auth: device-token.
`GET /api/sync/koreader/resolve` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/resolve_book.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/resolve_book.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -22,9 +22,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Set KOReader Rating
docs:
content: |-
# Set KOReader Rating
`POST /api/sync/koreader/rating` — auth: device-token.
`POST /api/sync/koreader/rating` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/set_rating.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/set_rating.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -22,9 +22,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Set KOReader Review
docs:
content: |-
# Set KOReader Review
`POST /api/sync/koreader/review` — auth: device-token.
`POST /api/sync/koreader/review` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/set_review.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/set_review.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -45,9 +45,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Sync Bookmarks
docs:
content: |-
# Sync Bookmarks
`POST /api/sync/koreader/bookmarks` — auth: device-token.
`POST /api/sync/koreader/bookmarks` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/sync_bookmarks.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/sync_bookmarks.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown
+6 -4
View File
@@ -39,9 +39,11 @@ settings:
followRedirects: true
maxRedirects: 5
docs: |-
# Sync Progress
docs:
content: |-
# Sync Progress
`POST /api/sync/koreader/progress` — auth: device-token.
`POST /api/sync/koreader/progress` — auth: device-token.
Canonical reference: `docs/developer/api/koreader/sync_progress.md` (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, not this file.
Canonical reference: docs/developer/api/koreader/sync_progress.md (docs site → Developer → API). This request is GENERATED from that doc; edit the doc, then run the drift test with -update.
type: text/markdown