Compare commits

..

179 Commits

Author SHA1 Message Date
Jakub Zych
ef47baf0a1 docs(quick-261106-jhk): MCP authorize drops OIDC identity scopes for the ChatGPT connector 2026-11-06 14:35:14 +01:00
Jakub Zych
aba678b196 fix(wristband): drop OIDC identity scopes at MCP authorize
Clients that also read the issuer's OpenID Connect discovery document
add openid, profile or email to their MCP authorize request, and the
MCP flavour refused those requests with invalid_scope ("scope contains
an unsupported value"), so they could not connect.

The three identity scopes are now dropped before the allow-list check,
as RFC 6749 section 3.3 lets a server grant fewer scopes than requested.
A request left with no other scope gets the read default. Any other
unknown scope, including a differently cased identity name, is still
refused. The MCP flavour still never grants identity scopes or issues
an id_token, and the metadata document is unchanged.
2026-11-06 14:17:43 +01:00
Jakub Zych
5db032f52f docs(35): UI design contract 2026-11-06 11:56:48 +01:00
Jakub Zych
928ae0097d docs(35): capture phase context 2026-11-06 11:02:13 +01:00
Jakub Zych
c755209964 docs: add phase 35 - mail templates and layouts editor 2026-11-06 10:18:59 +01:00
Jakub Zych
31acec420a docs(quick-261106-e5v): purge token rename leftovers, todo closed 2026-11-06 10:12:29 +01:00
Jakub Zych
d9d57c7411 docs(quick-261106-dv0): shared plugin boot logs at Debug, todo closed 2026-11-06 10:02:16 +01:00
Jakub Zych
8a600ca704 docs(quick-261106-d20): fonoteka.go uploads named after the sniffed type, attach.UploadWriterOptions exported, 2 todos closed 2026-11-06 09:38:19 +01:00
Jakub Zych
903859a131 feat(lagoon/attach): export UploadWriterOptions for blob writers that bypass Store (quick-261106-d20)
- attach.UploadWriterOptions (was the unexported uploadWriterOptions) gives
  code that writes an upload to the bucket itself the same Content-Type and
  Content-Disposition: attachment for non-inline types that attach.Store stores
- writeBlob calls it; Store behaviour unchanged
- TestUploadWriterOptions table test
- lagoon README, docs/database/attachments.md and docs/services/storage.md
  describe it for writers that bypass attach.Store
2026-11-06 09:31:51 +01:00
Jakub Zych
9fa740e8b7 docs: capture todo - blob writers that bypass attach.Store set Content-Disposition 2026-11-06 09:18:55 +01:00
Jakub Zych
895248eef2 docs(quick-batch-261105-oc4): security hardening batch, 5 items, 12 todos closed 2026-11-05 18:46:35 +01:00
Jakub Zych
27c98bf22a fix(lagoon/attach): StaticHandler sends the stored Content-Disposition and nosniff (quick-261105-oc8)
- attach.StaticHandler and attach.StaticHandlerPublic set X-Content-Type-Options: nosniff on every response
- the stored disposition is read with one Attributes call after the is_public gate and sent on GET and HEAD; a value mime.ParseMediaType rejects is sent as attachment
- blobs without a stored disposition are served as before
- lagoon README, storage and attachments docs pages, surf uploads comment updated
2026-11-05 18:13:27 +01:00
Jakub Zych
5aa846c5e8 docs(quick-261105-eab): OIDC grant flows serialized with revoke 2026-11-05 10:42:26 +01:00
Jakub Zych
f9255272c0 docs(phase-20): add security threat verification 2026-11-05 10:17:05 +01:00
Jakub Zych
1b1a553fb6 docs(phase-19.4.1): add security threat verification 2026-11-05 10:12:53 +01:00
Jakub Zych
95cced94fc docs(phase-11.2): add security threat verification 2026-11-05 10:09:29 +01:00
Jakub Zych
71dc0485ee docs(quick-261105-din): fix 32.1 CR-01, consent allow serialized with revoke 2026-11-05 10:00:02 +01:00
Jakub Zych
8c6b3171a8 docs(phase-19.3): add security threat verification 2026-11-05 09:33:44 +01:00
Jakub Zych
7490a310ce docs(phase-34): add security threat verification 2026-11-05 09:32:29 +01:00
Jakub Zych
439a994aac docs(phase-32.1): add security threat verification 2026-11-05 09:30:38 +01:00
Jakub Zych
7b8d205613 docs: add backlog item 999.2, SEO follow-ups after Phase 33 (v0.6.2) 2026-11-05 02:33:31 +01:00
Jakub Zych
1846e98c0f docs(33): phase 33 re-verification after the release (human_needed)
Covers 33-14-SUMMARY.md, the release and deploy logs and the release notes. Release items settled: tags, changelog posts, grzybyfunkcjonalne.pl sitemaps and post head, G1 on the demo; W5 SQL check waived by Jakub. Open: live MCP session, Rich Results Test, visual and admin checks (with grzyby checklist items 3, 5, 6, 7). Seeds 33-UAT.md.
2026-11-05 02:32:51 +01:00
Jakub Zych
7049dffd9a docs(phase-33): tick 33-14 in the roadmap 2026-11-05 02:26:02 +01:00
Jakub Zych
94c47268b5 docs(33-14): complete the tests, gate and release plan 2026-11-05 02:25:43 +01:00
Jakub Zych
6875627fdf docs(33-14): grzybyfunkcjonalne.pl step 12, smoke ok and the 404 log cleared 2026-11-05 02:24:10 +01:00
Jakub Zych
201fd0fbf9 docs(33-14): release log, post-release verification 2026-11-05 02:20:44 +01:00
Jakub Zych
211687f439 docs(33-14): release log, deploys of summercms.io, the demo, bm and grzybyfunkcjonalne.pl 2026-11-05 02:15:17 +01:00
Jakub Zych
ef164dda8e docs(33-14): release log, app pins and pushes 2026-11-05 02:01:35 +01:00
Jakub Zych
143b4dbdca docs(33-14): changelog posts and the layer patch releases 2026-11-05 01:36:02 +01:00
Jakub Zych
8edc869963 docs(33-14): release log, tags pushed and the layer install check failure 2026-11-05 01:25:43 +01:00
Jakub Zych
6d14f71ae5 style: gofmt 2026-11-05 01:00:36 +01:00
Jakub Zych
9c11b7064d docs(33): phase 33 re-verification after gap closure (human_needed) 2026-11-05 00:55:53 +01:00
Jakub Zych
6e99b1886a docs(quick-261104-xae): phase 33 gap-fix follow-ups and the gap-fix re-review 2026-11-05 00:32:56 +01:00
Jakub Zych
9d299a4455 docs(33): release notes for the gap-fix follow-ups (quick-261104-xae) 2026-11-05 00:23:39 +01:00
Jakub Zych
5ce50bedfb docs(phase-33): update tracking after 33-15 2026-11-04 23:42:46 +01:00
Jakub Zych
9637100ffa docs(33-15): complete the Go plugins gap-closure plan 2026-11-04 23:42:41 +01:00
Jakub Zych
fec697bb15 docs(33-15): release notes, release log and deferred items for the gap fixes 2026-11-04 23:30:59 +01:00
Jakub Zych
1f968994e1 docs(lagoon): attach/webp also decodes WebP
Importing attach/webp registers the encoder library's WebP decoder ahead
of the pure Go one for the whole process, so WebP uploads are decoded
through the system libwebp when it is installed. The lagoon README and
the attachments page say so and name -tags nodynamic.
2026-11-04 23:29:29 +01:00
Jakub Zych
0e951270aa docs(phase-33): update tracking after 33-16 2026-11-04 22:58:55 +01:00
Jakub Zych
a0ac2a1ee7 docs(33-16): complete the Nuxt layers gap-closure plan 2026-11-04 22:58:07 +01:00
Jakub Zych
c2e56ef339 docs(33-16): release-note drafts for the layer fixes
- vue-seo-layer v0.2.0: the route report's noindex paths, sitemap pages per
  locale and not over a catch-all, root files 503 while the backend is unknown
- vue-journal-layer v0.8.0: path-form listing routes, the catch-all upgrade
  note, post article meta
- vue-menu-layer and vue-faq-layer v0.5.0: the catch-all upgrade note
2026-11-04 22:55:40 +01:00
Jakub Zych
8d562004cb docs(33): gap-closure plans 33-15 (Go plugins) and 33-16 (Nuxt layers) 2026-11-04 22:37:13 +01:00
Jakub Zych
97abc77b14 docs(33): phase 33 verification before release (gaps_found) 2026-11-04 21:28:57 +01:00
Jakub Zych
133c3cfd1c docs(33): pre-release code review of phase 33 (four lanes) 2026-11-04 21:26:39 +01:00
Jakub Zych
c7a485177e docs(33-14): demo locale patches, release-note drafts and open items for the release checkpoint
- 33-14-vue-demo-app-locale.patch and 33-14-sm-demo-app-locale.patch move the
  demo to prefix_except_default on top of the 33-12 demo patches
- release-note drafts for the framework, the three plugins and four layers
- the read-only RISK-MAX query for production databases
- deferred items and the broken-windows ledger after the six fixes
2026-11-04 20:25:55 +01:00
Jakub Zych
3d72923617 docs(33-14): validation map 2026-11-04 20:25:45 +01:00
Jakub Zych
fbe9816a50 test: phase 33 gate, layer, consumer and admin stages
- layers: node --test runs checked with a TAP detector (self-tested), every
  vue-seo-layer smoke, guard:check and purge:check, all five journal
  expectation files (postTitleTag h1 and p), the journal purge checks and
  check-git-install.sh --self-test
- consumers: the 33-12 and 33-13 app patches pass git apply --check, and
  the 33-14 demo locale patches apply on top of the 33-12 ones in scratch
  worktrees
2026-11-04 20:25:36 +01:00
Jakub Zych
eb8a0280ca test: unit tests for content facts, field type request options, variant keys and WebP
- pact: the content kinds and tools, zero facts, the value types
- cabana: mergeRequestOptions precedence, one call per type, fail-open,
  no shared maps
- attach: VariantKey on thumbnail names
- attach/webp: every image kind, the stored content type, the
  broken-image thumbnail and a refused mode
2026-11-04 19:54:54 +01:00
Jakub Zych
513793a13d test: phase 33 gate, Go stages
- go: the framework's new unit tests by required name
- plugins: the sitemap, SEO and Journal unit tests by required name
- docker: the phase's Postgres suites by required name per plugin,
  TestChromeRenderer when a Chrome or Chromium binary is present, and the
  framework's lagoon/attach packages
2026-11-04 19:54:54 +01:00
Jakub Zych
96750982f2 docs(phase-33): update tracking after 33-13 2026-11-04 19:14:33 +01:00
Jakub Zych
5905e2b2e8 docs(33-13): complete the grzybyfunkcjonalne.pl plan
- deploy log: after-tags, production in 33-14 (no separate uat since the
  2026-10-31 cutover), the en and Additional addresses steps confirmed at
  the 33-14 release checkpoint, the production check list
- summary with the rehearsal, head diff and self-check
- deferred items: the demo moves to prefix_except_default (decided)
2026-11-04 19:14:02 +01:00
Jakub Zych
7199b26bb7 docs(33-13): grzyby patches for the release
- sm-grzybyfunkcjonalne-app: Journal tag pages off and author pages at
  /autor/:author, the sitemap and SEO config, nginx without the root-file
  locations (P33-49), check-deploy, smoke.sh (companions, route report,
  page names, seo-pages.csv, Additional addresses, rebuild), smoke-seo.sh,
  urls.txt, pl as the only enabled locale, seo-settings.yaml with the
  author templates and page suffix, DEPLOY.md release steps, tests
- vue-grzybyfunkcjonalne-app: nuxt.config on the SEO layer options
  without @nuxtjs/seo keys, no page useSeoMeta, footer sitemap link,
  title template for pages the CMS does not answer, SEO fixtures from
  the rehearsal
- local wiring note and the deferred findings
2026-11-04 18:17:26 +01:00
Jakub Zych
c59b3e61ed docs(phase-33): update tracking after 33-12 2026-11-04 18:13:05 +01:00
Jakub Zych
81c81c0c7d docs(33-12): complete the demo, summercms.io and bm plan
SUMMARY with the smoke output, the 33-14 hand-off (pins, linking, rome
steps) and the demo's /pl/ finding; deferred items and two WINDOWS
entries.
2026-11-04 18:12:25 +01:00
Jakub Zych
298c81d701 docs(33-12): demo patch tags a post in TestSEOOutput
demo:seed tags no post, so the tag_pages check in TestSEOOutput passed
without config/golem15.journal.yaml as well. The test now tags the seeded
post and requires /blog/tag/releases to resolve not_found; without the
config it fails.
2026-11-04 18:05:15 +01:00
Jakub Zych
e1d5110b29 docs(33-12): app patches for the release
- sm-demo-app: Journal, sitemap and SEO config, nginx without sitemap
  locations, env templates, DEPLOY.md SEO steps, seo-pages.csv,
  TestSEOOutput, scripts/smoke-seo.sh, release smoke on the new format
- vue-demo-app: seo.noindexRoutes for the decks, page meta for auth and
  signed-in pages, SeoSitemapLink in the footer, @nuxtjs/seo keys removed
- vue-summercmsio-app: changelog on seo.cms false, expectations for it
- sm-summercmsio-app: no change beyond the pin bumps
- 33-12-local-wiring.md: the scratch wiring for 33-13 and 33-14
2026-11-04 18:02:08 +01:00
Jakub Zych
617e15dcf0 docs(phase-33): update tracking after 33-11 2026-11-04 17:23:25 +01:00
Jakub Zych
0528e6661a docs(33-11): complete auto-links, internal links and WebP variants plan 2026-11-04 17:22:20 +01:00
Jakub Zych
5c0722429b feat(lagoon): WebP variants of attachment thumbnails
- attach.VariantKey: a thumbnail's copy in another format next to it
- attach/webp (separate package, so only binaries that import it link
  the encoder): Encode at quality 80 and Variant, which writes the WebP
  copy of a thumbnail once and leaves no file on a failed encode
- github.com/gen2brain/webp v0.6.4, decided in
  .planning/notes/2026-10-28-webp-gen2brain.md
- lagoon README and docs/database/attachments.md
2026-11-04 16:52:59 +01:00
Jakub Zych
1bb2ecf9cc docs(33-11): WebP decision note and STACK row
github.com/gen2brain/webp pinned at v0.6.4 (approved 2026-11-04), with
how it runs (purego or the wasm2go-transpiled libwebp), the linking
consequence, the benchmark and where the code lives.
2026-11-04 16:45:01 +01:00
Jakub Zych
3bfdc8616e docs(phase-33): update tracking after 33-10 2026-11-04 16:10:14 +01:00
Jakub Zych
d434b8ed19 docs(33-10): complete site audit crawler plan 2026-11-04 16:10:14 +01:00
Jakub Zych
835bf3f74c docs(33-10): resolver rule order in the chromedp note 2026-11-04 15:58:44 +01:00
Jakub Zych
e9504b1ece docs(33-10): chromedp decision note and STACK row 2026-11-04 15:43:58 +01:00
Jakub Zych
e245b54ad9 docs(phase-33): update tracking after 33-06 2026-11-04 14:44:16 +01:00
Jakub Zych
00c8fac080 docs(33-06): complete structured data, breadcrumbs, hreflang and pagination plan
- Task 4 answers: chromedp v0.21.0 and gen2brain/webp v0.6.4 approved
- the tracer resolve answer for the layer fixtures
- deferred: a repeater cannot carry a trigger (local_hours)
2026-11-04 14:44:16 +01:00
Jakub Zych
bd36b18729 docs(phase-33): update tracking after 33-09 2026-11-04 14:22:51 +01:00
Jakub Zych
80d03e741a docs(33-09): complete journal, menu and FAQ layers on the SEO layer plan 2026-11-04 14:22:04 +01:00
Jakub Zych
122aa0786e docs(phase-33): update tracking after 33-05 2026-11-04 13:55:11 +01:00
Jakub Zych
eba9567614 docs(33-05): complete SEO sitemap filter, page registry and site endpoints plan 2026-11-04 13:54:09 +01:00
Jakub Zych
1cc47f6d83 docs(phase-33): update tracking after 33-04 2026-11-04 12:45:25 +01:00
Jakub Zych
35d27d2e03 docs(33-04): complete sitemap extras plan
- 33-04-SUMMARY.md: image and News sitemaps, IndexNow, HTML sitemap API,
  management API and MCP tools in sm-sitemap-plugin
- deferred-items.md: taglist options cannot come from records
- WINDOWS.md: #29 fixed, #31 the News sources taglist deviation
2026-11-04 12:44:35 +01:00
Jakub Zych
01a316a96c docs(33-04): update the IndexNow coverage matrix 2026-11-04 12:27:13 +01:00
Jakub Zych
7bf3399a69 docs(phase-33): update tracking after 33-08 2026-11-04 12:07:28 +01:00
Jakub Zych
d581da5c92 docs(33-08): complete vue-seo-layer build guard, noindex routes and components plan 2026-11-04 12:06:43 +01:00
Jakub Zych
3ce8a36742 docs(quick-261104-fx1): min/max length on text fields and pl validation messages 2026-11-04 11:48:41 +01:00
Jakub Zych
145251481b fix(phrasebook): translate the pl string message and the numeric min/max lines (quick-261104-fx1)
- pl validation.yaml string line is Polish (Winter's pl file leaves it
  in English); the header notes the deliberate divergence
- pl validate.yaml min and max use Winter's numeric wording, since those
  keys only serve numeric and integer bounds
2026-11-04 11:42:48 +01:00
Jakub Zych
335f8e608e feat(lagoon): check min and max as length on every non-numeric field (quick-261104-fx1)
- min and max compare the characters of a string or a number's decimal
  form and the element count of a slice or map on any field without
  numeric or integer (Laravel's getSize), with the min.array and
  max.array messages for lists
- blank values, booleans, dates and byte slices are not measured; a
  malformed bound is an error on every non-numeric field
- reverse the 261104-f4x pin, prove it through the cabana settings save
  sequence, and update the README, docs and the storePassword comment
2026-11-04 11:42:15 +01:00
Jakub Zych
0785336a50 docs(phase-33): update tracking after 33-03 2026-11-04 11:29:49 +01:00
Jakub Zych
2c67f46aee docs(33-03): complete Golem15.Sitemap rewrite plan 2026-11-04 11:29:49 +01:00
Jakub Zych
7e6c42638c docs(quick-261104-f4x): lagoon.Validate string and url rules 2026-11-04 11:14:28 +01:00
Jakub Zych
d166f1c308 feat(lagoon): check min and max as character length on string and url fields (quick-261104-f4x)
- on a string or url field that is not numeric or integer, min and max
  compare utf8.RuneCountInString (Laravel's mb_strlen) and answer with
  the lagoon::validation min.string / max.string messages
- a min or max argument that is not a whole number is the
  unrecognized-rule error, whatever the value
- rule strings without string or url keep their results (pinned by a
  test); between is unchanged
2026-11-04 11:13:09 +01:00
Jakub Zych
d2ce3a2c3b feat(lagoon): accept string and url rules in lagoon.Validate (quick-261104-f4x)
- string requires a string value (pointers and named string types
  included), url a URL matching Laravel's pattern (urlPattern, shared
  with lagoon.ValidateRequest); both skip an empty or blank value
- lagoon::validate.string and .url in the en and pl catalogs, English
  fallbacks for a nil translator
- settings saves whose model rules use nullable|string|max:255 or
  nullable|url|max:500 no longer fail with an unrecognized-rule error
2026-11-04 11:08:06 +01:00
Jakub Zych
617eaef78e docs: capture todo - Enforce min/max length on text fields in lagoon.Validate 2026-11-04 11:05:55 +01:00
Jakub Zych
1e38cb2da2 docs(phase-33): update tracking after 33-02 2026-11-04 10:41:26 +01:00
Jakub Zych
dd6890e905 docs(33-02): complete Journal headings, editor and content facts plan 2026-11-04 10:40:50 +01:00
Jakub Zych
770aa1e216 docs(phase-33): update tracking after 33-07 2026-11-04 09:36:34 +01:00
Jakub Zych
94f3699cc4 docs(33-07): complete vue-seo-layer runtime plan
- SUMMARY: Task 1 answer (vue-seo-layer), Jakub's extend-in-place ruling,
  v0.1.1 compatibility evidence, deviations; next layer tag v0.2.0
- deferred-items: path canonicals under swr (pre-existing in v0.1.1)
2026-11-04 09:35:51 +01:00
Jakub Zych
b6180a7dac docs(phase-33): update tracking after 33-01 2026-11-04 08:51:10 +01:00
Jakub Zych
03fc292c8b docs(33-01): complete framework seams, phase gate and release ledger plan 2026-11-04 08:50:35 +01:00
Jakub Zych
21aa4e575f docs(33-01): release log for v0.6.1
- planned contents of framework v0.6.1: the two 33-01 seams and the
  gate script; the six Phase 32 fixes listed as already released in
  v0.5.2
- newest plugin and layer tags with no unreleased commits; versions
  read from git tag in 33-14
- release order and an empty executed-steps table
2026-11-04 08:47:58 +01:00
Jakub Zych
6ea43bb120 test: phase 33 gate script
- scripts/check-phase33.sh with the stages self-test, go, plugins,
  layers, consumers, docker, admin, docs, marker, additive and compat,
  and --all; no argument prints the usage and exits 2
- engine taken from check-phase32.sh (go test -json and vitest
  detectors, scratch sibling farm, apisurface additive comparison)
- marker diffs from v0.6.0 and adds sitemap, JSON-LD and the
  application names; additive compares against the newest tag not
  containing HEAD
- a missing repository fails with "missing <path>"; the self-test
  plants an API removal, an interface method, a marker hit, a failing
  go test and a missing repository
2026-11-04 08:47:42 +01:00
Jakub Zych
4cd35c9d66 feat(cabana): per-request options for plugin field types
- pact.FormFieldType gains RequestOptions, called with the application's
  database once per form schema request for each type the form uses
- the form schema route merges the answer into a copy of each field's
  typeOptions; a fields.yaml key wins, the compiled schema never changes
- an error logs one warning naming the type and serves the fields.yaml
  options only
- TestFieldTypeRequestOptions covers every screen, the precedence, the
  call count, the error path, unchanged schemas, form extension fields
  and the authenticated handler; a runnable example backs the docs
- the typeOptions description, the regenerated OpenAPI document and
  schema.d.ts, the field types page and the pact and cabana READMEs
  document it
2026-11-04 08:40:09 +01:00
Jakub Zych
561a56c768 feat(signpost): content descriptor fields for dates, parents, authors, media and outline
- pact.ContentDescriptor gains Kind and Tools with the ContentKind and
  ContentTool constants
- pact.ContentRecord gains PublishedAt, Parents, Authors and TopHeading;
  pact.ContentLocale gains Images, Videos and Headings, with the value
  types ContentRef, ContentPerson, ContentImage, ContentVideo and
  ContentHeading; every field is optional
- TestContentDescriptorFields proves signpost hands them through and
  that a type setting none of them describes as before
- the runnable content example, the pact and signpost READMEs and the
  menu item types page document the fields
2026-11-04 08:31:49 +01:00
Jakub Zych
399efed845 docs(20): review disposition after the gap closure
- CR-01, CR-02, CR-03, WR-01, WR-04 and WR-05 fixed, with commits, tags
  and the live checks of release 195aa213c546
- WR-02, WR-03, WR-06 and IN-01 to IN-09 deferred, one todo each
2026-11-03 23:07:32 +01:00
Jakub Zych
2035563fc7 docs(phase-20): update tracking after wave 7 2026-11-02 18:50:35 +01:00
Jakub Zych
8afc9bbc3e docs(20-08): call and session fixes summary 2026-11-02 18:50:35 +01:00
Jakub Zych
d1be8aa54d docs(20-07): filter hardening summary 2026-11-02 18:50:35 +01:00
Jakub Zych
762f0ae9aa docs(phase-20): add gap-closure plans 20-07 to 20-09 to the roadmap 2026-11-02 18:23:43 +01:00
Jakub Zych
5da9387427 docs(20): gap-closure plans for the code review findings
Claude-Session: https://claude.ai/code/session_01BK6kckmLyJ4a91Vm9rqaDP
2026-11-02 18:20:39 +01:00
Jakub Zych
f3032950be docs(20): code review of the chat family and the demo 2026-11-02 00:53:14 +01:00
Jakub Zych
a4b32b14e6 docs(phase-20): update tracking after wave 6 2026-11-02 00:38:09 +01:00
Jakub Zych
b113e12215 docs(20-06): unit tests for the chat family, two-browser checks and the live sign-off summary 2026-11-02 00:37:58 +01:00
Jakub Zych
8a3ac87abb docs(phase-20): update tracking after wave 5 2026-11-01 18:41:06 +01:00
Jakub Zych
079ef3e61e docs(20-05): chat family deployed on demo.summercms.io with its own LiveKit summary
Claude-Session: https://claude.ai/code/session_01BK6kckmLyJ4a91Vm9rqaDP
2026-11-01 18:40:42 +01:00
Jakub Zych
6389479906 docs(phase-20): update tracking after wave 4 2026-10-31 20:11:45 +01:00
Jakub Zych
d50a1575ca docs(20-04): forum, friends and video-call layers v0.1.0 on the demo site summary 2026-10-31 20:11:26 +01:00
Jakub Zych
0301dc2ae4 docs(20-04): API coverage of livekit-client, LiveKit, Centrifugo and Web Push 2026-10-31 15:07:39 +01:00
Jakub Zych
b40c519747 docs(phase-20): update tracking after wave 3 2026-10-31 14:20:33 +01:00
Jakub Zych
f1236743ae docs(20-03): vue-chat-layer v0.1.0 and chat on the demo site summary 2026-10-31 14:19:57 +01:00
Jakub Zych
baa0f20eb2 docs(phase-20): update tracking after wave 2 2026-10-30 19:13:00 +01:00
Jakub Zych
00607d165d docs(20-02): demo backend for the chat family summary 2026-10-30 19:11:58 +01:00
Jakub Zych
d6f490a9ab docs(20-02): close the sm-demo-app journal/oauthserver pointer todo
Already done by sm-demo-app 2133309 and 5ec5941 (oauthserver v0.1.6,
journal v0.2.6).
2026-10-30 18:37:35 +01:00
Jakub Zych
159cd5ecf4 docs(phase-20): update tracking after wave 1 2026-10-30 18:26:41 +01:00
Jakub Zych
2d28c9485c docs(20-01): chat family release summary 2026-10-30 18:25:54 +01:00
Jakub Zych
677e30f6f5 docs(34): record the v0.6.0 release, summercms.io and demo deploys 2026-10-30 15:54:28 +01:00
Jakub Zych
76288cd9e8 test(34): persist human verification items as UAT 2026-10-30 12:41:26 +01:00
Jakub Zych
f6d4c67314 test(34): persist human verification items as UAT 2026-10-30 12:40:44 +01:00
Jakub Zych
024fd82732 docs(34): re-verification passes, presentations ledger counts 2026-10-30 12:40:44 +01:00
Jakub Zych
c739a7dd06 docs(34): presentations v0.1.2 includes the sztab theme commit 2026-10-30 12:34:00 +01:00
Jakub Zych
211be60648 docs(34): roll out plugin.yaml to sm-presentations-plugin 2026-10-30 12:24:06 +01:00
Jakub Zych
65e0cdd1fa test(34): phase gate covers sm-presentations-plugin 2026-10-30 12:24:06 +01:00
Jakub Zych
ba39bb1125 docs(34): roll out plugin.yaml to the remaining public plugin repos 2026-10-29 23:25:08 +01:00
Jakub Zych
999054b0bd test(34): phase gate covers the remaining public plugin repos 2026-10-29 23:25:08 +01:00
Jakub Zych
87921c27f6 fix(kiosk): fetch a required plugin module whose replace directory is missing
A plugin developed inside an application replaces its required plugins
with sibling directories (../user). Checked out on its own, that
directory is missing and plugin.yaml lost the minimum (golem15.user: ""),
so the manifest differed between the two layouts and TestPluginManifest
could not pass in both. Such a module is now fetched at the version
go.mod requires, as a consumer would see it.

- listedModule.fallback marks a local replace whose directory is absent
- fallback modules download separately, so one unfetchable version does
  not hold up the others
- TestDeriveMissingReplace over a file:// proxy (offline)
2026-10-29 23:18:07 +01:00
Jakub Zych
a9237c8ec3 docs(34): phase verification report 2026-10-29 22:57:25 +01:00
Jakub Zych
7b60c17138 docs(34): code review fix report 2026-10-29 22:37:01 +01:00
Jakub Zych
75a0dea0a5 fix(34): WR-10 expect older compatible releases in the Plugins screen smoke test
The smoke fixture's acme.blog has v0.1.1 for framework v0.6.0 under a
newest release that needs v0.7.0; plugin:install picks v0.1.1, so the
marketplace now marks it compatible.
2026-10-29 22:23:05 +01:00
Jakub Zych
e6b3aa2222 fix(34): WR-11 accept an inline plugins list in plugin:add again
The comment-keeping summer.yaml edit refused a flow-style plugins list
(plugins: [{id: a, module: b}]) that plugin:add used to handle with a
full rewrite. The edit now replaces an inline list, over one or several
lines, with a block list of its items plus the new ones and keeps every
other line. A list it cannot edit in place (a tagged one, say) falls
back to the full SaveManifest rewrite with a note that the comments were
not kept. plugin:install gets the same behaviour.
2026-10-29 22:15:09 +01:00
Jakub Zych
754ab5423a fix(34): WR-10 align the marketplace compatibility marker with plugin:install
With a framework version that is not a release (a devel build, an empty
FrameworkVersion) every plugin with a minimum was marked as needing a
newer framework, and Compatible looked only at the newest release, so a
plugin whose older release fits was marked although plugin:install
would install that release. An unknown framework now gives no marker
(and no needs-framework note on the Installed tab), and a plugin whose
newest release is too new is looked up (cached, four at a time) and
counts as compatible when an older release fits.
2026-10-29 22:12:54 +01:00
Jakub Zych
7b193032c8 fix(34): WR-06 bound the Plugins screen's search cache
pluginCatalog.lists was keyed by every distinct query and category and
never dropped an expired entry, so searching distinct strings grew the
process without limit (each entry can hold a 4 MiB answer). Storing a
search into a full cache now drops the expired searches and then the
ones that expire first, keeping at most 256.
2026-10-29 22:10:41 +01:00
Jakub Zych
2f3eba0cb1 fix(34): WR-03 refuse user info in https git URLs
validateGitURL refused only a password, but GitHub, GitLab and Gitea take
a token as the user part of an https URL. Such a URL was printed and
written to .gitmodules by git submodule add, and so committed with the
application. An https URL with any user info is now refused with a hint
to use a credential helper; the user of an ssh URL stays allowed.
2026-10-29 22:09:39 +01:00
Jakub Zych
9977e31ac9 fix(34): WR-02 undo a failed plugin:install or plugin:update
A failure after the first change left the application half-modified: a
checkout moved into plugins/<vendor>/<name> but not registered, go.mod
edited, submodules without summer.yaml entries (and the next install
refused the leftover directory), or some submodules updated and others
not. Both commands now snapshot go.mod, go.sum, go.work, go.work.sum,
summer.yaml and .gitmodules (with its index entry) before applying; a
failure restores them, removes the submodules the run added (index
entry, submodule config, absorbed git dir, checkout; registered right
after the move) and checks moved submodules out where they were. What
cannot be undone is named in the error.
2026-10-29 22:08:54 +01:00
Jakub Zych
07673e4f30 fix(34): WR-01 keep summer build working for frameworks before party.Describe
summer build always emitted party.Describe and []party.Info, so an
application whose framework requirement predates v0.6.0 stopped compiling
once the CLI was updated. The build now checks the party package go list
resolves in the application (a static look for Describe and Info, not a
version compare, since a local checkout reports the previous tag until
it is tagged) and, when they are missing, writes main.go and
plugins.gen.go exactly as before, with a warning to move the framework
to v0.6.0. An unresolvable party package keeps the current sources.
2026-10-29 22:03:57 +01:00
Jakub Zych
9b72439533 fix(34): CR-02 install plugins of an installed module at its version
plugin:install pinned only modules chosen in the same plan, so a second
plugin package in a module the application already required was
installed at the newest release, moving the plugin already there, and
with --source the repository was cloned a second time. PlanInstall now
seeds every module of summer.yaml: a plugin in one installs at the
installed version with no go get or clone (only its summer.yaml entry),
and is refused with a plugin:update hint when that version has no
release of it or is not a release. A git URL whose repository is already
a submodule, or whose module the application has, is refused.
2026-10-29 22:01:30 +01:00
Jakub Zych
60551485ed fix(34): CR-01 never move a pseudo-version install back to its base release
plugin:update dropped a go.mod require that was not a strict vX.Y.Z and
treated it as v0.0.0, so a module at a commit after v0.4.0
(v0.4.1-0.<ts>-<hash>) was moved back to v0.4.0. kiosk.Newer now places
a release against a release, a git describe string or a pseudo-version
(by the tag it builds on, in Go's version order); plugin:update and the
admin Plugins screen badge share it. A pseudo-version with no tag before
its commit is left alone with a note naming go get <module>@<tag>.
2026-10-29 21:58:07 +01:00
Jakub Zych
d30ef5de47 docs(34): add code review report 2026-10-29 21:50:37 +01:00
Jakub Zych
16318b0c4a docs(34-06): roadmap plan progress 2026-10-29 21:39:42 +01:00
Jakub Zych
06ac86409a docs(34-06): complete phase gate, unit tests and release ledger plan 2026-10-29 21:39:21 +01:00
Jakub Zych
74c8146c46 docs(34): release ledger and validation map
- 34-release-log.md: v0.6.0 contents, plugin tag table (current -> new),
  release order with the three rebases, 32 pointer bumps, app
  regenerations, summercms.io deploy, v0.6.0 tag message draft, rules
- 34-VALIDATION.md: per-task map for 34-01..34-06, Wave 0 ticked
2026-10-29 21:39:21 +01:00
Jakub Zych
dfc6127009 test: phase 34 gate requires the summercms.io unit tests
- --site: the site plugin's registry unit tests by required name
- --docker: TestRegistryAPIShapes and TestRegistryIngestEndpoint
2026-10-29 21:35:00 +01:00
Jakub Zych
bad273b753 test(admin): PluginsView and settings paths
- PluginsView: tab switching, one request per typing burst and a blank
  search without q, name fallback on cards, copied state clearing, a
  refused clipboard write, a failed marketplace request
- useSettings: settingsPath prefers path, then controller, then the
  singleton form; settingsEntryForPath
2026-10-29 21:27:55 +01:00
Jakub Zych
df2ba57e7b test(cabana): Plugins screen endpoints
- TestPluginsEndpoints: 401/403/200 for both endpoints, the update rule
  table, cache hit and expiry on an injected clock, failure caching, at
  most 4 version lookups at once, call timeout, marketplace validation,
  markers, https-only icons, disabled registry making no call
- fix: marketplace categories come only from plugins the screen offers,
  not from registry entries dropped for an invalid ID
- check-phase34.sh: TestPluginsEndpoints and useSettings.test.ts required
2026-10-29 21:27:55 +01:00
Jakub Zych
a231309721 test(summer): plugin command prompts
- TestPluginCommands: plugin:install needs --yes off a terminal, --offline
  and a disabled registry refuse ID installs without registry calls,
  plugin:manifest --check exit status and output on missing and stale files
- check-phase34.sh: the 34-06 unit tests are required names of --go
2026-10-29 21:22:47 +01:00
Jakub Zych
7de774b0b3 test(build): plugin dirs, install resolution and summer.yaml edits
- TestPluginDirs and TestEffectiveFramework over go list JSON fixtures and
  git checkouts; TestResolveInstall against an in-memory registry;
  TestAppendManifestPlugins for the in-place summer.yaml edit
- fix: a package of the application's own module was reported as a
  submodule with the application's git describe; it is in-app (local)
- fix: summer.yaml items written as '-   id:' keep their spacing when
  plugin:add or plugin:install appends to them
2026-10-29 21:22:47 +01:00
Jakub Zych
9109e5b139 test(kiosk): manifest, identity, version and client unit tests
- TestReadIdentity: literal, const, chained, cross-package, alias,
  other-module and Requires shapes; refusals naming ID()/Requires()
- TestDerive, TestManifestFormat, TestCheck, TestVersions,
  TestRegistryClient (httptest: escaping, 404, envelopes, cap, redirect)
- runnable ExampleMarshal and ExampleNewestCompatible
- party TestDescribe: copy of the plugin list, publish once per app
2026-10-29 21:22:47 +01:00
Jakub Zych
b93a6de20e test: phase 34 gate script
- scripts/check-phase34.sh: --self-test, --go, --docker, --plugins, --site,
  --admin, --docs, --marker, --additive and --all over the framework, the
  20 plugin repositories and the summercms.io repositories
- required test names checked in go test -json output; vitest, TAP and
  unittest detectors; a missing repository fails with missing <path>
- docker NOT RUN fails --all unless PHASE34_ALLOW_NO_DOCKER=1
2026-10-29 21:18:00 +01:00
Jakub Zych
b5f1ed202a docs(34-02): roadmap plan progress 2026-10-29 21:02:11 +01:00
Jakub Zych
8e8e0642b0 docs(34-02): complete plugin.yaml rollout plan
- 20 plugin repositories (21 packages) carry a generated plugin.yaml and TestPluginManifest
- Task 4 answered defer: 32 app pointer bumps and push blockers recorded for the 34-06 release ledger
2026-10-29 21:01:43 +01:00
Jakub Zych
13324e7f01 docs(34-05): complete admin Plugins screen plan 2026-10-29 19:23:14 +01:00
Jakub Zych
678eac4637 build(admin): rebuild the embedded admin for the Plugins screen 2026-10-29 19:21:11 +01:00
Jakub Zych
7e8a19399d feat(cabana): plugin updates and marketplace search on the Plugins screen
- GET /plugins looks up each versioned plugin's releases through
  kiosk.Client and applies plugin:update's rule (NewestCompatible above
  the BaseVersion), with the update command and the framework a newer
  release needs
- GET /plugins/marketplace forwards q and category (validated like the
  registry), marks installed and incompatible plugins and returns the
  install command; ids outside the plugin ID shape are dropped
- 4 s per-call timeout, at most 4 lookups at once, in-process cache
  (searches 5 min, releases 15 min, failures 1 min); a failing registry
  gives status unavailable, an empty plugins.registry_url sends nothing
- SPA: update badges and Marketplace tab with copy buttons (clipboard
  fallback), hidden when the registry is disabled; no install button
- OpenAPI, SPA types, inventories, conformance case, en/pl strings, docs
2026-10-29 19:20:14 +01:00
Jakub Zych
c4b1ac4076 feat(cabana): read-only Plugins screen with installed plugins
- GET /plugins (backend.view_plugins, superusers always pass) lists the
  plugins from party.Installed, or party.Activated IDs for older builds,
  with the built framework version and whether the registry is configured
- Settings -> System -> Plugins entry with the new SettingsEntry.path,
  added only for principals allowed to open it
- PluginsView at /system/plugins with an Installed tab (reka-ui Tabs);
  settings panel, rail, breadcrumbs and page title know the route
- OpenAPI and SPA types regenerated; contract, token-class and
  conformance inventories list the route; en/pl strings; docs
2026-10-29 19:05:46 +01:00
Jakub Zych
0418900122 docs(34-04): roadmap plan progress 2026-10-29 18:48:38 +01:00
Jakub Zych
b91eadb5b6 docs(34-04): complete plugin:install and plugin:update plan 2026-10-29 18:47:57 +01:00
Jakub Zych
96a7012ece docs(34): close the --module question for v1 2026-10-29 18:46:25 +01:00
Jakub Zych
d024ab4bb8 feat(build): summer plugin:update
- module installs move to the newest compatible registry release with
  one go get; submodules fetch tags, check out the release tag and
  require it in go.mod; go.work overrides and version pins are refreshed
- unlisted submodules (git URL installs) update from their own tags and
  plugin.yaml; --offline restricts to that
- without an ID every plugin that resolves is updated; in-app, unlisted
  and incompatible ones are reported; failure only when a resolved
  update cannot be carried out
- same prompt rule as plugin:install
2026-10-29 18:46:14 +01:00
Jakub Zych
8093587696 feat(build): plugin:install --source and git URLs as submodules
- --source clones each registry repository (https only) at the chosen tag,
  adds it as a submodule under plugins/<vendor>/<name>, absorbs its git
  dir and registers it with the tag as the go.mod require
- git URLs (https, ssh, user@host:path) are cloned with the user's git
  setup and never sent to the registry; the newest tag whose plugin.yaml
  framework minimum fits is checked out, else the default branch head
- go.work replace overrides for every local replace in workspace modules'
  go.mod files (app target, versioned workspace module, or version pin)
- GIT_ALLOW_PROTOCOL=https:ssh, '--' before URLs and paths; non-git apps
  are refused before cloning; plugin:add keeps require v0.0.0
2026-10-29 18:39:22 +01:00
Jakub Zych
a462bf12c9 feat(build): plugin:install resolves requirements, pins and prompts
- required plugins resolve transitively against the registry, each at the
  newest release meeting the framework and its minimum, dependencies first
- an installed requirement below its minimum stops with a plugin:update
  hint; cycles in registry data are reported
- one go get for the whole set; plugins sharing a module share a release
- behavior subtests: deps, installed_old, cycle, pin, unknown, prompt,
  offline, invalid
2026-10-29 18:26:05 +01:00
Jakub Zych
9b23e877a6 feat(build): summer plugin:install for registry plugins as Go modules
- kiosk.Client reads the registry API v1 over fetchguard (trusted mode,
  4 MiB, 10 s, no redirects); kiosk.RegistryURL reads plugins.registry_url
  (default https://summercms.io, empty disables)
- build.PlanInstall/ApplyInstall pick the newest release the effective
  framework satisfies (or a pin), validate registry strings, go get it and
  append it to summer.yaml
- summer.yaml edits (plugin:add and plugin:install) keep comments and
  blank lines
- TestInstallSmoke/module installs from a file:// GOPROXY and builds
2026-10-29 18:22:01 +01:00
Jakub Zych
e7eda88ddd docs(34-03): roadmap plan progress 2026-10-29 18:11:36 +01:00
Jakub Zych
77ac19a57c docs(34-03): complete summercms.io registry and marketplace plan 2026-10-29 18:11:05 +01:00
Jakub Zych
69c1fea766 docs(34-01): roadmap plan progress 2026-10-29 17:14:15 +01:00
Jakub Zych
f1f1d55fa7 docs(34-01): complete plugin.yaml, registry contract and build metadata plan 2026-10-29 17:13:43 +01:00
Jakub Zych
e8d3d724f5 feat(build): bake plugin metadata and the framework version into plugins.gen.go
- party.Info, party.Installed, party.Describe (additive; Plugin and Activate unchanged)
- summer build resolves plugin dirs with one go list, reads plugin.yaml, versions per D-07 (module version, git describe without --dirty, none for in-app plugins)
- build.EffectiveFramework: newest tag of a locally replaced or used framework checkout, else the go.mod require
- generated main calls party.Describe(app, PluginInfo, FrameworkVersion) before Activate; metadata failures warn and fall back to IDs
- summer new goldens and examples/hello regenerated
2026-10-29 17:12:13 +01:00
Jakub Zych
4916ee3d43 feat(kiosk): registry v1 wire types and version rules
- RegistryAPIPath, RegistryPlugin, RegistryPluginDetail, RegistryVersion, envelopes, errors, ingest types
- ValidVersion, CompareVersions, BaseVersion, Satisfies, NewestCompatible
- docs: Registry API v1 reference in plugins/marketplace.md
2026-10-29 17:05:41 +01:00
Jakub Zych
51ec2f9daa feat(kiosk): resolve constant plugin IDs, overrides and the CheckT helper
- kiosk.ReadIdentity: ID()/Requires() as literals or constants across packages and modules, read with go/parser, never run
- plugin minimums from go.mod requires; v0.0.0 is an error, a pseudo-version warns
- kiosk.Validate, kiosk.CheckT (no testing import)
- plugin:add reads IDs through kiosk.ReadIdentity, so const-ID plugins register
2026-10-29 17:02:38 +01:00
Jakub Zych
ec6a1955fc feat(kiosk): plugin.yaml manifest and summer plugin:manifest
- new module kiosk: Manifest, Marshal, Parse, Derive, Generate, Write, Check, StaleError
- plugin:manifest [dir] with --check, --pretend, --name, --description
- docs: kiosk README, root table row, plugins/marketplace.md, scaffolding row
2026-10-29 16:55:17 +01:00
Jakub Zych
824e3d5882 docs(34): create phase plan 2026-10-29 13:27:49 +01:00
Jakub Zych
ac9f6db03e docs(phase-34): add research and validation strategy 2026-10-29 12:47:47 +01:00
Jakub Zych
c48301ef7e docs(34): capture phase context 2026-10-29 12:16:38 +01:00
Jakub Zych
4449066fa6 docs: capture exploration — plugin marketplace (note, research question, Phase 34) 2026-10-29 11:51:12 +01:00
Jakub Zych
b651a67356 docs(quick-261029-d9j): user plugin mail locale from Accept-Language, fallback key, Polish subjects 2026-10-29 09:49:36 +01:00
Jakub Zych
e51df97db8 docs(quick-261029-1r3): derive the summercms.io landing version from go.mod, close its todo 2026-10-29 01:32:38 +01:00
Jakub Zych
0e5bb0c44f docs(quick-261028-wqu): summercms.io changelog dropdown with Framework and Plugins streams 2026-10-29 00:31:21 +01:00
Jakub Zych
bac8e7ef22 docs: plugin release posts go to /changelog/plugins 2026-10-29 00:25:34 +01:00
Jakub Zych
83a952a74b docs: capture todo - Stream-aware previous/next links on the summercms.io changelog 2026-10-29 00:05:21 +01:00
Jakub Zych
545c0b4350 docs: record the version-format decision on the landing-version todo 2026-10-29 00:05:08 +01:00
Jakub Zych
13aa5f3227 docs: capture todo - Derive the summercms.io landing version from go.mod 2026-10-28 23:41:08 +01:00
322 changed files with 53111 additions and 345 deletions

View File

@@ -1270,7 +1270,7 @@ Plans:
3. An S3 blob driver can be selected through framework config, so the application does not import it. `/api-docs` and `/api-docs.json` can be served. Turnstile verification middleware is available.
4. The touched modules' READMEs and `docs/` pages are updated. The new code has unit tests, delivered in the phase's last plan.
**Plans:** 6/6 plans executed
**Plans:** 8/9 plans executed
Plans:
**Wave 1**
@@ -1533,26 +1533,33 @@ Plans:
3. The demo is deployed publicly: the frontend is open, `/backend` is not reachable from the public internet, and the site carries a "want to see the backend? contact Golem15" call to action.
4. The new code has unit tests, delivered in the phase's last plan.
**Plans:** 6 plans
**Plans:** 6/6 plans executed
Plans:
**Wave 1**
- [ ] 20-01-PLAN.md — shared plugin release: siblings fast-forwarded, chat and forum pre-save seams (D-18), new sm-moderation-plugin (D-17), go.mod fixes, eight tags after go-ahead
- [x] 20-01-PLAN.md — shared plugin release: siblings fast-forwarded, chat and forum pre-save seams (D-18), new sm-moderation-plugin (D-17), go.mod fixes, eight tags after go-ahead
**Wave 2** *(blocked on Wave 1 completion)*
- [ ] 20-02-PLAN.md — demo backend: oauthserver bump (folded todo), eight plugins mounted by tag, demo context and channel adapter, bootstrap endpoints, realtime for members, slash commands, moderation wiring, EN/PL seed and reset, Centrifugo namespaces, local LiveKit
- [x] 20-02-PLAN.md — demo backend: oauthserver bump (folded todo), eight plugins mounted by tag, demo context and channel adapter, bootstrap endpoints, realtime for members, slash commands, moderation wiring, EN/PL seed and reset, Centrifugo namespaces, local LiveKit
**Wave 3** *(blocked on Wave 2 completion)*
- [ ] 20-03-PLAN.md — vue-chat-layer v0.1.0 (bm port, channels, threads, pins, command picker, link embeds) and /chat, floating panel, Chat tour card in vue-demo-app
- [x] 20-03-PLAN.md — vue-chat-layer v0.1.0 (bm port, channels, threads, pins, command picker, link embeds) and /chat, floating panel, Chat tour card in vue-demo-app
**Wave 4** *(blocked on Wave 3 completion)*
- [ ] 20-04-PLAN.md — vue-forum-layer, vue-userfriends-layer, vue-chatvideo-layer v0.1.0 (DM-only call button), their pages and tour cards, herald VAPID config without UI
- [x] 20-04-PLAN.md — vue-forum-layer, vue-userfriends-layer, vue-chatvideo-layer v0.1.0 (DM-only call button), their pages and tour cards, herald VAPID config without UI
**Wave 5** *(blocked on Wave 4 completion)*
- [ ] 20-05-PLAN.md — rome deploy: the demo's own LiveKit, Vuurmuur rule (checkpoint), nginx, .env keys, Centrifugo, release, DEPLOY.md, check-deploy and check-live
- [x] 20-05-PLAN.md — rome deploy: the demo's own LiveKit, Vuurmuur rule (checkpoint), nginx, .env keys, Centrifugo, release, DEPLOY.md, check-deploy and check-live
**Wave 6** *(blocked on Wave 5 completion)*
- [ ] 20-06-PLAN.md — unit tests (Go, layers, site), two-browser chat and DM call checks, phase gate and live verification
- [x] 20-06-PLAN.md — unit tests (Go, layers, site), two-browser chat and DM call checks, phase gate and live verification
**Wave 7** *(gap closure, code review)*
- [x] 20-07-PLAN.md — filter hardening (CR-02, CR-03): normalised text and canonical link hosts in sm-moderation-plugin, rendered-HTML check in sm-forum-plugin, bypass regression tests
- [x] 20-08-PLAN.md — call and session fixes (CR-01, WR-01, WR-04, WR-05): useCall cancellation, join confirmation, failed-connect end, chat link guard, logout reset
**Wave 8** *(blocked on Wave 7 completion)*
- [ ] 20-09-PLAN.md — release, redeploy and recheck: suites, patch tags, demo bumps, rome deploy, live bypass and call probes, changelog posts, disposition ledger
### Phase 30: Płytarium cutover
@@ -1685,40 +1692,78 @@ Plans:
3. The crawler reports SEO issues per URL, and each issue can be fixed through MCP.
4. The new code has unit tests, delivered in the phase's last plan.
**Plans:** 14 plans
**Plans:** 16/16 plans executed
Plans:
**Wave 1**
- [ ] 33-01-PLAN.md — framework: additive content descriptor fields and per-request field options, check-phase33.sh, v0.5.2 release log (no tag)
- [ ] 33-07-PLAN.md — vue-seo-layer (new repository): CMS head and one JSON-LD graph, redirect/410 enforcement, root files, 404 report, shared purge route
- [x] 33-01-PLAN.md — framework: additive content descriptor fields and per-request field options, check-phase33.sh, v0.5.2 release log (no tag)
- [x] 33-07-PLAN.md — vue-seo-layer (new repository): CMS head and one JSON-LD graph, redirect/410 enforcement, root files, 404 report, shared purge route
**Wave 2** *(blocked on Wave 1 completion)*
- [ ] 33-02-PLAN.md — sm-journal-plugin: per-site H1 setting on every write path, editor J1–J4, descriptor facts, journal-author type, MCP tools
- [ ] 33-03-PLAN.md — sm-sitemap-plugin: sitemap index with per-type files, slot table, real lastmod, hreflang, filter contract (breaking, D-32)
- [ ] 33-08-PLAN.md — vue-seo-layer: SSR build guard, noindex routes, route report, drift check, breadcrumbs, pagination, HTML sitemap
- [x] 33-02-PLAN.md — sm-journal-plugin: per-site H1 setting on every write path, editor J1–J4, descriptor facts, journal-author type, MCP tools
- [x] 33-03-PLAN.md — sm-sitemap-plugin: sitemap index with per-type files, slot table, real lastmod, hreflang, filter contract (breaking, D-32)
- [x] 33-08-PLAN.md — vue-seo-layer: SSR build guard, noindex routes, route report, drift check, breadcrumbs, pagination, HTML sitemap
**Wave 3** *(blocked on Wave 2 completion)*
- [ ] 33-04-PLAN.md — sm-sitemap-plugin: image and News sitemaps, IndexNow, HTML-sitemap API, MCP tools
- [ ] 33-09-PLAN.md — journal, menu and FAQ layers on the SEO layer: headings in both H1 modes, one link per card, body links, breadcrumbs, pagination, related posts
- [x] 33-04-PLAN.md — sm-sitemap-plugin: image and News sitemaps, IndexNow, HTML-sitemap API, MCP tools
- [x] 33-09-PLAN.md — journal, menu and FAQ layers on the SEO layer: headings in both H1 modes, one link per card, body links, breadcrumbs, pagination, related posts
**Wave 4** *(blocked on Wave 3 completion)*
- [ ] 33-05-PLAN.md — sm-seo-plugin I: sitemap filter, page registry with route report, site endpoint, llms.txt, Links settings, purge after writes
- [x] 33-05-PLAN.md — sm-seo-plugin I: sitemap filter, page registry with route report, site endpoint, llms.txt, Links settings, purge after writes
**Wave 5** *(blocked on Wave 4 completion)*
- [ ] 33-06-PLAN.md — sm-seo-plugin II: JSON-LD @graph, publisher, schema fields (E8/E9), breadcrumbs, hreflang, pagination; chromedp and webp legitimacy checkpoint
- [x] 33-06-PLAN.md — sm-seo-plugin II: JSON-LD @graph, publisher, schema fields (E8/E9), breadcrumbs, hreflang, pagination; chromedp and webp legitimacy checkpoint
**Wave 6** *(blocked on Wave 5 completion)*
- [ ] 33-10-PLAN.md — sm-seo-plugin: crawler with optional rendered comparison (chromedp), issue report with fix routes, Site audit and Crawls, MCP tools
- [x] 33-10-PLAN.md — sm-seo-plugin: crawler with optional rendered comparison (chromedp), issue report with fix routes, Site audit and Crawls, MCP tools
**Wave 7** *(blocked on Wave 6 completion)*
- [ ] 33-11-PLAN.md — internal linking and media: auto-links, link suggestions (E10), WebP variants with srcset
- [x] 33-11-PLAN.md — internal linking and media: auto-links, link suggestions (E10), WebP variants with srcset
**Wave 8** *(blocked on Wave 7 completion)*
- [ ] 33-12-PLAN.md — apps I: demo end to end on local links, summercms.io patches, sm-bm-app noindex (D-72)
- [ ] 33-13-PLAN.md — grzybyfunkcjonalne.pl on the new sitemap format and the SEO layer; uat deploy by decision
- [x] 33-12-PLAN.md — apps I: demo end to end on local links, summercms.io patches, sm-bm-app noindex (D-72)
- [x] 33-13-PLAN.md — grzybyfunkcjonalne.pl on the new sitemap format and the SEO layer; uat deploy by decision
**Wave 9** *(blocked on Wave 8 completion)*
- [ ] 33-14-PLAN.md — unit tests, check-phase33.sh --all, release tags in order, app re-pins, changelog post
- [x] 33-14-PLAN.md — unit tests, check-phase33.sh --all, release tags in order, app re-pins, changelog post
**Wave 10** *(gap closure after the 33-14 release checkpoint; 33-14 Task 4 resumes after both)*
- [x] 33-15-PLAN.md — Go plugins: route report noindex paths and the filter (G1), Journal descriptors per translated locale (G3), crawl lifecycle and addresses, sitemap IndexNow/lock/lastmod/migration/headings, Journal content fixes
- [x] 33-16-PLAN.md — Nuxt layers: route report noindex paths (G1), HTML sitemap pages (redirect, catch-all, i18n), root files 503, post article meta, journal pagination routes, link: release guard and versions
### Phase 34: Plugin marketplace
**Goal:** People browse the public Golem15 plugins at summercms.io/marketplace and add one to their application with a single command, `summer plugin:install <id>`. The same command installs private plugins straight from a git URL without contacting summercms.io. The admin SPA gains a read-only Plugins screen listing installed plugins and searching the marketplace, which shows the install command with a copy button. v1 has no paid plugins, no developer registration and no installs from the admin panel.
**Requirements**: TBD
**Depends on:** Nothing technical; ordered after Phase 33
**Repos:** `summercms.go` (manifest spec and validation, `plugin:install`, cabana Plugins screen and boardwalk views), `sm-summercmsio-app` and its `golem15.summercms` site plugin (registry API, ingestion, admin presentation fields), `vue-summercmsio-app` (marketplace pages), and a `plugin.yaml` in each public `sm-*-plugin` repo.
**Context:** decisions in `.planning/notes/2026-10-29-plugin-marketplace.md`; open question on `--module` for private git URLs in `.planning/research/questions.md`.
**Success Criteria** (what must be TRUE):
1. Every public `sm-*-plugin` repo carries a `plugin.yaml` manifest (ID, module path, name, description, required framework version, required plugins) that the framework validates, and anyone can fetch the repo anonymously.
2. summercms.io ingests manifest, README and versions when a plugin is tagged, serves them through a registry API, and renders /marketplace with list, search, category and detail pages; category, featured, screenshots and icon are edited in the summercms.io admin.
3. `summer plugin:install golem15.<name>` resolves the plugin through the registry and installs it as a Go module (`--source` checks it out as a submodule); `summer plugin:install <git-url>` installs from the repo alone as a submodule. Both register the plugin like `plugin:add` and check framework and plugin requirements.
4. The admin Plugins screen lists installed plugins with versions and available updates, and its Marketplace tab searches the registry and shows the install command with a copy button.
5. The new code has unit tests, delivered in the phase's last plan.
**Plans:** 6/6 plans executed
Plans:
**Wave 1**
- [x] 34-01-PLAN.md — kiosk module: plugin.yaml format, `summer plugin:manifest [--check]`, const-resolving ID reader, registry v1 wire types, PluginInfo/FrameworkVersion baked by summer build (wave 1)
**Wave 2** *(blocked on Wave 1 completion)*
- [x] 34-03-PLAN.md — summercms.io registry: tables, pull ingester, /api/registry/v1, admin curation, `registry` scope ingest-now, hourly schedule, /marketplace pages, deploy, changelog-post.py hooks (wave 2)
- [x] 34-04-PLAN.md — `summer plugin:install` (module, --source, git URL) and `summer plugin:update`, `plugins.registry_url`, go.work overrides (wave 2)
**Wave 3** *(blocked on Wave 2 completion)*
- [x] 34-05-PLAN.md — admin Plugins screen: cabana endpoints, backend.view_plugins, Installed + Marketplace tabs with copy, openapi and dist (wave 3)
**Wave 4** *(blocked on Wave 3 completion)*
- [x] 34-02-PLAN.md — plugin.yaml and TestPluginManifest in every public sm-*-plugin repo, framework minimum v0.6.0, app pointer bumps after Jakub's push (wave 4)
**Wave 5** *(blocked on Wave 4 completion)*
- [x] 34-06-PLAN.md — unit tests across all repos, scripts/check-phase34.sh, release ledger and validation map (wave 5)
## Progress
@@ -1770,11 +1815,12 @@ Phases execute in numeric order: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 →
| 19.6.1. Backend Administrators screen (INSERTED) | 5/5 | Complete | 2026-10-22 |
| 19.7. Generic MCP module | 9/9 | In Progress| |
| 19.8. Console commands overhaul (INSERTED) | 6/6 | In Progress| |
| 20. Demo instance with every shared plugin | 0/TBD | Not started | - |
| 20. Demo instance with every shared plugin | 6/6 | In Progress| |
| 30. Płytarium cutover | 0/TBD | Not started | - |
| 31. Chat polish against WavePath clients | 0/TBD | Not started | - |
| 32. SEO foundation | 6/6 | In Progress| |
| 33. SEO output, audit and content | 0/14 | Planned | - |
| 33. SEO output, audit and content | 16/16 | In Progress| |
| 34. Plugin marketplace | 6/6 | In Progress| |
## Backlog
@@ -1798,3 +1844,33 @@ Phases execute in numeric order: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 →
Plans:
- [ ] TBD (promote with /gsd-review-backlog when ready)
### Phase 999.2: SEO follow-ups after Phase 33, for v0.6.2 (BACKLOG)
**Goal:** Clear what Phase 33 deferred:
- the journal-tag drift warning while tag pages are off (G2), which needs an additive ContentDescriptor field such as `Routable` and signpost.Activate accepting a type without a URL pattern;
- the deferred warnings and info items in 33-REVIEW.md and 33-REVIEW-GAPFIX.md, listed under "Deferred" in 33-15 and 33-16:
- sitemap: types sharing a group slug, no 50 MB byte guard, Additional addresses on another host;
- seo: long crawls held in memory and running past the job timeout, recheck inside an open transaction;
- journal layer: card image `sizes`, the sitemap group home crumb;
- journal plugin: the author login in URLs, the alt batch with locale "" next to the default locale, the settings API's own url check;
- a post-release mode for `check-phase33.sh --consumers`;
- the grzyby DEPLOY.md Verify line expecting `X-Robots-Tag: index, follow`;
- a decision for untranslated locale addresses, which still serve default-locale content under their own canonical: point the canonical at the default locale, or answer 404.
**Requirements:** TBD
**Plans:** 0 plans
Plans:
- [ ] TBD (promote with /msd-review-backlog when ready)
### Phase 35: Mail templates and layouts editor
**Goal:** Administrators edit every mail the application sends from the admin panel, as in WinterCMS's Mail templates screen. System mail and the templates plugins register through `pact.HasMailTemplates` appear in a list. Each template can get a database override of its subject and body, and the override can be reset to the file version. Layouts become admin-editable records assigned to templates, with a few predefined layouts seeded. Images can be uploaded and placed in layouts and templates. postcard renders the override when one exists, otherwise the plugin's file, so mail that already works keeps working.
**Requirements**: TBD
**Depends on:** Phase 34
**Context:** postcard already loads plugin templates and layouts from `views/mail/` (`pact.HasMailTemplates`, `postcard.BootPlugin`); this phase adds the editable database layer, admin screens and image handling on top. To confirm in discussion: partials (WinterCMS mail partials), preview and test send, per-locale variants, and whether the screens live in cabana or in a plugin.
**Plans:** 0 plans
Plans:
- [ ] TBD (run /msd-plan-phase 35 to break down)

View File

@@ -1068,6 +1068,9 @@ Recent decisions affecting current work:
| 261028-pq8 | Fix the four internal/build scaffolder todos (make:plugin vendor path, make:admin-controller output, scaffold header and make:command deps, same-second migration order) | 2026-10-28 | 8bc18c9 | [261028-pq8-fix-the-four-internal-build-scaffolder-t](./quick/261028-pq8-fix-the-four-internal-build-scaffolder-t/) |
| 261028-r16 | Fix the two lagoon todos: stored-upload extension from sniffed MIME (tests + deploy note) and the lagoon README after-commit callback order | 2026-10-28 | 36092f5 | [261028-r16-fix-the-two-lagoon-todos-derive-stored-u](./quick/261028-r16-fix-the-two-lagoon-todos-derive-stored-u/) |
| fast | ensureToolchain keeps an existing toolchain line instead of adding a second one | 2026-10-28 | 6ea2cb7 | — |
| 261106-dv0 | shared plugins log boot details at Debug: paymentgateway operators registered, paymentgatewaysubscriptions registries collected through diary.For (todo 2026-10-28-plugins-log-boot-details-at-debug.md) | 2026-11-06 | 8a88b86, 1df6a26 | [261106-dv0-plugin-boot-logs-at-debug](./quick/261106-dv0-plugin-boot-logs-at-debug/) |
| 261106-e5v | purge token rename leftovers: grzybyfunkcjonalne check-deploy refuses NUXT_SITE_* keys, journal/menu/faq READMEs name NUXT_CACHE_PURGE_TOKEN (todo 2026-10-20-rename-site-cache-purge-env-in-consumers.md) | 2026-11-06 | 4e2cf0c, f61c90a, 128a33d, a53511b | [261106-e5v-purge-token-rename-leftovers](./quick/261106-e5v-purge-token-rename-leftovers/) |
| 261106-jhk | wristband MCP authorize drops OIDC identity scopes (openid, profile, email) so the ChatGPT connector can connect | 2026-11-06 | aba678b | [261106-jhk-wristband-mcp-authorize-ignores-oidc-ide](./quick/261106-jhk-wristband-mcp-authorize-ignores-oidc-ide/) |
## Deferred Items

View File

@@ -1,10 +1,10 @@
---
schema_version: 1
open_count: 20
open_count: 26
waived_count: 0
fixed_count: 7
total_count: 27
last_updated: 2026-10-22T14:44:56.679Z
fixed_count: 9
total_count: 35
last_updated: 2026-11-04T19:19:01.124Z
---
# Broken Windows Ledger
@@ -42,6 +42,14 @@ last_updated: 2026-10-22T14:44:56.679Z
| 25 | 19.7 | deviation | modules/cabana | | 19.7-01: admin route inventories (phase09Routes, tokenRouteClasses, CSRF walk 35, phase10 want list, conformCases) extended for the two account contribution routes | open | | 2026-10-22T14:44:56.218Z | |
| 26 | 19.7 | deviation | modules/cabana | | 19.7-01: TestRecordActionPromptRun added on Postgres to prove Run receives the trimmed prompt value | open | | 2026-10-22T14:44:56.449Z | |
| 27 | 19.7 | unrun-verify | scripts/check-phase19.6.1.sh | | 19.7-01: check-phase19.6.1.sh --all stopped by the host (memory pressure) after the cabana and surf Postgres suites passed; re-run on the Docker host | open | | 2026-10-22T14:44:56.679Z | |
| 28 | 33 | deviation | modules/lagoon/validate.go | | 33-02: lagoon.Validate rejects the string and url rule tokens, so the Journal admin settings save answers 500 (pre-existing); the Headings and links switch is saved through the settings API/MCP until fixed | open | | 2026-11-04T09:39:12.905Z | |
| 29 | 33 | stub | contract/contract.go | | sm-sitemap-plugin: contract.ListingSettings HTMLEnabled, HTMLPaths, HTMLPageSize and KeyFile stay zero and golem15_sitemap_urls.images stays [] until 33-04 adds the HTML sitemap, IndexNow and image settings | fixed | | 2026-11-04T10:26:56.754Z | 2026-11-04T11:41:58.774Z |
| 30 | 33 | deviation | models/settings/fields.yaml | | sm-sitemap-plugin: the Additional addresses lastmod is a text field read as YYYY-MM-DD (server-checked, errors.lastmod) because the framework repeater accepts no datepicker column; swap to a datepicker once cabana supports it in repeaters | open | | 2026-11-04T10:26:56.940Z | |
| 31 | 33 | deviation | models/settings/fields.yaml | | sm-sitemap-plugin: News sources is a taglist with custom tags and no options (values listed by the news_sources partial, server-checked) because cabana taglist options are a fixed YAML list and form extensions take no taglist; switch to options from the article types and categories once the framework offers per-request taglist options | open | | 2026-11-04T11:42:13.158Z | |
| 32 | 33 | deviation | controllers/issues/config_filter.yaml | | sm-seo-plugin: the Site audit status filter cannot default to Open (cabana list filters have no default value), so the list shows ignored issues too, badged Ignored; GET /_seo/api/v1/issues and seo_list_issues default to status open; set the default once cabana filters accept one | open | | 2026-11-04T15:03:28.372Z | |
| 33 | 33 | deviation | controllers/issues/_issue_details.htm | | sm-seo-plugin: P7 shows Open the page and the Rich Results Test as labelled addresses, not links, because the partial allowlist keeps only same-origin hrefs; make them links once partials may carry an external link (new tab) | open | | 2026-11-04T15:03:28.619Z | |
| 34 | 33 | deviation | vue-demo-app/nuxt.config.ts | | 33-12: the demo serves Polish by cookie at one address (no_prefix), but the CMS names /pl/... alternates and sitemap addresses, which answer 404; i18n strategy decision before 33-14 applies the demo patches | open | | 2026-11-04T17:10:13.946Z | |
| 35 | 33 | todo | sm-sitemap-plugin/classes/rebuild.go | | 33-12: additional addresses are not de-duplicated against content records (migrated /, /blog, /faq listed twice on rome-like data); the demo DEPLOY step works around it | fixed | | 2026-11-04T17:10:14.144Z | 2026-11-04T19:19:01.124Z |
````json
[
@@ -395,6 +403,110 @@ last_updated: 2026-10-22T14:44:56.679Z
"recorded_at": "2026-10-22T14:44:56.679Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 28,
"kind": "deviation",
"phase": "33",
"file": "modules/lagoon/validate.go",
"line": null,
"description": "33-02: lagoon.Validate rejects the string and url rule tokens, so the Journal admin settings save answers 500 (pre-existing); the Headings and links switch is saved through the settings API/MCP until fixed",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T09:39:12.905Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 29,
"kind": "stub",
"phase": "33",
"file": "contract/contract.go",
"line": null,
"description": "sm-sitemap-plugin: contract.ListingSettings HTMLEnabled, HTMLPaths, HTMLPageSize and KeyFile stay zero and golem15_sitemap_urls.images stays [] until 33-04 adds the HTML sitemap, IndexNow and image settings",
"status": "fixed",
"reason": "",
"recorded_at": "2026-11-04T10:26:56.754Z",
"resolved_at": "2026-11-04T11:41:58.774Z",
"milestone": "v1.0"
},
{
"id": 30,
"kind": "deviation",
"phase": "33",
"file": "models/settings/fields.yaml",
"line": null,
"description": "sm-sitemap-plugin: the Additional addresses lastmod is a text field read as YYYY-MM-DD (server-checked, errors.lastmod) because the framework repeater accepts no datepicker column; swap to a datepicker once cabana supports it in repeaters",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T10:26:56.940Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 31,
"kind": "deviation",
"phase": "33",
"file": "models/settings/fields.yaml",
"line": null,
"description": "sm-sitemap-plugin: News sources is a taglist with custom tags and no options (values listed by the news_sources partial, server-checked) because cabana taglist options are a fixed YAML list and form extensions take no taglist; switch to options from the article types and categories once the framework offers per-request taglist options",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T11:42:13.158Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 32,
"kind": "deviation",
"phase": "33",
"file": "controllers/issues/config_filter.yaml",
"line": null,
"description": "sm-seo-plugin: the Site audit status filter cannot default to Open (cabana list filters have no default value), so the list shows ignored issues too, badged Ignored; GET /_seo/api/v1/issues and seo_list_issues default to status open; set the default once cabana filters accept one",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T15:03:28.372Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 33,
"kind": "deviation",
"phase": "33",
"file": "controllers/issues/_issue_details.htm",
"line": null,
"description": "sm-seo-plugin: P7 shows Open the page and the Rich Results Test as labelled addresses, not links, because the partial allowlist keeps only same-origin hrefs; make them links once partials may carry an external link (new tab)",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T15:03:28.619Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 34,
"kind": "deviation",
"phase": "33",
"file": "vue-demo-app/nuxt.config.ts",
"line": null,
"description": "33-12: the demo serves Polish by cookie at one address (no_prefix), but the CMS names /pl/... alternates and sitemap addresses, which answer 404; i18n strategy decision before 33-14 applies the demo patches",
"status": "open",
"reason": "",
"recorded_at": "2026-11-04T17:10:13.946Z",
"resolved_at": null,
"milestone": "v1.0"
},
{
"id": 35,
"kind": "todo",
"phase": "33",
"file": "sm-sitemap-plugin/classes/rebuild.go",
"line": null,
"description": "33-12: additional addresses are not de-duplicated against content records (migrated /, /blog, /faq listed twice on rome-like data); the demo DEPLOY step works around it",
"status": "fixed",
"reason": "",
"recorded_at": "2026-11-04T17:10:14.144Z",
"resolved_at": "2026-11-04T19:19:01.124Z",
"milestone": "v1.0"
}
]
````

View File

@@ -0,0 +1,42 @@
# Decision: the site audit's rendered comparison uses chromedp, optionally
**Date:** 2026-10-28 (dependency approved 2026-11-04)
**Status:** Accepted
**Context:** Phase 33 (SEO output, audit and content, D-70), 33-CONTEXT.md "Rendered comparison (Jakub, 2026-10-28): optional chromedp", 33-RESEARCH.md Alternatives considered and Package Legitimacy Audit, plan 33-06 Task 4 (approval), plan 33-10 Task 4 (P33-55)
## Decision
The site audit's crawler (`sm-seo-plugin`, package `classes/crawl`) always checks the raw, server-rendered HTML. It compares a page's raw HTML with its JavaScript-rendered DOM only when an operator configures a Chrome or Chromium binary; without one every crawl records the comparison as skipped and says so (the crawl preview P6, `GET /_seo/api/v1/crawls/{id}` and the MCP tool `seo_get_crawl` answer `render {status: skipped}`).
- **`github.com/chromedp/chromedp` pinned at exactly v0.21.0.** Published 2026-10-11 (proxy.golang.org, origin `github.com/chromedp/chromedp` at tag `v0.21.0`, commit `7862adfd`), MIT. Approved by Jakub on 2026-11-04 (33-06 Task 4). v0.21.1 and v0.22.0 exist but were under two weeks old at approval and are deliberately not used. Its go.mod requires `github.com/chromedp/cdproto` v0.157.8 and `github.com/go-json-experiment/json`; nothing else.
- **Why this library.** A maintained pure-Go client of the Chrome DevTools Protocol: no cgo, no Node runtime, no bundled browser. It drives an operator-installed Chrome or Chromium binary (RESEARCH Alternatives considered: a raw-HTML-only crawl misses content that appears only after JavaScript; a Node headless browser would add a second runtime to a single-binary deployment).
- **What is compared** (D-70, P33-55): same-host links, an H1, or a substantial amount of text (at least 50 words and 20 % more) that appear only after JavaScript are reported as `content_js` with `details.check: rendered`. The raw HTML against the CMS record stays `details.check: cms` and runs on every crawl.
- **Chrome is optional and operator-installed.** Production servers have none by default. The executable path is the Go config key `golem15.seo.crawl_chrome_path` (environment-overridable like every key); `golem15.seo.crawl_render_max` (default 200) caps the pages rendered per crawl, in crawl order. An empty path skips the comparison; a relative path, or one that is not an executable regular file, records the comparison as failed with a note. The crawl itself never fails because of the renderer.
- **The path comes from config only, never from an admin setting or MCP.** Any holder of `golem15.seo.manage` can write the SEO settings and call the SEO tools; a writable executable path would let them make the server run an arbitrary binary (T-33-69).
- **Plugin-only.** Only `sm-seo-plugin` requires chromedp. The framework go.mod does not (D-90: the framework gets no SEO code), and `grep chromedp go.mod` in summercms.go stays empty.
## The guard (P33-55)
Headless Chrome executes untrusted page JavaScript on the server, so it is held to the crawler's `fetchguard` limits:
- **Resolver pinning.** Before Chrome starts, the site host and its `www` twin are resolved and every address is checked with `fetchguard.IsPrivateAddr`; a private or reserved address refuses to start the renderer (render status failed, the note names the address) unless `golem15.seo.crawl_trusted` is true. The checked addresses go into `--host-resolver-rules` as `MAP <host> <address>` lines (one address per host, IPv4 first) followed by a final `MAP * ~NOTFOUND`, so every other host resolves to nothing and Chrome cannot re-resolve the site host to another address. Chrome applies the first rule that matches a host, so the catch-all must come last: with a leading `MAP * ~NOTFOUND` the site host itself fails with `ERR_NAME_NOT_RESOLVED` (checked against Chromium during 33-10; P33-55 had it leading).
- **Request interception.** Every request is paused through the DevTools Fetch domain and continued only when it is `https` (`http` only in trusted mode) to the site host or its twin, or a `data:` or `blob:` URL; every other request fails with `BlockedByClient`. Third-party scripts, fonts, analytics and link-local metadata addresses are therefore never loaded.
- **No state.** Each crawl uses a fresh temporary profile (`os.MkdirTemp`) removed when the renderer closes; no cookies, Authorization header, HTTP credentials or extensions; downloads denied. The crawler never signs in.
- **Limits.** One tab renders at a time, 20 s per page, the DOM read with `OuterHTML` is capped at 5 MiB, and Chrome is closed when the crawl finishes, fails or is cancelled.
- **Sandbox.** chromedp's default allocator flags are used without additions that weaken Chrome's sandbox (no `--no-sandbox`).
## Rejected alternatives
- **Raw HTML only.** No dependency and no browser on the server, but content and links that appear only after JavaScript go unreported, which D-70 asks the audit to find.
- **`github.com/go-rod/rod`.** Also a pure-Go DevTools client, but it downloads a browser by itself by default and adds a larger API surface; chromedp's allocator takes an explicit executable path, which keeps the binary under operator control.
- **A Node headless browser (Puppeteer, Playwright).** A second runtime next to the single binary.
## Package legitimacy
The package-legitimacy seam cannot check Go modules, so chromedp was gated by the blocking human check of plan 33-06 Task 4 and approved by Jakub (v0.21.0) before any `go get`. v0.21.0 resolves through proxy.golang.org with the origin above.
## Consequences
- `sm-seo-plugin/go.mod` requires `github.com/chromedp/chromedp v0.21.0` (and, through it, `github.com/chromedp/cdproto`); applications that mount the plugin get it through the plugin, and chromedp is compiled in whether or not a Chrome path is configured.
- A site whose crawl should compare rendered pages installs Chrome or Chromium on the server and sets `golem15.seo.crawl_chrome_path`; nothing else changes.
- If the library ever needs replacing, only `classes/crawl/render_chrome.go` changes: the crawler talks to the `crawl.Renderer` seam.

View File

@@ -0,0 +1,50 @@
# Decision: WebP variants of attachment thumbnails through github.com/gen2brain/webp
**Date:** 2026-10-28 (dependency approved 2026-11-04)
**Status:** Accepted
**Context:** Phase 33 (SEO output, audit and content, D-85), 33-CONTEXT.md "Image formats (Jakub, 2026-10-28): WebP now, in Go", 33-RESEARCH.md Open Question 3 and Package Legitimacy Audit, plan 33-06 Task 4 (approval), plan 33-11 (P33-42, P33-43)
## Decision
Sites serve their featured images as `<picture>` with a WebP source and the original format as the `srcset` fallback. The WebP files are encoded in Go, once per thumbnail size, in a background job, never in the upload request. AVIF is deferred.
- **`github.com/gen2brain/webp` pinned at exactly v0.6.4.** Published 2026-07-01 (proxy.golang.org, origin `github.com/gen2brain/webp` at tag `v0.6.4`, commit `3dcf5268`), MIT (the bundled libwebp under its BSD licence, `lib/LICENSE.libwebp`). Approved by Jakub on 2026-11-04 (33-06 Task 4). Its go.mod requires `github.com/ebitengine/purego` v0.10.1 and nothing else.
- **Why this library.** `golang.org/x/image/webp`, which `attach` already uses, decodes only; the standard library has no WebP encoder. cgo bindings to libwebp would break the cgo-free build of the single binary. gen2brain/webp encodes in Go without cgo.
- **What is encoded.** Each thumbnail a caller asks for (`attach.File.ThumbKey` at a width, height and mode) gets one WebP variant next to it, at quality 80, under `attach.VariantKey(thumbKey, "webp")`. The original upload is never re-encoded, and images an editor inserts into a body keep their original file.
- **Where it runs.** Journal's conga job `golem15.journal.image_variants` is dispatched after a featured image upload commits, and `journal:image-variants --all` backfills existing images. A slow or failing encode never fails the upload.
## How it runs (checked in the v0.6.4 module source, 2026-11-04)
- **First choice: the system libwebp through purego.** At init the package opens `libwebp.so` and `libwebpdemux.so` with `purego.Dlopen` (no cgo). On Linux this only works in a dynamically linked binary.
- **Fallback: libwebp transpiled to Go.** When the libraries are missing (or with the build tag `nodynamic`), it uses libwebp compiled to WASM and then transpiled to plain Go source by wasm2go (`libwebp.go`, about 2.7 MB of generated Go). There is no WASM runtime at run time and no wazero; 33-CONTEXT's "WASM fallback" means this transpiled code. `webp.Dynamic()` reports which path is active.
- **Linking consequence.** purego's no-cgo runtime support makes a binary that imports the package dynamically linked, even with `CGO_ENABLED=0`: the probe binary needed the ELF interpreter `/lib64/ld-linux-x86-64.so.2` and `libc.so.6`, `libdl.so.2` and `libpthread.so.0`. It runs on glibc hosts such as the Debian servers. It does not run in a `scratch` image, a distroless static image or on musl (Alpine). Building with `-tags nodynamic` keeps the binary statically linked and uses only the transpiled code (checked: `statically linked`, `Dynamic()` reports "dynamic disabled").
- **Side effect.** The package registers a `webp` decoder with `image.RegisterFormat`, next to the one `golang.org/x/image/webp` registers. Both decode WebP, so `image.Decode` keeps working whichever one it picks.
## Benchmark
- **33-CONTEXT, 2026-10-28.** A 1200 px variant of a 2592×1754 photo: WebP 78 KB against JPEG q80 at 133 KB. Encoding took about 90 ms with the system libwebp and about 510 ms in the fallback. AVIF came out only about 6 % smaller than WebP, at 1.3× to 20× the CPU.
- **Probe of v0.6.4 on 2026-11-04** (this workstation, a synthetic 1200×812 gradient, quality 80): about 17 ms through the system libwebp and about 90 ms in the transpiled fallback. WebP was 29.8 KB against 58.4 KB for JPEG q80. The two runs used different images and machines, so compare the paths with each other, not the numbers across runs.
## Where the code lives (P33-42)
- **Framework, generic media.** `modules/lagoon/attach/webp` (package `webp`): `Encode(w, img)` at quality 80 and `Variant(ctx, bucket, f, w, h, mode)`. `Variant` writes the variant next to the thumbnail, returns early when it exists, and deletes the key when an encode or close fails. In `attach` itself there is one generic helper, `attach.VariantKey(thumbKey, format)`.
- **Why it is not SEO code.** A WebP variant of a thumbnail is a media format. It has nothing to do with SEO, and the framework gets no SEO wording (D-90). The addition is additive at patch level (D-106).
- **Only binaries that import it link it.** `attach` does not import the sub-package, so a binary links gen2brain/webp, purego and the linking consequence above only when it imports `modules/lagoon/attach/webp`. In practice that means through sm-journal-plugin.
- **The job lives in Journal.** Only plugins register conga jobs, and Journal owns the featured images and their variants table (`golem15_journal_image_variants`, P33-43).
## Rejected alternatives
- **AVIF through `github.com/gen2brain/avif`.** About 6 % smaller than WebP at 1.3× to 20× the CPU. Deferred.
- **A Nuxt image pipeline (sharp).** New npm dependencies with a native module, and the encoding would move into the frontend server.
- **cgo bindings to libwebp.** They break the cgo-free cross-compiled builds the applications use.
- **Widths only, no new format.** This needs no dependency, but D-85 asks for a modern format.
## Package legitimacy
The package-legitimacy seam cannot check Go modules, so gen2brain/webp was gated by the blocking human check of plan 33-06 Task 4 and approved by Jakub at v0.6.4 before any `go get`. v0.6.4 resolves through proxy.golang.org with the origin above (`h1:SUDdmxADOAiPQ+5ylNmuHhuYf2dOi0KgKZHL5vpVCNU=`).
## Consequences
- The framework go.mod requires `github.com/gen2brain/webp v0.6.4` (and, through it, `github.com/ebitengine/purego v0.10.1`). Only packages under `modules/lagoon/attach/webp` import it.
- An application that mounts sm-journal-plugin links the encoder. Its binary is dynamically linked against glibc unless it is built with `-tags nodynamic`. Installing libwebp on the server makes encoding about five times faster, and nothing else changes. The package opens the unversioned names `libwebp.so` and `libwebpdemux.so`, which Debian ships in `libwebp-dev`.
- If the library ever needs replacing, only `modules/lagoon/attach/webp/webp.go` changes. Callers use `Encode` and `Variant`.

View File

@@ -0,0 +1,44 @@
# Decision: Plugin marketplace on summercms.io and `summer plugin:install`
**Date:** 2026-10-29
**Status:** Accepted (exploration)
**Context:** `/msd-explore` session on summercms.io/marketplace, modelled on octobercms.com/marketplace
## Scope of v1
- The marketplace lists the public Golem15 plugins (`sm-*-plugin` repos that stay public). No paid plugins and no developer registration: Golem15 publishes every listing.
- Its job is browsing plugins and getting the install command, nothing more.
## Decisions
### Listing data: facts in the repo, presentation on summercms.io
- Each plugin repo carries a `plugin.yaml` manifest next to `plugin.go`: plugin ID, module path, name, description, required framework version, required plugins. The README and git tags (`vX.Y.Z`) complete the facts.
- summercms.io ingests the manifest, README and tags when a plugin is tagged. The hook is the existing `scripts/changelog-post.py publish … --repo ../sm-<name>-plugin` step or a webhook.
- Presentation fields (category, featured flag, screenshots, icon, sort order) are edited in the summercms.io admin, in the `golem15.summercms` site plugin.
- Reason: install-critical data (module path, versions, requirements) cannot drift from the repo, while marketing details change without a plugin release. A repo manifest also leaves room for third-party submissions later (submit a repo URL).
### `summer plugin:install`
The form of the argument decides where the plugin comes from:
| Argument | Lookup | Default install mode | Override |
|----------|--------|----------------------|----------|
| Plugin ID, e.g. `golem15.journal` | summercms.io registry API: module path, versions, requirements | Go module (`require` in `go.mod`, `go mod download`) | `--source`: git submodule checkout at `plugins/<vendor>/<name>`, as `plugin:add` does today |
| Git URL, e.g. `git@github.com:acme/sm-servers-plugin.git` | None. summercms.io is never contacted. ID and requirements come from the repo's `plugin.yaml`, module path from its `go.mod` | Git submodule checkout, which reuses the SSH access the user already has | `--module` (see the open research question on private modules) |
- Git URLs cover closed or private plugins from repositories the user has access to.
- Both modes end with the same registration that `plugin:add` does (`summer.yaml`, `go.mod`, `go.work` where applicable), then `summer build`.
- Precondition: public plugin repos on git.golem15.com fetch anonymously (HTTPS clone and `?go-get=1` meta). Confirmed as the intent for public plugins on 2026-10-29.
### Admin "Plugins" screen (read-only)
- **Installed** tab: the activated plugins from `backpack.App`, with version and description, and updates available compared against the registry.
- **Marketplace** tab: searches the summercms.io registry and shows `summer plugin:install <id>` with a copy button. There is no install button.
- The running binary never installs plugins. Plugins are compiled in; runtime loading stays rejected (`why-go-not-scala.md`, `.planning/research/FEATURES.md` anti-features). Queued installs and dev-mode live installs were considered and dropped as unnecessary for v1.
## Out of scope for v1
- Paid plugins, licensing, developer accounts and submissions.
- Themes in the marketplace.
- Installing from the admin panel.

View File

@@ -0,0 +1,100 @@
---
phase: "11.2"
slug: "ready-to-share-summercms-io-website-and-newsletter-plugin"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 11.2 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. The newsletter plugin was not built in this phase (moved to backlog 999.1); no threat in the register concerns it. Evidence roots: FW = `summercms.go`, APP = `../sm-summercmsio-app`, PLUG = `APP/plugins/golem15/summercms`, SITE = `APP/vue-summercmsio-app`. Verified against the current tree; later phases (changelog, marketplace, VPN admin) changed the app, and replaced prongs are noted. T-11.2-SC is declared in all three plans (19 rows, 17 IDs).
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| npm registry → build machine | third-party packages run during install and generate | tarballs, git deps, install scripts (high) |
| en.json / terminal.json → rendered HTML | repository copy becomes public HTML | i18n strings, terminal commands (medium) |
| page → visitor clipboard | the Copy button writes text visitors paste into a shell | six shell commands (low) |
| page → third-party origins | any runtime request elsewhere leaks visitor data | IP, Referer (medium) |
| internet → nginx (rome) | untrusted HTTP; TLS terminates here | all public requests (high) |
| nginx → summercms-io on 127.0.0.1:8095 | proxied requests filtered by path and method | path, method, X-Forwarded-For (medium) |
| request path → embedded file map | an untrusted path selects a file and may redirect | URL path, Location (high) |
| site.yaml / CLI flags → docs header HTML | configured URL written into every docs page | site_url, site_label (medium) |
| operator machine → rome | binary and config upload; secrets stay on the server | binary, config (medium) |
| summercms.go → module proxy | a pushed tag becomes immutable public state | release tag (medium) |
| test results → phase sign-off / env gates → integration tests | a gate misreading skips passes untested behaviour | test events, gate variables (medium) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-11.2-01 | Tampering (XSS) | components rendering en.json | medium | mitigate | no v-html/innerHTML under SITE/app/; inline code via `<i18n-t>` | closed |
| T-11.2-02 | Information disclosure (privacy) | font loading | medium | mitigate | `@nuxt/fonts` build-time download (SITE/nuxt.config.ts:40,64-71); SITE/tests/output.test.ts:218-231 asserts no Google font hosts; built output clean | closed |
| T-11.2-03 | Tampering | Copy button payload | low | accept | AR-11.2-01 | closed |
| T-11.2-04 | Information disclosure | PLUG static.go path resolution | high | mitigate | `path.Clean` + dot-segment 404 + preloaded map only, dotfiles never loaded (static.go:131-183); smoke.sh:230 and static_test.go:155-156 assert `/docs/.summer-docs` 404 | closed |
| T-11.2-05 | Spoofing (open redirect) | /docs and extension-less redirects | medium | mitigate | constant `/docs/` redirect (plugin.go:86); redirect only to an existing mapped name (static.go:178-182); TestStaticRedirectLocations covers `//evil`, `../`, backslash | closed |
| T-11.2-06 | Tampering (MIME sniffing) | static.go headers | low | mitigate | own content-type table first (static.go:30-60); `nosniff` on every file incl. 404s and scripts | closed |
| T-11.2-07 | Elevation of privilege | admin exposure | high | mitigate | public nginx `/backend` → 404 (summercms.io.conf:74-76), binary on loopback, check-deploy.sh:129-130 guards the block; admin only on the VPN vhost (10.8.3.0/24). Replaced since: plugin now has admin controllers (Phase 34) and smoke.sh:225 expects 200 on the binary; the internet-facing control holds | closed |
| T-11.2-08 | Information disclosure | DB password and app key | high | mitigate | empty secrets in committed config; `.env` gitignored, only `*.example` tracked; `.env` root:summercms 0640, never rsynced (DEPLOY.md:195,289) | closed |
| T-11.2-09 | Tampering (XSS) | docs header site_url | medium | mitigate | `checkSiteURL` on yaml key and flag (internal/docsite/load.go:125,145-161,289); `html/template` with plain string; load_test.go rejects `javascript:` and `//` | closed |
| T-11.2-10 | Tampering (clickjacking) | public pages | low | accept | AR-11.2-02 | closed |
| T-11.2-11 | Information disclosure (transport) | nginx | high | mitigate | 80→443 301 except ACME, www→apex, certbot certs, HSTS (summercms.io.conf:20-63); binary binds 127.0.0.1:8095 | closed |
| T-11.2-12 | Denial of service | nginx and binary | medium | mitigate | `limit_except GET HEAD` on `/` (:176-179); site routes GET-only (routes_test.go, smoke POST → 405); preloaded static files; supervisor restart | closed |
| T-11.2-13 | Tampering / Repudiation | v0.1.0 tag | medium | mitigate | blocking-human checkpoint (11.2-02-PLAN.md:318) resolved as defer-tag; no v0.1.0 exists; all tags annotated; CLAUDE.md requires go-ahead | closed |
| T-11.2-14 | Elevation of privilege | runtime account | medium | mitigate | nologin system user, dedicated Postgres role and DB, root-owned install root with only `storage/` writable (DEPLOY.md:173-182); supervisor `user=summercms` | closed |
| T-11.2-15 | Repudiation (false green) | scripts/check-phase11.2.sh | medium | mitigate | detector refuses build failure, no-tests, skip, fail, zero tests, missing named tests (:58-120); unknown flag exits 2 | closed |
| T-11.2-16 | Tampering (silent skip) | build-gated tests and terminal check | medium | mitigate | gate sets `SUMMERCMS_REQUIRE_BUILD=1` and `SUMMERCMS_TERMINAL_CHECK=1`; links_test.go `requireBuild` fails instead of skipping | closed |
| T-11.2-SC (01) | Tampering | pnpm installs | high | mitigate | exact pins, committed lockfile (git deps locked to commits), build allow-list of three packages, `--frozen-lockfile` (APP/scripts/build.sh:121) | closed |
| T-11.2-SC (02) | Tampering | dependency installs | high | mitigate | APP go.mod first-party only; PLUG direct requires (Phase 34) all already in FW go.mod at the same versions; go.sum committed; dirty-tree builds refused (build.sh:80-90) | closed |
| T-11.2-SC (03) | Tampering | dependency installs | low | accept | AR-11.2-03 | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-11.2-01 | T-11.2-03 | Payload is the bundled terminal.json, identical to the visible lines; the page only writes to the clipboard and never reads it. | 11.2-01 PLAN | 2026-11-05 |
| AR-11.2-02 | T-11.2-10 | Static marketing and docs pages with no state-changing actions; the admin CSP is deliberately not reused because it blocks Nuxt's inline scripts (D-07). | 11.2-02 PLAN | 2026-11-05 |
| AR-11.2-03 | T-11.2-SC (03) | Tests use the stdlib and the existing node:test runner; no package is added; `pnpm install --frozen-lockfile` reuses 11.2-01's lockfile. | 11.2-03 PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Notes (non-blocking)
- **Attack surface added after 11.2** (covered by later phases' registers): admin controllers on the binary behind the VPN vhost; `APP/DEPLOY.md:190` ("nginx refuses /backend, so nothing writes runtime config overrides") is stale now that the admin is reachable over the VPN — writes would still fail on the root-owned `config/`. New write routes: `/_journal/api/v1/` (token + throttle) and POST `/api/registry/v1/ingest` (T-34-15/16). Marketplace readme `v-html` is covered by T-34-13.
- **Open review info items:** IN-01..IN-08 (11.2-REVIEW-DISPOSITION.md), none security-relevant beyond IN-07 (links_test.go follows redirects).
- **UAT:** 11.2-UAT.md is still `testing` with tests 1-3 pending; the cutover test expects v0.1.0, which was never created (releases started at v0.1.1). Superseded rather than failed.
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 19 rows (17 IDs) | 19 | 0 | msd-security-auditor (ASVS L1, block_on high; repo contents only, no live-host checks) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
**Approval:** verified 2026-11-05

View File

@@ -0,0 +1,142 @@
---
phase: "19.3"
slug: "framework-transport-and-infrastructure-for-wavepath"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 19.3 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. Framework paths are relative to the repo root (HEAD `7b8d205`); `seo/` = `../vue-seo-layer`. The shared Nuxt purge route moved after the phase from the faq, menu and journal layers into vue-seo-layer, which all three now extend; T-23, T-29, T-37 and T-43 were verified there. T-19.3-SC is declared once per plan (6 rows, one ID).
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| application to Redis | network hop carrying credentials in `redis.url` and shared counters other instances trust | Redis URL, cache entries, rate-limit counters (high) |
| request data to cache and limiter keys | keys can derive from client IPs, user ids or request values | key material (medium) |
| config and environment to boot | CORS, cookie, Turnstile, api-docs, `redis.url`, driver keys, `public_url` validated or reported before serving | config values, secrets (high) |
| browser on a sibling subdomain / SPA origin to the API | credentialed cross-origin requests and the token cookie | session cookie, API answers (high) |
| request to Turnstile middleware | untrusted token and body; siteverify crosses to Cloudflare | Turnstile token, secret (high) |
| jsDelivr CDN to the api-docs page | third-party scripts executed in the app's origin | JS (medium) |
| client upload to attach.Store | untrusted bytes and file name | file content, name (high) |
| bucket or CDN to the browser | stored files served from the app's or a CDN's origin | files (medium) |
| AWS environment to s3blob | credentials outside summer config | AWS credentials (medium) |
| summer.yaml to go build | manifest values become command arguments | build tags (medium) |
| Go app to the site's Nitro purge route | bearer-token POST over loopback or https after admin saves | purge token (high) |
| network to the Nitro purge route | anyone who can reach the site can call the route | purge requests (medium) |
| plugin hooks to the save transaction | hook errors roll back admin writes | hook results (low) |
| Go module proxy to the build | a new test-only module enters go.sum | modules (medium) |
| test harnesses to the network | httptest, miniredis and testcontainers only | test traffic (low) |
| local checkouts to origin | tags and pushes every consumer reads | tags (medium) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-19.3-01 | Information disclosure | cooler.OpenRedis, Install errors/logs | high | mitigate | cooler/redis.go:15,30-46 fixed error naming `redis.url`, parse error dropped, Addr-only endpoint log; TestOpenRedisRedactsSmoke | closed |
| T-19.3-02 | Denial of service | RateLimitStore during outage | medium | mitigate | ratelimit.go:63-73 attempt timeout + fallback; 500 ms (cooler.go:56); once/min warner (:410-446); memory fallback (surf/serve.go:237) | closed |
| T-19.3-03 | Tampering | Redis key space | medium | mitigate | `<prefix>cache:` / `<prefix>rl:` namespaces; SCAN with escaped glob + UNLINK, no FLUSHDB (rediscache.go:121-146). Residual IN-01 | closed |
| T-19.3-04 | Denial of service | memory cache growth | medium | mitigate | memory.go:40-45 `MaximumSize`, <1 refused; cooler.go:51,304-312 | closed |
| T-19.3-05 | Information disclosure | route:list/tests dialing Redis | low | mitigate | serve.go:83 only `installCooler` caller; router.go:556-566 lookup only; store_lookup_test.go:60 | closed |
| T-19.3-06 | Information disclosure | CORS credentials + `*` | high | mitigate | surf/cors.go:50-51 enforced via LoadCORSConfig and LoadCORSProfiles; TestCORSCredentialsWildcardRefusedSmoke | closed |
| T-19.3-07 | Tampering | shared-cache CORS answers | medium | mitigate | cors.go:240-281 Vary added before the allow check, preflight; :488-503 exact-origin echo | closed |
| T-19.3-08 | Spoofing | token cookie attributes | high | mitigate | bouncer/cookie.go:85-116 Domain validity, production Secure, None requires Secure; HttpOnly hard-coded (:154,:172) | closed |
| T-19.3-09 | Information disclosure | cookie Domain scope | medium | mitigate | cookie.go:82-90 host-only default, Domain opt-in; docs/services/authentication.md:95 | closed |
| T-19.3-10 | Tampering | CSRF on refresh/logout | low | accept | AR-19.3-01. Residual IN-08 | closed |
| T-19.3-11 | Spoofing | Turnstile with no secret | high | mitigate | bouncer/turnstile.go:111-119 production + no secret → 503, success required; production flag from config (router.go:732-733). Residual IN-11 | closed |
| T-19.3-12 | Denial of service | slow siteverify | medium | mitigate | turnstile.go 5 s client + ctx, 4 KiB LimitReader | closed |
| T-19.3-13 | Tampering | body consumed by Turnstile | medium | mitigate | turnstile.go:264-266 read once, restored; body limit wraps route middleware (router.go:513-515); TestTurnstileMiddlewareSmoke. Residual IN-05 | closed |
| T-19.3-14 | Information disclosure | Turnstile secret/token in logs | high | mitigate | secret only in form body; url.Error unwrapped; log carries error text only (turnstile.go:120-241); TestTurnstileNeverLogsSecret | closed |
| T-19.3-15 | Tampering | swagger-ui on jsDelivr | medium | mitigate | surf/apidocs.go:32-66 pinned 5.33.1 with sha384 SRI + crossorigin; nonce-only CSP (:208) | closed |
| T-19.3-16 | Information disclosure | /api-docs surface | low | accept | AR-19.3-02 | closed |
| T-19.3-17 | Tampering (XSS) | api_docs title/spec URL | medium | mitigate | apidocs.go `html/template` contextual escaping (:10,:55-81) | closed |
| T-19.3-18 | Tampering / EoP | stored XSS via disk name | high | mitigate | lagoon/attach/diskext.go:39-77, store.go:170 `DiskExtension(sniffed, ext)`; inline.go:38-44 attachment disposition; storage.md:110-135; TestDiskExtensionTable. Residual IN-07 | closed |
| T-19.3-19 | Information disclosure | public_url exposing files | medium | mitigate | 22-hex random names (store.go:294-300); boot Warn (bucket.go:157-161); storage.md:94 | closed |
| T-19.3-20 | Tampering | build.tags reaching go build | medium | mitigate | internal/build/manifest.go:121-172 validation; build.go:58-78 `exec.CommandContext`, single `-tags=` arg, no shell | closed |
| T-19.3-21 | Repudiation / misconfig | s3:// in an untagged binary | medium | mitigate | attach/bucket.go:106-137 refusal; s3_on.go/s3_off.go; build prints `build tags:` | closed |
| T-19.3-22 | Information disclosure | AWS credentials | medium | mitigate | storage.md:78 no keys in bucket_url/config; no credential keys in attach | closed |
| T-19.3-23 | DoS / Spoofing | shared Nitro purge route | medium | mitigate | seo/server/lib/siteCachePurge.ts:13,54-60 ≥32-char token else 404, proxied → 404, sha256 + timingSafeEqual; purge.post.ts:32-48; route `cache: false` | closed |
| T-19.3-24 | Information disclosure | purge token in Go logs/errors | high | mitigate | cooler/sitecache.go errors/logs name keys, kind, slug, status, host+path only; assertNoToken in sitecache_test.go | closed |
| T-19.3-25 | Information disclosure | token in clear on the network | high | mitigate | sitecache.go:97-132 user info refused, http only to loopback | closed |
| T-19.3-26 | Denial of service | purge breaking saves | medium | mitigate | `WithoutCancel` + 2 s, `lagoon.AfterCommit`, errors logged only (sitecache.go:159,302-309); faq/menu 500-receiver tests | closed |
| T-19.3-27 | Tampering | purge before commit | low | mitigate | AfterCommit (sitecache.go:302-309); `cabana.TxFromContext` in faq, menu, journal site_cache.go | closed |
| T-19.3-28 | Tampering | ReorderAfterSave failing | low | accept | AR-19.3-03 | closed |
| T-19.3-29 | Tampering | three route copies drifting | low | mitigate | superseded: single copy in vue-seo-layer, none left in faq/menu/journal; sha256 pins seo/tests/sitePurge.test.ts:26-39 | closed |
| T-19.3-30 | Repudiation | gate passing on skipped tests | medium | mitigate | scripts/check-phase19.3.sh:195-285 fails on skip/zero/missing; self-test (:357+). See "Gate out of date" | closed |
| T-19.3-31 | Tampering | unverified release | medium | mitigate | 19.3-05 checkpoint; v0.1.27 unmoved on origin, ancestor of v0.2.0 and origin/master | closed |
| T-19.3-32 | Information disclosure | secret-in-logs tests | low | mitigate | TestTurnstileNeverLogsSecret, TestOpenRedisRedactsSmoke, assertNoToken | closed |
| T-19.3-33 | Tampering | profiled-route refusals missing CORS/Vary | medium | mitigate | surf/router.go:462-530 profile wraps recovery/body limit/locale, :905-918 Vary merge; TestCORSProfileHeadersOnRefusals, TestCORSProfileVaryKeptWithHandlerVary | closed |
| T-19.3-34 | Information disclosure | credentialed wildcard/unanchored origins | high | mitigate | cors.go:61-160 anchoring and wildcard host-label rules with probes, per profile; TestCORSCredentialedOriginRules, TestCORSAnchoredPatternNoSuffixMatch. Residual: multi-label public suffix (below) | closed |
| T-19.3-35 | Information disclosure | token forwarded on redirect | high | mitigate | sitecache.go:109-115 `CheckRedirect` → `ErrUseLastResponse`; TestSiteCachePurgeNoRedirect | closed |
| T-19.3-36 | Denial of service | synchronous per-row purges | medium | mitigate | single coalescing worker, Wait, Close drains (sitecache.go:212-277; cooler.go:123-131); async tests | closed |
| T-19.3-37 | Spoofing | allowProxied reachable from the network | medium | mitigate | siteCachePurge.ts:55-59 token check first, `allowProxied !== true` → 404; default false (seo/nuxt.config.ts:58-71); docs/services/caching.md:215 | closed |
| T-19.3-38 | Information disclosure | inferred insecure cookie in production | high | mitigate | cookie.go:107-112 error names `auth.cookie.secure` and `app.url`; TestLoadCookieConfigProductionInferredSecure | closed |
| T-19.3-39 | Information disclosure | zero CookieConfig | medium | mitigate | cookie.go:273-287 zero → Secure, SameSite Lax, used by both handlers; TestZeroCookieConfigDefaults | closed |
| T-19.3-40 | Elevation of privilege | api-docs CSP with host source | medium | mitigate | apidocs.go:65-67,208 nonce-only `script-src`; TestAPIDocsCSPNoHostSource | closed |
| T-19.3-41 | Information disclosure | protected files in a public_url bucket | high | mitigate | attach/store.go:38-42,139-140 refused before body read; boot warning; every bucket via attach.OpenBucket; TestStoreProtectedNeedsPrivateBucket | closed |
| T-19.3-42 | Spoofing | turnstile routes without a secret, unnoticed | medium | mitigate | router.go:710,739-758 one Warn with route count and production flag, never the secret; TestTurnstileEmptySecretWarnsAtBoot. Residual IN-11 | closed |
| T-19.3-43 | Tampering | layer copies drifting | low | mitigate | superseded, as T-19.3-29 | closed |
| T-19.3-44 | Tampering | unverified release / moved tag | medium | mitigate | 19.3-06 checkpoint; v0.2.0 contains 0c8109c and v0.1.27, on origin/master; v0.1.27 unmoved | closed |
| T-19.3-SC (01) | Tampering | go-redis, otter installs | high | mitigate | decision note 2026-10-15-cooler-go-redis-otter.md precedes the go.mod commit; pinned v9.23.0 / v2.3.0 | closed |
| T-19.3-SC (02) | Tampering | installs | high | mitigate | go.mod/go.sum unchanged across the plan; swagger-ui via SRI-pinned CDN | closed |
| T-19.3-SC (03) | Tampering | s3blob / AWS SDK | high | mitigate | gocloud.dev v0.46.0; s3blob only behind `//go:build summercms_s3`; note precedes the go.mod commit | closed |
| T-19.3-SC (04) | Tampering | installs | high | mitigate | framework go.mod unchanged; layer package.json version bumps only; plugin go.mod bumps add only modules the framework already pins | closed |
| T-19.3-SC (05) | Tampering | miniredis install | high | mitigate | human approval recorded (19.3-05-SUMMARY:121-129); pinned v2.40.0; test-only imports | closed |
| T-19.3-SC (06) | Tampering | installs | high | mitigate | go.mod/go.sum unchanged across the plan; layer commits bump versions only | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-19.3-01 | T-19.3-10 | Refresh only rotates a cookie (the answer is unreadable cross-origin unless CORS allows that origin); logout CSRF is a forced logout; routes are POST-only and the docs advise JSON or a custom header (authentication.md:97). | 19.3-02 PLAN | 2026-11-05 |
| AR-19.3-02 | T-19.3-16 | /api-docs is off by default; the spec is the app's hand-written public surface (D-16); both routes are public by design (D-17). | 19.3-02 PLAN | 2026-11-05 |
| AR-19.3-03 | T-19.3-28 | The hook runs inside the reorder transaction by design so its failure rolls the reorder back, as FormAfter hooks do; purge hooks never return errors. | 19.3-04 PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Unregistered Flags and Residual Risk (non-blocking)
1. **Purge token was published in page payloads (fixed after the phase).** The phase's layer versions read the token from `NUXT_SITE_CACHE_PURGE_TOKEN`; nuxt-site-config copies every `NUXT_SITE_*` variable into the public site config. Fixed: the token is now `cachePurge.token` / `NUXT_CACHE_PURGE_TOKEN`, seo/server/plugins/site-cache-purge.ts strips the old keys, and docs/services/caching.md:207 says to rotate. **Action:** confirm every deployment that set the old variable has rotated its token.
2. **Credentialed wildcard on a multi-label public suffix passes boot** (VERIFICATION advisory 1, next to T-19.3-34). `https://*.co.uk` is accepted: `wildcardHostLabel` accepts any non-empty remainder and the probes only cover `.invalid` and `.com`.
3. **Second purge route.** The deprecated `vue-journal-layer/server/api/__journal__/cache/purge.post.ts` predates this phase, still ships, and is not covered by this register.
4. Open review info items from 19.3-REVIEW-DISPOSITION: IN-01 (T-03), IN-05 (T-13), IN-07 (T-18), IN-08 (T-10), IN-11 (T-11/T-42: no log when a published verifier replaces a configured secret).
### Gate out of date
The layers stage of `scripts/check-phase19.3.sh` (lines 175-177, 524) still `cmp`s the purge files inside the faq, menu and journal layers, which moved to vue-seo-layer; that stage would now fail. No threat reopens; T-29/T-43 evidence now comes from vue-seo-layer.
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 50 rows (45 IDs) | 50 | 0 | msd-security-auditor (ASVS L1, block_on high; `go test -short` on cooler, bouncer, surf, lagoon/attach, internal/build: 28 named tests pass, 4 Docker-backed tests not run) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
- [ ] Old `NUXT_SITE_CACHE_PURGE_TOKEN` values rotated on every deployment that set them
**Approval:** verified 2026-11-05 (ASVS L1)

View File

@@ -0,0 +1,137 @@
---
phase: "19.4.1"
slug: "early-public-demo-on-demo-summercms-io"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 19.4.1 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. Static audit of repository contents (no SSH, no production requests, tests not re-run; test results from the phase gate log and VERIFICATION). Audited: sm-demo-app da03c06 (after Phases 20 and 33), vue-demo-app fe5d38d (the submodule; the sibling `../vue-demo-app` checkout is stale), framework v0.6.1 and the plugin tags go.mod requires. Roots: DEMO = `../sm-demo-app`, VUE = `DEMO/vue-demo-app`, PLG = `DEMO/plugins/golem15`, FW = `summercms.go`.
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| ROADMAP.md → client-facing deck | internal phase names include client applications | phase titles and summaries (high) |
| local .env → demo:seed | visitor credentials enter the database | visitor email and password (high) |
| local demo pages → committed screenshots | captures could show secrets or personal data | OIDC and admin PNGs (medium) |
| seeded deck HTML → public deck API | rendered on a public origin | slide HTML (low) |
| internet → nginx (demo.summercms.io) | only allow-listed prefixes reach Go; includes the public login-required `/smbackend` admin (user decision 2026-10-20) | all HTTP traffic, admin login (high) |
| nginx → Go and Nuxt on loopback | trusted proxy 127.0.0.1/32 sets client IP headers | X-Forwarded-For, X-Real-IP (medium) |
| build machine → module proxies and git.golem15.com | tags become immutable inputs for every consumer | plugin tags, go.sum (medium) |
| build machine → rome over SSH | secrets generated on rome or piped, never logged | env values, binaries (high) |
| Stripe → webhook | signed callbacks from the internet | events, Stripe-Signature (high) |
| browser → `/_user/api/v1/register` and `/login` | anonymous, automatable sign-ups and credential attempts | credentials, Turnstile token (high) |
| browser → `/_feedback/api/v1/{key}/submit` | anonymous free text with a public key | name, email, message (medium) |
| Go → Cloudflare siteverify and G15Office | outbound calls carrying secrets | Turnstile secret, G15Office token (high) |
| operator → demo:reset | destructive command on production data | `--force` (high) |
| browser locale cookie → SSR | user-controlled input selecting content | locale value (low) |
| registered user → `/_demo/api/v1/presentations` | untrusted HTML, markdown and settings stored | deck JSON (high) |
| browser → `/api/realtime/token` and `/ws` | authenticated users obtain realtime credentials | JWT, Centrifugo token (high) |
| Centrifugo → `/api/realtime/subscribe` | server-to-server over loopback | X-Centrifugo-Secret, user, channel (high) |
| Go → Centrifugo HTTP API | publishes slide positions | API key, positions (medium) |
| anonymous visitor → `/_demo/api/v1/quizzes` | public read of quiz metadata | slug, title, description, count (medium) |
| test harness → Docker / test fixtures → repositories | throwaway database, test-only secrets | test data (low) |
| check-live.sh → production origin | read-only probes | GETs plus one refused POST (low) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-19.4.1-01 | Information disclosure | roadmap deck builder | high | mitigate | denylist + case-insensitive `leaks` (DEMO/plugins/demo/roadmap/names.go:8-26); leak check after curated overrides, leaking phases left out, final per-slide guard (deck.go:56-60,143-146); `TestRoadmapNoClientNames` | closed |
| T-19.4.1-02 | Information disclosure | visitor credentials | high | mitigate | `golem15.demo.visitor.*` only, ≥8 chars, never printed (console/seed.go:101-141); empty defaults; dev.sh umask 077, prints key name only; `TestSeedVisitorFromConfig` | closed |
| T-19.4.1-03 | Information disclosure | OIDC screenshots | medium | mitigate | capture-oidc.cjs uses the example client only, never opens the one-time secret screen; user reviewed the images (01 Task 4) | closed |
| T-19.4.1-04 | Tampering | deck HTML | low | accept | AR-19.4.1-01 | closed |
| T-19.4.1-05 | Denial of service | repeated seeding | low | mitigate | old image rows deleted in-tx after import, blobs after commit (console/roadmap_deck.go:109,136-155); `TestSeedRoadmapUpsert` | closed |
| T-19.4.1-06 | Elevation of privilege | admin exposure | high | mitigate | **Re-scoped by the user's decision of 2026-10-20** (the plan's "SSH tunnel only" is superseded): `/backend` → 404 (nginx:78-80), `/smbackend` login-required; `login.max_attempts: 5 / 1 min`; ClientIP takes the rightmost untrusted XFF hop with the Cloudflare real-IP snippet; `X-Robots-Tag noindex`; `TestAdminLoginThrottle`; check-deploy.sh:245-259, check-live.sh:140-150 | closed |
| T-19.4.1-07 | Information disclosure | secrets in repositories | high | mitigate | env examples empty; secret-pattern scan clean in both repos; values generated on rome, 0640 root:summercms-demo, admin password root 0600 (DEPLOY.md). Repo privacy is host-only | closed |
| T-19.4.1-08 | Tampering | one-way plugin tags | medium | mitigate | all 11 phase tags resolve to the commits recorded in the SUMMARYs; scripts/check-pins.sh; `TestGoModRequiresTags` | closed |
| T-19.4.1-09 | Spoofing | Stripe webhook | high | mitigate | signing secret required, `pgstripe.VerifySignature` on raw body (PLG/pgstripe/subscriptions/webhook.go:72-78); empty example. Value on rome is host-only | closed |
| T-19.4.1-10 | Information disclosure | debug pages and permissive CORS | medium | mitigate | production `debug: false`; CORS only `https://demo.summercms.io`; supervisor `SUMMER_ENV="production"`; check-deploy.sh:183 | closed |
| T-19.4.1-11 | Elevation of privilege | unintended Go routes | medium | mitigate | nginx allow-list, `/` GET/HEAD only; check-deploy.sh:268-279 refuses extra `/oauth`, `/.well-known`, `/api` and subscribe locations; PAT APIs `/api/v1/*` unrouted. Narrowed by Phase 19.7 (MCP paths) | closed |
| T-19.4.1-12 | Denial of service | Nuxt site-cache purge | medium | mitigate | purge on 127.0.0.1:3098, no POST reaches Nuxt, route 404s proxied/401s bad token; payload token leak fixed in DEMO 866e58c (`NUXT_CACHE_PURGE_TOKEN`, check-deploy.sh:300-318, smoke checks) | closed |
| T-19.4.1-13 | Information disclosure | credentials on public pages | high | mitigate | empty login fields cleared after submit; FAQ answer "credentials on request"; smoke.sh:256-268 fails on admin links or visitor credentials on 12 SSR pages; check-live `no_admin_link` | closed |
| T-19.4.1-14 | Spoofing | TLS | medium | mitigate | 301 to HTTPS, certbot lineage, HSTS (nginx:50-67); check-live HSTS check. Certificate is host-only | closed |
| T-19.4.1-15 | Denial of service | port collisions | low | mitigate | check-deploy.sh:179-243,364-371 port consistency; port probe on rome is host-only | closed |
| T-19.4.1-16 | Spoofing | bot sign-ups and credential stuffing | high | mitigate | `turnstile: closed`; guard on `/login`, `/register` inside `throttle:user-api`; attempt_limit 5; production without secret → 503 (FW v0.6.1); check-live token-less register → 422; `TestDemoTurnstile` | closed |
| T-19.4.1-17 | Tampering | shared sm-user-plugin behaviour | high | mitigate | default `turnstile: ""` adds nothing, invalid values fail boot (PLG/user/routes.go:63-79); `TestTurnstileRoutes`; no other app sets the key | closed |
| T-19.4.1-18 | Denial of service | contact form spam | medium | mitigate | 10/min per client IP; field limits (message ≤5000); Origin allow-list; no mailer in feedback/demo code | closed |
| T-19.4.1-19 | Information disclosure | Turnstile secret, G15Office token | high | mitigate | empty examples; build-machine secrets file mode 600; values piped over SSH stdin and checked by count only (DEPLOY.md:114-238). File modes host-only | closed |
| T-19.4.1-20 | Tampering | demo:reset deleting kept data | high | mitigate | no-op without `--force`; explicit table list keeps admins, plans, settings, locales, sitemap, OAuth clients; one transaction, blobs after commit; schedule off by default; `TestResetKeepsPlans`; check-local.sh:262-281 | closed |
| T-19.4.1-21 | Tampering | stored XSS via seed or author description | low | mitigate | AuthorCard text interpolation; PostBody `sanitizeJournalHtml` before v-html; curated seed | closed |
| T-19.4.1-22 | Information disclosure | author payload | low | accept | AR-19.4.1-02 (rationale corrected) | closed |
| T-19.4.1-23 | Tampering | locale cookie | low | accept | AR-19.4.1-03 | closed |
| T-19.4.1-24 | Information disclosure | feedback widget key in the page | low | accept | AR-19.4.1-04 | closed |
| T-19.4.1-25 | Tampering | stored XSS and phishing through user decks | high | mitigate | wrapper restricts themes, clears CSS/context, forces unpublished, resets id/hash, 403 on published decks (DEMO/plugins/demo/decks_api.go:38-120); bluemonday sanitize without `<a>` (PLG/presentations/classes/sanitize.go:21-51); reset wipes user decks; `TestDemoDeckWrites`. See residual 3 | closed |
| T-19.4.1-26 | Elevation of privilege | cross-app realtime token reuse | high | mitigate | own Centrifugo with own HMAC secret; HMAC-tagged channels with per-subscribe DB ownership check (PLG/presentations/realtime.go:74-90); guarded token route. Owner-only access clause superseded by Phase 20 (chat community members) | closed |
| T-19.4.1-27 | Spoofing | subscribe proxy | high | mitigate | no nginx location (enforced by check-deploy.sh:273-276, check-live); constant-time `X-Centrifugo-Secret` compare, empty refused (FW lighthouse/centrifugo/handlers.go:112-113); `TestRealtimeRoutes` | closed |
| T-19.4.1-28 | Information disclosure | Centrifugo keys and remote key | high | mitigate | `CHANGE_ME_*` placeholders enforced by check-deploy.sh:213-219; empty env examples; generated on rome 0640; health prints only `api_key_set` | closed |
| T-19.4.1-29 | Spoofing | WebSocket from other sites | medium | mitigate | `allowed_origins: ["https://demo.summercms.io"]`, no insecure/anonymous flags; check-live refuses a foreign Origin | closed |
| T-19.4.1-30 | Denial of service | deck writes and token route | medium | mitigate | 256 KiB body, ≤60 slides, `throttle:20,1`; realtime bucket 120/min per user | closed |
| T-19.4.1-31 | Information disclosure | quiz answers to anonymous visitors | medium | mitigate | public list returns slug, title, description, count only; quiz API behind `jwt.auth`; `TestDemoQuizList` | closed |
| T-19.4.1-32 | Elevation of privilege | another user's decks | medium | mitigate | owner from JWT (`mineCaller`); no owner field, `DisallowUnknownFields`; queries scoped by owner_user_id | closed |
| T-19.4.1-33 | Information disclosure | test fixtures and logs | medium | mitigate | test-only secrets; fake siteverify; smoke uses random tokens and passwords, never echoed | closed |
| T-19.4.1-34 | Tampering | regression of mitigations from plans 01-04 | high | mitigate | pinning test per threat (T-01, 02, 05, 16, 17, 20, 25, 26, 27, 31; smoke/check-live for T-06, T-13); scripts/check-all.sh | closed |
| T-19.4.1-35 | Denial of service | check-live against production | low | accept | AR-19.4.1-05 | closed |
| T-19.4.1-SC | Tampering | npm/pip/cargo installs (plans 01-05) | high | mitigate | only `centrifuge 5.7.3` and `vitest 3.2.7` added, exact pins; `protobufjs: false`; `--frozen-lockfile`, `GOWORK=off`, `GOPRIVATE`; go.sum committed; no replace (go_mod_test.go:31) | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-19.4.1-01 | T-19.4.1-04 | Seeded content is curated in the repository and every field passes `classes.Clean` at render; text values are HTML-escaped by the builder (`para()` uses `esc()`). | 19.4.1-01 PLAN | 2026-11-05 |
| AR-19.4.1-02 | T-19.4.1-22 | Plan rationale: "only subtitle, description and avatar are added; email and login data stay out of authorColumns." **Corrected:** `login` is selected (PLG/journal/controllers/api/authors.go:27-28) and published as `slug` when the author slug is empty. Holds in practice: the demo's only author is `summercms-team` (no superuser, no role, unusable password). A post by a real admin without an author slug would publish that admin's login name while `/smbackend` is public. | 19.4.1-03 PLAN (corrected by audit) | 2026-11-05 |
| AR-19.4.1-03 | T-19.4.1-23 | Only en and pl are accepted by the i18n module; any other value falls back to the default. | 19.4.1-03 PLAN | 2026-11-05 |
| AR-19.4.1-04 | T-19.4.1-24 | Public by design; the Origin allow-list and throttles gate it. | 19.4.1-03 PLAN | 2026-11-05 |
| AR-19.4.1-05 | T-19.4.1-35 | A handful of GET requests and one refused POST per run, inside the existing throttles. | 19.4.1-05 PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Residual Risk and Notes (non-blocking)
1. **T-06 register row is stale in 19.4.1-02-PLAN.md** ("admin only through an SSH tunnel"). The verified mitigation is the login-required public `/smbackend` described above (user decision 2026-10-20; 02-SUMMARY flag `auth-surface`, 03-SUMMARY "Threat model update").
2. **Later phases changed mitigations:** T-11 (Phase 19.7 routes MCP and OAuth metadata paths; check-deploy enforces the narrower list) and T-26 (Phase 20 gives realtime tokens to chat community members; presentations channels still HMAC-tagged and ownership-checked). Belongs in those phases' audits.
3. **The deck wrapper (T-25) is the only public deck write path while** nginx does not route `/api/v1/presentations` **and** demo users lack `golem15.presentations.access_presentations` (needed by the Phase 19.7 presentations MCP tools, incl. `presentations_publish` and deck CSS; no demo group grants it today). If either changes, users get a write path that skips the wrapper's CSS, publish and theme rules.
4. **AR-19.4.1-02 wording** corrected above (author `login` published as slug).
5. **Local-only admin password literal:** DEMO/scripts/dev.sh:48 `ADMIN_PASSWORD=AdminDemo123!` for the local dev admin, reused as a fallback in smoke-seo.sh:74. Not a production credential, but a committed literal in a private repo.
6. **UAT:** 19.4.1-UAT.md is `testing` with 3 pending items. Item 1 (purge token in the payload) is fixed in 866e58c; DEPLOY.md:1046-1055 records the rotation on rome on 2026-10-20 (host-only). Items 2-3 are UAT, not threats.
### Host-only checks (not verifiable from the repos)
Repository privacy on git.golem15.com; rome file modes (`.env`, `site.env` 0640 root:summercms-demo, admin file 0600, centrifugo.json 0640); Stripe and Turnstile secrets present on rome; reset schedule off on rome; certbot certificate and Cloudflare real-IP snippet; port probe; purge-token rotation; build machine's 0600 secrets file.
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 36 | 36 | 0 | msd-security-auditor (ASVS L1, block_on high; static, repo contents only) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
- [ ] Host-only checks confirmed on rome / git.golem15.com
**Approval:** verified 2026-11-05 (ASVS L1, repository evidence)

View File

@@ -0,0 +1,214 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 01
subsystem: plugins
tags: [chat, forum, moderation, go-modules, release, gitea]
requires:
- phase: 19.4.1-early-public-demo-on-demo-summercms-io
provides: live demo instance the chat family is added to
- phase: 34
provides: summercms v0.6.0 framework tag the family requires
provides:
- "sm-chat-plugin v0.1.5: events.MessageSaving pre-save event + contracts.Rejection (422 on refusal)"
- "sm-forum-plugin v0.1.1: events.PostSaving pre-save event + contracts.Rejection (422 on refusal)"
- "sm-moderation-plugin v0.1.0 (new public repo): golem15.moderation, *classes.Filter for banned words and links, admin settings screen"
- "sm-chatvideo-plugin, sm-herald-plugin, sm-userfriends-plugin v0.1.1: go.mod on tagged chat/user/summercms, framework replace only"
- "Eight chat-family module tags that resolve together with GOWORK=off against summercms v0.6.0"
affects: [20-02, 20-03, 20-04, 20-05, 20-06, sm-demo-app]
actuals:
tokens: 32150 # chars/4 over the realized diffs in the six changed sibling repos
tasks: 6
commits: 7 # measured: git rev-list over the sibling repos (chat 2, forum 1, moderation 1, chatvideo 1, herald 1, userfriends 1); summercms.go had 0 code commits
plan_head_before: 677e30f6f53e9eab79d6cadd46b8b6e2843f5c61 # summercms.go; multi-repo plan, per-repo bases listed in the body
plan_head_after: 677e30f6f53e9eab79d6cadd46b8b6e2843f5c61 # summercms.go before this SUMMARY commit
tech-stack:
added: []
patterns:
- "Pre-save veto event: plugin fires <Thing>Saving on the bus before the transaction; a listener returning contracts.Rejection{Field, Message} maps to the existing 422 validation envelope, any other error keeps the opaque 500 path"
- "Shared filter published as a typed service (app.Publish(*classes.Filter)) that consumers look up; the filter plugin imports none of its consumers"
key-files:
created:
- ../sm-moderation-plugin/plugin.go
- ../sm-moderation-plugin/classes/filter.go
- ../sm-moderation-plugin/models/settings.go
- ../sm-moderation-plugin/admin.go
- ../sm-chat-plugin/contracts/rejection.go
- ../sm-forum-plugin/contracts/rejection.go
modified:
- ../sm-chat-plugin/events/events.go
- ../sm-chat-plugin/classes/service.go
- ../sm-chat-plugin/api/errors.go
- ../sm-forum-plugin/events/events.go
- ../sm-forum-plugin/classes/forum_service.go
- ../sm-forum-plugin/api/errors.go
- ../sm-chatvideo-plugin/go.mod
- ../sm-herald-plugin/go.mod
- ../sm-userfriends-plugin/go.mod
key-decisions:
- "Task 5 checkpoint answered \"release\" by the user (2026-10-30): create sm-moderation-plugin, push and tag"
- "Tag numbers moved up one because the marketplace manifest commits had already tagged chat v0.1.4 and the others v0.1.0; chat v0.1.5, forum/chatvideo/herald/userfriends v0.1.1, moderation v0.1.0"
- "The family requires summercms v0.6.0, not the planned v0.5.1"
- "sm-moderation-plugin is public, like sm-sitemap-plugin, default branch main"
patterns-established:
- "Pre-save veto seam: events.<Thing>Saving + contracts.Rejection, additive and parity-safe"
requirements-completed: [SC-1, D-17, D-18, D-19, D-20]
coverage:
- id: D1
description: "Chat MessageSaving seam: a Rejection from a listener answers 422 on send, reply and edit, with no row written and no event or publish"
requirement: "D-18"
verification:
- kind: integration
ref: "../sm-chat-plugin/saving_smoke_test.go#TestMessageSavingTracer"
status: pass
human_judgment: false
- id: D2
description: "Forum PostSaving seam: CreateThread, Reply and EditPost fire PostSaving before render; a Rejection maps to 422 under title or body"
requirement: "D-18"
verification:
- kind: integration
ref: "../sm-forum-plugin/saving_smoke_test.go"
status: pass
human_judgment: false
- id: D3
description: "golem15.moderation Filter flags banned words and phrases (Unicode boundaries, Polish letters) and banned links (domain, subdomains, URL prefixes), nil for clean text"
requirement: "D-17"
verification:
- kind: unit
ref: "../sm-moderation-plugin/classes/filter_smoke_test.go#TestFilterSmoke"
status: pass
human_judgment: false
- id: D4
description: "Eight chat-family tags pushed to git.golem15.com on the verified HEADs and resolving together in module mode"
requirement: "SC-1"
verification:
- kind: other
ref: "Task 6 verify loop: git describe --tags --exact-match HEAD == ls-remote refs/tags/<tag>^{} for all eight repos (exit 0)"
status: pass
- kind: other
ref: "scratch module, GOWORK=off GOPRIVATE='git.golem15.com/*' GOFLAGS=-mod=mod go build ./... (exit 0)"
status: pass
human_judgment: false
duration: 3min (Task 6 continuation; Tasks 1-5 ran in earlier sessions)
completed: 2026-10-30
status: complete
---
# Phase 20 Plan 01: Chat Family Release Summary
**Chat and forum gained additive pre-save veto events (MessageSaving, PostSaving with contracts.Rejection → 422). The new shared golem15.moderation plugin publishes a banned word and link filter. All eight chat-family modules are tagged on git.golem15.com and build together with GOWORK=off against summercms v0.6.0.**
## Performance
- **Duration:** about 3 min for the Task 6 continuation (17:22–17:25 UTC); Tasks 1-5 ran in earlier sessions
- **Started (continuation):** 2026-10-30T17:22:07Z
- **Completed:** 2026-10-30T17:25Z
- **Tasks:** 6/6 (Task 5 was the go-ahead decision)
- **Files modified:** 45 across six sibling repos (chat 7, forum 7, chatvideo 3, herald 3, userfriends 4, moderation 21 new)
## Accomplishments
- `sm-chat-plugin` v0.1.5: `events.MessageSaving` fires in `SendMessageWith` (send, reply, ReplyTo) and `EditMessage` before the transaction. `writeChatError` maps a `contracts.Rejection` to the existing 422 `{"error":"Validation failed","errors":{field:[msg]}}`. With no listener the behaviour is unchanged, and the parity and golden tests pass without edits.
- `sm-forum-plugin` v0.1.1: `events.PostSaving` fires in `CreateThread`, `Reply` and `EditPost` before `breakwater.Render`. A Rejection lands under `errors.title` or `errors.body`.
- `sm-moderation-plugin` v0.1.0 (new repo): `golem15.moderation` publishes `*classes.Filter` at boot. The lists come from the `banned_words` and `banned_links` textareas on its settings screen (singleton `golem15_moderation_settings`, permission `golem15.moderation.manage_settings`). It imports neither chat nor forum.
- chatvideo, herald and userfriends v0.1.1: each go.mod now keeps only the framework replace and requires tagged chat/user/summercms modules.
- Module-mode proof: a scratch module that requires the eight tags and summercms v0.6.0 and blank-imports all eight plugin packages built with `GOWORK=off`. It resolved sm-user-plugin v0.1.13 transitively.
## Release table (for plan 02)
| Repo | Before HEAD (origin) | After HEAD | Tag | Tag commit | Why |
|------|----------------------|------------|-----|------------|-----|
| sm-chat-plugin | db3b518 | 6275ae4 | v0.1.5 | 6275ae4c7cd80fdc5b0c07466ba65ca63b518503 | MessageSaving seam (patch) |
| sm-chatchannels-plugin | 017843a | 017843a | v0.1.0 (existing) | 017843a | no new commits, not pushed or re-tagged |
| sm-chatbots-plugin | 24eadf6 | 24eadf6 | v0.1.0 (existing) | 24eadf6 | no new commits, not pushed or re-tagged |
| sm-chatvideo-plugin | 33ff4f5 | 0f08c35 | v0.1.1 | 0f08c35380d7505d591cef96ac80ef8d7649e70e | go.mod hygiene |
| sm-forum-plugin | 36bd875 | 4e8a3c3 | v0.1.1 | 4e8a3c35e20698eaf8603ce68410ce7f02bc2674 | PostSaving seam |
| sm-herald-plugin | db8a1bb | 82f070a | v0.1.1 | 82f070ac89dbd1a081aee282f121f1e186a65465 | go.mod hygiene |
| sm-userfriends-plugin | 2f29b26 | 1c28db8 | v0.1.1 | 1c28db8a08a819290591a4e0365a751ebf8c913f | go.mod hygiene + plugin.yaml |
| sm-moderation-plugin | (new) | d9791e2 | v0.1.0 | d9791e2ea53bcb7abbfbca65cfc79d817ad5f33b | first release |
All tags are annotated. Each was pushed separately, and `git ls-remote origin refs/tags/<tag>^{}` equals the local HEAD in every repo. All branch pushes were fast-forwards with no force. All eight working trees are clean.
## Task Commits
1. **Task 1: chat MessageSaving seam**: `42f64eb` (feat), plus `6275ae4` (chore: no host application named in the CanDeleteMessage comment), in sm-chat-plugin
2. **Task 2: forum PostSaving seam**: `4e8a3c3` (feat), sm-forum-plugin
3. **Task 3: golem15.moderation plugin**: `d9791e2` (feat), sm-moderation-plugin
4. **Task 4: go.mod hygiene**: sm-chatvideo-plugin `0f08c35`, sm-herald-plugin `82f070a`, sm-userfriends-plugin `1c28db8` (chore)
5. **Task 5: go-ahead**: the user answered **"release"**
6. **Task 6: release**: no code commit; repo created, five branches and moderation main pushed, six tags pushed, module-mode build proven
## go.mod changes (Task 4)
- **sm-chatvideo-plugin:** dropped `replace sm-chat-plugin => ../sm-chat-plugin` and `replace sm-user-plugin => ../fonoteka.go/plugins/golem15/user`; sm-user-plugin v0.1.2 → v0.1.13; keeps sm-chat-plugin v0.1.3 and summercms v0.6.0.
- **sm-herald-plugin:** dropped `replace sm-user-plugin => ../fonoteka.go/plugins/golem15/user`; sm-user-plugin v0.1.1 → v0.1.13; summercms v0.6.0.
- **sm-userfriends-plugin:** sm-chat-plugin pseudo-version `v0.0.0-20261017200243-4d0e764ca443` → v0.1.3; sm-user-plugin v0.1.1 → v0.1.13; summercms v0.6.0.
- **sm-moderation-plugin:** requires summercms v0.6.0.
- Every one of them keeps only `replace git.golem15.com/golem15/summercms => ../summercms.go`.
## How the moderation repository was created
`tea login list` showed a git.golem15.com login (user jakub). The API reported sm-sitemap-plugin as `"private":false`, default branch `main`. The repo was created with `tea repo create --login git.golem15.com --name sm-moderation-plugin --owner golem15` as a public repo (no `--private`), and the API confirmed `private:false`, `default_branch:main`. Then `git -C ../sm-moderation-plugin remote add origin git@git.golem15.com:golem15/sm-moderation-plugin.git` and `git push -u origin main`. `git ls-remote git@git.golem15.com:golem15/sm-moderation-plugin.git` exits 0 and shows d9791e2 on `refs/heads/main`. The local repo had been created in Task 3 with `git init -b main`.
## Decisions Made
- Checkpoint answer: **"release"** (user, 2026-10-30).
- The family requires summercms v0.6.0, the current framework tag, instead of the v0.5.1 the plan named.
- chatchannels and chatbots keep their existing v0.1.0 tags on HEAD. They had no new commits, so they were neither pushed nor re-tagged.
## Deviations from Plan
1. **Tag numbers moved up one.** Another session's marketplace manifest commits had already tagged sm-chat-plugin v0.1.4 and the other repos v0.1.0. The new tags are therefore chat v0.1.5 and forum/chatvideo/herald/userfriends v0.1.1. Moderation is v0.1.0 as planned, and chatchannels and chatbots stay on their existing v0.1.0. The tags were read from `git ls-remote --tags origin` immediately before tagging.
2. **summercms stays v0.6.0** in every go.mod and in the scratch proof, not v0.5.1.
3. **[Rule 2] Moderation got `plugin.yaml` and `manifest_test.go`** (`TestPluginManifest`), so the plugin matches the marketplace manifest convention that landed during the plan.
4. **[Rule 3] userfriends `plugin.yaml` regenerated** because the go.mod change made the manifest check fail (commit 1c28db8).
5. **No changelog lines for chatvideo, herald and userfriends.** Their READMEs have no changelog section.
6. **App names removed** from a chat comment (`6275ae4`) and from the chat README, per the "framework code never names a consuming application" rule.
7. **Added `(*Filter).SetTranslator`** to the moderation filter, so violation messages are localised through the host's translator.
8. **Extra moderation exports** beyond the plan's list: `models.SetLimits`, `models.Limits`, `models.Lines`, `models.LinkEntry`, `models.ValidHost`, `models.DefaultSettings`, `models.Text`; root `PluginID`, `ConfigMaxEntries`, `ConfigMaxEntryLength`, `PermissionManageSettings`.
9. **Task 4 acceptance check `grep -c v0.0.0` fails as written.** It matches only third-party `// indirect` pseudo-versions. No golem15 module is on a pseudo-version any more.
**Total deviations:** 9 (2 auto-fixed under Rules 2/3, the rest are renumbering, scope notes and documentation)
**Impact on plan:** None on the goal. The seams stay additive, and plan 02 can mount all eight by tag.
## Follow-ups left alone (out of scope)
- The tracked `go.work` files in the sibling repos still point at `../fonoteka.go/plugins/golem15/user`. They only affect workspace builds, not module mode.
- The forum and herald READMEs still say "v0.4.0 modules" in their Dependencies section.
- `../sm-chat-plugin/classes/kind_test.go` is not gofmt'd. This predates the plan.
## Issues Encountered
None in Task 6. Every push, tag push and ls-remote check succeeded on the first attempt. The proxy had not yet seen the new tags, and `GOPRIVATE='git.golem15.com/*'` made go fetch them directly.
## Threat notes
- T-20-03 (filter cost): one uncached `Match` at 2 lists × 500 entries × 200 characters takes about 36 ms, and the compiled matchers take about 8.8 KB. Matchers are compiled once per list version, so this cost is paid once per settings change, not per message.
- T-20-05 (one-way tags): the tags sit on the HEADs that passed vet and tests in Tasks 1-4. They were confirmed free immediately before creation and verified on the remote afterwards.
## User Setup Required
None.
## Next Phase Readiness
- Plan 02 can require the chat family by tag: chat v0.1.5, chatchannels v0.1.0, chatbots v0.1.0, chatvideo v0.1.1, forum v0.1.1, herald v0.1.1, userfriends v0.1.1, moderation v0.1.0, with summercms v0.6.0 and sm-user-plugin v0.1.13.
- Plugin release posts on summercms.io/changelog/plugins for the six new tags are not written yet. Per CLAUDE.md, plugin tags get a post.
---
*Phase: 20-demo-instance-with-every-shared-plugin*
*Completed: 2026-10-30*
## Self-Check: PASSED
- All eight repos: `git describe --tags --exact-match HEAD` matches `ls-remote refs/tags/<tag>^{}` (verify loop exit 0).
- Commits 42f64eb, 6275ae4, 4e8a3c3, d9791e2, 0f08c35, 82f070a, 1c28db8 exist on origin/main of their repos.
- `../sm-moderation-plugin/classes/filter.go`, `../sm-chat-plugin/contracts/rejection.go` and `../sm-forum-plugin/contracts/rejection.go` exist.

View File

@@ -0,0 +1,311 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 02
subsystem: sm-demo-app
tags: [chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends, moderation, livekit, centrifugo, seed]
requires:
- phase: 20-01
provides: the eight chat-family tags (chat v0.1.5 with MessageSaving, forum v0.1.1 with PostSaving, moderation v0.1.0 Filter)
provides:
- "sm-demo-app mounts chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends and moderation at their tags"
- "golem15.demo hosts the chat family: contexts demo/1 and channel/{id}, channel and forum access policies, moderation seams, slash commands /demo and /tour"
- "Host bootstrap contract GET /_demo/api/v1/chat and GET /_demo/api/v1/chat/members (for vue-chat-layer, plan 03)"
- "demo.realtime-access: every community member gets a realtime token"
- "demo:seed EN/PL showcase data for chat, forum and friends; demo:reset covers every chat-family table"
- "Local LiveKit in scripts/dev.sh; deploy/livekit.yaml.example and Centrifugo namespaces chat, user, video (for plan 05)"
affects: [20-03, 20-04, 20-05, 20-06]
actuals:
tokens: 36500 # chars/4 over the realized sm-demo-app diff 56c1141..f4ed2c2 without go.sum (146079 chars)
tasks: 4
commits: 1 # MEASURED in summercms.go: git rev-list --count plan_head_before..HEAD (the todo move); sm-demo-app: 12 (git rev-list --count 56c1141..f4ed2c2)
plan_head_before: 159cd5ecf4aac6e48c2579c68c19addb7633cfce # summercms.go
plan_head_after: d6f490a9abcaf4322aec5a072f7842b8f0d3d2c3 # summercms.go before this SUMMARY commit; sm-demo-app 56c1141 -> f4ed2c2
tech-stack:
added:
- "github.com/livekit/server-sdk-go/v2 v2.19.0 and github.com/SherClockHolmes/webpush-go v1.4.0 (transitive, through chatvideo and herald)"
patterns:
- "Channel-as-context adapter: the host registers chatchannels' `channel` alias on chat's registry so a channel's backing conversation resolves"
- "Host wiring in lagoon.OnDatabase after each plugin published its service (ChannelService, ForumService, chatbots Registry, moderation Filter); a missing service is a boot error naming the summer.yaml order"
- "Pre-save veto listeners (MessageSaving, PostSaving) look up the moderation Filter per event"
key-files:
created:
- ../sm-demo-app/plugins/demo/classes/chat_context.go
- ../sm-demo-app/plugins/demo/classes/forum_access.go
- ../sm-demo-app/plugins/demo/chat.go
- ../sm-demo-app/plugins/demo/chat_api.go
- ../sm-demo-app/plugins/demo/chatbots.go
- ../sm-demo-app/plugins/demo/moderation.go
- ../sm-demo-app/plugins/demo/realtime_access.go
- ../sm-demo-app/plugins/demo/console/seed_chat.go
- ../sm-demo-app/plugins/demo/console/seed_forum.go
- ../sm-demo-app/plugins/demo/console/seed_friends.go
- ../sm-demo-app/chat_smoke_test.go
- ../sm-demo-app/config/golem15.chatvideo.yaml
- ../sm-demo-app/config/golem15.chat.yaml
- ../sm-demo-app/config/env/production/golem15.chatvideo.yaml
- ../sm-demo-app/deploy/livekit.yaml.example
modified:
- ../sm-demo-app/summer.yaml
- ../sm-demo-app/go.mod
- ../sm-demo-app/go.work
- ../sm-demo-app/.gitmodules
- ../sm-demo-app/plugins.gen.go
- ../sm-demo-app/plugins/demo/plugin.go
- ../sm-demo-app/plugins/demo/routes.go
- ../sm-demo-app/plugins/demo/config/config.yaml
- ../sm-demo-app/plugins/demo/console/seed.go
- ../sm-demo-app/plugins/demo/console/reset.go
- ../sm-demo-app/boot_test.go
- ../sm-demo-app/realtime_test.go
- ../sm-demo-app/deploy/centrifugo.json.example
- ../sm-demo-app/deploy/env.example
- ../sm-demo-app/scripts/dev.sh
- ../sm-demo-app/README.md
- .planning/todos/done/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md
key-decisions:
- "Folded oauthserver/journal todo closed without a commit in sm-demo-app: 2133309 and 5ec5941 had already moved oauthserver to v0.1.6 (contains b6a9586) and journal to v0.2.6; not moved back to v0.1.3"
- "Channel join path: GetGroupChat's lazy join holds (opening GET /_chat/api/v1/contexts/channel/{id}/conversation adds the participant row); the bootstrap joins nobody"
- "Bootstrap channels[].joined is 'has not left' (chatchannels prefs.has_left); left channels stay listed with joined false"
- "Chat attachments capped at 5 MiB per message (config/golem15.chat.yaml max_message_bytes 5242880), reported as limits.max_bytes"
- "Forum CanManage and CanManageContext both go to the moderator group, as the plan says; forum needs no RegisterContext for listing or posting"
- "Production livekit_url wss://demo.summercms.io/livekit lives in config/env/production/golem15.chatvideo.yaml"
patterns-established:
- "Seed steps write chat rows by raw SQL in created order and call chat's own jobs.Work to keep thread summaries consistent"
requirements-completed: [SC-1, D-05, D-06, D-07, D-08, D-09, D-10, D-12, D-14, D-17, D-20, D-22, D-23]
coverage:
- id: D1
description: "A registered member reads the bootstrap, opens seeded #general (lazy join), posts and reads back through the chat API; channel creation refused; members endpoint excludes the caller"
requirement: "D-06, D-07"
verification:
- kind: integration
ref: "../sm-demo-app/chat_smoke_test.go#TestDemoChatTracer"
status: pass
human_judgment: false
- id: D2
description: "Banned word in a chat message -> 422 errors.content, banned link in a forum title -> 422 errors.title, clean content stored; DM between two members; /demo and /tour listed and ephemeral"
requirement: "D-17, D-08, D-05"
verification:
- kind: integration
ref: "../sm-demo-app/chat_smoke_test.go#TestDemoModerationSmoke"
status: pass
human_judgment: false
- id: D3
description: "demo:seed EN/PL chat, forum, friends, moderator group, moderation lists; second run all exists; demo:reset --force wipes and reseeds, keeps moderation settings and the userfriends context"
requirement: "D-09, D-22"
verification:
- kind: integration
ref: "../sm-demo-app/chat_smoke_test.go#TestSeedChatSmoke"
status: pass
- kind: other
ref: "scripts/dev.sh seed twice against the local Postgres: every new step 'created', then 'exists'"
status: pass
human_judgment: false
- id: D4
description: "Every plugin activates, prefixes routed, go.mod tags only, pins match"
requirement: "SC-1"
verification:
- kind: integration
ref: "../sm-demo-app/boot_test.go#TestBootAllPlugins, go_mod_test.go#TestGoModRequiresTags, scripts/check-pins.sh (25 modules), scripts/build.sh dev"
status: pass
human_judgment: false
- id: D5
description: "Realtime token for any member (401 without JWT), Centrifugo namespaces, local LiveKit on 7890/7891/7892"
requirement: "D-10, D-06"
verification:
- kind: integration
ref: "../sm-demo-app/realtime_test.go#TestRealtimeRoutes"
status: pass
- kind: other
ref: "dev.sh start_livekit (curl 127.0.0.1:7890 200); new binary on 127.0.0.1:8197: GO_ADDR=127.0.0.1:8197 scripts/check-local.sh realtime ok; fresh registered member: token, /chat, /chat/members 200"
status: pass
human_judgment: false
duration: 33min
completed: 2026-10-30
status: complete
---
# Phase 20 Plan 02: Demo backend for the chat family Summary
**sm-demo-app mounts all eight chat-family plugins at their tags and golem15.demo hosts them as one community. Every registered member can post in the seeded EN/PL channels, DM anyone, use /demo and /tour, post in the forum and get a realtime token. Moderation refuses banned words and links with 422, and a local LiveKit runs from scripts/dev.sh.**
## Performance
- **Duration:** about 33 min
- **Started:** 2026-10-30T17:37:25Z
- **Completed:** 2026-10-30T18:10:23Z
- **Tasks:** 4/4
- **Files modified:** 40 in sm-demo-app (2902 insertions, 111 deletions), 1 in summercms.go
## Accomplishments
- Eight `feat: mount golem15.<id> <tag>` commits. `summer.yaml` lists chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends and moderation after golem15.user and before golem15.demo. Every submodule describes as its tag, and `check-pins` reports ok for 25 modules.
- Host types in `plugins/demo/classes`:
- `DemoContext` (demo/1, `chat:context:1`).
- `ChannelContext` (alias `channel`, `chat:channel:{id}`).
- `ChatAccess`: members may access demo/1 and `CanManageContext` is always false.
- `ForumAccess`.
- `MemberIDs`, `IsMember` and `IsModerator`.
- Membership means activated, not deleted and not banned (`user_throttle.is_banned`).
- The bootstrap `GET /_demo/api/v1/chat` returns `{member, moderator, context, channels[], conversations[], limits}` and `/chat/members` returns `{members[]}`. Both need a JWT and are throttled at 120 a minute.
- Listeners on MessageSaving and PostSaving call the moderation Filter. `/demo` and `/tour` answer ephemerally, in EN or PL from `preferred_locale`.
- demo:seed adds eight steps. demo:reset clears 27 more tables in foreign-key order.
- `demo.realtime-access` guards the token route. Centrifugo gets the namespaces chat, user and video. `deploy/livekit.yaml.example` is added, dev.sh starts and stops a local LiveKit, and the README has a chat family section.
## Task Commits
| # | Task | Repo | Commit | Message |
|---|------|------|--------|---------|
| 1 | Folded todo | summercms.go | d6f490a | docs(20-02): close the sm-demo-app journal/oauthserver pointer todo |
| 1 | Mount chat | sm-demo-app | 7815001 | feat: mount golem15.chat v0.1.5 |
| 1 | Mount chatchannels | sm-demo-app | 6edfae5 | feat: mount golem15.chatchannels v0.1.0 |
| 1 | Tracer host wiring | sm-demo-app | 58ba678 | feat: demo chat context, channel adapter and bootstrap |
| 2 | Mount chatbots | sm-demo-app | 47c7833 | feat: mount golem15.chatbots v0.1.0 |
| 2 | Mount chatvideo | sm-demo-app | 5076d8c | feat: mount golem15.chatvideo v0.1.1 |
| 2 | Mount forum | sm-demo-app | 2dea441 | feat: mount golem15.forum v0.1.1 |
| 2 | Mount herald | sm-demo-app | 64d37a2 | feat: mount golem15.herald v0.1.1 |
| 2 | Mount userfriends | sm-demo-app | a78c543 | feat: mount golem15.userfriends v0.1.1 |
| 2 | Mount moderation | sm-demo-app | 864a14b | feat: mount golem15.moderation v0.1.0 |
| 2 | Wiring | sm-demo-app | b03fe83 | feat: demo hosts forum, friends, slash commands and moderation |
| 3 | Seed and reset | sm-demo-app | 4a94565 | feat: seed and reset the chat family (EN/PL) |
| 4 | Realtime, members, deploy, dev | sm-demo-app | f4ed2c2 | feat: realtime for every demo member, members endpoint, Centrifugo namespaces and local LiveKit |
Nothing was pushed, tagged or deployed. No file inside a plugin submodule was edited.
## Details for later plans
**Channel join path:** the lazy join holds. `GET /_chat/api/v1/contexts/channel/{channelId}/conversation` reaches chat's `GetGroupChat`, which adds the caller as a participant of the existing backing conversation. TestDemoChatTracer asserts the participant row. The bootstrap fallback (`AddUserToGroupChat`) was not needed.
**Personas:** Ada Hart and Ben Carter (en), Ola Nowak and Tomek Wiśniewski (pl). Emails are `<key>@personas.demo.invalid`. Each gets a random bcrypt hash of 32 random bytes, never printed, and a handle from the user plugin's `AssignHandle`.
**Channels:**
| Channel | Slug | Language | Messages | Thread roots | Pins |
|---------|------|----------|----------|--------------|------|
| #general (default) | `general` | en | 13 | 2 | 1 |
| #announcements | `announcements` | en | 5 | 1 | 1 |
| #ogólny | `ogolny` | pl | 15 | 1 | 1 |
All three channels have reactions. Ada sends the visitor a welcome DM.
**Forum:** "General discussion" (`general-discussion`) and "Show and tell" (`show-and-tell`) in English and "Rozmowy" (`rozmowy`) in Polish, with 2, 2 and 3 threads and `content_html` from `breakwater.Render`.
**Friends:** accepted friendships ada-ben, ada-ola, ben-tomek and ola-tomek. Ola has a pending request to the visitor. The group "Demo crew" has Ada as owner and Ben and Tomek as members.
**Moderation defaults** (only while both lists are empty): words `buy followers`, `casino bonus`, `free crypto` and `viagra`; link `bit.ly`.
**Reset table order** (inserted before `users`, children first):
1. chatvideo participants, sessions
2. chatchannels channel_mentions, channel_pins, channel_members, channel_user_prefs, user_context_prefs, personal_categories, channels, channel_categories
3. chat reactions, thread_mutes, thread_summaries, messages, participants, conversations
4. forum thread_reads, posts, threads, categories
5. userfriends group_bans, group_invites, group_members, groups, friendships
6. herald push_subscriptions
7. chatbots bot_flags
Chatchannels comes before chat because channels hang off their backing conversations. The reset keeps `golem15_moderation_settings`, `user_groups` (the moderator group) and `golem15_userfriends_contexts`. Chat attachments were already covered: the reset removes every `system_files` owner except the kept ones.
**Centrifugo option names** (v6.5.1, checked against `centrifugo defaultconfig`):
- `chat`: `presence`, `join_leave`, `force_push_join_leave`, `allow_presence_for_subscriber` and `subscribe_proxy_enabled`.
- `user` and `video`: `subscribe_proxy_enabled` only.
**Boot warnings left by plugins** (`dev.sh seed`):
- The chatchannels and forum deny-all warnings fire from the plugins' own database hooks before golem15.demo's hook installs the resolvers, so they are expected.
- `golem15.chatbots: BotAuthResolver is deny-all`. The demo has no bot persona.
- `golem15.herald: PresenceGate is deny-all` and `golem15.herald: VAPID keys are missing`. Plan 04 handles these.
## Decisions Made
See the key-decisions list in the frontmatter. The plan's own discretion items (aliases, personas, slugs, commands, ports) were applied as written.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Folded todo needed no sm-demo-app commit**
- **Found during:** Task 1 step 1
- **Issue:** go.mod already required sm-oauthserver-plugin v0.1.6 and sm-journal-plugin v0.2.6 (2133309, 5ec5941), and the oauthserver checkout contains b6a9586. Bumping to v0.1.3 would have been a downgrade.
- **Fix:** No `chore: bump sm-oauthserver-plugin to v0.1.3` commit. The todo moved to done with a note (d6f490a).
**2. [Rule 3 - Blocking] realtime_test.go namespaces updated in the mount commits**
- **Found during:** Task 1 and Task 2 (mount chatvideo)
- **Issue:** chat registers the `chat` namespace and chatvideo registers `video`, so the short suite failed.
- **Fix:** `wantNamespaces` was extended in 58ba678 and 5076d8c, so `go test -short` stays green at every commit.
**3. [Rule 3 - Blocking] boot_test.go realtime subtest expected the old guard**
- **Found during:** Task 4
- **Fix:** It now expects `demo.realtime-access`, in f4ed2c2.
**4. [Rule 2 - Missing critical] Chat attachment cap**
- **Issue:** chat's `max_message_bytes` defaults to 0 (no total limit) on a public demo, and the bootstrap reported 0.
- **Fix:** `config/golem15.chat.yaml` sets 5 MiB per message (5 × the 1 MiB upload body limit), in b03fe83.
**5. [Rule 2] Production LiveKit URL**
- **Fix:** Added `config/env/production/golem15.chatvideo.yaml` with `livekit_url: wss://demo.summercms.io/livekit`, so the committed `ws://127.0.0.1:7890` applies locally only (f4ed2c2).
**6. Scope order changes**
- The `chat personas` step landed in Task 1, because #general's welcome message needs a sender. `users` can't send as a backend admin.
- `/chat/members` assertions were added to TestDemoChatTracer in Task 4.
**7. The `pact.HasMiddleware` assertion sits in plugin.go**, as the plan asks. The middleware itself is in realtime_access.go.
**8. Forum RegisterContext not called.** Its only consumer is `forum:rewrite-context-types`. Listing and posting work without it.
### Verification adjustments
- **The Task 4 verify command `centrifugo checkconfig -c deploy/centrifugo.json.example` cannot pass as written.** Centrifugo picks the config type from the file extension ("Unsupported Config Type example"). I ran it on a `.json` copy instead, the way `scripts/check-deploy.sh` does. checkconfig passed, check-deploy passed, and every option name is in `centrifugo defaultconfig`.
- **`scripts/dev.sh up` was not run as a whole.** The dev ports are held by stale processes that dev.sh did not start in this session and cannot stop:
- Centrifugo on 8011 (pid 212066, Oct 22)
- Go on 8097, run as user golem (pid 3405714, Oct 24)
- Nuxt on 3020 from a cursor-agent session (pid 3776486, Oct 27)
Their pid files are stale, so `claim_port` would refuse, and killing other sessions' processes was out of bounds. What I verified instead:
- **LiveKit:** started with dev.sh's own `ensure_env` and `start_livekit` functions. `curl 127.0.0.1:7890/` answered 200, TCP 7890/7891 and UDP 7892 were listening, `logs/livekit.yaml` is mode 600 with no CHANGE_ME left and `use_external_ip: false`.
- **Realtime:** the new binary ran on 127.0.0.1:8197 against the local Postgres, and `GO_ADDR=127.0.0.1:8197 scripts/check-local.sh realtime` printed ok. A freshly registered member got 200 from the token route, `/_demo/api/v1/chat` and `/chat/members`.
- **Seed:** `scripts/dev.sh seed` ran twice. The new steps were `created`, then `exists`.
- Both of my processes were stopped afterwards.
- **Mistake made and fixed:** my first attempt sourced dev.sh's functions from the scratchpad. Its `cd "$(dirname "$0")/.."` then landed in the meta repo `..`, where it wrote `.env`, `logs/` and `storage/app/uploads/public`. All three had been created seconds earlier by that run, and I removed them. Nothing else in the meta repo was touched.
**Total deviations:** 8 plus 2 verification adjustments. **Impact:** none on the plan goal.
## Issues Encountered
- **g15office MCP unavailable** (connection timed out in this session). Task ssuyq2os (the folded todo) was **not** moved to Live and got no comment, and the Phase 20 task xo463rwk got no comment either. The orchestrator or the user needs to do both.
## Known Stubs
None. Every endpoint reads live data. The bootstrap reports `is_bot: false` for everyone on purpose, because the demo has no bot persona (D-05).
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: endpoint | ../sm-demo-app/plugins/demo/chat_api.go | `/chat/members` lists every member's name, surname and handle to any member (planned in T-20 scope; no email or id beyond the user id) |
| threat_flag: config | ../sm-demo-app/config/golem15.chat.yaml | Upload cap 5 MiB per message on the public demo (mitigation, not new surface) |
## User Setup Required
None for this plan. Plan 05 needs the LiveKit key pair on rome (`deploy/env.example`).
## Next Phase Readiness
- Plan 03 (vue-chat-layer) can build on `GET /_demo/api/v1/chat` and `/chat/members` as documented in sm-demo-app README "Chat family". Channels are opened with `GET /_chat/api/v1/contexts/channel/{id}/conversation`.
- Plan 05 deploys `deploy/livekit.yaml.example`, the Centrifugo namespaces (restart summercms-demo-centrifugo), nginx `/livekit/` and the Go allow-list, and the herald VAPID keys.
---
*Phase: 20-demo-instance-with-every-shared-plugin*
*Completed: 2026-10-30*
## Self-Check: PASSED
- All 15 created files listed under key-files exist, and the todo is under `.planning/todos/done/`.
- sm-demo-app commits 7815001, 6edfae5, 58ba678, 47c7833, 5076d8c, 2dea441, 64d37a2, a78c543, 864a14b, b03fe83, 4a94565, f4ed2c2 and summercms.go d6f490a exist.
- `git -C ../sm-demo-app submodule status` shows no `+` or `-`, and the sm-demo-app working tree is clean (`--ignore-submodules=none`).

View File

@@ -0,0 +1,298 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 03
subsystem: vue-chat-layer, vue-demo-app
tags: [chat, nuxt-layer, realtime, centrifuge, i18n, slash-commands, threads, pins]
requires:
- phase: 20-02
provides: "Host bootstrap GET /_demo/api/v1/chat and /chat/members, the chat family mounted, realtime for every member"
provides:
- "vue-chat-layer v0.1.0 on git.golem15.com (public), tag v0.1.0 = c465414"
- "The page's one Centrifuge client with onUserEvent, shared by the chat and the presentations remote"
- "vue-demo-app /chat, the floating chat panel, the Chat tour card, EN/PL"
- "check-local chat (check-chat.cjs), tour with seven cards, smoke.sh /chat"
affects: [20-04, 20-05, 20-06]
actuals:
tokens: 80100 # chars/4: layer tracked files without the lockfile (279087) + vue-demo-app diff 44a5229..3fe8018 without the lockfile (30546) + sm-demo-app scripts diff f4ed2c2..b4fc7dc (10832)
tasks: 6
commits: 0 # MEASURED in summercms.go before this SUMMARY commit (docs only here); code commits: vue-chat-layer 4, vue-demo-app 4, sm-demo-app 2
plan_head_before: baa0f20eb2cd316cb3424fe6b4fd957d079713c0 # summercms.go
plan_head_after: baa0f20eb2cd316cb3424fe6b4fd957d079713c0 # summercms.go before this SUMMARY commit
tech-stack:
added:
- "vue-chat-layer (new shared Nuxt layer) with centrifuge 5.7.3 and @nuxtjs/i18n 10.4.0; vitest 3.2.7, nuxt 4.4.8, vue 3.5.35, typescript 5.9.3 as dev deps (all versions already pinned in the workspace)"
patterns:
- "Store as a composable over useState keys prefixed chat:, one reactive store per Nuxt app (no Pinia)"
- "Auth hook $chatAuth {token, refresh, unauthorized, userId?}; pure Nuxt-free client in app/lib, imported explicitly"
- "One realtime client per page; other layers get user:{me} events through onUserEvent"
key-files:
created:
- ../vue-chat-layer/nuxt.config.ts
- ../vue-chat-layer/README.md
- ../vue-chat-layer/app/lib/client.ts
- ../vue-chat-layer/app/lib/realtime.ts
- ../vue-chat-layer/app/lib/linkEmbeds.ts
- ../vue-chat-layer/app/composables/useChat.ts
- ../vue-chat-layer/app/components/Chat/FloatingPanel.vue
- ../vue-chat-layer/app/components/Chat/CommandPicker.vue
- ../vue-chat-layer/app/components/Chat/ThreadPane.vue
- ../vue-chat-layer/app/assets/css/chat-tokens.css
- ../vue-chat-layer/tests/smoke.test.ts
- ../sm-demo-app/vue-demo-app/app/pages/chat.vue
- ../sm-demo-app/scripts/check-chat.cjs
modified:
- ../sm-demo-app/vue-demo-app/package.json
- ../sm-demo-app/vue-demo-app/pnpm-lock.yaml
- ../sm-demo-app/vue-demo-app/nuxt.config.ts
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/lib/realtime.ts
- ../sm-demo-app/vue-demo-app/app/lib/realtime.test.ts
- ../sm-demo-app/vue-demo-app/vitest.config.ts
- ../sm-demo-app/vue-demo-app/app/layouts/default.vue
- ../sm-demo-app/vue-demo-app/app/pages/index.vue
- ../sm-demo-app/vue-demo-app/app/components/TourCard.vue
- ../sm-demo-app/vue-demo-app/i18n/locales/en.json
- ../sm-demo-app/vue-demo-app/i18n/locales/pl.json
- ../sm-demo-app/scripts/check-local.sh
- ../sm-demo-app/scripts/smoke.sh
key-decisions:
- "Task 5 checkpoint answer: release. golem15/vue-chat-layer created public with tea (same visibility as vue-faq-layer), main pushed, annotated tag v0.1.0 on c465414"
- "The layer reads the caller's user id from the JWT's numeric sub claim; an optional $chatAuth.userId() overrides it"
- "vue-demo-app chatAuth.refresh posts to POST /_user/api/v1/refresh and stores the rotated token through lib/api/client.ts tokens (document.cookie)"
- "Ported libs keep bm's signatures with optional localized copy and setFormatLocale (defaults pl-PL / Europe/Warsaw), so bm's tests port unchanged in plan 06"
- "Slash command answers render through renderChatText, the only v-html besides message bodies"
patterns-established:
- "A layer's realtime client is re-exported by the app (export * from 'vue-chat-layer/app/lib/realtime'); vitest inlines the layer and dedupes centrifuge"
requirements-completed: [SC-2, D-01, D-02, D-03, D-04, D-05, D-07, D-20, D-22, D-23]
coverage:
- id: D1
description: "A logged-in visitor opens #general on /chat and a message sent from the composer appears; anonymous /chat has the register link to /register?next=/chat and no chat"
requirement: "D-02, D-04"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-chat.cjs (check-local.sh chat)"
status: pass
- kind: smoke
ref: "../sm-demo-app/scripts/smoke.sh (/chat in the page loop, register prompt, no chat in the HTML)"
status: pass
human_judgment: false
- id: D2
description: "The chat client sends the bearer, refreshes once on 401, calls unauthorized after a failed refresh, maps 422 to field errors"
requirement: "D-01"
verification:
- kind: unit
ref: "../vue-chat-layer/tests/smoke.test.ts"
status: pass
human_judgment: false
- id: D3
description: "One shared Centrifuge client: the presentations remote and the chat ride one socket; bm's realtime test passes against it"
requirement: "SC-2"
verification:
- kind: unit
ref: "../sm-demo-app/vue-demo-app/app/lib/realtime.test.ts"
status: pass
- kind: e2e
ref: "check-local.sh realtime remote"
status: pass
human_judgment: false
- id: D4
description: "Live delivery, /demo command (ephemeral, nothing posted), unknown command row, link card, reaction, thread reply and live thread reply, pins, attachment upload and send, DM from the picker, edit, delete, PL UI, floating panel badge and DM reply, panel hidden on /chat and decks"
requirement: "SC-2, D-02, D-03, D-05"
verification:
- kind: manual
ref: "Playwright probes against the local stack with two members (scratchpad live.cjs, features.cjs, floating.cjs)"
status: pass
human_judgment: true
- id: D5
description: "Tour has seven cards with Chat (EN) and Czat (PL); vue-demo-app builds and tests against the tag"
requirement: "D-03, D-01"
verification:
- kind: e2e
ref: "check-local.sh chat tour after the tag pin"
status: pass
- kind: build
ref: "pnpm --dir ../sm-demo-app/vue-demo-app test (209) && run build"
status: pass
human_judgment: false
duration: 52min
completed: 2026-10-31
status: complete
---
# Phase 20 Plan 03: vue-chat-layer v0.1.0 and chat on the demo site Summary
**vue-chat-layer v0.1.0 is released on git.golem15.com. It carries bm's chat ported to a Pinia-free Nuxt layer and widened to several channels, threads, pins, link cards and a slash command picker. The demo site now has /chat for members, a register prompt for visitors, a floating DM panel on every page and a Chat tour card, in EN and PL.**
## Performance
- **Duration:** about 52 min
- **Started:** 2026-10-31T12:27Z
- **Completed:** 2026-10-31T13:19Z
- **Tasks:** 6/6. Task 5 was the checkpoint, answered "release".
- **Files:** vue-chat-layer has 52 tracked files without the lockfile. vue-demo-app has 13 files changed (436 insertions, 147 deletions). sm-demo-app scripts have 3 files changed.
## The layer's public API (v0.1.0)
**Runtime config:**
| Key | Env | Purpose |
|-----|-----|---------|
| `chat.apiBase` | `NUXT_CHAT_API_BASE` | Server-side base of the chat API |
| `public.chat.apiBase` | | `/_chat/api/v1` |
| `public.chat.channelsApiBase` | | `/_chatchannels/api/v1` |
| `public.chat.botsApiBase` | | `/_chatbots/api/v1` |
| `public.chat.hostApiBase` | | `''`. With an empty value the chat does not start, and a console error names the key |
**Hook:** `$chatAuth` with `token()`, `refresh()`, `unauthorized()` and an optional `userId()`.
**Host contract:** `GET {hostApiBase}/chat` and `GET {hostApiBase}/chat/members`. The README documents both with a neutral `acme` host.
**Slots:**
- `conversation-actions`, with `{ conversation }`. It renders only for a DM, in `ChatHeader`, `ChatPanel`, `ChatPage` and `ChatFloatingPanel`.
- `sidebar-footer`, in `ChatChannelList` and `ChatPage`.
**Components:** `ChatPage`, `ChatFloatingPanel` (prop `chatPath`), `ChatChannelList`, `ChatDmList`, `ChatPanel`, `ChatHeader`, `ChatMessageList`, `ChatMessage`, `ChatComposer`, `ChatThreadPane`, `ChatPinsPanel`, `ChatReactionBar`, `ChatStagingChips`, `ChatDeleteDialog`, `ChatMemberPicker`, `ChatMentionPopup`, `ChatCommandPicker`, `ChatLinkEmbed`, `ChatAvatar`, `ChatIcon` and `ChatNotices`.
**Composables:** `useChat`, `useChatApi` (with `useChatAuth` and `useChatConfig`) and `useChatNotice`.
**Library exports:**
- `client.ts`: `createChatClient`, `ChatApiError`, `userIdFromToken`.
- `realtime.ts`: `REALTIME_WS_PATH`, `connect`, `subscribe`, `presence`, `openChannel`, `onUserEvent`, `dispatchUserEvent`, `setRealtimeAuth`, `disconnect`, `onConnection`, `onUnavailable`.
- `linkEmbeds.ts`: `linkify`, `messageUrls`, `registerEmbedRenderer`, `embedRendererFor`.
- The ported `chatEvents`, `chatFormat`, `chatText` and `chatUnread`, plus `format` (`setFormatLocale`), `attachments`, `markdown`, `media` and `tabs`.
**Copy:** EN and PL under `chat.*`, 131 keys. PL covers every EN key.
## What was stripped from bm and why
- **bm's embeds and the embed picker were dropped** (`deadline`, `class` and `reading`, plus `EmbedPicker`, `EmbedCard`, `lib/embeds.ts` and the paste-to-embed logic). They are bm entities. In their place:
- A generic link card shows the host and path, with no fetch.
- `registerEmbedRenderer` lets a host render its own entity links (the D-01 extension point).
- **The single `# ogólny` model became `channels[]`, `activeId` and `kind`.** bm's "Czat roku" tab layout became a sidebar plus pane. Threads, pins and the command picker are new.
- **The Pinia stores went away.** `useChat` became `useState` and `useToast` became `useChatNotice`.
- **The bm cached membership flag in localStorage and its BM bootstrap paths were removed.** Every string went to i18n.
## Task Commits
| # | Repo | Commit | Message |
|---|------|--------|---------|
| 1 | vue-chat-layer | fa6f995 | feat: chat layer tracer: bootstrap, channel list, messages, composer |
| 1 | vue-demo-app | 5b7648f | feat: /chat page on vue-chat-layer |
| 1 | sm-demo-app | b6ece43 | test: check-chat browser check |
| 2 | vue-chat-layer | 5d58153 | feat: port the chat store, realtime client and components |
| 2 | vue-demo-app | ae3dbfc | refactor: share the chat layer's realtime client |
| 3 | vue-chat-layer | 269c75b | feat: threads, pins, reactions, attachments, link embeds and the command picker |
| 4 | vue-chat-layer | c465414 | feat: floating chat panel |
| 4 | vue-demo-app | 8636aa3 | feat: floating chat panel, Chat tour card |
| 4 | sm-demo-app | b4fc7dc | test: tour expects the Chat card, smoke covers /chat |
| 6 | vue-chat-layer | tag v0.1.0 (1e6a907, peels to c465414) | vue-chat-layer v0.1.0 |
| 6 | vue-demo-app | 3fe8018 | feat: pin vue-chat-layer v0.1.0 |
**Pushed:** only vue-chat-layer `main` and the tag `v0.1.0`. They went to the new public repository `git@git.golem15.com:golem15/vue-chat-layer.git`, created with `tea repo create`. `git ls-remote origin 'refs/tags/v0.1.0^{}'` equals HEAD c465414.
**Not pushed:** vue-demo-app and sm-demo-app (plan 05). sm-demo-app shows the moved `vue-demo-app` submodule pointer as uncommitted; plan 05 bumps it.
## Checkpoint answer
Task 5: **release**. The user gave the go-ahead to create the repository, push main and tag v0.1.0.
## Verification
- **Layer:** `pnpm test` passes 6/6, and `pnpm build:playground` builds.
- **vue-demo-app:** `pnpm test` passes 209/209 and `pnpm run build` builds, both against the link pin and against the tag.
- **check-local.sh:** these runs all printed ok.
- `chat` (Task 1)
- `chat realtime remote` (Task 2)
- `chat` (Task 3)
- `tour chat realtime remote` (Task 4)
- `chat tour` after the tag pin (Task 6)
- **smoke.sh:** `smoke: ok` with /chat included.
- **Manual (Task 3 criterion):** `/demo` typed in the #general composer opened the picker, and Enter showed the ephemeral answer. The channel had 18 messages before and 18 after, so nothing was posted.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 2 - Missing critical] The caller's user id**
- **Found during:** Task 2.
- **Issue:** The demo bootstrap and `/chat/members` do not include the caller. The store needs the id for `user:{me}` and for telling its own messages apart.
- **Fix:** `userIdFromToken` reads the JWT's numeric `sub` claim. An optional `$chatAuth.userId()` overrides it. Documented in the README. Commit 5d58153.
**2. Refresh endpoint**
- useDemoAuth has no refresh.
- `chatAuth.refresh` calls `POST /_user/api/v1/refresh` with the bearer token. The user plugin answers the rotated token in the body.
- The token is stored through `lib/api/client.ts` `tokens` (`document.cookie`), because the hook runs outside a component's setup, where `useCookie` fails. Commits 5b7648f and ae3dbfc.
**3. [Rule 3 - Blocking] Realtime test and vitest config**
- vue-demo-app's `app/lib/realtime.test.ts` is now bm's current realtime test against the shared client. Two adjustments go beyond import paths:
- The token route is a stubbed `fetch` instead of a mocked `@/api/client`, because the layer fetches the token itself.
- The 503 case asserts `{status: 503}`, since the error is now `RealtimeTokenError`.
- `vitest.config.ts` (outside Task 2's file list) got `resolve.dedupe: ['centrifuge']` and `test.server.deps.inline: ['vue-chat-layer']`. With these the mock applies, and the tag-installed layer's TypeScript is transformed. Commit ae3dbfc.
**4. Extra layer files and the shape of the ported libs**
- Two files are outside the plan's list:
- `app/lib/markdown.ts`: `escapeHtml`, `safeUrl` and `formatSpans`, for chatText.
- `app/lib/attachments.ts`: `checkFiles`.
- The ported libs keep bm's signatures, with optional localized copy. `setFormatLocale` configures the format locale; its defaults stay pl-PL and Europe/Warsaw, so bm's tests port unchanged in plan 06. The components set the app's locale and the browser's time zone.
- `chatEvents` adds an optional `rootId` to created events, so replies stay out of the main list.
**5. Ephemeral answers**
- Slash command answers render through `renderChatText`. This keeps the prohibition: `v-html` is used only for the escaped renderer output.
- `linkify` is exported but not used by the components.
**6. Naming and copy**
- The app's `chat.*` keys (`eyebrow`, `title`, `lead`, `slashHint`, `anonymous`, `registerToChat`) avoid the layer's `chat.*` tree. The layer's own title key is `chat.name`.
- `{'@'}` escapes @ in the app copy, because a bare @ is vue-i18n link syntax.
- /chat also has a Log in link next to the register link.
**7. Dev-stack note**
- Running `nuxt build` while `nuxt dev` is up makes the dev server loop on "Another Nuxt dev is already running".
- The stack was restarted with `dev.sh down` and `dev.sh up` after each build.
**8. Pins**
- The visitor was allowed to pin in #general, and the pin succeeded.
- The refused-pin path (a notice, then the action hidden for the session) is in the code but was not exercised.
**Total deviations:** 8. **Impact:** none on the plan goal.
## Known Stubs
None. Link cards are generic by design (D-01; there is no unfurl backend).
## Issues Encountered
- **vue-tsc on the playground** (run with summercms.go/admin's vue-tsc, not a gate) reports only `noUncheckedIndexedAccess` errors (the "possibly undefined" kind). They are mostly in the modules ported from bm and come from the source. Builds don't typecheck.
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: supply-chain | ../sm-demo-app/vue-demo-app/package.json | New git dependency vue-chat-layer pinned by tag v0.1.0 (commit c465414 in the lockfile), as planned in T-20-18 |
## Next Phase Readiness
- **Plan 04** (vue-chatvideo-layer) can extend `vue-chat-layer#v0.1.0`:
- Call button: put it in the `conversation-actions` slot, which renders for DMs only.
- `video:*` events: listen through `onUserEvent`.
- Session channels: subscribe through the shared `subscribe`.
- **Plan 05** needs to know:
- vue-demo-app is ready to push. Its `package.json` and lockfile pin the tag, with no local path.
- The sm-demo-app submodule pointer bump is still to do.
## Self-Check: PASSED
- The listed files exist in their repos: vue-chat-layer, vue-demo-app and sm-demo-app scripts.
- Commits exist:
- vue-chat-layer: fa6f995, 5d58153, 269c75b, c465414.
- vue-demo-app: 5b7648f, ae3dbfc, 8636aa3, 3fe8018.
- sm-demo-app: b6ece43, b4fc7dc.
- The remote tag v0.1.0 peels to c465414.

View File

@@ -0,0 +1,303 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 04
subsystem: vue-forum-layer, vue-userfriends-layer, vue-chatvideo-layer, vue-demo-app, sm-demo-app
tags: [forum, friends, video-calls, livekit, nuxt-layer, herald, vapid, tour, i18n]
requires:
- phase: 20-02
provides: "Chat family mounted in sm-demo-app, seeded forum and friends, local LiveKit, Centrifugo namespaces chat/user/video, GET /_demo/api/v1/chat/members"
- phase: 20-03
provides: "vue-chat-layer v0.1.0: conversation-actions (DM only) and sidebar-footer slots, onUserEvent and subscribe on the page's one realtime client, $chatAuth"
provides:
- "vue-forum-layer v0.1.0 on git.golem15.com (public), tag v0.1.0 = dcd6549"
- "vue-userfriends-layer v0.1.0 on git.golem15.com (public), tag v0.1.0 = bcc8e99"
- "vue-chatvideo-layer v0.1.0 on git.golem15.com (public), tag v0.1.0 = 75e9a40, livekit-client 2.23.0 exact"
- "vue-demo-app /forum, /forum/t/{id}, /friends, /call/{conversation}, the DM call button, the incoming-call prompt, ten tour cards, all three layers pinned by tag"
- "sm-demo-app check-local forum, friends, call, herald; tour expects ten cards; smoke.sh covers /forum and /friends; dev.sh writes herald's VAPID keys into .env"
- "Phase COVERAGE.md (livekit-client, LiveKit server, Centrifugo, Web Push)"
affects: [20-05, 20-06]
actuals:
tokens: 56900 # chars/4: the three layers' tracked files without lockfiles (56107 + 54654 + 63266) + vue-demo-app diff 3fe8018..9357711 without the lockfile (28917) + sm-demo-app diff b4fc7dc..fc23b4c in scripts, README and deploy (19375) + COVERAGE.md (5418) = 227737 chars
tasks: 7
commits: 1 # MEASURED in summercms.go: git rev-list --count b40c519..0301dc2 (COVERAGE.md) before this SUMMARY commit; code commits: vue-forum-layer 1, vue-userfriends-layer 1, vue-chatvideo-layer 1, vue-demo-app 5, sm-demo-app 4
plan_head_before: b40c519 # summercms.go
plan_head_after: 0301dc2ae48607c69847b3300ec844f80cad25d3 # summercms.go before this SUMMARY commit
tech-stack:
added:
- "livekit-client 2.23.0 (exact, vue-chatvideo-layer dependency; approved at the Task 3 checkpoint)"
- "vue-forum-layer, vue-userfriends-layer, vue-chatvideo-layer (new shared Nuxt layers); every other package is an existing workspace pin (@nuxtjs/i18n 10.4.0, nuxt 4.4.8, vue 3.5.35, typescript 5.9.3, vitest 3.2.7)"
patterns:
- "Layer clients in app/utils carry a layer prefix on every export (forumError, friendTarget), because Nuxt auto-imports app/utils into the app"
- "A companion layer (vue-chatvideo-layer) takes vue-chat-layer as a peer dependency, does not extend it, and dedupes it in Vite so the realtime module stays one instance"
- "Token getter hooks per layer ($forumAuth, $userfriendsAuth), optional data hook ($userfriendsDirectory), $chatAuth reused by the companion layer"
key-files:
created:
- ../vue-forum-layer/app/utils/forumClient.ts
- ../vue-forum-layer/app/components/Forum/Thread.vue
- ../vue-forum-layer/README.md
- ../vue-userfriends-layer/app/utils/friendsClient.ts
- ../vue-userfriends-layer/app/components/Friends/Groups.vue
- ../vue-userfriends-layer/README.md
- ../vue-chatvideo-layer/app/lib/callMachine.ts
- ../vue-chatvideo-layer/app/lib/videoClient.ts
- ../vue-chatvideo-layer/app/composables/useCall.ts
- ../vue-chatvideo-layer/app/composables/useIncomingCalls.ts
- ../vue-chatvideo-layer/README.md
- ../sm-demo-app/vue-demo-app/app/pages/forum/index.vue
- ../sm-demo-app/vue-demo-app/app/pages/forum/t/[id].vue
- ../sm-demo-app/vue-demo-app/app/pages/friends.vue
- ../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue
- .planning/phases/20-demo-instance-with-every-shared-plugin/COVERAGE.md
modified:
- ../sm-demo-app/vue-demo-app/package.json
- ../sm-demo-app/vue-demo-app/pnpm-lock.yaml
- ../sm-demo-app/vue-demo-app/nuxt.config.ts
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/pages/chat.vue
- ../sm-demo-app/vue-demo-app/app/pages/index.vue
- ../sm-demo-app/vue-demo-app/app/pages/account/security.vue
- ../sm-demo-app/vue-demo-app/app/layouts/default.vue
- ../sm-demo-app/vue-demo-app/app/components/SiteHeader.vue
- ../sm-demo-app/vue-demo-app/app/components/TourCard.vue
- ../sm-demo-app/vue-demo-app/i18n/locales/en.json
- ../sm-demo-app/vue-demo-app/i18n/locales/pl.json
- ../sm-demo-app/scripts/check-local.sh
- ../sm-demo-app/scripts/smoke.sh
- ../sm-demo-app/scripts/dev.sh
- ../sm-demo-app/deploy/env.example
- ../sm-demo-app/README.md
key-decisions:
- "Task 3 checkpoint: the user approved livekit-client 2.23.0 (repository github.com/livekit/client-sdk-js, npm maintainer thedavidzhao, no install or postinstall hooks, npm provenance attestations, published 2026-10-16, 15 days old; compatibility with LiveKit server 1.13.1 not checked separately, the local 1.13.1 calls work)"
- "Task 6 checkpoint: release. The subagent's tea repo create was refused by the permission system; the orchestrator, after the user's go-ahead in manual mode, created the three repositories public, pushed main and the annotated tags v0.1.0 (remote tags equal HEAD)"
- "Decline posts video/leave: no chatvideo path publishes video:call:declined; the caller shows a did-not-answer note for a participant who left without joining"
- "The last one out ends the call (video/end instead of video/leave), so the next start rings again"
- "The call button's start answer is handed to the call page in memory (one start per call, no token in the URL)"
- "Forum manage rights come from the host: ForumThread canManage, filled by the demo from the chat bootstrap's moderator flag"
patterns-established:
- "check-local throwaway_user prints e-mail and JWT; LiveKit join tokens are validated with GET /rtc/validate, the token passed to curl through a config on stdin"
requirements-completed: [SC-2, D-11, D-12, D-13, D-14, D-15, D-16, D-20, D-21, D-22, D-23]
coverage:
- id: D1
description: "Members read the seeded EN/PL forum, create threads, reply, preview, edit and delete own posts; anonymous /forum has the register link to /register?next=/forum and no forum"
requirement: "D-14, D-21, D-22"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-local.sh forum"
status: pass
- kind: unit
ref: "../vue-forum-layer/tests/client.test.ts"
status: pass
- kind: manual
ref: "Playwright probe (scratchpad forum.cjs): categories, thread, preview, reply, edit, delete, new thread, no console error"
status: pass
human_judgment: true
- id: D2
description: "Friends, requests (accept, reject, cancel), unfriend, groups (create, invite code, join by code, leave); /friends linked from the chat sidebar, the header and /account/security"
requirement: "D-15"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-local.sh friends"
status: pass
- kind: unit
ref: "../vue-userfriends-layer/tests/client.test.ts"
status: pass
- kind: manual
ref: "Playwright probe (scratchpad friends.cjs) with two throwaway members"
status: pass
human_judgment: true
- id: D3
description: "DM-only call button; start, LiveKit token accepted, end; two members in a call with remote video, mute and camera off seen remotely, decline note, prompt cleared when the caller hangs up, server end ends the page's call"
requirement: "D-11, D-12, D-13, D-23"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-local.sh call"
status: pass
- kind: unit
ref: "../vue-chatvideo-layer/tests/callMachine.test.ts"
status: pass
- kind: manual
ref: "Playwright probe (scratchpad call.cjs) with fake media, against the link pins"
status: pass
human_judgment: true
- id: D4
description: "Herald VAPID keys in .env without printing them; public-key route 401 without and 200 with a JWT; no /_herald in goPaths"
requirement: "D-16"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-local.sh herald"
status: pass
human_judgment: false
- id: D5
description: "Ten tour cards in EN and PL; vue-demo-app tests and build against the three tags"
requirement: "D-03, D-20"
verification:
- kind: e2e
ref: "check-local.sh tour; forum friends call chat tour after the tag pin"
status: pass
- kind: build
ref: "pnpm --dir ../sm-demo-app/vue-demo-app test (209) && run build"
status: pass
human_judgment: false
duration: about 2 h of work (14:13 to 15:15 for Tasks 1 to 5, then the release checkpoint and Task 7 until 20:03)
completed: 2026-10-31
status: complete
---
# Phase 20 Plan 04: forum, friends and video-call layers v0.1.0 on the demo site Summary
**Three new shared layers are released at v0.1.0: vue-forum-layer (categories, threads, Markdown posts from the server's content_html), vue-userfriends-layer (friends, requests, groups with invite codes) and vue-chatvideo-layer (DM calls on livekit-client 2.23.0, loaded on demand). The demo site has /forum, /friends, /call/{conversation}, a call button in DM headers, an incoming-call prompt on every page, ten tour cards, and herald runs with VAPID keys and no UI.**
## Performance
- **Tasks:** 7/7. Task 3 (package legitimacy) and Task 6 (release go-ahead) were checkpoints answered by the user.
- **Files:** vue-forum-layer 22, vue-userfriends-layer 22 and vue-chatvideo-layer 22 tracked files; vue-demo-app 5 commits; sm-demo-app 4 commits.
## The layers' public API (v0.1.0)
**vue-forum-layer**
- Runtime config: `forum.apiBase` (`NUXT_FORUM_API_BASE`), `public.forum.apiBase` (`/_forum/api/v1`).
- Hook: `$forumAuth` (token getter).
- Components: `ForumPage` (contextType, contextId, threadPath), `ForumThread` (contextType, contextId, threadId, canManage, backPath), `ForumCategoryList`, `ForumThreadList`, `ForumPostEditor` (submit, preview, withTitle, …).
- Composables: `useForum`, `useForumApi`, `useForumAuth`. Client: `createForumClient`, `ForumApiError`, `forumContextPath`, `forumError`.
- Copy: `forum.*` EN and PL.
**vue-userfriends-layer**
- Runtime config: `userfriends.apiBase`, `public.userfriends.apiBase` (`/_userfriends/api/v1`).
- Hooks: `$userfriendsAuth` (token getter), optional `$userfriendsDirectory(): Promise<{id, name}[]>`.
- Components: `FriendsPage`, `FriendsList`, `FriendsRequests`, `FriendsAddFriend`, `FriendsGroups`.
- Composables: `useFriends` (useState keys `userfriends:*`), `useFriendsApi`, `useFriendsAuth`, `useFriendsDirectory`. Client: `createFriendsClient`, `FriendsApiError`, `friendTarget`, `friendsError`.
- Copy: `friends.*` EN and PL.
**vue-chatvideo-layer**
- Peer dependency `vue-chat-layer ^0.1.0` (not extended; the app extends both, chat first). Dependency `livekit-client` 2.23.0 exact.
- Runtime config: `public.chatvideo.apiBase` (`/_chatvideo/api/v1`). Auth: vue-chat-layer's `$chatAuth`.
- Components: `ChatvideoCallButton` (conversationId, callPath), `ChatvideoCall` (conversationId, start, backPath), `ChatvideoTile`, `ChatvideoIncomingCall` (callPath).
- Composables: `useCall`, `useVideoClient`, `useIncomingCalls` (`RING_MS` 45 s).
- Lib: `callMachine` (`initialCallState`, `transition`, `isLive`, `failureReason`), `videoClient` (`createVideoClient`, `VideoApiError`, `videoSessionChannel`, `videoPath`, `videoEvent`, `parseIncomingCall`, `rememberStart`, `takeStart`).
- Copy: `chatvideo.*` EN and PL, reason keys `chatvideo.reason.*`.
## Task Commits
| # | Repo | Commit | Message |
|---|------|--------|---------|
| 1 | vue-forum-layer | dcd6549 | feat: forum layer: categories, threads and Markdown posts |
| 1 | vue-demo-app | 2473517 | feat: /forum and /forum/t/{id} on vue-forum-layer |
| 1 | sm-demo-app | c4a9cfc | test: check-local forum, smoke covers /forum |
| 2 | vue-userfriends-layer | bcc8e99 | feat: friends layer: friends, requests and friend groups |
| 2 | vue-demo-app | 4edc81f | feat: /friends on vue-userfriends-layer, linked from the chat and the account |
| 2 | sm-demo-app | c2208e9 | test: check-local friends, smoke covers /friends |
| 3 | — | — | checkpoint: approved livekit-client 2.23.0 |
| 4 | vue-chatvideo-layer | 75e9a40 | feat: video-call layer: DM calls on LiveKit |
| 4 | vue-demo-app | 1db4394 | feat: DM video calls on vue-chatvideo-layer |
| 4 | sm-demo-app | c669717 | test: check-local call (DM start, LiveKit token validation, end) |
| 4 | summercms.go | 0301dc2 | docs(20-04): API coverage of livekit-client, LiveKit, Centrifugo and Web Push |
| 5 | sm-demo-app | fc23b4c | feat: herald VAPID keys without UI, check-local herald and the ten-card tour |
| 5 | vue-demo-app | cc8d330 | feat: Forum, Friends and Calls tour cards |
| 6 | — | — | checkpoint: release |
| 7 | vue-forum-layer, vue-userfriends-layer, vue-chatvideo-layer | tags v0.1.0 | created, pushed and tagged by the orchestrator (below) |
| 7 | vue-demo-app | 9357711 | feat: pin the forum, friends and video-call layers v0.1.0 |
**Release (Task 7).** The subagent's `tea repo create` was refused by the permission system ("Create Public Surface"), so nothing was created from the subagent. After the user's go-ahead (in manual permission mode), the orchestrator created `golem15/vue-forum-layer`, `golem15/vue-userfriends-layer` and `golem15/vue-chatvideo-layer` public (vue-faq-layer's visibility), pushed `main` and the annotated tags `v0.1.0`. `ls-remote 'refs/tags/v0.1.0^{}'` equals HEAD for each: dcd6549, bcc8e99, 75e9a40. The subagent then pinned the tags in vue-demo-app.
**Not pushed:** vue-demo-app and sm-demo-app (plan 05). sm-demo-app shows the moved `vue-demo-app` submodule pointer as uncommitted.
## Checkpoint answers
- **Task 3:** approved livekit-client 2.23.0. Facts checked by the orchestrator: repository github.com/livekit/client-sdk-js, npm maintainer thedavidzhao, no install or postinstall hooks, npm provenance attestations, published 2026-10-16 (15 days old). Compatibility with LiveKit server 1.13.1 was not checked from the release notes; calls on the local 1.13.1 work. Installed with `--save-exact`; lockfile integrity `sha512-j9Kg86nJ…`.
- **Task 6:** release.
## Verification
- **Layers:** forum `pnpm test` 7/7, friends 6/6, chatvideo vitest 10/10; `pnpm build:playground` builds for all three.
- **vue-demo-app:** `pnpm test` 209/209 and `pnpm run build` after every task and against the tags.
- **check-local.sh:** `forum` (Task 1), `friends forum chat` (Task 2), `call chat` (Task 4), `herald tour` (Task 5), `forum friends call chat tour herald` and `back remote realtime quizzes journal` (before the release), `forum friends call chat tour` against the tags (Task 7): all ok.
- **smoke.sh:** `smoke: ok`, with /forum and /friends in the page loop and their anonymous prompts.
- **Browser probes** (Playwright, throwaway members, fake media, against the link pins): the forum, friends and call flows listed in the coverage block passed with no console error. Against the tags, the call probe's ring step failed five times in a row because the stale servers took every incoming-call broadcast (environment notes); the tagged install itself resolves one vue-chat-layer copy (one entry in `node_modules/.pnpm`) and passes check-local call and chat.
- **Task 5 manual check:** `dev.sh up` printed only "added the herald VAPID keys to .env"; no line of the output holds a key value. A second `dev.sh seed` added nothing. The plan's `grep .env` was blocked by the secret-read hook; `check-local herald` (200 with a non-empty publicKey) shows the key is loaded.
- **Acceptance greps:** all print the expected values (no consuming-app names in the layers, v-html only on content_html, one `import('livekit-client')`, no static runtime import, every `subscribe(` line uses `videoSessionChannel`, exact livekit pin, one `conversation-actions`, one `sidebar-footer`, one `to="/friends"` in SiteHeader, no `'/_herald'`, three tour keys, `HERALD__VAPID__PRIVATE_KEY=` once and empty, no OPT-OUT row without a reason, no link pins left).
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Decline has no declined event on the server**
- **Found during:** Task 4 (read video_service.go as the plan asked).
- **Issue:** `Notifier.Declined` exists, but no VideoService path calls it; `Leave` publishes `video:participant:left`. No endpoint publishes `video:call:declined`.
- **Fix:** Decline posts `video/leave`. The caller's page treats `video:participant:left` (and `video:call:declined`, should it ever come) for a participant who never connected as a decline and shows "did not answer". The shared plugin is unchanged (follow-up below).
- **Commit:** 75e9a40.
**2. [Rule 1 - Bug] A left-open session never rings again**
- **Found during:** Task 4.
- **Issue:** `start` answers the live session without a new `video:call:incoming` when one exists. If both members only posted `leave`, the session stayed open until the reconcile job, and the next call from the DM would not ring.
- **Fix:** Leave posts `video/end` when nobody else is in the room (the last one out ends the call), else `video/leave`. Both use `keepalive` so pagehide still sends them.
- **Commit:** 75e9a40.
**3. [Rule 2 - Missing critical] One start per call**
- **Issue:** The plan has both the button and the call page start the call; `video-initiate` allows 5 starts a minute.
- **Fix:** The button keeps its start answer in memory for 60 s (`rememberStart`), and the page takes it once (`takeStart`) before starting itself. The join token never goes into a URL.
- **Commit:** 75e9a40.
**4. Forum manage rights from the host**
- The forum API does not report manage rights. `ForumThread` takes `canManage`; the demo thread page fills it from `GET /_demo/api/v1/chat`'s `moderator` flag (the same group the forum policy checks). A refused action hides itself for the session.
- **Commit:** dcd6549, 2473517.
**5. [Rule 3 - Blocking] Auto-import collisions**
- Nuxt auto-imports `app/utils` into the app, so the layers' generic helper names would collide. Exports carry the layer's prefix: `forumError`, `forumContextPath`, `friendsError`, `friendTarget`.
- **Commit:** dcd6549, bcc8e99.
**6. [Rule 3 - Blocking] One vue-chat-layer copy**
- With the development `link:` pin, the linked checkout's own `node_modules/vue-chat-layer` (its dev dependency) would be a second realtime module that never hears the chat's events. vue-chatvideo-layer's nuxt.config sets `vite.resolve.dedupe: ['vue-chat-layer']`. With the link pin the incoming-call prompt works; with the tag install pnpm resolves the peer to the app's copy.
- **Commit:** 75e9a40.
**7. Smaller additions**
- check-local.sh: `throwaway_user` (e-mail and JWT) with `throwaway_jwt` on top of it; `check_call` reads Ada's id from `/chat/members`.
- smoke.sh: the anonymous prompts of /forum and /friends are checked, not only the page loop.
- `ensure_vapid` runs at the end of `seed()`, so `up` and `seed` both cover it.
- The add-friend picker hides current friends and people with a pending request.
- App copy lives under `forum.*`, `friends.*` and `call.*` next to the layers' trees (distinct keys), plus `header.friends`, `chat.friendsLink` and `security.friendsLink`.
- The plan's draft progress SUMMARY after Task 4 was skipped on the orchestrator's instruction; this SUMMARY is the only one.
**Total deviations:** 7. **Impact:** none on the plan goal; 1 and 2 make the call flow work with the plugin as it is.
## Follow-ups
- **sm-chatvideo-plugin:** `Notifier.Declined` is never called. A decline route (or `Leave` publishing `video:call:declined` for a participant still in status invited) would let the layer drop its participant-left inference. Not needed for this phase.
- **Herald:** the boot warning "PresenceGate is deny-all; the host must SetPresenceGate" remains; it matters only once push is sent (D-16 defers the subscribe UI).
## Environment notes
- **Stale demo servers share the local database.** `./bin/demo serve` pid 684528 (user jin, 127.0.0.1:8099, since Oct 22, in sm-demo-app) and pid 2918923 (user golem, 0.0.0.0:8096, since Oct 20) run River workers on `127.0.0.1:55540/summercms_demo` and take `summer.broadcast` jobs. Since the release, the current server ran 7 of about 50 broadcasts; the stale ones ran the rest, and their pushes do not reach the current Centrifugo clients. A Node test without a browser received 4 of 6 incoming-call pushes earlier; later the browser ring step failed 5 runs in a row. They were left running (not approved to stop). Stop them before plan 06's browser tests.
- **Headless Chrome** sometimes hits `ERR_NETWORK_CHANGED` (the host's network interfaces change, likely docker), which breaks page loads in probes.
- **Vite dev re-optimization:** the first `check-local chat` after adding a layer got a 504 "Outdated Optimize Dep" and passed on the rerun (dev server only).
- **Local secrets in a tool log:** while diagnosing, the Centrifugo `PROXY_SECRET`, `TOKEN_SECRET` and `API_KEY` from pid 684528's environment were printed into the session's tool output. They are local development values and were never committed; removing the `SUMMER_REALTIME__CENTRIFUGO__*` lines from `.env` and running `dev.sh up` rotates them.
## Known Stubs
None.
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: supply-chain | ../vue-chatvideo-layer/package.json | New third-party dependency livekit-client 2.23.0 (exact), installed after the Task 3 checkpoint as planned in T-20-SC |
| threat_flag: supply-chain | ../sm-demo-app/vue-demo-app/package.json | Three new git dependencies pinned by tag v0.1.0 (commits dcd6549, bcc8e99, 75e9a40 in the lockfile) |
## Next Phase Readiness
- **Plan 05:** vue-demo-app pins every layer by tag and has no link pin, so it can be pushed. The sm-demo-app submodule pointer bump is still to do. The deploy needs `/_forum`, `/_userfriends` and `/_chatvideo` routed to Go in nginx (not `/_herald`), the herald VAPID keys in rome's `.env`, and LiveKit reachable at the production `livekit_url`.
- **Plan 06:** the call machine and the three clients have unit tests to extend; browser checks of the call flow need the stale servers stopped.
## Self-Check: PASSED
- Layer commits exist: vue-forum-layer dcd6549, vue-userfriends-layer bcc8e99, vue-chatvideo-layer 75e9a40; remote tags v0.1.0 peel to them.
- vue-demo-app: 2473517, 4edc81f, 1db4394, cc8d330, 9357711. sm-demo-app: c4a9cfc, c2208e9, c669717, fc23b4c. summercms.go: 0301dc2.
- The key files listed above exist in their repos.

View File

@@ -0,0 +1,162 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 05
subsystem: sm-demo-app deploy, rome
tags: [deploy, rome, livekit, vuurmuur, nginx, centrifugo, herald, vapid, robots, check-live]
requires:
- phase: 20-02
provides: "chat family mounted in sm-demo-app, deploy/livekit.yaml.example, Centrifugo namespaces in the example, production livekit_url"
- phase: 20-03
provides: "vue-chat-layer v0.1.0 pinned in vue-demo-app"
- phase: 20-04
provides: "forum, friends and video-call layers v0.1.0 pinned in vue-demo-app, herald VAPID handling in dev.sh"
provides:
- "demo.summercms.io serves /chat, /forum, /friends and /call/{id} with the banner and register prompts; the chat-family APIs answer 401 without a JWT"
- "The demo's own LiveKit 1.13.1 on rome (supervisor program summercms-demo-livekit, 127.0.0.1:7890 behind nginx /livekit/, media 7891/tcp and 7892/udp open through Vuurmuur)"
- "Centrifugo namespaces chat, user, video on rome; herald VAPID keys in rome's .env; robots.txt disallows the new prefixes"
- "scripts/check-deploy.sh LiveKit and chat-family checks; scripts/check-live.sh chat-family checks; DEPLOY.md runbooks for LiveKit, the firewall and the chat family"
affects: [20-06]
actuals:
tokens: 14800 # chars/4 over sm-demo-app fc23b4c..f2e35c1 without the ROADMAP snapshot and the gitlink (59224 chars)
tasks: 6
commits: 0 # MEASURED in summercms.go: git rev-list --count 6389479..HEAD before this SUMMARY commit (docs-only plan here); sm-demo-app: 6 (git rev-list --count fc23b4c..f2e35c1)
plan_head_before: 63894799065795c54d91e40094692cf4f0cbe419 # summercms.go
plan_head_after: 63894799065795c54d91e40094692cf4f0cbe419 # summercms.go before this SUMMARY commit; sm-demo-app fc23b4c -> f2e35c1, vue-demo-app 44a5229 -> 9357711 (pushed)
tech-stack:
added: []
patterns:
- "Secrets generated on rome go into files through bash builtins and stdin only (printf, tee), never as a process argument"
- "Shared-host supervisor changes name the program (supervisorctl update <name>), so no other program restarts"
- "Admin-only settings changed unattended through rome's loopback admin API, the password read on rome into a 0700 temp dir"
key-files:
created:
- ../sm-demo-app/deploy/supervisor/summercms-demo-livekit.conf
modified:
- ../sm-demo-app/deploy/nginx/demo.summercms.io.conf
- ../sm-demo-app/deploy/livekit.yaml.example
- ../sm-demo-app/config/env/production/golem15.chatvideo.yaml
- ../sm-demo-app/scripts/check-deploy.sh
- ../sm-demo-app/scripts/check-live.sh
- ../sm-demo-app/DEPLOY.md
- ../sm-demo-app/README.md
- ../sm-demo-app/plugins/demo/content/ROADMAP.md
- ../sm-demo-app/vue-demo-app
key-decisions:
- "Task 3 checkpoint: deploy (push both repositories and release the chat family on rome)"
- "Task 5 checkpoint: firewall done; the user applied the Vuurmuur rule as service sm-demo-livekit (7891/tcp, 7892/udp), rule on line 1 of rules.conf"
- "Media path: ICE over the UDP mux 7892 with ICE-TCP 7891, no embedded TURN; TURN on 3478/5349 with a DNS-only host is the recorded fallback"
- "Admin stays at /smbackend with login; /backend answers 404"
- "robots.txt updated through PUT /_seo/api/v1/robots on rome's loopback (admin bearer token), not by hand"
- "VAPID subject mailto:DEMO_ADMIN_EMAIL from the build machine's secrets file"
requirements-completed: [SC-2, SC-3, D-10, D-12, D-16, D-20, D-21]
duration: about 5 h of work over two sessions (2026-10-31 evening to 2026-11-01 18:40), with three checkpoints and the user's own firewall change
completed: 2026-11-01
status: complete
---
# Phase 20 Plan 05: chat family deployed on demo.summercms.io with its own LiveKit Summary
**The chat family runs on the public demo: https://demo.summercms.io serves /chat, /forum, /friends and /call/{id} with the banner and register prompts, every chat-family API answers 401 without a JWT, /livekit/rtc/validate reaches the demo's own LiveKit 1.13.1 (supervisor program summercms-demo-livekit, separate from WavePath's), Centrifugo has the chat, user and video namespaces, herald has VAPID keys without a route, and Vuurmuur admits LiveKit's media on 7891/tcp and 7892/udp. `check-live.sh https://demo.summercms.io` prints `check-live: ok`.**
## Task Commits
| # | Repo | Commit | Message |
|---|------|--------|---------|
| 1 | sm-demo-app | b5c639e | feat: deploy files for the chat family and the demo's LiveKit |
| 2 | sm-demo-app | cf08fb5 | fix: check-live tells an unrouted /_herald by its 404, not its type |
| 3 | — | — | checkpoint: deploy |
| 4 | vue-demo-app | (push) | 44a5229..9357711 pushed to origin master |
| 4 | sm-demo-app | c399bfd | chore: bump vue-demo-app (chat, forum, friends, calls) |
| 4 | sm-demo-app | 6d726b4 | chore: sync the roadmap snapshot |
| 4 | sm-demo-app | fcd8d95 | docs: record the chat-family release on rome |
| 5 | — | — | checkpoint: firewall done (applied by the user) |
| 6 | sm-demo-app | f2e35c1 | docs: record the LiveKit firewall rule |
**Pushed:** vue-demo-app master = 9357711 (`ls-remote` equals local HEAD, and sm-demo-app's gitlink points to it); sm-demo-app master = f2e35c1 (`ls-remote` equals local HEAD). Push order: vue-demo-app first, then the pointer bump.
## Deploy table (Task 2, rome read-only, 2026-10-31/11-01; no secret values)
| Item | State before the release |
|------|--------------------------|
| Listeners on 7890, 7891, 7892 | none (free); the trio was kept |
| WavePath LiveKit | `wavepath-livekit` RUNNING pid 1104; 127.0.0.1:7880, *:7881, UDP 50000-60000 |
| LiveKit binary | `/usr/local/bin/livekit-server` 1.13.1 |
| Demo programs | summercms-demo, summercms-demo-site, summercms-demo-centrifugo RUNNING; no summercms-demo-livekit, conf or livekit.yaml |
| `.env` key counts | CHATVIDEO__LIVEKIT_API_KEY 0, __LIVEKIT_API_SECRET 0, HERALD__VAPID__PUBLIC_KEY 0, __PRIVATE_KEY 0, __SUBJECT 0 |
| centrifugo.json | namespaces `["presentations"]` only (chat 0, user 0, video 0); Centrifugo v6.5.1 |
| Vuurmuur | 0.8.1, INPUT policy DROP, 62 vrmr lines, 15 rules, service Livekit unused, 0 rules for 789x |
| Unpushed | sm-demo-app 19 commits (plans 02-04) + this plan's; vue-demo-app 9 commits |
## Ports used
7890/tcp on 127.0.0.1 (signal and RoomService, behind nginx `location ^~ /livekit/` and `livekit_admin_url`), 7891/tcp on all addresses (ICE-TCP), 7892/udp on every interface including 54.36.173.176 (ICE UDP mux). No collision with Go 8098, Nuxt 3098, Centrifugo 8010 or WavePath's 7880/7881/50000-60000 (check-deploy asserts it).
## What changed on rome (2026-11-01)
- **LiveKit:** `/srv/summercms-demo/livekit.yaml` (0640 root:summercms-demo, own key pair generated on rome), the same pair in `.env` (secret line count 1), `/etc/supervisor/conf.d/summercms-demo-livekit.conf`, program started alone with `supervisorctl update summercms-demo-livekit`. `curl 127.0.0.1:7890/` answers OK, `/rtc/validate` 401.
- **Centrifugo:** namespaces `["presentations","chat","user","video"]`, `checkconfig` passed, summercms-demo-centrifugo restarted. Backup `/srv/summercms-demo/centrifugo.json.bak-2026-11-01`.
- **VAPID:** public key, private key and subject `mailto:` + DEMO_ADMIN_EMAIL appended to `.env` (count 3, values non-empty: 87 and 43 characters), generated with `bin/demo.new herald:vapid-generate --json -q`.
- **Release** `c49fabf46c88` (sm-demo-app 6d726b4): 9 migrations (the chat family's tables), demo:seed created channels and history EN/PL, the visitor's welcome DM, forum categories and threads, friends and group, the moderator group demo-moderators and the moderation lists; binary and site swapped (`bin/demo.prev` 21e6abc585e6, `site/.output.prev`), summercms-demo and summercms-demo-site restarted, `websockets:health` reports the API key set.
- **nginx:** the new vhost installed, `nginx -t` passed, reloaded. Previous vhost `/root/demo.summercms.io.nginx.bak-2026-11-01`.
- **robots.txt:** `Disallow:` /_chat, /_chatchannels, /_chatbots, /_chatvideo, /_forum, /_userfriends and /livekit appended through `PUT /_seo/api/v1/robots` on loopback (bot switches untouched); the live file shows them with the Sitemap line. Previous rules `/root/summercms-demo-seo-robots.bak-2026-11-01.json`.
- **Firewall (by the user):** service `/etc/vuurmuur/services/sm-demo-livekit` (`RANGE="6;7891*1024:65535"`, `RANGE="17;7892*1024:65535"`, no COMMENT), rule `Accept service sm-demo-livekit from any to firewall(any) options log,loglimit="30"` on line 1 of rules.conf. `iptables -S` shows NFLOG `vrmr: ACCEPT` and NEWACCEPT for `--dport 7891` and `--dport 7892` (66 vrmr lines, 62 before); `nc -zv 54.36.173.176 7891` connects. It differs from the proposal in the service name (`sm-demo-livekit`, not `summercms-demo-livekit`), the missing COMMENT and the position (first, not appended); no `rules.conf.bak-*` is in `/etc/vuurmuur/rules/` (the pre-change file was the 15-line one probed on 2026-10-31). DEPLOY.md records it and its removal commands use the applied names.
- **WavePath untouched:** `wavepath-livekit` kept pid 1104 throughout (uptime 1 day 23:53 before, 2 days 0:09 after); no other non-demo program was restarted. Nothing was added to `/etc/livekit/livekit.yaml`.
Supervisor status after the release: summercms-demo, summercms-demo-site, summercms-demo-centrifugo and summercms-demo-livekit RUNNING.
## Checkpoint answers
- **Task 3:** deploy.
- **Task 5:** firewall done; the user applied the Vuurmuur rule, Claude made no firewall change and verified it read-only.
## Verification
- check-deploy: `check-deploy: ok`; negative copies (a /_herald location, LiveKit on another port, a UDP port range, bind 0.0.0.0, a real key, a cap mismatch, a wrong admin URL) each fail with their own line.
- Local LiveKit 1.13.1 with the example: signal on 127.0.0.1:7890 only, ICE-TCP on *:7891, UDP 7892 per interface, /rtc/validate 401.
- check-pins ok (25 modules); `build.sh release` → `build: ok release c49fabf46c88`; smoke ok; `go vet` and `go test -short ./...` green.
- check-live against the live demo after the release and again after the firewall rule: `check-live: ok` (banner, CTA, /backend 404, /smbackend, /chat /forum /friends /call/1 prompts, six chat-family 401s, /livekit/rtc/validate from LiveKit, /_herald 404, robots lines, /ws 101, Back in a browser).
- Acceptance greps: 6 chat-family locations, the program once, Vuurmuur 14+ times in DEPLOY.md. The plan's `grep -c 'location ^~ /livekit/'` prints 0 on this machine because `grep` is ugrep, which treats a mid-pattern `^` as an anchor (it also prints 0 for the existing `/_demo/` location); `grep -cF` prints 1.
- Robots state: updated, see above. Nothing left for the user from robots.
## Deviations from Plan
**1. [Rule 1 - Bug] check-live's /_herald check** (Task 2, cf08fb5). The first version failed on any JSON answer, but Nuxt answers its 404 as JSON to curl's `Accept: */*`. It now wants status 404 (Go would answer 401 without a JWT).
**2. [Rule 3 - Blocking] Release build prerequisites** (Tasks 2 and 4). `build.sh release` refused in Task 2: the uncommitted vue-demo-app gitlink (the plan's Task 4 bump), the user's untracked backup file (left untouched; the user removed it) and a stale ROADMAP snapshot (phase 20 progress lines). The snapshot was synced in Task 4 just before the build (6d726b4) so it matched the framework's master at release time.
**3. [Rule 2 - Missing critical] Runbook safety on a shared host** (Task 1). The LiveKit secret goes into the files through bash builtins and stdin only (the Centrifugo runbook's `sed` put secrets in argv); the substitution is anchored on the newline and indent so a comment holding the placeholder cannot take it; `supervisorctl update` names the program; the new Centrifugo file is created 0640 before `tee` writes it; the vhost is backed up before it is replaced (added to "Release").
**4. robots.txt through the loopback SEO API** (Task 4). DEPLOY.md's SEO section described a hand edit; the plan allowed an unattended path. The procedure is recorded in DEPLOY.md "Chat family".
**5. check-live also covers /call/1 and /_chat** (Task 1), because SC-2 and SC-3 name them; the plan's list had /chat, /forum, /friends and five API prefixes.
**Total deviations:** 5. **Impact:** none on the goal.
## Boot-log warnings (rome and local alike)
`golem15.chatchannels: ChannelAccessResolver is deny-all`, `golem15.forum: ForumAccessResolver is deny-all`, `golem15.chatbots: BotAuthResolver is deny-all` and `golem15.herald: PresenceGate is deny-all` appear at every boot, locally too (12 times each in the local go.log). They are logged before golem15.demo installs its resolvers in `lagoon.OnDatabase` (`plugins/demo/chat.go:68,86`); chatbots has no bot users and herald no UI (D-16). Plan 06's signed-in live checks confirm the wiring on rome.
## Known Stubs
None.
## Left for the user
Nothing required. Optional: keep a dated copy of the pre-change rules.conf if you want one next to the file (DEPLOY.md lists the 15 earlier rules). NAT'd-browser media is proven only by plan 06's live call; the TURN fallback needs its own decision.
## Next Phase Readiness
Plan 06 can run its live checks: the stale local demo servers from plan 04 are stopped, the live demo passes check-live, the media ports are reachable, and a signed-in member (Turnstile is closed in production, so a test account comes from the operator or the visitor account in rome's .env) can exercise chat, forum, friends and a two-browser DM call.
## Self-Check: PASSED
- sm-demo-app commits exist and are on origin: b5c639e, cf08fb5, c399bfd, 6d726b4, fcd8d95, f2e35c1 (remote master f2e35c1). vue-demo-app origin master 9357711.
- Files exist: deploy/supervisor/summercms-demo-livekit.conf, the modified files above.
- rome: summercms-demo-livekit RUNNING, `.env` LiveKit secret count 1, VAPID count 3, wavepath-livekit pid 1104 unchanged, check-live ok.

View File

@@ -0,0 +1,328 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 06
subsystem: tests, sm-demo-app checks, vue-demo-app header
tags: [tests, vitest, testcontainers, playwright, livekit, moderation, chat, forum, check-all, uat]
requires:
- phase: 20-01
provides: "MessageSaving and PostSaving seams, golem15.moderation Filter"
- phase: 20-02
provides: "the demo host (contexts, policies, bootstrap, seed, reset, realtime guard)"
- phase: 20-03
provides: "vue-chat-layer v0.1.0"
- phase: 20-04
provides: "vue-forum-layer, vue-userfriends-layer and vue-chatvideo-layer v0.1.0"
- phase: 20-05
provides: "the chat family live on demo.summercms.io with its own LiveKit"
provides:
- "Unit and database tests for the phase's new code in the plugin, layer and app repos that own it (SC-4)"
- "check-chat.cjs --two and --call; check-local chatlive and callmedia (two browsers, a DM call with fake media through the local LiveKit)"
- "check-all.sh runs the chat family's plugin suites, the four layer suites and the two-browser checks"
- "The live header: every site link on the left (menu entries, Chat, Forum, member links), only the language switcher and Log in/Log out on the right"
affects: [phase-20 verification]
actuals:
tokens: 82300 # chars/4 over the realized diffs of the nine repos (329253 chars, go.sum and the roadmap snapshot excluded)
tasks: 8
commits: 0 # MEASURED in summercms.go: git rev-list --count 8a3ac87..HEAD before this SUMMARY commit (docs only here); code commits: 18 across nine sibling repos (table below)
plan_head_before: 8a3ac87abb6caa5d8d668fa9ead52fb0dcc24ee9 # summercms.go
plan_head_after: 8a3ac87abb6caa5d8d668fa9ead52fb0dcc24ee9 # summercms.go before this SUMMARY commit
tech-stack:
added:
- "sm-moderation-plugin: github.com/testcontainers/testcontainers-go v0.44.0 and github.com/jackc/pgx/v5 v5.10.0 as test-only dependencies (the decided versions the other plugins pin)"
patterns:
- "Fake LiveKit RoomService for Go tests: an httptest server answering /twirp/livekit.RoomService/* with empty protobuf bodies, so chatvideo's real RoomServiceClient path runs"
- "Nuxt composables tested outside Nuxt by stubbing the auto-imported globals (useState, useNuxtApp, useChatApi, ...) over a fresh state per test"
- "Two-browser Playwright checks with --use-fake-ui-for-media-stream and --use-fake-device-for-media-stream against the local LiveKit"
key-files:
created:
- ../sm-moderation-plugin/classes/filter_test.go
- ../sm-moderation-plugin/classes/filter_internal_test.go
- ../sm-moderation-plugin/models/settings_test.go
- ../sm-moderation-plugin/plugin_test.go
- ../sm-chat-plugin/saving_test.go
- ../sm-forum-plugin/saving_test.go
- ../sm-demo-app/moderation_test.go
- ../sm-demo-app/chat_test.go
- ../sm-demo-app/video_test.go
- ../sm-demo-app/seed_chat_test.go
- ../sm-demo-app/plugins/demo/chatbots_test.go
- ../sm-demo-app/plugins/demo/classes/chat_context_test.go
- ../vue-chat-layer/app/lib/chatEvents.test.ts
- ../vue-chat-layer/app/lib/chatFormat.test.ts
- ../vue-chat-layer/app/lib/chatText.test.ts
- ../vue-chat-layer/app/lib/chatUnread.test.ts
- ../vue-chat-layer/app/lib/realtime.test.ts
- ../vue-chat-layer/app/lib/linkEmbeds.test.ts
- ../vue-chat-layer/app/lib/slots.ts
- ../vue-chat-layer/tests/client.test.ts
- ../vue-chat-layer/tests/store.test.ts
- ../vue-chat-layer/tests/support/http.ts
- ../vue-chatvideo-layer/tests/videoClient.test.ts
- ../vue-chatvideo-layer/tests/useCall.test.ts
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts
- ../sm-demo-app/vue-demo-app/app/components/SiteNav.vue
modified:
- ../sm-moderation-plugin/go.mod
- ../sm-moderation-plugin/README.md
- ../sm-demo-app/boot_test.go
- ../sm-demo-app/realtime_test.go
- ../sm-demo-app/reset_test.go
- ../sm-demo-app/scripts/check-chat.cjs
- ../sm-demo-app/scripts/check-local.sh
- ../sm-demo-app/scripts/check-all.sh
- ../sm-demo-app/README.md
- ../sm-demo-app/plugins/demo/content/ROADMAP.md
- ../vue-chat-layer/vitest.config.ts
- ../vue-chat-layer/app/components/Chat/Header.vue
- ../vue-chat-layer/README.md
- ../vue-chatvideo-layer/tests/callMachine.test.ts
- ../vue-chatvideo-layer/README.md
- ../vue-forum-layer/tests/client.test.ts
- ../vue-userfriends-layer/tests/client.test.ts
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/components/SiteHeader.vue
- ../sm-demo-app/vue-demo-app/app/assets/css/site.css
- ../sm-demo-app/vue-demo-app/i18n/locales/en.json
- ../sm-demo-app/vue-demo-app/i18n/locales/pl.json
key-decisions:
- "Task 6 checkpoint: push. The tests found no bugs, so there were no fixes, no tags and no fix release; only branch pushes."
- "Task 8 round 1: the user approved the chat (and the DM video call) on the live demo, and asked for Chat and Forum in the header with every feature link on the left and only the language switcher and Log out on the right"
- "Chat and Forum are header links in a local SiteNav, not seeded menu entries: MenuNav has no slot for app items, so the member links could not sit in its mobile panel, and seeded entries would have needed a new binary and demo:seed on rome. The fix shipped as a site-only redeploy."
- "Task 8 round 2: approved (the live header and the live check, including the DM video call)"
- "The DM-only conversation-actions rule became a tested helper (dmActionsTarget) instead of a component mount: @vue/test-utils is in no lockfile"
patterns-established:
- "check-all.sh covers every repo the demo's chat family depends on, with overridable *_PLUGIN_DIR and *_LAYER_DIR checkouts"
requirements-completed: [SC-1, SC-2, SC-3, SC-4, D-01, D-02, D-04, D-05, D-06, D-07, D-08, D-09, D-11, D-12, D-13, D-14, D-15, D-17, D-18, D-20, D-21, D-22, D-23]
coverage:
- id: D1
description: "Banned words and links from the settings row reach the filter, the demo listeners and the chat and forum seams: 422 under content, title or body on every write path, nothing stored, list changes live, disabled passes"
requirement: "D-17, D-18"
verification:
- kind: unit
ref: "../sm-moderation-plugin/classes/filter_test.go#TestMatchWords, TestMatchLinks, TestParseList"
status: pass
- kind: integration
ref: "../sm-demo-app/moderation_test.go#TestDemoModeration"
status: pass
human_judgment: false
- id: D2
description: "The pre-save seams are silent without listeners and refuse totally with one (no row, no post-save event, no publication); a plain listener error stays 500"
requirement: "D-18"
verification:
- kind: integration
ref: "../sm-chat-plugin/saving_test.go#TestMessageSavingNoListener, TestMessageSavingRejects, TestMessageSavingOtherError"
status: pass
- kind: integration
ref: "../sm-forum-plugin/saving_test.go#TestPostSavingNoListener, TestPostSavingRejects"
status: pass
human_judgment: false
- id: D3
description: "Moderation settings limits, the filter cache and message locale, and the plugin's boot"
requirement: "D-17"
verification:
- kind: unit
ref: "../sm-moderation-plugin/models/settings_test.go#TestSettingsLimits; classes/filter_internal_test.go#TestFilterCheckCache, TestViolationMessage"
status: pass
- kind: integration
ref: "../sm-moderation-plugin/plugin_test.go#TestBootPublishesFilter, TestFilterCheckDisabled, TestFilterCheckReload"
status: pass
human_judgment: false
- id: D4
description: "Demo host: live membership, channel adapter, seeded-only channels, bootstrap JSON, members, DMs, moderator delete limited to channels, slash commands, DM video start against a fake RoomService, seed counts and idempotency, reset of every chat-family table, member-only realtime tokens, jwt.auth on every chat-family route"
requirement: "D-05, D-06, D-07, D-08, D-09, D-11, D-12, D-22, D-23"
verification:
- kind: integration
ref: "../sm-demo-app/chat_test.go, video_test.go#TestDemoVideoStart, seed_chat_test.go#TestSeedChat, reset_test.go#TestResetKeepsPlans, realtime_test.go#TestRealtimeMemberToken, boot_test.go#TestBootAllPlugins"
status: pass
- kind: unit
ref: "../sm-demo-app/plugins/demo/classes/chat_context_test.go, plugins/demo/chatbots_test.go#TestDemoCommands"
status: pass
human_judgment: false
- id: D5
description: "Layers: bm's chat tests unchanged on the port, the client, the multi-channel store, link embeds, the call machine, the video client, useCall on a mocked Room, the forum and friends clients, the site's auth hooks"
requirement: "D-01, D-02, D-04, D-05, D-13, D-14, D-15, D-21, D-23"
verification:
- kind: unit
ref: "pnpm test in vue-chat-layer (146), vue-chatvideo-layer (114), vue-forum-layer (12), vue-userfriends-layer (11), vue-demo-app (218)"
status: pass
human_judgment: false
- id: D6
description: "Two browsers locally: a live #general message with reaction and typing; a DM call with fake media, remote video on both sides, mute seen across, the session ended after both leave; no call button in #general"
requirement: "SC-2, D-11, D-13, D-23"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-local.sh chatlive callmedia (check-chat.cjs --two, --call)"
status: pass
human_judgment: false
- id: D7
description: "The phase gate, ending with check-live against the live demo"
requirement: "SC-2, SC-3, SC-4"
verification:
- kind: e2e
ref: "../sm-demo-app/scripts/check-all.sh --local (check-all: ok)"
status: pass
human_judgment: false
- id: D8
description: "Two-browser chat and a DM video call on https://demo.summercms.io, and the header with every link on the left"
requirement: "SC-2, SC-3"
verification:
- kind: manual
ref: "Task 8 UAT by the user: approved (after the header round)"
status: pass
human_judgment: true
duration: about 3 h of work (2026-11-01 17:42Z to the header redeploy), with two checkpoints and one UAT round
completed: 2026-11-02
status: complete
---
# Phase 20 Plan 06: unit tests for the chat family, two-browser checks and the live sign-off Summary
**The phase's new code is covered by tests in the repos that own it: the moderation filter and settings, both pre-save seams, the demo host (membership, channels, DMs, moderator delete, slash commands, video start against a fake LiveKit RoomService, seed, reset, realtime), bm's chat tests running unchanged on vue-chat-layer next to new client, store and link-embed tests, the call machine and useCall on a mocked Room, and the forum, friends and site auth clients. Two browsers prove live chat and a DM call with fake media locally, check-all gates every suite and ends green against the live demo, and the user approved the live chat, DM call and a reworked header.**
## Test counts
| Suite | Before | After |
|---|---|---|
| sm-moderation-plugin (Go top-level tests) | 2 | 16 |
| sm-chat-plugin (Go) | 44 | 47 |
| sm-forum-plugin (Go) | 16 | 18 |
| sm-demo-app `./...` (Go) | 27 | 47 |
| vue-chat-layer (vitest) | 6 | 146 |
| vue-chatvideo-layer (vitest) | 10 | 114 |
| vue-forum-layer (node --test) | 7 | 12 |
| vue-userfriends-layer (node --test) | 6 | 11 |
| vue-demo-app (vitest) | 209 | 218 |
Go counts are top-level test functions (`go test -list`); the Docker tests ran in every verify (PASS lines counted).
## Tests per repository
- **sm-moderation-plugin:**
- `classes`: `TestMatchWords`, `TestMatchWordsFirstAndEmpty`, `TestMatchLinks`, `TestMatchLinksInvalidEntries`, `TestParseList`, `TestFilterCheckCache` and `TestViolationMessage`.
- `models`: `TestSettingsLimits`, `TestLinkEntry` and `TestSettingsModel`.
- root (testcontainers): `TestBootPublishesFilter`, `TestFilterCheckDisabled` and `TestFilterCheckReload`.
- **sm-chat-plugin:** `TestMessageSavingNoListener`, `TestMessageSavingRejects` (send, reply, ReplyTo, edit; field empty, content or custom) and `TestMessageSavingOtherError`.
- **sm-forum-plugin:** `TestPostSavingNoListener` and `TestPostSavingRejects` (thread, reply, edit; title, body or empty field; plain error 500).
- **sm-demo-app:**
- `TestDemoModeration`.
- In chat_test.go: `TestDemoChatContextMembership`, `TestDemoChannelAdapter`, `TestDemoChannelsSeededOnly`, `TestDemoChatBootstrap`, `TestDemoChatMembers`, `TestDemoDMs`, `TestDemoModeratorDelete` and `TestDemoCommands` (HTTP).
- `TestDemoVideoStart`, `TestSeedChat` and `TestSeedChatWithoutVisitor`.
- Extended `TestResetKeepsPlans` and `TestBootAllPlugins`, and the new `TestRealtimeMemberToken`.
- In `plugins/demo/classes`: `TestDemoChatContextConstants`, `TestDemoChatContextMembershipHooks`, `TestDemoChatContextLoaders`, `TestDemoChatAccess`, `TestDemoForumAccess` and `TestDemoMembershipWithoutDatabase`.
- In `plugins/demo`: `TestDemoCommands`.
- **vue-chat-layer:**
- bm's `chatEvents`, `chatFormat`, `chatText`, `chatUnread` and `realtime` tests next to their ports (only the imports differ).
- `linkEmbeds.test.ts`, `tests/client.test.ts` and `tests/store.test.ts`.
- **vue-chatvideo-layer:** `callMachine.test.ts` (every event in every state), `videoClient.test.ts` and `useCall.test.ts` (`vi.mock('livekit-client')`).
- **vue-forum-layer, vue-userfriends-layer:** every client method's refusal and answer, and the error bodies.
- **vue-demo-app:** `app/utils/communityAuth.test.ts`. The existing `app/lib/realtime.test.ts` still passes through the re-export.
**What TestDemoVideoStart recorded for a channel start.** Seeded #general has 5 participants (4 personas plus the caller) against `max_participants` 4. A start there answers 422 "Conversation has too many participants for a video call". With 2 participants it answers 201, so the server has no conversation-type rule; calls are limited to DMs only by the UI (D-23). The DM start answers 201, then 200 with the same session on a second start and for the other side. The token claims (issuer, user id, room) verify with the test secret, and CreateRoom reached the fake Twirp RoomService exactly once with a bearer token.
## Task commits
| Task | Repo | Commit | Message |
|---|---|---|---|
| 1 | sm-moderation-plugin | 8a93cc8 | test: word, phrase and link matching of the filter |
| 1 | sm-demo-app | a660add | test: moderation end to end through the chat and forum seams |
| 2 | sm-moderation-plugin | 313d117 | test: settings limits, filter cache and locale, boot publishes the filter |
| 2 | sm-chat-plugin | 6539dd2 | test: MessageSaving parity, refusals on every write path and other errors |
| 2 | sm-forum-plugin | 13aa642 | test: PostSaving parity and refusals on thread, reply and edit |
| 3 | sm-demo-app | 08b7784 | test: demo chat family |
| 4 | vue-chat-layer | 764cb42 | refactor: the DM-only conversation-actions rule as a helper |
| 4 | vue-chat-layer | b6d3389 | test: the SPA's chat tests on the port, client, store and link embeds |
| 4 | vue-chatvideo-layer | 8222255 | test: every call transition, the video client and useCall on a fake Room |
| 4 | vue-forum-layer | 4780824 | test: every forum client method's refusal and answer, error bodies |
| 4 | vue-userfriends-layer | 6a5f6ce | test: every friends client method's refusal and answer, error bodies |
| 4 | vue-demo-app | 0c1a66b | refactor: community auth hooks into app/utils |
| 4 | vue-demo-app | ec45480 | test: community auth hooks |
| 5 | sm-demo-app | 9b9da38 | test: two-browser chat and call checks; phase gate covers the chat family |
| 5 | sm-demo-app | 3d86215 | chore: bump vue-demo-app (community auth hooks and their tests) |
| 5 | sm-demo-app | 71ff755 | chore: sync the roadmap snapshot |
| 6 | — | — | checkpoint: **push** |
| 7 | all nine | — | branch pushes; check-all: ok |
| 8 | vue-demo-app | deb809f | feat: every site link on the left of the header, with Chat and Forum |
| 8 | sm-demo-app | 2cd4640 | chore: bump vue-demo-app (header: all links left, Chat and Forum) |
| 8 | — | — | site-only redeploy on rome; UAT: **approved** |
Every repo was pushed with plain fast-forwards. `git ls-remote origin` equals local HEAD for each:
| Repo | Pushed head |
|---|---|
| sm-moderation-plugin | 313d117 |
| sm-chat-plugin | 6539dd2 |
| sm-forum-plugin | 13aa642 |
| vue-chat-layer | b6d3389 |
| vue-chatvideo-layer | 8222255 |
| vue-forum-layer | 4780824 |
| vue-userfriends-layer | 6a5f6ce |
| vue-demo-app | deb809f |
| sm-demo-app | 2cd4640 |
No tags were created in this plan.
## Checkpoint answers and the UAT
- **Task 6:** push. No bugs were found, so there were no fixes and no fix release; only branch pushes.
- **Task 7:** `check-all.sh --local` printed `check-all: ok`. It covered:
- every suite: the app, the MCP-tagged app, sm-user, sm-journal, chat, forum and moderation with Docker, `-short` of chatchannels, chatbots, chatvideo, herald and userfriends, vitest in vue-demo-app and the four layers;
- `check-pins: ok (25 modules)`, `build: ok release e50834496975`, `smoke: ok` and `check-deploy: ok`;
- `check-local: ok back remote chatlive callmedia`;
- `check-live: ok` against https://demo.summercms.io.
- **Task 8, round 1:** "chat itself approved, but it's missing in navbar … make all to the left, and on the right just language and logout."
- Fix: `SiteNav` renders the main menu's entries (vue-menu-layer's `MenuNavItem`), then Chat and Forum for everyone, then My presentations, Friends and Security for members, in one list. The right side keeps only the language switcher and Log in or Log out.
- Below 1180px every link is in the menu panel, so the member links are reachable on phones too. Phone spacing was tightened to fit 390px.
- Checked with Playwright at 1280, 1440, 1024 and 390px, as visitor and member, in EN and PL. Also `check-local tour chat back`, `smoke.sh`, vue-demo-app's tests and build.
- Released site-only after the user's "yes":
- pushed deb809f and 2cd4640;
- `build: ok release f9fa556fd20e`, `smoke: ok`;
- rsynced only `vue-demo-app/.output/` to `site/.output.new`, swapped it in (`.output.prev` kept) and restarted only `summercms-demo-site` (RUNNING, pid 1773325);
- `check-live: ok`;
- the anonymous live header shows Home, Journal, FAQ, Subscriptions, Chat, Forum (PL: Start, Blog, FAQ, Subskrypcje, Czat, Forum) on the left and EN/PL and Log in on the right.
- The binary, config, migrations, `demo:seed`, nginx, Centrifugo and LiveKit were untouched. Site rollback: `sudo mv site/.output site/.output.bad && sudo mv site/.output.prev site/.output && sudo supervisorctl restart summercms-demo-site`.
- **Task 8, round 2:** approved. This covers the live header and the live check, including the two-browser chat and the DM video call.
## Deviations from Plan
1. **Slot helper instead of a component mount.** @vue/test-utils is in no lockfile, so ChatHeader's inline DM-only `v-if` became `dmActionsTarget` (`vue-chat-layer/app/lib/slots.ts`, 764cb42, no behaviour change) and is tested in the store test. It is on vue-chat-layer main, untagged; the demo still pins v0.1.0.
2. **Where the filter tests landed.** `TestFilterCheckCache` is an internal test in `classes`. The database tests (`TestFilterCheckDisabled`, `TestFilterCheckReload`) are in the plugin root's `plugin_test.go` with the sitemap-style harness, not in `filter_test.go`. Extra tests were added (listed above).
3. **Test-only dependencies.** sm-moderation-plugin's go.mod gained testcontainers-go v0.44.0 and pgx v5.10.0, resolved offline with `GOPROXY=off` from the versions the other plugins already pin. The README Testing section names them.
4. **The ported realtime test.** vue-chat-layer's `realtime.test.ts` is vue-demo-app's adapted copy of bm's test (a stubbed token route). The vitest config maps bm's `@/api/http` to `tests/support/http.ts`. The other four bm tests match bm's after `describe` (diff empty).
5. **Split chatvideo test file.** The video-client part of `callMachine.test.ts` moved into a new `videoClient.test.ts`.
6. **Extra demo tests.** `TestSeedChatWithoutVisitor`; `TestDemoCommands` exists in `plugins/demo` (the command objects) and in the root package (HTTP); `TestBootAllPlugins` checks `jwt.auth` on every chat-family route.
7. **Commits needed by the gate.** The vue-demo-app pointer bump (3d86215) and a roadmap snapshot sync (71ff755) were committed in Task 5. `build.sh release` refuses a dirty tree and a stale snapshot, and the framework's ROADMAP had moved since plan 05.
8. **The check-back hook.** The header rework kept the `site-header__mine` class on the member links and keeps the text out of template comments. scripts/check-back.cjs (also run by check-live) relies on it, so the live check works on the old and the new site alike.
9. **Header breakpoint.** The panel takes over below 1180px rather than only below 768px, because nine links for a member do not fit on one row below that width.
**Total deviations:** 9. **Impact on plan:** none on the goal. No production behaviour changed except the header, which the user asked for in the UAT.
## Notes
- **Banned-link prefix matching.** A banned-link entry with a path matches by string prefix, so `shop.example/promo` also matches `/promotions`. That's what the README and the admin form say ("starts with"); the plan said "only below its path". It is not pinned by a test.
- **A stale snapshot reddens the gate.** Any later commit to the framework ROADMAP turns `check-all` red at `sync-roadmap --check` until the demo's snapshot is synced and committed.
- **Leftover dev process.** A `nuxt dev` from Oct 22 (pids 212159 and 212194) still runs in vue-demo-app, listening on no port. It was left alone, as instructed.
- **Phone header before this plan.** At 390px the visitor's Polish header ("Zaloguj się") probably overflowed already; the header round fixed it along the way.
## Known Stubs
None.
## Threat Flags
None. The new surface is test code and check scripts. The scripts read the visitor's credentials only through check-local's existing `.env` helper and never print them; the header change adds links to existing pages.
## Self-Check: PASSED
- Commits exist on their remotes: sm-moderation-plugin 8a93cc8 and 313d117; sm-chat-plugin 6539dd2; sm-forum-plugin 13aa642; vue-chat-layer 764cb42 and b6d3389; vue-chatvideo-layer 8222255; vue-forum-layer 4780824; vue-userfriends-layer 6a5f6ce; vue-demo-app 0c1a66b, ec45480 and deb809f; sm-demo-app a660add, 08b7784, 9b9da38, 3d86215, 71ff755 and 2cd4640 (`ls-remote` heads above).
- The key files listed above exist in their repos.
- rome: summercms-demo-site RUNNING with `site/.output` (new) and `site/.output.prev`; check-live ok.

View File

@@ -0,0 +1,255 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 07
type: execute
wave: 7
depends_on: ["20-06"]
gap_closure: true
review_findings: [CR-02, CR-03]
files_modified:
- ../sm-moderation-plugin/classes/filter.go
- ../sm-moderation-plugin/classes/normalize.go
- ../sm-moderation-plugin/classes/html.go
- ../sm-moderation-plugin/classes/bypass_test.go
- ../sm-moderation-plugin/classes/html_test.go
- ../sm-moderation-plugin/classes/filter_test.go
- ../sm-moderation-plugin/models/settings.go
- ../sm-moderation-plugin/models/settings_test.go
- ../sm-moderation-plugin/plugin_test.go
- ../sm-moderation-plugin/go.mod
- ../sm-moderation-plugin/go.sum
- ../sm-moderation-plugin/README.md
- ../sm-forum-plugin/events/events.go
- ../sm-forum-plugin/classes/forum_service.go
- ../sm-forum-plugin/classes/lifecycle.go
- ../sm-forum-plugin/saving_test.go
- ../sm-forum-plugin/README.md
autonomous: true
requirements: [D-17, D-18, SC-2]
estimate:
tokens: 170000
raw_tokens: 170000
tasks: 3
confidence: low
must_haves:
truths:
- "CR-03, D-17: classes.Match and Filter.Check refuse every word bypass the reviewer listed: a zero-width space or soft hyphen inside a banned word (and every other format character), a no-break, thin or ideographic space between the words of a banned phrase, decomposed (NFD) Polish diacritics against an NFC entry, fullwidth letters, HTML entities (vi&#97;gra) and inline markup inside a word (via**gra**, via`gra`, _viagra_). Matching is diacritic-insensitive (zolw matches the entry żółw) and reports the entry as listed."
- "CR-02, D-17: classes.Match and Filter.Check refuse every link bypass the reviewer listed: a percent-encoded host (bit%2Ely, bit.l%79), fullwidth letters and ideographic, fullwidth or halfwidth dots in the host, a port in front of a path rule (example.com:443/promo), a percent-encoded or doubled path (/%70romo, //promo), a trailing dot (example.com./promo), a subdomain of a path rule (sub.example.com/promo), userinfo (user@bit.ly), an entity in a link destination ([x](https://bit&#46;ly/a)), and either spelling of an IDN (punycode against Unicode, both ways). The http(s) scheme with no or mixed slashes and backslashes after the colon (https:bit.ly) counts as the host it opens."
- "Clean text stays clean: every existing case of TestMatchWords, TestMatchWordsFirstAndEmpty, TestMatchLinks, TestMatchLinksInvalidEntries and TestParseList keeps its expectation, except `a.shop.example/promo`, which the review's subdomain rule now flags."
- "CR-03, D-18: forum's events.PostSaving carries HTML, the content_html breakwater renders from Body, on thread, reply and edit; the value equals what is stored. With no listener the forum's routes, payloads, stored rows and status codes are unchanged, and the existing seam, golden and method-map tests pass unedited."
- "CR-03: classes.MatchHTML and Filter.CheckHTML read rendered HTML as a member sees it (text across inline tags joined, entities decoded, href and src values as links), so the forum's Markdown forms the raw check cannot see (bit\\.ly, via<!-- x -->gra, [x](https:bit.ly), a reference link with an entity in its destination) are refused once a host checks PostSaving.HTML."
- "No new module enters the build: golang.org/x/text v0.42.0 and golang.org/x/net v0.58.0 become direct requires of sm-moderation-plugin at the versions the framework already requires directly (summercms.go go.mod), resolved offline."
artifacts:
- path: "../sm-moderation-plugin/classes/normalize.go"
provides: "text normaliser (entities, NFKC, format characters, Unicode spaces, diacritics, inline markup) and the link-candidate canonicaliser (percent-decoding, dots, IDNA, port, userinfo, path)"
contains: "norm.NFKC"
- path: "../sm-moderation-plugin/classes/html.go"
provides: "MatchHTML and Filter.CheckHTML over x/net/html tokens"
contains: "func MatchHTML"
- path: "../sm-moderation-plugin/classes/bypass_test.go"
provides: "the reviewer's probes as regression tests"
contains: "TestMatchBypassLinks"
- path: "../sm-forum-plugin/events/events.go"
provides: "PostSaving.HTML"
contains: "HTML"
key_links:
- from: "../sm-forum-plugin/classes/forum_service.go"
to: "../sm-forum-plugin/events/events.go"
via: "CreateThread and Reply render first and fire PostSaving with HTML set to the rendered body"
pattern: "HTML: *html"
- from: "../sm-forum-plugin/classes/lifecycle.go"
to: "../sm-forum-plugin/events/events.go"
via: "EditPost renders first and fires PostSaving with HTML"
pattern: "HTML: *html"
- from: "../sm-moderation-plugin/classes/filter.go"
to: "../sm-moderation-plugin/classes/normalize.go"
via: "compile folds every entry and match runs on the normalised text, Check and Match alike"
pattern: "normali[sz]e"
prohibitions:
- statement: "sm-moderation-plugin imports neither sm-chat-plugin nor sm-forum-plugin."
status: unresolved
verification: automated
- statement: "No push, tag or deploy in this plan; sm-demo-app is not edited here (its listener change needs the new tags and lands in 20-09)."
status: unresolved
verification: judgment
- statement: "Forum's HTTP API, stored columns, migrations and config keys do not change; PostSaving gains a field and nothing else changes shape."
status: unresolved
verification: judgment
---
## Phase Goal
ROADMAP Goal (not in user-story format; no story is invented here): sm-demo-app runs every shared plugin and its public site shows them working, deployed publicly.
This plan's slice (gap round after the code review, plan 7 of 9, wave 7): the moderation filter refuses what members actually see, not only the literal text they type. It closes CR-02 (banned-link bypass through URL forms browsers normalise) and CR-03 (banned-word bypass through invisible characters, Unicode spaces, decomposed diacritics and forum Markdown) from 20-REVIEW.md, in the two repositories that own the code: sm-moderation-plugin (the filter) and sm-forum-plugin (the pre-save seam passes the rendered post).
**Unit tests rule for this gap round:** the project rule "unit tests are the last plan of every phase" is met because every fix in this plan ships with its own regression tests in the repository that owns the code, and plan 20-09 runs every touched repository's full suite before anything is tagged.
## Decisions taken in this plan (Claude's discretion, recorded)
- **Where the rendered text comes from.** Forum renders the body before it fires PostSaving and passes the result in a new field `HTML` (additive; the review's second option, "so every host gets it"). The moderation plugin offers `MatchHTML` and `Filter.CheckHTML` to read it. Moderation stays free of chat and forum imports; HTML is generic, so a later host (journal posts, a rich editor) can use the same call.
- **The raw check stays and gets stronger.** `Check` and `Match` normalise the text themselves (entities, NFKC, format characters, Unicode spaces, diacritics, inline markup inside words), so chat messages, which the browser renders with vue-chat-layer's inline renderer, and forum titles are covered without any host change. The three forum forms the reviewer reproduced (via**gra**, vi&#97;gra, an entity in a link destination) are already refused on the raw body by this normalisation; `CheckHTML` adds the forms only the renderer resolves.
- **The demo listener.** `plugins/demo/moderation.go` `checkMessage` needs no change (Check normalises). `checkPost` needs one more check, `CheckHTML` on `ev.HTML`, which compiles only against the new moderation and forum tags. sm-demo-app's go.work points at the submodule checkouts pinned to the current tags, so that edit is made in 20-09 right after the dependency bumps, keeping every sm-demo-app commit buildable. This plan records the finding in its SUMMARY.
- **Dependencies (CLAUDE.md rule).** `golang.org/x/text` (unicode/norm) and `golang.org/x/net` (idna for punycode, html for the tokenizer) move from indirect to direct requires of sm-moderation-plugin. Both are already direct requires of the framework at v0.42.0 and v0.58.0 (summercms.go go.mod), already in the plugin's go.sum and in the module cache, and sm-journal-plugin imports `x/net/html` directly (.planning/notes/journal-html-sanitizing-bluemonday.md). The standard library has no NFKC, IDNA or HTML tokenizer. This plan is the phase note that names them; the README's Dependencies section says so too.
- **Diacritic-insensitive matching** folds both the entries and the text: NFD, drop nonspacing marks, recompose, plus a small map for the letters that have no decomposition (ł, đ, ø, ħ, ŧ and their capitals). An entry is reported as listed, so `Match` keeps answering "żółw", not its folded form.
- **Path rules match subdomains** as host rules do (the review's fix). This flips one existing expectation, `a.shop.example/promo`, from clean to flagged; the plan updates that case and no other.
- **Versions.** The next patch tags are v0.1.1 for sm-moderation-plugin (its latest tag is v0.1.0; the brief's v0.1.2 assumed a v0.1.1 that does not exist) and v0.1.2 for sm-forum-plugin (latest v0.1.1). The README changelog entries name those versions; 20-09 re-checks the tags before the release gate.
- spec-less probe fallback skipped: phase has no requirement IDs to probe (visible skip).
<objective>
Make the banned-word and banned-link filter match what a member sees: normalise the text and every link candidate before matching, read rendered forum HTML, and give the forum seam the rendered post.
Purpose: D-17 (banned words and links refused in chat and forum) holds against anyone who tries more than once; D-18's seam carries what the forum stores. Closes CR-02 and CR-03 server-side.
Output: commits in ../sm-moderation-plugin and ../sm-forum-plugin (not pushed, not tagged), with regression tests for every bypass the reviewer listed.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-CONTEXT.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-06-SUMMARY.md
Repos: ../sm-moderation-plugin (main at 313d117, tag v0.1.0) and ../sm-forum-plugin (main at 13aa642, tag v0.1.1). Both have a tracked go.work (`use .`, framework replaced by ../summercms.go). Read-only reference: ../sm-demo-app/plugins/demo/moderation.go (the listener), ../summercms.go/modules/breakwater (Render), ../sm-demo-app/plugins/demo/console/seed_friends.go (the demo's default lists: buy followers, casino bonus, free crypto, viagra; bit.ly).
Rules: no co-author tags; stage files by explicit path; plugin code and planning docs in separate commits; no push or tag (20-09 does both after a go-ahead); framework code and these plugins name no consuming application (README examples use `acme`); check `git status` in each repo before editing and leave edits that are not this plan's alone. Docker tests skip under `-short`; if the Docker socket is denied, run the Docker tests through `sudo -u golem` (CLAUDE.md). Resolve modules offline: `GOFLAGS=-mod=mod GOPROXY=off` for `go mod tidy`.
The reviewer's probe: /tmp/claude-1000/-media-nvme-dev-golem15-summercms-io-summercms-summercms-go/0fc9bf8a-bc2a-4cab-8faa-51763a879541/scratchpad/modtest/main_test.go (a module that replaces sm-moderation-plugin with the sibling checkout; run it with `GOWORK=off GOFLAGS=-mod=mod GOPROXY=off go test -v` in that directory). It may be gone after a reboot; its cases are copied into bypass_test.go in Task 1 and Task 2, which are the record.
<interfaces>
sm-moderation-plugin today (classes/filter.go): consts KindWord, KindLink; type Violation {Kind, Match, Message}; `boundary` = non-letter, non-digit, non-underscore; `hostPattern` regexp (labels of letters, digits, inner hyphens, a dot; optional http(s) scheme; optional path); `ParseList(text) []string` (trim, lower-case, collapse whitespace, dedupe); unexported `compile(words, links) (*matcher, error)` and `(*matcher).match(text) *Violation` (words regexp `(?i)(?:^|boundary)(alt|alt)(?:$|boundary)` with `\s+` between phrase words; link rules {entry, host, path}, host rules match the host and its subdomains, path rules the same host and a path prefix); `Match(words, links, text) *Violation` (pure); `Filter` {db, tr, cache} with `NewFilter(db)`, `SetTranslator(tr)`, `Check(ctx, text) (*Violation, error)` (reads row 1, enabled switch, recompiles on change, translated message).
models/settings.go: `LinkEntry(entry) (host, path string, ok bool)` (host entry or http(s) URL, lower-cased, www. and trailing dot dropped, path unescaped, port and userinfo refused), `ValidHost(h)`, `Lines`, `Text`, `Settings.BeforeValidate` (uses LinkEntry to refuse bad link entries).
sm-forum-plugin: events.PostSaving {ContextType, ContextID, ActorID, ThreadID, PostID, Title, Body, Op}; fire sites CreateThread (classes/forum_service.go, Fire at ~284, Render at ~290), Reply (~341, Render ~347), EditPost (classes/lifecycle.go ~235, Render ~241), each guarded by `s.bus != nil`; tests saving_test.go TestPostSavingNoListener, TestPostSavingRejects (Docker harness).
breakwater.Render output for the forum probes (checked during planning): via**gra** → `<p>via<strong>gra</strong></p>`; vi&#97;gra → `<p>viagra</p>`; [x](https://bit&#46;ly/a) → an anchor with href https://bit.ly/a; bit\.ly → `<p>bit.ly</p>`; via<!-- -->gra → `<p>viagra</p>`; [x](https:bit.ly) → href "https:bit.ly"; _viagra_ → `<em>viagra</em>`; a reference link `[x][1]` with `[1]: https://bit&#46;ly/r` → href https://bit.ly/r.
Go facts (checked during planning): net/url refuses a percent-escape in the host ("invalid URL escape %2E"), so the authority is percent-decoded before parsing; `idna.Lookup.ToASCII` maps fullwidth letters and the dots U+3002, U+FF0E and U+FF61 and gives punycode for an IDN (żółw.pl → xn--w-uga1v8h.pl); NFKC maps fullwidth letters and U+FF0E but not U+3002.
</interfaces>
</context>
<tasks>
<task type="tracer">
<name>Task 1: Tracer: a banned word split by a zero-width space and a banned host written as bit%2Ely are refused by Match and by Filter.Check, through one normaliser and one link canonicaliser, under test</name>
<precondition>`git -C ../sm-moderation-plugin status --porcelain` prints nothing and `git -C ../sm-moderation-plugin rev-parse HEAD` equals `git -C ../sm-moderation-plugin ls-remote origin refs/heads/main` (fast-forward base).</precondition>
<files>../sm-moderation-plugin/classes/normalize.go, ../sm-moderation-plugin/classes/filter.go, ../sm-moderation-plugin/classes/bypass_test.go, ../sm-moderation-plugin/plugin_test.go, ../sm-moderation-plugin/go.mod, ../sm-moderation-plugin/go.sum</files>
<read_first>../sm-moderation-plugin/classes/filter.go (whole file), classes/filter_test.go (runMatch helper and the existing cases), classes/filter_internal_test.go, plugin_test.go (TestMain, the testcontainers harness, TestFilterCheckDisabled), models/settings.go (LinkEntry), go.mod, 20-REVIEW.md CR-02 and CR-03, the scratchpad probe main_test.go</read_first>
<action>Per D-17, closing the first case of CR-03 and of CR-02 end to end.
1. Red first: create classes/bypass_test.go (package classes_test, reusing the runMatch shape of filter_test.go) with `TestMatchBypassWords` holding one case, the word "viagra" with a U+200B zero-width space after "via", and `TestMatchBypassLinks` holding one case, "https://bit%2Ely/x" against the host entry bit.ly. Lists come from `classes.ParseList` of the demo defaults (words "buy followers", "casino bonus", "free crypto", "viagra"; links "bit.ly" and "example.com/promo"). Run them and see both fail.
2. classes/normalize.go (new, unexported helpers, doc comments in the file's style):
- a text normaliser used by both Match and Filter.Check: decode HTML entities once with the standard library's `html.UnescapeString`, apply `norm.NFKC` (golang.org/x/text/unicode/norm), drop every rune of category Cf (zero-width space, joiners, word joiner, BOM, soft hyphen, bidi controls), and turn every rune that `unicode.IsSpace` or the Z categories accept into a plain space;
- a link-candidate canonicaliser: given one candidate (with or without an http(s) scheme), percent-decode its authority once (the WHATWG parser does; net/url refuses an escape in the host), parse it with net/url, take `Hostname()` (this drops the port and userinfo), lower-case it, drop a trailing dot and a leading "www.", and convert it with `idna.Lookup.ToASCII` (golang.org/x/net/idna), falling back to the lower-cased NFKC form when ToASCII refuses the label.
3. classes/filter.go: `compile` folds each word entry with the same normaliser before quoting it, and remembers the entry as listed; `match` normalises the text first; link candidates found in the text go through the canonicaliser, and rule hosts are converted to their ASCII form once in compile. Keep `Violation.Match` the entry as listed (ParseList's form). This task only needs candidate extraction to see "bit%2Ely" as one host: widen candidate extraction so a host may contain percent-escapes (Task 2 replaces it with full tokenising).
4. go.mod: `GOFLAGS=-mod=mod GOPROXY=off go -C ../sm-moderation-plugin mod tidy`; golang.org/x/text and golang.org/x/net move to the direct block at v0.42.0 and v0.58.0 (no version change, no new module).
5. plugin_test.go: add `TestFilterCheckNormalises` (Docker, the existing harness): with the settings row holding the demo default lists, `Filter.Check` on the zero-width-space word answers KindWord "viagra" and on "https://bit%2Ely/x" KindLink "bit.ly", and clean text answers nil.
6. Make both bypass tests and every existing test green. Commit in sm-moderation-plugin: `fix: normalise text and link hosts before matching banned entries`.</action>
<verify>
<automated>go -C ../sm-moderation-plugin vet ./... &amp;&amp; go -C ../sm-moderation-plugin test -count=1 -short ./... &amp;&amp; go -C ../sm-moderation-plugin test -count=1 -short -run '^(TestMatchBypassWords|TestMatchBypassLinks)$' -v ./classes 2>&amp;1 | grep -c -- '^--- PASS: TestMatchBypass' | grep -qx 2 &amp;&amp; go -C ../sm-moderation-plugin test -count=1 -run '^TestFilterCheckNormalises$' .</automated>
<fails_when>Non-zero exit: vet fails, an existing short test breaks, either bypass test is missing or red, or the Docker test TestFilterCheckNormalises fails (the stored lists do not reach the normalised matcher).</fails_when>
</verify>
<acceptance_criteria>
- `grep -cE '^\s+golang.org/x/(text|net) v0\.(42|58)\.0$' ../sm-moderation-plugin/go.mod` prints 2 (both direct, without the indirect comment).
- `go -C ../sm-moderation-plugin list -deps ./... | grep -cE 'sm-(chat|forum)-plugin'` prints 0.
</acceptance_criteria>
<done>One invisible-character word and one percent-encoded host are refused by the pure matcher and by the stored-list filter, and the tracer's normaliser and canonicaliser are the single path every later case goes through.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Every word and link bypass the reviewer listed is refused, entries are normalised the same way, and clean text stays clean</name>
<files>../sm-moderation-plugin/classes/normalize.go, ../sm-moderation-plugin/classes/filter.go, ../sm-moderation-plugin/classes/bypass_test.go, ../sm-moderation-plugin/classes/filter_test.go, ../sm-moderation-plugin/models/settings.go, ../sm-moderation-plugin/models/settings_test.go, ../sm-moderation-plugin/README.md</files>
<read_first>The Task 1 code, classes/filter_test.go (all cases), models/settings_test.go (TestLinkEntry), README.md (Features, Usage, API reference, Dependencies, Testing, Changelog), 20-REVIEW.md CR-02 table and CR-03 list, ../vue-chat-layer/app/lib/markdown.ts formatSpans and ../vue-chat-layer/app/lib/chatText.ts CODE_RE (the inline markup chat renders)</read_first>
<behavior>
- Words (TestMatchBypassWords): viagra split by U+200B, U+00AD, U+200D, U+2060 or U+FEFF; "buy followers" with U+00A0, U+2009, U+202F or U+3000 between the words; fullwidth viagra; vi&#97;gra and vi&#x61;gra; via**gra**, via`gra`, via~~gra~~ and _viagra_; with the entry żółw, its NFD spelling (z plus U+0307, o plus U+0301, ł, w) and the folded spelling zolw both flag and report "żółw".
- Words that must stay clean: spam_bot, _spam, spamming (with spam listed), and every existing TestMatchWords case.
- Links (TestMatchBypassLinks), against bit.ly and example.com/promo: https://bit%2Ely/x, https://bit.l%79/x, bit.l%79/x, https://bit.ly/x, https://bit。ly/x, https://bit.ly/x, https://bit。ly/x, https://user@bit.ly/x, https://example.com@bit.ly/, [x](https://bit&#46;ly/a), https:bit.ly, https:/\bit.ly/x, https://bit.ly./x, https://example.com:443/promo, https://example.com/%70romo, https://example.com//promo, https://example.com/./promo, https://example.com./promo, https://sub.example.com/promo; with the entry żółw.example, https://xn--w-uga1v8h.example/ flags, and with the entry xn--w-uga1v8h.example, https://żółw.example/ flags.
- Links that must stay clean: https://notbit.ly/x, https://example.com/about, https://example.com/x/promo, https://bit.lyx/, and every existing TestMatchLinks case except a.shop.example/promo, which now flags (path rules cover subdomains).
</behavior>
<action>Per D-17, closing CR-02 and the text half of CR-03.
- Extend bypass_test.go with every case of the behavior block (one table per test, each case commented with the bypass it pins), then make it green:
- normaliser: after the Task 1 steps, fold diacritics (NFD, drop category Mn, recompose with NFC, then map ł Ł đ Đ ø Ø ħ Ħ ŧ Ŧ to their base letters); the same function folds the entries in compile, and a map from folded entry to listed entry keeps `Violation.Match` as listed. Join the words of a phrase with `[\p{Z}\s]+`.
- markup: `match` runs the words and links on two forms of the text, first the normalised text, then the same text with inline markup removed: every asterisk, backtick and tilde dropped, and an underscore pair around a word (`_word_` between boundaries, the rule of vue-chat-layer's formatSpans) unwrapped. A lone underscore stays a word character, so spam_bot and _spam stay clean.
- links: replace the regexp candidate extraction with tokenising: split the normalised text on whitespace and on the delimiters `<>"'()[]{}`, trim trailing sentence punctuation (.,;:!?), and treat a token as a candidate when it has an http(s) scheme or contains a dot after the dot mapping. For http and https, any run of slashes and backslashes after the colon (none included) counts as `//`, as the WHATWG parser reads special schemes. The candidate's path is percent-decoded and cleaned with path.Clean after a leading slash (collapses //, /./ and dot segments) and compared lower-cased. A path rule matches its host and every subdomain, like a host rule.
- models/settings.go `LinkEntry`: apply NFKC and the dot mapping to the entry, and return the host in its IDNA ASCII form (`idna.Lookup.ToASCII`); an entry whose host ToASCII refuses is not ok, so the admin form refuses it. Existing ASCII cases of TestLinkEntry keep their results; change the żółw.example case to expect its punycode host and add cases for a fullwidth entry and an entry with U+3002.
- filter_test.go: change only the a.shop.example/promo case to expect a KindLink violation for https://shop.example/promo, with a comment that path rules cover subdomains (CR-02).
- README.md: Features (normalisation and link canonicalisation, in plain words, with the list of forms), Usage unchanged, API reference (LinkEntry's ASCII host), Dependencies (golang.org/x/text and golang.org/x/net, why, at the framework's versions), Testing (the new test names), Changelog `### v0.1.1` (banned entries match what members see: invisible characters, Unicode spaces, diacritics, entities, inline markup, URL forms browsers normalise; path rules cover subdomains; no schema, config or API change other than LinkEntry's ASCII host). Name no application.
- Commit in sm-moderation-plugin: `fix: match banned words and links in the forms browsers show`.</action>
<verify>
<automated>go -C ../sm-moderation-plugin vet ./... &amp;&amp; go -C ../sm-moderation-plugin test -count=1 -short ./... &amp;&amp; go -C ../sm-moderation-plugin test -count=1 ./... &amp;&amp; P=/tmp/claude-1000/-media-nvme-dev-golem15-summercms-io-summercms-summercms-go/0fc9bf8a-bc2a-4cab-8faa-51763a879541/scratchpad/modtest; if [ -f "$P/main_test.go" ]; then (cd "$P" &amp;&amp; GOWORK=off GOFLAGS=-mod=mod GOPROXY=off go test -count=1 -v . 2>&amp;1 | grep -c 'flagged=false' | grep -qx 0); fi</automated>
<fails_when>Non-zero exit: vet fails; a short or Docker test fails (a bypass case still passes, a clean case is now flagged, an existing expectation other than a.shop.example/promo changed, LinkEntry refuses a valid entry); or the reviewer's probe, when it still exists, prints any flagged=false line.</fails_when>
</verify>
<acceptance_criteria>
- `go -C ../sm-moderation-plugin test -count=1 -short -run '^TestMatchBypass(Words|Links)$' -v ./classes 2>&amp;1 | grep -c -- '^--- PASS'` prints 2.
- `grep -F 'a.shop.example/promo' ../sm-moderation-plugin/classes/filter_test.go | grep -c 'KindLink'` prints 1 (the one existing case that changed), and `git -C ../sm-moderation-plugin diff --stat 313d117 -- classes/filter_test.go` reports 1 deletion (the old case line; the insertions are the new case and its comment).
- `grep -c '### v0.1.1' ../sm-moderation-plugin/README.md` prints 1.
</acceptance_criteria>
<done>No word or link form from the review gets past the filter, an admin's entry matches in every spelling a browser accepts, and every clean sentence the earlier tests pinned still passes.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: The forum seam carries the rendered post, and the filter reads rendered HTML the way a member sees it</name>
<files>../sm-moderation-plugin/classes/html.go, ../sm-moderation-plugin/classes/html_test.go, ../sm-moderation-plugin/README.md, ../sm-forum-plugin/events/events.go, ../sm-forum-plugin/classes/forum_service.go, ../sm-forum-plugin/classes/lifecycle.go, ../sm-forum-plugin/saving_test.go, ../sm-forum-plugin/README.md</files>
<read_first>../sm-forum-plugin/events/events.go, classes/forum_service.go (CreateThread, Reply), classes/lifecycle.go (EditPost, Preview), saving_test.go (harness, TestPostSavingNoListener, TestPostSavingRejects), README.md (Features "Pre-save seam", API reference, Testing, Changelog), ../summercms.go/modules/breakwater/breakwater.go (Render, the sanitiser policy: which tags and attributes survive), ../sm-demo-app/plugins/demo/moderation.go (checkPost, read only), the Task 2 normaliser</read_first>
<behavior>
- TestMatchHTML (moderation, -short): for each forum probe, MatchHTML(defaults, breakwater.Render(probe)) is a violation: via**gra**, vi&#97;gra, _viagra_, via`gra`, via<!-- x -->gra (word "viagra"); [x](https://bit&#46;ly/a), [x](https:bit.ly), bit\.ly, a reference link [x][1] with [1]: https://bit&#46;ly/r, and an autolink <https://bit.ly/x> (link "bit.ly"). Clean Markdown (a heading, a list, a link to https://example.org/about, code with "via" in one span and "gra" in another paragraph) is not.
- Text across inline tags joins without a boundary (via<strong>gra</strong> is "viagra"); block tags and <br> separate (<p>via</p><p>gra</p> is clean); href and src values are link candidates; alt and title text is checked as words.
- TestPostSavingHTML (forum, Docker): a recording listener sees, for a thread, a reply and an edit, HTML equal to the content_html stored for that post; a body of vi&#97;gra gives HTML that contains "viagra"; TestPostSavingNoListener and TestPostSavingRejects pass unchanged.
</behavior>
<action>Per D-17 and D-18, closing the forum half of CR-03.
sm-forum-plugin:
- events/events.go: add the field `HTML` to PostSaving, documented as the content_html that would be stored, rendered by breakwater from Body (sanitised), set on every Op. Update the package and type comments: the event fires after the Markdown is rendered and before anything is persisted.
- classes/forum_service.go (CreateThread, Reply) and classes/lifecycle.go (EditPost): call `breakwater.Render(body)` before the Fire and pass the result as `HTML`; the transaction stores the same value. Behaviour without a listener is byte-identical (the render only moves up). Update the doc comments of the three methods.
- saving_test.go: add TestPostSavingHTML per the behavior block.
- README.md: Features "Pre-save seam" (fires after render, carries HTML), API reference row for PostSaving with HTML, the acme listener example also checking `ev.HTML`, Testing (TestPostSavingHTML), Changelog `### v0.1.2` (PostSaving carries the rendered HTML; additive, no route, payload, table, migration or config change). Commit in sm-forum-plugin: `feat: PostSaving carries the rendered post HTML`.
sm-moderation-plugin:
- classes/html.go: `MatchHTML(words, links []string, html string) *Violation` (pure) and `(*Filter).CheckHTML(ctx, html string) (*Violation, error)` (the same settings row, enabled switch, cache and translated message as Check). Walk the HTML with the golang.org/x/net/html tokenizer: text tokens (the tokenizer decodes entities) appended as they come, with no separator for inline elements and a newline for block elements and br; the values of href and src checked as link candidates on their own; alt and title appended as text. Then run the Task 2 matcher (both forms) on the joined text, words before links, and on each attribute URL.
- classes/html_test.go: TestMatchHTML per the behavior block, rendering with breakwater (a framework module the plugin already requires).
- README.md: Usage gets the host pattern for rendered content (check the source text with Check and the rendered HTML with CheckHTML, as in the acme example); API reference rows for MatchHTML and Filter.CheckHTML; Testing; the v0.1.1 changelog entry gains "MatchHTML and Filter.CheckHTML read rendered HTML". Commit in sm-moderation-plugin: `feat: MatchHTML and Filter.CheckHTML for rendered content`.
- Read ../sm-demo-app/plugins/demo/moderation.go and write into the SUMMARY: checkMessage needs no change; checkPost needs `CheckHTML(ctx, ev.HTML)` after title and body (field body), which 20-09 adds after bumping the demo to these tags. Do not edit sm-demo-app here.</action>
<verify>
<automated>go -C ../sm-forum-plugin vet ./... &amp;&amp; go -C ../sm-forum-plugin test -count=1 -short ./... &amp;&amp; go -C ../sm-forum-plugin test -count=1 -run '^(TestPostSavingNoListener|TestPostSavingRejects|TestPostSavingHTML|TestPostSavingTracer)$' . &amp;&amp; go -C ../sm-moderation-plugin vet ./... &amp;&amp; go -C ../sm-moderation-plugin test -count=1 -short -run '^TestMatchHTML$' -v ./classes 2>&amp;1 | grep -q -- '^--- PASS: TestMatchHTML' &amp;&amp; go -C ../sm-moderation-plugin test -count=1 ./...</automated>
<fails_when>Non-zero exit: forum vet or tests fail (the HTML field differs from the stored content_html, the no-listener path changed, a refusal stopped working), TestMatchHTML is missing or red (a rendered probe passes, clean Markdown is flagged), or any moderation test fails.</fails_when>
</verify>
<acceptance_criteria>
- `grep -cE 'HTML: *html' ../sm-forum-plugin/classes/forum_service.go` prints 2 and `grep -cE 'HTML: *html' ../sm-forum-plugin/classes/lifecycle.go` prints 1.
- `grep -c '### v0.1.2' ../sm-forum-plugin/README.md` prints 1.
- `grep -cE 'MatchHTML|CheckHTML' ../sm-moderation-plugin/README.md` prints at least 3.
</acceptance_criteria>
<done>A host can refuse a forum post by what its readers will see, and the two plugins are ready for their patch tags with every bypass pinned by a test.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| member text to the filter | untrusted chat messages, forum titles and Markdown bodies, any Unicode |
| filter to the member's browser | what passes is rendered as text, links and link cards by the chat renderer, goldmark and the WHATWG URL parser |
| admin settings to the filter | banned entries typed by an administrator, any Unicode |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-20-38 | Spoofing | banned-link matching (classes/normalize.go, filter.go) | high | mitigate | candidates are canonicalised the way browsers resolve them (percent-decoded authority, IDNA ASCII, dots mapped, port and userinfo dropped, special-scheme slashes, cleaned path) and compared with entries in the same form; TestMatchBypassLinks pins every form from CR-02 |
| T-20-39 | Tampering | banned-word matching | high | mitigate | NFKC, format characters dropped, Unicode spaces folded, diacritics folded on both sides, entities decoded, inline markup removed in a second pass; TestMatchBypassWords pins every form from CR-03 |
| T-20-40 | Tampering | forum Markdown rendered after the check | high | mitigate | PostSaving carries the rendered HTML and CheckHTML reads it as a member sees it; TestPostSavingHTML and TestMatchHTML pin the rendered forms (wired in the demo in 20-09) |
| T-20-41 | Denial of service | normalising and matching large texts | low | accept | RE2 is linear, lists are bounded by max_entries and max_entry_length, the work is two passes over a message the plugins already cap in size |
| T-20-SC | Tampering | Go module installs | high | mitigate | no new module: golang.org/x/text v0.42.0 and golang.org/x/net v0.58.0 are already direct requires of the framework and in go.sum; tidy runs with GOPROXY=off, so nothing is fetched |
</threat_model>
<verification>
- Task 1: vet, short tests, the two tracer bypass tests and the Docker TestFilterCheckNormalises.
- Task 2: the full moderation suite with Docker; every reviewer probe flagged; one existing expectation flipped on purpose.
- Task 3: forum suite with the HTML seam test and the unchanged seam tests; TestMatchHTML on breakwater output; the demo listener finding recorded for 20-09.
</verification>
<success_criteria>
Every bypass in CR-02 and CR-03 is refused by the filter and pinned by a regression test, the forum seam passes the rendered post (D-18, additive), clean text is still accepted, and both plugins are committed, untagged, ready for 20-09's release gate.
</success_criteria>
<output>
Create `.planning/phases/20-demo-instance-with-every-shared-plugin/20-07-SUMMARY.md` when done: the commits per repo, the probe table (form, before, after), the one changed expectation, the dependency note, and the listener finding for 20-09 (checkMessage unchanged, checkPost adds CheckHTML on ev.HTML).
</output>

View File

@@ -0,0 +1,185 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 07
subsystem: moderation filter (sm-moderation-plugin) and forum pre-save seam (sm-forum-plugin)
status: complete
gap_closure: true
review_findings: [CR-02, CR-03]
tags: [moderation, normalisation, idna, nfkc, forum, seam, security]
requires: [20-06]
provides:
- "classes.Match / Filter.Check normalise text and links before matching (CR-02, CR-03)"
- "classes.MatchHTML / Filter.CheckHTML read rendered HTML as members see it"
- "models.CanonicalHost; models.LinkEntry returns the IDNA ASCII host"
- "forum events.PostSaving.HTML (the content_html that is stored)"
affects: [20-09 (dependency bumps, demo listener, tags)]
tech-stack:
added: []
patterns:
- "normalise both sides: entries and text through the same fold, entry reported as listed"
- "two passes per text (as typed, without inline markup), words before links"
- "link candidates canonicalised like the WHATWG URL parser (percent-decoded authority, last @, port dropped, IDNA ASCII, special-scheme slashes, cleaned path)"
key-files:
created:
- ../sm-moderation-plugin/classes/normalize.go
- ../sm-moderation-plugin/classes/html.go
- ../sm-moderation-plugin/classes/bypass_test.go
- ../sm-moderation-plugin/classes/html_test.go
modified:
- ../sm-moderation-plugin/classes/filter.go
- ../sm-moderation-plugin/classes/filter_test.go
- ../sm-moderation-plugin/models/settings.go
- ../sm-moderation-plugin/models/settings_test.go
- ../sm-moderation-plugin/plugin_test.go
- ../sm-moderation-plugin/go.mod
- ../sm-moderation-plugin/README.md
- ../sm-forum-plugin/events/events.go
- ../sm-forum-plugin/classes/forum_service.go
- ../sm-forum-plugin/classes/lifecycle.go
- ../sm-forum-plugin/saving_test.go
- ../sm-forum-plugin/README.md
decisions:
- "Hosts go through a WHATWG-like UTS #46 profile (lookup mapping, bidi and joiner rules, CheckHyphens and STD3 off) rather than idna.Lookup, which refuses names browsers open (ab--c.example)"
- "The authority is split by hand (last @, last :) instead of net/url, which errors on escapes and odd ports and would drop the candidate"
- "The old host regexp stays as a second candidate source next to tokenising, so every host the old matcher found (url=bad.example) is still found"
- "The markup pass also drops a backslash before ASCII punctuation, so the raw check refuses bit\\.ly too"
- "Combining marks Mn and Me are dropped when folding; Cc controls that are not spaces are dropped with Cf"
metrics:
duration: 20min
started: 2026-11-02T17:29:01Z
completed: 2026-11-02T17:49:03Z
tasks: 3
files: 16
actuals:
tokens: 17100
tasks: 3
commits: 4
plan_head_before: "sm-moderation-plugin 313d117, sm-forum-plugin 13aa642 (summercms.go: no code commits)"
plan_head_after: "sm-moderation-plugin 334697b, sm-forum-plugin ec1a82c"
---
# Phase 20 Plan 07: Filter hardening for CR-02 and CR-03 Summary
The moderation filter now matches text and links the way a member reads and a browser opens them: NFKC, dropped format characters, Unicode spaces, folded diacritics, entities and inline markup for words; percent-decoding, IDNA ASCII, mapped dots, port and userinfo, special-scheme slashes and cleaned paths for links. Rendered forum HTML can be checked with `CheckHTML`, and forum's `PostSaving` now carries that HTML.
## Commits
The plan's code lives in the two sibling repos. Nothing was pushed or tagged. The `commits: 4` above was counted with `git rev-list --count` from each repo's base. The summercms.go repo has no code commits; this SUMMARY is left uncommitted for the orchestrator.
| Repo | Hash | Subject |
|------|------|---------|
| sm-moderation-plugin | 266fc60 | fix: normalise text and link hosts before matching banned entries |
| sm-moderation-plugin | 9715ce7 | fix: match banned words and links in the forms browsers show |
| sm-moderation-plugin | 334697b | feat: MatchHTML and Filter.CheckHTML for rendered content |
| sm-forum-plugin | ec1a82c | feat: PostSaving carries the rendered post HTML |
## Probe table
Lists: words `buy followers`, `casino bonus`, `free crypto`, `viagra`; links `bit.ly`, `example.com/promo`. "Before" is v0.1.0 (313d117); every row was also checked with the reviewer's scratchpad probe, which now prints no `flagged=false` line.
| Form | Before | After | Where pinned |
|------|--------|-------|--------------|
| `via<U+200B>gra`, soft hyphen, ZWJ, word joiner, BOM | clean | word viagra | TestMatchBypassWords |
| `buy<NBSP/U+2009/U+202F/U+3000>followers` | clean | word buy followers | TestMatchBypassWords |
| fullwidth `viagra` | clean | word viagra | TestMatchBypassWords |
| `vi&#97;gra`, `vi&#x61;gra` | clean | word viagra | TestMatchBypassWords, TestMatchHTML |
| `via**gra**`, ``via`gra` ``, `via~~gra~~`, `_viagra_` | clean | word viagra | TestMatchBypassWords, TestMatchHTML |
| NFD `żółw`, folded `zolw` (entry żółw) | clean | word żółw (as listed) | TestMatchBypassWords |
| `https://bit%2Ely/x`, `https://bit.l%79/x`, `bit.l%79/x` | clean | link bit.ly | TestMatchBypassLinks, TestFilterCheckNormalises |
| `https://bit.ly/x`, `bit。ly`, `bit.ly`, `bit。ly` | clean | link bit.ly | TestMatchBypassLinks |
| `https://user@bit.ly/x`, `https://example.com@bit.ly/` | flagged (the regexp found bit.ly after the @) | link bit.ly | TestMatchBypassLinks |
| `[x](https://bit&#46;ly/a)` | clean | link bit.ly | TestMatchBypassLinks, TestMatchHTML |
| `https:bit.ly`, `https:/\bit.ly/x`, `https:\\bit.ly` | flagged (regexp found the bare host) | link bit.ly | TestMatchBypassLinks |
| `https://bit.ly./x` | flagged | link bit.ly | TestMatchBypassLinks |
| `example.com:443/promo`, `/%70romo`, `//promo`, `/./promo`, `/x/../promo`, `example.com./promo` | clean | link example.com/promo | TestMatchBypassLinks |
| `https://sub.example.com/promo` | clean | link example.com/promo | TestMatchBypassLinks |
| punycode against a Unicode entry, and the reverse | clean | link (entry as listed) | TestMatchBypassLinks |
| rendered `via<!-- x -->gra`, `bit\.ly`, reference link with an entity, `<https://bit.ly/x>` | clean (raw) | flagged by MatchHTML | TestMatchHTML |
| clean: `spam_bot`, `_spam`, `spamming`, `notbit.ly`, `/about`, `/x/promo`, `bit.lyx`, `<p>via</p><p>gra</p>` | clean | clean | bypass and HTML tests |
## The one changed expectation
`TestMatchLinks`: `a.shop.example/promo` against the entry `https://shop.example/promo` was clean and now flags (KindLink, entry as listed). Path rules cover subdomains, as host rules do (CR-02). `git diff --stat 313d117 -- classes/filter_test.go` shows 2 insertions (the comment and the case) and 1 deletion. No other existing case changed.
`TestLinkEntry`: the `żółw.example` case now expects `xn--w-uga1v8h.example`. New cases cover fullwidth letters, U+3002 and U+FF61 dots, an ASCII punycode entry, `ab--c.example` (accepted) and the invalid punycode `xn--zz.example` (refused).
## Dependency note
`golang.org/x/text v0.42.0` (unicode/norm) and `golang.org/x/net v0.58.0` (idna, html) moved from indirect to direct requires of sm-moderation-plugin. The framework already requires both directly at these versions. `go mod tidy` ran with `GOPROXY=off`, go.sum did not change, and no new module entered the build. The README's Dependencies section names both. `go list -deps ./...` shows no sm-chat-plugin or sm-forum-plugin import.
## Listener finding for 20-09
`../sm-demo-app/plugins/demo/moderation.go` (read only, not edited):
- `checkMessage` needs no change: `Check` now normalises the chat text itself.
- `checkPost` should call `f.CheckHTML(ctx, ev.HTML)` after the title and body checks, and reject under field `body` when it flags. This only compiles against the new tags (sm-forum-plugin v0.1.2 for `PostSaving.HTML`, sm-moderation-plugin v0.1.1 for `CheckHTML`). The demo's go.work uses the submodule checkouts at `plugins/golem15/{forum,moderation}`, currently at v0.1.1 and v0.1.0. So the edit belongs right after 20-09 bumps those submodules.
- Even without that edit, the raw `Check` on the body now refuses `via**gra**`, `vi&#97;gra`, `_viagra_`, `[x](https://bit&#46;ly/a)`, `[x](https:bit.ly)` and `bit\.ly`. Only the forms the renderer alone resolves, such as a comment inside a word or a reference-link destination with an entity, need `CheckHTML`.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] TestPostSavingNoListener had to gain the HTML field**
- **Found during:** Task 3
- **Issue:** The plan said the existing seam tests pass unedited. But `TestPostSavingNoListener` compares whole `PostSaving` values with `slices.Equal`, so the new field made it fail.
- **Fix:** The three expected events now carry `HTML: breakwater.Render(body)`. Nothing else in the test changed. `TestPostSavingRejects`, `TestPostSavingTracer`, the golden and method-map tests are unedited and pass.
- **Files modified:** ../sm-forum-plugin/saving_test.go
- **Commit:** ec1a82c
**2. [Rule 1 - Bug] WHATWG-like IDNA profile instead of `idna.Lookup`**
- **Found during:** Task 2
- **Issue:** `idna.Lookup` checks hyphens. It refuses `ab--c.example`, a name browsers open. Used in `LinkEntry`, that would make the admin form reject a valid entry.
- **Fix:** `models.CanonicalHost` uses `idna.New(MapForLookup, BidiRule, Transitional(false), CheckHyphens(false), StrictDomainName(false), CheckJoiners(true))`, which is UTS #46 as the URL standard applies it. Punycode results are the same (`żółw.example` → `xn--w-uga1v8h.example`). It is one exported function used by both `LinkEntry` and the matcher, so entries and candidates are always read alike.
- **Files modified:** ../sm-moderation-plugin/models/settings.go
- **Commit:** 9715ce7
**3. [Rule 1 - Bug] Authority split by hand, not with net/url**
- **Issue:** `url.Parse` errors on some decoded hosts and on non-numeric ports. Each such error would silently drop a candidate.
- **Fix:** `canonicalLink` takes the text after the last `@`, drops a `:port` and passes the host to CanonicalHost. This gives the same result as `Hostname()` for valid URLs and never drops a candidate.
- **Commit:** 266fc60
**4. [Rule 2 - Missing functionality] The host regexp stays next to tokenising**
- **Issue:** The plan said to replace the regexp with tokenising. Tokens alone miss a host glued to other text (`url=bad.example`, `a,bad.example`), which the old matcher found.
- **Fix:** `matchLinks` checks the tokens first, then every `hostPattern` match (widened for percent-escapes). The union can only add matches, and every must-stay-clean case still passes.
- **Commit:** 9715ce7
**5. [Rule 2 - Missing functionality] Small additions to the normaliser**
- The markup pass also drops a backslash before ASCII punctuation (a Markdown escape), so the raw check refuses `bit\.ly`.
- Controls (Cc) that are not spaces are dropped along with Cf.
- Diacritic folding drops enclosing marks (Me) along with Mn.
- **Commit:** 266fc60, 9715ce7
**6. [Rule 2 - Test coverage] Extra tests**
- `TestFilterCheckNormalises` also covers `CheckHTML` through the stored lists: word, link with the pl message, clean, disabled.
- `TestMatchHTMLWalk` pins the tokenizer walk: inline joins, block/br/td separation, href, src, alt and title, comments and scripts.
- **Commit:** 334697b
**7. [Rule 1 - Bug] Invisible characters escaped in test sources**
- The first bypass test was committed with a literal U+200B in its source (266fc60). In 9715ce7 every invisible or combining character in the test sources became a `\uXXXX` escape, so the cases can be read and reviewed.
### TDD notes
- Task 1: RED was seen before any code changed. Both tracer tests failed with "got no violation".
- Task 2: RED was seen before the code changed: 19 "got no violation" failures across TestMatchBypassWords, TestMatchBypassLinks and the flipped TestMatchLinks case.
- Task 3: the HTML tests were written after `html.go`, and both passed on their first run. RED was not observed separately.
## Test results
- sm-moderation-plugin: `go vet ./...` is clean. `go test -short ./...` and `go test ./...` (Docker Postgres) pass. That covers TestMatchBypassWords, TestMatchBypassLinks, TestMatchHTML, TestMatchHTMLWalk, TestLinkEntry and TestFilterCheckNormalises.
- sm-forum-plugin: `go vet ./...` is clean. `go test -short ./...` and `go test ./...` (Docker) pass, including TestPostSavingTracer, TestPostSavingNoListener, TestPostSavingRejects and TestPostSavingHTML.
- Reviewer probe (scratchpad modtest): all 20 cases print `flagged=true`.
- Acceptance greps: go.mod has 2 direct x/text and x/net lines. There are 0 chat/forum deps. `HTML: html` appears 2 times in forum_service.go and once in lifecycle.go. Each README has one changelog heading (`### v0.1.1` moderation, `### v0.1.2` forum). MatchHTML/CheckHTML appear 11 times in the moderation README.
## Known limitations (not stubs)
- Path rules are prefixes, as before: `example.com/promo` also matches `/promotional`. This behaviour is older than this plan and was not changed.
- IPv4 forms a browser normalises (`0x7f.1`, dotless decimals) and IPv6 literals are not canonicalised. No listed entry in the review relies on them.
## Threat Flags
None. No new endpoint, auth path, file access or schema change. PostSaving gains a read-only field.
## Self-Check: PASSED
- FOUND: classes/normalize.go, classes/html.go, classes/bypass_test.go, classes/html_test.go (sm-moderation-plugin)
- FOUND commits: 266fc60, 9715ce7, 334697b (sm-moderation-plugin), ec1a82c (sm-forum-plugin)

View File

@@ -0,0 +1,324 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 08
type: execute
wave: 7
depends_on: ["20-06"]
gap_closure: true
review_findings: [CR-01, WR-01, WR-04, WR-05, CR-02]
files_modified:
- ../vue-chatvideo-layer/app/composables/useCall.ts
- ../vue-chatvideo-layer/app/lib/videoClient.ts
- ../vue-chatvideo-layer/app/components/Chatvideo/Call.vue
- ../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue
- ../vue-chatvideo-layer/app/assets/css/chatvideo-base.css
- ../vue-chatvideo-layer/i18n/locales/en.json
- ../vue-chatvideo-layer/i18n/locales/pl.json
- ../vue-chatvideo-layer/tests/useCall.test.ts
- ../vue-chatvideo-layer/tests/videoClient.test.ts
- ../vue-chatvideo-layer/README.md
- ../vue-chat-layer/app/lib/urlGuard.ts
- ../vue-chat-layer/app/lib/urlGuard.test.ts
- ../vue-chat-layer/app/lib/markdown.ts
- ../vue-chat-layer/app/lib/linkEmbeds.ts
- ../vue-chat-layer/app/lib/linkEmbeds.test.ts
- ../vue-chat-layer/README.md
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/composables/useDemoAuth.ts
autonomous: true
requirements: [SC-2, D-02, D-04, D-11, D-13, D-17, D-23]
estimate:
tokens: 230000
raw_tokens: 230000
tasks: 5
confidence: low
must_haves:
truths:
- "CR-01, D-13: a call the user leaves, or whose page unmounts, while start or join is pending, while livekit-client loads, while LiveKit connects or between enabling the camera and the microphone never publishes media after the leave: no Room connects after it, setCameraEnabled and setMicrophoneEnabled are not called after it, a Room already created is disconnected, and once the server session exists the starter posts end and the callee posts leave. Leave works in the starting and connecting states. A second begin while one is pending creates no second Room."
- "WR-05: a failed LiveKit connect posts end when the session has nobody joined besides this user (GET status), and leave otherwise; when status cannot be read, the starter posts end and the callee leave."
- "WR-04, D-11, D-13, D-23: ChatvideoCall starts media on mount only when an in-memory handoff younger than a minute shows the user just clicked: the DM call button's start answer (start) or the incoming prompt's Accept (join). A direct load or a chat link to /call/{id}, with or without ?start=1, shows a confirmation with a Start call or Join call button and calls neither video/start nor video/join and opens no LiveKit connection until it is clicked."
- "CR-02 (client side), D-02, D-17: the chat renders as text, with no link and no link card, any http(s) URL whose host as written is not the host the browser opens: a percent-escape, userinfo or a backslash in the authority, ideographic, fullwidth or halfwidth dots, fullwidth letters, a trailing dot, or a scheme not followed by exactly two slashes. Honest URLs, IDN hosts written in Unicode, ports, queries and fragments still link and embed. bm's copied chat tests pass unchanged."
- "WR-01, D-04: logging out (header or login page) and the chat's unauthorized() reset the chat store, close the shared realtime socket and dismiss a ringing call prompt in the same tab; one failing part does not stop the others; the next login starts from empty chat state with a fresh connection token."
- "Every fix has vitest regression tests in the repository that owns it; vue-demo-app builds and passes its tests on its current layer pins (v0.1.0 already exports useChat().reset, the realtime disconnect and useIncomingCalls().dismiss); nothing is pushed or tagged here."
artifacts:
- path: "../vue-chatvideo-layer/app/composables/useCall.ts"
provides: "per-attempt token, stale checks after every await, leave from the pre-room states, failed-connect end rule"
contains: "attempt"
- path: "../vue-chatvideo-layer/app/lib/videoClient.ts"
provides: "hasStart, rememberAccept, takeAccept and callAutostart (the click handoffs)"
contains: "callAutostart"
- path: "../vue-chatvideo-layer/app/components/Chatvideo/Call.vue"
provides: "the join confirmation"
contains: "chatvideo-confirm"
- path: "../vue-chat-layer/app/lib/urlGuard.ts"
provides: "honestHttpUrl"
contains: "honestHttpUrl"
- path: "../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts"
provides: "createCommunitySignOut and endSession"
contains: "createCommunitySignOut"
key_links:
- from: "../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue"
to: "../vue-chatvideo-layer/app/lib/videoClient.ts"
via: "Accept leaves the join handoff before it navigates"
pattern: "rememberAccept"
- from: "../vue-chatvideo-layer/app/components/Chatvideo/Call.vue"
to: "../vue-chatvideo-layer/app/lib/videoClient.ts"
via: "mount begins only when callAutostart answers true"
pattern: "callAutostart"
- from: "../vue-chat-layer/app/lib/markdown.ts"
to: "../vue-chat-layer/app/lib/urlGuard.ts"
via: "safeUrl allows an http(s) target only through honestHttpUrl"
pattern: "honestHttpUrl"
- from: "../vue-chat-layer/app/lib/linkEmbeds.ts"
to: "../vue-chat-layer/app/lib/urlGuard.ts"
via: "linkify and messageUrls parse through honestHttpUrl"
pattern: "honestHttpUrl"
- from: "../sm-demo-app/vue-demo-app/app/plugins/auth.ts"
to: "../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts"
via: "the plugin builds the sign-out and hands it to createChatAuth and to logout"
pattern: "createCommunitySignOut"
prohibitions:
- statement: "No push, tag or pin change in this plan; vue-demo-app keeps its v0.1.0 layer pins and the sm-demo-app gitlink is not bumped (20-09)."
status: unresolved
verification: judgment
- statement: "No new package in any package.json or lockfile; tests use vitest, vi.mock and pure helpers (no @vue/test-utils, which no lockfile has)."
status: unresolved
verification: automated
- statement: "Neither layer names a consuming application or a host path."
status: unresolved
verification: automated
---
## Phase Goal
ROADMAP Goal (not in user-story format; no story is invented here): sm-demo-app runs every shared plugin and its public site shows them working, video calls included.
This plan's slice (gap round after the code review, plan 8 of 9, wave 7, parallel with 20-07: no shared file): the call and session fixes from 20-REVIEW.md in the repositories that own the code.
- CR-01: leaving or unmounting during start or join still connected and published the camera and microphone.
- WR-05: a failed connect posted leave and left an empty ringing session.
- WR-04: a link opened a call and turned media on with no confirmation.
- WR-01: logout left the previous user's chat store, realtime socket and call prompt running.
- The client half of CR-02: the chat's link-embed rendering gets the guard the brief asked for; the server half is 20-07.
**Unit tests rule for this gap round:** the project rule "unit tests are the last plan of every phase" is met because every fix here ships with vitest regression tests in the repository that owns it, and 20-09 runs every touched repository's full suite before anything is tagged.
## Decisions taken in this plan (Claude's discretion, recorded)
- **One attempt token** (the review's fix shape). `begin` increments an attempt counter and dispatches `start` before its first await, for the callee too, so the state leaves idle at once and Leave and unmount always see a live attempt. After every await (the start or join answer, the livekit-client import, connect, each media toggle) it bails out when the attempt is stale. `leave()` invalidates the attempt. The call machine already moves starting → connecting on `joined`, so it needs no change.
- **Who posts what after a stale answer.** When the start or join answer arrives after a leave, the server session exists only from that moment, so `begin`'s stale branch posts `end` (starter) or `leave` (callee) itself. `leave()` posts only when an answer has already arrived for the attempt. This avoids the 404 that the current code's premature `end` produced.
- **"Alone" after a failed connect (WR-05).** The review's formula (`start || remoteParticipants.size === 0`) would end the call for a waiting caller whenever a callee's connect fails, because a room that never connected has no remote participants. The plan uses the server's view instead: GET status, alone when at most one participant has status `joined` (chatvideo marks the starter joined at start and the callee at join). Fallback on a status error: the starter ends, the callee leaves.
- **Confirmation (WR-04).** The autostart decision is a pure helper, `callAutostart(conversationId, start)`, over in-memory handoffs that a link cannot create: the call button's start answer (existing `rememberStart`, now readable with `hasStart` without taking it) and a new Accept marker (`rememberAccept`, `takeAccept`), each valid for a minute. `?start=1` stays in the demo's call path but only chooses Start over Join on the confirmation. The rule is tested as a helper because @vue/test-utils is in no lockfile (20-06 deviation 1). The demo's call page needs no code change. Its doc comment is updated together with the pin bump in 20-09, so it never describes behaviour that the pinned layer lacks.
- **Link guard (CR-02 client side).** It lives in a new `app/lib/urlGuard.ts` with `honestHttpUrl(raw)`, used by `safeUrl` (markdown.ts) and by `parseHttp` (linkEmbeds.ts). A deceptive URL stays text: no anchor and no card. The server now refuses banned ones (20-07). The client guard covers any host, so a card never shows a different host than the text. bm's copied tests (chatText.test.ts and the other four) stay byte-identical, so the new cases go into urlGuard.test.ts and linkEmbeds.test.ts.
- **Sign-out (WR-01).** The review's explicit-call option, not a `watch(loggedIn)`: the token store is document.cookie, which a useCookie watcher would not see when `unauthorized()` clears it. `createCommunitySignOut` and `endSession` are Nuxt-free factories in `app/utils/communityAuth.ts`, tested with vitest. The plugin builds the sign-out with `nuxtApp.runWithContext` and hands it to `createChatAuth` (unauthorized) and, through `$communitySignOut`, to `useDemoAuth().logout()`. SiteHeader.vue and login.vue already go through `logout()` and need no change. Clearing `chatvideo:incoming` uses `useIncomingCalls().dismiss()`, which also stops the ring timer and closes the session handle. The handle leak between two pending subscribes is IN-07 and stays deferred.
- spec-less probe fallback skipped: phase has no requirement IDs to probe (visible skip).
<objective>
Make leaving a call final at any moment, end empty sessions after a failed connect, ask before a call page starts the camera and microphone, keep deceptive link hosts out of chat links and cards, and reset the previous user's chat, socket and call prompt on logout.
Purpose: D-13 (the minimal call page) and D-11/D-23 (DM calls from the call button) behave as the user expects. D-02 and D-17 hold in the chat renderer. D-04 holds after logout (no chat for a signed-out visitor).
Output: commits in ../vue-chatvideo-layer, ../vue-chat-layer and ../sm-demo-app/vue-demo-app (not pushed, not tagged, pins unchanged), each with vitest regression tests.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-CONTEXT.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-06-SUMMARY.md
Repos: ../vue-chatvideo-layer (main at 8222255, tag v0.1.0), ../vue-chat-layer (main at b6d3389, tag v0.1.0; 764cb42 and b6d3389 are already on main after the tag), ../sm-demo-app/vue-demo-app (the submodule, master at deb809f; pins vue-chat-layer and vue-chatvideo-layer v0.1.0 by git+https tag). Test runners: `pnpm --dir <repo> test` (vitest 3.2.7); the layers' SFCs compile with `pnpm --dir <layer> run build:playground`; vue-demo-app builds with `pnpm --dir ../sm-demo-app/vue-demo-app run build`.
Rules: no co-author tags; stage files by explicit path; no push, tag or pin change (20-09); a layer's README changes in the same commit as its API; the layers name no application; check `git status` in each repo before editing and leave edits that are not this plan's alone (vue-demo-app often has a stale `nuxt dev` from 2026-10-22 running, pids 212159 and 212194, leave it alone). Do not edit sm-demo-app itself; its browser checks for these fixes are written in 20-09 Task 1, where they run against the unreleased layers.
<interfaces>
vue-chatvideo-layer today:
- app/composables/useCall.ts: `useCall(conversationId)` returns {state, tiles, declined, audioBlocked, reconnecting, mediaError, begin(start), leave(), toggleMute(), toggleCamera(), startAudio()}; module-level `room`, `lk`, `channel`, `leaving`; begin: guard on `status !== 'idle' && isLive`, `dispatch start` only for the starter, `await client.start/join` (or takeStart), `joined`, pagehide listener, `openChannel(session_id)`, `await import('livekit-client')`, `room = new Room(...)`, `await r.connect`, a check that room is still r, `connected`, `await setCameraEnabled(true)`, `await setMicrophoneEnabled(true)`; on connect failure it posts leave. `leave()` returns early on idle; it posts end when alone (no room or no remote participants) else leave, then disconnects. onBeforeUnmount calls leave.
- app/lib/callMachine.ts: states idle, starting, connecting, connected, ended, failed; `joined` accepted from idle or starting; `isLive`; unchanged by this plan.
- app/lib/videoClient.ts: `createVideoClient` {start, join, leave, end, status → VideoStatus {session_id, conversation_id, status, started_by, participants [{user_id, status}]} or null}; `rememberStart`/`takeStart` (in-memory, a minute, taken once); `videoSessionChannel`; `parseIncomingCall`.
- Call.vue: props conversationId, start, backPath; `onMounted(() => call.begin(props.start))`; Leave enabled while starting, connecting or connected; retry calls begin. IncomingCall.vue: `accept()` takes the pending call and navigates to callPath; decline posts leave. Locale keys chatvideo.state.*, chatvideo.action.*, chatvideo.reason.*.
- tests/useCall.test.ts: vi.mock of livekit-client (fake Room with connect, disconnect, localParticipant setters as vi.fn, `Room.instances`, `failConnect`, `onCreate`), vi.mock of vue-chat-layer realtime (`realtime.subs`), unmount hooks captured, a stub client (start, join, leave, end, status as vi.fn), `connected(start)` helper. The test "a failed LiveKit connect fails the call and leaves the session" expects leave; WR-05 changes it.
- chatvideo server facts: Start creates the session with the starter's participant row `joined` and the others `invited`; Join marks the actor `joined`; Leave marks `left`.
vue-chat-layer today: app/lib/markdown.ts `safeUrl(raw)` (http(s) with `//` and a non-slash, mailto, site paths, anchors), `escapeHtml`, `formatSpans`; app/lib/chatText.ts `renderChatText` (LINK_RE, URL_RE through safeUrl); app/lib/linkEmbeds.ts `parseHttp(raw)` (new URL, http(s) only), `linkify`, `messageUrls`, `registerEmbedRenderer`, `embedRendererFor`; Chat/LinkEmbed.vue shows url.host and links url.href; useChat `reset()` (exported in v0.1.0); app/lib/realtime.ts `disconnect()` (exported in v0.1.0).
vue-demo-app today: app/utils/communityAuth.ts {CommunityTokens, CommunityFetch, tokenGetter, createChatAuth(store, fetchJson) → {token, refresh, unauthorized}, friendsDirectory}; app/plugins/auth.ts provides paymentGatewayAuth, chatAuth, forumAuth, userfriendsAuth, userfriendsDirectory and calls setRealtimeAuth; app/composables/useDemoAuth.ts `logout()` posts /_user/api/v1/logout with the token, then `token.value = null`; app/lib/realtime.ts re-exports vue-chat-layer's realtime (disconnect included); app/layouts/default.vue renders ChatFloatingPanel and ChatvideoIncomingCall for members.
</interfaces>
</context>
<tasks>
<task type="tracer">
<name>Task 1: Tracer: the caller clicks Leave while the call is still starting, and nothing connects or turns on afterwards, under test</name>
<precondition>`git -C ../vue-chatvideo-layer status --porcelain` prints nothing; `pnpm --dir ../vue-chatvideo-layer test` passes before the change.</precondition>
<files>../vue-chatvideo-layer/app/composables/useCall.ts, ../vue-chatvideo-layer/tests/useCall.test.ts</files>
<read_first>../vue-chatvideo-layer/app/composables/useCall.ts (whole file), app/lib/callMachine.ts, tests/useCall.test.ts (whole file: the fakes, beforeEach, the connected helper, every existing test), 20-REVIEW.md CR-01</read_first>
<action>Per D-13, closing the caller path of CR-01 end to end.
1. Red first: in tests/useCall.test.ts add a small deferred-promise helper and the test "leave while start is pending: no room, no media, end once the session exists". `client.start` answers a deferred promise; call `begin(true)` without awaiting it, `await leave()`, then resolve the start answer and await the begin promise. Expect: no fake Room was connected (`Room.instances` empty, or none of them had connect called), setCameraEnabled and setMicrophoneEnabled never called, `client.end` called once with the conversation id after the answer arrived, the state ended with reason left, no open session channel, no pagehide listener. Run it and see it fail.
2. useCall.ts: add the per-attempt counter. begin increments it and keeps its own number, resets `leaving`, dispatches `start` before the first await (for both roles), and after the start or join answer checks whether the attempt is stale (another attempt started or leave ran); if so it posts `end` for a start or `leave` for a join (errors swallowed) and returns before subscribing, adding the pagehide listener or loading livekit-client. leave() no longer returns early while an attempt is in flight in the starting state: it marks leaving, invalidates the attempt, dispatches leave, posts end or leave only when this attempt already has its answer, and disconnects.
3. Keep every existing test green; update the module header comment (begin, leave and unmount semantics).
4. Commit in vue-chatvideo-layer: `fix: leaving while a call starts never connects it`.</action>
<verify>
<automated>pnpm --dir ../vue-chatvideo-layer test</automated>
<fails_when>Non-zero exit: the new test fails (a Room connects, a media setter runs, end is posted before or never, the state is not ended) or an existing useCall, callMachine or videoClient test breaks.</fails_when>
</verify>
<acceptance_criteria>
- `grep -c 'leave while start is pending' ../vue-chatvideo-layer/tests/useCall.test.ts` prints 1.
- `git -C ../vue-chatvideo-layer diff --stat 8222255 -- package.json pnpm-lock.yaml` prints nothing.
</acceptance_criteria>
<done>A caller who hangs up during "Connecting…" is out of the call for good: the late start answer ends the session and no camera or microphone turns on.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Every other moment of leaving is final too (callee join, unmount, livekit-client load, connect, between camera and microphone, a second begin), and a failed connect ends an empty session</name>
<files>../vue-chatvideo-layer/app/composables/useCall.ts, ../vue-chatvideo-layer/tests/useCall.test.ts, ../vue-chatvideo-layer/README.md</files>
<read_first>The Task 1 code and test, tests/useCall.test.ts (the fake Room's connect and setters, failConnect, onCreate, the unmount hooks), app/lib/videoClient.ts (status, VideoStatus), README.md (Usage, "The call flow", API reference, Testing)</read_first>
<behavior>
- "unmount while join is pending": begin(false) with a deferred join, run the captured unmount hook, resolve the join; no Room connects, no media setter runs, client.leave is posted once after the answer, state ended.
- "leave while connect is pending": connect answers a deferred promise; leave; resolve connect; setCameraEnabled and setMicrophoneEnabled never called, the Room disconnected, end posted once (alone).
- "leave between camera and microphone": setCameraEnabled answers a deferred promise; leave; resolve it; setMicrophoneEnabled never called, the Room disconnected.
- "leave while livekit-client loads": the import is awaited after the answer; stall it with a hoisted deferred gate in the mocked module if vitest allows it reliably, otherwise call leave in the same tick the answer resolves (the stale check right after the answer) and say which in the SUMMARY; no Room created after the leave, end posted once.
- "a second begin while the first join is pending": two begin(false) calls before the answer; join called once, at most one Room ever created and connected.
- WR-05 "a failed connect ends a session nobody else joined": failConnect set, client.status answers participants [{user_id: 7, status: 'joined'}, {user_id: 9, status: 'invited'}]; client.end posted, client.leave not. "a failed connect leaves when the other side joined": status answers two joined participants; client.leave posted, client.end not. "status unreadable": status rejects; the starter posts end, the callee posts leave.
- The existing test "a failed LiveKit connect fails the call and leaves the session" is renamed and changed to the WR-05 rule: the stub's status answers undefined, which counts as unreadable (as do null and a rejection), so the starter ends; every other existing expectation stays.
</behavior>
<action>Per D-13 and D-12 (the reconcile job and ringing behave as designed), closing the rest of CR-01 and WR-05.
- useCall.ts: after the livekit-client import, return when stale (no Room is created); after `connect` resolves, when stale disconnect that Room (disconnect(true), errors swallowed) and return; check staleness before each of setCameraEnabled and setMicrophoneEnabled, and after the camera, so a leave between them disconnects and skips the microphone; the Disconnected handler and finish() keep working for the current attempt only. On a connect failure: dispatch error, disconnect, then ask `client.status(conversationId)`; post end when at most one participant has status joined, else leave; on a status error post end for a start and leave for a join. Remove nothing else (tiles, declined, audio, reconnecting stay as they are).
- tests/useCall.test.ts: the behavior block's tests; keep the fakes, extend them only where a deferred is needed.
- README.md: "The call flow" says Leave works at any moment and what is posted when, the WR-05 rule, and Testing lists the new tests.
- Commit in vue-chatvideo-layer: `fix: a call left at any moment stays left, and a failed connect ends an empty session`.</action>
<verify>
<automated>pnpm --dir ../vue-chatvideo-layer test</automated>
<fails_when>Non-zero exit: any behavior-block test fails (media published after a leave, a second Room, a stale branch posting the wrong call, WR-05 posting leave for an empty session) or an existing test breaks.</fails_when>
</verify>
<acceptance_criteria>
- `grep -cE "test\('(unmount while join is pending|leave while connect is pending|leave between camera and microphone|a second begin while the first join is pending)" ../vue-chatvideo-layer/tests/useCall.test.ts` prints 4.
- `grep -c 'a failed connect ends a session nobody else joined' ../vue-chatvideo-layer/tests/useCall.test.ts` prints 1.
</acceptance_criteria>
<done>Whatever the moment a user leaves or navigates away, the camera and microphone stay off and the session is closed the right way, and a call that could not connect does not keep ringing.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: The call page asks before it starts media, unless the user just clicked the call button or Accept</name>
<files>../vue-chatvideo-layer/app/lib/videoClient.ts, ../vue-chatvideo-layer/app/components/Chatvideo/Call.vue, ../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue, ../vue-chatvideo-layer/app/assets/css/chatvideo-base.css, ../vue-chatvideo-layer/i18n/locales/en.json, ../vue-chatvideo-layer/i18n/locales/pl.json, ../vue-chatvideo-layer/tests/videoClient.test.ts, ../vue-chatvideo-layer/README.md</files>
<read_first>app/lib/videoClient.ts (the handoff block: HANDOFF_MS, rememberStart, takeStart), app/components/Chatvideo/Call.vue, CallButton.vue, IncomingCall.vue, app/assets/css/chatvideo-base.css (button and note styles), i18n/locales/en.json and pl.json, tests/videoClient.test.ts (the handoff tests), README.md (Usage, Components, "The call flow"), ../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue and app/pages/chat.vue (how the demo passes start and callPath; read only), 20-REVIEW.md WR-04</read_first>
<behavior>
- callAutostart(id, true) is false on a direct load; true right after rememberStart(id, …) within a minute, and begin's takeStart still receives that answer (hasStart does not take it); false after a minute; false for another conversation.
- callAutostart(id, false) is false on a direct load; true once right after rememberAccept(id) within a minute, then false (taken); false after a minute; false for another conversation; a start handoff does not make a join autostart.
- takeStart behaves as before (the existing handoff tests stay).
</behavior>
<action>Per D-11, D-13 and D-23, closing WR-04.
- app/lib/videoClient.ts: add `hasStart(conversationId, now?)` (a start answer younger than HANDOFF_MS is waiting; not taken), `rememberAccept(conversationId, now?)` and `takeAccept(conversationId, now?)` (an Accept marker, a minute, taken once; in memory, never in a URL or storage), and `callAutostart(conversationId, start, now?)` (start: hasStart; join: takeAccept). Doc comments say why: a link can open the call route but cannot create a handoff.
- IncomingCall.vue: accept() calls rememberAccept for the conversation before it navigates.
- Call.vue: on mount, begin only when callAutostart answers true; otherwise the idle state renders a confirmation block (class `chatvideo-confirm`) with the text chatvideo.confirm.start or chatvideo.confirm.join and one button (classes `chatvideo-button chatvideo-confirm__go`, label chatvideo.action.startCall or chatvideo.action.joinCall) that calls begin(start), plus the back link when backPath is set. Live, ended and failed states render as today; Retry stays an explicit click. Update the component's header comment (media starts only after a click on this page, the call button or Accept).
- Locales en and pl: confirm.start, confirm.join (each says the camera and microphone turn on after the click), action.startCall, action.joinCall. chatvideo-base.css: the confirm block in the existing card and button style.
- tests/videoClient.test.ts: the behavior block.
- README.md: Components (ChatvideoCall's confirmation; `start` picks Start or Join), "The call flow" (autostart only after the call button or Accept; a direct load or a link asks), API reference (hasStart, rememberAccept, takeAccept, callAutostart), Usage (the ?start=1 example now only selects Start), Testing.
- Commit in vue-chatvideo-layer: `feat: the call page asks before it starts the camera and microphone`.</action>
<verify>
<automated>pnpm --dir ../vue-chatvideo-layer test &amp;&amp; pnpm --dir ../vue-chatvideo-layer run build:playground</automated>
<fails_when>Non-zero exit: a handoff test fails (a direct load autostarts, Accept does not, hasStart takes the answer, a marker outlives a minute or crosses conversations), an earlier test breaks, or the playground build fails to compile Call.vue or IncomingCall.vue.</fails_when>
</verify>
<acceptance_criteria>
- `grep -c 'callAutostart' ../vue-chatvideo-layer/app/components/Chatvideo/Call.vue` prints at least 1 and `grep -c 'rememberAccept' ../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue` prints at least 1.
- `node -e "for (const l of ['en','pl']) { const c = require('../vue-chatvideo-layer/i18n/locales/' + l + '.json').chatvideo; if (!c.confirm?.start || !c.confirm?.join || !c.action?.startCall || !c.action?.joinCall) process.exit(1) }"` exits 0.
- `grep -rniE 'golem15\.demo|sm-demo|demo\.summercms' ../vue-chatvideo-layer/app ../vue-chatvideo-layer/README.md | wc -l` prints 0.
</acceptance_criteria>
<done>Opening a call link shows a clear Start call or Join call button and nothing turns on until it is clicked, while the call button and Accept still go straight into the call.</done>
</task>
<task type="auto" tdd="true">
<name>Task 4: The chat renders deceptive link hosts as text, never as a link or a link card</name>
<files>../vue-chat-layer/app/lib/urlGuard.ts, ../vue-chat-layer/app/lib/urlGuard.test.ts, ../vue-chat-layer/app/lib/markdown.ts, ../vue-chat-layer/app/lib/linkEmbeds.ts, ../vue-chat-layer/app/lib/linkEmbeds.test.ts, ../vue-chat-layer/README.md</files>
<read_first>../vue-chat-layer/app/lib/markdown.ts, app/lib/chatText.ts (LINK_RE, URL_RE, how safeUrl is used), app/lib/linkEmbeds.ts, app/lib/linkEmbeds.test.ts, app/components/Chat/LinkEmbed.vue, README.md (link embeds section, Testing), 20-REVIEW.md CR-02 (the table and the rendering paragraph)</read_first>
<behavior>
- honestHttpUrl refuses (returns null): https://bit%2Ely/x, https://bit.l%79/x, https://bit.ly/x, https://bit。ly/x, https://bit.ly/x, https://bit。ly/x, https://user@bit.ly/x, https://example.com@bit.ly/, https:/\bit.ly/x, https://\bit.ly/x, https://bit.ly./x, javascript: and data: URLs, and anything new URL cannot parse.
- honestHttpUrl accepts: https://bit.ly/x, http://example.com:8080/a?b=c#d, https://żółw.example/ (an IDN written in Unicode), https://xn--w-uga1v8h.example/, https://sub.example.org/path.
- renderChatText of each refused URL, bare and as [label](url), contains no anchor (the text shows as written, escaped); messageUrls of a text holding them returns none; linkify leaves them as text. The accepted URLs still render as links and still yield cards.
- bm's copied tests (chatEvents, chatFormat, chatText, chatUnread, realtime) pass byte-identical.
</behavior>
<action>Per D-02 (generic link embeds) and D-17, the client half of CR-02.
- app/lib/urlGuard.ts (new): `honestHttpUrl(raw: string): URL | null`. The URL must parse with new URL as http or https, and the scheme must be followed by exactly two slashes. The authority as written, up to the first slash, question mark or hash, must hold no percent sign, no at sign and no backslash. The host as written must hold none of U+3002, U+FF0E and U+FF61, must be unchanged by NFKC (no fullwidth or compatibility characters), and must not end with a dot. Its lower-cased form must equal url.hostname, or, for a host with non-ASCII letters, it must be in NFC with only U+002E as the separator. Doc comment: the chat links and embeds only URLs whose written host is the host the browser opens, so a card never shows a host the text does not.
- markdown.ts: safeUrl allows an http(s) target only when honestHttpUrl accepts it (mailto, site paths and anchors unchanged). linkEmbeds.ts: parseHttp delegates to honestHttpUrl, so linkify and messageUrls skip deceptive URLs.
- app/lib/urlGuard.test.ts (new): the behavior block, including renderChatText cases (import it from ./chatText). linkEmbeds.test.ts: messageUrls and linkify cases for two refused and two accepted URLs.
- README.md: the link embeds section describes the guard; Testing lists urlGuard.test.ts.
- Commit in vue-chat-layer: `fix: deceptive link hosts render as text, not links or cards`.</action>
<verify>
<automated>pnpm --dir ../vue-chat-layer test &amp;&amp; git -C ../vue-chat-layer diff --quiet b6d3389 -- app/lib/chatEvents.test.ts app/lib/chatFormat.test.ts app/lib/chatText.test.ts app/lib/chatUnread.test.ts app/lib/realtime.test.ts</automated>
<fails_when>Non-zero exit: a guard test fails (a deceptive URL becomes an anchor or a card, an honest or IDN URL stops linking), a store, client or embed test breaks, or one of bm's copied test files was edited.</fails_when>
</verify>
<acceptance_criteria>
- `grep -c 'honestHttpUrl' ../vue-chat-layer/app/lib/markdown.ts` and `grep -c 'honestHttpUrl' ../vue-chat-layer/app/lib/linkEmbeds.ts` each print at least 1.
- `grep -rniE 'golem15\.demo|sm-demo|demo\.summercms' ../vue-chat-layer/app ../vue-chat-layer/README.md | wc -l` prints 0.
</acceptance_criteria>
<done>A message can no longer show a working link or a link card to a host it hides behind escapes, dots or userinfo; honest links work as before.</done>
</task>
<task type="auto" tdd="true">
<name>Task 5: Logging out resets the chat, closes the realtime socket and clears a ringing call in the same tab</name>
<files>../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts, ../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts, ../sm-demo-app/vue-demo-app/app/plugins/auth.ts, ../sm-demo-app/vue-demo-app/app/composables/useDemoAuth.ts</files>
<read_first>../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts and communityAuth.test.ts (whole files), app/plugins/auth.ts, app/composables/useDemoAuth.ts (whole file), app/components/SiteHeader.vue and app/pages/login.vue (their logout calls), app/lib/realtime.ts (the re-export), app/layouts/default.vue, vitest.config.ts, ../vue-chat-layer/app/composables/useChat.ts (reset, lines around 1514) and app/lib/realtime.ts (disconnect), ../vue-chatvideo-layer/app/composables/useIncomingCalls.ts (dismiss), 20-REVIEW.md WR-01</read_first>
<behavior>
- createCommunitySignOut({resetChat, disconnectRealtime, dismissCall}) runs the three in that order; a part that throws does not stop the next ones; calling it twice is safe.
- createChatAuth(store, fetch, onSignedOut): unauthorized() clears the token, then calls onSignedOut once; without onSignedOut it behaves as before (the existing tests pass unchanged).
- endSession(token, postLogout, clearToken, signOut): with a token it posts logout with that token, clears the token even when the post rejects, then signs out once; without a token it posts nothing and still clears and signs out.
</behavior>
<action>Per D-04 (no chat for a signed-out visitor), closing WR-01.
- app/utils/communityAuth.ts: add `createCommunitySignOut(parts)` and `endSession(token, postLogout, clearToken, signOut)` (Nuxt-free, doc comments), and an optional third parameter `onSignedOut` on `createChatAuth`, called by unauthorized() after the token is cleared. Update the file header.
- app/plugins/auth.ts: take the nuxtApp argument; build the sign-out with createCommunitySignOut whose parts run only in the browser: resetChat runs useChat().reset() inside nuxtApp.runWithContext, disconnectRealtime calls disconnect from ~/lib/realtime, dismissCall runs useIncomingCalls().dismiss() inside nuxtApp.runWithContext. Pass it to createChatAuth and provide it as `communitySignOut`. Update the header comment.
- app/composables/useDemoAuth.ts: read `$communitySignOut` from useNuxtApp() when the composable is created (before any await, so the Nuxt context is still there), and make logout() delegate to endSession with the current token, the existing logout POST, a clear that sets the token to null, and that sign-out. SiteHeader.vue and login.vue keep calling logout() unchanged.
- app/utils/communityAuth.test.ts: the behavior block, next to the existing tests.
- Commit in vue-demo-app only (not pushed; the sm-demo-app gitlink is bumped in 20-09): `fix: logging out resets the chat, closes the realtime socket and clears a ringing call`.</action>
<verify>
<automated>pnpm --dir ../sm-demo-app/vue-demo-app test &amp;&amp; pnpm --dir ../sm-demo-app/vue-demo-app run build</automated>
<fails_when>Non-zero exit: a sign-out or endSession test fails, an existing auth hook test breaks, or the site build fails (a missing auto-import or a layer API that v0.1.0 does not export).</fails_when>
</verify>
<acceptance_criteria>
- `grep -c 'createCommunitySignOut' ../sm-demo-app/vue-demo-app/app/plugins/auth.ts` prints at least 1 and `grep -c 'endSession' ../sm-demo-app/vue-demo-app/app/composables/useDemoAuth.ts` prints at least 1.
- `git -C ../sm-demo-app/vue-demo-app diff --stat deb809f -- package.json pnpm-lock.yaml app/components/SiteHeader.vue` prints nothing.
- `git -C ../sm-demo-app status --porcelain -- vue-demo-app` prints ` M vue-demo-app` (the gitlink moved, not staged; 20-09 commits the bump).
</acceptance_criteria>
<done>After logout nothing of the previous member stays in the tab: no chat state, no open socket, no ringing prompt, and the next member starts clean.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| browser camera and microphone to LiveKit | media leaves the device once a Room is connected and tracks are published |
| chat links to the call route | any member can post a same-site link to /call/{id} |
| chat text to rendered links and cards | member-written URLs become anchors and cards |
| one browser tab, two accounts | the previous member's state must not reach the next one |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-20-42 | Information disclosure | useCall (camera and microphone after leave) | critical | mitigate | per-attempt token checked after every await; leave invalidates it; a stale branch disconnects any Room and never calls the media setters; useCall tests pin each moment (start, join, import, connect, between camera and microphone, unmount, second begin) |
| T-20-43 | Elevation of privilege | /call/{id} opened from a link | high | mitigate | media starts on mount only with an in-memory handoff a link cannot create (call button start answer, Accept marker, a minute, taken once); otherwise the confirmation waits for a click; callAutostart tests |
| T-20-44 | Information disclosure | chat store, realtime socket and call prompt after logout | high | mitigate | logout and unauthorized run the community sign-out (reset, disconnect, dismiss), each part isolated; communityAuth tests; 20-09 adds a browser check that the socket closes |
| T-20-45 | Denial of service | empty ringing session after a failed connect | medium | mitigate | the failed-connect branch ends the session when GET status shows nobody else joined; tests for both outcomes and for an unreadable status |
| T-20-46 | Spoofing | deceptive hosts in chat anchors and link cards | high | mitigate | honestHttpUrl refuses escapes, userinfo, backslashes, compatibility dots and letters, trailing dots and malformed scheme separators before safeUrl, linkify or messageUrls produce a link or card; urlGuard tests |
| T-20-SC | Tampering | npm installs | high | mitigate | no package or lockfile change in this plan; acceptance checks the layer manifests are untouched |
</threat_model>
<verification>
- Task 1: vue-chatvideo-layer tests with the caller leave-during-start test.
- Task 2: the remaining CR-01 moments and WR-05 under test.
- Task 3: handoff tests and the playground build compiling the changed components.
- Task 4: vue-chat-layer tests with the guard, bm's copied tests untouched.
- Task 5: vue-demo-app tests and build on the v0.1.0 pins.
</verification>
<success_criteria>
CR-01, WR-01, WR-04, WR-05 and the client half of CR-02 are fixed in the repositories that own the code, each with regression tests; nothing is pushed, tagged or re-pinned, so 20-09 can run the full suites, integrate the unreleased layers locally and release them.
</success_criteria>
<output>
Create `.planning/phases/20-demo-instance-with-every-shared-plugin/20-08-SUMMARY.md` when done: the commits per repo, the new tests per finding, the changed expectation of the failed-connect test, the new layer exports (hasStart, rememberAccept, takeAccept, callAutostart, honestHttpUrl) and class names (chatvideo-confirm, chatvideo-confirm__go) that 20-09's browser checks use.
</output>

View File

@@ -0,0 +1,253 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 08
subsystem: chat-video-frontend
tags: [vue, nuxt, livekit, vitest, chat, video, auth, gap-closure]
status: complete
gap_closure: true
review_findings: [CR-01, WR-01, WR-04, WR-05, CR-02]
requires:
- phase: 20-06
provides: "useCall on a fake Room, the chat layer's tests, the community auth hooks and their tests"
provides:
- "useCall: a per-attempt token with stale checks after every await; leave works and is final at any moment"
- "useCall: a failed connect (or livekit-client import) ends a session nobody else joined (GET status)"
- "videoClient: hasStart, rememberAccept, takeAccept, callAutostart (click handoffs)"
- "ChatvideoCall: confirmation (chatvideo-confirm, chatvideo-confirm__go) unless the call button or Accept just handed over"
- "vue-chat-layer: honestHttpUrl (app/lib/urlGuard.ts), used by safeUrl, linkify and messageUrls"
- "vue-demo-app: createCommunitySignOut and endSession; logout and unauthorized() reset the chat, close the socket and dismiss the ring"
affects: [20-09]
actuals:
tokens: 16745 # chars/4 over the three repos' diffs (8222255..HEAD, b6d3389..HEAD, deb809f..HEAD)
tasks: 5
commits: 5 # measured per repo: vue-chatvideo-layer 3, vue-chat-layer 1, vue-demo-app 1; none in summercms.go
plan_head_before: "vue-chatvideo-layer 8222255, vue-chat-layer b6d3389, vue-demo-app deb809f"
plan_head_after: "vue-chatvideo-layer 5386903, vue-chat-layer a798bb1, vue-demo-app 188ae25"
tech-stack:
added: []
patterns:
- "Per-attempt object ({start, answered, left}) plus a stale() closure checked after every await of an async lifecycle"
- "In-memory click handoffs (a minute, taken once) as proof of user intent before media starts"
- "A written-host-equals-opened-host guard before any anchor or link card is produced"
- "A Nuxt-free sign-out factory whose parts run isolated, wired by the plugin with runWithContext"
key-files:
created:
- ../vue-chat-layer/app/lib/urlGuard.ts
- ../vue-chat-layer/app/lib/urlGuard.test.ts
modified:
- ../vue-chatvideo-layer/app/composables/useCall.ts
- ../vue-chatvideo-layer/app/lib/videoClient.ts
- ../vue-chatvideo-layer/app/components/Chatvideo/Call.vue
- ../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue
- ../vue-chatvideo-layer/app/assets/css/chatvideo-base.css
- ../vue-chatvideo-layer/i18n/locales/en.json
- ../vue-chatvideo-layer/i18n/locales/pl.json
- ../vue-chatvideo-layer/tests/useCall.test.ts
- ../vue-chatvideo-layer/tests/videoClient.test.ts
- ../vue-chatvideo-layer/README.md
- ../vue-chat-layer/app/lib/markdown.ts
- ../vue-chat-layer/app/lib/linkEmbeds.ts
- ../vue-chat-layer/app/lib/linkEmbeds.test.ts
- ../vue-chat-layer/README.md
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/composables/useDemoAuth.ts
key-decisions:
- "A stale start or join answer closes its session (end for the caller, leave for the callee) only when no newer attempt replaced it; a newer attempt owns the session"
- "leave() before the call connects posts end for the caller and leave for the callee (not the room-based alone rule), and only once the attempt has its answer"
- "WR-05 uses the server's view: GET status, end when at most one participant is joined; unreadable status (null, undefined, rejection) falls back to end for the caller and leave for the callee. The same rule applies to a failed livekit-client import"
- "callAutostart: start needs a waiting start answer (hasStart, left for begin to take); join takes an Accept marker. ?start=1 only chooses Start call over Join call"
- "honestHttpUrl also refuses invisible characters (Default_Ignorable_Code_Point, Cf) in a host, which the Unicode-host branch would otherwise accept"
patterns-established:
- "Leaving at every await of begin() is a test: deferred promises for start, join, connect and the camera setter, and a gated vi.doMock of livekit-client for the import"
requirements-completed: [SC-2, D-02, D-04, D-11, D-13, D-17, D-23]
coverage:
- id: D1
description: "CR-01: leaving or unmounting at any moment of a call attempt never connects a Room or turns on media afterwards"
requirement: D-13
verification:
- kind: unit
ref: "../vue-chatvideo-layer/tests/useCall.test.ts (leave while start is pending; unmount while join is pending; leave while livekit-client loads; leave while connect is pending; a connect that fails after a leave posts nothing more; leave between camera and microphone; a second begin while the first join is pending)"
status: pass
- id: D2
description: "WR-05: a failed connect ends a session nobody else joined, else leaves"
requirement: D-13
verification:
- kind: unit
ref: "../vue-chatvideo-layer/tests/useCall.test.ts (a failed LiveKit connect fails the call; an unreadable status ends the starter's session; a failed connect ends a session nobody else joined; a failed connect leaves when the other side joined; a failed connect with an unreadable status: the starter ends, the callee leaves)"
status: pass
- id: D3
description: "WR-04: the call page asks before media unless the call button or Accept just handed over"
requirement: D-11
verification:
- kind: unit
ref: "../vue-chatvideo-layer/tests/videoClient.test.ts (describe call autostart)"
status: pass
- kind: other
ref: "pnpm --dir ../vue-chatvideo-layer run build:playground (Call.vue and IncomingCall.vue compile)"
status: pass
- id: D4
description: "CR-02 client side: deceptive link hosts render as text, never as a link or a card"
requirement: D-17
verification:
- kind: unit
ref: "../vue-chat-layer/app/lib/urlGuard.test.ts; ../vue-chat-layer/app/lib/linkEmbeds.test.ts"
status: pass
- id: D5
description: "WR-01: logout and unauthorized() reset the chat, close the socket and dismiss the ring"
requirement: D-04
verification:
- kind: unit
ref: "../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts (createChatAuth with a sign-out, createCommunitySignOut, endSession)"
status: pass
- kind: other
ref: "pnpm --dir ../sm-demo-app/vue-demo-app run build on the v0.1.0 pins"
status: pass
duration: 14min
completed: 2026-11-02
---
# Phase 20 Plan 08: Call and session fixes Summary
**Leaving a call is now final at any await of the attempt (per-attempt token with stale checks), a failed connect ends an empty session from GET status, the call page asks before media unless the call button or Accept handed over in memory, the chat renders deceptive link hosts as text through `honestHttpUrl`, and logout resets the chat, the realtime socket and the ring in the same tab.**
## Performance
- **Duration:** about 14 min
- **Started:** 2026-11-02T17:25:39Z
- **Completed:** 2026-11-02T17:39:00Z
- **Tasks:** 5 of 5
- **Files modified:** 20 (2 created) across three repositories
## Commits per repository
Nothing was pushed or tagged. vue-demo-app keeps its v0.1.0 layer pins. The sm-demo-app gitlink moved but is not staged (` M vue-demo-app`); 20-09 bumps it.
| Repo | Hash | Subject |
|------|------|---------|
| ../vue-chatvideo-layer | 69e8b83 | fix: leaving while a call starts never connects it |
| ../vue-chatvideo-layer | 27ad81c | fix: a call left at any moment stays left, and a failed connect ends an empty session |
| ../vue-chatvideo-layer | 5386903 | feat: the call page asks before it starts the camera and microphone |
| ../vue-chat-layer | a798bb1 | fix: deceptive link hosts render as text, not links or cards |
| ../sm-demo-app/vue-demo-app | 188ae25 | fix: logging out resets the chat, closes the realtime socket and clears a ringing call |
## Test results
| Suite | Before | After |
|-------|--------|-------|
| vue-chatvideo-layer `pnpm test` | 114 | 127 passed (3 files) |
| vue-chat-layer `pnpm test` | 146 | 215 passed (10 files) |
| vue-demo-app `pnpm test` | 218 | 225 passed (18 files) |
- `pnpm --dir ../vue-chatvideo-layer run build:playground` passed. So did `pnpm --dir ../vue-chat-layer run build:playground` and `pnpm --dir ../sm-demo-app/vue-demo-app run build` (v0.1.0 pins). In the built bundle, the plugin calls the resolved `useChat().reset()`, `disconnect()` and `useIncomingCalls().dismiss()`.
- The SPA's copied chat tests (chatEvents, chatFormat, chatText, chatUnread, realtime) are byte-identical to b6d3389 (`git diff --quiet` exit 0).
- No package.json or lockfile changed in any repo. Neither layer names an application (grep count 0).
## New tests per finding
- **CR-01** (useCall.test.ts):
- leave while start is pending: no room, no media, end once the session exists (Task 1, red first)
- unmount while join is pending: no room, no media, leave once the session exists
- leave while connect is pending: no media, the Room disconnected, end once
- a connect that fails after a leave posts nothing more
- leave between camera and microphone: the microphone stays off, the Room disconnected
- a second begin while the first join is pending creates no second Room
- leave while livekit-client loads: no Room after the leave, end once. This one stalls the import itself. `vi.resetModules()` plus `vi.doMock('livekit-client')` with an async factory gated on a deferred, then a fresh import of useCall; the `finally` restores the plain fake. The test is last in the file, and five consecutive runs were stable.
- **WR-05** (useCall.test.ts): a failed connect ends a session nobody else joined; a failed connect leaves when the other side joined; a failed connect with an unreadable status: the starter ends, the callee leaves.
- **Changed expectation:** the old test "a failed LiveKit connect fails the call and leaves the session" is now "a failed LiveKit connect fails the call; an unreadable status ends the starter's session". The stub's `status` answers undefined, which counts as unreadable, so the starter posts `end`, not `leave`. Every other expectation stays.
- **WR-04** (videoClient.test.ts, `describe('call autostart')`):
- a start begins on mount only with the call button's answer, which begin still takes
- a join begins on mount only once, right after Accept
- a start answer does not make a join begin, nor an Accept a start
- **CR-02 client** (urlGuard.test.ts, new):
- `honestHttpUrl` refuses 16 deceptive forms. These are the review's table plus `https:///`, `https:bit.ly`, soft hyphen, ZWSP and `0x7f.1`, along with other schemes and unparseable input.
- It accepts 8 honest forms: a port with query and fragment, an IDN in Unicode and in punycode, a subdomain, upper case, `@` in the path, and `%` in the query.
- `renderChatText` (bare and `[label](url)`), `safeUrl`, `messageUrls` and `linkify` behave on both sets.
- linkEmbeds.test.ts has two new cases.
- **WR-01** (communityAuth.test.ts): unauthorized clears the token, then signs out once. createCommunitySignOut runs its parts in order, keeps going when a part throws, and is safe to call twice. endSession posts then clears then signs out, clears and signs out when the post rejects, and posts nothing without a token.
## For 20-09 (browser checks and release)
- **Layer exports added:** vue-chatvideo-layer `app/lib/videoClient.ts`: `hasStart`, `rememberAccept`, `takeAccept`, `callAutostart`. vue-chat-layer `app/lib/urlGuard.ts`: `honestHttpUrl`. vue-demo-app `app/utils/communityAuth.ts`: `createCommunitySignOut`, `endSession`, and an optional third parameter `onSignedOut` on `createChatAuth`. The plugin provides `$communitySignOut`.
- **Class names:** `.chatvideo-confirm` (the confirmation block), `.chatvideo-confirm__go` (Start call / Join call button), `.chatvideo-confirm__text`, `.chatvideo-confirm__back` (the back link when `backPath` is set).
- **Locale keys:** `chatvideo.confirm.start`, `chatvideo.confirm.join`, `chatvideo.action.startCall` (en "Start call", pl "Rozpocznij rozmowę"), `chatvideo.action.joinCall` (en "Join call", pl "Dołącz do rozmowy").
- **Browser-visible behaviour changes once the pins move:**
- A direct load of `/call/{id}` or `/call/{id}?start=1` shows the confirmation and posts nothing until the click.
- The DM call button (start handoff) and the incoming prompt's Accept still go straight in.
- The callee's status now passes through `starting` before `connecting`; both render "Connecting…".
- Existing browser checks that load `/call/{id}?start=1` directly and expect media must click `.chatvideo-confirm__go` first.
- **Demo call page doc comment** (`vue-demo-app/app/pages/call/[conversation].vue`) still says "With ?start=1 … it starts the call". Per the plan it is updated with the pin bump in 20-09.
- **New layer tags:** each layer needs one (main is ahead of v0.1.0: chatvideo 3 commits, chat 1 commit on top of the 2 already after the tag) before vue-demo-app can pin them.
## Decisions Made
See key-decisions in the frontmatter. In short:
- **Stale answer:** it closes its session only when it is still the current attempt.
- **Leave before connect:** the caller posts end and the callee posts leave, and only once the answer has arrived.
- **WR-05:** the rule follows GET status, with a fallback by role when the status cannot be read.
- **Autostart:** a start needs the waiting start answer; a join takes the Accept marker.
- **Invisible characters:** hosts containing them are refused.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 2 - Missing critical] Session-channel handle closed when the attempt goes stale while subscribing**
- **Found during:** Task 2
- **Issue:** `openChannel` set `channel` after `await subscribe`. A leave during the subscribe left the handle open (the review's "the channel handle leaks"). A stale attempt's publications could still call `finish`.
- **Fix:** `openChannel(sessionId, stale)` closes the handle when the attempt is stale on arrival, and ignores publications for a stale attempt.
- **Files modified:** ../vue-chatvideo-layer/app/composables/useCall.ts
- **Commit:** 27ad81c
**2. [Rule 1 - Bug] A failed livekit-client import left the session ringing, like a failed connect**
- **Found during:** Task 2
- **Issue:** WR-05's cause also applied to the import-failure branch, which only disconnected.
- **Fix:** That branch now uses the same `closeFailed` (GET status) rule.
- **Files modified:** ../vue-chatvideo-layer/app/composables/useCall.ts
- **Commit:** 27ad81c
**3. [Rule 2 - Missing critical] Invisible characters in a Unicode host**
- **Found during:** Task 4
- **Issue:** The plan's Unicode-host branch (NFC, only U+002E separators) accepted `https://bit.l\u00ady/x`, which displays as and opens `bit.ly`. A soft hyphen or ZWSP is dropped by the URL parser.
- **Fix:** `honestHttpUrl` refuses hosts containing `\p{Default_Ignorable_Code_Point}` or `\p{Cf}`. Both forms are under test.
- **Files modified:** ../vue-chat-layer/app/lib/urlGuard.ts, ../vue-chat-layer/app/lib/urlGuard.test.ts
- **Commit:** a798bb1
**4. [Rule 1 - Bug] leave() before connect no longer ends the caller's call from the callee side**
- **Found during:** Task 1
- **Issue:** The old rule `alone = !room || room.remoteParticipants.size === 0` made a callee who left while connecting post `end`, which ended the waiting caller's call.
- **Fix:** Before `connected`, the caller posts end and the callee leave, as the plan's truth states. Once connected, the room-based last-one-out rule still applies.
- **Files modified:** ../vue-chatvideo-layer/app/composables/useCall.ts
- **Commit:** 69e8b83
### Other notes
- The `leave while livekit-client loads` test stalls the dynamic import itself (the preferred variant in the plan), not the same-tick fallback.
- **Not done here, per the plan:** IN-07 (the handle race between two pending incoming subscribes) stays deferred. The demo's call page comment waits for 20-09.
## Deferred Issues
- `tsc --noEmit -p .nuxt/tsconfig.app.json` in vue-demo-app reports a type error at `app/plugins/auth.ts` on the `fetchJson` line (`$fetch(url, opts)` with `method?: string`). The line was there before this plan (it is line 20 at deb809f) and does not affect the build. Out of scope.
## Known Stubs
None.
## Threat Flags
None. The changes close T-20-42 to T-20-46 and add no new endpoint, auth path or storage.
## Self-Check: PASSED
- FOUND: ../vue-chat-layer/app/lib/urlGuard.ts, ../vue-chat-layer/app/lib/urlGuard.test.ts
- FOUND commits: 69e8b83, 27ad81c, 5386903 (vue-chatvideo-layer), a798bb1 (vue-chat-layer), 188ae25 (vue-demo-app)

View File

@@ -0,0 +1,552 @@
---
phase: 20-demo-instance-with-every-shared-plugin
plan: 09
type: execute
wave: 8
depends_on: ["20-07", "20-08"]
gap_closure: true
review_findings: [CR-01, CR-02, CR-03, WR-01, WR-04, WR-05]
files_modified:
- ../vue-chat-layer/package.json
- ../vue-chatvideo-layer/package.json
- ../sm-demo-app/scripts/check-moderation.sh
- ../sm-demo-app/scripts/check-local.sh
- ../sm-demo-app/scripts/check-chat.cjs
- ../sm-demo-app/scripts/check-all.sh
- ../sm-demo-app/README.md
- ../sm-demo-app/DEPLOY.md
- ../sm-demo-app/go.mod
- ../sm-demo-app/go.sum
- ../sm-demo-app/plugins/golem15/moderation
- ../sm-demo-app/plugins/golem15/forum
- ../sm-demo-app/plugins/demo/moderation.go
- ../sm-demo-app/moderation_test.go
- ../sm-demo-app/plugins/demo/content/ROADMAP.md
- ../sm-demo-app/vue-demo-app
- ../sm-demo-app/vue-demo-app/package.json
- ../sm-demo-app/vue-demo-app/pnpm-lock.yaml
- ../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue
- .planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md
- .planning/todos/pending/chatchannels-pin-policy.md
- .planning/todos/pending/moderation-profile-group-and-filenames.md
- .planning/todos/pending/forum-friends-client-401-refresh.md
- .planning/todos/pending/chatvideo-dm-only-host-hook.md
- .planning/todos/pending/chatvideo-live-membership.md
- .planning/todos/pending/check-local-jwt-out-of-argv.md
- .planning/todos/pending/chat-slash-text-escape.md
- .planning/todos/pending/demo-seed-moderation-lists-once.md
- .planning/todos/pending/demo-nginx-livekit-rtc-only.md
- .planning/todos/pending/chatvideo-incoming-handle-leak.md
- .planning/todos/pending/demo-vapid-runbook-pipefail.md
- .planning/todos/pending/demo-chat-members-read-only.md
autonomous: false
requirements: [SC-2, SC-3, SC-4, D-10, D-13, D-17, D-18]
estimate:
tokens: 340000
raw_tokens: 340000
tasks: 12
confidence: low
must_haves:
truths:
- "SC-4: before anything is pushed, the full suites pass in every repository the gap round touched: sm-moderation-plugin and sm-forum-plugin (go vet, go test ./... with Docker), vue-chat-layer and vue-chatvideo-layer (vitest and the playground build), vue-demo-app (vitest and the Nuxt build) and sm-demo-app (go vet, go test ./... with Docker)."
- "Before any tag, the unreleased fixes run together in the local demo (the sibling plugin checkouts through a scratch go.work, the local layers as packed tarballs, both temporary and reverted): check-local moderation, chat, chatlive and callmedia pass, so a one-way tag never ships an untested combination."
- "After the Task 3 go-ahead: annotated tags exist on origin at the default branch's head, each containing the earlier tags. sm-moderation-plugin gets the next patch after v0.1.0 (v0.1.1), sm-forum-plugin after v0.1.1 (v0.1.2), and vue-chat-layer and vue-chatvideo-layer after v0.1.0 (v0.1.1 each). For each, `git ls-remote origin refs/tags/<tag>^{}` equals the pushed HEAD."
- "sm-demo-app requires the new moderation and forum tags (go.mod and go.sum, submodules checked out at the tags, check-pins ok, one `chore: bump` commit per plugin), its forum listener also checks the rendered post (PostSaving.HTML through CheckHTML), and TestDemoModeration refuses every reviewer probe through HTTP on chat send, reply and edit and on forum thread, reply and edit, with nothing stored. vue-demo-app pins both layers at their new tags."
- "check-moderation.sh refuses every reviewer probe in chat and forum with 422 under the right field, after a plain control word is refused (so changed lists cannot pass silently), and leaves nothing behind. check-chat.cjs --call shows the confirmation on a direct /call load with no LiveKit connection before the click, then completes the DM call. check-chat.cjs's default mode shows that logout closes the realtime socket."
- "SC-3, after the Task 7 go-ahead: rome runs the new binary and site through DEPLOY.md's Upload and Release. Only summercms-demo and summercms-demo-site restart, check-live prints `check-live: ok`, and bin/demo.prev and site/.output.prev are kept for a rollback."
- "SC-2, D-17 on the live site: with the user's live tokens, the bypass probe passes against https://demo.summercms.io and the call probe completes a DM call there with the confirmation step. Without tokens the user's own UAT of the same steps is recorded. smoke.sh passes on the deployed artifact."
- "After the Task 11 go-ahead, one post per plugin tag (sm-moderation-plugin, sm-forum-plugin) is on https://summercms.io/changelog/plugins, written per CLAUDE.md (user-facing, no planning IDs, no H1). The journal token is never printed or copied."
- "20-REVIEW-DISPOSITION.md: CR-01, CR-02, CR-03, WR-01, WR-04 and WR-05 are fixed, with commit refs. WR-02, WR-03, WR-06 and IN-01 to IN-09 are deferred, each pointing at its todo in .planning/todos/pending/ (g15office task id in the frontmatter when the g15office tools answer)."
artifacts:
- path: "../sm-demo-app/scripts/check-moderation.sh"
provides: "the bypass probe for a local or the live demo"
contains: "check-moderation: ok"
- path: "../sm-demo-app/plugins/demo/moderation.go"
provides: "forum listener checking the rendered post"
contains: "CheckHTML"
- path: ".planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md"
provides: "the closed ledger"
contains: "fixed"
key_links:
- from: "../sm-demo-app/plugins/demo/moderation.go"
to: "../sm-forum-plugin/events/events.go"
via: "checkPost runs Filter.CheckHTML on ev.HTML after title and body"
pattern: "ev\\.HTML"
- from: "../sm-demo-app/go.mod"
to: "../sm-moderation-plugin"
via: "require at the new patch tag"
pattern: "sm-moderation-plugin v0\\.1\\.[1-9]"
- from: "../sm-demo-app/vue-demo-app/package.json"
to: "../vue-chatvideo-layer"
via: "git+https pin at the new tag"
pattern: "vue-chatvideo-layer.git#v0\\.1\\.[1-9]"
prohibitions:
- statement: "No push, tag, rome change or changelog post happens before its checkpoint is answered; a tag is never moved or re-pushed; tags go on the default branch only."
status: unresolved
verification: judgment
- statement: "No secret value (JWTs, the journal token, .env values) appears in a command line, a log, a committed file or the SUMMARY; .env files are never read; JWTs reach the scripts through 0600 files or the environment and curl gets the header through a config on stdin."
status: unresolved
verification: judgment
- statement: "The temporary integration (scratch go.work, packed layer tarballs) is never committed: vue-demo-app's package.json and pnpm-lock.yaml match their committed state when Task 2 ends."
status: unresolved
verification: automated
- statement: "On rome only summercms-demo and summercms-demo-site restart; nginx, Centrifugo, LiveKit, the firewall and WavePath's programs are untouched."
status: unresolved
verification: judgment
---
## Phase Goal
ROADMAP Goal (not in user-story format; no story is invented here): sm-demo-app runs every shared plugin and its public Nuxt site shows them working, deployed publicly with the backend call to action.
This plan's slice (gap round after the code review, plan 9 of 9, wave 8): it releases 20-07's and 20-08's fixes, redeploys the demo and re-checks it live.
- Prove the unreleased fixes together locally.
- Tag the four repositories after a go-ahead.
- Consume the tags in the demo, including the one listener change that needs them.
- Rebuild, redeploy on rome after a go-ahead, and probe the live site for the bypasses and the call flow.
- Publish the two plugin changelog posts after a go-ahead.
- Close 20-REVIEW-DISPOSITION.md.
**Unit tests rule for this gap round:** the project rule "unit tests are the last plan of every phase" is met because every fix in 20-07 and 20-08 carries its own regression tests and this plan runs every touched repository's full suite (Task 2) and the demo's whole gate (Task 6) before anything goes live.
## Decisions taken in this plan (Claude's discretion, recorded)
- **Versions.** Each tag is the next patch after the latest tag, checked on 2026-11-02 with `git tag --sort=-v:refname` and `git ls-remote --tags origin`:
| Repo | Latest tag | New tag |
|---|---|---|
| sm-moderation-plugin | v0.1.0 | v0.1.1 |
| sm-forum-plugin | v0.1.1 | v0.1.2 |
| vue-chat-layer | v0.1.0 | v0.1.1 |
| vue-chatvideo-layer | v0.1.0 | v0.1.1 |
The brief asked for moderation v0.1.2. No v0.1.1 exists, and skipping one would leave a hole in the series, so the plan proposes v0.1.1 and the Task 3 checkpoint shows the table for the user to confirm or override. Task 2 re-reads the tags, because another session could tag in between.
- **Integration before tagging.** Tags are one-way, so Task 1 and Task 2 run the unreleased code together in the local demo. The Go side uses a scratch go.work that maps moderation and forum to the sibling checkouts (GOWORK is respected by dev.sh and build.sh dev). The site side installs the two layers from `pnpm pack` tarballs; unlike link pins, a tarball resolves vue-chat-layer once, as the git tag install will. Both are reverted before the release gate.
- **The demo listener change comes after the bumps** (20-07's finding). `checkPost` gains `CheckHTML(ctx, ev.HTML)` in the commit right after the two `chore: bump` commits, so every sm-demo-app commit builds with its own pointers. Until then, the reviewer's three forum forms are already refused on the raw body by the new Check. The tarball and scratch integration therefore proves those three; the rendered-only forms (bit\.ly, an HTML comment) are pinned by TestDemoModeration in Task 5.
- **Probes written as checks.** The bypass probe is `scripts/check-moderation.sh BASE`, reusable locally (`check-local.sh moderation`) and live. The call probe is check-chat.cjs --call, extended with the direct-load confirmation step, plus a logout step in its default mode. Both read JWTs from a 0600 file or the environment, never argv, and curl gets the bearer header through a config on stdin (the pattern IN-03 asks for). Live, the probe posts only in the visitor's own DM with a persona and as replies on a seeded thread. It starts with a control word that must be refused, and it deletes anything a probe managed to store.
- **Live tokens are an authentication gate.** Live login needs a real Turnstile solve, so Task 9 asks the user to sign in in a browser and save the token cookie values into two files. The alternative is "manual": the user runs the same steps by hand.
- **Changelog posts** go to sm-moderation-plugin and sm-forum-plugin only. The layers have no plugin.yaml and no changelog stream, and changelog-post.py refuses a repository without a manifest.
- **Deferred findings** (WR-02, WR-03, WR-06, IN-01 to IN-09) each become one todo in the existing format. IN-07's logout half was fixed by 20-08 (dismiss on sign-out); its todo keeps the handle leak.
- spec-less probe fallback skipped: phase has no requirement IDs to probe (visible skip).
<objective>
Release the gap-round fixes, put them on the live demo, and prove there that the bypasses are closed and the call flow asks before media; close the review ledger.
Purpose: SC-2, SC-3 and SC-4 hold again after the code review; D-17 (moderation), D-18 (the seams) and D-13 (the call page) hold on the live site.
Output: four tags, commits in sm-demo-app and vue-demo-app, a new release on rome, two changelog posts, the closed disposition ledger and twelve follow-up todos, each step after its go-ahead.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-05-SUMMARY.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-06-SUMMARY.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-07-SUMMARY.md
@.planning/phases/20-demo-instance-with-every-shared-plugin/20-08-SUMMARY.md
Repos: ../sm-moderation-plugin, ../sm-forum-plugin, ../vue-chat-layer, ../vue-chatvideo-layer (each on main, 20-07 and 20-08 commits unpushed); ../sm-demo-app (master; submodules plugins/golem15/* at their required tags; vue-demo-app submodule with 20-08's commit, gitlink moved but not committed); ../sm-summercmsio-app (scripts/changelog-post.py). Host: rome over `ssh -p 2222 debian@10.8.3.118` (passwordless sudo; the `rome` alias does not resolve here), with `RSH="ssh -p 2222"` and `ROME=debian@10.8.3.118` as DEPLOY.md uses them.
Rules (CLAUDE.md and the brief): no co-author tags; stage files by explicit path; one logical change per commit; planning docs and code in separate commits; the plugin or layer is pushed and tagged first, then the pointer or pin bump in the app as its own commit (one `chore: bump <name> to <tag>` per plugin); push vue-demo-app before the sm-demo-app commit that moves its gitlink; tags only on the default branch, annotated, never moved; never read `.env*` files; never print, copy or mint the journal token; leave other sessions' uncommitted edits (STATE.md, state.json, G15OFFICE.md) alone; Docker tests through `sudo -u golem` if the socket is denied. After Task 4, write a progress note into a draft 20-09-SUMMARY.md (tasks done, tags and commits, open points), so a context reset resumes cleanly. `SCRATCH` in the commands below is this session's scratchpad directory; set it once (`SCRATCH=<the scratchpad path>`) before Task 1 and again after a context reset.
<interfaces>
sm-demo-app scripts: dev.sh up (Postgres, Centrifugo, LiveKit 127.0.0.1:7890, Go on :8097, Nuxt on :3020; builds through go.work, so GOWORK overrides it); check-local.sh CHECK... (helpers request, json_has, bad, visitor_jwt, throwaway_user, psql_value; ALL_CHECKS; check_call, two_member_chat, check_chatlive, check_callmedia); check-chat.cjs --base URL [--two|--call] (DEMO_JWT, DEMO_JWT2 from the environment; TOKEN_COOKIE summercms_demo_token; the call mode clicks .chatvideo-callbutton__btn, accepts on .chatvideo-incoming, waits for remote video, mutes, both click .chatvideo-button--leave, polls video/status); check-all.sh [--local] (step 5 runs check-local.sh back remote chatlive callmedia); check-pins.sh; build.sh [release|dev] (release refuses dirty trees, a stale ROADMAP snapshot and pins off go.mod); sync-roadmap.sh; smoke.sh [binary]; check-deploy.sh; check-live.sh URL.
Demo APIs used by the probe: GET /_demo/api/v1/chat/members (persona Ada Hart); POST /_chat/api/v1/contexts/demo/1/dm {user_id}; POST /_chat/api/v1/conversations/{id}/messages {content}; DELETE /_chat/api/v1/messages/{id}; GET /_forum/api/v1/contexts/demo/1/categories and /threads; POST /_forum/api/v1/contexts/demo/1/categories/{categoryId}/threads {title, body}; POST /_forum/api/v1/contexts/demo/1/threads/{threadId}/posts {body}; DELETE /_forum/api/v1/contexts/demo/1/posts/{postId} and /threads/{threadId}. Refusal: 422 {"error":"Validation failed","errors":{field:[message]}} with field content (chat), title or body (forum).
Live default lists (demo:seed, unless an admin changed them): words "buy followers", "casino bonus", "free crypto", "viagra"; links "bit.ly".
20-08 names used by the checks: the confirmation block `.chatvideo-confirm`, its button `.chatvideo-confirm__go`; the call button `.chatvideo-callbutton__btn`.
DEPLOY.md: "Build" (build.sh, smoke.sh, check-deploy.sh), "Upload" (three rsync lines with --chown=root:root and sudo rsync), "Release" (migrate and demo:seed with bin/demo.new, keep bin/demo.prev and site/.output.prev, restart summercms-demo and summercms-demo-site, websockets:health), "Verify" (check-live.sh, supervisorctl status, the reset schedule off), "Rollback".
changelog (../sm-summercmsio-app/DEPLOY.md "Posting to the changelog"): `scripts/changelog-post.py source vX.Y.Z --repo ../sm-<name>-plugin`, then `scripts/changelog-post.py publish vX.Y.Z notes.md --excerpt "…" --repo ../sm-<name>-plugin` (`--draft` saves unpublished); the plugin checkout must be exactly at the tag with a clean worktree and a plugin.yaml that passes `summer plugin:manifest --check`; the token is read from ~/.config/summercms/journal-token by the script.
Todo format (.planning/todos/pending/*.md): frontmatter title, date, priority, area, g15office (task id); a short body. .planning/G15OFFICE.md: each todo gets a g15office task in project summercms (type Bug, Feature, Improvement or Task; the description ends with `Local: .planning/todos/pending/<file>`).
</interfaces>
</context>
<tasks>
<task type="tracer">
<name>Task 1: Tracer: the bypass, call-confirmation and logout checks exist, and they pass against the unreleased fixes running together in the local demo</name>
<precondition>The 20-07 and 20-08 SUMMARYs exist and record their commits; `git -C <repo> status --porcelain` is empty in sm-moderation-plugin, sm-forum-plugin, vue-chat-layer and vue-chatvideo-layer; in sm-demo-app it lists at most ` M vue-demo-app`; Docker runs.</precondition>
<files>../sm-demo-app/scripts/check-moderation.sh, ../sm-demo-app/scripts/check-local.sh, ../sm-demo-app/scripts/check-chat.cjs, ../sm-demo-app/scripts/check-all.sh, ../sm-demo-app/README.md, ../sm-demo-app/DEPLOY.md</files>
<read_first>../sm-demo-app/scripts/check-local.sh (header, helpers, visitor_jwt, check_call, two_member_chat, ALL_CHECKS), scripts/check-chat.cjs (whole file), scripts/check-all.sh (step 5), scripts/dev.sh (up, how it builds), go.work, README.md "Checks", DEPLOY.md "Verify", 20-REVIEW.md (the probe forms), 20-07-SUMMARY.md (probe table), 20-08-SUMMARY.md (class names and handoffs)</read_first>
<action>Per D-17, D-13 and D-04.
1. scripts/check-moderation.sh BASE (new, `set -euo pipefail`, header in the style of check-live.sh):
- It reads the member JWT from the file named by DEMO_JWT_FILE (it must be mode 600; a looser mode stops the script) or from DEMO_JWT. It never prints the JWT and never puts it in argv: every request passes the Authorization header to curl as a config on stdin, written with bash builtins.
- It finds the visitor's DM with the persona Ada Hart (members, then dm) and the first seeded forum category and thread.
- Control first: the plain word "viagra" must answer 422 as a chat message (errors.content) and as a forum reply (errors.body). If either control is accepted, it deletes what was stored, prints "check-moderation: the filter is off or the lists differ from the defaults" and exits 1.
- Then every probe from the review, in one array whose comment says it mirrors 20-07's TestMatchBypassWords and TestMatchBypassLinks. Words: viagra with U+200B, with U+00AD; "buy followers" with U+00A0, with U+2009, with U+3000; fullwidth viagra; vi&#97;gra; via**gra**. Links: https://bit%2Ely/x, https://bit.l%79/x, https://bit.ly/x, https://bit。ly/x, https://user@bit.ly/x, [x](https://bit&#46;ly/a). Write each with bash $'\u…' escapes and build the JSON bodies with python3 json.dumps, as check-local does.
- Each probe must answer 422 as a chat message, as a forum reply and once as a forum thread title (errors.title). A probe that answers 2xx is deleted at once (the message, post or thread) and reported.
- It ends with "check-moderation: ok", or one line per failure and exit 1.
2. check-local.sh: `check_moderation` runs check-moderation.sh against $GO with the visitor's JWT through the environment; add `moderation` to ALL_CHECKS and the header list. check-all.sh step 5 runs `moderation` with the other browser and API checks (header comment too).
3. check-chat.cjs:
- Read DEMO_JWT_FILE and DEMO_JWT2_FILE when set (trimmed, never printed), else DEMO_JWT and DEMO_JWT2.
- --call: before the call-button step, A loads /call/{dm}?start=1 directly. `.chatvideo-confirm` must be visible within 5 s. Watch the page's WebSockets for 3 s: none may open to a URL containing /livekit/rtc, and no .chatvideo-tile may render. GET .../video/status must show no session. Then the existing flow runs (the call button and Accept autostart through the handoffs), and the summary line stays "check-chat: ok call".
- Default mode: after the message check, the member clicks Log out in the header. Within 5 s every WebSocket the page opened to /ws must be closed, and /chat must show the register link.
- Update the header comment.
4. README.md "Checks" and DEPLOY.md "Verify": the moderation check, the live bypass probe and the live call probe with token files (the commands, the file mode, that they post only in the visitor's DM and as thread replies and clean up), in the files' style.
5. Commit in sm-demo-app (scripts and docs only): `test: moderation bypass probe, call confirmation and logout checks`.
6. Temporary integration (never committed):
- Write a scratch go.work, $SCRATCH/demo-gap.go.work under this session's scratchpad. It is ../sm-demo-app/go.work with every path made absolute, plugins/golem15/moderation replaced by the absolute path of ../sm-moderation-plugin and plugins/golem15/forum by ../sm-forum-plugin.
- Pack both layers with `pnpm --dir ../vue-chat-layer pack --pack-destination $SCRATCH` (and the same for vue-chatvideo-layer), then `pnpm --dir ../sm-demo-app/vue-demo-app add <the two tarball paths>`.
- Run `GOWORK=$SCRATCH/demo-gap.go.work ../sm-demo-app/scripts/dev.sh up`.
- Run `../sm-demo-app/scripts/check-local.sh moderation chat callmedia` and see them pass. Leave the setup in place for Task 2, which reverts it; say so in the draft SUMMARY if the run stops here.</action>
<verify>
<automated>bash -n ../sm-demo-app/scripts/check-moderation.sh &amp;&amp; node --check ../sm-demo-app/scripts/check-chat.cjs &amp;&amp; ../sm-demo-app/scripts/check-local.sh moderation chat callmedia</automated>
<fails_when>Non-zero exit: a script has a syntax error, or check-local reports moderation failed (a probe stored, a control accepted, a wrong field), chat failed (the message or the logout socket check) or callmedia failed (the direct load opened LiveKit or showed no confirmation, or the DM call did not complete).</fails_when>
</verify>
<acceptance_criteria>
- `git -C ../sm-demo-app show --stat HEAD | grep -cE 'scripts/check-moderation.sh|scripts/check-chat.cjs|scripts/check-local.sh'` prints 3.
- `grep -v '^\s*#' ../sm-demo-app/scripts/check-moderation.sh | grep -cE -- '-H +.?Authorization'` prints 0 (the bearer header never goes on curl's command line).
</acceptance_criteria>
<done>The bypass probe, the call confirmation step and the logout check exist and pass against all four unreleased fixes together, before anything is tagged.</done>
</task>
<task type="auto">
<name>Task 2: Full suites of every touched repository, the rest of the local checks on the unreleased code, revert of the temporary integration, and release prep</name>
<files>../vue-chat-layer/package.json, ../vue-chatvideo-layer/package.json</files>
<read_first>The Task 1 setup ($SCRATCH/demo-gap.go.work, the tarball pins), each repo's README Testing and Changelog sections, ../sm-moderation-plugin/plugin.yaml and ../sm-forum-plugin/plugin.yaml, .planning/notes/core-plugins-own-repos.md, ../sm-demo-app/scripts/check-pins.sh</read_first>
<action>Per SC-4.
1. Full suites (record pass counts in the draft SUMMARY):
- sm-moderation-plugin and sm-forum-plugin: `go -C <repo> vet ./...` and `go -C <repo> test -count=1 ./...` with Docker.
- vue-chat-layer and vue-chatvideo-layer: `pnpm --dir <repo> test` and `pnpm --dir <repo> run build:playground`.
- vue-demo-app: `pnpm test` and `pnpm run build`, first under the tarball pins, then again after the revert below.
- sm-demo-app: `go vet ./...` and `go test -count=1 ./...` under its own go.work (the committed pointers). Also `GOWORK=$SCRATCH/demo-gap.go.work go -C ../sm-demo-app test -count=1 -run '^(TestDemoModeration|TestBootAllPlugins|TestGoModRequiresTags)$' .`, which shows the new plugin code works with the demo before it is tagged. TestGoModRequiresTags only reads go.mod, so it must still pass.
2. Remaining local checks on the unreleased code: `../sm-demo-app/scripts/check-local.sh chatlive call forum friends herald tour`.
3. Revert the temporary integration: `git -C ../sm-demo-app/vue-demo-app checkout -- package.json pnpm-lock.yaml`, then `pnpm --dir ../sm-demo-app/vue-demo-app install --frozen-lockfile`. Restart the stack without the GOWORK override (`../sm-demo-app/scripts/dev.sh up` restarts or rebuilds per its own rules; stop the old Go process if dev.sh does not). Delete the scratch tarballs and go.work.
4. Release prep, recorded as a table in the draft SUMMARY:
- For each of the four repos: the latest tag (`git tag --sort=-v:refname | head -1` and `git ls-remote --tags origin`) and the next patch tag (expected v0.1.1, v0.1.2, v0.1.1, v0.1.1).
- The default branch (`git remote show origin`, HEAD branch main), a fast-forward of origin main (`git merge-base --is-ancestor origin/main HEAD` after `git fetch`), and every earlier tag an ancestor of HEAD.
- The README changelog entries for the new versions (moderation, forum), and `summer plugin:manifest --check` passing in both plugins (summer from PATH, else `go -C ../summercms.go run ./cmd/summer`).
- Set "version" in the two layers' package.json to the new version, and commit each: `chore: release 0.1.1`.
- The commits each tag will contain (`git log --oneline <latest tag>..HEAD`).</action>
<verify>
<automated>for r in sm-moderation-plugin sm-forum-plugin; do go -C ../$r vet ./... &amp;&amp; go -C ../$r test -count=1 ./... || exit 1; done &amp;&amp; for l in vue-chat-layer vue-chatvideo-layer; do pnpm --dir ../$l test || exit 1; done &amp;&amp; pnpm --dir ../sm-demo-app/vue-demo-app test &amp;&amp; pnpm --dir ../sm-demo-app/vue-demo-app run build &amp;&amp; go -C ../sm-demo-app vet ./... &amp;&amp; go -C ../sm-demo-app test -count=1 ./... &amp;&amp; git -C ../sm-demo-app/vue-demo-app diff --quiet -- package.json pnpm-lock.yaml &amp;&amp; for l in vue-chat-layer vue-chatvideo-layer; do node -e "process.exit(require('../$l/package.json').version === '0.1.1' ? 0 : 1)" || exit 1; done</automated>
<fails_when>Non-zero exit: a suite fails in any touched repository, the temporary pins were not reverted, or a layer's package.json version was not set.</fails_when>
</verify>
<acceptance_criteria>
- The draft SUMMARY holds the release table (repo, latest tag, new tag, HEAD, commits since the tag) and the suite results.
- `git -C ../sm-demo-app status --porcelain` lists at most ` M vue-demo-app`.
</acceptance_criteria>
<done>Every touched repository is green on its own and together with the others, the integration left no trace, and the release table is ready for the go-ahead.</done>
</task>
<task type="checkpoint:decision" gate="blocking">
<name>Task 3: Go-ahead to push main and tag the four repositories</name>
<read_first>The Task 2 release table (repo, latest tag, proposed tag, HEAD, commits since the latest tag), the suite results and the local checks, the note on moderation's version (v0.1.1, not the brief's v0.1.2)</read_first>
<acceptance_criteria>
- The user's answer is recorded in the SUMMARY with the confirmed versions.
</acceptance_criteria>
<decision>Push main and create the annotated tags sm-moderation-plugin v0.1.1, sm-forum-plugin v0.1.2, vue-chat-layer v0.1.1 and vue-chatvideo-layer v0.1.1?</decision>
<context>Tags are one-way: consumers' go.sum and lockfiles pin them, so they are never moved, only superseded. Each tag carries only the gap-round fixes listed in the table (plus vue-chat-layer's two test and refactor commits already on main since v0.1.0). The demo can consume them only after this. Other applications pin older tags and are unaffected, because the changes are additive (PostSaving gains a field, the filter matches more forms, the layers add a guard, handoffs and a confirmation).</context>
<options>
<option id="release">
<name>Push and tag all four</name>
<pros>The demo can pin the fixes and be redeployed.</pros>
<cons>The versions are public and final.</cons>
</option>
<option id="push-only">
<name>Push main, no tags yet</name>
<pros>The commits are backed up and visible for review.</pros>
<cons>The demo cannot pin them; the plan stops after Task 4 until tags are approved.</cons>
</option>
<option id="hold">
<name>Hold</name>
<pros>Nothing leaves this machine.</pros>
<cons>The live demo keeps the bypasses and the call race.</cons>
</option>
</options>
<resume-signal>Reply "release" (optionally with other versions), "push-only" or "hold".</resume-signal>
</task>
<task type="auto">
<name>Task 4: Push the four repositories and tag them</name>
<reversibility rating="one-way">Pushed tags are pinned by consumers' go.sum and lockfiles; they can be superseded but never moved.</reversibility>
<precondition>Task 3 answered "release" or "push-only".</precondition>
<files>(no files; git refs on origin)</files>
<read_first>The Task 3 answer, the Task 2 release table, .planning/notes/core-plugins-own-repos.md</read_first>
<action>For each of sm-moderation-plugin, sm-forum-plugin, vue-chat-layer and vue-chatvideo-layer, in that order:
- `git fetch origin` and confirm origin/main is still an ancestor of HEAD (stop and report if another session pushed);
- `git push origin main` and check `git ls-remote origin refs/heads/main` equals HEAD;
- with "release": create the annotated tag at HEAD (`git tag -a <tag> -m "<one line: what the release fixes>"`), push only that tag (`git push origin <tag>`), check `git ls-remote origin "refs/tags/<tag>^{}"` equals HEAD and that the previous tag is an ancestor (`git merge-base --is-ancestor <previous> <tag>`).
With "push-only", stop after the pushes, record it, and end the plan run here (resume at Task 3 when the user approves tags).
Write the progress note into the draft 20-09-SUMMARY.md: the four pushed heads and tags.</action>
<verify>
<automated>for r in "sm-moderation-plugin v0.1.1" "sm-forum-plugin v0.1.2" "vue-chat-layer v0.1.1" "vue-chatvideo-layer v0.1.1"; do set -- $r; [ "$(git -C ../$1 ls-remote origin refs/heads/main | cut -f1)" = "$(git -C ../$1 rev-parse HEAD)" ] || exit 1; [ "$(git -C ../$1 ls-remote origin "refs/tags/$2^{}" | cut -f1)" = "$(git -C ../$1 rev-parse HEAD)" ] || exit 1; done</automated>
<fails_when>Non-zero exit: a remote main differs from the local HEAD, or a tag is missing on origin or points elsewhere. Use the versions confirmed in Task 3 if they differ from the table; with "push-only" only the main check applies.</fails_when>
</verify>
<acceptance_criteria>
- `git -C ../sm-moderation-plugin describe --exact-match HEAD` and the same in the other three repos print the new tag.
</acceptance_criteria>
<done>The four fixes are public at their patch tags on the default branch.</done>
</task>
<task type="auto" tdd="true">
<name>Task 5: The demo consumes the tags: layer pins, plugin bumps, the forum listener reads the rendered post, and the gitlink</name>
<precondition>Task 4 created all four tags on origin.</precondition>
<files>../sm-demo-app/vue-demo-app/package.json, ../sm-demo-app/vue-demo-app/pnpm-lock.yaml, ../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue, ../sm-demo-app/go.mod, ../sm-demo-app/go.sum, ../sm-demo-app/plugins/golem15/moderation, ../sm-demo-app/plugins/golem15/forum, ../sm-demo-app/plugins/demo/moderation.go, ../sm-demo-app/moderation_test.go, ../sm-demo-app/vue-demo-app, ../sm-demo-app/plugins/demo/content/ROADMAP.md</files>
<read_first>../sm-demo-app/plugins/demo/moderation.go, moderation_test.go (TestDemoModeration: setLists, post, put, refused, the stored-count check), go.mod, .gitmodules, scripts/check-pins.sh, scripts/build.sh (the release refusals), scripts/sync-roadmap.sh, vue-demo-app/package.json, vue-demo-app/app/pages/call/[conversation].vue, 20-07-SUMMARY.md (the listener finding), ../sm-moderation-plugin/README.md (CheckHTML), ../sm-forum-plugin/README.md (PostSaving.HTML)</read_first>
<behavior>
- TestDemoModeration, with the lists set to the demo defaults plus the path rule example.com/promo: every probe of check-moderation.sh, the path-rule forms (https://example.com:443/promo, https://example.com//promo, https://sub.example.com/promo) and the decomposed żółw case (with żółw added to the words), is refused with 422 on chat send, reply and edit (errors.content) and on forum thread title, thread body, reply and edit (errors.title or errors.body); nothing is stored.
- The rendered-only forum forms bit\.ly and via<!-- x -->gra are refused on reply and edit with errors.body (only CheckHTML on ev.HTML catches them).
- The existing TestDemoModeration cases keep passing.
</behavior>
<action>Per D-17, D-18 and D-13, in this commit order:
1. vue-demo-app: `pnpm --dir ../sm-demo-app/vue-demo-app add` the two git+https specs at the new tags (vue-chat-layer and vue-chatvideo-layer). Update the doc comment of app/pages/call/[conversation].vue: ?start=1 picks Start over Join on the confirmation; media starts only after a click there, the call button or Accept. Run `pnpm test` and `pnpm run build`, then commit in vue-demo-app: `chore: pin vue-chat-layer and vue-chatvideo-layer v0.1.1`.
2. sm-demo-app, for moderation and then forum: fetch tags in the submodule and check it out at the new tag; `GOWORK=off GOPRIVATE=git.golem15.com/* go -C ../sm-demo-app get git.golem15.com/golem15/sm-<name>-plugin@<tag>` and `GOWORK=off GOPRIVATE=git.golem15.com/* go -C ../sm-demo-app mod tidy` (GOPRIVATE as build.sh sets it); commit go.mod, go.sum and the gitlink: `chore: bump sm-moderation-plugin to v0.1.1`, then `chore: bump sm-forum-plugin to v0.1.2`.
3. plugins/demo/moderation.go: checkPost also runs `Filter.CheckHTML` on `ev.HTML` (when not empty), after title and body, and answers a violation as `Rejection{Field: "body"}`; update the function and file comments (chat messages are checked by Check, which normalises; forum posts also by what they render to). Extend TestDemoModeration per the behavior block (red first for the rendered-only forms). Commit: `fix: refuse forum posts whose rendered text carries a banned word or link`.
4. Commit the vue-demo-app gitlink in sm-demo-app: `chore: bump vue-demo-app (layers v0.1.1, sign-out reset)`.
5. If `scripts/sync-roadmap.sh --check` reports a stale snapshot, run `scripts/sync-roadmap.sh` and commit `chore: sync the roadmap snapshot`.
Nothing is pushed in this task.</action>
<verify>
<automated>go -C ../sm-demo-app vet ./... &amp;&amp; go -C ../sm-demo-app test -count=1 ./... &amp;&amp; go -C ../sm-demo-app test -count=1 -run '^(TestDemoModeration|TestGoModRequiresTags)$' -v . 2>&amp;1 | grep -cE -- '^--- PASS: Test(DemoModeration|GoModRequiresTags) ' | grep -qx 2 &amp;&amp; ../sm-demo-app/scripts/check-pins.sh &amp;&amp; pnpm --dir ../sm-demo-app/vue-demo-app test</automated>
<fails_when>Non-zero exit: vet or a Go test fails (a probe stored, a rendered-only form accepted, a go.mod require not a tag), check-pins reports a checkout off its required tag, or the site tests fail on the new pins.</fails_when>
</verify>
<acceptance_criteria>
- `grep -cE 'sm-moderation-plugin v0\.1\.1$|sm-forum-plugin v0\.1\.2$' ../sm-demo-app/go.mod` prints 2.
- `grep -cE 'vue-chat(video)?-layer\.git#v0\.1\.1' ../sm-demo-app/vue-demo-app/package.json` prints 2.
- `git -C ../sm-demo-app status --porcelain` prints nothing.
</acceptance_criteria>
<done>The demo builds from the released fixes only, and its own listener refuses forum posts by what they render to.</done>
</task>
<task type="auto">
<name>Task 6: The demo's whole gate passes locally on the released versions, including a release build and the smoke run</name>
<files>(no files; build outputs bin/demo and vue-demo-app/.output, untracked)</files>
<read_first>../sm-demo-app/scripts/check-all.sh (steps and --local), DEPLOY.md "Build", 20-06-SUMMARY.md (the last check-all run)</read_first>
<action>Run `../sm-demo-app/scripts/dev.sh up` (the stack now builds from the bumped submodules through go.work), then `../sm-demo-app/scripts/check-all.sh --local`. It runs the app and plugin suites, vitest in vue-demo-app and the four layers, sync-roadmap --check, check-pins, `build.sh release`, smoke.sh, check-deploy, then check-local back remote chatlive callmedia moderation and check-live against the current live site. Record the release id from the `build: ok release <id>` line and each step's result in the draft SUMMARY. If a step fails, fix the cause in the repository that owns it. A fix to a tagged repository means a new patch tag through Task 3's gate again, never a moved tag.</action>
<verify>
<automated>../sm-demo-app/scripts/check-all.sh --local 2>&amp;1 | tail -1 | grep -qx 'check-all: ok'</automated>
<fails_when>Non-zero exit: any check-all step fails (a suite, the snapshot, pins, the release build, smoke, check-deploy, a browser check or check-live).</fails_when>
</verify>
<acceptance_criteria>
- The draft SUMMARY records `build: ok release <id>` and `smoke: ok` from this run.
</acceptance_criteria>
<done>The exact release that would go to rome passed the whole gate on this machine.</done>
</task>
<task type="checkpoint:decision" gate="blocking">
<name>Task 7: Go-ahead to push the demo repositories and deploy the release to rome</name>
<read_first>The release id from Task 6 and the check-all result; `git -C ../sm-demo-app log --oneline origin/master..HEAD` and the same for vue-demo-app; the list of what changes on rome: binary, site, config rsync; `migrate` (no new migrations in the bumped plugins: check `git -C <plugin> diff --stat <previous tag> <new tag> -- updates/`) and `demo:seed`; restart of summercms-demo and summercms-demo-site only; no nginx, Centrifugo, LiveKit, firewall or WavePath change; the rollback commands from DEPLOY.md "Rollback"</read_first>
<acceptance_criteria>
- The user's answer is recorded in the SUMMARY.
</acceptance_criteria>
<decision>Push vue-demo-app and sm-demo-app and deploy release <id> to demo.summercms.io?</decision>
<context>The live demo still has CR-01 (calls connect after Leave), CR-02 and CR-03 (filter bypasses), WR-01, WR-04 and WR-05. The release restarts only the demo's own two programs; bin/demo.prev and site/.output.prev stay for a rollback.</context>
<options>
<option id="deploy">
<name>Push and deploy</name>
<pros>The fixes are live today.</pros>
<cons>A short restart of the demo's API and site.</cons>
</option>
<option id="push-only">
<name>Push, deploy later</name>
<pros>The pins are backed up.</pros>
<cons>The live demo keeps the bugs; Tasks 8 to 10 wait.</cons>
</option>
<option id="hold">
<name>Hold</name>
<pros>No change anywhere.</pros>
<cons>As above, and the pins exist only here.</cons>
</option>
</options>
<resume-signal>Reply "deploy", "push-only" or "hold".</resume-signal>
</task>
<task type="auto">
<name>Task 8: Push the demo, upload and release on rome by the runbook, and check the live site</name>
<reversibility rating="costly">A release can be rolled back with bin/demo.prev and site/.output.prev (DEPLOY.md "Rollback"); migrations, if any ran, are not reversed.</reversibility>
<precondition>Task 7 answered "deploy" (with "push-only" do steps 1 and 2 only and stop).</precondition>
<files>(no repository files; rome: /srv/summercms-demo/bin, /srv/summercms-demo/site, /srv/summercms-demo/config)</files>
<read_first>../sm-demo-app/DEPLOY.md "Upload", "Release", "Verify", "Rollback"; 20-05-SUMMARY.md (how the last release went, shared-host rules)</read_first>
<action>Per SC-3 and D-10.
1. Push vue-demo-app master, check `git ls-remote` equals HEAD; then push sm-demo-app master, check the same.
2. With "push-only", record and stop here.
3. Build machine: DEPLOY.md "Upload", the three rsync lines exactly (config without overrides.yaml, bin/demo to bin/demo.new, vue-demo-app/.output/ to site/.output.new/, `--chown=root:root`, sudo rsync, `$RSH`), from the release built in Task 6 (re-run `scripts/build.sh` if anything changed since, then smoke.sh again).
4. rome: DEPLOY.md "Release", exactly as written, in this order:
- migrate and demo:seed with bin/demo.new as summercms-demo with SUMMER_ENV=production;
- keep bin/demo.prev and site/.output.prev, then swap in the new binary and site;
- `sudo supervisorctl restart summercms-demo summercms-demo-site`;
- websockets:health answers Configuration OK.
Restart nothing else. Every command that could carry a secret runs on rome without echoing it.
5. DEPLOY.md "Verify":
- `scripts/check-live.sh https://demo.summercms.io` prints `check-live: ok`;
- supervisorctl status shows the four demo programs RUNNING;
- the reset schedule stays off;
- `wavepath-livekit` keeps its pid (read-only check).
6. Record in the draft SUMMARY: the release id, the commands' results, the pids before and after, and the rollback state.</action>
<verify>
<automated>[ "$(git -C ../sm-demo-app ls-remote origin refs/heads/master | cut -f1)" = "$(git -C ../sm-demo-app rev-parse HEAD)" ] &amp;&amp; [ "$(git -C ../sm-demo-app/vue-demo-app ls-remote origin refs/heads/master | cut -f1)" = "$(git -C ../sm-demo-app/vue-demo-app rev-parse HEAD)" ] &amp;&amp; ../sm-demo-app/scripts/check-live.sh https://demo.summercms.io</automated>
<fails_when>Non-zero exit: a remote master differs from the local HEAD, or check-live reports any failure after the release (roll back per DEPLOY.md and report if the site or API is broken).</fails_when>
</verify>
<acceptance_criteria>
- `ssh -p 2222 debian@10.8.3.118 sudo supervisorctl status summercms-demo summercms-demo-site summercms-demo-centrifugo summercms-demo-livekit` shows four RUNNING lines.
</acceptance_criteria>
<done>demo.summercms.io runs the release with all six fixes, and its anonymous checks pass.</done>
</task>
<task type="checkpoint:human-action" gate="blocking">
<name>Task 9: The user signs in on the live demo so the probes can act as members (an authentication gate: live login needs a real Turnstile solve)</name>
<action>Sign in on https://demo.summercms.io in a browser and save the session token for the probes. Claude cannot do this because live login is behind Turnstile.</action>
<instructions>
Claude already deployed the release and ran the anonymous live checks. The member probes need a signed-in session:
1. In a browser, log in at https://demo.summercms.io/login as the demo's visitor account (or any member account you use for checks).
2. In the browser's developer tools (Application, then Cookies), copy the value of the cookie `summercms_demo_token`.
3. Save it in a file only you can read, without pasting it into this chat: `install -m 600 /dev/null ~/.config/summercms/demo-live-jwt`, then paste the value into that file with an editor.
4. For the two-browser call probe, do the same with a second member account (register one in a private window if needed) into `~/.config/summercms/demo-live-jwt2`.
Alternatively run the checks yourself ("manual"):
- Send each probe from DEPLOY.md "Verify" as a DM to Ada and as a forum reply. Each must be refused, and the plain word viagra too.
- Open /call/{your DM with Ada}?start=1 directly. A Start call button must show, and the camera must stay off until you click it.
- From a second browser, call yourself from the DM button and accept. Both sides must connect.
- Leave while the page still says "Connecting…". The camera light must go off and the other side must stop ringing.
- Log out while a call rings. The prompt and the chat panel must go away.
</instructions>
<verification>Claude checks that each file exists with mode 600 and is not empty (`stat -c %a`, `test -s`), without reading its content into the conversation.</verification>
<resume-signal>Reply "tokens ready" (both files), "one token" (only demo-live-jwt; the call probe is then your manual check) or "manual approved" / "manual failed: what you saw".</resume-signal>
</task>
<task type="auto">
<name>Task 10: Live recheck: the bypass probe, the call probe, check-live and smoke, then the changelog drafts</name>
<precondition>Task 9 answered; for the automated probes the token files exist with mode 600.</precondition>
<files>(no repository files; drafts in this session's scratchpad)</files>
<read_first>The Task 9 answer, ../sm-demo-app/DEPLOY.md "Verify" (the probe commands from Task 1), ../sm-summercmsio-app/DEPLOY.md "Posting to the changelog", the CLAUDE.md changelog rules</read_first>
<action>Per SC-2, D-17 and D-13.
1. With a token: `DEMO_JWT_FILE=~/.config/summercms/demo-live-jwt ../sm-demo-app/scripts/check-moderation.sh https://demo.summercms.io` prints `check-moderation: ok`.
2. With two tokens: `DEMO_JWT_FILE=~/.config/summercms/demo-live-jwt DEMO_JWT2_FILE=~/.config/summercms/demo-live-jwt2 NODE_PATH="$(npm root -g)" node ../sm-demo-app/scripts/check-chat.cjs --base https://demo.summercms.io --call` prints `check-chat: ok call`. Fake media goes through rome's LiveKit; the direct-load step shows the confirmation. Do not run the default mode live: it would post in public #general and log the token out.
3. With "manual approved", record the user's answer instead of the automated probe it replaces; with "manual failed", stop and report what the user saw against the fix it points to.
4. `../sm-demo-app/scripts/check-live.sh https://demo.summercms.io` and `../sm-demo-app/scripts/smoke.sh` (the deployed artifact bin/demo) again; both ok.
5. Remove the two token files (`rm -f`) and tell the user their browser sessions stay signed in.
6. Changelog drafts. From ../sm-summercmsio-app run `scripts/changelog-post.py source <tag> --repo ../sm-moderation-plugin`, and the same for sm-forum-plugin. Write the user-facing notes to $SCRATCH/changelog-moderation.md and $SCRATCH/changelog-forum.md, using sections `## Highlights`, `## Added`, `## Changed` and `## Fixed` as needed. Include no H1, no planning IDs and no `quick-*` codes, and no consuming application's name. Add a one-line plain-text excerpt for each.
- Moderation: banned words and links now match what readers see (invisible characters, Unicode spaces, diacritics, entities, inline markup, URL forms browsers normalise); path entries cover subdomains; MatchHTML and Filter.CheckHTML for rendered content.
- Forum: PostSaving carries the rendered post HTML.
7. Record every result in the draft SUMMARY.</action>
<verify>
<automated>../sm-demo-app/scripts/check-live.sh https://demo.summercms.io &amp;&amp; test -s "$SCRATCH/changelog-moderation.md" &amp;&amp; test -s "$SCRATCH/changelog-forum.md" &amp;&amp; ! grep -qE '^# |CR-0|WR-0|IN-0|20-0[0-9]|quick-' "$SCRATCH/changelog-moderation.md" "$SCRATCH/changelog-forum.md"</automated>
<fails_when>Non-zero exit: check-live fails, a draft is missing, or a draft has an H1, a review or plan ID or a quick code. The probe runs of steps 1 and 2 are recorded with their output line; a probe failure stops the plan with a report, which is not a verify failure.</fails_when>
</verify>
<acceptance_criteria>
- The draft SUMMARY records `check-moderation: ok` and `check-chat: ok call` against https://demo.summercms.io, or the user's manual answer for each.
- `test -e ~/.config/summercms/demo-live-jwt || echo gone` prints gone.
</acceptance_criteria>
<done>The live demo refuses every bypass from the review, asks before a call page turns media on, completes a DM call, and passes its anonymous checks and smoke run.</done>
</task>
<task type="checkpoint:decision" gate="blocking">
<name>Task 11: Go-ahead for the two plugin changelog posts</name>
<read_first>$SCRATCH/changelog-moderation.md and $SCRATCH/changelog-forum.md with their excerpts, the tags (sm-moderation-plugin v0.1.1, sm-forum-plugin v0.1.2), and whether ~/.config/summercms/journal-token exists (`test -s`, never read)</read_first>
<acceptance_criteria>
- The user's answer is recorded in the SUMMARY, with any wording changes applied to the drafts.
</acceptance_criteria>
<decision>Publish the two plugin posts on https://summercms.io/changelog/plugins?</decision>
<context>CLAUDE.md: plugin release tags get a post on /changelog/plugins the same day. The posts are public and can be updated later with --update. The layers get no post (no plugin.yaml, no changelog stream).</context>
<options>
<option id="publish">
<name>Publish both</name>
<pros>The releases are announced the day they are tagged.</pros>
<cons>Public at once.</cons>
</option>
<option id="draft">
<name>Save as drafts (--draft)</name>
<pros>The text can be reviewed in the admin first.</pros>
<cons>Not announced until published.</cons>
</option>
<option id="skip">
<name>Skip</name>
<pros>No post.</pros>
<cons>Breaks the same-day rule.</cons>
</option>
</options>
<resume-signal>Reply "publish", "draft" or "skip", with any changes to the text.</resume-signal>
</task>
<task type="auto">
<name>Task 12: Publish the posts as answered, and close the review ledger with commit refs and follow-up todos</name>
<precondition>Task 11 answered.</precondition>
<files>.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md, .planning/todos/pending/chatchannels-pin-policy.md, .planning/todos/pending/moderation-profile-group-and-filenames.md, .planning/todos/pending/forum-friends-client-401-refresh.md, .planning/todos/pending/chatvideo-dm-only-host-hook.md, .planning/todos/pending/chatvideo-live-membership.md, .planning/todos/pending/check-local-jwt-out-of-argv.md, .planning/todos/pending/chat-slash-text-escape.md, .planning/todos/pending/demo-seed-moderation-lists-once.md, .planning/todos/pending/demo-nginx-livekit-rtc-only.md, .planning/todos/pending/chatvideo-incoming-handle-leak.md, .planning/todos/pending/demo-vapid-runbook-pipefail.md, .planning/todos/pending/demo-chat-members-read-only.md</files>
<read_first>20-REVIEW-DISPOSITION.md, 20-REVIEW.md (WR-02, WR-03, WR-06, IN-01 to IN-09: files, issue, fix), two existing files in .planning/todos/pending/ (format), .planning/G15OFFICE.md (todo mirroring), the commit refs from the 20-07, 20-08 and draft 20-09 SUMMARYs</read_first>
<action>Per SC-4 and the brief.
1. Posts (with "publish" or "draft"):
- From ../sm-summercmsio-app, for each plugin, check the checkout is exactly at its tag with a clean worktree (`git -C ../sm-<name>-plugin describe --exact-match HEAD`; check out the tag if main moved on).
- Run `scripts/changelog-post.py publish <tag> <draft file> --excerpt "<line>" --repo ../sm-<name>-plugin`, adding --draft for "draft". The script reads the journal token itself.
- If the token file is missing or the token is refused, stop and ask the user. Never print, copy or mint a token.
- Check https://summercms.io/changelog/plugins lists the published posts.
- Return the checkouts to main.
2. 20-REVIEW-DISPOSITION.md: CR-01, CR-02, CR-03, WR-01, WR-04 and WR-05 become `fixed`. Each note names the repo, the commit short sha and the tag, for example `sm-moderation-plugin <sha> (v0.1.1)`, plus the live check that confirmed it. WR-02, WR-03, WR-06 and IN-01 to IN-09 become `deferred`, each note pointing at its todo file. Add a `closed: 2026-11-02` line (or the actual date) to the frontmatter.
3. Todos, one per deferred finding, in the existing format: title, date, priority (high for WR-02 and WR-03, medium for WR-06, IN-01, IN-02 and IN-07, low for the rest), area (the repo and file), an empty g15office field until the task exists. The body gives the finding's issue and fix in two or three sentences, with "Source: phase 20 code review (20-REVIEW.md <ID>)". IN-07's todo notes that the logout half was fixed by 20-08. The files are:
- chatchannels-pin-policy.md (WR-02)
- moderation-profile-group-and-filenames.md (WR-03)
- forum-friends-client-401-refresh.md (WR-06)
- chatvideo-dm-only-host-hook.md (IN-01)
- chatvideo-live-membership.md (IN-02)
- check-local-jwt-out-of-argv.md (IN-03)
- chat-slash-text-escape.md (IN-04)
- demo-seed-moderation-lists-once.md (IN-05)
- demo-nginx-livekit-rtc-only.md (IN-06)
- chatvideo-incoming-handle-leak.md (IN-07)
- demo-vapid-runbook-pipefail.md (IN-08)
- demo-chat-members-read-only.md (IN-09)
4. g15office (.planning/G15OFFICE.md):
- Create one task per todo in project summercms (type Bug for WR-02, WR-03, WR-06, IN-02, IN-04, IN-05, IN-07 and IN-09, Improvement for the rest). Each description ends with `Local: .planning/todos/pending/<file>`. Write each task id into its todo's frontmatter.
- Post a short comment on the Phase 20 milestone task: the gap round released and deployed, with the four tags.
- If the g15office tools do not answer, leave the ids empty and list the todos as left for the user in the SUMMARY. Do not edit G15OFFICE.md itself.
5. Commit in summercms.go by explicit path (planning docs only; STATE.md, state.json and G15OFFICE.md untouched): `docs(20): review disposition after the gap closure`.</action>
<verify>
<automated>D=.planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md; for f in CR-01 CR-02 CR-03 WR-01 WR-04 WR-05; do grep -E "^\| $f \|" $D | grep -q '| fixed |' || exit 1; done; for f in WR-02 WR-03 WR-06 IN-01 IN-02 IN-03 IN-04 IN-05 IN-06 IN-07 IN-08 IN-09; do grep -E "^\| $f \|" $D | grep -q '| deferred |' || exit 1; done; ls .planning/todos/pending/{chatchannels-pin-policy,moderation-profile-group-and-filenames,forum-friends-client-401-refresh,chatvideo-dm-only-host-hook,chatvideo-live-membership,check-local-jwt-out-of-argv,chat-slash-text-escape,demo-seed-moderation-lists-once,demo-nginx-livekit-rtc-only,chatvideo-incoming-handle-leak,demo-vapid-runbook-pipefail,demo-chat-members-read-only}.md >/dev/null &amp;&amp; git diff --quiet HEAD -- $D</automated>
<fails_when>Non-zero exit: a finding has the wrong disposition, a todo file is missing, or the ledger change is not committed.</fails_when>
</verify>
<acceptance_criteria>
- `grep -c '| open |' .planning/phases/20-demo-instance-with-every-shared-plugin/20-REVIEW-DISPOSITION.md` prints 0.
- Every fixed row names at least one commit sha and tag.
- The SUMMARY records the post URLs (or the draft ids, or "skipped") and the g15office ids or the note that they are left for the user.
</acceptance_criteria>
<done>The gap round is announced as the user chose, every review finding has its final disposition, and every deferred one is a tracked todo.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| build machine to origin | pushes and one-way tags that other applications pin |
| build machine to rome | rsync and sudo on a shared production host |
| probes to the live demo | member sessions posting test content on a public site |
| build machine to summercms.io | the journal token publishing posts |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-20-47 | Tampering | release tags | high | mitigate | annotated tags on the default branch only after Task 3's go-ahead; fast-forward check before push; ls-remote equals HEAD; earlier tags are ancestors; never moved, a fix gets a new patch tag |
| T-20-48 | Information disclosure | live member JWTs | high | mitigate | the user writes them into 0600 files (never pasted); scripts read the files, never print them, and pass the bearer header to curl as a config on stdin; the files are removed after the probes; the live default mode of check-chat (which would log out and post publicly) is not run |
| T-20-49 | Tampering | probe content on the live demo | medium | mitigate | probes post only in the visitor's own DM and as replies or one thread on seeded content; a control word must be refused first; anything a probe stored is deleted at once and reported |
| T-20-50 | Information disclosure | journal token | high | mitigate | changelog-post.py reads ~/.config/summercms/journal-token itself; it is never printed, copied or minted; a missing or refused token stops the step and asks the user |
| T-20-51 | Denial of service | the shared host during the release | medium | mitigate | DEPLOY.md's release restarts only summercms-demo and summercms-demo-site; WavePath's pid is checked before and after; rollback with bin/demo.prev and site/.output.prev |
| T-20-52 | Tampering | temporary integration leaking into a release | medium | mitigate | the scratch go.work and the tarball pins live outside the repos or are reverted in Task 2 (verify checks package.json and pnpm-lock.yaml are unchanged); build.sh release refuses dirty trees and pins off go.mod |
| T-20-SC | Tampering | npm and Go installs | high | mitigate | only the project's own layers and plugins change version, by git tag; no third-party package is added or bumped; Go tidy runs against tags already on origin |
</threat_model>
<verification>
- Task 1: the three checks pass against the unreleased fixes running together locally.
- Task 2: every touched repository's full suite; the integration reverted; the release table.
- Task 3: go-ahead for push and tags.
- Task 4: remote heads and tags equal local HEAD.
- Task 5: the demo on the tags, the listener on the rendered post, TestDemoModeration and check-pins green.
- Task 6: check-all.sh --local ends with check-all: ok (release build and smoke included).
- Task 7: go-ahead for push and deploy.
- Task 8: pushed heads, the runbook release, check-live ok.
- Task 9: live tokens or the user's manual answer.
- Task 10: bypass probe and call probe against the live site, check-live and smoke again, changelog drafts clean.
- Task 11: go-ahead for the posts.
- Task 12: posts as answered; the ledger closed; twelve todos.
</verification>
<success_criteria>
The six fixed findings are released at patch tags, consumed by the demo, deployed on demo.summercms.io and proven there (bypass probe, call probe, check-live, smoke); the two plugin posts are handled as the user decided; 20-REVIEW-DISPOSITION.md has no open row and every deferred finding is a todo.
</success_criteria>
<output>
Create `.planning/phases/20-demo-instance-with-every-shared-plugin/20-09-SUMMARY.md` when done (it grows from the draft started in Task 2): the release table and tags, every checkpoint answer, the demo commits, the release id and rome results, the live probe results, the post URLs, the ledger changes and the todo list with g15office ids.
</output>

View File

@@ -0,0 +1,31 @@
---
phase: 20-demo-instance-with-every-shared-plugin
review: 20-REVIEW.md
recorded: 2026-11-02
closed: 2026-11-03
---
# Phase 20 review disposition
One row per finding in 20-REVIEW.md. `fixed` names the commits and the release tag and the check that confirmed it on the live demo (release 195aa213c546, deployed 2026-11-02 by plan 20-09); `deferred` points at the todo that tracks it. No row is open.
| Finding | Severity | Disposition | Note |
|---|---|---|---|
| CR-01 | critical | fixed | Leaving or unmounting during start/join still connects and publishes camera and microphone. vue-chatvideo-layer 69e8b83, 27ad81c (v0.1.1): a per-attempt token with stale checks after every await; leave is final at any moment. Live: `check-chat.cjs --call` ok against demo.summercms.io. |
| CR-02 | critical | fixed | Banned-link filter bypass through URL forms the browser normalises, rendered as working links. sm-moderation-plugin 266fc60, 9715ce7 (v0.1.1): link hosts and paths canonicalised like the URL parser; vue-chat-layer a798bb1 (v0.1.1): deceptive hosts render as text; sm-demo-app 262da37 (CheckHTML on the rendered forum post). Live: `check-moderation.sh` ok (fixed probe, sm-demo-app da481c9), every link form refused in chat, forum reply and thread title. |
| CR-03 | critical | fixed | Banned-word filter bypass through invisible characters, Unicode spaces and forum Markdown. sm-moderation-plugin 266fc60, 9715ce7, 334697b (v0.1.1): words matched after NFKC, format characters, Unicode spaces, diacritics, entities and inline markup; MatchHTML/CheckHTML; sm-forum-plugin ec1a82c (v0.1.2): PostSaving.HTML; sm-demo-app 262da37 (listener checks the rendered post). Live: `check-moderation.sh` ok, every word form refused. |
| WR-01 | warning | fixed | Logout leaves the chat store and the realtime socket of the previous user running. vue-demo-app 188ae25 (pinned in sm-demo-app 27c48cf with layers v0.1.1): logout and unauthorized reset the chat, close the realtime socket and dismiss the ring. Local: check-chat.cjs default mode, every /ws socket closed within 5 s of Log out (not run live: it posts in #general). |
| WR-02 | warning | deferred | Any member can pin or unpin any message in every public channel; the message is not checked against the channel. Todo: .planning/todos/pending/chatchannels-pin-policy.md |
| WR-03 | warning | deferred | Member-visible text outside the chat and forum seams is never moderated. Todo: .planning/todos/pending/moderation-profile-group-and-filenames.md |
| WR-04 | warning | fixed | A link opens a call and turns the camera and microphone on with no confirmation. vue-chatvideo-layer 5386903 (v0.1.1): the call page asks before media unless the call button or Accept handed over; vue-demo-app 9a12701 (pins). Live: `check-chat.cjs --call`, a direct /call load showed the confirmation with no LiveKit socket, tile or session before the click. |
| WR-05 | warning | fixed | A failed LiveKit connect posts `leave`, not `end`, leaving an empty ringing session behind. vue-chatvideo-layer 27ad81c (v0.1.1): a failed connect (or livekit-client import) ends a session nobody else joined, from GET status. Unit tests in useCall.test.ts; deployed with release 195aa213c546. |
| WR-06 | warning | deferred | The forum and friends clients have no 401 refresh; an expired token shows "not found". Todo: .planning/todos/pending/forum-friends-client-401-refresh.md |
| IN-01 | info | deferred | Group calls in public channels are blocked only by the seeded participant count. Todo: .planning/todos/pending/chatvideo-dm-only-host-hook.md |
| IN-02 | info | deferred | chatvideo checks participant rows, not live membership. Todo: .planning/todos/pending/chatvideo-live-membership.md |
| IN-03 | info | deferred | check-local passes member JWTs to curl in argv. Todo: .planning/todos/pending/check-local-jwt-out-of-argv.md |
| IN-04 | info | deferred | A chat message that starts with "/" can never be posted. Todo: .planning/todos/pending/chat-slash-text-escape.md |
| IN-05 | info | deferred | `demo:seed` brings back the default moderation lists after an admin empties them. Todo: .planning/todos/pending/demo-seed-moderation-lists-once.md |
| IN-06 | info | deferred | nginx `/livekit/` exposes LiveKit's whole HTTP surface. Todo: .planning/todos/pending/demo-nginx-livekit-rtc-only.md |
| IN-07 | info | deferred | The incoming-call runtime can leak a session handle and survives logout. The logout half was fixed by 20-08 (vue-demo-app 188ae25); the handle leak remains. Todo: .planning/todos/pending/chatvideo-incoming-handle-leak.md |
| IN-08 | info | deferred | The VAPID runbook pipeline runs without `pipefail`. Todo: .planning/todos/pending/demo-vapid-runbook-pipefail.md |
| IN-09 | info | deferred | `GET /chat/members` writes, and builds an unbounded `IN` list. Todo: .planning/todos/pending/demo-chat-members-read-only.md |

View File

@@ -0,0 +1,387 @@
---
phase: 20-demo-instance-with-every-shared-plugin
reviewed: 2026-11-01T23:50:42Z
depth: standard
files_reviewed: 105
files_reviewed_list:
- ../sm-chat-plugin/api/errors.go
- ../sm-chat-plugin/classes/service.go
- ../sm-chat-plugin/classes/writes.go
- ../sm-chat-plugin/contracts/rejection.go
- ../sm-chat-plugin/events/events.go
- ../sm-chatvideo-plugin/go.mod
- ../sm-demo-app/config/env/production/golem15.chatvideo.yaml
- ../sm-demo-app/config/golem15.chatvideo.yaml
- ../sm-demo-app/config/golem15.chat.yaml
- ../sm-demo-app/deploy/nginx/demo.summercms.io.conf
- ../sm-demo-app/deploy/supervisor/summercms-demo-livekit.conf
- ../sm-demo-app/deploy/centrifugo.json.example
- ../sm-demo-app/deploy/livekit.yaml.example
- ../sm-demo-app/deploy/env.example
- ../sm-demo-app/DEPLOY.md
- ../sm-demo-app/.gitmodules
- ../sm-demo-app/go.mod
- ../sm-demo-app/go.work
- ../sm-demo-app/plugins/demo/chat_api.go
- ../sm-demo-app/plugins/demo/chatbots.go
- ../sm-demo-app/plugins/demo/chat.go
- ../sm-demo-app/plugins/demo/classes/chat_context.go
- ../sm-demo-app/plugins/demo/classes/forum_access.go
- ../sm-demo-app/plugins/demo/config/config.yaml
- ../sm-demo-app/plugins/demo/console/reset.go
- ../sm-demo-app/plugins/demo/console/seed_chat.go
- ../sm-demo-app/plugins/demo/console/seed_forum.go
- ../sm-demo-app/plugins/demo/console/seed_friends.go
- ../sm-demo-app/plugins/demo/console/seed.go
- ../sm-demo-app/plugins/demo/moderation.go
- ../sm-demo-app/plugins/demo/plugin.go
- ../sm-demo-app/plugins/demo/realtime_access.go
- ../sm-demo-app/plugins/demo/routes.go
- ../sm-demo-app/plugins.gen.go
- ../sm-demo-app/scripts/check-all.sh
- ../sm-demo-app/scripts/check-chat.cjs
- ../sm-demo-app/scripts/check-deploy.sh
- ../sm-demo-app/scripts/check-live.sh
- ../sm-demo-app/scripts/check-local.sh
- ../sm-demo-app/scripts/dev.sh
- ../sm-demo-app/scripts/smoke.sh
- ../sm-demo-app/summer.yaml
- ../sm-demo-app/vue-demo-app/app/assets/css/site.css
- ../sm-demo-app/vue-demo-app/app/components/SiteHeader.vue
- ../sm-demo-app/vue-demo-app/app/components/SiteNav.vue
- ../sm-demo-app/vue-demo-app/app/components/TourCard.vue
- ../sm-demo-app/vue-demo-app/app/layouts/default.vue
- ../sm-demo-app/vue-demo-app/app/lib/realtime.ts
- ../sm-demo-app/vue-demo-app/app/pages/account/security.vue
- ../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue
- ../sm-demo-app/vue-demo-app/app/pages/chat.vue
- ../sm-demo-app/vue-demo-app/app/pages/forum/index.vue
- ../sm-demo-app/vue-demo-app/app/pages/forum/t/[id].vue
- ../sm-demo-app/vue-demo-app/app/pages/friends.vue
- ../sm-demo-app/vue-demo-app/app/pages/index.vue
- ../sm-demo-app/vue-demo-app/app/plugins/auth.ts
- ../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts
- ../sm-demo-app/vue-demo-app/nuxt.config.ts
- ../sm-demo-app/vue-demo-app/pnpm-lock.yaml
- ../sm-demo-app/vue-demo-app/vitest.config.ts
- ../sm-forum-plugin/api/errors.go
- ../sm-forum-plugin/classes/forum_service.go
- ../sm-forum-plugin/classes/lifecycle.go
- ../sm-forum-plugin/contracts/rejection.go
- ../sm-forum-plugin/events/events.go
- ../sm-herald-plugin/go.mod
- ../sm-moderation-plugin/admin.go
- ../sm-moderation-plugin/classes/filter.go
- ../sm-moderation-plugin/go.mod
- ../sm-moderation-plugin/models/settings.go
- ../sm-moderation-plugin/plugin.go
- ../sm-moderation-plugin/config/config.yaml
- ../sm-moderation-plugin/models/settings/fields.yaml
- ../sm-moderation-plugin/updates/202610280001_create_golem15_moderation_settings.go
- ../sm-userfriends-plugin/go.mod
- ../vue-chat-layer/app/assets/css/chat-tokens.css
- ../vue-chat-layer/app/components/Chat/CommandPicker.vue
- ../vue-chat-layer/app/components/Chat/FloatingPanel.vue
- ../vue-chat-layer/app/components/Chat/Header.vue
- ../vue-chat-layer/app/components/Chat/ThreadPane.vue
- ../vue-chat-layer/app/components/Chat/Message.vue
- ../vue-chat-layer/app/components/Chat/MessageList.vue
- ../vue-chat-layer/app/components/Chat/LinkEmbed.vue
- ../vue-chat-layer/app/composables/useChat.ts
- ../vue-chat-layer/app/lib/client.ts
- ../vue-chat-layer/app/lib/chatText.ts
- ../vue-chat-layer/app/lib/markdown.ts
- ../vue-chat-layer/app/lib/linkEmbeds.ts
- ../vue-chat-layer/app/lib/realtime.ts
- ../vue-chat-layer/app/lib/slots.ts
- ../vue-chat-layer/nuxt.config.ts
- ../vue-chat-layer/vitest.config.ts
- ../vue-chatvideo-layer/app/composables/useCall.ts
- ../vue-chatvideo-layer/app/composables/useIncomingCalls.ts
- ../vue-chatvideo-layer/app/lib/callMachine.ts
- ../vue-chatvideo-layer/app/lib/videoClient.ts
- ../vue-chatvideo-layer/app/components/Chatvideo/Call.vue
- ../vue-chatvideo-layer/app/components/Chatvideo/CallButton.vue
- ../vue-chatvideo-layer/app/components/Chatvideo/IncomingCall.vue
- ../vue-chatvideo-layer/app/components/Chatvideo/Tile.vue
- ../vue-chatvideo-layer/nuxt.config.ts
- ../vue-forum-layer/app/components/Forum/Thread.vue
- ../vue-forum-layer/app/utils/forumClient.ts
- ../vue-userfriends-layer/app/components/Friends/Groups.vue
- ../vue-userfriends-layer/app/utils/friendsClient.ts
findings:
critical: 3
warning: 6
info: 9
total: 18
status: issues_found
---
# Phase 20: Code Review Report
**Reviewed:** 2026-11-01T23:50:42Z
**Depth:** standard
**Files Reviewed:** 105 (the 86 listed files, plus the layer components, libs and deploy files the SUMMARYs under-listed)
**Status:** issues_found
## Summary
The review covered the phase's code in its sibling repositories. That is the chat and forum pre-save seams (`git diff v0.1.4..main` and `v0.1.0..main`; both tags exist), the new sm-moderation-plugin, the sm-demo-app host plugin, deploy files and scripts (commits since 2026-10-28), vue-demo-app since 44a5229, and the four new layers.
Areas that held up when traced:
- **Pre-save seams.** Both are additive and silent without a listener, and they map `contracts.Rejection` to 422 on every chat and forum write path (send, reply, ReplyTo, edit; thread, reply, edit).
- **Core plugins.** The phase changed no core plugin (user, journal/blog, pages, payment). sm-user-plugin is consumed by tag and unchanged.
- **XSS.** `renderChatText` escapes everything before it adds tags, placeholders cannot be forged (`\u0000` is stripped), and `safeUrl` refuses `javascript:`, `data:` and `//` / `/\` paths. Forum `content_html` comes from goldmark plus bluemonday. Attachments download as octet-stream with the `download` attribute. No XSS was found.
- **Realtime authorization.** Every Centrifugo namespace goes through the subscribe proxy. The `user`, `chat`, `video` and `presentations` authorizers each check their own rule, so giving every member a connection token does not widen channel access. LiveKit tokens are scoped to one room, with no `roomAdmin`.
- **Runbook secrets.** The runbooks keep secrets out of argv and logs.
Three defects need fixing before more traffic reaches the demo:
1. **Call race (CR-01).** The call composable connects to LiveKit and publishes the camera and microphone after the user has already left or navigated away.
2. **Link filter bypass (CR-02).** The banned-link filter misses URL forms that browsers normalise to the banned host. The chat then renders them as working links and link cards.
3. **Word filter bypass (CR-03).** The banned-word filter misses invisible characters, non-breaking spaces and forum Markdown that renders to the banned word.
Each bypass was confirmed by running `classes.Match` against the probes; all of them returned `flagged=false`.
## Critical Issues
### CR-01: Leaving or unmounting during start/join still connects and publishes camera and microphone
**File:** `../vue-chatvideo-layer/app/composables/useCall.ts:177-231` (also `258-266`, `274-276`; Leave is enabled while `starting`/`connecting` in `../vue-chatvideo-layer/app/components/Chatvideo/Call.vue:72,91`)
**Issue:** `begin()` never re-checks the state or `leaving` after its awaits (`client.start`/`client.join` at line 184, `import('livekit-client')` at line 193). It also assigns `room` only after the import. `leave()` sees `room === null`, so it cannot disconnect anything.
- **Caller:** Leave is clicked while the status shows "Connecting…" (the state is `starting`). `leave()` dispatches `ended`, posts `end` (404, because the session does not exist yet) and navigates away. Then `start` resolves. `begin` subscribes `video:session:{id}`, loads livekit-client, creates a `Room`, connects, and runs `setCameraEnabled(true)` and `setMicrophoneEnabled(true)`. The server session was created and the callee is ringing. If they accept, they see and hear a caller who believes they hung up. Nothing on the page can stop it, and the channel handle leaks.
- **Callee:** this path is worse. `begin(false)` dispatches nothing before `await client.join()`, so the state stays `idle`. Navigating away during the join runs `onBeforeUnmount → leave()`, which returns early on `status === 'idle'` (line 259). Then the join resolves: `transition` lets `joined` move `idle → connecting`, and the callee is live in the room with camera and microphone, with no UI and no leave posted.
- **Second join:** the same missing guard lets a second `begin(false)` start while the first is pending. That creates two Rooms, and the first is never disconnected.
**Fix:** Add a per-attempt token and bail out after every await. Mark the attempt live before the first await. Make `leave()` work from the pre-room states.
```ts
let attempt = 0
async function begin(start: boolean) {
if (state.value.status !== 'idle' && isLive(state.value)) return
const mine = ++attempt
leaving = false
dispatch({ type: 'start' }) // also for the callee: leaves 'idle' before any await
const stale = () => mine !== attempt || leaving || !isLive(state.value)
let join: VideoJoin
try { join = start ? (takeStart(conversationId) ?? (await client.start(conversationId))) : await client.join(conversationId) }
catch (e) { if (!stale()) dispatch({ type: 'error', code: e instanceof VideoApiError ? e.status : 0, message: e instanceof Error ? e.message : '' }); return }
if (stale()) { void (start ? client.end(conversationId) : client.leave(conversationId)).catch(() => {}); return }
// ...same checks after import('livekit-client'), after r.connect(), and before each setXEnabled:
// if (stale()) { await r.disconnect(true); return }
}
async function leave() {
if (leaving || !isLive(state.value)) return // no early return on 'idle' while an attempt is pending
leaving = true; attempt++ // invalidates the in-flight begin
// ...
}
```
Add `useCall.test.ts` cases: "leave while start is pending" and "unmount while join is pending". Both must assert that `Room.connect` and `setCameraEnabled` are never called.
### CR-02: Banned-link filter bypass through URL forms the browser normalises, rendered as working links
**File:** `../sm-moderation-plugin/classes/filter.go:50,122-135`; `../sm-moderation-plugin/models/settings.go:137-168`; rendering in `../vue-chat-layer/app/lib/chatText.ts:87-93`, `../vue-chat-layer/app/lib/linkEmbeds.ts:40-47,69-83` and `../vue-chat-layer/app/components/Chat/LinkEmbed.vue:13`
**Issue:** `hostPattern` matches the literal text and compares hosts and paths byte for byte. The WHATWG URL parser (browsers, and `new URL` in `linkEmbeds.ts`) percent-decodes and IDNA-maps the host, so each form below reaches the banned host. Every probe returned `flagged=false` against `Match(["viagra",...], ["bit.ly","example.com/promo"], …)`. With `node`, `new URL()` resolves each one to `bit.ly`:
| Text sent | What the browser opens |
|---|---|
| `https://bit%2Ely/x` | `https://bit.ly/x` |
| `https://bit.l%79/x` | `https://bit.ly/x` |
| `https://bit.ly/x` (fullwidth) | `https://bit.ly/x` |
| `https://bit。ly/x` (U+3002) | `https://bit.ly/x` |
| `https://example.com:443/promo` | path rule skipped: the port stops the path group |
| `https://example.com/%70romo`, `//promo`, `https://example.com./promo` | path-prefix rules skipped |
| `https://sub.example.com/promo` | path rules never cover subdomains |
| punycode `xn--…` vs. Unicode host | either spelling of an IDN bypasses the other |
The chat then renders the bypass as a clickable `<a href="https://bit%2Ely/x">`. `ChatLinkEmbed` makes it worse: its card shows the normalised host `bit.ly` and links to `https://bit.ly/x`. The forum renders the same through goldmark autolinks. Spammers can post any banned link, which defeats D-17 for links.
**Fix:** Normalise both sides the way the browser does before comparing. In the filter, find every candidate URL or host, then:
```go
// for each candidate: s := found[0]; if no scheme, s = "http://" + s
u, err := url.Parse(s) // then:
host, _ := url.PathUnescape(u.Hostname()) // %2E -> .
host = strings.Map(func(r rune) rune { // ideographic/fullwidth dots
switch r { case '。', '.', '。': return '.' }; return r }, host)
host, err = idna.Lookup.ToASCII(norm.NFKC.String(host)) // fullwidth -> ASCII, Unicode -> punycode (x/net/idna)
host = strings.TrimSuffix(strings.TrimPrefix(strings.ToLower(host), "www."), ".")
path := path.Clean("/" + mustUnescape(u.EscapedPath())) // //promo, /./promo, %70romo
```
Apply the same `idna.Lookup.ToASCII` and NFKC to entries in `LinkEntry`. Let path rules also match subdomains, as host rules do. Widen `hostPattern` so its host class takes `%`, `.` and `。`, or tokenise on whitespace and parse each token. Add these probes to `filter_test.go`. `golang.org/x/net/idna` and `x/text` are already transitive dependencies of the framework; note them per the dependency rule.
### CR-03: Banned-word filter bypass through invisible characters, Unicode spaces and forum Markdown
**File:** `../sm-moderation-plugin/classes/filter.go:45,91,94,115`; seams `../sm-forum-plugin/classes/forum_service.go:284,341` and `../sm-forum-plugin/classes/lifecycle.go:235`; listener `../sm-demo-app/plugins/demo/moderation.go:65,86`
**Issue:** The word regexp uses `[^\p{L}\p{N}_]` as its boundary and RE2's ASCII-only `\s+` between the words of a phrase. Confirmed with `classes.Match`:
- **Invisible characters.** `via​gra` (zero-width space) and `vi­agra` (soft hyphen) display as "viagra" and are not flagged. Format characters (`\p{Cf}`) count as boundaries.
- **Unicode spaces.** `buy followers` (NBSP; likewise U+2009, U+3000) is not flagged.
- **NFD text.** Polish diacritics typed in decomposed (NFD) form do not match an NFC entry, and the combining mark counts as a boundary.
- **Forum Markdown.** The forum seam passes the raw Markdown body and title, but members see `breakwater.Render` output. `via**gra**` renders "via**gra**" as one word, `vi&#97;gra` renders "viagra", and `[x](https://bit&#46;ly/a)` renders a link to `bit.ly` because CommonMark decodes entities in link destinations. None of them are flagged.
Moderation is therefore cosmetic against anyone who tries once.
**Fix:** Normalise the text before matching, in `Filter.Check` (and `Match`):
```go
t := norm.NFKC.String(text)
t = strings.Map(func(r rune) rune {
if unicode.Is(unicode.Cf, r) { return -1 } // ZWSP, ZWJ, soft hyphen, BOM...
if unicode.IsSpace(r) { return ' ' } // NBSP, thin, ideographic spaces
return r
}, t)
```
Use `[\p{Z}\s]+` in place of `\s+` between phrase words. Normalise entries with the same function in `ParseList`.
For the forum, check the rendered text too. In the demo's `checkPost`, run the filter on `html.UnescapeString` of `breakwater.Render(body)` with tags stripped, and on the hrefs it contains. Alternatively, have forum's `PostSaving` carry the rendered HTML (an additive field) so every host gets it.
## Warnings
### WR-01: Logout leaves the chat store and the realtime socket of the previous user running
**File:** `../sm-demo-app/vue-demo-app/app/composables/useDemoAuth.ts:83-92`, `../sm-demo-app/vue-demo-app/app/components/SiteHeader.vue:12-15`, `../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts:57`; `reset()` in `../vue-chat-layer/app/composables/useChat.ts:1514-1516`
**Issue:** `logout()` blacklists the JWT and clears the cookie. Nothing calls `useChat().reset()` or the realtime `disconnect()`, and the floating panel just unmounts. `start()` is the only caller of `reset()`, and it runs only when a chat view mounts again. After logout the tab therefore keeps:
- the Centrifugo connection and the `user:{me}` subscription, which deliver the old user's DM and call events until the connection token expires;
- the old user's messages and DMs in `useState`;
- a pending incoming-call prompt in `chatvideo:incoming`.
`$chatAuth.unauthorized()` has the same gap: it only clears the cookie. The layer's own comment says reset exists so that a second account never sees the first one's chat, but the host never wires it.
**Fix:** In `logout()` (and in `unauthorized`), after clearing the token, call `useChat().reset()` (it disconnects the shared client) and clear `useState('chatvideo:incoming')`. Alternatively, `watch(loggedIn)` in `plugins/auth.ts` and reset when it turns false. Add a vitest case for the logout path.
### WR-02: Any member can pin or unpin any message in every public channel; the message is not checked against the channel
**File:** `../sm-demo-app/plugins/demo/classes/chat_context.go:259-269` (the policy) reaching `../sm-chatchannels-plugin/classes/channel_service.go:1332-1353` and `../sm-chatchannels-plugin/api/pins.go:31-52`
**Issue:** chatchannels gates `PinMessage` and `UnpinMessage` only with `requireChannelAccess`. The demo's `ChatAccess.CanAccessContext` answers true for every member, so any registered visitor can unpin the seeded welcome pins in #general, #announcements and #ogólny, or flood the pins panel. `PinMessage` also never checks that `messageID` belongs to the channel's conversation, so pins can point at another conversation's (DM) message ids. Contents do not leak, because the client's `GET /messages/{id}` needs participation, but the rows are bogus. Plan 03 noted "the visitor was allowed to pin … the pin succeeded" without treating it as a gap.
**Fix:** Make pinning a manage action, for example additively in chatchannels: `PinMessage`/`UnpinMessage` require `CanManageContext`, or an optional `contracts.PinPolicy` the host implements. The demo then answers it from the moderator group. Also verify `message.conversation_id == *ch.ConversationID` before creating the pin. Until then, the demo layer can hide pin actions for non-moderators (`pinAllowed`), but the server must enforce the rule.
### WR-03: Member-visible text outside the chat and forum seams is never moderated
**File:** `../sm-demo-app/plugins/demo/moderation.go:28-44`
**Issue:** The filter runs only on `MessageSaving.Content` and the `PostSaving` title and body. Members write other text that other members see:
- **Profile name and surname.** They appear in `/chat/members` for every member, in mention chips, in DM headers, as forum `author_name`, and as `caller_name` in the incoming-call prompt.
- **userfriends group names and descriptions.** They are shown to invitees in the code preview.
- **Chat attachment filenames.**
A member registering as "free crypto bit.ly/x" puts that text in front of everyone, including in a ringing prompt. D-17 states that banned words and links are refused on every write path.
**Fix:** Run `Filter.Check` on the profile name and surname at registration and profile update. Use a user-plugin saving event if one exists, otherwise the demo's own registration route, without changing the core user plugin. Do the same for userfriends group create and update if a seam exists, or add an additive `GroupSaving` seam, and for attachment filenames (chat `MessageSaving` could carry them additively). Record any path left out as an explicit, documented exception.
### WR-04: A link opens a call and turns the camera and microphone on with no confirmation
**File:** `../vue-chatvideo-layer/app/components/Chatvideo/Call.vue:34-36`, `../sm-demo-app/vue-demo-app/app/pages/call/[conversation].vue:17,30`; same-tab site links in `../vue-chat-layer/app/lib/markdown.ts:22`
**Issue:** `ChatvideoCall` calls `begin()` on mount. `/call/{id}?start=1` starts a call (and rings the other side), and `/call/{id}` joins a live one. The chat renders site paths such as `/call/45?start=1` as same-tab links. One member can DM another `[see this](/call/45?start=1)`, where 45 is their shared DM. A click puts the victim in a call that publishes camera and microphone at once; once the origin has the media permission there is no prompt. A forged `?start=1` also bypasses the call button's intent.
**Fix:** Require an explicit action on the call page. Render a "Start call" or "Join" button and call `begin()` from its click. Keep auto-start only for a `takeStart()` handoff, which proves the click came from `ChatvideoCallButton`, and drop the `?start=1` trigger for direct loads.
### WR-05: A failed LiveKit connect posts `leave`, not `end`, leaving an empty ringing session behind
**File:** `../vue-chatvideo-layer/app/composables/useCall.ts:204-208`
**Issue:** When `r.connect()` fails, the caller posts `client.leave()`. As the starter and only connected participant, the session stays `pending` or `active` with nobody in it:
- the callee keeps ringing for up to 45 s, and Accept joins an empty room;
- Retry (`begin(true)`) gets the existing session back (`Created: false`), so it never rings again until the reconcile job runs.
This is the "left-open session never rings again" bug that `leave()` itself fixed with "last one out ends".
**Fix:** Use the same rule as `leave()`: `void (start || r.remoteParticipants.size === 0 ? client.end(conversationId) : client.leave(conversationId)).catch(() => {})`.
### WR-06: The forum and friends clients have no 401 refresh; an expired token shows "not found"
**File:** `../vue-forum-layer/app/utils/forumClient.ts:139-159`, `../vue-forum-layer/app/components/Forum/Thread.vue:41`, `../vue-userfriends-layer/app/utils/friendsClient.ts:135`
**Issue:** The chat and video clients refresh once on 401 through `$chatAuth.refresh()`. `$forumAuth` and `$userfriendsAuth` are bare token getters, and neither client retries. After the JWT expires, a member on `/forum/t/{id}` sees "thread not found", because `Thread.vue` maps 401 to `forum.error.notFound`. Posting fails the same way. `/chat` keeps working in the same tab.
**Fix:** Give both hooks the `{token, refresh, unauthorized}` shape (the demo can pass `chatAuth`), and add the chat client's single-flight refresh-and-retry to `request()`. Map 401 to its own "signed out" message rather than not-found.
## Info
### IN-01: Group calls in public channels are blocked only by the seeded participant count
**File:** `../sm-demo-app/config/golem15.chatvideo.yaml:13-18`, `../sm-chatvideo-plugin/classes/video_service.go:91,109-112`
**Issue:** The server has no DM-only rule (D-23 is UI only, as documented). Channel calls are refused today only because the four personas plus any visitor exceed `max_participants: 4`. If the cap is raised, or a channel is created with fewer seeded participants, any member can start a call that rings everyone who opened that channel.
**Fix:** Add a host hook in chatvideo (for example an optional `CanStartCall(conversationType)`), or check `conversation.type == dm` in the demo, so the rule does not depend on seed data.
### IN-02: chatvideo checks participant rows, not live membership
**File:** `../sm-chatvideo-plugin/classes/video_service.go:425-443`, `../sm-chatvideo-plugin/classes/authorizer.go:54-79`
**Issue:** A ban revokes the user's JWTs, so new calls are blocked. A LiveKit join token already minted (900 s) and an open `video:session` subscription still survive the ban, because chatvideo never consults `contracts.LiveMembership` as chat does.
**Fix:** Optional: have chatvideo honour `LiveMembership` (via chat's `Service.IsParticipant`) in `requireParticipant` and the authorizer, and remove the participant from the LiveKit room on a ban.
### IN-03: check-local passes member JWTs to curl in argv
**File:** `../sm-demo-app/scripts/check-local.sh:452,514,601` (and the friends checks)
**Issue:** The LiveKit join token is passed carefully through a curl config on stdin, but the member JWTs go into `-H "Authorization: Bearer $jwt"` arguments, which other local users can read in `/proc/*/cmdline`. This is local and uses throwaway users, but it is inconsistent with the stated pattern.
**Fix:** Reuse the `curl -K -` approach with `header = "Authorization: Bearer …"`.
### IN-04: A chat message that starts with "/" can never be posted
**File:** `../vue-chat-layer/app/composables/useChat.ts:825-829`
**Issue:** Every text starting with `/` (for example "/r/golang is great", or a path) is dispatched as a slash command and refused as unknown.
**Fix:** Dispatch only when the first token matches a known trigger from `commands`, or support a `//` escape.
### IN-05: `demo:seed` brings back the default moderation lists after an admin empties them
**File:** `../sm-demo-app/plugins/demo/console/seed_friends.go:117-122`
**Issue:** `seedModerationLists` refills both lists whenever both are empty, and every release runs `demo:seed`. An admin who deliberately clears both lists gets the defaults back at the next deploy.
**Fix:** Seed only on the first run, for example by inserting the lists in a row-creation step or recording a seeded flag.
### IN-06: nginx `/livekit/` exposes LiveKit's whole HTTP surface
**File:** `../sm-demo-app/deploy/nginx/demo.summercms.io.conf:363-375`
**Issue:** Browsers need only `/rtc` (and `/rtc/validate`). The location also exposes LiveKit's Twirp `RoomService` on the public origin. That service is protected by admin JWTs signed with the API secret, so exposing it publicly is unnecessary.
**Fix:** `location ^~ /livekit/rtc { proxy_pass http://127.0.0.1:7890/rtc; … }`, and answer 404 for the rest of `/livekit/`. Adjust check-deploy.
### IN-07: The incoming-call runtime can leak a session handle and survives logout
**File:** `../vue-chatvideo-layer/app/composables/useIncomingCalls.ts:41-56,58-70`
**Issue:** Two `video:call:incoming` events for the same session, both pending in `subscribe`, both pass the `pending.value?.sessionId === call.sessionId` check. The second overwrites `rt.channel` and the first handle is never closed. `pending` is also never cleared on logout (see WR-01).
**Fix:** Keep a sequence number per `watchSession` and close the handle unless it is the latest. Clear `pending` from the logout path.
### IN-08: The VAPID runbook pipeline runs without `pipefail`
**File:** `../sm-demo-app/DEPLOY.md:533-540`
**Issue:** The remote script uses `set -e` without `pipefail`. If `herald:vapid-generate` fails, `jq` emits nothing and `tee -a` appends nothing, but the `SUBJECT` line is still appended. The re-run guard (`grep -c "^…VAPID__" = 0`) then refuses ("already in .env") although no key pair exists, and recovery needs a hand edit of `.env`. The keys were already applied on rome; this matters for a rebuild.
**Fix:** Use `set -eo pipefail`, generate into a variable first, check both keys are non-empty, then append all three lines in one `tee`.
### IN-09: `GET /chat/members` writes, and builds an unbounded `IN` list
**File:** `../sm-demo-app/plugins/demo/chat_api.go:338-358`
**Issue:** A GET assigns handles (`AssignHandle`) to members without one. Two concurrent first loads race on the same rows. It also expands every member id into `id IN ?`, which fails with 500 past Postgres' 65535 bind-parameter limit. The production reset schedule is off, so users accumulate.
**Fix:** Select with the `memberWhere` subquery (`WHERE id <> ? AND <memberWhere>`) instead of an id list. Assign missing handles at registration or in `demo:seed`, not in a GET.
---
_Reviewed: 2026-11-01T23:50:42Z_
_Reviewer: Claude (msd-code-reviewer)_
_Depth: standard_

View File

@@ -0,0 +1,153 @@
---
phase: "20"
slug: "demo-instance-with-every-shared-plugin"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 20 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. Static audit of repository contents (no SSH, no ls-remote, no host contact). Audited: sm-demo-app da03c06 with plugin submodules on their tags (chat v0.1.5, forum v0.1.2, moderation v0.1.1, chatvideo/herald/userfriends v0.1.1, chatchannels/chatbots v0.1.0); vue-demo-app pins vue-chat-layer v0.1.1, vue-chatvideo-layer v0.1.1, vue-forum-layer v0.1.0, vue-userfriends-layer v0.1.0. Paths are relative to `../` (the meta repo). One medium threat (T-20-32) is open and non-blocking.
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| chat/forum HTTP clients → plugin APIs | message and post bodies untrusted; the saving seam runs before storage | message content, thread title, Markdown, JWT (high) |
| host listeners → plugin services | the host decides refusals; listener errors must not leak internals | saving events, Rejection, errors (medium) |
| admin settings → moderation filter | admins edit lists every message is matched against | banned word/link entries (medium) |
| build machine → git.golem15.com / proxies / origin | tags become immutable inputs of every consumer | tags, pushes, go.sum, pnpm lock (medium) |
| browser → /_demo, /_chat, /_chatchannels, /_chatbots, /_chatvideo, /_forum, /_userfriends | every request untrusted; actor only from the JWT | JWT, JSON, uploads ≤5 MiB (high) |
| Centrifugo subscribe proxy → Go / browser → Centrifugo | client channel names, authorized server-side | channel names, connection tokens, X-Centrifugo-Secret (high) |
| seed/reset commands → DB | trusted operator commands; persona accounts must stay unusable | persona rows, random bcrypt hashes (medium) |
| Go → LiveKit RoomService (loopback) / browser → LiveKit | admin calls signed with the API secret; WebRTC with short-lived join token | admin JWT, join token (TTL 900), media, ICE (high) |
| members' content → other members' browsers | untrusted text, links, cards, content_html, names | rendered content (high) |
| realtime events → incoming-call prompt | server payloads about other users | session_id, conversation_id, caller_name (low) |
| npm / git → layers | third-party (livekit-client) and own layers | packages, lockfile integrity (medium) |
| internet → nginx (Cloudflare) / rome public 7891/tcp, 7892/udp | six API prefixes plus /livekit/; WebRTC media straight to LiveKit | HTTP, WS, SRTP, ICE (high) |
| build machine → rome (SSH) | secrets generated on rome; releases and rsync | binaries, configs (high) |
| demo services ↔ WavePath on the same host | must stay isolated | ports, supervisor programs, LiveKit config (high) |
| test harnesses / browser checks → local and live demo | throwaway accounts, visitor creds, live JWT files | JWTs (0600 files), probe content (medium) |
| build machine → summercms.io | journal token publishing changelog posts | g15_ token (high) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-20-01 | Tampering | chat write paths that skip the seam | high | mitigate | MessageSaving fired on the only message insert and content update (sm-chat-plugin classes/service.go:314-337, writes.go:267-276); forum equivalents; TestMessageSavingTracer/Rejects. Chatbots announce path inserts without the seam but is unreachable on the demo (Ephemeral commands) | closed |
| T-20-02 | Information disclosure | listener errors in API bodies | medium | mitigate | only Rejection → 422, everything else opaque 500 (chat/forum api/errors.go) on every write handler | closed |
| T-20-03 | Denial of service | filter matching cost | medium | mitigate | QuoteMeta + RE2, recompile only on list change; 500 entries / 200 chars enforced in BeforeValidate | closed |
| T-20-04 | Elevation of privilege | moderation settings screen | medium | mitigate | `PermissionManageSettings`, role `developer`, enforced by cabana | closed |
| T-20-05 | Tampering | one-way module tags | medium | mitigate | all family tags annotated, on origin/main, monotonic | closed |
| T-20-06 | Elevation of privilege | channel creation by members | high | mitigate | `CanManageContext` always false (plugins/demo/classes/chat_context.go:272-274); tests refuse member and moderator | closed |
| T-20-07 | Information disclosure | subscribing to other conversations | high | mitigate | chat/user/video authorizers admit only own or participant channels; all namespaces via subscribe proxy. Residual IN-02 | closed |
| T-20-08 | Spoofing | persona accounts | medium | mitigate | `personas.demo.invalid` emails, random bcrypt hashes never printed; reset reseeds | closed |
| T-20-09 | Elevation of privilege | moderator rights | medium | mitigate | group conversations only, member + moderator group, banned users excluded, live membership required; group seeded empty | closed |
| T-20-10 | Tampering | spam/abuse in chat and forum | high | mitigate | moderation listeners on both seams; rate buckets (chat 120/min, DM 10/min, forum, video-initiate 5/min); Turnstile `closed`; manual demo:reset (schedule off in production). Residual WR-03 | closed |
| T-20-11 | Denial of service | realtime token minting | low | mitigate | JWT + membership guard, 120/min per user | closed |
| T-20-12 | Information disclosure | LiveKit and VAPID secrets (local) | high | mitigate | dev.sh umask 077, names only echoed; empty examples; CHANGE_ME placeholders enforced by check-deploy.sh:391-399 | closed |
| T-20-13 | Denial of service | stale chat-family rows after reset | low | mitigate | reset lists chat-family tables before users; reset tests | closed |
| T-20-14 | Tampering | stored XSS (text, names, URLs) | high | mitigate | vue-chat-layer v-html only through the escaping renderer; safeUrl, rel noopener noreferrer nofollow; linkify on escaped text with honestHttpUrl | closed |
| T-20-15 | Information disclosure | JWT handling in the layer | medium | mitigate | token from auth.token() as Bearer to same-origin bases; no web storage or cookie use | closed |
| T-20-16 | Information disclosure | attachment downloads | medium | mitigate | bearer download, object URL; server checks CanView | closed |
| T-20-17 | Spoofing | slash command answers | low | mitigate | `/` text dispatched, never posted; local ephemeral row marked "only you" | closed |
| T-20-18 | Tampering | layer supply chain | medium | mitigate | exact pins; layers pinned by tag and locked to commits | closed |
| T-20-19 | Denial of service | realtime connections | low | mitigate | single Centrifuge client; bounded polling | closed |
| T-20-20 | Tampering | forum stored XSS | high | mitigate | v-html only on server-rendered content_html; `breakwater.Render` (bluemonday) on write; server-side preview | closed |
| T-20-21 | Spoofing | call joins | high | mitigate | requireParticipant on start/join, token TTL 900, max 4 participants; layer never builds tokens | closed |
| T-20-22 | Information disclosure | camera and microphone | medium | mitigate | media only after handoff/click; disconnect stops tracks; leave on pagehide/unmount | closed |
| T-20-23 | Tampering | incoming-call payloads | low | mitigate | text binding for caller name; positive integer ids only | closed |
| T-20-24 | Denial of service | call spam | medium | mitigate | video-initiate 5/min, max_duration 900, reconcile job; DM-only slot in the UI. Residual IN-01 | closed |
| T-20-25 | Information disclosure | friend enumeration | low | mitigate | generic 422 shown as is; directory = chat picker set | closed |
| T-20-26 | Information disclosure | VAPID private key | high | mitigate | never printed; empty example; no `/_herald` route in Nuxt or nginx, enforced by check-deploy.sh:405-409 | closed |
| T-20-27 | Elevation of privilege | LiveKit co-tenancy with WavePath | high | mitigate | own supervisor program, config, user, ports, key pair; WavePath config untouched (DEPLOY.md:355-410). Host state live-only | closed |
| T-20-28 | Information disclosure | LiveKit, VAPID, Centrifugo secrets (rome) | high | mitigate | generated on rome, `install -m 0640 root:summercms-demo`, written via stdin, unset; placeholders enforced. File modes live-only | closed |
| T-20-29 | Denial of service | open media ports | medium | mitigate | only 7891/tcp and 7892/udp via Vuurmuur; participant and timeout limits. Firewall live-only | closed |
| T-20-30 | Information disclosure | origin IP in ICE candidates | low | accept | AR-20-01 | closed |
| T-20-31 | Elevation of privilege | unintended Go routes | medium | mitigate | six chat-family locations + `/livekit/`, no /_herald, `/backend` 404; check-deploy.sh. Residual IN-06 | closed |
| T-20-32 | Tampering | firewall drift | medium | mitigate | Vuurmuur change and removal documented (DEPLOY.md:467-490), but **no dated rules.conf backup**; DEPLOY.md:475-476 points to a "Probed on rome on 2026-10-31" section (:94-102) that lists no rules | open — below high threshold (non-blocking) |
| T-20-33 | Denial of service | a release breaking the live demo | medium | mitigate | `.prev` binary and site kept, rollback documented, check-live after release; clean-tree builds | closed |
| T-20-34 | Spoofing | signalling WebSocket | low | mitigate | tokens only after requireParticipant (TTL 900); `/rtc/validate` 401 without token | closed |
| T-20-35 | Information disclosure | credentials in tests and check output | medium | mitigate | visitor password read from `.env`, never printed; failures name keys only. Residual IN-03 (argv) | closed |
| T-20-36 | Tampering | regressions behind skipped tests | medium | mitigate | check-all.sh runs suites without `-short`; container start failure fails tests; PLAN verifies count `--- PASS` lines | closed |
| T-20-37 | Denial of service | throwaway accounts on the live demo | low | accept | AR-20-02 (rationale corrected) | closed |
| T-20-38 | Spoofing | banned-link matching | high | mitigate | sm-moderation-plugin normalize.go canonical links (dots, percent-decode, last `@`, port, IDNA, path); TestMatchBypassLinks | closed |
| T-20-39 | Tampering | banned-word matching | high | mitigate | entity decode, NFKC, Cf/Cc drop, space folding, diacritics, markup strip; two passes; TestMatchBypassWords | closed |
| T-20-40 | Tampering | forum Markdown rendered after the check | high | mitigate | PostSaving.HTML carries rendered HTML; demo runs CheckHTML on it; forum, moderation and demo tests | closed |
| T-20-41 | Denial of service | normalising and matching large texts | low | accept | AR-20-03 | closed |
| T-20-42 | Information disclosure | useCall: media after leave | critical | mitigate | per-attempt `stale()` checks at every await; stale branch drops the Room; tests cover seven moments | closed |
| T-20-43 | Elevation of privilege | /call/{id} opened from a link | high | mitigate | confirmation unless an in-memory 60 s single-use handoff exists | closed |
| T-20-44 | Information disclosure | chat store, socket, call prompt after logout | high | mitigate | isolated sign-out steps; reset, disconnect, dismiss wired; communityAuth tests; check-chat.cjs requires `/ws` closed in 5 s | closed |
| T-20-45 | Denial of service | empty ringing session after a failed connect | medium | mitigate | closeFailed ends sessions with ≤1 participant; tests | closed |
| T-20-46 | Spoofing | deceptive hosts in anchors and cards | high | mitigate | `honestHttpUrl` (vue-chat-layer urlGuard.ts:28-48) on every link path; tests | closed |
| T-20-47 | Tampering | release tags | high | mitigate | annotated, on origin/main, monotonic; ls-remote and fast-forward recorded in 20-09-SUMMARY | closed |
| T-20-48 | Information disclosure | live member JWTs | high | mitigate | mode 600/400 required, header via `curl -K -` stdin; delete afterwards documented and recorded. Deletion live-only | closed |
| T-20-49 | Tampering | probe content on the live demo | medium | mitigate | scope limited to own DM and seeded thread; stored probes deleted and reported; controls refused first | closed |
| T-20-50 | Information disclosure | journal token | high | mitigate | changelog-post.py own token file, refuses readable-by-others, never printed | closed |
| T-20-51 | Denial of service | the shared host during a release | medium | mitigate | restarts only the demo programs; rollback; pids recorded. Pid check live-only | closed |
| T-20-52 | Tampering | temporary integration leaking into a release | medium | mitigate | clean-tree builds, GOWORK=off, frozen lockfile; tag-only pins; no go.mod replace | closed |
| T-20-SC | Tampering | npm / Go installs (plans 01-09) | high | mitigate | every new module matches an already-vetted version (sitemap or framework); livekit-client 2.23.0 exact with lock integrity and human checkpoint; `protobufjs: false`; later plans change only golem15 modules and layer tags | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-20-01 | T-20-30 | rome already exposes services on its public address; the ICE candidates show it (DEPLOY.md:367-369). | 20-05 PLAN | 2026-11-05 |
| AR-20-02 | T-20-37 | check-live registers no accounts (its token-less register expects 422). **Corrected:** the plan said the reset job removes the human UAT account, but the reset schedule is off in production (DEPLOY.md:945-946, 1006-1009), so UAT accounts stay until someone runs `demo:reset --force` by hand. | 20-09 PLAN (corrected by audit) | 2026-11-05 |
| AR-20-03 | T-20-41 | RE2 is linear, lists are bounded by max_entries and max_entry_length, and the work is two passes over a message the plugins already cap in size. | 20-07 PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Open Below Threshold
| Threat | Severity | Gap | To close (any one) |
|--------|----------|-----|--------------------|
| T-20-32 | medium | no dated `rules.conf` backup before the Vuurmuur change; DEPLOY.md's substitute reference points at a section without the rules | take a dated `rules.conf.bak-<date>` on rome, record the 15 pre-change RULE lines in DEPLOY.md's "Probed on rome" section, or record an accepted risk |
---
## Unregistered Flags and Residual Risk (non-blocking)
- **Unregistered (20-02):** `GET /_demo/api/v1/chat/members` (sm-demo-app/plugins/demo/chat_api.go) lists every member's name, surname and handle to any member; IN-09 adds that the GET writes handles and builds an unbounded `IN` list (500 above 65535 members). Todo `demo-chat-members-read-only.md`.
- Deferred review items, each with a pending todo: WR-02 (any member can pin/unpin in public channels), WR-03 (profile names, friend-group names and attachment filenames are not moderated), WR-06 (forum/friends clients lack 401 refresh), IN-01 (no server-side DM-only call rule), IN-02 (video join token survives a ban up to 900 s), IN-03 (member JWTs and — found by this audit — the visitor password at check-local.sh:333 in curl argv), IN-04, IN-05, IN-06 (nginx `/livekit/` exposes LiveKit's whole HTTP surface incl. admin-JWT-protected RoomService), IN-07, IN-08 (VAPID runbook without `pipefail`).
- Untracked: the 19.4.1 Centrifugo secrets runbook (DEPLOY.md:327-328) passes secrets as `sed` arguments on rome (not echoed; noted in 20-05 deviation 3, not fixed).
### Host-only checks (not verifiable from the repos)
WavePath LiveKit untouched and pid unchanged (T-20-27, T-20-51); file modes of `livekit.yaml`, `.env`, `centrifugo.json` (T-20-28); the applied Vuurmuur rule (T-20-29, T-20-32); live JWT files deleted (T-20-48); `RESET__ENABLED` count 0.
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 53 | 52 | 1 (medium, non-blocking) | msd-security-auditor (ASVS L1, block_on high; static, repo contents only) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
- [ ] T-20-32 closed (backup or recorded rules) or accepted
- [ ] Host-only checks confirmed on rome
**Approval:** verified 2026-11-05 (ASVS L1; T-20-32 open below threshold)

View File

@@ -0,0 +1,72 @@
# API Coverage — Phase 20 (livekit-client, LiveKit server, Centrifugo, Web Push)
> Full coverage by default. Opt-outs are explicit, reasoned decisions. The phase builds no new server-side client: LiveKit's server API is called by `sm-chatvideo-plugin` (server-sdk-go), Centrifugo by `lighthouse`, Web Push by `sm-herald-plugin`. This phase adds the browser side of the video calls (`vue-chatvideo-layer` on `livekit-client` 2.23.0, plan 04), the chat's use of Centrifugo (`vue-chat-layer`, plan 03) and herald's VAPID configuration (plan 04).
## livekit-client 2.23.0 (plan 04, vue-chatvideo-layer)
| capability | decision | reason |
|---|---|---|
| Room connect (livekit_url and the server-minted join token) | INTEGRATE | |
| Room disconnect (stops the local tracks) | INTEGRATE | |
| publish camera (localParticipant.setCameraEnabled) | INTEGRATE | |
| publish microphone (localParticipant.setMicrophoneEnabled) | INTEGRATE | |
| subscribe and attach remote tracks (TrackSubscribed, track.attach and detach) | INTEGRATE | |
| mute and unmute | INTEGRATE | |
| camera toggle | INTEGRATE | |
| participant events (ParticipantConnected, ParticipantDisconnected, TrackMuted, TrackUnmuted, LocalTrackPublished) | INTEGRATE | |
| connection state and reconnection (Reconnecting, Reconnected, Disconnected) | INTEGRATE | |
| adaptiveStream and dynacast | INTEGRATE | |
| audio playback unlock (AudioPlaybackStatusChanged, startAudio) | INTEGRATE | |
| dynamic import of the package | INTEGRATE | |
| screen share | OPT-OUT | explicitly out of scope: D-13 keeps the call page minimal and the server config has screen_share false |
| data channel (publishData, data streams, RPC) | OPT-OUT | not needed: chat messages go through the chat plugins, not the call |
| device selection (switchActiveDevice, getLocalDevices) | OPT-OUT | not needed for a minimal demo call: the browser's default camera and microphone are used |
| end-to-end encryption (E2EE worker) | OPT-OUT | explicitly out of scope: a public demo call with a short-lived room; media is DTLS-SRTP encrypted in transit |
| recording and egress | OPT-OUT | explicitly out of scope: the demo records nothing |
| simulcast tuning (videoEncoding, layers) | OPT-OUT | not needed: the defaults with adaptiveStream and dynacast fit 1:1 calls |
| audio-only mode | OPT-OUT | not needed: turning the camera off gives the same call without video |
| background effects and track processors | OPT-OUT | not needed: not part of a minimal call page |
| active speaker highlighting | OPT-OUT | not needed: calls are 1:1 DMs (D-11), so there is no speaker to pick out |
## LiveKit server 1.13.1 through golem15.chatvideo (plans 02 and 05)
| capability | decision | reason |
|---|---|---|
| room create (on video/start) | INTEGRATE | |
| room delete (on video/end and at max_duration) | INTEGRATE | |
| join token mint (per participant, token_ttl 900) | INTEGRATE | |
| participant count and active rooms (reconcile) | INTEGRATE | |
| remove participant (on video/leave) | INTEGRATE | |
| reconcile job (chatvideo:reconcile-sessions ends idle and overdue rooms) | INTEGRATE | |
| room max_participants (4 in livekit.yaml, next to chatvideo max_participants, D-12) | INTEGRATE | |
| /rtc/validate (check-local call) | INTEGRATE | |
| egress (recording, streaming) | OPT-OUT | explicitly out of scope: the demo records nothing |
| ingress (RTMP, WHIP) | OPT-OUT | explicitly out of scope: calls start from the site only |
| SIP | OPT-OUT | explicitly out of scope: no phone dial-in on a public demo |
| webhooks | OPT-OUT | not needed: the reconcile job polls room state, and the call events go through Centrifugo |
| TURN server | OPT-OUT | deferred: plan 05 decides it with the rome network setup (ICE TCP 7891 and UDP 7892 first) |
## Centrifugo v6 (plans 02 to 04)
| capability | decision | reason |
|---|---|---|
| chat namespace with presence and join/leave | INTEGRATE | |
| user namespace (user:{id}, the chat's events and video:call:incoming) | INTEGRATE | |
| video namespace (video:session:{id}: accepted, ended, participant joined and left) | INTEGRATE | |
| subscribe proxy on chat, user and video | INTEGRATE | |
| one shared client per page (vue-chat-layer realtime, onUserEvent for other layers) | INTEGRATE | |
| server HTTP API publish (lighthouse broadcast jobs) | INTEGRATE | |
| history and recovery | OPT-OUT | not needed: the chat refetches the open conversation over HTTP on every (re)subscribe |
| client-side publish | OPT-OUT | explicitly out of scope: browsers never publish; Go publishes after authorizing the write |
| client RPC | OPT-OUT | not needed: every action is an HTTP call |
| presence on the video namespace | OPT-OUT | not needed: LiveKit's participant events show who is in the call |
## Web Push through golem15.herald (plan 04)
| capability | decision | reason |
|---|---|---|
| VAPID key pair in .env (herald:vapid-generate, D-16) | INTEGRATE | |
| VAPID public key route (/_herald/api/v1/push/vapid-public-key, check-local herald) | INTEGRATE | |
| subscribe UI and service worker | OPT-OUT | deferred per D-16: herald is mounted without UI in this phase |
| push on chat events (DMs, mentions, incoming calls) | OPT-OUT | deferred per D-16: needs the subscribe UI first |
| push to /_herald from the site (goPaths) | OPT-OUT | deferred per D-16: the site does not call herald, so /_herald is not routed by vue-demo-app |

View File

@@ -5,7 +5,7 @@ titles: json
findings:
- id: CR-01
severity: critical
disposition: open
disposition: fixed
title: "An in-flight MCP allow recreates a consent the user just revoked"
- id: WR-01
severity: warning
@@ -31,7 +31,7 @@ findings:
severity: warning
disposition: open
title: "`/connect` can allow a stale request after `?request=` changes"
open: 7
open: 6
total: 7
recorded: 2026-10-28T16:03:08.042Z
---
@@ -40,7 +40,7 @@ recorded: 2026-10-28T16:03:08.042Z
| Finding | Severity | Disposition | Source |
|---------|----------|-------------|--------|
| CR-01 | critical | open | - |
| CR-01 | critical | fixed | sm-oauthserver-plugin 21f5985 (unreleased; ships with the next plugin tag) |
| WR-01 | warning | open | - |
| WR-02 | warning | open | - |
| WR-03 | warning | open | - |

View File

@@ -0,0 +1,100 @@
---
phase: "32.1"
slug: "mcp-oauth-for-plugin-apps-declared-scopes-mcp-subject-on-con"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 32.1 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. Evidence paths: F = `summercms.go`, U = `sm-user-plugin`, O = `sm-oauthserver-plugin`, V = `vue-oauth-layer`, S = `sm-summercmsio-app` (all under `../`). Baseline for "unchanged" claims: `2cea312`, the commit before the phase.
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| MCP client to wristband authorize | Untrusted scope string and redirect cross here; the phase only changes which names are legal | scope string, redirect URI, PKCE challenge (high) |
| pier dispatch to route handler | the handler gets an MCPCall built from the resolved subject, not from tool arguments | subject, client id, token id (high) |
| OAuth grant scopes to MCPAllows / user.scope | the grant is the consented set; Implies may add only names the plugin marked | granted scopes (high) |
| DELETE /oauth/authorizations/{client_id} | a signed-in user names a client; another user's rows must stay | client id, user session (high) |
| Operator config `mcp_scopes` | names enter metadata and the allow-list at boot | scope names (medium) |
| MCP consent JSON to the browser | client name, labels and admin name are attacker-influenced (DCR name, phrase text) | display strings (medium) |
| Page POST back to the consent route | the browser can omit fields; the server intersection is the control | decision, scopes, backend_admin (high) |
| Test output and changelog notes | tokens and authorization codes must not reach logs or the public post | test output, release notes (medium) |
| git push of a release tag | the tag is what other repositories require | tag (low) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-32.1-01 | Elevation of privilege | wristband resolvedScopes | high | mitigate | F/modules/wristband/server.go:203 `mcpEmptyScopes` (five names incl. backend); :210-218 never widens a non-empty list; used by metadata :194 and authorize.go:29. `DefaultOptions` and OIDC discovery unchanged | closed |
| T-32.1-02 | Elevation of privilege | pier filter.go read/write ceiling | high | mitigate | filter.go and identity.go unchanged since baseline; ceiling identity.go:80-82 `writes()` used at filter.go:66,:75; no `Implies` reference in pier, bouncer or wristband | closed |
| T-32.1-03 | Spoofing | wristband Authorize redirect | high | mitigate | 63d05e8 touched only `allowedAuthorizeScopes`; authorize.go order: client lookup :62-82, exact redirect :84-88, PKCE :95-108, scope parse :110 | closed |
| T-32.1-04 | Information disclosure | pact.MCPCall.Subject.TokenID | medium | mitigate | TokenID rule in pact/README.md:170, pier/README.md:13 and docs; dispatch.go:211-215 adds no log line; subject from `id.subjectFor` :172; audit.go unchanged | closed |
| T-32.1-05 | Elevation of privilege | MCPUserGuard Implies helper | high | mitigate | U/classes/mcp_guard.go:160-175 `mcpEffectiveScopes`: personal tokens unchanged, clone only, read/write Implies only, exact stock scope required, no write-back; both call sites (:94, :145); `CompileAPITokenScopes` rejects backend/offline_access and bad Implies (api_token_scopes.go:139,:148). Residual: WR-01, WR-02 | closed |
| T-32.1-06 | Elevation of privilege | MCP consent upsert | high | mitigate | O/controllers/mcp_consent_api.go: deny → `DenyPending` (:180-183); silent re-grant → `TouchConsent` (:355-358); decision → `replaceMCPConsent` ON CONFLICT sets scopes (:382-389), replace not union. Test `TestMCPConsentReplace`. Residual: WR-03, WR-04 (CR-01 fixed in 21f5985) | closed |
| T-32.1-07 | Elevation of privilege | authorizations.revoke | high | mitigate | O/controllers/authorizations.go:137-163: `LockUserGrants` advisory lock in-tx before deletes of consent, codes and tokens; `MCPSubjectRevoked` after commit. Test `TestMCPRevokeDeletesCode`. CR-01 fixed in 21f5985: the MCP allow takes the same lock | closed |
| T-32.1-08 | Information disclosure | PendingRequest / IssueCode | high | mitigate | F/modules/wristband/consent.go:139-174 `lookupOwnedPending` unchanged, all misses → `ErrPendingNotFound` → 404. Plugin's `mcpPendingClientID` (mcp_consent_api.go:322-332) looks up by request id alone but both callers run it after the owner-checked `PendingRequest` | closed |
| T-32.1-09 | Tampering | grantedScopes when scopes is absent | medium | mitigate | mcp_consent_api.go:247-250 absent scopes = requested set; offline override only when present (:224-226); request struct takes decision, scopes, backend_admin only | closed |
| T-32.1-10 | Information disclosure | consent and revoke logs | medium | mitigate | phase diff `df2eddd..a7743e7` adds no log line in plugin non-test code; error-code sets unchanged | closed |
| T-32.1-11 | Tampering | app/pages/connect.vue | high | mitigate | no `v-html`/innerHTML in V/app/; connect.vue uses text interpolation and attribute bindings; V/tests/connect.test.ts:107-109 asserts no `v-html`. Residual: WR-06 | closed |
| T-32.1-12 | Elevation of privilege | read checkbox | low | accept | AR-32.1-01 | closed |
| T-32.1-13 | Information disclosure | tests and changelog-post.py | medium | mitigate | phase test messages print only codes, error keys, scope lists and ids; notes contain no token prefixes; S/scripts/changelog-post.py:407-411 exits without token, :318-326 refuses a world-readable token file | closed |
| T-32.1-14 | Spoofing | release tags | low | accept | AR-32.1-02 | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-32.1-01 | T-32.1-12 | The read checkbox is disabled and the page's own POST includes read. A client that omits read only narrows the grant; the server must not reinsert read because the 422 smoke posts backend alone. Narrowing is not a privilege gain. `grantedScopes` does not special-case read. | 32.1-04-PLAN | 2026-11-05 |
| AR-32.1-02 | T-32.1-14 | Tagging does not change PKCE, redirect matching or the read/write ceiling; the checkpoint is the control on publishing, not a new auth path. | 32.1-05-PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Residual Risk (open review findings, outside the L1 register)
`32.1-REVIEW-DISPOSITION.md` lists these as `open`. The auditor confirmed each is still present in the code on 2026-11-05. They do not count toward `threats_open` at ASVS L1, but CR-01 would make T-32.1-07 a blocking open threat at L2. CR-01 has since been fixed (sm-oauthserver-plugin 21f5985).
| Finding | Severity | Touches | Gap |
|---------|----------|---------|-----|
| CR-01 | critical | T-32.1-07, T-32.1-06 | Fixed in sm-oauthserver-plugin 21f5985 (2026-11-05, unreleased): `MCPConsentDecide` issues the code and writes the consent in one transaction under `classes.WithinUserGrantsLock` (exclusive `LockUserGrants`, the lock revoke takes); a failed consent write rolls the code back. Tests `TestMCPConsentAllowSerializesWithRevoke`, `TestMCPConsentFailureRollsBackCode`. |
| CR-01 sibling (OIDC) | high | T-32.1-07 | Fixed in sm-oauthserver-plugin 7b9899f (2026-11-05, unreleased): the OIDC decide was already consistent (consent upsert and code in one transaction, ordered against revoke by the consent row lock; pinned by `TestOIDCConsentAllowThenRevoke`), but a silent resume could issue a code after a revoke, a refresh rotation's successor tokens survived a revoke and a code exchange could deadlock with one. The OIDC store now takes the user's grants lock (shared) before its first grant row. Tests `TestOIDCResumeSerializesWithRevoke`, `TestOIDCRefreshSerializesWithRevoke`, `TestOIDCExchangeSerializesWithRevoke`. |
| WR-01, WR-02 | warning | T-32.1-05 | `mcpEffectiveScopes` re-implies a declared scope the user cleared on /connect while read/write remains, and does not intersect the catalog with `golem15.oauthserver.mcp_scopes`. |
| WR-04 | warning | T-32.1-06 | narrowing a consent does not revoke refresh tokens carrying the removed scopes or offline_access. |
| WR-03 | warning | T-32.1-06 | the consent backfill seeds from tokens the verifier would refuse (nil-expiry, inactive/revoked clients, rotated refresh tokens). |
| WR-06 | warning | T-32.1-11 | /connect `load()` has no generation guard; a stale `consent_required:false` can auto-allow a request the user no longer views. |
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 14 | 14 | 0 | msd-security-auditor (ASVS L1, block_on high) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
- [x] CR-01 given a disposition in 32.1-REVIEW-DISPOSITION.md (fixed: sm-oauthserver-plugin 21f5985)
**Approval:** verified 2026-11-05 (ASVS L1; CR-01 fixed in sm-oauthserver-plugin 21f5985, unreleased)

View File

@@ -0,0 +1,254 @@
---
phase: 33-seo-output-audit-and-content
plan: 01
subsystem: framework
tags: [pact, signpost, cabana, content-descriptor, field-types, gate-script, release-ledger]
requires:
- phase: 32-seo-foundation
provides: pact.ContentDescriptor, signpost content registry, plugin field types, form extensions, check-phase32.sh engine
provides:
- pact.ContentDescriptor.Kind and Tools with ContentKind*/ContentTool* constants
- pact.ContentRecord.PublishedAt, Parents, Authors, TopHeading
- pact.ContentLocale.Images, Videos, Headings and the value types ContentRef, ContentPerson, ContentImage, ContentVideo, ContentHeading
- pact.FormFieldType.RequestOptions merged into served typeOptions per schema request
- scripts/check-phase33.sh (eleven stages plus --all)
- 33-release-log.md (v0.6.1 planned contents and release order)
affects: [33-02, 33-03, 33-04, 33-05, 33-06, 33-07, 33-08, 33-09, 33-10, 33-11, 33-12, 33-13, 33-14]
actuals:
tokens: 24700
tasks: 4
commits: 4
plan_head_before: 399efed845bc7dc7e6a1dbd26ed74d78172684e4
plan_head_after: 21aa4e5
tech-stack:
added: []
patterns:
- "Optional descriptor facts: new slices are nil-or-empty alike; signpost hands records through untouched"
- "Per-request field options: computed once per type per schema request, merged into a copy, fields.yaml wins, errors fail open with one WARN"
key-files:
created:
- modules/signpost/content_fields_smoke_test.go
- modules/cabana/field_request_options_smoke_test.go
- scripts/check-phase33.sh
- .planning/phases/33-seo-output-audit-and-content/33-release-log.md
modified:
- modules/pact/content.go
- modules/pact/capabilities.go
- modules/cabana/field_type.go
- modules/cabana/http.go
- modules/cabana/schema_types.go
- modules/cabana/admin_openapi.go
- modules/signpost/example_content_test.go
- modules/cabana/example_field_type_test.go
- admin/openapi/admin.json
- admin/src/api/schema.d.ts
- docs/plugins/menu-item-types.md
- docs/backend/field-types.md
- modules/pact/README.md
- modules/signpost/README.md
- modules/cabana/README.md
key-decisions:
- "Task 1 Decision A (Jakub 2026-11-04): as-planned; P33-01 descriptor fields/constants/value types and P33-02 FormFieldType.RequestOptions exactly as the plan names them"
- "Task 1 Decision B (Jakub 2026-11-04): WR-02 accepted; pact.RecordSaved.Locale stays the primary tag of the request locale (released in v0.5.2)"
- "Task 1 Decision C (Jakub 2026-11-04): Phase 33 delivers SummerCMS v0.6.1 (patch, additive); additive and marker stages compare with v0.6.0; plans reading v0.5.1/v0.5.2 mean v0.6.0/v0.6.1"
- "RequestOptions receives the application database bound to the request context, nil when none is configured"
patterns-established:
- "Content facts: a content type may set Kind/Tools and per-record PublishedAt/Parents/Authors/TopHeading/Images/Videos/Headings; consumers read them through signpost without importing the content plugin"
- "Phase gate: check-phase33.sh stage engine; a missing repository fails with 'missing <path>'"
requirements-completed: [SC-2, SC-3, D-93, D-90, D-106, D-43, D-86, D-31, D-85, D-50, D-51, D-96, D-10]
coverage:
- id: D1
description: "Additive content descriptor fields and value types, handed through signpost.Describe and signpost.Records unchanged; a type without them describes as before"
requirement: "D-93"
verification:
- kind: unit
ref: "modules/signpost/content_fields_smoke_test.go#TestContentDescriptorFields"
status: pass
- kind: unit
ref: "modules/signpost/example_content_test.go#ExampleRegistry_MatchPath"
status: pass
human_judgment: false
- id: D2
description: "pact.FormFieldType.RequestOptions merged into served typeOptions (every screen, fields.yaml wins, once per type per request, error fails open with one warning, unchanged schema without it, form extension fields, authenticated handler only)"
requirement: "SC-3"
verification:
- kind: unit
ref: "modules/cabana/field_request_options_smoke_test.go#TestFieldTypeRequestOptions"
status: pass
- kind: other
ref: "scripts/check-admin-openapi.sh --check"
status: pass
human_judgment: false
- id: D3
description: "Framework API strictly additive against v0.6.0 and no framework line names SEO, a sitemap, JSON-LD or an application"
requirement: "D-106"
verification:
- kind: other
ref: "bash scripts/check-phase33.sh --go --docs --marker --additive"
status: pass
- kind: other
ref: "bash scripts/check-phase33.sh --compat"
status: pass
human_judgment: false
- id: D4
description: "check-phase33.sh with eleven stages; self-test detects an API removal, an interface method, a marker hit, a failing go test and a missing repository"
verification:
- kind: other
ref: "bash scripts/check-phase33.sh --self-test"
status: pass
human_judgment: false
- id: D5
description: "33-release-log.md records v0.6.1 planned contents, the six Phase 32 fixes as already released in v0.5.2, plugin/layer tag state and the release order"
verification: []
human_judgment: true
rationale: "A planning ledger; its accuracy and the release order are Jakub's call before 33-14 tags anything"
duration: 22min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 01: Framework seams, phase gate and release ledger Summary
**Optional content facts on pact.ContentDescriptor/Record/Locale (kind, MCP tools, first publication, parents, authors, top heading, images, videos, heading outline), per-request plugin field options through pact.FormFieldType.RequestOptions, the eleven-stage check-phase33.sh gate and the v0.6.1 release ledger**
## Task 1 answers (Jakub, 2026-11-04)
Later plans (33-02 to 33-14) use these:
1. **Decision A: as-planned.** P33-01 and P33-02 are adopted exactly as written, no rename:
- `pact.ContentDescriptor.Kind string` with `ContentKindArticle = "article"`, `ContentKindCollection = "collection"`, `ContentKindProfile = "profile"`, `ContentKindPage = "page"`;
- `pact.ContentDescriptor.Tools map[string]string` with `ContentToolEdit = "edit"`, `ContentToolHeadings = "headings"`, `ContentToolImageAlt = "image_alt"` (values are full MCP tool names);
- `pact.ContentRecord.PublishedAt *time.Time`, `Parents []ContentRef`, `Authors []ContentPerson`, `TopHeading int`;
- `pact.ContentLocale.Images []ContentImage`, `Videos []ContentVideo`, `Headings []ContentHeading`;
- `ContentRef{Type, ID string}`, `ContentPerson{Name string; Ref ContentRef}`, `ContentImage{URL, Alt string; Decorative bool; Width, Height int}`, `ContentVideo{Provider, ID string}`, `ContentHeading{Level int; Text string}`;
- `pact.FormFieldType.RequestOptions func(ctx context.Context, db *gorm.DB) (map[string]any, error)` with `json:"-"`.
2. **Decision B: WR-02 accepted.** `pact.RecordSaved.Locale` stays the primary tag of the request locale, as released in v0.5.2 (commit 1583651). 32-UAT.md is left to verify-work.
3. **Decision C: version base.** Tags v0.5.2, v0.5.3 and v0.6.0 already exist and contain all six Phase 32 fixes (676ca53, 5471b66, d660cd0, 468af06, 1583651, 0e187cf). This phase delivers **SummerCMS v0.6.1** (patch, additive per D-106). `check-phase33.sh --additive` compares against the newest tag not containing HEAD (computed, currently v0.6.0); `--marker` diffs from v0.6.0 (`PHASE33_BASE`). **Where a Phase 33 plan says v0.5.1 (base) or v0.5.2 (target), read v0.6.0 and v0.6.1.** Nothing is pushed or tagged before 33-14.
## Performance
- **Duration:** 22 min (continuation; Task 1 answered before this run)
- **Started:** 2026-11-04T07:26:44Z
- **Completed:** 2026-11-04T07:49:00Z
- **Tasks:** 4 (Task 1 decision, Tasks 2-4 executed)
- **Files modified:** 19
## Accomplishments
- Content types can describe kind, fixing MCP tools, first publication, ordered parents, authors, top heading level, images (with alt and a decorative flag), videos and the heading outline; signpost hands them through, and a type without them is unaffected.
- A plugin field type can serve per-request options to its element through the existing `typeOptions` attribute; the compiled schema is never mutated and errors fail open.
- `scripts/check-phase33.sh` gates the phase: `--self-test`, `--go`, `--docs`, `--marker`, `--additive`, `--admin`, `--plugins` and `--compat` all pass on this host.
- `33-release-log.md` records the v0.6.1 contents and the release order 33-14 follows.
## Task Commits
1. **Task 1: Confirm descriptor fields, RequestOptions, RecordSaved.Locale meaning**: no commit (decision, answers above)
2. **Task 2: Content descriptor fields (tracer)**: `561a56c` (feat)
3. **Task 3: Per-request options for plugin field types**: `4cd35c9` (feat)
4. **Task 4: Phase gate script and release log**: `6ea43bb` (test, group A), `21aa4e5` (docs, group B)
**Plan metadata:** this SUMMARY commit (docs)
## Files Created/Modified
- `modules/pact/content.go`: Kind, Tools, the kind and tool constants, the record and locale fields and the five value types.
- `modules/pact/capabilities.go`: `FormFieldType.RequestOptions` with its doc comment (no secrets, fails open).
- `modules/cabana/field_type.go`: `mergeRequestOptions` (once per type, copy-merge, fields.yaml wins, one WARN on error).
- `modules/cabana/http.go`: form schema route calls it on the request's own field slice; `requestDB` helper.
- `modules/cabana/schema_types.go`, `modules/cabana/admin_openapi.go`, `admin/openapi/admin.json`, `admin/src/api/schema.d.ts`: typeOptions description now names per-request options.
- `modules/signpost/content_fields_smoke_test.go`: `TestContentDescriptorFields` (full type, plain type, nil vs empty slices).
- `modules/cabana/field_request_options_smoke_test.go`: `TestFieldTypeRequestOptions`, one subtest per behaviour line plus the authenticated-handler check (T-33-01).
- `modules/signpost/example_content_test.go`, `modules/cabana/example_field_type_test.go`: runnable examples that the docs embed.
- `docs/plugins/menu-item-types.md`, `docs/backend/field-types.md`, `modules/pact/README.md`, `modules/signpost/README.md`, `modules/cabana/README.md`: documentation of every new identifier.
- `scripts/check-phase33.sh`: phase gate.
- `.planning/phases/33-seo-output-audit-and-content/33-release-log.md`: release ledger.
## Decisions Made
- The Task 1 answers above.
- `RequestOptions` gets the application database bound to the request context, or nil when the application has none. The test service has no database, and a type that needs one can check for nil.
- The compat stage reads the sitemap and Journal plugins at their releases before the phase (v0.1.2, v0.3.1) and sm-demo-app at its HEAD when 33-01 ran (da481c9). It uses read-only snapshots, not worktrees in the sibling repos.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Version base moved from v0.5.1/v0.5.2 to v0.6.0/v0.6.1 (Jakub's ruling, Decision C)**
- **Found during:** Task 1 (checkpoint), applied in Task 4
- **Issue:** The plan was written before v0.5.2, v0.5.3 and v0.6.0 were tagged, so the six Phase 32 fixes are already released.
- **Fix:** The additive stage still computes the newest tag that does not contain HEAD (v0.6.0). The marker base is `PHASE33_BASE=v0.6.0`. The release log lists the fixes as "already released in v0.5.2" and plans v0.6.1. The commit subject of group B is `docs(33-01): release log for v0.6.1`, not `... v0.5.2`.
- **Files modified:** scripts/check-phase33.sh, 33-release-log.md
- **Committed in:** 6ea43bb, 21aa4e5
**2. [Rule 3 - Blocking] Plugin tags moved past the plan's ranges**
- **Found during:** Task 4
- **Issue:** The plan pasted `sm-seo-plugin v0.1.0..HEAD` and `sm-journal-plugin v0.2.5..HEAD` as unreleased fixes. Those commits are now released in sm-seo-plugin v0.1.1 and sm-journal-plugin v0.2.6 to v0.3.1, and no plugin or layer has unreleased commits.
- **Fix:** The release log has a table of the newest tag per repository with "none" unreleased. Versions are still read from `git tag` in 33-14.
- **Committed in:** 21aa4e5
**3. [Rule 3 - Blocking] Docs checker requires src= snippets for go code blocks**
- **Found during:** Task 3
- **Issue:** The docs checker refuses a hand-written go snippet in docs/backend/field-types.md.
- **Fix:** Added a runnable `headingLevels` func and `ExampleCompileFormWithTypes_requestOptions` to modules/cabana/example_field_type_test.go. The page embeds the func through `src=`.
- **Committed in:** 4cd35c9
**4. [Rule 2 - Marker] pact README addition moved to a new bullet**
- **Found during:** Task 2
- **Issue:** Editing the existing descriptor bullet re-added its pre-existing word "sitemaps" as a changed line, which the D-90 marker stage would flag.
- **Fix:** The new facts are described in a separate "Content facts" bullet, and the original line is unchanged.
- **Committed in:** 561a56c
**5. [TDD] Task 3 RED evidence not committed separately**
- **Found during:** Task 3
- **Issue:** The plan's commit-group table gives Task 3 one commit (`feat(cabana): ...`), while tdd.md's cycle commits `test(...)` first. The plan is `type: execute`, not `type: tdd`.
- **Fix:** I followed the plan's single commit. RED was recorded before implementing: TestFieldTypeRequestOptions failed on 4 behaviour subtests (`typeOptions=map[rows:4]`, `calls=0`, no warning logged), and `check tdd-red-evidence` returned RED_EVIDENCE_OK. GREEN then passed all 8 subtests.
---
**Total deviations:** 5 (3 blocking, 1 marker-safety, 1 TDD commit-shape note)
**Impact on plan:** The API shape and behaviour are exactly as planned. Only version numbers, the ledger contents and the doc mechanics changed.
## Issues Encountered
- The compat stage reports sm-feedback-plugin, sm-presentations-plugin and sm-quizzes-plugin as "skipped (fails at v0.6.0 too)": they do not resolve the framework through a scratch workspace at either revision. These failures predate this plan and are not caused by it.
- shellcheck warns SC2034 (`type` unused) in the copied `snapshot_submodules`. check-phase32.sh has the same warning, so I left it as is.
## Verification run
- `go vet ./... && go test -short ./...`: green after every commit.
- `go test ./modules/signpost -run 'TestContentDescriptorFields|Example' -v`: PASS (5 subtests, 3 examples).
- `go test ./modules/cabana -run 'TestFieldTypeRequestOptions|TestFormExtensionUnextendedSchemaUnchanged' -v`: PASS (8 subtests).
- `scripts/check-admin-openapi.sh --check`: exit 0. `check-phase33.sh --admin` (openapi + dist): passed.
- `go test ./cmd/summer -run TestDocsTree` and `summer docs:build --check`: no problems.
- `bash scripts/check-phase33.sh --self-test`: passed (37 checks). Without an argument it exits 2 and prints the usage.
- `bash scripts/check-phase33.sh --go --docs --marker --additive`: PASS all four; additive: cabana +0, pact +35, signpost +0 lines against v0.6.0.
- `bash scripts/check-phase33.sh --plugins`: passed (sm-seo-plugin 77 and sm-journal-plugin 232 vitest tests).
- `bash scripts/check-phase33.sh --compat`: passed.
- Not run here: `--layers` (vue-seo-layer `testing/guard-check.mjs` arrives in 33-08), `--consumers`, `--docker`.
## User Setup Required
None. No external service configuration is required.
## Next Phase Readiness
- 33-02 (Blog Editor) can use `RequestOptions` for `headingLevels` and `genericAnchors`, and 33-03 onward can fill and read the content facts.
- 33-14 tags framework **v0.6.1** and follows 33-release-log.md.
## Self-Check: PASSED
- FOUND: modules/pact/content.go, modules/pact/capabilities.go, modules/signpost/content_fields_smoke_test.go, modules/cabana/field_request_options_smoke_test.go, scripts/check-phase33.sh, 33-release-log.md
- FOUND commits: 561a56c, 4cd35c9, 6ea43bb, 21aa4e5
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,346 @@
---
phase: 33-seo-output-audit-and-content
plan: 02
subsystem: journal
tags: [sm-journal-plugin, headings, h1-setting, blog-editor, tiptap, content-descriptor, mcp, media-names, bluemonday]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-01 seams: pact content facts (Kind, Tools, PublishedAt, Parents, Authors, TopHeading, Images, Videos, Headings) and pact.FormFieldType.RequestOptions"
- phase: 32-seo-foundation
provides: "Journal content descriptors, journal-tag, RecordSaved emission on API writes"
provides:
- "Journal H1 setting content_h1_to_h2 (settings row, config key golem15.journal.content_h1_to_h2 as fallback) with H1 to H2 conversion on every Journal rich-text write path (post content and category pillar text)"
- "content_h1_to_h2 flag on GET /posts/{slug} and every GET /categories row; notices key on API write answers"
- "journal:fix-headings and POST /_journal/api/v1/fix-headings over stored post and category content"
- "GET/PUT /_journal/api/v1/settings and POST /_journal/api/v1/images/alt"
- "MCP tools journal_get_settings, journal_update_settings, journal_fix_headings, journal_set_image_alt"
- "Descriptor facts for posts, categories and tags, and the journal-author content type (golem15.journal.author_pages)"
- "Blog Editor J1-J4 on RequestOptions (heading levels, outline panel, link rel, generic-anchor warning, image naming)"
- "HTML policy keeps rel=nofollow|sponsored|ugc on a; classes.MediaFileName slugs uploaded image names"
affects: [33-04, 33-06, 33-09, 33-10, 33-11, 33-13, 33-14]
actuals:
tokens: 55440
tasks: 4
commits: 9
plan_head_before: f7bfb3313b718e31cc754c87e4e0f9b0dcf95c0a
plan_head_after: 0edf6e1b67d4f7d8f62980e30d52292cce94faf3
tech-stack:
added: []
patterns:
- "Byte-preserving HTML rewrites on the x/net/html tokenizer (ConvertH1 rewrites only the tag name; SetImageAlt rewrites only the matching img from its token)"
- "One setting reader (EffectiveH1ToH2): settings row, else config key, else true"
- "Per-request field options from settings (RequestOptions), read by the element from its options attribute"
- "A parse rule carried by a never-created node type (HeadingOneAsTwo) to map h1 to the heading node at level 2"
key-files:
created:
- ../sm-journal-plugin/updates/202610280001_add_golem15_journal_settings_headings.go
- ../sm-journal-plugin/config/config.yaml
- ../sm-journal-plugin/classes/headings.go
- ../sm-journal-plugin/classes/heading_fix.go
- ../sm-journal-plugin/classes/journal_settings.go
- ../sm-journal-plugin/classes/image_alt.go
- ../sm-journal-plugin/classes/content_facts.go
- ../sm-journal-plugin/classes/media_names.go
- ../sm-journal-plugin/console/fix_headings.go
- ../sm-journal-plugin/controllers/api/settings.go
- ../sm-journal-plugin/controllers/api/maintenance.go
- ../sm-journal-plugin/assets/src/blogeditor/outline.ts
- ../sm-journal-plugin/assets/src/blogeditor/linkform.ts
- ../sm-journal-plugin/assets/src/blogeditor/imageform.ts
- ../sm-journal-plugin/headings_test.go
- ../sm-journal-plugin/journal_descriptor_fields_test.go
- ../sm-journal-plugin/classes/media_names_test.go
- ../sm-journal-plugin/tests/blogeditor/additions.test.ts
modified:
- ../sm-journal-plugin/models/settings.go
- ../sm-journal-plugin/models/settings/fields.yaml
- ../sm-journal-plugin/plugin.go
- ../sm-journal-plugin/routes.go
- ../sm-journal-plugin/mcp.go
- ../sm-journal-plugin/classes/blog_editor.go
- ../sm-journal-plugin/classes/format_html.go
- ../sm-journal-plugin/classes/media_store.go
- ../sm-journal-plugin/classes/content_descriptors.go
- ../sm-journal-plugin/classes/menu_item_types.go
- ../sm-journal-plugin/controllers/api/posts.go
- ../sm-journal-plugin/controllers/api/posts_helpers.go
- ../sm-journal-plugin/console/import_posts.go
- ../sm-journal-plugin/assets/src/blogeditor/element.ts
- ../sm-journal-plugin/assets/src/blogeditor/extensions.ts
- ../sm-journal-plugin/assets/src/blogeditor/toolbar.ts
- ../sm-journal-plugin/assets/src/blogeditor/labels.ts
- ../sm-journal-plugin/assets/src/blogeditor/blogeditor.css
- ../sm-journal-plugin/assets/dist/blogeditor.js
- ../sm-journal-plugin/assets/dist/blogeditor.css
- ../sm-journal-plugin/tests/blogeditor/fixtures/editor-corpus.json
- ../sm-journal-plugin/lang/en/lang.yaml
- ../sm-journal-plugin/lang/pl/lang.yaml
- ../sm-journal-plugin/README.md
key-decisions:
- "Version mapping (Jakub's 33-01 ruling): the framework target is SummerCMS v0.6.1 (base v0.6.0); sm-journal-plugin is at v0.3.1, its next version is read from git tag in 33-14. go.mod still requires v0.6.0 with the existing replace to ../summercms.go; the require bump waits for the v0.6.1 tag"
- "P33-04 as planned: EffectiveH1ToH2 reads the settings row, then golem15.journal.content_h1_to_h2, then true"
- "API H1 conversion converts content and content_html together (default and translated); ConvertH1 is byte-preserving, so markdown content changes only where it holds raw <h1> tags. An update that does not send content converts nothing"
- "API notices: one {message, count} per converted locale, with a locale key on a translation's notice (additive)"
- "POST /fix-headings defaults to dry_run true (mirrors the CLI); POST /images/alt defaults to dry_run false (an explicit per-change edit); set_image_alt also checks post.CanEdit per post (403)"
- "The stored-heading fix rewrites translate rows directly (attribute_data JSON, translate's own encoding) so a translation in a since-disabled locale is converted too and SetTranslated's enabled-locale check cannot abort the batch"
- "Editor schema keeps H5 and H6 (levels 2-6 while the setting is on, 1-6 while off); the toolbar offers only H2-H4 or H1-H4. A strict [2,3,4] schema would drop stored H5/H6 on the first edit"
- "Post Parents are the post's categories by name (the order :category takes its first category in)"
- "journal-author: Controller empty, Model Backend\\Models\\User, Published = has a published post, LastMod = newest update of their published posts"
- "MediaFileName applies to both the editor upload and POST /_journal/api/v1/media/upload (D-85 server backstop); the response shape is unchanged, the stored name is now slugged"
patterns-established:
- "Content plugins answer their own fixing tools in ContentDescriptor.Tools (journal_update_post, journal_fix_headings, journal_set_image_alt)"
- "Editor options arrive per request through RequestOptions; the element parses them from its options attribute with defaults"
requirements-completed: [SC-2, SC-3, D-50, D-51, D-81, D-83, D-85, D-96, D-43, D-93, D-10]
coverage:
- id: D1
description: "H1 setting (column, config key, Headings and links tab) with admin save conversion and the post-title notice; GET /posts/{slug} reports content_h1_to_h2; setting off stores H1 unchanged; switching never rewrites stored content"
requirement: "D-50"
verification:
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestHeadingConversionTracer"
status: pass
- kind: unit
ref: "../sm-journal-plugin/classes/headings_test.go#TestConvertH1"
status: pass
- kind: integration
ref: "../sm-journal-plugin/updates/settings_headings_migration_test.go#TestSettingsHeadingsMigration"
status: pass
human_judgment: false
- id: D2
description: "Conversion on the API (default and translated), markdown, import and category admin paths with notices; GET /categories rows carry content_h1_to_h2"
requirement: "D-96"
verification:
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestHeadingConversion"
status: pass
human_judgment: false
- id: D3
description: "journal:fix-headings (dry run, --apply, nothing to do, refusal exit 1) and POST /fix-headings over posts and categories with RecordSaved per changed record; settings API with manage_settings (401/403/422)"
requirement: "D-10"
verification:
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestFixHeadingsCommand"
status: pass
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestJournalSettingsTools"
status: pass
human_judgment: false
- id: D4
description: "POST /images/alt and MCP journal_set_image_alt: tokenizer-escaped alt, all-or-nothing 422, dry run, decorative alt, translated content, access_posts; four new MCP tools listed and bound to routes"
requirement: "D-85"
verification:
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestSetImageAlt"
status: pass
- kind: unit
ref: "../sm-journal-plugin/classes/image_alt_test.go#TestSetImageAlt"
status: pass
- kind: unit
ref: "../sm-journal-plugin/mcp_test.go#TestJournalMCP"
status: pass
- kind: unit
ref: "../sm-journal-plugin/mcp_smoke_test.go#TestJournalMCPSmoke"
status: pass
human_judgment: false
- id: D5
description: "Descriptor facts for posts (PublishedAt, Parents, Authors, Images, Videos, Headings, TopHeading, Kind, Tools), categories (Parents, Headings, TopHeading, Kind, Tools) and tags (Kind)"
requirement: "D-93"
verification:
- kind: integration
ref: "../sm-journal-plugin/journal_descriptor_fields_test.go#TestJournalDescriptorFields"
status: pass
human_judgment: false
- id: D6
description: "journal-author content type with author_pages on and off"
requirement: "D-43"
verification:
- kind: integration
ref: "../sm-journal-plugin/journal_descriptor_fields_test.go#TestJournalAuthorType"
status: pass
human_judgment: false
- id: D7
description: "Stored HTML keeps rel with only nofollow/sponsored/ugc; MediaFileName slug rule on uploads; corpus pins a rel link and a decorative image"
requirement: "D-83"
verification:
- kind: unit
ref: "../sm-journal-plugin/classes/editor_policy_test.go#TestEditorOutputPassesPolicy"
status: pass
- kind: unit
ref: "../sm-journal-plugin/classes/media_names_test.go#TestMediaFileName"
status: pass
human_judgment: false
- id: D8
description: "Blog Editor J1-J4 behaviour: heading levels per setting via RequestOptions, outline flags and counts with CLDR plurals, rel checkboxes and generic warning, slugged file name and decorative alt; dist matches a fresh build"
requirement: "D-51"
verification:
- kind: automated_ui
ref: "../sm-journal-plugin/tests/blogeditor/additions.test.ts"
status: pass
- kind: integration
ref: "../sm-journal-plugin/headings_test.go#TestBlogEditorRequestOptions"
status: pass
- kind: other
ref: "bash ../sm-journal-plugin/scripts/check-dist.sh"
status: pass
human_judgment: false
- id: D9
description: "J2 outline look and wrapping in the real admin (long headings wrap with a hanging indent at 360 px, 12px indent per level, icon and colours in light and dark), J3/J4 form layout"
requirement: "D-81"
verification: []
human_judgment: true
rationale: "Visual layout in the embedded admin SPA; happy-dom tests cover structure and behaviour, not rendering"
- id: D10
description: "The H1 setting switch saved from Settings › Journal in the admin"
verification: []
human_judgment: true
rationale: "Blocked by a pre-existing framework issue (lagoon.Validate rejects the string/url rule tokens; the Journal settings screen answers 500 on save, deferred-items.md); the API and MCP path is tested"
duration: 60min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 02: Journal headings, editor additions and content facts Summary
**Per-site Journal H1 setting with byte-preserving H1→H2 conversion on every rich-text write path (admin, API/MCP, markdown, import, category pillar text), journal:fix-headings, the settings and bulk image-alt routes with four new MCP tools, descriptor facts plus a journal-author content type, and Blog Editor J1–J4 (heading levels, outline, link rel, slugged image names)**
## Read first: version mapping and things to decide
- **Versions (Jakub's 33-01 ruling).** Read "v0.5.1" in the plan as SummerCMS v0.6.0 and "v0.5.2" as v0.6.1. The Journal changes need v0.6.1 (the content facts and `RequestOptions` are new there). `sm-journal-plugin/go.mod` still requires `v0.6.0` and resolves the framework through its existing `replace => ../summercms.go`; I did not touch that replace. The require bump to v0.6.1 happens when 33-14 tags the framework. The Journal was at v0.3.1 before this plan, and its next version is read from `git tag` in 33-14. Nothing was pushed or tagged.
- **No breaking change to an existing Journal consumer.** Every API change adds something: `content_h1_to_h2` on `GET /posts/{slug}` and on the category rows, `notices` on write answers, and new routes and tools. Two behaviour changes need a line in the release notes:
1. The H1 setting defaults to **on** (D-50, Jakub 2026-10-28). After the upgrade, new saves on a site turn H1 into H2 until someone switches the setting off. Stored content is never rewritten unless `journal:fix-headings --apply` runs.
2. Uploaded image names are now slugged on the server (D-85). This covers `POST /_journal/api/v1/media/upload` too: `My Photo.JPG` is stored as `my-photo.jpg`. The response shape is the same, and clients use the returned URL.
- **Pre-existing framework issue (deferred, needs a decision).** Saving Settings › Journal in the admin answers **500**, and it did before this plan too. `lagoon.Validate` does not know the `string` and `url` rule tokens that `Settings.Rules()` has used for a long time. So until the framework is fixed, the new switch can only be changed through `PUT /_journal/api/v1/settings` or MCP `journal_update_settings`. Details are in `deferred-items.md`, and there is a WINDOWS.md entry. The fix belongs in lagoon (v0.6.1).
## Performance
- **Duration:** about 60 min
- **Started:** 2026-11-04T08:38:29Z
- **Completed:** 2026-11-04T09:38:48Z
- **Tasks:** 4 (9 commits in sm-journal-plugin)
- **Files modified:** 63 in sm-journal-plugin
## Accomplishments
- The Journal H1 setting (`content_h1_to_h2`, Headings and links tab, config fallback) converts H1 to H2 on every Journal rich-text write path and sends a notice. Post and category answers expose the setting. Stored content changes only through `journal:fix-headings --apply` or `journal_fix_headings`.
- Journal fixes its own content through MCP: `journal_get_settings`, `journal_update_settings`, `journal_fix_headings` and `journal_set_image_alt` (D-10, D-85, P33-05).
- Descriptors give the SEO, sitemap and audit plugins publication dates, parents, authors, images (with alt and the decorative flag), YouTube videos, the heading outline, the top heading level, the kind and the fixing tools. Author pages are a content type (`journal-author`).
- Blog Editor J1–J4: the heading levels follow the setting (per request through `RequestOptions`). There is a read-only outline that flags skipped, empty, link-only and Source-mode H1 headings and generic link texts. External links get rel checkboxes, a generic link text gets a non-blocking warning, and an image gets a slugged file name and a required alt (or is marked decorative) before upload.
- On the server, the HTML policy keeps `rel` when it holds only `nofollow`, `sponsored` and `ugc`, and `MediaFileName` applies the same slug rule as the editor.
## Task Commits (sm-journal-plugin, branch main, not pushed)
1. **Task 1: H1 setting with the admin save conversion (tracer)**: `305f94a` (feat)
2. **Task 2: other write paths, fix-headings, settings API, MCP tools**: `faaa9b0` (group A), `5210b64` (group B), `af25eaa` (group C)
3. **Task 3: descriptor facts and journal-author**: `e8e77a1` (group A), `805bfdb` (group B)
4. **Task 4: Blog Editor J1–J4, rel policy, media names, README**: `391435b` (group A), `4b09bd9` (groups B and C together), `0edf6e1` (group D, docs)
**Plan metadata:** the SUMMARY commit in summercms.go (docs), then ROADMAP alone.
## Files Created/Modified (sm-journal-plugin)
- `updates/202610280001_add_golem15_journal_settings_headings.go`: `content_h1_to_h2 BOOLEAN NOT NULL DEFAULT TRUE`, `generic_anchors TEXT NULL`, with rollback.
- `config/config.yaml`, `plugin.go`: `ConfigFS` (`pact.HasConfig`) and the `journal:fix-headings` registration.
- `classes/journal_settings.go`: `EffectiveH1ToH2`, `GenericAnchors`, `DefaultGenericAnchors`, `H1ToH2Key`.
- `classes/headings.go`: `ConvertH1`, `CountH1`, `ConvertContentH1`, `ConvertTranslationH1`.
- `classes/heading_fix.go`: `FixStoredHeadings`, `HeadingFix` and the refusal text. They are shared by the command and the API.
- `classes/image_alt.go`: `SetImageAlt` on the tokenizer.
- `classes/content_facts.go`: the image, video and heading parse, category refs and the author projection.
- `classes/content_descriptors.go`, `classes/menu_item_types.go`: the facts, `AuthorPagesKey`, and the `journal-author` type (`MenuTypeAuthor`, `DefaultAuthorPattern`).
- `classes/blog_editor.go`: the Decode conversion with the post or category notice, and `RequestOptions` (`headingLevels`, `genericAnchors`). `safeUploadName` now uses `MediaFileName`.
- `classes/format_html.go`: the rel rule. `classes/media_names.go`: `MediaFileName`. `classes/media_store.go`: applies it.
- `controllers/api/posts.go`, `posts_helpers.go`: conversion inside the write transaction, the `notices` answer and the category flag.
- `controllers/api/settings.go`: `ShowSettings`, `UpdateSettings`. `controllers/api/maintenance.go`: `FixHeadings`, `SetImageAlt`. `routes.go`: four routes.
- `console/fix_headings.go`. `console/import_posts.go`: `ImportFromDirConfig`, `ImportStats.H1Converted`. `ImportFromDir` keeps its signature.
- `mcp.go`: four tools.
- `assets/src/blogeditor/{element,extensions,toolbar,labels,outline,linkform,imageform}.ts`, `blogeditor.css`, `assets/dist/*`: J1–J4.
- `lang/{en,pl}/lang.yaml`: the C27 keys with the P33-54 wording, `editor.h1_converted` and `editor.h1_converted_category` (CLDR plurals), and `menuitem.journal_author`.
- `README.md`: the setting and its precedence, the write paths, the command, the routes, the MCP tools, `journal-author`, the content facts, the editor additions and the rel and name rules.
## Decisions Made
See `key-decisions` in the frontmatter. The main ones:
- The API converts `content` and `content_html` together.
- A PUT without `content` converts nothing.
- `fix-headings` is a dry run by default. `images/alt` is not, because it is an explicit edit, and it checks edit rights per post.
- The editor schema keeps H5 and H6 so that stored headings survive an edit.
- Post parents are ordered by category name.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug, deferred root cause] Settings screen save fails in the admin (pre-existing)**
- **Found during:** Task 2 (settings API)
- **Issue:** `lagoon.Validate` rejects the `string` and `url` tokens in `Settings.Rules()`. The admin settings PUT answers 500, and my API handler hit the same error.
- **Fix:** `UpdateSettings` checks `string` and `url` itself (`settingsRule`) and passes the other tokens to `lagoon.Validate`. The admin screen is not fixed, because that needs a framework change; it is logged in `deferred-items.md` and WINDOWS.md.
- **Files modified:** controllers/api/settings.go
- **Verification:** TestJournalSettingsTools (422 for a bad URL and for a non-string value)
- **Committed in:** 5210b64
**2. [Rule 3 - Blocking] The category-content migration test assumed it was the last migration**
- **Found during:** Task 1
- **Fix:** It now rolls back to the step before its own (`RollbackTo`). I added `TestSettingsHeadingsMigration` for the new step.
- **Committed in:** 305f94a
**3. [Rule 1 - Data loss] The heading schema keeps H5 and H6**
- **Found during:** Task 4
- **Issue:** TipTap levels of exactly `[2, 3, 4]` (UI-SPEC C28) would turn stored H5 and H6 into paragraphs on the first edit of their block.
- **Fix:** The schema levels are 2–6 while the setting is on and 1–6 while it is off. The toolbar offers H2–H4 or H1–H4. A dedicated parse rule (`HeadingOneAsTwo`) maps `<h1>` to level 2 without importing `@tiptap/extension-heading`, so no package was added.
- **Committed in:** 4b09bd9
**4. [Rule 3 - Blocking] Existing tests pinned the behaviour this plan changes**
- Tool lists (TestJournalMCP, TestJournalMCPSmoke), menu type lists (TestMenuItemTypesPatterns, TestContentDescriptors), the category key list (categories_test.go), and the corpus test's "no rel" assertion. The upload-name expectations changed too: `zdj-cie-1.png` is now `zdjecie-1.png`, `ok-adka.png` is now `okladka.png`, and `b.JPEG` is now `b.jpeg`. The old upload-on-pick tests (smoke.test.ts, embed.test.ts) were rewritten to the J4 flow, which is pick, then the form, then Insert uploads, then the image is inserted on the result. I updated each test to the new behaviour; I did not remove any.
- **Committed in:** 5210b64, af25eaa, 805bfdb, 391435b, 4b09bd9
**5. [Plan shape] Task 4 groups B and C are one commit**
- **Issue:** J1–J4 share `element.ts`, `labels.ts` and the bundle. If B were committed without C, the import graph would not build.
- **Fix:** One commit, `feat: editor heading levels, outline, link rel, generic-anchor warning and image naming`.
**6. [Plan shape] Helper and test files the plan did not list**
- `classes/heading_fix.go` holds the logic the command and the API share. The tests not in the plan are `classes/headings_test.go`, `classes/image_alt_test.go`, `updates/settings_headings_migration_test.go`, `tests/blogeditor/additions.test.ts` and `TestBlogEditorRequestOptions`. The slug helpers live in `imageform.ts`. I added `controllers.PermissionManageSettings` and `console.ImportFromDirConfig`; both are additive.
- For the acceptance greps, the C27 console copy appears in `console/fix_headings.go` (doc comment and long help). The runtime refusal string is `classes.H1ConversionOffText`.
**7. [TDD note] RED evidence**
- Task 2 group A tests were written right after the code, so no RED was captured for them. For Task 2 groups B and C and for Task 3, I ran the tests against stubs first. Each failed on its target assertion: TestFixHeadingsCommand had dry-run output `""`, TestJournalSettingsTools got 404, TestSetImageAlt got 404, the TestJournalMCP tool list mismatched, and the descriptor kinds were empty and journal-author was nil. `check tdd-red-evidence` only reads TAP, so I converted the Go output to TAP, and it then returned RED_EVIDENCE_OK.
**8. [Cosmetic] Attribute order of new editor links**
- TipTap renders `rel` before `href` (`<a rel="nofollow sponsored" href="…">`). The policy and the layer do not depend on attribute order. Stored links keep their own bytes.
---
**Total deviations:** 8 (1 deferred pre-existing bug, 1 blocking test fix, 1 data-loss guard, 1 test update set, 2 plan-shape, 1 TDD note, 1 cosmetic)
**Impact on plan:** Every must-have truth is met through the API, MCP, editor and descriptors. The one exception is the admin switch save, which a pre-existing framework issue blocks.
## Issues Encountered
- `go test ./... -run X` prints "no tests to run" for the subpackages. The plan's `fails_when` lists that phrase, but each named root test passes: the line is from the other packages.
- vue-journal-layer holds a copy of `editor-corpus.json`. Its policy mirror (htmlGate) has to accept `rel` with the three tokens and `alt=""`, which is 33-09's work.
## User Setup Required
None. No external service configuration is required.
## Next Phase Readiness
- 33-04 (image and News sitemaps), 33-06 (JSON-LD, breadcrumbs), 33-09 (layer title tag and htmlGate following `content_h1_to_h2`) and 33-10 (CMS checks through `Tools`, `TopHeading`, `Images`, `Headings`) can read what this plan provides.
- 33-14: bump the Journal `go.mod` to the v0.6.1 tag, tag the Journal from `git tag` (after v0.3.1), and include the release notes about the default-on setting and slugged upload names.
- Open: the framework fix for `lagoon.Validate` `string`/`url` (deferred-items.md).
## Self-Check: PASSED
- FOUND: the 18 created files listed in key-files.created (checked with `[ -f ]`).
- FOUND commits in sm-journal-plugin: 305f94a, faaa9b0, 5210b64, af25eaa, e8e77a1, 805bfdb, 391435b, 4b09bd9, 0edf6e1. `git rev-list --count f7bfb33..HEAD` = 9.
- Verification: `go vet ./...` and `go test -short ./...` are green. The full Docker `go test ./...` is green (root, classes, controllers, api, models, updates). `npm run test` passed 244 of 244. `check-dist.sh` matches. `check-phase33.sh --plugins` passed.
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,437 @@
---
phase: 33-seo-output-audit-and-content
plan: 03
subsystem: sitemap
tags: [sm-sitemap-plugin, sitemap-index, slot-table, stable-numbering, lastmod, hreflang, filter-contract, listing, conga, settings-singleton, breaking-change]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-01 version ruling (framework target v0.6.1, base v0.6.0) and the signpost content facts"
- phase: 32-seo-foundation
provides: "signpost content descriptors and Records (D-93), pact.RecordSaved/RecordDeleted (D-92), form extensions (D-91)"
provides:
- "sm-sitemap-plugin per-type format: GET /sitemap.xml index and GET /_sitemap/files/{file} served from the slot table golem15_sitemap_urls (D-30)"
- "Stable file numbering (classes.AssignSlots), file_size setting 1..50 000 (default 1000), renumbering only on a size change"
- "Event-driven lastmod (RecordSaved with changes outside golem15.sitemap.lastmod_ignore), RecordDeleted holes"
- "Rebuild job golem15.sitemap.rebuild: debounced after record events (rebuild_pending_until), dispatched on settings save, nightly sitemap:rebuild 03:00, sitemap:rebuild [--queue]"
- "hreflang xhtml:link alternates with x-default (D-55 to D-57)"
- "Package git.golem15.com/golem15/sm-sitemap-plugin/contract: Filter (consumed through app.Lookup), Listing (published by the plugin), reasons (D-95)"
- "Settings singleton golem15.sitemap.settings (Files with S1 partial, Content types extension tab, Additional addresses); golem15_sitemap_types"
- "Migration of the Phase 17 definition url items into extra_urls, frontend_url into site_url, frontend_default_locale into default_locale (D-32)"
- "sitemap:import and sitemap:import-winter retargeted to the additional addresses"
affects: [33-04, 33-05, 33-07, 33-08, 33-13, 33-14]
actuals:
tokens: 60600
tasks: 4
commits: 7
plan_head_before: 049f3ee270ed9ac2619f357626914b1a8caac780
plan_head_after: 64453d2a914f00a8310f76f806a8858d5d4345da
tech-stack:
added: []
patterns:
- "Slot table: every address is a row with (grp, file_no); a rebuild keeps numbers, appends oldest first, leaves holes; numbered_size detects a file size change"
- "One rebuild transaction that locks settings row 1 (SELECT ... FOR UPDATE), so two rebuilds never interleave"
- "Debounce through a conditional UPDATE of rebuild_pending_until plus conga Enqueue in the same transaction; the job clears it when it starts"
- "Published contract sub-package without init, so other plugins import the seam without registering the plugin"
key-files:
created:
- ../sm-sitemap-plugin/contract/contract.go
- ../sm-sitemap-plugin/classes/slots.go
- ../sm-sitemap-plugin/classes/rebuild.go
- ../sm-sitemap-plugin/classes/writer.go
- ../sm-sitemap-plugin/classes/settings.go
- ../sm-sitemap-plugin/classes/types.go
- ../sm-sitemap-plugin/classes/dispatch.go
- ../sm-sitemap-plugin/classes/lastmod.go
- ../sm-sitemap-plugin/classes/listing.go
- ../sm-sitemap-plugin/models/url.go
- ../sm-sitemap-plugin/models/type_setting.go
- ../sm-sitemap-plugin/models/legacy.go
- ../sm-sitemap-plugin/updates/202610280001_create_golem15_sitemap_urls.go
- ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go
- ../sm-sitemap-plugin/updates/202610280003_create_golem15_sitemap_types.go
- ../sm-sitemap-plugin/controllers/settings.go
- ../sm-sitemap-plugin/controllers/settings/config_form.yaml
- ../sm-sitemap-plugin/controllers/settings/_sitemap_files.htm
- ../sm-sitemap-plugin/extensions_settings.go
- ../sm-sitemap-plugin/jobs.go
- ../sm-sitemap-plugin/listeners.go
- ../sm-sitemap-plugin/schedule.go
- ../sm-sitemap-plugin/console/rebuild.go
- ../sm-sitemap-plugin/sitemap_index_test.go
- ../sm-sitemap-plugin/content_fixture_test.go
- ../sm-sitemap-plugin/filter_fixture_test.go
- ../sm-sitemap-plugin/classes/slots_test.go
- ../sm-sitemap-plugin/classes/lastmod_test.go
modified:
- ../sm-sitemap-plugin/plugin.go
- ../sm-sitemap-plugin/routes.go
- ../sm-sitemap-plugin/admin.go
- ../sm-sitemap-plugin/models/settings.go
- ../sm-sitemap-plugin/models/settings/fields.yaml
- ../sm-sitemap-plugin/controllers/admin_registry.go
- ../sm-sitemap-plugin/console/import.go
- ../sm-sitemap-plugin/console/import_winter.go
- ../sm-sitemap-plugin/console/helpers.go
- ../sm-sitemap-plugin/config/config.yaml
- ../sm-sitemap-plugin/lang/en/lang.yaml
- ../sm-sitemap-plugin/lang/pl/lang.yaml
- ../sm-sitemap-plugin/README.md
- ../sm-sitemap-plugin/plugin.yaml
- ../sm-sitemap-plugin/go.mod
key-decisions:
- "Task 1 ANSWERED: as-proposed (Jakub, 2026-11-04): index stays /sitemap.xml, files /sitemap-<slug>-<n>.xml served through /_sitemap/files/{file}, /sitemap.xsl removed, one settings singleton, url items to Additional addresses, priority/changefreq/tiers/manifest removed, definitions table kept unread"
- "Version mapping (33-01 ruling): framework target v0.6.1, base v0.6.0; go.mod still requires summercms v0.6.0 with the existing replace => ../summercms.go; the bump is 33-14's"
- "Settings validation runs in the controller's FormBeforeUpdate (Settings.Validate), not lagoon.HasBeforeValidate: cabana's CRUD path turns a BeforeValidate error into a 500"
- "Content type titles (the HTML sitemap heading) are stored as a JSONB locale map on golem15_sitemap_types, not through the translation writer"
- "Rows left out (deleted, unpublished, noindex, type) keep their file number as a hole; a renumber drops the numbers of left-out rows"
- "S1 links files to the backend routes (/sitemap.xml, /_sitemap/files/<name>): the partial kit keeps only root-relative hrefs; the note names the public index URL"
- "The index answers 404 while no site address is configured, and an empty sitemapindex before the first rebuild"
- "A Filter error or a wrong number of decisions fails the rebuild (the files stay as they were); an invalid Decision.Group is ignored with a warning"
- "x-default points to the default_locale setting's address, else the record's first listed locale; alternates list only listed (not excluded) locales"
- "Reserved slugs images and news (33-04's image and News sitemaps) are refused as type file names"
patterns-established:
- "Plugins publish narrow seams in a contract sub-package with no init; consumers Lookup the interface and work without it"
- "Fake content plugin over an in-memory store for testing signpost consumers without database tables"
requirements-completed: [SC-1, D-30, D-32, D-55, D-56, D-57, D-93, D-95, D-24, D-22]
coverage:
- id: D1
description: "GET /sitemap.xml answers an index of per-type files sitemap-<slug>-<n>.xml with lastmod; each file at most file_size URLs with absolute <loc> and real <lastmod>, no priority or changefreq; drafts absent; escaping; unknown files 404; /sitemap.xsl 404"
requirement: "D-30"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestSitemapIndex"
status: pass
- kind: unit
ref: "../sm-sitemap-plugin/routes_test.go#TestFileNames"
status: pass
human_judgment: false
- id: D2
description: "Stable numbering: holes on delete, appends to the last file with room, renumber only on file_size change"
requirement: "D-30"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestStableNumbering"
status: pass
- kind: unit
ref: "../sm-sitemap-plugin/classes/slots_test.go#TestAssignSlots"
status: pass
human_judgment: false
- id: D3
description: "lastmod moves only on a real change (per locale for translated changes); no-op saves, ignored attributes and rebuilds leave it; deletes leave the files"
requirement: "D-30"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestLastmod"
status: pass
- kind: unit
ref: "../sm-sitemap-plugin/classes/lastmod_test.go#TestRealChanges"
status: pass
human_judgment: false
- id: D4
description: "hreflang alternates for each translated locale plus x-default; none for a missing translation or a single locale"
requirement: "D-55"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestHreflangAlternates"
status: pass
human_judgment: false
- id: D5
description: "contract.Filter batches per page; Exclude leaves the files counted by reason, Group moves to sitemap-offers-1.xml, Groups titles reach Listing.Settings; without a Filter everything published is listed; Listing.Entries paging"
requirement: "D-95"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestFilterExcludes"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestNoFilter"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestListing"
status: pass
human_judgment: false
- id: D6
description: "Rebuilds: debounced to one job per delay after record events, dispatched on save, nightly 03:00, sitemap:rebuild [--queue]"
requirement: "D-30"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestDebouncedRebuild"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestRebuildCommand"
status: pass
- kind: unit
ref: "../sm-sitemap-plugin/commands_documented_test.go#TestScheduleAndJobs"
status: pass
human_judgment: false
- id: D7
description: "Settings singleton (one tile, Files/Content types/Additional addresses), errors.* refusals, save dispatches a rebuild, type off leaves files with reason type, S1 empty/building/files/left-out states"
requirement: "D-32"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestSettingsSingleton"
status: pass
- kind: unit
ref: "../sm-sitemap-plugin/models/settings_test.go#TestSettingsValidate"
status: pass
human_judgment: false
- id: D8
description: "Definitions migration (url items to extra_urls, frontend_url to site_url, locale), definitions table untouched, rollback keeps data; sitemap:import and sitemap:import-winter write the additional addresses"
requirement: "D-32"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_index_test.go#TestMigrateDefinitions"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/import_test.go#TestImportWinter"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/import_test.go#TestImportFile"
status: pass
human_judgment: false
- id: D9
description: "Site URL precedence: setting, golem15.sitemap.site_url, app.url; never the Host header"
requirement: "D-22"
verification:
- kind: unit
ref: "../sm-sitemap-plugin/routes_test.go#TestSiteURLPrecedence"
status: pass
human_judgment: false
- id: D10
description: "The settings screen's look in the real admin (S1 tables and callouts, the Content types tab placement after Files, the repeater)"
verification: []
human_judgment: true
rationale: "Rendering in the embedded admin SPA; the tests cover the schema, the API and the partial's node tree, not the visual layout"
duration: 43min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 03: Golem15.Sitemap rewrite Summary
**sm-sitemap-plugin now serves a sitemap index at /sitemap.xml over per-type files `sitemap-<slug>-<n>.xml` from a slot table with stable numbering, event-driven lastmod, hreflang alternates and a debounced conga rebuild, narrowed by a published `contract.Filter` and readable through `contract.Listing`; the PHP-parity format, the definitions screen and the XSL are gone and the old data migrates.**
## Task 1 ANSWERED: as-proposed (Jakub, 2026-11-04)
- The index stays at `/sitemap.xml`. The per-type files are `/sitemap-<slug>-<n>.xml`, and Go serves them at `/_sitemap/files/{file}`.
- The XSL stylesheet `/sitemap.xsl` is removed and now answers 404. This resolves the todo `.planning/todos/completed/sitemap-xslt-browser-deprecation.md`. If g15office task **w8kupqi3** is still open, it can be closed as resolved by removal (commit `84cb27a` in sm-sitemap-plugin). I could not check its state from here.
- The Phase 17 definitions screen and the settings tile are now one settings singleton. The url items moved to "Additional addresses". priority, changefreq, tiers and the manifest are removed. The definitions table stays in the database and is no longer read.
## Read first: versions, breaking changes, consumers
- **Versions.** The framework target is v0.6.1 with base v0.6.0 (33-01 ruling). `sm-sitemap-plugin/go.mod` still requires `summercms v0.6.0` through the existing `replace => ../summercms.go`, and that replace was not touched. The plugin was at v0.1.2 (049f3ee). These changes are breaking, so the next minor tag is cut in 33-14. Nothing was pushed or tagged.
- **Breaking changes in sm-sitemap-plugin**, approved by the "as-proposed" answer:
1. `/sitemap.xml` is now a `<sitemapindex>`, not a `<urlset>`. The URL is unchanged, so robots.txt and the GSC submission need no change.
2. The files live at the site root as `/sitemap-<slug>-<n>.xml`, served by Go at `/_sitemap/files/<name>`. A site must map the root names: vue-seo-layer does this (33-07, next tag v0.2.0), or nginx can (the README has the snippet).
3. `/sitemap.xsl` answers 404. `<priority>` and `<changefreq>` are no longer written.
4. The admin has one "Sitemaps" tile linking to `golem15.sitemap.settings`. The `golem15.sitemap.definitions` controller and the `sitemap_settings` settings form are gone. The permission code `golem15.sitemap.access_definitions` is unchanged, so roles keep their access.
5. Config keys `golem15.sitemap.cache_seconds` and `golem15.sitemap.priority_tiers` are removed. New keys: `site_url`, `lastmod_ignore`, `rebuild_delay_seconds`. The festival events `classes.BeforeAddItem` and `classes.AddItem` are removed.
6. A `<loc>` never uses the request Host. Without a site address (the setting, `golem15.sitemap.site_url` or `app.url`), the index answers 404.
7. `sitemap:import` writes `{url, lastmod}` into the additional addresses and ignores `changefreq` and `priority`. Its success line is now "Imported N addresses into the sitemap's additional addresses." `sitemap:import-winter` keeps its flags but writes url items into the additional addresses and the settings into `site_url` and `default_locale`. Reference items are dropped.
8. The application needs a conga worker for rebuilds (record events and saves queue them) and the scheduler for the nightly run. Otherwise someone has to run `sitemap:rebuild`. After deploying, run `sitemap:rebuild` once so the files exist.
- **Consumers.** sm-grzybyfunkcjonalne-app and sm-demo-app pin v0.1.2 as a submodule and are untouched. They move to the new URLs in 33-13. No core plugin (user, blog, pages, payment, journal) was changed, and the framework got no code from this plan (D-90; `--marker` passed).
## Performance
- **Duration:** about 43 min
- **Started:** 2026-11-04T09:47:25Z
- **Completed:** 2026-11-04T10:30Z
- **Tasks:** 4 (Task 1 decision answered before the run, Tasks 2 to 4 executed)
- **Commits:** 7 in sm-sitemap-plugin (branch main, not pushed). 78 files changed: 49 added or modified, 29 removed.
## Accomplishments
- **Index and files from a slot table (D-30).** `golem15_sitemap_urls` holds one row per address with its group and file number. Rebuilds keep file numbers, append new addresses to the last file with room, and leave holes for deleted, unpublished or excluded addresses. Only a `file_size` change renumbers. The routes read the table and never generate per request.
- **Real lastmod.** A row's lastmod starts at the record's `LastMod`. After that it moves only when `pact.RecordSaved` reports a change outside `golem15.sitemap.lastmod_ignore`. A translated change moves only that locale's row. A no-op save, a counter update or a rebuild moves nothing. `pact.RecordDeleted` takes the rows out at once.
- **Rebuilds.** Rebuilds run as the conga job `golem15.sitemap.rebuild`:
- debounced after record events through `rebuild_pending_until` (P33-12), defaulting to 60 s;
- dispatched after every settings save commits;
- run nightly at 03:00 through the scheduled `sitemap:rebuild`;
- run by hand with `sitemap:rebuild`, or `--queue` to hand it to a worker.
- **hreflang (D-55 to D-57).** A record with two or more listed locales gets `xhtml:link` alternates on every listed address, plus `x-default` on the default locale's address. The xhtml namespace is declared only when used.
- **Contract (D-95).** `contract.Filter` is asked once per page of records and once for the additional addresses:
- an excluded address keeps its row with the reason and is counted in S1;
- `Decision.Group` moves the address to another file group;
- `Decision.LastMod` sets the first lastmod of a new address.
The plugin publishes `classes.Listing` as `contract.Listing` in `Register`. Its `Settings` returns the site address, the index address, the default locale and the groups with counts and titles. Its `Entries` pages through a group's addresses, with a locale filter.
- **Settings singleton (C26).** One tile opens it. It has three tabs:
- Files: site address, file size, and the S1 partial (index plus files, the left-out table by reason, a note; the empty and building states).
- Content types: built at boot from signpost, one block per type (include, file name, HTML heading).
- Additional addresses.
Saving refuses bad input with the `errors.*` copy.
- **Migration (D-32).** Migration 202610280002 copies the url items of the served definition into `extra_urls`, `frontend_url` into `site_url` and `frontend_default_locale` into `default_locale`. The definitions table and the Phase 17 columns are untouched, and rollback drops only the new columns.
- **Removal.** The generator, the libxml serializer, tiers, the rewrite, the manifest, the `Url::to` port, the events, the PHP goldens with their generator, the XSL, the definition model, the definitions controller and its form are all deleted, along with their tests.
## Task Commits (sm-sitemap-plugin, branch main, not pushed)
1. **Task 1: Confirm the public format.** No commit; answered "as-proposed" (above).
2. **Task 2: index and per-type files (tracer):** `3359f1a` feat: sitemap index and per-type files from a slot table (tracer)
3. **Task 3:**
- group A `3ba70bb` feat: sitemap settings singleton with content types and additional addresses
- group B `84cb27a` feat!: remove the PHP-parity sitemap, tiers, definitions screen and XSL
- group C `62fc7d7` feat: migrate definitions into additional addresses
4. **Task 4:**
- group A `653627b` feat: real lastmod from record events and debounced rebuilds
- group B `ded1095` feat: hreflang alternates and the sitemap filter contract
- group C `64453d2` docs: README for the per-type sitemap format
**Plan metadata:** this SUMMARY commit in summercms.go (docs), then ROADMAP alone.
## Files Created/Modified (sm-sitemap-plugin)
- `contract/contract.go`: every P33-08 type. No init and no `party.Register`.
- `classes/slots.go`: `AssignSlots` and `Slot`.
- `classes/rebuild.go`: `Rebuild`, `RebuildResult`, `RebuildArgs` and `RebuildKind`, `DefaultSlug`, `ExtraRecordID`, the Filter decisions, the alternates.
- `classes/writer.go`: `WriteIndex` and `WriteURLSet` on `bufio` with `xml.EscapeText`; `FileName`, `ParseFileName`, `ValidSlug`.
- `classes/settings.go`: `LoadSettings`, `SiteURL`, `Absolute`.
- `classes/types.go`: `EffectiveType`, `LoadTypeSettings`, `ReservedSlugs`.
- `classes/dispatch.go`: `RequestRebuild`, `DispatchRebuild`, `Building`.
- `classes/lastmod.go`: `RecordSaved`, `RecordDeleted`, `RealChanges`, `RequestDebouncedRebuild`, `ClearPending`, and the config readers.
- `classes/listing.go`: `Listing`.
- `models/url.go`, `models/type_setting.go`, `models/legacy.go`: the slot row, the type row, and a reader for Phase 17 and Winter definition data (used by the import and the migration).
- `models/settings.go`: the new columns only, plus `Validate` and `Problems`.
- `updates/2026102800{01,02,03}_*.go`: the slot table, the settings columns with the definitions copy, and the types table.
- `controllers/settings.go` with `settings/config_form.yaml` and `settings/_sitemap_files.htm`: the singleton and S1.
- `extensions_settings.go`: the Content types tab.
- `admin.go`: one tile; embeds by pattern.
- `jobs.go`, `listeners.go`, `schedule.go`, `console/rebuild.go`, `plugin.go`: the job, the listeners, the schedule, the command, and publishing the Listing.
- `console/import.go`, `console/import_winter.go`, `console/helpers.go`: these now write to the additional addresses.
- `routes.go`: the index and file routes.
- `config/config.yaml`: `site_url` (commented), `lastmod_ignore`, `rebuild_delay_seconds`.
- `lang/{en,pl}/lang.yaml`: every C26 key, including the images, News, IndexNow and HTML keys that 33-04 uses, plus `errors.lastmod`, `settings.extra_url_lastmod_comment` and `jobs.rebuild`. The Phase 17 item and definition keys are removed.
- `README.md` and `plugin.yaml` (regenerated by `summer plugin:manifest`), `go.mod` (`goccy/go-yaml` is now a direct dependency; it is already in the decided set).
- Tests:
- `sitemap_index_test.go`: 13 Docker tests.
- `content_fixture_test.go`, `filter_fixture_test.go`: the fake content plugin and the fake filter plugin.
- `import_test.go`, `routes_test.go`, `classes/slots_test.go`, `classes/lastmod_test.go`, `models/settings_test.go`, `console/import_winter_test.go`, `commands_documented_test.go`.
## Decisions Made
See `key-decisions` in the frontmatter.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] The framework repeater does not accept a datepicker**
- **Found during:** Task 3
- **Issue:** C26 asks for a datepicker for the row lastmod. cabana refuses `datepicker` inside a `repeater` when it compiles the schema, so the plugin would not boot.
- **Fix:** the lastmod is a text field with the comment "Optional, as YYYY-MM-DD". The server checks it (`models.ValidDate`) and refuses a bad value with the new `errors.lastmod`. This is logged in deferred-items.md and WINDOWS.md #30. The framework fix (datepicker in repeater rows) is separate, additive work.
- **Commit:** 3ba70bb
**2. [Rule 1 - Bug] `BeforeValidate` refusals became 500s**
- **Found during:** Task 3
- **Issue:** cabana's CRUD path turns any `lagoon.HasBeforeValidate` error into a `CapabilityError` (500). The Phase 17 hook only worked through the old settings-form route.
- **Fix:** validation is now `Settings.Validate`, called from the controller's `FormBeforeUpdate` and `FormBeforeCreate` (the SEO plugin's pattern). It returns 422 with field details.
- **Commit:** 3ba70bb
**3. [Rule 3 - Blocking] S1 cannot link to the public file URLs**
- **Issue:** the partial renderer keeps only root-relative `href`s (`safePartialURL`).
- **Fix:** each file links to the backend route that serves it. The note names the public index address. Logged in deferred-items.md as by design.
- **Commit:** 3ba70bb
**4. [Plan shape] Field labels cannot carry `:type`**
- **Issue:** cabana translates field labels without parameters, so "Include :type" cannot be rendered.
- **Fix:** each type's switch is labelled with the type's own signpost label. The copy moved to comments without the parameter (`type_include` "Include this content type in the sitemaps.", `type_slug` "File name", `type_title` "Heading in the HTML sitemap", and their pl equivalents).
- **Commit:** 3ba70bb
**5. [Plan shape] Content type titles stored as a JSONB locale map**
- **Issue:** the plan said "title via the translation writer", but the extension's `Save` already receives the mltext value as a locale map, and `golem15_sitemap_types` has no host-column model for translate.
- **Fix:** titles are stored as `titles jsonb` and fed directly into `GroupInfo.Titles` and `Group.Titles`.
- **Commit:** 3ba70bb
**6. [Rule 3 - Blocking] The Phase 17 tests needed rework**
- **Issue:** the route smoke tests (`TestSitemapTracer`, `TestSitemapCacheAndThrottle`, `TestSitemapImportSmoke`), the admin smoke test (`TestSitemapAdminSmoke`, which already failed before this plan because the framework now localizes 422 phrase keys), `TestBackendURL`, and the tier Boot assertion all pinned the removed format.
- **Fix:** they were replaced by the new tests, and `TestImportWinter` was rewritten for the new targets. No surviving behaviour lost its test.
- **Commits:** 3359f1a, 3ba70bb, 84cb27a
**7. [Plan shape] Extra settings columns**
- The plan did not list `numbered_size` (detects a file size change), `built_at` and `rebuild_requested_at` (the S1 building state).
- `extra_urls` is `JSONB NULL DEFAULT '[]'` instead of `NOT NULL`, because a `lagoon.Jsonable` that is not valid writes NULL.
- **Commit:** 3359f1a
**8. [Acceptance grep] Two greps print more than the plan expects**
- `grep "priority_tiers\|cache_seconds"` still matches `enable_priority_tiers`, in two places:
- the column in the released Phase 17 migration 202610110002, whose DDL must not change;
- the PHP export key that `sitemap:import-winter` recognizes so it can report it as ignored.
Both config keys themselves are gone.
- `grep "/_sitemap/files/{file}" routes.go` prints two lines: the route and its doc comment.
**9. [TDD note] RED evidence**
- Before implementing, I ran the tests for 3C and for 4A and 4B:
- `TestMigrateDefinitions` failed with `extra_urls = ""`.
- `TestLastmod` and `TestDebouncedRebuild` failed on their target assertions.
- `TestHreflangAlternates`, `TestFilterExcludes` and `TestListing` failed on theirs.
- `TestStableNumbering` and `TestNoFilter` passed at RED. They pin invariants that the tracer slot logic already had.
- The plan is `type: execute`, and each task is one commit per the plan's commit-group table, with no separate `test(...)` commit.
### Auth gates
None.
---
**Total deviations:** 9. One is a framework gap (deferred), one is a bug fix, one is a by-design link limitation, and the rest are plan shape, test rework, acceptance-grep notes and a TDD note.
**Impact on plan:** every must-have truth is met. The two visible differences from UI-SPEC C26 are the lastmod text field and the switch labels.
## Known Stubs
- `contract.ListingSettings.HTMLEnabled`, `HTMLPaths`, `HTMLPageSize` and `KeyFile` stay zero, and `golem15_sitemap_urls.images` stays `[]`, until 33-04 adds the HTML sitemap, IndexNow and image settings (P33-08; WINDOWS.md #29). The C26 copy for those tabs is already in the phrasebooks.
## Threat Flags
None outside the plan's threat model. T-33-09 to T-33-12 are mitigated:
- every value goes through `xml.EscapeText`, and the test covers `&`, `<` and quotes;
- only an http(s) site URL from the setting or config is used, never the Host;
- the routes are table-served, throttled and constrained by `Where`;
- only published records are listed, and drafts are tested to be absent;
- `site_url` is validated, and the settings are guarded by the existing permission.
## Issues Encountered
- `go test ./... -run X` prints "no tests to run" for the subpackages, while every named root test passes (same as in 33-02).
## Verification run
- `go vet ./...` and `go test -short ./...` in sm-sitemap-plugin: green after every commit.
- Docker `go test ./... -count=1` in sm-sitemap-plugin: green after every commit except the tracer. At the tracer the old `TestSitemapAdminSmoke` was red; it was already failing before this plan and was removed in 3A.
- The plan's named tests all pass: TestSitemapIndex, TestStableNumbering, TestLastmod, TestHreflangAlternates, TestFilterExcludes, TestNoFilter, TestDebouncedRebuild, TestMigrateDefinitions, TestSettingsSingleton, TestImportWinter. TestListing, TestImportFile and TestRebuildCommand pass too.
- Acceptance greps: `type Filter interface` and `type Listing interface`, `xml.EscapeText`, the files route, no init in `contract/`, no files under assets, `classes/testdata` or `tests/php`, `golem15.sitemap.settings`, `Lookup[contract.Filter]`, `Publish[contract.Listing]`, `sitemap:rebuild` in schedule.go and console/rebuild.go, `x-default`. All present; see deviation 8 for the two greps that print extra lines.
- From summercms.go:
- `bash scripts/check-phase33.sh --plugins --marker`: PASS (sitemap, seo and journal vet and short tests; vitest 77 and 244).
- `bash scripts/check-phase33.sh --docker`: PASS (sitemap 23, seo 56, journal 124 top-level Postgres tests).
## User Setup Required
None for this plan. When the apps move to the new format in 33-13:
- run `sitemap:rebuild` once after the deploy;
- make sure a conga worker and the scheduler run;
- map the root file names (vue-seo-layer v0.2.0 or the nginx rule in the README).
## Next Phase Readiness
- **33-04:** add images, News, IndexNow and the HTML sitemap on this table and settings. Fill the zero `ListingSettings` fields. Use `RebuildResult.Added/Changed/Removed` for IndexNow.
- **33-05:** the SEO plugin implements `contract.Filter` (noindex, canonical, redirect) and may use `Decision.Group` for page-registry kinds.
- **33-13:** move grzybyfunkcjonalne and demo to the new sitemap.
- **33-14:** bump `go.mod` to v0.6.1 and tag the next minor (breaking) version from `git tag`, after v0.1.2. Write the release notes from "Read first".
## Self-Check: PASSED
- FOUND: every file in key-files.created (checked with `[ -f ]`).
- FOUND commits in sm-sitemap-plugin: 3359f1a, 3ba70bb, 84cb27a, 62fc7d7, 653627b, ded1095, 64453d2. `git rev-list --count 049f3ee..HEAD` = 7.
- No uncommitted changes in sm-sitemap-plugin.
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,320 @@
---
phase: 33-seo-output-audit-and-content
plan: 04
subsystem: sitemap
tags: [sm-sitemap-plugin, image-sitemap, news-sitemap, indexnow, fetchguard, html-sitemap, management-api, mcp, settings-singleton]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-03 slot table, rebuild (RebuildResult Added/Changed/Removed), settings singleton, contract.Listing; 33-01 content facts (Kind, PublishedAt, Parents, Images)"
provides:
- "Image sitemap files sitemap-images-<n>.xml (image_file_no, stable numbering, at most 1000 images per page), images_enabled default on (D-31)"
- "Google News sitemap sitemap-news.xml: articles of the last 48 hours, newest first, at most 1000, news_sources type:/category: values, news_enabled default off (D-31)"
- "IndexNow: 32-hex key on save (crypto/rand), indexnow_new_key rotation, GET /_sitemap/indexnow/{file}, job golem15.sitemap.indexnow from rebuild diffs in production only, fetchguard client limited to api.indexnow.org, S2 status partial (D-31)"
- "HTML sitemap API GET /_sitemap/api/v1/html and /_sitemap/api/v1/html/{group} in the contract vue-seo-layer 33-08 consumes (D-34, D-24)"
- "Settings tabs Images and News, IndexNow, HTML sitemap; contract.Listing.Settings fills HTMLEnabled, HTMLPaths, HTMLPageSize, KeyFile"
- "Management API GET/PUT /_sitemap/api/v1/settings, POST /_sitemap/api/v1/rebuild and MCP tools sitemap_get_settings, sitemap_update_settings, sitemap_rebuild (D-10)"
affects: [33-05, 33-07, 33-08, 33-13, 33-14]
actuals:
tokens: 55000
tasks: 3
commits: 6
plan_head_before: 64453d2a914f00a8310f76f806a8858d5d4345da
plan_head_after: 291cf176db68ef498f8b8a57361d2418f7b0ebd0
tech-stack:
added: []
patterns:
- "A second numbering of the same slot rows (image_file_no) with AssignSlots and the same renumber flag as file_no"
- "Outbound vendor call as a conga job through a single-host fetchguard client; the test routes it with fetchguard.WithTransport"
- "Production-only side effect checked twice: before queueing and again in the job"
- "Values a fixed-option taglist cannot offer listed by a server-rendered partial next to it, and checked on save"
key-files:
created:
- ../sm-sitemap-plugin/updates/202610280004_add_golem15_sitemap_media_news_indexnow.go
- ../sm-sitemap-plugin/classes/images.go
- ../sm-sitemap-plugin/classes/news.go
- ../sm-sitemap-plugin/classes/indexnow.go
- ../sm-sitemap-plugin/classes/htmlgroups.go
- ../sm-sitemap-plugin/classes/files.go
- ../sm-sitemap-plugin/classes/typesettings.go
- ../sm-sitemap-plugin/controllers/api/indexnow.go
- ../sm-sitemap-plugin/controllers/api/html.go
- ../sm-sitemap-plugin/controllers/api/auth.go
- ../sm-sitemap-plugin/controllers/api/settings.go
- ../sm-sitemap-plugin/controllers/api/logger.go
- ../sm-sitemap-plugin/controllers/settings/_news_sources.htm
- ../sm-sitemap-plugin/controllers/settings/_indexnow_status.htm
- ../sm-sitemap-plugin/mcp.go
- ../sm-sitemap-plugin/sitemap_extras_test.go
modified:
- ../sm-sitemap-plugin/classes/rebuild.go
- ../sm-sitemap-plugin/classes/writer.go
- ../sm-sitemap-plugin/classes/listing.go
- ../sm-sitemap-plugin/classes/settings.go
- ../sm-sitemap-plugin/contract/contract.go
- ../sm-sitemap-plugin/models/url.go
- ../sm-sitemap-plugin/models/settings.go
- ../sm-sitemap-plugin/models/settings/fields.yaml
- ../sm-sitemap-plugin/models/settings_test.go
- ../sm-sitemap-plugin/controllers/settings.go
- ../sm-sitemap-plugin/extensions_settings.go
- ../sm-sitemap-plugin/jobs.go
- ../sm-sitemap-plugin/routes.go
- ../sm-sitemap-plugin/config/config.yaml
- ../sm-sitemap-plugin/lang/en/lang.yaml
- ../sm-sitemap-plugin/lang/pl/lang.yaml
- ../sm-sitemap-plugin/README.md
- ../sm-sitemap-plugin/plugin.yaml
- ../sm-sitemap-plugin/content_fixture_test.go
- ../sm-sitemap-plugin/sitemap_smoke_test.go
- ../sm-sitemap-plugin/commands_documented_test.go
- .planning/phases/33-seo-output-audit-and-content/COVERAGE.md
key-decisions:
- "HTML sitemap API contract follows what vue-seo-layer 33-08 already reads: overview {groups:[{key, slug, title, total, more, entries:[{title, url, children?}]}]}, group page {group, title, page, pages, entries}; groups are addressed by their file slug; locale and page and page_size and total are extra fields"
- "html_path is stored as a JSONB locale map (html_paths) through the plugin's own form extension, not the translation writer (same reason as 33-03's type titles: the settings row has no translatable host model); a save merges the locales sent"
- "news_sources is a taglist with custom tags and no options; the values (type:<key>, category:<key>:<id>) are listed by the news_sources partial and checked on save, because cabana taglist options are a fixed YAML list and form extensions take no taglist"
- "IndexNow 5xx answers and network errors retry like 429 (five attempts); 400, 403 and 422 are recorded without retry; S2's err_rate time is the queued retry's scheduled_at in river_job, shown only while one is pending"
- "Image sitemap files use the same file size and renumber flag as the per-type files"
- "S1 and the index share classes.SitemapFiles, so the files table now lists the image and News files too (the index count counts addresses only once)"
- "The content type settings write moved to classes.SaveTypeSettings, shared by the form extension and PUT /_sitemap/api/v1/settings (types.<key>.<field> refusals)"
patterns-established:
- "Plugin management API mirrors the SEO plugin's manage wrapper: cabana.ResolveBackend (token cover golem15.sitemap.*) plus cabana.Allows, 422 validation_failed with translated messages, X-Robots-Tag noindex"
- "A compile-only pier.Mount in the plugin's tests proves the MCP declarations bind to registered routes"
requirements-completed: [SC-1, D-31, D-34, D-24, D-10, D-30]
coverage:
- id: D1
description: "Image sitemap: featured then body images, deduplicated, unsafe dropped, absolute, at most 1000 per page, only image:image/image:loc, stable numbering with holes and renumber on file size change, images_enabled off removes the files from the index and answers 404"
requirement: "D-31"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestImageSitemap"
status: pass
human_judgment: false
- id: D2
description: "News sitemap: 1 h and 47 h old articles listed, 49 h not, never another kind, publication name (news_publication else app.name), language, date, escaped title, type and category sources, newest 1000 of 1007, off by default (no index entry, 404), malformed source refused, partial lists the values"
requirement: "D-31"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestNewsSitemap"
status: pass
human_judgment: false
- id: D3
description: "IndexNow in production: key on save (32 hex), key file text/plain, other names 404, one job with the new and the removed address, POST {host, key, urlList} to api.indexnow.org without keyLocation, 202 recorded, 403/422/400 recorded without retry, 429 retries, S2 states and callouts, other hosts never sent, new key makes the old file 404, off takes the file down"
requirement: "D-31"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestIndexNow"
status: pass
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestIndexNowStaging"
status: pass
human_judgment: false
- id: D4
description: "HTML sitemap API: L3 group order, titles in the locale, category tree, posts newest first, others alphabetical, 150 + more, page 2 of 2, 404 past the last / malformed page / unknown group / off, excluded and other-locale addresses absent, noindex; HTML tab refusals; Listing HTML and KeyFile fields"
requirement: "D-34"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestHTMLGroups"
status: pass
human_judgment: false
- id: D5
description: "Management API and MCP: 401/403, GET body, PUT refusals store nothing, PUT stores settings, HTML paths merge, types, IndexNow key and rotation, rebuild queued; MCP dispatch as the linked administrator; pier compiles sitemap_get_settings, sitemap_rebuild, sitemap_update_settings"
requirement: "D-10"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestSitemapTools"
status: pass
human_judgment: false
- id: D6
description: "The new settings tabs (Images and News, IndexNow with S2, HTML sitemap) in the real admin: field layout, triggers hiding the News fields and the new-key checkbox, the partial tables and callouts"
verification: []
human_judgment: true
rationale: "Rendering in the embedded admin SPA; the tests cover the schema, the saves and the partial node trees, not the visual layout"
- id: D7
description: "A HTML-sitemap group larger than html_page_size shows its first page plus the sitemap.all link and its group page is paginated (layer rendering in 33-08)"
requirement: "D-34"
verification:
- kind: integration
ref: "../sm-sitemap-plugin/sitemap_extras_test.go#TestHTMLGroups"
status: pass
human_judgment: false
duration: 30min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 04: Sitemap extras Summary
**sm-sitemap-plugin now adds image sitemap files and a Google News sitemap to the index, notifies IndexNow of each rebuild's changes in production through a single-host fetchguard client, serves the HTML sitemap's data in the JSON contract vue-seo-layer already reads, and exposes all sitemap settings through a management API that is also the MCP tools sitemap_get_settings, sitemap_update_settings and sitemap_rebuild.**
## Read first: versions, breaking changes, consumers
- **Versions.** Framework target v0.6.1 on base v0.6.0 (33-01 ruling). `sm-sitemap-plugin/go.mod` still requires `summercms v0.6.0` with `replace => ../summercms.go`; the bump is 33-14's. The plugin stays at v0.1.2 plus the 7 unpushed 33-03 commits plus these 6. Nothing was pushed or tagged; the breaking next-minor tag is 33-14's.
- **No new breaking change.** Everything here is additive to the 33-03 format: new columns with defaults (migration `202610280004`), new routes, new settings, a second job kind. The image sitemap is on by default, so after the next rebuild the index of a site with images gains `sitemap-images-<n>.xml` entries; News and IndexNow are off by default; the HTML sitemap API answers by default (the layer only renders it while the site answer has it on with a path).
- **For consumers (33-13, 33-14).** The application needs the conga worker for the IndexNow job as well. A site that turns IndexNow on must serve `/<key>.txt` at the root: vue-seo-layer does it from the SEO plugin's `root_files` (which should include `contract.ListingSettings.KeyFile`, 33-05's part), nginx with the README snippet. No core plugin (user, blog, pages, payment, journal) was touched, and the framework got no code (D-90; `--marker` passed).
## Performance
- **Duration:** about 30 min
- **Started:** 2026-11-04T11:14:58Z
- **Completed:** 2026-11-04T11:45Z
- **Tasks:** 3
- **Commits:** 6 in sm-sitemap-plugin (main, not pushed), 1 planning-docs commit in summercms.go (COVERAGE.md)
## Accomplishments
- **Image sitemap (D-31).** The rebuild stores each page's featured image and body images (absolute on the site, each once, at most 1000; `data:` and `javascript:` dropped) and numbers the listed rows with images into `sitemap-images-<n>.xml` with the per-type rules: stable numbers, holes, renumbering only with the file size. The files carry only `image:image` and `image:loc`.
- **News sitemap (D-31).** `sitemap-news.xml` lists articles (content kind `article`) first published in the last 48 hours, newest first, at most 1000, with the publication name, language, date and title. `news_sources` narrows it to `type:<key>` or `category:<key>:<id>` values.
- **IndexNow (D-31).**
- Saving with IndexNow on generates the key; "Generate a new key on save" replaces it and the old key file answers 404 at once.
- After each committed rebuild, in production only, the added, changed and removed addresses on the site host are queued as `golem15.sitemap.indexnow` jobs of at most 10 000.
- The job posts `{host, key, urlList}` to `https://api.indexnow.org/indexnow` through a fetchguard client limited to that host, records every answer, and retries 429, 5xx and network errors (five attempts).
- S2 shows the key or `no_key`, the last notification or `never`, and the 403, 422 and 429 callouts.
- **HTML sitemap API (D-34, D-24).** The overview lists the non-empty groups in the L3 order with titles in the locale, the category tree, posts newest first and the rest alphabetical, each with the first `html_page_size` links and `more`. A group page pages the rest. Only the XML sitemaps' listed addresses appear. Public, `noindex`, bucket `sitemap-html`.
- **Settings tabs.** Images and News, IndexNow (with S2) and HTML sitemap, with the C26 copy and the `errors.html_path` and `errors.page_size` refusals. `contract.Listing.Settings` now answers `HTMLEnabled`, `HTMLPaths`, `HTMLPageSize` and `KeyFile`.
- **Management API and MCP (D-10).** GET and PUT settings and POST rebuild behind the sitemap permission, and the three tools. pier compiles them against the plugin's routes in the test.
## Task Commits (sm-sitemap-plugin, branch main, not pushed)
1. **Task 1 (tracer):** `5bf56fd` feat: image sitemap files (tracer)
2. **Task 2:**
- group A `a10ce2d` feat: Google News sitemap
- group B `e02d0b1` feat: IndexNow key, key file and pings
- group C (summercms.go) `01a316a` docs(33-04): update the IndexNow coverage matrix
3. **Task 3:**
- group A `8f4ff2a` feat: HTML sitemap groups API
- group B `2a05516` feat: sitemap management API and MCP tools
- group C `291cf17` docs: images, News, IndexNow, HTML sitemap and MCP in README
**Plan metadata:** this SUMMARY commit in summercms.go (docs), then ROADMAP alone.
## Decisions Made
See `key-decisions` in the frontmatter.
## Deviations from Plan
### Auto-fixed and plan-shape deviations
**1. [Plan shape] HTML sitemap addresses stored as a JSONB locale map**
- **Issue:** P33-13 says `html_path` goes through the translation writer. The settings row has no translatable host model, and without a writer cabana refuses a translated value on the main form.
- **Fix:** column `html_paths jsonb` (default pl `/mapa-strony`, en `/sitemap`), edited as the mltext `html_path` added by the plugin's own form extension after `html_enabled`. A save merges the locales sent. Same approach as 33-03's type titles.
- **Commit:** 8f4ff2a
**2. [Rule 3 - Blocking] News sources taglist without options**
- **Issue:** C26 asks for `customTags: false` with options from the article types and their categories. cabana taglist options are a fixed YAML list, and form extensions accept no taglist field, so dynamic options are impossible.
- **Fix:** the taglist accepts custom tags. A `news_sources` partial under it lists the values the site has (article types and the categories their articles name, `classes.NewsSources`). Each value is checked on save (`models.ValidNewsSource`, new `errors.news_source`). The API answers the values as `news_source_options`. Logged in deferred-items.md and WINDOWS.md #31.
- **Commit:** a10ce2d
**3. [Rule 2 - Correctness] IndexNow 5xx and network errors retry**
- P33-14 names 429 only. A 5xx or a network failure says nothing about the request, so dropping the notification would lose the change. These are retried within the five attempts as well. COVERAGE.md gained that row and the precise key file route (group C).
- **Commit:** e02d0b1, 01a316a
**4. [Plan shape] S2's 429 time**
- `err_rate` needs ":time" of the next attempt. The queue owns the retry schedule, so S2 reads the pending job's `scheduled_at` from `river_job` and shows the callout only while a retry is queued. No extra column.
- **Commit:** e02d0b1
**5. [Plan shape] The key file route, not a root route**
- As planned (`/_sitemap/indexnow/{file}`); no `/<key>.txt` root route in Go, so a site served at `/` keeps its one-segment pages. vue-seo-layer maps the root name from the site answer's `root_files`.
**6. [Rule 2 - Correctness] S1 and the index share one file listing**
- With image and News files in the index, S1 would otherwise have hidden them. `classes.SitemapFiles` now feeds both, and the index row of S1 counts addresses once.
- **Commit:** 2a05516
**7. [Rule 3 - Blocking] Type settings write shared with the API**
- `PUT /_sitemap/api/v1/settings` must check content types like the form. The 33-03 save logic moved unchanged to `classes.SaveTypeSettings` (field-name refusals; the API renames them `types.<key>.<field>`).
- **Commit:** 2a05516
**8. [Rule 3 - Blocking] Test adjustments**
- `TestScheduleAndJobs` now expects two jobs.
- `TestSettingsValidate` builds settings with the default HTML page size, because 0 is now refused.
- `bootPlugins` takes an `__env` override, so `TestIndexNow` runs in production.
- The fake content record carries `PublishedAt` and `Parents`.
- A fake blog plugin (`acme.journal`, an article type and a collection type) is booted only by the new tests, so the 33-03 tests are unchanged.
**9. [Plan shape] Copy additions**
- New phrases outside C26:
- `errors.news_publication`, `errors.news_source`, `errors.type_unknown`;
- `news.sources`, `news.source_value`, `news.source_label`, `news.source_type`, `news.none`.
- Every C26 key is used as written.
**10. [TDD note] RED evidence**
- The plan is `type: execute`, and each task is one commit per its commit-group table.
- Each test was written against the behaviour list before its implementation compiled. The tests of a group were run once the group compiled, and passed on that first run.
- No separate RED commit was made.
### Auth gates
None.
---
**Total deviations:** 10. One is a framework gap (deferred: taglist options), one is storage shape, two are correctness additions, one is a status-source choice, and the rest are refactors, tests and copy.
**Impact on plan:** every must-have truth is met. The visible difference from UI-SPEC C26 is the News sources tag list, which accepts typed values with the value table under it instead of a fixed choice.
## Known Stubs
None. WINDOWS.md #29 (the zero ListingSettings fields and the empty images column from 33-03) is resolved here and marked fixed.
## Threat Flags
None outside the plan's threat model:
- **T-33-13:** fetchguard AllowHostsMode with `api.indexnow.org` only, HTTPS, no redirects, a 10 s timeout. `classes.SiteURLs` keeps only addresses on the site host, and the test sends a foreign host and a look-alike host.
- **T-33-15:** a production check before queueing and again in the job (`TestIndexNowStaging`).
- **T-33-16:** paging capped at `html_page_size` (at most 500), the tree read capped at 10 000 rows, bucket `sitemap-html`.
- **T-33-17:** `cabana.ResolveBackend` and the permission check on every management route; the 401 and 403 cases are in `TestSitemapTools`.
- **T-33-14** (key disclosure) is accepted as planned.
- **New public surface, in the plan:** `GET /_sitemap/indexnow/{file}` and the two HTML routes; they serve only data the sitemaps already publish.
## Issues Encountered
- `go test ./... -run X` prints "no tests to run" for the subpackages while the named root tests pass (as in 33-02 and 33-03).
- The 33-09 executor worked in sm-journal-plugin at the same time. `--plugins` still passed with its working tree as found.
## Verification run
- sm-sitemap-plugin, after every commit:
- `go vet ./...` and `go test -short ./...`: green.
- Docker `go test ./... -count=1`: green.
- The plan's named tests all pass: TestImageSitemap, TestSitemapIndex, TestNewsSitemap, TestIndexNow (plus TestIndexNowStaging), TestHTMLGroups, TestSitemapTools. The 33-03 suite passes too.
- Acceptance greps:
- one line each for `sitemap-image/1.1` (writer.go), `image_file_no` (migration), `crypto/rand` and `AllowHostsMode` (indexnow.go), and `sitemap-news/0.9` (news.go);
- `/_sitemap/api/v1/html` appears in routes.go and README.md;
- `"get_settings"`, `"update_settings"` and `"rebuild"` appear in mcp.go;
- `X-Robots-Tag` appears in html.go;
- COVERAGE.md has 3 OPT-OUT rows, each with a reason.
- From summercms.go:
- `bash scripts/check-phase33.sh --plugins --marker`: PASS (sitemap, seo and journal vet and short tests; vitest 77 and 244).
- `bash scripts/check-phase33.sh --docker`: PASS (29 sitemap, 56 seo and 124 journal top-level Postgres tests).
- `--layers` was not run: it is known to be broken and is logged in deferred-items.md.
## User Setup Required
None for this plan. When a site turns IndexNow on (after 33-13):
- it must run in the `production` environment with a conga worker;
- the key file must be reachable at `https://<site>/<key>.txt` (vue-seo-layer from the site answer, or the nginx rule in the README).
## Next Phase Readiness
- **33-05:** the SEO plugin's site answer can take `html_sitemap` (enabled, paths, page_size) and the key file for `root_files` from `contract.Listing.Settings`.
- **33-13:** consumers move to the new sitemap and may enable News or IndexNow per site.
- **33-14:** bump `go.mod` to v0.6.1 and tag the next minor of sm-sitemap-plugin, covering 33-03 and 33-04.
## Self-Check: PASSED
- FOUND: every file in key-files.created (checked with `[ -f ]`).
- FOUND commits in sm-sitemap-plugin: 5bf56fd, a10ce2d, e02d0b1, 8f4ff2a, 2a05516, 291cf17. `git rev-list --count 64453d2..HEAD` = 6.
- FOUND commit in summercms.go: 01a316a.
- No uncommitted changes in sm-sitemap-plugin.
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,447 @@
---
phase: 33-seo-output-audit-and-content
plan: 05
subsystem: seo
tags: [sm-seo-plugin, sitemap-filter, page-registry, route-report, site-answer, llms-txt, robots-txt, links, outbound, site-cache-purge, mcp]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-03/33-04 sm-sitemap-plugin contract (Filter, Listing with HTML settings and KeyFile); 33-01 descriptor Kind/Parents; 33-08 layer contracts for POST /registry/routes and GET /site"
provides:
- "classes.SitemapFilter published as contract.Filter: noindex, canonical-elsewhere and redirected addresses leave the sitemaps; production values, so staging lists the same set (D-95, D-24)"
- "Page registry golem15_seo_pages: SEO › Pages screen, content type seo-page (SEO tab, resolve ok, sitemaps by kind), C21 refusals (D-33)"
- "POST /_seo/api/v1/registry/routes route report: token, 2000-path cap, insert-only, missing state (D-33, P33-20)"
- "GET/POST /_seo/api/v1/pages, PUT/DELETE /pages/{id} and MCP tools seo_list_pages, seo_create_page, seo_update_page, seo_delete_page (D-10)"
- "GET /_seo/api/v1/site (P33-17) and GET /llms.txt (D-25)"
- "robots.txt Sitemap: line from the sitemap plugin's index unless robots_sitemaps is set (D-22)"
- "Links tab (links_new_tab, nofollow_domains, sponsored_domains) and outbound in the resolve answer (P33-16, D-83)"
- "noindex_published only for listed addresses; CMS issue sitemap_blocked; P1 status.excluded_* callouts (D-12, D-24)"
- "Site-cache purge after every SEO write, once per transaction (P33-19)"
- "sm-sitemap-plugin: contract.ListingSettings.TypesOff (additive)"
affects: [33-06, 33-07, 33-08, 33-10, 33-11, 33-12, 33-13, 33-14]
actuals:
tokens: 60200
tasks: 3
commits: 9
plan_head_before: 55f5e5dbb0c1fc50851dd51c9a8f258d265d6024
plan_head_after: df93c860011ee33158657a27f1a82ea1eeef6595
tech-stack:
added: []
patterns:
- "A plugin's own form extension stores a translatable field as a locale map in JSONB (registry url/title), so the record can be matched by any locale's address without the translation writer"
- "Content-type label that is not a phrase key is shown as written (no translator lookup)"
- "Site-cache purge deduplicated per transaction by the transaction's ConnPool (package-level map, reset when it grows past 1024 entries)"
- "Listener transactions that record history run in lagoon.Transaction, so their after-commit work runs"
key-files:
created:
- ../sm-seo-plugin/classes/sitemap_filter.go
- ../sm-seo-plugin/classes/registry.go
- ../sm-seo-plugin/classes/site.go
- ../sm-seo-plugin/classes/llms.go
- ../sm-seo-plugin/models/page.go
- ../sm-seo-plugin/models/page/columns.yaml
- ../sm-seo-plugin/models/page/fields.yaml
- ../sm-seo-plugin/updates/202610280002_create_golem15_seo_pages.go
- ../sm-seo-plugin/updates/202610280003_add_golem15_seo_links_and_llms.go
- ../sm-seo-plugin/menu_item_types.go
- ../sm-seo-plugin/extensions_pages.go
- ../sm-seo-plugin/controllers/pages.go
- ../sm-seo-plugin/controllers/pages/config_list.yaml
- ../sm-seo-plugin/controllers/pages/config_form.yaml
- ../sm-seo-plugin/controllers/pages/config_filter.yaml
- ../sm-seo-plugin/controllers/pages/_page_status.htm
- ../sm-seo-plugin/controllers/api/registry.go
- ../sm-seo-plugin/controllers/api/site.go
- ../sm-seo-plugin/controllers/api/llms.go
- ../sm-seo-plugin/sitemap_filter_test.go
- ../sm-seo-plugin/registry_test.go
modified:
- ../sm-seo-plugin/go.mod
- ../sm-seo-plugin/go.work
- ../sm-seo-plugin/plugin.go
- ../sm-seo-plugin/plugin.yaml
- ../sm-seo-plugin/routes.go
- ../sm-seo-plugin/admin_navigation.go
- ../sm-seo-plugin/extensions.go
- ../sm-seo-plugin/extensions_robots.go
- ../sm-seo-plugin/listeners.go
- ../sm-seo-plugin/mcp.go
- ../sm-seo-plugin/operations.go
- ../sm-seo-plugin/classes/resolver.go
- ../sm-seo-plugin/classes/history.go
- ../sm-seo-plugin/classes/batch.go
- ../sm-seo-plugin/classes/issues.go
- ../sm-seo-plugin/classes/robots.go
- ../sm-seo-plugin/classes/robots_write.go
- ../sm-seo-plugin/classes/settings_write.go
- ../sm-seo-plugin/classes/partials.go
- ../sm-seo-plugin/classes/generate.go
- ../sm-seo-plugin/classes/undo.go
- ../sm-seo-plugin/models/settings.go
- ../sm-seo-plugin/models/settings/fields.yaml
- ../sm-seo-plugin/models/robots.go
- ../sm-seo-plugin/models/revision.go
- ../sm-seo-plugin/extension/_seo_status.htm
- ../sm-seo-plugin/config/config.yaml
- ../sm-seo-plugin/lang/en/lang.yaml
- ../sm-seo-plugin/lang/pl/lang.yaml
- ../sm-seo-plugin/README.md
- ../sm-seo-plugin/fixture_test.go
- ../sm-seo-plugin/settings_test.go
- ../sm-seo-plugin/robots_test.go
- ../sm-seo-plugin/batch_test.go
- ../sm-seo-plugin/operations_test.go
- ../sm-sitemap-plugin/contract/contract.go
- ../sm-sitemap-plugin/classes/listing.go
- ../sm-sitemap-plugin/sitemap_index_test.go
- ../sm-sitemap-plugin/README.md
key-decisions:
- "The sitemap filter also excludes an address the site's address rules would 301 (normalisation) with reason redirect, not only redirect-rule sources"
- "Registry addresses and names per locale are stored in urls/titles JSONB by the plugin's own form extension (fields url and title), not through the translation writer, so Match can find a page by any locale's address in one query"
- "Registry content type label is golem15.seo::lang.pages.type (Site page / Strona witryny): the plain Page label collided with another content type's SEO settings tab"
- "Plan commit groups 2A and 2C are one commit: TestEveryAdminOperationHasTool maps every Pages operation to its tool, so the controller cannot land without the tools"
- "Migration 202610280003 (links and llms columns) landed with the Links commit, ahead of the llms.txt commit that uses its robots columns"
- "llms.txt and the route report: llms.txt answers 404 outside production (non-production lock), and the route report answers 200 with {inserted, updated, skipped, reported_at}"
- "robots.txt names contract.ListingSettings.IndexURL (the sitemap plugin's site address) when robots_sitemaps is unset; the config default became a comment; both consumer apps set robots_sitemaps explicitly and keep their lines"
- "Issue gained an optional severity field, set to error for sitemap_blocked only; the site-audit plans fill the others"
- "sm-sitemap-plugin got the additive contract.ListingSettings.TypesOff so P1 can say status.excluded_type without reading the sitemap's tables (D-95)"
patterns-established:
- "Registry/content-type ownership check: iterate signpost content types except the own one and call Match; Exact means owned"
- "A management write of a content-type record fires cabana.EmitRecordSaved/EmitRecordDeleted itself, so SEO address tracking and the sitemap follow as for an admin save"
requirements-completed: [SC-1, SC-3, D-95, D-24, D-33, D-12, D-22, D-25, D-83, D-94, D-10]
coverage:
- id: D1
description: "A noindex page leaves the XML sitemap with reason noindex, in production and on staging alike"
requirement: "D-95"
verification:
- kind: integration
ref: "../sm-seo-plugin/sitemap_filter_test.go#TestSitemapFilterTracer"
status: pass
human_judgment: false
- id: D2
description: "Canonical elsewhere, redirect and rule-noindex reasons; P1 excluded callouts (plain) for noindex, canonical, redirect and a type switched off"
requirement: "D-24"
verification:
- kind: integration
ref: "../sm-seo-plugin/sitemap_filter_test.go#TestFilterReasons"
status: pass
human_judgment: false
- id: D3
description: "Registry: create, resolve ok, seo-page record with SEO tab, sitemap-pages and sitemap-offers files, hreflang, C21 refusals (owned, taken, invalid, required, parent loop), 301 on address change (admin and API), filter groups and titles, delete removes entries and the sitemap row, management API with 401/403"
requirement: "D-33"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestRegistry"
status: pass
human_judgment: false
- id: D4
description: "Route report: 404 without a token, notfound_token fallback, 401, 422 over 2000 paths, insert-only with derived title, owned and invalid paths skipped, a repeated report changes only reported_at and writes no history, missing row state, P9 states, missing filter"
requirement: "D-33"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestRouteReport"
status: pass
human_judgment: false
- id: D5
description: "Site answer keys, root files (verification and IndexNow key), routes without the registry, noindex header"
requirement: "D-97"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestSiteEndpoint"
status: pass
human_judgment: false
- id: D6
description: "llms.txt off 404, on text/plain with site name, intro, groups and escaped links, excluded and other-locale addresses absent, staging 404"
requirement: "D-25"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestLLMSTxt"
status: pass
human_judgment: false
- id: D7
description: "robots.txt Sitemap line from the index, or the configured robots_sitemaps"
requirement: "D-22"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestRobotsSitemapLine"
status: pass
- kind: integration
ref: "../sm-seo-plugin/robots_test.go#TestRobotsServed"
status: pass
human_judgment: false
- id: D8
description: "Links tab: defaults, line-numbered domain refusal (admin and API), normalised storage, MCP-writable keys, outbound in resolve"
requirement: "D-83"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestSettingsLinks"
status: pass
human_judgment: false
- id: D9
description: "noindex_published only for listed addresses; sitemap_blocked issue with line and rule"
requirement: "D-12"
verification:
- kind: integration
ref: "../sm-seo-plugin/sitemap_filter_test.go#TestNoindexPublishedConflict"
status: pass
- kind: integration
ref: "../sm-seo-plugin/sitemap_filter_test.go#TestSitemapBlockedIssue"
status: pass
human_judgment: false
- id: D10
description: "One purge per committed SEO write (SEO tab, MCP redirect, settings, applied batch); none for a dry run or a refused batch"
requirement: "D-97"
verification:
- kind: integration
ref: "../sm-seo-plugin/registry_test.go#TestPurgeAfterWrite"
status: pass
human_judgment: false
- id: D11
description: "Every Pages operation maps to an MCP tool bound to a route"
requirement: "D-10"
verification:
- kind: unit
ref: "../sm-seo-plugin/operations_test.go#TestEveryAdminOperationHasTool"
status: pass
human_judgment: false
- id: D12
description: "Pages screen, Links tab and the llms.txt fields in the real admin SPA: layout, trigger hiding llms_intro, parent dropdown, missing badge"
verification: []
human_judgment: true
rationale: "Rendering in the embedded admin SPA; the tests cover schema, saves, row states and partial node trees, not the visual layout"
duration: 70min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 05: SEO plugin sitemap filter, page registry and site-level endpoints Summary
**sm-seo-plugin now decides what the sitemaps list (noindex, canonicalised and redirected addresses leave them), keeps a page registry of the site's own frontend pages as the content type seo-page with an insert-only route report, and gives the layer its site answer, llms.txt, the index Sitemap: line, Links rules in the resolve answer and a site-cache purge after every SEO write.**
## Read first: versions, breaking changes, consumers
- **Versions.** Framework v0.6.0 base, v0.6.1 target (33-01 ruling); the framework got no code here (D-90, `--marker` passed). `sm-seo-plugin` stays at tag v0.1.1 plus these 9 unpushed commits on main; `sm-sitemap-plugin` at v0.1.2 plus 14 unpushed commits (13 from 33-03/33-04, 1 here). Nothing was pushed or tagged.
- **go.mod.** `sm-seo-plugin/go.mod` requires `git.golem15.com/golem15/sm-sitemap-plugin v0.1.2`, and `go.work` replaces it with `../sm-sitemap-plugin`. The v0.1.2 tag has no `contract` package, so a build with `GOWORK=off` fails until 33-14 bumps the require to the new sitemap tag. Consumers resolve the sitemap through their own submodule `use`/`replace` (both apps already do).
- **Changes a consumer will notice when it moves to the next sm-seo-plugin (33-13/33-14):**
- **`Requires()` now names `golem15.sitemap`.** A site with the SEO plugin must activate the sitemap plugin. Both known consumers (sm-demo-app, sm-grzybyfunkcjonalne-app) already list both plugins. Because no existing consumer breaks, I did not stop for a checkpoint.
- The SEO settings get a **Site page** tab (the registry's per-type settings) and a **Links** tab; robots.txt gets the llms.txt fields; SEO › Pages appears in the side menu.
- **robots.txt.** It names the sitemap plugin's index URL when `golem15.seo.robots_sitemaps` is unset. Both consumer apps set that key in `config/golem15.seo.yaml`, so their lines stay as they are.
- **noindex_published.** This batch conflict now fires only for addresses a sitemap file lists right now.
- The resolve answer gains the `outbound` key; no existing key changed.
- **New tables and columns.** Migrations `202610280002` and `202610280003` add the `golem15_seo_pages` table and new columns on settings and robots, all with defaults.
- **Core plugins.** Untouched: user, blog, pages, payment and journal. The vue-* layers were not changed either.
## Performance
- **Duration:** about 70 min (11:40Z to 12:51Z)
- **Tasks:** 3 (tracer, then 2 TDD tasks)
- **Commits:** 9 in sm-seo-plugin, 1 in sm-sitemap-plugin (main, not pushed); planning docs in summercms.go
## Accomplishments
- **Sitemap filter (D-95, D-24).** `classes.SitemapFilter` is published in `Register`. It decides on production values, through a `Resolver` flag that skips the non-production lock. For each address it checks, in order:
- normalisation or a redirect rule → `redirect`;
- effective robots noindex → `noindex`;
- canonical URL not the page itself → `canonical`.
Registry pages go into the `pages`, `offers`, `services` and `landing-pages` groups. `Groups` titles each group per locale.
- **Page registry (D-33, C21).**
- **Model and migration:** the `golem15_seo_pages` model and its migration.
- **SEO › Pages screen:**
- the list has kind, origin and missing filters and the missing row state;
- the form has the P9 partial, and the url/title mltext extension saves each locale and refuses `url_required`, `url_invalid`, `url_taken` and `url_owned` (with type and title), plus `parent_loop`.
- **Content type `seo-page`:** Records, Describe, Match by any locale, Resolve and References. Each page gets the SEO tab, resolves ok, takes part in address tracking with a 301 on change, and is listed in the sitemaps.
- **Route report (P33-20).** `POST /registry/routes` uses a constant-time token and accepts at most 2000 paths. It only inserts or touches `reported_at`, skips owned and invalid paths, and stamps `routes_reported_at`.
- **Management API and MCP (D-10).** Pages CRUD, the four tools and the `AdminOperations` rows.
- **Site answer (P33-17).** Every key the layer's fixture expects except `pagination` and `home_crumb`, which 33-06 adds.
- **llms.txt (D-25).** Built from the sitemaps' listed addresses in the default locale, grouped in the content types' order, with Markdown escaping.
- **robots.txt (D-22).** One `Sitemap:` line naming the index.
- **Links (D-83).** The Links tab, domain validation with line numbers, normalised storage, `outbound` in the resolve answer, and MCP keys.
- **Conflicts and issues (D-12, D-24).** `noindex_published` only for listed addresses. New issue `sitemap_blocked`: severity error, `seo_update_robots`, the line and the rule. P1 shows the "Not in the sitemaps" callouts.
- **Purge (P33-19).** `Service.Record` queues `cooler.PurgeSiteCacheAfterCommit` (kind `seo`) once per transaction.
## Task Commits
sm-seo-plugin (branch main, not pushed):
1. **Task 1 (tracer):** `17b810d` feat: sitemap filter excludes noindex, canonicalised and redirected URLs (tracer)
2. **Task 2:**
- `9e802ec` feat: page registry with its admin screen and signpost type (groups A and C together)
- `26193ae` feat: route report endpoint (group B)
3. **Task 3:**
- `49d3879` feat: links settings and outbound rules in resolve (group B)
- `742a5b9` feat: site endpoint, llms.txt and the sitemap index in robots.txt (group A)
- `59f0457` feat: sitemap-aware batch conflict and the sitemap_blocked issue (group C)
- `2dfc606` feat: purge the site cache after SEO writes (group D)
- `397c126` fix: name a content type's plain label in url_owned without translating it
- `df93c86` docs: registry, site endpoint, llms.txt and links in README (group E)
sm-sitemap-plugin (branch main, not pushed):
- `9e5c393` feat: the listing names the content types switched off
The tracer gate ran in interactive end-of-phase mode: `TestSitemapFilterTracer` was re-run and passed before the expansion tasks.
## Decisions Made
See `key-decisions` in the frontmatter.
## Deviations from Plan
### Adapted to the actual repositories
**1. [Plan shape] Registry translations in JSONB, not the translation writer.**
- **Plan:** P33-18 puts other locales "through the translation writer".
- **Why it cannot work:** a signpost `Match` must find a page by its pl address. The writer offers no reverse lookup, and the test fixture's fake writer is not keyed per record.
- **What I did:**
- `urls` and `titles` are JSONB locale maps (GIN index on `urls`), edited as the mltext fields `url` and `title` of the plugin's own form extension. This is the same approach as 33-03 and 33-04.
- That extension runs before the SEO tab's, so address tracking sees the saved address.
- The url index is unique where `url <> ''`, because the owner row is inserted before the extension writes the address.
- **Commit:** 9e802ec
**2. [Rule 3 - Blocking] Registry type label.**
- **Problem:** the registry type's label `pages.name` ("Page") collided with another content type's "Page" tab in the SEO settings, and cabana refuses two tabs whose labels read the same.
- **Fix:** new copy key `pages.type` (Site page / Strona witryny).
- **Commit:** 9e802ec
**3. [Rule 3 - Blocking] Field types cabana requires.**
- `content_updated_at` is a `*lagoon.Date`: cabana's datepicker in date mode needs that type.
- `parent_id` is `*models.PageRef`, which has `UnmarshalText`, because the dropdown posts text.
- **Commit:** 9e802ec
**4. [Rule 1 - Bug] Row state read from the table.**
- **Bug:** `ListExtendRecords` replaces the origin with its label before `ListRowStates` runs, so the missing state could never match.
- **Fix:** `ListRowStates` reads the state with `models.MissingSQL`.
- **Commit:** 9e802ec
**5. [Plan shape] Commit groups changed.**
- Task 2's groups A and C are one commit, because the parity test needs the Pages tools and the Pages controller together.
- Task 3 order is B (Links, with migration 202610280003, which also holds the llms columns), A, C, D, E.
- Task 2's route report (B) was split from A by staging stripped copies of the files. Both commits passed vet and the Docker suite.
**6. [Rule 2 - Correctness] Additive sitemap contract field.**
- **Why:** P1's `status.excluded_type` needs to know which content types are switched off, and `contract.Listing` had no way to say so. D-95 forbids reading the sitemap's tables.
- **What I did:** added `ListingSettings.TypesOff` in sm-sitemap-plugin, with a test assertion and a README line. The change is additive and outside the plan's file list.
- **Commit:** 9e5c393 in sm-sitemap-plugin
**7. [Rule 2 - Correctness] What the filter treats as a redirect.**
- **Rule:** an address the site's address rules would 301 (normalisation) is excluded as `redirect`, as well as redirect-rule sources.
- **Why:** a listed URL that 301s is a sitemap error.
**8. [Rule 2 - Correctness] Changes to existing code paths.**
- **llms.txt** answers 404 outside production (the non-production lock).
- **Undo** handles the new robots fields `llms_enabled` and `llms_intro`.
- **Transactions:** `RecordDeleted` and `addressesAfterSave` now run in `lagoon.Transaction`. Their history records would otherwise hit "after-commit callback skipped inside unmanaged transaction" and never purge.
- **robots.txt checks:** the file is composed once per batch of address checks, not once per address.
- **Commits:** 742a5b9, 2dfc606, 59f0457
**9. [Plan shape] Copy additions.**
- `pages.type` and `pages.home_title` (the name of a reported `/`: Home / Strona główna).
- `pages.filter_missing_only` and `pages.filter_missing_hide`, read from the C21 shorthand.
- `history.what_page`, `history.kind_page`.
- `Issue.severity` (JSON `severity`) is set only for `sitemap_blocked`.
**10. [Rule 3 - Blocking] Existing tests adjusted to the planned behaviour.**
- `TestSettingsTypeTabs`: the Site page and Links tabs.
- `TestRobotsServed` and `TestRobotsScreen`: the Sitemap line now names the sitemap's index, which is on app.url in the fixture, and the llms fields are on the screen.
- `TestBatch`: rebuilds the sitemap first, so its address is listed.
- `TestPluginManifest`: plugin.yaml regenerated with `requires: golem15.sitemap`.
- The fixture boots `golem15.sitemap` whenever `golem15.seo` is booted.
**11. [Rule 1 - Bug] Plain content type labels.**
- **Bug:** `url_owned` passed a plain content type label to the translator, which logged it as a missing key.
- **Fix:** labels without `::` are used as written.
- **Commit:** 397c126
### TDD note
The plan is `type: execute`. Each task's tests were written before or alongside its code. They were run once the group compiled, and the failures fixed before the group's commit:
- the "/pl/pages/first" substring;
- the file group name;
- the NOT NULL urls column;
- the datepicker type;
- the dropdown fill;
- the row-state ordering.
No separate RED commit was made: the plan requires green tests at every commit, as in 33-04.
### Auth gates
None.
**Total deviations:** 11. Two are storage or contract shapes, four are blocking fixes, three are correctness additions, one is commit grouping and one is copy additions.
**Impact on plan:** every must-have truth is met. The visible additions to UI-SPEC are the Site page settings tab label and the plain-callout variant of P1.
## Issues Encountered
- **Shared file group.** A content type whose sitemap file group is also `pages` (the fixture's `acme-page`) shares the file and the HTML-sitemap group with the registry's `page` kind. The README states it.
- **Route report size.** The framework's default body limit (`http.body_limits.default_bytes`) can refuse a report larger than 1 MB before the 2000-path cap applies. The layer's reports of static routes are far smaller.
- **Registry history.** Undo of a registry page's history row answers `history.undo_unsupported`; registry undo was not planned.
- `go test ./... -run X` prints "no tests to run" for subpackages while the named root tests pass (as in 33-02 to 33-04).
## Known Stubs
None.
## Threat Flags
None outside the plan's threat model:
- **T-33-18** (route report): constant-time token compare, a 2000-path cap, paths of at most 2048 bytes, insert-only, owned paths skipped; covered by `TestRouteReport`.
- **T-33-19** (`/site`): only public facts. The test asserts that no token and no registry type appear.
- **T-33-20** (llms.txt): built from the listed addresses only, off by default, 404 outside production.
- **T-33-21** (Pages admin and MCP): `golem15.seo.manage` on every route and screen. Covered by the parity test and the 401/403 cases.
- **T-33-22** (domain lists): host names only, no scheme or path, validated line by line.
- **T-33-23** (purge): one purge per transaction after commit, coalesced by the framework purger.
## Verification run
- **sm-seo-plugin, after every commit:**
- `go vet ./...` and `go test -short ./...`: green;
- Docker `go test ./... -count=1`: green, 67 top-level tests.
- **Named tests:** all pass.
- TestSitemapFilterTracer, TestFilterReasons, TestNoindexPublishedConflict, TestSitemapBlockedIssue.
- TestRegistry, TestRouteReport, TestSiteEndpoint, TestLLMSTxt, TestRobotsSitemapLine, TestSettingsLinks, TestPurgeAfterWrite.
- TestEveryAdminOperationHasTool, TestMCPReadToolsAreGET.
- TestResolverPrecedence and the Phase 32 suites.
- **sm-sitemap-plugin:** vet, short and the Docker suite green (sitemap without SEO).
- **From summercms.go:**
- `bash scripts/check-phase33.sh --plugins --marker`: PASS (vet and short tests of sitemap, seo and journal; vitest 77 and 244; marker clean).
- `bash scripts/check-phase33.sh --docker`: PASS (29 sitemap, 67 seo, 124 journal top-level tests).
- `--layers` was not run: it is known to be broken and is logged in deferred-items.md. No layer was changed.
- `--go` and `--consumers` were not run: no framework code and no consumer pointer changed in this plan.
- **Acceptance greps:**
- one line or more each for `golem15.sitemap` (plugin.go), `sm-sitemap-plugin/contract` (sitemap_filter.go and plugin.go), `sm-sitemap-plugin =>` (go.work), `"seo-page"` (registry.go), `/registry/routes` (routes.go), `subtle.ConstantTimeCompare` (api/registry.go), and `sitemap_blocked` (issues.go);
- four lines for the four page tools in mcp.go;
- `"/llms.txt"` and `"/site"` in routes.go;
- `links_new_tab` in settings_write.go, fields.yaml and resolver.go (via `OutboundOf`/`LinksNewTab`).
## User Setup Required
None for this plan. For sites (33-13):
- **Route report:** set `golem15.seo.route_report_token`, or rely on `notfound_token`, and give the layer the same token.
- **Purge:** configure `site_cache.purge_url` and `site_cache.purge_token`.
- **Sitemap site address:** set the sitemap's site address (setting or `golem15.sitemap.site_url`) to the public origin, because robots.txt now names its index.
## Next Phase Readiness
- **33-06:** adds `pagination` and `home_crumb` to `classes.SiteAnswer`, and further resolve keys next to `outbound`.
- **33-08's layer** can drop its fixtures for `/registry/routes` and `/site`: the plugin now answers in the shapes the layer reads.
- **33-14:** bump the `sm-sitemap-plugin` require to its new tag and tag the next minor of both plugins.
## Self-Check: PASSED
- FOUND: every file in key-files.created (checked with `[ -f ]`).
- FOUND commits in sm-seo-plugin: 17b810d, 9e802ec, 26193ae, 49d3879, 742a5b9, 59f0457, 2dfc606, 397c126, df93c86. `git rev-list --count 55f5e5d..HEAD` = 9.
- FOUND commit in sm-sitemap-plugin: 9e5c393.
- No uncommitted changes in sm-seo-plugin or sm-sitemap-plugin.
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,473 @@
---
phase: 33-seo-output-audit-and-content
plan: 06
subsystem: seo
tags: [sm-seo-plugin, json-ld, schema-org, breadcrumbs, hreflang, pagination, publisher, local-business, custom-elements, mcp, package-legitimacy]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-01 descriptor facts (Kind, Parents, Authors, PublishedAt, Images, Videos); 33-05 resolve answer with outbound, the /site answer, the page registry kinds"
provides:
- "One JSON-LD @graph per ok resolve answer (classes/schema Build), nodes linked by the P33-22 @ids"
- "Resolve keys html_lang, alternates, jsonld, breadcrumbs, pagination, seo.og.locale, seo.og.locale_alternates (additive)"
- "Publisher, Local business, Pagination tabs and the home crumb setting; P8 publisher preview"
- "Pagination forms (query or path) with one-hop 301s, invalid pages, suffixes with %pages% left for the layer"
- "GET /site pagination {form, param, segments} and home_crumb {name, url, names}"
- "SEO tab: Primary category (seoparent), Structured data (seoschema, E8), preview (E9, widget action seo_graph); P1 primary_gone, P2 schema type and trail rows"
- "GET /_seo/api/v1/graph and MCP seo_get_graph; primary_parent and schema on seo_set_url_seo and apply_batch"
- "Task 4 checkpoint answers: chromedp v0.21.0 and gen2brain/webp v0.6.4 approved"
affects: [33-07, 33-08, 33-09, 33-10, 33-11, 33-12, 33-13, 33-14]
actuals:
tokens: 110000
tasks: 4
commits: 6
plan_head_before: df93c860011ee33158657a27f1a82ea1eeef6595
plan_head_after: d38049a
tech-stack:
added: []
patterns:
- "classes/schema is pure (no plugin imports): the resolver, the admin preview, the publisher preview and the MCP tool share Build and Validate"
- "Per-record structured data values live in the entry's data (primary_parent, schema) on every locale row, like the social image"
- "Pagination is folded into Resolve before the strict check, so normalisation, strict URLs and the page form reach the final address in one 301"
key-files:
created:
- ../sm-seo-plugin/classes/schema/graph.go
- ../sm-seo-plugin/classes/schema/nodes.go
- ../sm-seo-plugin/classes/schema/validate.go
- ../sm-seo-plugin/classes/schema/custom.go
- ../sm-seo-plugin/classes/breadcrumbs.go
- ../sm-seo-plugin/classes/alternates.go
- ../sm-seo-plugin/classes/pagination.go
- ../sm-seo-plugin/classes/structured.go
- ../sm-seo-plugin/updates/202610280004_add_golem15_seo_publisher_pagination.go
- ../sm-seo-plugin/controllers/settings/_publisher_preview.htm
- ../sm-seo-plugin/controllers/api/graph.go
- ../sm-seo-plugin/assets/src/elements/schema.ts
- ../sm-seo-plugin/assets/src/elements/graph.ts
- ../sm-seo-plugin/assets/src/elements/parent.ts
- ../sm-seo-plugin/tests/elements/schema.test.ts
- ../sm-seo-plugin/structured_data_test.go
modified:
- ../sm-seo-plugin/classes/resolver.go
- ../sm-seo-plugin/classes/site.go
- ../sm-seo-plugin/classes/settings_write.go
- ../sm-seo-plugin/classes/sitemap_filter.go
- ../sm-seo-plugin/classes/entries.go
- ../sm-seo-plugin/classes/history.go
- ../sm-seo-plugin/classes/owner.go
- ../sm-seo-plugin/classes/partials.go
- ../sm-seo-plugin/classes/field_types.go
- ../sm-seo-plugin/models/settings.go
- ../sm-seo-plugin/models/settings/fields.yaml
- ../sm-seo-plugin/controllers/settings.go
- ../sm-seo-plugin/controllers/api/settings.go
- ../sm-seo-plugin/controllers/api/seo.go
- ../sm-seo-plugin/extensions.go
- ../sm-seo-plugin/routes.go
- ../sm-seo-plugin/mcp.go
- ../sm-seo-plugin/operations.go
- ../sm-seo-plugin/config/config.yaml
- ../sm-seo-plugin/assets/src/elements/index.ts
- ../sm-seo-plugin/assets/src/elements/labels.ts
- ../sm-seo-plugin/assets/src/elements/styles.css
- ../sm-seo-plugin/assets/dist/seo.js
- ../sm-seo-plugin/assets/dist/seo.css
- ../sm-seo-plugin/lang/en/lang.yaml
- ../sm-seo-plugin/lang/pl/lang.yaml
- ../sm-seo-plugin/README.md
- ../sm-seo-plugin/settings_test.go
- ../sm-seo-plugin/seo_tab_test.go
key-decisions:
- "Task 4 (Jakub 2026-11-04): github.com/chromedp/chromedp approved, pin v0.21.0 (v0.21.1 and v0.22.0 exist but are under two weeks old)"
- "Task 4 (Jakub 2026-11-04): github.com/gen2brain/webp approved, pin v0.6.4 (its fallback is libwebp transpiled to Go with wasm2go, not wazero)"
- "Every graph carries the full WebSite and publisher nodes, not only the home page, so each page's graph is self-contained (the tracer expects both on a post)"
- "home_crumb in the site answer is {name, url, names}: name and url are what the committed 33-08 layer reads; names adds the per-locale names the plan asked for"
- "The graph is skipped in the sitemap filter's production resolver (it decides on robots and canonical only)"
- "Primary category is offered for article kinds only; the value is <type>:<id> of one of the descriptor's Parents"
- "Page 2 and later always uses its own canonical (D-21), and its hreflang alternates point at the same page of each translation"
patterns-established:
- "A structured data refusal is a schema.Error code mapped to the schema.* copy, shared by the field type Decode, seo_set_url_seo and the graph tool"
requirements-completed: [SC-2, SC-3, D-43, D-44, D-45, D-46, D-03, D-86, D-55, D-56, D-57, D-40, D-41, D-42, D-21, D-94, D-10, D-70, D-85]
coverage:
- id: D1
description: "One @graph with WebPage, BlogPosting (headline, author, dates, image, wordCount, articleSection), BreadcrumbList, VideoObject, WebSite and Organization linked by @id; breadcrumbs equal the BreadcrumbList items; alternates en, pl, x-default; none for a single-locale record"
requirement: "D-43"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestGraphTracer"
status: pass
human_judgment: false
- id: D2
description: "Breadcrumbs through the primary parent (stored, else first; recursive; unpublished parents skipped), per-locale home crumb, home page trail"
requirement: "D-86"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestGraphTracer/TestBreadcrumbs"
status: pass
human_judgment: false
- id: D3
description: "html_lang, og:locale and alternates from one source; paged alternates"
requirement: "D-55"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestGraphTracer/TestAlternates"
status: pass
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestPagedAlternates"
status: pass
human_judgment: false
- id: D4
description: "Publisher and Local business settings with every C20 refusal (422) in the admin and the API; the local business node; a person publisher; P8 with the logo finding; home crumb name"
requirement: "D-45"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestPublisherSettings"
status: pass
human_judgment: false
- id: D5
description: "Pagination query and path forms, one-hop 301s with normalisation, invalid pages, page 2+ canonical, robots and suffixes, /site pagination and home_crumb, segment and suffix refusals"
requirement: "D-40"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestPagination"
status: pass
human_judgment: false
- id: D6
description: "Custom JSON-LD refusals (invalid JSON with line/column, not an object, 16 KB, depth 8, script tag, type, price, currency), merge with the schema.merged notice, appended nodes, re-serialised storage on every locale row"
requirement: "D-44"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestCustomJSONLD"
status: pass
human_judgment: false
- id: D7
description: "Collection, profile, registry offer (Service with offer), contact page, home SearchAction; no e-commerce node"
requirement: "D-43"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestGraphPerKind"
status: pass
human_judgment: false
- id: D8
description: "GET /graph with findings and rules, unsaved schema preview, 401/403, primary_parent via seo_set_url_seo and apply_batch (dry run), P1 primary_gone, P2 rows"
requirement: "D-46"
verification:
- kind: integration
ref: "../sm-seo-plugin/structured_data_test.go#TestGraphTool"
status: pass
- kind: unit
ref: "../sm-seo-plugin/operations_test.go#TestEveryAdminOperationHasTool"
status: pass
human_judgment: false
- id: D9
description: "E8, E9 and the parent element: type options, Service grid and price backstop, JSON status with line and column, 16 KB, nodes and findings, allGood, 800 ms re-check, locale switch, failure line"
requirement: "D-44"
verification:
- kind: unit
ref: "../sm-seo-plugin/tests/elements/schema.test.ts"
status: pass
human_judgment: false
- id: D10
description: "The new settings tabs, E8, E9 and the primary category select in the real admin SPA: layout, spacing, the local business switch hiding its fields"
verification: []
human_judgment: true
rationale: "Rendering in the embedded admin SPA; the tests cover schemas, saves and element DOM in happy-dom, not the visual layout"
duration: 105min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 06: Structured data, breadcrumbs, hreflang and pagination Summary
**sm-seo-plugin now answers every page with one JSON-LD @graph (page, article, profile, service, breadcrumbs, videos, WebSite, publisher), its breadcrumb trail through the primary category, hreflang with x-default, and paginated addresses in the site's form, with publisher and local business settings, the Structured data fields and graph preview in the SEO tab, and seo_get_graph through MCP.**
## Task 4 answers: Go module legitimacy (Jakub, 2026-11-04)
33-10 and 33-11 pin exactly these versions, each after its decision note:
| Module | Answer | Pin | Checked by the orchestrator |
|--------|--------|-----|-----------------------------|
| `github.com/chromedp/chromedp` | **approved** | **v0.21.0** | Owned by the chromedp organisation, MIT. Dependencies: `github.com/chromedp/cdproto` and `github.com/go-json-experiment/json`. v0.21.1 (2026-11-01) and v0.22.0 (2026-11-03) exist, but both are less than two weeks old, so v0.21.0 is pinned. |
| `github.com/gen2brain/webp` | **approved** | **v0.6.4** | MIT. The only dependency is `github.com/ebitengine/purego`. Correction to the plan: the fallback without a system libwebp is libwebp transpiled to Go with wasm2go, not a WASM build run through wazero. |
Nothing was installed in this plan; no go.mod changed.
## Read first: versions, breaking changes, consumers
- **Versions.** The framework base is v0.6.0 and the target v0.6.1; this plan changed no framework code (`--marker` passed). `sm-seo-plugin` stays at tag v0.1.1 and now has 15 unpushed commits on main: 9 from 33-05 and 6 from this plan. The require on summercms and the go.work/replace setup are as 33-05 left them. Nothing was pushed or tagged.
- **Resolve answer.** Only additive keys:
- top level: `html_lang`, `alternates`, `jsonld`, `breadcrumbs`, `pagination`;
- inside `seo.og`: `locale`, `locale_alternates`.
No existing key changed. The new top-level keys are left out of the JSON when they are empty, and the layer reads a missing key as empty.
- **What a consumer will notice when moving to the next sm-seo-plugin:**
- **Migration 202610280004** adds settings columns, all with defaults.
- **New settings tabs:** Pagination, Publisher and Local business, plus a home crumb field on the General tab.
- **New SEO tab fields:** Structured data and its preview on every content type, and Primary category on article types.
- **`?page=1` now redirects.** A request for `?page=1`, or for `/strona/N` while the site uses the query form, now answers 301 where it used to answer ok. Page 2 and later now get suffixes on the title and description. This is what D-41 asks for, but sites will see it.
- **Core plugins.** Untouched: user, blog, pages, payment and journal. The vue-* layers were not changed.
## Tracer resolve answer (TestGraphTracer, `/blog/first-post`)
For comparison with the layer fixtures of 33-07 to 33-09:
```json
{
"action": "ok",
"alternates": [
{"hreflang": "en", "url": "https://www.example.test/blog/first-post"},
{"hreflang": "pl", "url": "https://www.example.test/pl/blog/pierwszy-wpis"},
{"hreflang": "x-default", "url": "https://www.example.test/blog/first-post"}
],
"breadcrumbs": [
{"name": "Home", "path": "/", "url": "https://www.example.test/"},
{"name": "Recipes", "path": "/blog/category/recipes", "url": "https://www.example.test/blog/category/recipes"},
{"name": "First post", "path": "/blog/first-post", "url": "https://www.example.test/blog/first-post"}
],
"html_lang": "en",
"jsonld": {
"@context": "https://schema.org",
"@graph": [
{"@id": "https://www.example.test/blog/first-post#webpage", "@type": "WebPage",
"breadcrumb": {"@id": "https://www.example.test/blog/first-post#breadcrumb"},
"dateModified": "2026-10-05T12:30:00Z", "datePublished": "2026-10-01T08:00:00Z",
"description": "About the first post", "inLanguage": "en",
"isPartOf": {"@id": "https://www.example.test/#website"}, "name": "First post",
"primaryImageOfPage": {"@type": "ImageObject", "url": "https://www.example.test/media/first.jpg"},
"url": "https://www.example.test/blog/first-post"},
{"@id": "https://www.example.test/blog/first-post#article", "@type": "BlogPosting",
"articleSection": "Recipes",
"author": [{"@id": "https://www.example.test/blog/author/jan#profile", "@type": "Person", "name": "Jan Kowalski", "url": "https://www.example.test/blog/author/jan"}],
"dateModified": "2026-10-05T12:30:00Z", "datePublished": "2026-10-01T08:00:00Z",
"description": "About the first post", "headline": "First post",
"image": ["https://www.example.test/media/first.jpg"], "inLanguage": "en",
"isPartOf": {"@id": "https://www.example.test/blog/first-post#webpage"},
"mainEntityOfPage": {"@id": "https://www.example.test/blog/first-post#webpage"},
"publisher": {"@id": "https://www.example.test/#organization"}, "wordCount": 420},
{"@id": "https://www.example.test/blog/first-post#breadcrumb", "@type": "BreadcrumbList",
"itemListElement": [
{"@type": "ListItem", "item": "https://www.example.test/", "name": "Home", "position": 1},
{"@type": "ListItem", "item": "https://www.example.test/blog/category/recipes", "name": "Recipes", "position": 2},
{"@type": "ListItem", "item": "https://www.example.test/blog/first-post", "name": "First post", "position": 3}]},
{"@id": "https://www.example.test/blog/first-post#video-1", "@type": "VideoObject",
"description": "About the first post", "embedUrl": "https://www.youtube.com/embed/dQw4w9WgXcQ",
"isPartOf": {"@id": "https://www.example.test/blog/first-post#webpage"}, "name": "First post",
"thumbnailUrl": ["https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg"],
"uploadDate": "2026-10-01T08:00:00Z", "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"},
{"@id": "https://www.example.test/#website", "@type": "WebSite", "inLanguage": "en", "name": "Acme Blog",
"publisher": {"@id": "https://www.example.test/#organization"}, "url": "https://www.example.test/"},
{"@id": "https://www.example.test/#organization", "@type": "Organization", "name": "Acme", "url": "https://www.example.test/"}
]
},
"locale": "en",
"outbound": {"new_tab": true, "nofollow_domains": [], "sponsored_domains": []},
"seo": {
"canonical": "https://www.example.test/blog/first-post",
"description": "About the first post",
"og": {"description": "About the first post", "image": "https://www.example.test/media/first.jpg",
"locale": "en_US", "locale_alternates": ["pl_PL"], "title": "First post | Acme Blog",
"url": "https://www.example.test/blog/first-post"},
"robots": "index, follow", "title": "First post | Acme Blog",
"twitter": {"card": "summary_large_image", "site": ""}, "verification": [], "x_robots_tag": "index, follow"
},
"staging": false,
"status": 200,
"url": "https://www.example.test/blog/first-post"
}
```
A page-3 answer in the query form adds `"pagination": {"form": "query", "invalid": false, "page": 3, "param": "page", "segment": ""}`. Its title is `Recipes – page 3 of %pages% | Acme Blog` and its description ends with `Page 3 of %pages%.` A garbage page value answers `not_found` with `"pagination": {..., "invalid": true}`.
## Performance
- **Duration:** about 105 min (11:56Z to 13:41Z)
- **Tasks:** 4: a tracer, two TDD tasks and the checkpoint, which Jakub answered in parallel.
- **Commits:** 6 in sm-seo-plugin (main, not pushed). The planning docs are committed in summercms.go.
## Accomplishments
- **classes/schema.** A pure package with:
- `Build`: one node builder per type;
- `Validate`: Google's required and recommended properties per type, with `rules` false for types Google has no rich-result rules for;
- `Normalize`, `DecodeCustom` and `Merge`: the C17 server rules for the structured data value and custom JSON-LD.
- **Resolve.**
- The breadcrumb trail goes through the primary parent: the stored choice, else the first parent, recursively up to 6 levels.
- Alternates list each translated locale, include x-default, and come with `html_lang` and the og locales.
- Pagination: the page form is parsed and folded into the one-hop decision, with invalid pages, suffixes, a self canonical and paged alternates.
- **Settings.**
- New Publisher, Local business and Pagination tabs and the home crumb field.
- The four-place pattern (model, writer, API, form) is applied to every new column, with all C20 refusals.
- P8 shows the generated publisher node with its findings.
- **SEO tab.**
- E8 (`seoschema`), E9 (widget `seo_graph`) and Primary category (`seoparent`).
- The `primary_parent` and `schema` values are stored in the entry data on every locale row.
- Saves answer the `schema.merged` notice.
- P1 gains `primary_gone`; P2 gains rows for the schema type and the breadcrumb trail.
- **MCP.**
- `seo_get_graph` (`GET /_seo/api/v1/graph?url=&schema=`).
- `seo_set_url_seo` and `apply_batch` accept `primary_parent` and `schema`.
- `seo_update_settings` documents every new key.
- The parity row `widget_action:seo_graph` maps to `get_graph`.
## Task Commits
sm-seo-plugin (branch main, not pushed):
1. **Task 1 (tracer):** `ea2ce24` feat: JSON-LD graph, breadcrumbs and hreflang in the resolve answer (tracer)
2. **Task 2:**
- `fde5024` feat: publisher, local business and home crumb settings (group A)
- `032d3da` feat: pagination forms and suffixes in resolve and site (group B)
3. **Task 3:**
- `17da132` feat: graph validation and custom JSON-LD (groups A and C, plus the Go side of B)
- `10ff628` feat: structured data, graph preview and primary category in the SEO tab (group B: elements and dist)
- `d38049a` docs: structured data, breadcrumbs, hreflang and pagination in README (group D)
4. **Task 4:** no commit. The checkpoint answers are recorded at the top of this file.
The tracer gate ran in interactive end-of-phase mode. `TestGraphTracer` was re-run and passed before the expansion tasks started.
## Decisions Made
See `key-decisions` in the frontmatter.
## Deviations from Plan
### Adapted to the actual repositories
**1. [Plan shape] Fake content plugin `acme.magazine` instead of extending the fixture's pages plugin.**
- **Why:** `addresses_test.go` already registers an `acme.blog` plugin.
- **What I did:** the tracer and the per-kind tests use an in-memory plugin `acme.magazine` with three types: `acme-story` (article), `acme-section` (collection) and `acme-writer` (profile). It uses every 33-01 fact. fixture_test.go is unchanged.
**2. [Plan shape] Commit groups.**
- **Validator moved earlier:** validate.go landed in Task 2 group A, because P8 needs the findings.
- **Groups 3A and 3C are one commit**, together with the Go side of 3B (the SEO tab fields, the action, P1 and P2). The operations parity test binds the new `seo_graph` widget action to its tool, and the Go tests drive the SEO tab.
- **Group 3B** is the element commit: elements, labels, styles, dist and vitest.
**3. [Plan shape] `home_crumb` shape.**
- **The conflict:** the plan says "home_crumb per locale". The committed 33-08 layer reads `home_crumb.name` and `.url` (`SeoHtmlSitemapPage.vue`, `types.ts`).
- **What I did:** the site answer is `{"name": <default locale>, "url": <site>/, "names": {<locale>: <name>}}`. This serves both.
**4. [Rule 3 - Blocking] Repeater rows cannot have a trigger.**
- **The limit:** cabana refuses `trigger` on `type: repeater`.
- **Effect:** `local_hours` stays visible when the Local business switch is off. Every other local field hides as planned.
- **Logged** in deferred-items.md.
**5. [Rule 2 - Correctness] Additions outside the plan's list.**
- `classes/structured.go`: input composition, graph answers, the E9 action and the merge notices.
- `classes/owner.go`: `seo_set_url_seo` checks the new keys.
- `classes/history.go`: data values in history.
- `classes/sitemap_filter.go`: signature only. The production resolver skips the graph.
- New copy keys:
- `settings.url_invalid` and `settings.email_invalid` (website and email checks, T-33-25);
- `api.record_only`;
- `schema.field_price`, `schema.field_currency`, `schema.price_invalid` and `schema.currency_invalid`;
- `graphFailed` in E9 (the host gives the element no server message).
- Hreflang of page 2 and later points at the same page of each translation.
**6. [Plan shape] Files not touched.** These files from the plan's list needed no change:
- `updates/registry.go` (migrations register themselves);
- `controllers/settings/config_form.yaml`;
- `extension/_seo_status.htm` and `_seo_effective.htm`, which render the new callout and rows unchanged.
**7. [Plan shape] `field_types.go` (root) has no new lines.** The new types are registered through `classes.FieldTypes`, which the root file returns. The acceptance grep counts 2 lines in `classes/field_types.go`.
**8. [Rule 1 - Bug] The seoparent value round trip.**
- **Bug:** the admin sends the loaded `{selected, options}` object back when the editor leaves the field untouched.
- **Fix:** Decode reads `selected` from it.
**9. [Plan shape] E8 default for registry offers.** The element cannot know a registry page's kind, so the default option of a page-kind record reads "Default (WebPage)" even when the server's default is Service (offer and service kinds). The server applies Service correctly.
### TDD note
The plan is `type: execute` with `tdd="true"` tasks. Each group's tests were written alongside its code and run before the commit. The failures fixed before committing were:
- the local type copy keys;
- a nil `Settings{}` in TestTemplates;
- the tab expectations;
- the site JSON field order;
- the `<` check.
No separate RED commit was made: the plan needs green tests at every commit, as in 33-04 and 33-05.
### Auth gates
None.
**Total deviations:** 9. Five are plan shape, one is a blocking framework limit, one is a correctness addition, one is a bug and one is a UI default note.
**Impact on plan:** every must-have truth is met. The only exception is the visual hiding of the opening-hours repeater.
## Issues Encountered
- **Unvalidated per-locale values.** For the translatable settings (`page_segment`, the suffixes, `breadcrumb_home`, `publisher_name`), the admin's other-locale values go through the translation writer without Decode, so only the default locale's value is validated on save. An invalid segment in another locale falls back to the default segment when it is read.
- **Undo does not restore the new data values.** Undo of an entry history row restores the Phase 32 columns, not `primary_parent` or `schema`. History does record both.
- **`go test ./... -run X`** prints "no tests to run" for subpackages while the named root tests pass, as in 33-02 to 33-05.
## Known Stubs
None.
## Threat Flags
None outside the plan's threat model:
- **T-33-24** (custom JSON-LD): parse, objects only, 16 KB and depth 8, `<script` refused, re-serialised with `<` escaped. Covered by `TestCustomJSONLD`.
- **T-33-25** (sameAs and the website): https absolute URLs only, line-numbered refusal. Covered by `TestPublisherSettings`.
- **T-33-26** (breadcrumbs and alternates): built only from descriptors and settings.
- **T-33-27** (graph tool): the manage wrapper applies, with 401 and 403 in `TestGraphTool`.
- **T-33-28** (the parent chain): capped at 6 levels, cycle-safe.
- **T-33-SC** (installs): no package was installed.
## Verification run
- **sm-seo-plugin, after every commit:**
- `go vet ./...` and `go test -short ./...`: green;
- Docker `go test ./... -count=1`: green.
- **Named tests:** all pass.
- TestGraphTracer (with TestAlternates and TestBreadcrumbs), TestPublisherSettings, TestPagination (including its TestSiteEndpoint subtest), TestPagedAlternates, TestCustomJSONLD, TestGraphPerKind, TestGraphTool.
- TestSiteEndpoint, TestNormalize, TestSEOTab, TestEveryAdminOperationHasTool, TestLangKeysComplete, TestSettingsTypeTabs, TestResolverPrecedence and the Phase 32 and 33-05 suites.
- **Elements:**
- `npm run test`: 87 passed (10 new);
- `npm run build`, then `scripts/check-dist.sh`: matches.
- **From summercms.go:** `bash scripts/check-phase33.sh --plugins --marker`: PASS (vitest 87 and 244; marker clean).
- **Not run here:**
- `--layers`: known broken (deferred-items.md).
- `--docker`: it would also run sm-journal-plugin, which 33-09 is editing at the same time. The SEO Docker suite was run directly instead.
- `--go` and `--consumers`: no framework or consumer change.
- **Acceptance greps:**
- `func Build(`: 1;
- the four resolve json tags: 4;
- the settings_write keys: 15;
- `%pages%`: 3;
- `"pagination"`/`"home_crumb"` in site.go: 2;
- `"seoschema"`/`"seoparent"`: 2;
- the three element tags in index.ts: 3;
- `"get_graph"`: 1;
- `Product` in classes/schema: 0.
## User Setup Required
None for this plan. Optional per site:
- `golem15.seo.search_url` turns on the SearchAction.
- `golem15.seo.og_locales` overrides the og:locale values.
- The Publisher tab fills the publisher node; without it, the site name is used.
## Next Phase Readiness
- **33-07, 33-08 and 33-09:** the backend now answers the keys their fixtures expect (see the tracer answer above). Each layer fixture's `home_crumb` should gain `names`, or the layer can keep reading `name`.
- **33-10 and 33-11:** pin chromedp v0.21.0 and gen2brain/webp v0.6.4, each after its decision note.
- **33-14:** tag the next sm-seo-plugin minor, which includes 33-05 and this plan.
## Self-Check: PASSED
- FOUND: every file in key-files.created (checked with `[ -f ]`).
- FOUND commits in sm-seo-plugin: ea2ce24, fde5024, 032d3da, 17da132, 10ff628, d38049a. `git rev-list --count df93c86..HEAD` = 6.
- No uncommitted changes in sm-seo-plugin.
---
*Phase: 33-seo-output-audit-and-content*
*Completed: 2026-11-04*

View File

@@ -0,0 +1,349 @@
---
phase: 33-seo-output-audit-and-content
plan: 07
subsystem: vue-seo-layer
tags: [nuxt-layer, nitro-middleware, json-ld, hreflang, lru-cache, root-files, site-cache-purge, labels, css-tokens]
requires:
- phase: 32-seo-foundation
provides: GET /_seo/api/v1/resolve answer (action, status, location, url, locale, staging, seo), POST /notfound, verification files
- phase: 33-01
provides: version ruling (phase targets SummerCMS v0.6.1, base v0.6.0)
provides:
- vue-seo-layer runtime on top of v0.1.1 (repository ../vue-seo-layer, branch main, 7 commits, not pushed, not tagged)
- Nitro middleware server/middleware/seo.ts (resolveCached, redirect/410/X-Robots-Tag, pagination.invalid 404, event.context.seo)
- useCmsSeo (html lang, hreflang, og:locale, one JSON-LD @graph), useSchemaNode, mergeGraph, isPagePath
- resolve LRU (seo.resolveCacheTtl, 1000 entries, in-flight de-duplication) and the site answer cache (server/lib/site.ts)
- shared POST /api/__site__/cache/purge moved in (library and plugin byte-identical, route also clears the SEO caches) plus a purge hook for the transition
- root-file proxies server/middleware/seo-root.ts (robots.txt, sitemap.xml, sitemap-<name>.xml, llms.txt, listed verification and IndexNow key files)
- local module lib/seo-module.ts (configKey seo; cms, breadcrumbs, links.newTabHint, rootFiles, resolveFiles)
- useSeoLabels / pickLabels / formatSeoLabel (L8 en, pl), seo-tokens.css, seo-base.css
- smoke harness (count=, exact header=, noheader=, reqheader=, repeatable options, resolves/apicalls/noreport lines, --no-site), fixture API (site, root files, resolve counts, reload), purge-check.mjs, purge-token-check.mjs
affects: [33-08, 33-09, 33-12, 33-13, 33-14]
actuals:
tokens: 42900
tasks: 4
commits: 7
plan_head_before: 7d52c5d2e50fb5870887751adfdcd5e78512a271
plan_head_after: 6636cde70a6d866e6d7511c24f5d3b70258455f9
tech-stack:
added: []
patterns:
- "Resolve once per request in Nitro middleware, hand the answer to the render through event.context.seoResolved; the route middleware reuses it on the server and resolves only on client navigation"
- "New behaviour gated on the backend's v0.2.0 site answer: a backend whose /site answers 404, or one never reached, keeps the v0.1.1 behaviour"
- "LRU with generation counter: a clear detaches loads in flight, so nothing fetched before a purge is stored after it"
- "Smoke runs per scenario (v0.1.1 suite against --no-site, full, off via both switches, backend down, no token)"
key-files:
created:
- ../vue-seo-layer/lib/seo-module.ts
- ../vue-seo-layer/server/middleware/seo.ts
- ../vue-seo-layer/server/middleware/seo-root.ts
- ../vue-seo-layer/server/lib/config.ts
- ../vue-seo-layer/server/lib/resolve.ts
- ../vue-seo-layer/server/lib/lru.ts
- ../vue-seo-layer/server/lib/site.ts
- ../vue-seo-layer/server/lib/siteCachePurge.ts
- ../vue-seo-layer/server/api/__seo__/resolve.get.ts
- ../vue-seo-layer/server/api/__site__/cache/purge.post.ts
- ../vue-seo-layer/server/plugins/site-cache-purge.ts
- ../vue-seo-layer/server/plugins/seo-cache-purge.ts
- ../vue-seo-layer/app/composables/useCmsSeo.ts
- ../vue-seo-layer/app/composables/useSchemaNode.ts
- ../vue-seo-layer/app/composables/useSeoLabels.ts
- ../vue-seo-layer/app/utils/graph.ts
- ../vue-seo-layer/app/utils/pagePath.ts
- ../vue-seo-layer/app/utils/labels.ts
- ../vue-seo-layer/app/app.config.ts
- ../vue-seo-layer/app/assets/css/seo-tokens.css
- ../vue-seo-layer/app/assets/css/seo-base.css
- ../vue-seo-layer/testing/nuxt-server.mjs
- ../vue-seo-layer/testing/purge-check.mjs
- ../vue-seo-layer/testing/purge-token-check.mjs
- ../vue-seo-layer/testing/expect-seo.txt
- ../vue-seo-layer/testing/expect-seo-off.txt
- ../vue-seo-layer/testing/expect-seo-down.txt
- ../vue-seo-layer/testing/expect-seo-notoken.txt
- ../vue-seo-layer/testing/fixtures/seo/resolve.json
- ../vue-seo-layer/testing/fixtures/seo/site.json
- ../vue-seo-layer/tests/graph.test.ts
- ../vue-seo-layer/tests/pagePath.test.ts
- ../vue-seo-layer/tests/lru.test.ts
- ../vue-seo-layer/tests/labels.test.ts
- ../vue-seo-layer/tests/sitePurge.test.ts
- ../vue-seo-layer/tests/rootFiles.test.ts
modified:
- ../vue-seo-layer/nuxt.config.ts
- ../vue-seo-layer/package.json
- ../vue-seo-layer/README.md
- ../vue-seo-layer/app/plugins/seo-head.ts
- ../vue-seo-layer/app/middleware/seo.global.ts
- ../vue-seo-layer/app/composables/useSeoResolve.ts
- ../vue-seo-layer/app/utils/seo.ts
- ../vue-seo-layer/app/utils/types.ts
- ../vue-seo-layer/server/middleware/seo-verification.ts
- ../vue-seo-layer/server/plugins/seo-notfound.ts
- ../vue-seo-layer/testing/smoke-ssr.mjs
- ../vue-seo-layer/testing/fixture-api.mjs
- ../vue-seo-layer/tests/seo.test.ts
- ../vue-seo-layer/.playground/nuxt.config.ts
key-decisions:
- "Task 1 (Jakub 2026-11-04): the shared layer's name is vue-seo-layer"
- "Option 1 (Jakub 2026-11-04): extend the existing v0.1.1 repository in place (no git init, no re-scaffold, remote origin kept, never pushed or tagged); backward compatibility with v0.1.1 mandatory"
- "33-14 does not create the repository with tea; the layer's next tag is v0.2.0"
- "Module option seo.cms is an alias of public.seo.enabled (NUXT_PUBLIC_SEO_ENABLED); either one false switches the layer off"
- "Redirect Location keeps the v0.1.1 rule: same-site targets become paths, other hosts stay absolute; built from the answer only"
- "Client navigation keeps public.seo.apiBase (/_seo/api/v1); GET /api/__seo__/resolve is opt-in by setting it to /api/__seo__"
- "Root files and the root_files-only verification rule apply only once the backend gave a v0.2.0 site answer; otherwise v0.1.1 behaviour"
patterns-established:
- "Compatibility suite: testing/expect.txt (v0.1.1) runs unchanged against a backend without /site on every smoke run"
requirements-completed: [SC-2, D-97, D-20, D-20a, D-20b, D-20c, D-08, D-05, D-103, D-43, D-55, D-71, D-22, D-25]
coverage:
- id: D1
description: "A Nuxt page extending the layer renders the CMS title, canonical, hreflang, html lang, og:locale and exactly one JSON-LD script with one @graph (CMS nodes plus layer nodes merged by @id; '<' escaped)"
requirement: "D-43"
verification:
- kind: integration
ref: "npm run smoke:ssr (testing/expect-seo.txt tracer lines)"
status: pass
- kind: unit
ref: "tests/graph.test.ts, tests/seo.test.ts#seoHeadInput: v0.2.0 keys"
status: pass
human_judgment: false
- id: D2
description: "Redirect (301/302, Location from the answer only, crafted Host ignored), 410, X-Robots-Tag and the pagination.invalid 404 enforced in Nitro middleware before the render and the route cache"
requirement: "D-20a"
verification:
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt redirect/410/404 lines); testing/purge-check.mjs step 8 (redirect on a route-cached page)"
status: pass
human_judgment: false
- id: D3
description: "Resolve LRU (TTL, 1000 entries, in-flight de-duplication, purge-safe) and the moved site cache purge route clearing route cache, resolve and site caches"
requirement: "D-97"
verification:
- kind: unit
ref: "tests/lru.test.ts, tests/sitePurge.test.ts"
status: pass
- kind: integration
ref: "npm run purge:check (purge-check 18 checks, purge-token-check 53 checks); smoke 'resolves /blog/lwia-grzywa 1'"
status: pass
human_judgment: false
- id: D4
description: "Root files from the backend (robots.txt, sitemap.xml, sitemap-<name>.xml, llms.txt, listed verification and IndexNow key files) with status, content type, X-Robots-Tag; 503 Retry-After 60 on backend failure; other paths pass through"
requirement: "D-05"
verification:
- kind: unit
ref: "tests/rootFiles.test.ts"
status: pass
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt root lines, expect-seo-down.txt)"
status: pass
human_judgment: false
- id: D5
description: "404 report once with the bearer token; none with the layer off or without a token"
requirement: "D-20"
verification:
- kind: integration
ref: "npm run smoke:ssr (report/noreport lines in expect-seo.txt, expect-seo-off.txt, expect-seo-notoken.txt)"
status: pass
human_judgment: false
- id: D6
description: "L8 labels (en, pl, app overrides), seo-tokens.css and seo-base.css (only .seo-* classes), no i18n dependency"
verification:
- kind: unit
ref: "tests/labels.test.ts"
status: pass
- kind: integration
ref: "smoke line '<p class=\"seo-visually-hidden\">Ścieżka nawigacji</p>'; plan acceptance greps"
status: pass
human_judgment: false
- id: D7
description: "v0.1.1 behaviour and config keys preserved for consumers"
verification:
- kind: integration
ref: "testing/expect.txt (31 v0.1.1 checks) on every smoke run; expect-seo-off.txt with NUXT_PUBLIC_SEO_ENABLED=false; scratch build of vue-grzybyfunkcjonalne-app against this layer: its smoke 52/52, smoke:ga 2/2, unit 28/28"
status: pass
human_judgment: false
duration: 25min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 07: vue-seo-layer runtime Summary
**The existing vue-seo-layer v0.1.1 now resolves each page once in Nitro middleware with a purge-safe LRU, enforces redirect, 410 and X-Robots-Tag before the route cache, renders hreflang and one merged JSON-LD @graph, serves the CMS's root files, owns the shared site-cache purge route and ships the L8 labels and tokens. Every v0.1.1 behaviour and config key still works.**
## Task 1 answer and Jakub's ruling (2026-11-04)
- **Task 1 (checkpoint:decision), answered:** the layer's name is **vue-seo-layer**.
- **The plan was stale.** It assumed `../vue-seo-layer` did not exist. In fact the repository was created and published on 2026-10-31, outside this phase: remote `git@git.golem15.com:golem15/vue-seo-layer.git`, tags v0.1.0 and v0.1.1, branch main with 2 commits (ac59f3c, 7d52c5d). It is consumed by `../sm-grzybyfunkcjonalne-app/vue-grzybyfunkcjonalne-app` pinned at `#v0.1.1`.
- **Jakub's ruling (option 1): extend the existing layer in place.** So:
- no `git init`, no recreate or re-scaffold, no file deleted, work stayed on main;
- the acceptance criterion "no remote" is void (origin exists);
- nothing was pushed or tagged.
- **Backward compatibility with v0.1.1 is mandatory.** The plan's new keys were added alongside the existing ones. Where a plan key duplicates an existing one, the existing key keeps working and the new one is an alias: `seo.cms` is an alias of `public.seo.enabled`, and either one false switches the layer off.
- **Commit subjects.** The plan's subjects were used. No scaffold commit exists, so the tracer subject describes the actual change.
- **For later plans:**
- **33-14** does NOT create the repository with tea.
- **The layer's next tag is v0.2.0.** `package.json` still says 0.1.1; bump it when tagging in 33-14. The README already shows the `#v0.2.0` pin and marks new features "v0.2.0".
- **Framework context (33-01):** the phase targets SummerCMS v0.6.1 on base v0.6.0.
- **No planned change needed a checkpoint:decision.** Every planned change could be made without changing observable v0.1.1 behaviour. One regression I introduced myself was found by the consumer build and fixed (deviation 6).
### How v0.1.1 compatibility was verified
1. **The v0.1.1 suite is unchanged.** `testing/expect.txt` (31 checks: head priority, empty values keep page tags, staging noindex, redirects, 410, 404 reports, verification files, `404 /robots.txt`, relative canonicals) runs on every `npm run smoke:ssr` against a backend whose `/site` answers 404, as v0.1.1's backend does. It passes on the final commit.
2. **Both switches tested.** `testing/expect-seo-off.txt` runs once with the new `NUXT_PUBLIC_SEO_CMS=false` and once with the v0.1.1 `NUXT_PUBLIC_SEO_ENABLED=false`. Both give zero API calls, the pages' own head, no redirect, no root files and no report.
3. **Consumer build.** In a scratchpad copy of `vue-grzybyfunkcjonalne-app`, its node_modules copy of vue-seo-layer was replaced with `git archive HEAD` of this layer. The real repository was not touched. I ran `nuxt build`, then its `smoke:ssr` (52/52), `smoke:ga` (2/2) and `npm test` (28/28). This found deviation 6, which is fixed. The consumer build also runs next to `@nuxtjs/seo`, which shares the `seo` config key, without errors.
4. **Config keys kept with v0.1.1 semantics:** `seo.apiBase`, `seo.notfoundToken`, `seo.timeoutMs`, `public.seo.apiBase` (still the browser's resolve base) and `public.seo.enabled`. The exported helpers `useSeoAnswer`, `resolveSeo`, `seoHeadInput` and the rest of `app/utils/seo.ts` keep their signatures. The new head keys are only added when the answer carries them, so an old backend gives the same tags.
## Performance
- **Duration:** 25 min
- **Started:** 2026-11-04T08:07:26Z
- **Completed:** 2026-11-04T08:32:38Z
- **Tasks:** 4 (Task 1 answered, Tasks 2 to 4 executed)
- **Files modified:** 57 in ../vue-seo-layer
## Accomplishments
- **Nitro middleware** resolves each page request once through the LRU, forwarding X-Forwarded-For. It handles redirect, 410, X-Robots-Tag and the pagination.invalid 404 before the render and the route cache. The render reuses the answer, so a page costs one resolve call; the smoke checks this with `resolves PATH 1`.
- **One head owner** (seo-head plugin → `useCmsSeo`). It sets the v0.1.1 tags plus `<html lang>`, og:locale and og:locale:alternate, hreflang links, and exactly one JSON-LD script with one @graph. The graph merges CMS nodes and `useSchemaNode` nodes by @id, with CMS values winning.
- **Shared purge route** moved in with the same contract. It also empties the resolve and site caches. A purge hook does the same when the journal, menu or FAQ layer's copy of the route answers instead (Pitfall 6 during the transition to 33-09).
- **Root-file proxies** with status, content type and X-Robots-Tag passed on, and 503 with Retry-After 60 on backend failure. They are gated on the v0.2.0 site answer.
- **L8 labels, tokens and base styles**, a README covering everything, and 67 unit tests.
- **Six smoke runs** (93 checks) plus the purge checks (18 + 53).
## Task Commits
All in /media/nvme/dev/golem15/summercms.io/summercms/vue-seo-layer (branch main, not pushed):
1. **Task 1: name the layer.** No commit; answered: vue-seo-layer.
2. **Task 2: tracer.** `160b53b` feat: CMS head and one JSON-LD graph on every server-rendered page (tracer)
3. **Task 3:**
- A `e3baa70` feat: redirect and 410 enforcement, X-Robots-Tag and the resolve cache
- B `691fa09` feat: shared site cache purge route clears the SEO caches
- C `d162943` feat: root files from the CMS and the 404 report
4. **Task 4:**
- A `aa7480e` feat: SEO labels, tokens and base styles
- B `c2357cd` docs: README
5. **Deviation fix:** `6636cde` fix: root files fall through until the backend has given a site answer
## Decisions Made
See key-decisions in the frontmatter. In short:
- **seo.cms** is an alias of public.seo.enabled.
- **Redirect Location** keeps the v0.1.1 same-origin-to-path rule.
- **The browser** keeps public.seo.apiBase; the new `/api/__seo__/resolve` is opt-in.
- **Root files** depend on a confirmed v0.2.0 site answer.
## Deviations from Plan
### Ruling-driven (Jakub, option 1)
**1. The repository exists.**
- **What changed:** no `git init`, no scaffold, remote kept, "no remote" criterion void.
- **Fixture layout:** the v0.1.1 fixtures (`testing/fixtures/resolve.json`, `verification/`) and `testing/expect.txt` were kept as they are. The new answers live in `testing/fixtures/seo/`, and the fixture API merges both.
### Compatibility-driven (Rule 2, to keep v0.1.1 behaviour)
**2. Redirect Location.**
- **Plan:** "forward the resolver's absolute location" (`/stary` → `https://example.test/nowy`).
- **What I did:** kept v0.1.1's `seoRedirectTarget`. A same-site target becomes a path (`/nowy`); another host stays absolute.
- **Prohibition still holds:** the Location never uses request input. The smoke sends a crafted Host and X-Forwarded-Host, and `server/middleware/seo.ts` has no `getRequestHost` or `x-forwarded-host`.
**3. Client-navigation resolve.**
- **Plan:** fetch through `/api/__seo__/resolve`.
- **What I did:** the browser still uses `public.seo.apiBase`, whose v0.1.1 meaning is the same-origin resolve base. The `/api/__seo__/resolve` route exists, goes through the server LRU, has `cache: false` and noindex, and is used when the app sets `public.seo.apiBase` to `/api/__seo__`.
**4. Head application.**
- **Plan:** `seo-head.ts` takes the answer from `useRequestEvent().context.seo`.
- **What I did:**
- The v0.1.1 global route middleware stays. On the server it reuses `event.context.seoResolved` (no second call). It still resolves paths the Nitro middleware skips (dotted page paths) and client navigations.
- The canonical link has no explicit `key`. unhead's own canonical de-duplication then keeps one canonical even when a page sets its own, which v0.1.1's `/about` check relies on.
**5. Verification files.**
- **Plan:** only names listed in `root_files` are proxied; others pass through.
- **What I did:** that rule applies when the backend gives a site answer. With a backend whose `/site` answers 404 (v0.1.1 era) or one never reached, `seo-verification.ts` keeps the v0.1.1 name lookup. robots.txt and the sitemaps are not proxied then, matching v0.1.1's `404 /robots.txt`.
- **Backend base:** `seo.backendBase` defaults to empty, which means `apiBase` without `/_seo/api/v1`. That is effectively `http://127.0.0.1:8096`, and an app that set only `NUXT_SEO_API_BASE` needs nothing new.
**6. [Rule 1 - Bug] Root files answered 503 while the backend was unreachable since start.**
- **Found during:** the post-plan consumer build. vue-grzybyfunkcjonalne-app's smoke expects `404 /robots.txt` and `404 /sitemap.xml` with the SEO API down.
- **Fix:** root proxies need a site answer (state ok, or the last one seen while the backend is down), so a cold start with the backend down falls through as in v0.1.1. The plan's 503 still applies once a site answer was seen: `503 /sitemap-fail-1.xml` in expect-seo.txt, and expect-seo-down.txt now expects the v0.1.1 404s.
- **Files:** server/lib/site.ts, server/middleware/seo-root.ts, tests/rootFiles.test.ts, testing/expect-seo-down.txt, README.md
- **Commit:** 6636cde
### Other adjustments
**7. Purge route copy and its transition hook.**
- **Byte-identical:** the purge library and the site-config plugin match the journal, menu and FAQ copies.
- **Not byte-identical:** the route adds `clearSeoCaches()`; its pinned hash in `tests/sitePurge.test.ts` is updated.
- **Added `server/plugins/seo-cache-purge.ts`** (an afterResponse hook on a 200 POST to `/api/__site__/cache/purge` or `/api/__journal__/cache/purge`). In an app that also extends journal, menu or FAQ, Nitro may run their copy, which does not clear the SEO caches (Pitfall 6). 33-09 removes those copies; the hook can stay, since clearing twice is harmless.
**8. purge-check.mjs.**
- **Changed:** it changes the fixture resolve title (as planned). It drops the journal-only checks: browser `max-age=0` comes from vue-journal-layer's journal-revalidate plugin, which was not moved, and `_payload.json` carries no SEO data.
- **Added:** step 8, where a redirect added for a route-cached page applies at once with `NUXT_SEO_RESOLVE_CACHE_TTL=0`.
- **Unchanged:** all other checks of both scripts.
**9. Playground route cache.**
- **Plan:** `'/**': { swr: 300 }`. **Used:** `'/blog/**'`.
- **Why:** a route-cached render has no Host header, so v0.1.1's `/relative` check (a path canonical made absolute on the request origin) needs uncached pages. Pre-existing behaviour, see Deferred.
**10. Smoke harness grammar.**
- **header=:** now means "equals", per P33-29. All v0.1.1 lines still pass.
- **Added:** `noheader=`, `reqheader=`, `noreport`, `resolves PATH N`, `apicalls N` and `--no-site`.
- **Runs:** `smoke:ssr` runs six scenarios instead of one; `purge:check` script added.
- **Boot probe:** `testing/nuxt-server.mjs` probes `/_nuxt/` so the boot never resolves a page.
**11. TDD gate.**
- **Not done:** no separate RED commits.
- **Why:** the plan requires `npm run test` green at every commit.
- **What was done:** tests were written and run failing before each implementation (`lru.test.ts`, `labels.test.ts`: ERR_MODULE_NOT_FOUND, plus a deliberate run with `clearSeoCaches()` removed failing three sitePurge tests). Each was then committed with its implementation in the plan's commit groups.
## TDD Gate Compliance
- RED observed locally (not committed) for `tests/lru.test.ts`, `tests/labels.test.ts` and the sitePurge cache-clear tests.
- GREEN in commits e3baa70, 691fa09 and aa7480e.
- No refactor commits.
- A separate `test(...)` commit was not made because the plan requires a green test suite at every commit (deviation 11).
## Known Stubs
Intentional forward options, wired in later plans and not blocking this plan's goal:
- **`lib/seo-module.ts` `breadcrumbs`** (default true): reaches `runtimeConfig.public.seo.breadcrumbs`; `<SeoBreadcrumbs>` arrives in 33-08.
- **`lib/seo-module.ts` `links.newTabHint`** (default true): reaches `runtimeConfig.public.seo.links.newTabHint`; the body-link pipeline is 33-09.
- **`nuxt.config.ts` `seo.routeReportToken`:** read by `seoServerConfig`; the route report is 33-08.
- **`app/assets/css/seo-base.css`:** only `.seo-visually-hidden` and the focus ring so far. Breadcrumb, pagination and sitemap rules land with their components in 33-08.
## Deferred Issues
- **Pre-existing in v0.1.1, out of scope:** on a route-cached (swr) render the request has no Host, so a canonical, og:url or og:image that the backend answers as a path becomes absolute on `http://localhost`. It does not affect backends with `golem15.seo.site_url` or `app.url` set, which the README already requires. Logged in deferred-items.md.
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: new-endpoint | ../vue-seo-layer/server/api/__seo__/resolve.get.ts | Public GET /api/__seo__/resolve?url= returns the same public resolve answer the backend's /_seo/api/v1/resolve gives. Only path URLs up to 2048 characters; goes through the LRU, never route-cached, noindex, 404 when the layer is off. |
| threat_flag: proxy | ../vue-seo-layer/server/middleware/seo-root.ts | Root-file proxy (T-33-32): targets are the server-only bases plus an allow-listed name (exact names, `sitemap-[a-z0-9-]+.xml`, names listed in root_files); covered by tests/rootFiles.test.ts including traversal inputs. |
## Self-Check: PASSED
- All key files exist in ../vue-seo-layer (checked after writing).
- Commits 160b53b, e3baa70, 691fa09, d162943, aa7480e, c2357cd and 6636cde are present on main in ../vue-seo-layer.
- `npm run test`: 67 pass, 0 fail.
- `npm run smoke:ssr`: six runs ok (31, 36, 9, 9, 6, 2 checks).
- `npm run purge:check`: purge-check ok (18), purge-token-check ok (53).
- Plan acceptance greps:
- `sendRedirect` appears once in seo.ts; no `getRequestHost` or `x-forwarded-host`.
- expect-seo.txt has more than 5 `header=` or `count=` lines.
- `application/ld+json` appears once in useCmsSeo.ts.
- package.json has no `"dependencies"` and no i18n.
- Both the `--seo-target-size` and `--seo-space-5` tokens are present.
- No bare-element rules in seo-base.css.

View File

@@ -0,0 +1,406 @@
---
phase: 33-seo-output-audit-and-content
plan: 08
subsystem: vue-seo-layer
tags: [nuxt-layer, build-guard, ssr, noindex, route-report, drift-check, breadcrumbs, pagination, html-sitemap]
requires:
- phase: 33-07
provides: vue-seo-layer runtime (resolve middleware, useCmsSeo, site answer cache, labels, tokens, smoke harness, fixture API)
- phase: 33-03
provides: sitemap index /sitemap.xml and per-type files /sitemap-<slug>-<n>.xml through /_sitemap/files/{file} (unchanged here)
provides:
- SSR build guard (lib/guard.ts) with options seo.noindexRoutes and seo.indexable, guard:check over four fixture apps
- automatic noindex for declared routes and for pages whose meta sets requiresAuth or seo.robots (app plugin seo-route-robots)
- route artefact #seo-routes, the route report (POST /registry/routes) and the startup drift check
- GET /api/__seo__/site and useSeoSite()
- <SeoBreadcrumbs>, <SeoPagination> + usePagination(), HTML sitemap pages (SeoHtmlSitemapPage, GET /api/__seo__/sitemap) and <SeoSitemapLink>
- options seo.routeReport, seo.pagination, seo.htmlSitemap
affects: [33-09, 33-12, 33-13, 33-14]
actuals:
tokens: 42200
tasks: 3
commits: 7
plan_head_before: 6636cde70a6d866e6d7511c24f5d3b70258455f9
plan_head_after: b051bda0809b9a8ca58f2c55c55d12d6477e8127
tech-stack:
added: []
patterns:
- "Build-time checks in the local module: nitro:config (rules merged) runs before pages:resolved, so the guard runs once the pages are resolved; a production build throws, nuxt dev and nuxt prepare warn"
- "Build-time route data for runtime plugins through addServerTemplate (#seo-routes), no network call at build time"
- "Pagination and breadcrumb links through NuxtLink's custom slot, so the router's aria-current does not mark every page of the same path"
- "Helpers in app/utils carry the seo prefix (auto-imported next to the journal layer's paginationWindow)"
key-files:
created:
- ../vue-seo-layer/lib/guard.ts
- ../vue-seo-layer/lib/routes.ts
- ../vue-seo-layer/lib/options.ts
- ../vue-seo-layer/testing/guard-check.mjs
- ../vue-seo-layer/testing/guard/{indexable-ssr-false,noindex-ok,client-page,global-ssr-false}/
- ../vue-seo-layer/app/plugins/seo-route-robots.ts
- ../vue-seo-layer/server/plugins/seo-route-report.ts
- ../vue-seo-layer/server/plugins/seo-drift.ts
- ../vue-seo-layer/server/lib/drift.ts
- ../vue-seo-layer/server/lib/routeReport.ts
- ../vue-seo-layer/server/lib/htmlSitemap.ts
- ../vue-seo-layer/server/seo-routes.d.ts
- ../vue-seo-layer/server/api/__seo__/site.get.ts
- ../vue-seo-layer/server/api/__seo__/sitemap.get.ts
- ../vue-seo-layer/app/composables/useSeoSite.ts
- ../vue-seo-layer/app/composables/usePagination.ts
- ../vue-seo-layer/app/components/Seo/Breadcrumbs.vue
- ../vue-seo-layer/app/components/Seo/Pagination.vue
- ../vue-seo-layer/app/components/Seo/SitemapLink.vue
- ../vue-seo-layer/app/components/Seo/SitemapList.vue
- ../vue-seo-layer/app/components/global/SeoHtmlSitemapPage.vue
- ../vue-seo-layer/app/seo-pages/SitemapPage.vue
- ../vue-seo-layer/app/seo-pages/SitemapGroupPage.vue
- ../vue-seo-layer/app/utils/paginationWindow.ts
- ../vue-seo-layer/app/utils/pageHref.ts
- ../vue-seo-layer/app/utils/breadcrumbClaim.ts
- ../vue-seo-layer/app/utils/sitePath.ts
- ../vue-seo-layer/testing/expect-seo-drift.txt
- ../vue-seo-layer/testing/fixtures/seo/site-drift.json
- ../vue-seo-layer/testing/fixtures/seo/html.json
- ../vue-seo-layer/.playground/app/pages/{konto,szkic}.vue, prywatne/index.vue, blog/index.vue
- ../vue-seo-layer/tests/{guard,routes,paginationWindow,pageHref,breadcrumbClaim,htmlSitemap}.test.ts
modified:
- ../vue-seo-layer/lib/seo-module.ts
- ../vue-seo-layer/server/lib/config.ts
- ../vue-seo-layer/app/composables/useCmsSeo.ts
- ../vue-seo-layer/app/composables/useSeoLabels.ts
- ../vue-seo-layer/app/utils/seo.ts
- ../vue-seo-layer/app/utils/types.ts
- ../vue-seo-layer/app/assets/css/seo-base.css
- ../vue-seo-layer/package.json
- ../vue-seo-layer/README.md
- ../vue-seo-layer/testing/smoke-ssr.mjs
- ../vue-seo-layer/testing/fixture-api.mjs
- ../vue-seo-layer/testing/expect-seo.txt, expect-seo-off.txt, expect-seo-down.txt, expect-seo-notoken.txt
- ../vue-seo-layer/testing/fixtures/seo/site.json, resolve.json
- ../vue-seo-layer/.playground/nuxt.config.ts, app/app.vue, app/pages/[...slug].vue
key-decisions:
- "The build guard runs when the pages are resolved (pages:resolved), not inside nitro:config: Nuxt fires nitro:config first; the rules are read from the final Nitro config (nitro:init), and nitro:build:before is the fallback for an app without pages"
- "The guard throws only in a production build or generate; nuxt dev and nuxt prepare (run on install) warn, so an install never fails"
- "Declared noindex and page-meta robots win over the CMS robots (tagPriority -10 against the head entry's critical -8), except on staging"
- "The route report retries once after 60 s only on no answer or a non-404/401/403 status; a 404 (no page registry) and a refused token are logged, not retried"
- "A root catch-all page does not count as serving a CMS content-type pattern in the drift check; a prefixed catch-all does"
- "app/utils helpers are seo-prefixed (seoPaginationWindow, seoPageHref, seoClaimBreadcrumbs, seoSitePath): the journal layer auto-imports its own paginationWindow with another return shape"
- "HTML sitemap pages answer 404 unless the CMS's site answer has the HTML sitemap on with a path for the locale, 503 when the backend has not answered; an app page at the same path keeps it"
patterns-established:
- "Smoke grammar: routereport N [has=PATH] [lacks=PATH], log TEXT:N, --site-file NAME"
- "Split commits verified on the staged tree: git checkout-index into a scratch dir, then test, build and smoke there"
requirements-completed: [SC-2, D-70, D-23, D-21, D-33, D-20c, D-86, D-40, D-41, D-42, D-71, D-34, D-97]
coverage:
- id: D1
description: "nuxt build fails with the D-70 message for a Nuxt route rule, a Nitro route rule, a .client.vue page and a global ssr: false, and passes when the route is declared in seo.noindexRoutes; the declared route is served with X-Robots-Tag: noindex, nofollow and / without it; inline route rules are refused; seo.indexable false checks nothing"
requirement: "D-70"
verification:
- kind: integration
ref: "npm run guard:check (testing/guard-check.mjs, 16 checks)"
status: pass
- kind: unit
ref: "tests/guard.test.ts"
status: pass
human_judgment: false
- id: D2
description: "A page with requiresAuth meta, a page with seo.robots and a path under noindexRoutes get the robots meta tag and X-Robots-Tag without page code; an ordinary page keeps the CMS robots"
requirement: "D-23"
verification:
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt /konto, /szkic, /prywatne, /plain lines)"
status: pass
- kind: unit
ref: "tests/routes.test.ts#pageMetaRobots"
status: pass
human_judgment: false
- id: D3
description: "One route report at server start with the token and the static paths (not /konto, /szkic, /prywatne, the sitemap pages); none without a token or with routeReport false"
requirement: "D-33"
verification:
- kind: integration
ref: "npm run smoke:ssr (routereport lines in expect-seo.txt, expect-seo-notoken.txt, expect-seo-drift.txt)"
status: pass
- kind: unit
ref: "tests/routes.test.ts#staticRoutes, routeReportBody, routeReportOutcome"
status: pass
human_judgment: false
- id: D4
description: "Startup drift check: no warning when CMS and build agree, three warnings (URL pattern, pagination form, pl HTML sitemap path) against site-drift.json, and the server still serves pages"
requirement: "D-20c"
verification:
- kind: integration
ref: "npm run smoke:ssr (log lines in expect-seo.txt and expect-seo-drift.txt)"
status: pass
- kind: unit
ref: "tests/routes.test.ts#driftWarnings"
status: pass
human_judgment: false
- id: D5
description: "<SeoBreadcrumbs>: one nav per page with a layout and a page instance, server-rendered links, last item aria-current text; none on the home page or a page without a trail"
requirement: "D-86"
verification:
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt L1 lines, count=<nav class=\"seo-breadcrumbs\":1)"
status: pass
- kind: unit
ref: "tests/breadcrumbClaim.test.ts"
status: pass
human_judgment: false
- id: D6
description: "<SeoPagination> + usePagination(): window 1 … 3–7 … 14, page 1 unnumbered, other query parameters kept, rel prev/next anchors and head links, %pages% filled in the CMS title and description, nothing with one page"
requirement: "D-42"
verification:
- kind: unit
ref: "tests/paginationWindow.test.ts, tests/pageHref.test.ts"
status: pass
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt L2 lines)"
status: pass
human_judgment: false
- id: D7
description: "HTML sitemap: overview with H1 and an H2 per non-empty group, nested categories, sitemap.all link, sitemap.empty; group pages with built trail, page suffix and pagination; 404 unknown group / past the last / malformed page, 301 ?page=1, 503 on API failure and with the backend down, 404 with the layer off; non-http URLs never rendered as links"
requirement: "D-34"
verification:
- kind: integration
ref: "npm run smoke:ssr (expect-seo.txt L3 lines, expect-seo-off.txt, expect-seo-down.txt)"
status: pass
- kind: unit
ref: "tests/htmlSitemap.test.ts"
status: pass
human_judgment: false
- id: D8
description: "<SeoSitemapLink> renders the locale's sitemap link only while the CMS has the HTML sitemap on and the layer serves it"
requirement: "D-34"
verification:
- kind: integration
ref: "npm run smoke:ssr (L4 line in expect-seo.txt and expect-seo-drift.txt; none in expect-seo-off.txt and the --no-site v0.1.1 run)"
status: pass
human_judgment: false
- id: D9
description: "Default styles of L1–L3 (only .seo-* selectors, tokens only, long text wraps)"
verification:
- kind: other
ref: "app/assets/css/seo-base.css review; no bare-element selector"
status: pass
human_judgment: true
- id: D10
description: "v0.1.1 compatibility: the v0.1.1 smoke suite unchanged; the scratch build of the existing consumer against this layer passes its own checks"
verification:
- kind: integration
ref: "testing/expect.txt (31 checks, --no-site) on every smoke run; scratch copy of the consumer app with node_modules/vue-seo-layer = git archive aee6957: nuxt build, smoke:ssr 52/52, smoke:ga 2/2, npm test 28/28"
status: pass
human_judgment: false
duration: 27min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 08: vue-seo-layer build guard, noindex routes, route report and public components Summary
**vue-seo-layer now fails a production build whose indexable routes would render only in the browser, marks declared and signed-in routes noindex without page code, reports its static routes to the CMS page registry and logs CMS/build drift at start. It also ships server-rendered breadcrumbs, pagination in the CMS URL form and an HTML sitemap with its footer link. All of it is additive to v0.1.1.**
## Context rulings applied
- **Framework version:** the framework is at v0.6.0 and this phase delivers v0.6.1. This plan changes no framework code, so D-90 holds.
- **The layer:** vue-seo-layer was extended in place on main after 33-07 (6636cde).
- Nothing was pushed or tagged.
- `package.json` stays at 0.1.1; the next tag is v0.2.0, in 33-14.
- **Sitemap paths (33-03):** the plan's layer code proxies no XML sitemap path, so no alignment was needed.
- The HTML sitemap pages call the sitemap plugin's HTML API at `/_sitemap/api/v1/html` and `/_sitemap/api/v1/html/{group}`, the contract planned in 33-04.
- 33-04 is not built yet, so these calls run against fixtures. The same is true of the SEO plugin's `POST /registry/routes` (33-05): 33-03 and 33-05 code had not landed in the plugins when this plan ran.
## Performance
- **Duration:** about 27 min (2026-11-04T10:37:49Z to 11:04:32Z)
- **Tasks:** 3 (tracer, then 2 TDD tasks)
- **Commits:** 7 in ../vue-seo-layer
- **Files:** 68 changed in ../vue-seo-layer
## Task Commits
All in /media/nvme/dev/golem15/summercms.io/summercms/vue-seo-layer (branch main, not pushed):
1. **Task 1 (tracer):** `b4680af` feat: the build fails when an indexable route renders only in the browser (tracer)
2. **Task 2:**
- A `9cc2cda` feat: noindex for declared and signed-in routes
- B `3abc986` feat: route report and drift check at server start
3. **Task 3:**
- A `ebb0c80` feat: breadcrumbs component
- B `f2d13d6` feat: pagination component and composable
- C `aee6957` feat: HTML sitemap pages and footer link
- D `b051bda` docs: build guard, noindex routes and components
The tracer gate ran in interactive end-of-phase mode with automated checks only. Its `<verify>` was re-run (tests plus `guard:check`) and passed before expansion.
## Accomplishments
### Build guard (D-70)
- `lib/guard.ts` holds the pure checks: `isNoindex` and `patternCovers` (Nitro route-rule semantics), `pagePattern`, `flattenPages`, `findOffenders` and `guardMessage`.
- The module collects every merged route rule from the final Nitro config, plus the `.client.vue` pages. It refuses `experimental.inlineRouteRules`.
- A production build throws `[vue-seo-layer] indexable routes must render on the server (D-70): …`.
- Each declared noindex pattern gets an X-Robots-Tag route rule.
- `testing/guard-check.mjs` builds four fixtures (about 14 s in total) and checks the header on the noindex fixture.
### Noindex routes (D-23, D-21)
- The module adds `requiresAuth` and `seo` to Nuxt's page-meta extraction keys.
- The app plugin `seo-route-robots` applies the robots meta tag (priority above the CMS head entry) and, during SSR, the header once navigation is done.
- Staging keeps the CMS's noindex.
### Route report and drift check (D-33, D-20c)
- `#seo-routes` is written from the resolved pages at bundle time.
- `seo-route-report` posts the static paths once per process.
- `seo-drift` compares URL patterns, pagination and HTML-sitemap paths with the site answer and logs one warning per mismatch.
- `GET /api/__seo__/site` and `useSeoSite()` share the cached site answer.
### Components (D-86, D-40 to D-42, D-34, D-71)
- `<SeoBreadcrumbs>`: one trail per page, claimed by the first instance per path.
- `<SeoPagination>` with `usePagination()`: hrefs in the CMS form, head prev/next links, and `%pages%` filled in the CMS title and description (`useCmsSeo` with `seoFillPages`).
- HTML sitemap pages, registered per locale through `extendPages` and rendering the overridable global `SeoHtmlSitemapPage`. They load data from `GET /api/__seo__/sitemap`.
- `<SeoSitemapLink>`.
- Default styles for L1 to L3.
### README
The README documents everything above.
## Compatibility notes for v0.1.1 consumers
All new behaviour is additive or tied to a declaration or a v0.2.0 backend answer:
- **v0.1.1 options:** every v0.1.1 option, runtime key and exported helper keeps its meaning. The v0.1.1 smoke suite (`testing/expect.txt`, 31 checks against a backend without `/site`) passes unchanged on every run.
- **Build guard:** it only fails an app with an indexable `ssr: false` route, a `.client.vue` page or a global `ssr: false`.
- The existing consumer has none of these and builds.
- The demo app's `/p/**` and `/presentations/**` must be declared in `seo.noindexRoutes` when it moves to v0.2.0, as 33-12 plans. Otherwise its build fails by design.
- `nuxt prepare` and `nuxt dev` only warn, so an install never fails.
- **Noindex:** applied only to routes the app declares, and to pages whose meta sets `requiresAuth: true` or `seo.robots`. An app that already uses `requiresAuth` for its own guard gets `noindex, nofollow` on those pages, which is the intended D-23 behaviour.
- **Route report:**
- It needs a token. It falls back to `NUXT_SEO_NOTFOUND_TOKEN`, so an app that set that token will start posting the report.
- A v0.1.1-era backend answers 404, which is logged once and not retried.
- `seo.routeReport: false` switches it off.
- **HTML sitemap pages:** registered by default at `/mapa-strony` and `/sitemap`.
- **If the app already has a page at one of these paths:** the app's page is kept.
- **CMS has no HTML sitemap** (no site answer, or the sitemap off or without a path for the locale): the pages answer 404. In the existing consumer these paths answered 404 before as well, through the journal's `/:category` route.
- **Backend unreachable since start:** they answer 503 instead of 404.
- The layer also statically claims these two paths ahead of a dynamic route such as `/:category`.
- `seo.htmlSitemap: false` registers none.
- **New global names:** components `SeoBreadcrumbs`, `SeoPagination`, `SeoSitemapLink`, `SeoSitemapList` and `SeoHtmlSitemapPage`; composables `usePagination`, `useSeoPages` and `useSeoSite`; utils prefixed `seo*`. None of them collides with the journal, menu or FAQ layers.
- **Consumer check:** the existing consumer app was copied to a scratch directory with `node_modules/vue-seo-layer` replaced by `git archive` of aee6957. The real repository was not touched. Results:
- `nuxt build` passed, guard included.
- `smoke:ssr` 52/52, `smoke:ga` 2/2, `npm test` 28/28.
## Decisions Made
See key-decisions in the frontmatter.
## Deviations from Plan
### Adapted to the actual repository and Nuxt
**1. Guard timing.**
- **Plan:** throw in `nitro:config`.
- **What happens in Nuxt 4.4.8:** `nitro:config` fires before `pages:resolved`, so the pages are not known there.
- **What I did:**
- `nitro:config` only adds the noindex header rules.
- The rules are read from the final Nitro config (`nitro:init`).
- The check runs in `pages:resolved`, with `nitro:build:before` as the fallback.
- The acceptance grep still prints the two hook lines.
**2. Dev and prepare only warn.** Throwing in `nuxt prepare`, which pnpm runs on install, would break installs. Production `build` and `generate` fail as planned.
**3. Helper names are prefixed.**
- **Plan names:** `paginationWindow`, `pageHref`, `breadcrumbClaim`.
- **Why changed:** vue-journal-layer already auto-imports a `paginationWindow` with another return shape. A second auto-import of that name in the same app would shadow it.
- **What I did:** the files keep the plan's names, and the exports are `seoPaginationWindow`, `seoPageHref` / `seoPageNumber` and `seoClaimBreadcrumbs` / `seoReleaseBreadcrumbs`.
**4. Extra files.** Each was split out of a planned file or task:
- `lib/options.ts` and `server/lib/{drift,routeReport,htmlSitemap}.ts`: pure parts, so they can be unit-tested.
- `app/utils/sitePath.ts`: same-origin URLs become paths; anything that is not http(s) is never a link.
- `app/components/Seo/SitemapList.vue`: the recursive category tree.
- `server/seo-routes.d.ts`: types for `#seo-routes`.
- `tests/routes.test.ts` and `tests/htmlSitemap.test.ts`.
**5. Fixture site answer.** `testing/fixtures/seo/site.json` changed its post pattern from `/blog/:slug` to `/posts/:slug`. The playground serves posts at `posts/[slug].vue`, while `/blog/<slug>` is rendered by the root catch-all, which by design does not count for the drift check. Only the drift check reads `routes`.
**6. Playground HTML sitemap paths.** The playground sets `htmlSitemap.paths` to `{pl: '/mapa-strony', en: '/en/sitemap'}`, matching the 33-07 fixture site answer. The layer default stays pl `/mapa-strony`, en `/sitemap`.
**7. Fixture for the "/blog with one page" case.** The blog listing takes `?pages=N`. "One page" is `/blog?pages=1`, because the fixture's `/blog` has 14 pages.
**8. HTML sitemap behaviour beyond the plan:**
- **Breadcrumbs:** the overview's trail comes from the resolver, as on any page.
- **`?page=1`:** the 301 is enforced in the layer page, since the resolver does not know these pages.
- **Path pagination form:** an extra route `<path>/:group/<segment>/:page` is registered.
- **Gating:** the pages answer only while the site answer has the HTML sitemap on with a path for the locale.
**9. [Rule 1 - Bug] `setResponseHeader` is not auto-imported in app code.**
- **Found during:** the Task 2 smoke (`/konto` answered 500).
- **Fix:** the header is set with `useResponseHeader` inside `nuxtApp.runWithContext`.
- **Files:** app/plugins/seo-route-robots.ts. Fixed before commit 9cc2cda.
**10. [Rule 1 - Bug] The router marked every query variant as the active page.**
- **Found during:** a Task 3 probe. NuxtLink's active match ignores the query, so every `/blog?page=N` link carried `aria-current="page"`.
- **Fix:** pagination and breadcrumb links render through NuxtLink's `custom` slot. They still navigate on the client, and only the current item carries `aria-current`. Fixed before commit f2d13d6.
**11. [Rule 2 - Security] Non-http(s) sitemap URLs.** A `javascript:` URL from the sitemap API renders as text, never as a link. The smoke covers it with a fixture entry.
**12. Smoke expectations adjusted to real markup:**
- **aria-current count:** `aria-current="page"` appears twice on `/blog?page=5` (the current page and the breadcrumbs' last item).
- **Payload:** the raw `%pages%` stays in the payload, so the check targets the title and description tags.
**13. Commit splits:**
- Task 2 A/B and Task 3 A/B/C share files.
- Intermediate versions of those files were staged with `git update-index`.
- Each staged tree was checked out into a scratch directory and passed `npm run test`, `build:playground` and `smoke:ssr` there before its commit.
### TDD gate
- Tests were written alongside each unit before running (guard, routes/drift/report, window/href/claim, htmlSitemap).
- **RED observed:**
- `pagePatterns` (a `?` stripped as a query, fixed in lib/guard.ts before the Task 1 commit).
- The smoke's `/konto` 500 (deviation 9).
- No separate RED commits, because the plan requires `npm run test` green at every commit (same as 33-07).
## Deferred Issues
- **The `scripts/check-phase33.sh --layers` stage cannot pass.**
- **Cause:** its `npm_vitest` step demands a vitest summary, while all four layers run `node --test` TAP ("refuse: no all-passing vitest summary", `test=0 detect=3`).
- **What I ran instead:** every step of the stage by hand: unit tests, playground builds and smokes for all four layers, and `guard-check.mjs`. All passed.
- **Logged in:** deferred-items.md, for a gate fix outside this plan.
- **No typecheck script.** The layer has no typecheck script, and its devDependencies lack `vue-tsc`. Types were not machine-checked, as in 33-07. The build (vite + oxc) compiled every file.
## Known Stubs
None. The sitemap HTML API (33-04) and the page registry (33-05) are not built yet. The layer code follows their planned contracts and is covered by fixtures, so it does not depend on stubs.
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: new-endpoint | ../vue-seo-layer/server/api/__seo__/site.get.ts | Public GET /api/__seo__/site returns the backend's public site answer (cached); no-store, noindex, never route-cached |
| threat_flag: proxy | ../vue-seo-layer/server/api/__seo__/sitemap.get.ts | Public GET /api/__seo__/sitemap proxies the sitemap HTML API on the server-only backendBase; locale, group slug and page are checked by regex before use, only these reach the backend, the answer is reduced to known fields (T-33-38) |
| threat_flag: outbound-token | ../vue-seo-layer/server/plugins/seo-route-report.ts | The route-report token (server-only runtime config) is sent only to the configured apiBase (T-33-36) |
## Self-Check: PASSED
- **Files:** all key files listed above exist in ../vue-seo-layer.
- **Commits:** b4680af, 9cc2cda, 3abc986, ebb0c80, f2d13d6, aee6957 and b051bda are on main in ../vue-seo-layer (7 since 6636cde).
- **Unit tests:** `npm run test` 106 pass, 0 fail.
- **Smoke:** `npm run smoke:ssr` passed all seven runs (31, 64, 11, 11, 7, 3 and 7 checks).
- **Purge:** `npm run purge:check` 18 + 53 checks.
- **Guard:** `npm run guard:check` 16 checks.
- **Other layers:** the remaining steps of the gate's layers stage passed: journal, menu and FAQ unit tests, playground builds and smokes.
- **Acceptance greps:**
- The D-70 message is in lib/guard.ts.
- `nitro:config` and `pages:resolved` appear once each in seo-module.ts.
- `requiresAuth` is in seo-route-robots.ts and `drift:` in seo-drift.ts (the message prefix itself lives in server/lib/drift.ts).
- `registry/routes` in seo-route-report.ts prints two lines, not the planned one: the header comment and the call.
- `aria-current` is in Breadcrumbs.vue and Pagination.vue.
- No `ClientOnly` or `onMounted` in the components and pages.
- expect-seo.txt has `count=<nav class="seo-breadcrumbs":1`.

View File

@@ -0,0 +1,502 @@
---
phase: 33-seo-output-audit-and-content
plan: 09
subsystem: vue-journal-layer, vue-menu-layer, vue-faq-layer, vue-seo-layer, sm-journal-plugin
tags: [nuxt-layer, seo-layer, headings, h1, post-card, body-links, autolink, outbound, breadcrumbs, pagination, itemlist, faqpage, purge, related-posts]
requires:
- phase: 33-08
provides: vue-seo-layer components (SeoBreadcrumbs, SeoPagination, usePagination), useSchemaNode, labels, seo.links.newTabHint, seo.pagination, the shared purge route
- phase: 33-07
provides: vue-seo-layer runtime (resolve middleware, useSeoAnswer, useCmsSeo, one JSON-LD graph, smoke grammar)
- phase: 33-02
provides: content_h1_to_h2 on GET /posts/{slug} and every GET /categories row; the Journal policy keeps rel nofollow/sponsored/ugc and alt=""
provides:
- vue-seo-layer app/utils/bodyLinks.ts (autolink, applyOutbound, imageAttrs)
- vue-journal-layer on vue-seo-layer without @nuxtjs/seo; one H1 in both Journal H1 modes; journal.postTitleTag and journal.breadcrumbs
- renderJournalBody (L7 order), gateJournalHtml/sanitizeJournalHtml demoteH1, rel token policy
- one link per post card (headingLevel 2 | 3), SeoBreadcrumbs on journal pages, JournalPagination as SeoPagination, path-form listing routes, pillar text on page 1, ItemList nodes
- vue-menu-layer and vue-faq-layer on vue-seo-layer without purge copies; FaqBlock headingLevel 0 and schema (FAQPage node)
- sm-journal-plugin golem15.journal.related_mode / related_count (opt-in scored related posts, previous_in_category / next_in_category)
affects: [33-10, 33-11, 33-12, 33-13, 33-14]
actuals:
tokens: 40100
tasks: 4
commits: 13
plan_head_before:
vue-seo-layer: b051bda0809b9a8ca58f2c55c55d12d6477e8127
vue-journal-layer: 1dd31760601e4bbbe93033b5aba6c5edb2c1bef3
vue-menu-layer: ef3a090647ac994fa920baa48464edcd8338a77f
vue-faq-layer: 1f23340a2f8bc14ac3bcd8819485dc13eca1fda3
sm-journal-plugin: 0edf6e1b67d4f7d8f62980e30d52292cce94faf3
plan_head_after:
vue-seo-layer: 7af91fc
vue-journal-layer: adcea4d
vue-menu-layer: 8b5da67
vue-faq-layer: f7ec4fe
sm-journal-plugin: ee3cb26
tech-stack:
added: []
patterns:
- "A content layer extends vue-seo-layer through a link dependency during development (P33-33); 33-14 swaps it for the git tag pin"
- "Body link steps live in vue-seo-layer (pure, auto-imported); the journal gate takes them as injected functions, so its node tests never import across packages"
- "Smoke checks of page structure: headings=strict (one h1, no skipped level) and cardlinks=N, outside <script> elements"
key-files:
created:
- ../vue-seo-layer/app/utils/bodyLinks.ts
- ../vue-seo-layer/tests/bodyLinks.test.ts
- ../vue-journal-layer/app/composables/useJournalItemList.ts
- ../vue-journal-layer/testing/fixtures/acme/seo/resolve.json
- ../vue-journal-layer/testing/fixtures/acme/seo/site.json
- ../vue-journal-layer/testing/expect-acme-title-h1.txt
- ../vue-journal-layer/testing/expect-acme-title-p.txt
- ../vue-journal-layer/testing/expect-acme-hint-off.txt
- ../vue-journal-layer/testing/expect-acme-breadcrumbs-off.txt
- ../vue-faq-layer/app/utils/faqSchema.ts
- ../vue-faq-layer/tests/faqSchema.test.ts
- ../sm-journal-plugin/classes/related.go
- ../sm-journal-plugin/related_media_test.go
modified:
- ../vue-journal-layer/package.json, pnpm-lock.yaml, nuxt.config.ts, lib/journal-module.ts
- ../vue-journal-layer/app/utils/{htmlGate,seo,postView,types,routes,pagination,view}.ts
- ../vue-journal-layer/app/components/Journal/{PostBody,PostCard,PostList,RelatedPosts,Pagination,CategoryHeader}.vue
- ../vue-journal-layer/app/journal-pages/{PostPage,PostIndexPage,CategoryPage,TagPage,AuthorPage,SearchPage}.vue
- ../vue-journal-layer/app/assets/css/{journal-tokens,journal-base}.css
- ../vue-journal-layer/testing/{smoke-ssr,fixture-api,nuxt-server}.mjs, expect-acme.txt, fixtures/acme/{posts,categories}.json
- ../vue-journal-layer/tests/{htmlGate,seo,routes,pagination,postView,embeds}.test.ts, tests/fixtures/editor-corpus.json
- ../vue-journal-layer/.playground/nuxt.config.ts, .playground/app/app.vue, README.md
- ../vue-menu-layer/package.json, pnpm-lock.yaml, nuxt.config.ts, .playground/nuxt.config.ts, testing/smoke-ssr.mjs, README.md
- ../vue-faq-layer/package.json, pnpm-lock.yaml, nuxt.config.ts, app/components/Faq/Block.vue, .playground/nuxt.config.ts, .playground/app/app.vue, testing/smoke-ssr.mjs, testing/expect.txt, README.md
- ../vue-seo-layer/README.md
- ../sm-journal-plugin/controllers/api/posts.go, config/config.yaml, README.md
deleted:
- ../vue-journal-layer/server/api/__sitemap__/journal.ts, app/utils/sitemap.ts, tests/sitemap.test.ts
- ../vue-journal-layer/server/api/__site__/cache/purge.post.ts, server/lib/siteCachePurge.ts, server/plugins/site-cache-purge.ts, tests/sitePurge.test.ts
- the same four purge files in ../vue-menu-layer and ../vue-faq-layer
key-decisions:
- "Layer breaking changes approved, option A (Jakub, 2026-11-04): journal drops @nuxtjs/seo and its sitemap source; the three layers extend vue-seo-layer; one link per card, breadcrumbs on by default, related titles h3"
- "P33-33 as planned: \"vue-seo-layer\": \"link:../vue-seo-layer\" in each layer's dependencies, lockfiles updated by pnpm install; 33-14 swaps it for the git tag pin"
- "The deprecated POST /api/__journal__/cache/purge keeps its own helpers (app/utils/siteCache.ts): a bare import of vue-seo-layer's .ts library from a server route would be externalized by Nitro in a git-installed app (Node does not strip types under node_modules)"
- "The body link steps are injected into the journal's renderJournalBody by PostBody (auto-imported from vue-seo-layer), so htmlGate stays pure and its node tests import nothing from another package"
- "Auto-links within one text are taken in document order (longer phrase first at the same place) up to autolink_max; each phrase and each URL once"
- "Post page neighbours: the in-category pair when the Journal answers at least one, else the site-wide pair"
- "Scored related posts: posts sharing nothing are never related; in-category neighbours keep previous_post/next_post's direction (previous = nearest newer)"
- "Page-less apps that extend vue-seo-layer set seo.htmlSitemap false (the menu and FAQ playgrounds do)"
patterns-established:
- "Journal smoke grammar: count=, header=, noheader=, headings=strict, cardlinks=N, resolves PATH N; the fixture API also answers the SEO resolve and site endpoints"
- "Cross-layer check: scratch app outside the repositories with link dependencies, fixture APIs of all three layers, the journal smoke harness"
requirements-completed: [SC-2, D-97, D-50, D-52, D-80, D-81, D-82, D-83, D-71, D-86, D-40, D-41, D-43]
coverage:
- id: D1
description: "The journal layer extends vue-seo-layer without @nuxtjs/seo: one canonical and one JSON-LD script per page, the CMS title wins, the post's own title and description only without a CMS answer"
requirement: "D-97"
verification:
- kind: integration
ref: "vue-journal-layer pnpm smoke:ssr (expect-acme.txt tracer lines: count=rel=\"canonical\":1, count=application/ld+json:1, count=<title>:1, /blog/uncategorised-note fallback)"
status: pass
- kind: unit
ref: "tests/seo.test.ts (cmsHeadPresent, journalSiteOrigin)"
status: pass
human_judgment: false
- id: D2
description: "Exactly one H1 in both Journal H1 modes: title h1 and body h1 demoted while content_h1_to_h2 is on; title p.journal-post__title and body h1 kept while off; postTitleTag h1/p give the documented two and zero H1"
requirement: "D-50"
verification:
- kind: integration
ref: "expect-acme.txt (/blog/heading-on, /blog/heading-off), expect-acme-title-h1.txt, expect-acme-title-p.txt"
status: pass
- kind: unit
ref: "tests/htmlGate.test.ts (demoteH1), tests/seo.test.ts (journalPostTitleTag)"
status: pass
human_judgment: false
- id: D3
description: "Heading convention on every fixture page (one h1, no skipped level), cards h2 / h3 under related, category pillar text follows the category row's setting, page >= 2 suffix"
requirement: "D-52"
verification:
- kind: integration
ref: "expect-acme.txt headings=strict lines (16 count=<h1:1 lines), /blog/category/news and /blog/category/plain"
status: pass
human_judgment: false
- id: D4
description: "One link per post card (title only, no read-more, image not a link), stretched-link CSS with the focus ring on the card"
requirement: "D-80"
verification:
- kind: integration
ref: "expect-acme.txt cardlinks=1 on every listing and post page, notcontains=journal-post-card__more"
status: pass
- kind: other
ref: "journal-base.css review (stretched link, :has focus ring)"
status: pass
human_judgment: true
- id: D5
description: "Body links: auto-links in document order up to autolink_max, never in headings or to the page itself; outbound rel kept plus nofollow/sponsored; target, noopener and hint only while new_tab is on, no hint with newTabHint false; images lazy/async with alt=\"\" kept"
requirement: "D-82, D-83, D-71"
verification:
- kind: unit
ref: "vue-seo-layer tests/bodyLinks.test.ts (21 tests, including quotes, entities, javascript: and protocol-relative URLs refused)"
status: pass
- kind: unit
ref: "vue-journal-layer tests/htmlGate.test.ts (rel tokens, renderJournalBody order)"
status: pass
- kind: integration
ref: "expect-acme.txt (hello-acme, heading-off), expect-acme-hint-off.txt"
status: pass
human_judgment: false
- id: D6
description: "SeoBreadcrumbs at the top of journal pages, none with journal.breadcrumbs false (the layout's instance renders the trail, BreadcrumbList unchanged)"
requirement: "D-86"
verification:
- kind: integration
ref: "expect-acme.txt breadcrumb lines, expect-acme-breadcrumbs-off.txt"
status: pass
human_judgment: false
- id: D7
description: "JournalPagination as SeoPagination with journal class names (first, last, gap items, head prev/next); path-form routes registered for the path pagination form; pillar text on page 1 only"
requirement: "D-40, D-41, D-42"
verification:
- kind: integration
ref: "expect-acme.txt /blog/category/news?page=6 and ?page=2 lines"
status: pass
- kind: unit
ref: "tests/routes.test.ts (journalPagedRoutes), tests/pagination.test.ts (pageFromRoute)"
status: pass
human_judgment: false
- id: D8
description: "ItemList on index, category, tag and author pages and the FAQPage node of FAQ blocks, one JSON-LD script per page"
requirement: "D-43"
verification:
- kind: integration
ref: "expect-acme.txt ItemList lines; vue-faq-layer expect.txt (count=\"@type\":\"FAQPage\":1)"
status: pass
- kind: unit
ref: "tests/seo.test.ts (journalItemList), vue-faq-layer tests/faqSchema.test.ts"
status: pass
human_judgment: false
- id: D9
description: "Purge copies removed from the three layers; the shared route from vue-seo-layer and the deprecated journal route keep working"
requirement: "RESEARCH Pitfall 6"
verification:
- kind: integration
ref: "vue-journal-layer testing/purge-check.mjs (post and category) and purge-token-check.mjs; vue-seo-layer pnpm purge:check"
status: pass
human_judgment: false
- id: D10
description: "An app extending journal, menu and FAQ layers renders each page with one resolve call, one canonical and one JSON-LD script"
requirement: "SC-2"
verification:
- kind: integration
ref: "cross-layer scratch app (command and output below), 17 checks"
status: pass
human_judgment: false
- id: D11
description: "Journal related posts: default answer as before; scored mode ranks by shared tags and categories with count 3 to 6 and adds previous_in_category / next_in_category; drafts and future posts never shown to visitors; the layer renders the in-category neighbours"
requirement: "D-82"
verification:
- kind: integration
ref: "sm-journal-plugin TestRelatedDefaultUnchanged, TestRelatedScored, TestRelatedScoredCountClamped (Postgres)"
status: pass
- kind: integration
ref: "expect-acme.txt neighbour lines; tests/postView.test.ts (postNeighbours)"
status: pass
human_judgment: false
duration: 51min
completed: 2026-11-04
status: complete
---
**Layer breaking changes APPROVED: option A; versions confirmed: vue-journal-layer v0.8.0, vue-menu-layer v0.5.0, vue-faq-layer v0.5.0 (breaking minors, tagged in 33-14) (Jakub, 2026-11-04)**
# Phase 33 Plan 09: content layers on the shared SEO layer, heading convention, body links and opt-in related posts Summary
**vue-journal-layer, vue-menu-layer and vue-faq-layer now extend vue-seo-layer. Every page gets one CMS head, one canonical and one JSON-LD graph. The journal layer drops @nuxtjs/seo and keeps exactly one H1 in both Journal H1 modes. Its post cards have one link, its post bodies follow the CMS link and image rules, and it renders the CMS breadcrumbs and pagination. Journal gains opt-in scored related posts and category neighbours, and its default answer is unchanged.**
## Context rulings applied
- **Breaking changes:** option A as approved (see the line at the top).
- The non-breaking guarantees hold:
- the deprecated `POST /api/__journal__/cache/purge` still works;
- `postTitleTag: 'auto'` gives an h1 while the Journal setting is on or absent;
- FAQ `headingLevel` keeps its default of 2 (0 is new and opt-in);
- Journal's scored related posts are opt-in, and the default answer is the same as before (TestRelatedDefaultUnchanged, the API matrix tests).
- No package.json version was changed; 33-14 does that.
- **Framework:** no framework code changed (D-90), and no `summercms` requires were bumped.
- **No SEO code in Journal (D-96):** Journal imports no SEO plugin. All link and SEO logic is in vue-seo-layer.
- **How the layers reference vue-seo-layer:** P33-33 as planned. Each layer's package.json has `"vue-seo-layer": "link:../vue-seo-layer"`, and `pnpm install` updated the lockfiles.
- 33-14 must swap this for the git tag pin before tagging.
- No package came from the registry ("downloaded 0"). The lockfile diffs only move peer resolutions.
- **Not pushed or tagged.** The consumers (grzybyfunkcjonalne, demo, the summercms.io changelog) were not touched.
## Performance
- **Duration:** about 51 min (2026-11-04T12:28:32Z to 13:19:06Z)
- **Tasks:** 4 (a tracer, two TDD tasks and one auto task)
- **Commits:** 13 across 5 repositories (measured with `git rev-list --count <before>..HEAD` per repository)
## Task Commits
All on the default branch, not pushed:
**vue-journal-layer** (1dd3176..adcea4d, 7 commits)
1. Task 1 (tracer): `289d031` feat!: render the post page on the shared SEO layer with one H1 in both Journal H1 modes (tracer)
2. Task 2:
- A `1010a60` feat: body links, outbound rules and image attributes in the post body
- B `51e5d67` feat!: one link per post card and the heading convention
- C `98904b8` feat: breadcrumbs, CMS pagination and pillar content on page one
- D `642c25a` feat: ItemList nodes on listing pages
3. Task 3: `ed50826` docs: README for the SEO layer
4. Task 4: `adcea4d` feat: category neighbours on the post page
**vue-seo-layer** (b051bda..7af91fc, 2 commits)
- Task 2: `db44ca4` feat: body link utilities (auto-links, outbound rules, image attributes)
- Task 3: `7af91fc` docs: body link utilities and the app-without-pages note
**vue-menu-layer** (ef3a090..8b5da67, 1 commit)
- Task 3: `8b5da67` feat!: extend the SEO layer and drop the copied purge route
**vue-faq-layer** (1f23340..f7ec4fe, 2 commits)
- Task 3:
- A `cb321e9` feat!: extend the SEO layer and drop the copied purge route
- B `f7ec4fe` feat: FAQPage node and widget headings
**sm-journal-plugin** (0edf6e1..ee3cb26, 1 commit)
- Task 4: `ee3cb26` feat: opt-in scored related posts and category neighbours
The untracked `go.work.sum`, which belongs to another session, was left alone.
The tracer gate ran in interactive end-of-phase mode with automated checks only. Its checks (unit tests, playground build, smoke, both purge checks) passed on the committed tree before expansion.
## Accomplishments
### Journal on the SEO layer (Task 1; D-97, D-50, P33-33 to P33-36)
- `extends: ['vue-seo-layer']`, and `@nuxtjs/seo` is gone from the modules, the dependencies and the `ogImage`, `seo` and `sitemap` keys.
- The journal sitemap source and the copied shared purge route, library, plugin and tests are removed.
- The post title element is decided by `journalPostTitleTag(cfg.postTitleTag, post.content_h1_to_h2)`. While the setting is on, the body is sanitized with `demoteH1` (in both the payload and the sink).
- The fallback meta (post title, excerpt, featured image, article times) applies only while `cmsHeadPresent(answer)` is false.
- `useSiteConfig()` is replaced by `journalSiteOrigin(answer.url, request origin)` in PostPage and AuthorPage.
- The search page is marked noindex through page meta (`seo: { robots: 'noindex, follow' }`), so vue-seo-layer sends both the meta tag and the header.
- New tokens `--journal-post-title-size`, `--journal-post-title-weight` and `--journal-post-title-line-height`; `.journal-post__title` is styled by its class.
### Body links, cards, headings, breadcrumbs, pagination, ItemList (Task 2; D-80 to D-83, D-71, D-52, D-86, D-40 to D-43)
- **vue-seo-layer `bodyLinks.ts`:**
- `autolink` works over text nodes only, with a stack of open tags and an entity guard.
- `applyOutbound` handles rel tokens, target, noopener and the hint inserted before `</a>`.
- `imageAttrs` adds the image attributes.
- Everything works on sanitize-html output, with escaped values.
- **Journal `renderJournalBody`** runs in the L7 order. The steps are injected by PostBody.
- The sanitizer keeps a `rel` made only of the tokens nofollow, sponsored and ugc, mirroring the Go regex exactly. This is the 33-02 follow-up.
- `alt=""` was already kept.
- The editor corpus was copied again from the plugin (17 entries).
- **PostCard:** the title link is the only anchor, the image sits in a `div`, the read-more link is gone, and `headingLevel` takes 2 or 3. The stretched link uses `::after`, and the focus ring is on the card (`:has`). RelatedPosts renders its cards with `heading-level="3"`.
- **Breadcrumbs:** `<SeoBreadcrumbs>` at the top of the post, index, category, tag and author pages while `journal.breadcrumbs` is on.
- **JournalPagination** wraps `<SeoPagination class-prefix="journal-pagination">` with the journal labels.
- **Path pagination form:** with `seo.pagination.form` set to `path`, the module registers `<listing>/<segment>/:page` routes, and the pages read the page through `pageFromRoute`.
- **CategoryHeader:** the pillar text renders on page 1 only, demoted by the category row's `content_h1_to_h2`.
- **ItemList:** `useJournalItemList` adds the node to the index, category, tag and author pages.
### Menu and FAQ layers (Task 3; D-52, D-43, D-71)
- Both extend vue-seo-layer through the link dependency. Their purge copies are removed with `git rm`.
- Their smokes point `NUXT_SEO_API_BASE` at the fixture API, which answers 404, so the layer fails open.
- **FaqBlock:**
- `headingLevel: 0` renders `<p class="faq-block__title">` with the same id and `aria-labelledby`.
- The `schema` prop (default true) adds a FAQPage node through `faqSchema(faq, pageUrl)`: `@id` `<url>#faq`, with the answers as plain text.
- The FAQ smoke harness gained `count=` and repeatable options.
- README updates in all four layers (upgrade notes in the journal, menu and FAQ layers).
### Opt-in related posts (Task 4; D-82, P33-44)
- **Config:** `golem15.journal.related_mode` (`category` | `scored`, default `category`) and `golem15.journal.related_count` (3 to 6, default 3, clamped) are in `config/config.yaml`.
- **Code:** `classes.ReadRelatedSettings`, `ScoredRelatedPosts` (one scoring query), `PrimaryCategoryID` and `CategoryNeighbour`.
- **Show handler:** uses the scored ranking only in scored mode, and only then adds `previous_in_category` and `next_in_category`.
- **Layer:** `postNeighbours` prefers the in-category pair when the Journal answers one.
## Cross-layer check (Task 3)
**Scratch app:** a scratch app outside the repositories, in `/tmp/claude-1000/-media-nvme-dev-golem15-summercms-io-summercms-summercms-go/cc746d7e-76ce-49f4-ae43-0e1debb2bbea/scratchpad/cross-layer-app`. Nothing from it is committed.
- `package.json` has nuxt 4.4.8 and vue 3.5.35, plus link dependencies on vue-journal-layer, vue-menu-layer and vue-faq-layer.
- `nuxt.config.ts` sets `extends: ['vue-journal-layer', 'vue-menu-layer', 'vue-faq-layer']` and the playground's i18n.
- `app.vue` renders `<MenuNav code="main">`, `<NuxtPage>` and a `<FaqBlock slug="acme" :heading-level="0">` widget.
**How it runs:** `run-cross.mjs` starts the menu and FAQ fixture APIs, then runs the journal harness:
```
node vue-journal-layer/testing/smoke-ssr.mjs --output .output --fixtures vue-journal-layer/testing/fixtures/acme --expect expect-cross.txt --env NUXT_MENU_API_BASE=<menu fixture> --env NUXT_FAQ_API_BASE=<faq fixture>
```
**What `expect-cross.txt` checks:**
- For 8 pages (`/blog/hello-acme`, `/blog/heading-on`, `/blog/heading-off`, `/blog`, `/blog?page=2`, `/blog/category/news`, `/blog/tag/release` and `/blog/author/jane-doe`):
- one `application/ld+json` script on every page;
- one `rel="canonical"` on the five pages the CMS fixture answers;
- the menu, the FAQ widget title and the FAQPage node merged into the CMS graph.
- After each page, `resolves <path> 1`.
- At the end, `resolves * 8`.
**Output** (`pnpm exec nuxt build`, then `node run-cross.mjs`, on the final layer trees):
```
build=0
smoke-ssr: ok (17 checks)
```
That is exactly one resolve call per page render.
## Consumer migration notes (for 33-12 and 33-13)
Consumers stay pinned to their current tags until they are migrated. When an app moves to vue-journal-layer v0.8.0, vue-menu-layer v0.5.0 and vue-faq-layer v0.5.0:
**Config and modules**
- Remove `site: { url, name }` and the `@nuxtjs/seo` keys: `ogImage`, `seo.canonicalQueryWhitelist`, `sitemap`, `robots` and `schemaOrg`.
- Set `NUXT_SEO_API_BASE`, or `seo: { cms: false }` for a site without the SEO plugin (planned for summercms.io in 33-12).
- An app that calls `useSiteConfig()`, `useSchemaOrg()` or other `@nuxtjs/seo` composables must add the module itself or move off those composables. An app that adds the module itself gets a second canonical and graph next to the CMS's.
- A site without the SEO plugin loses the `| site.name` title suffix in fallback titles; set `app.head.titleTemplate`.
**Sitemaps and purge**
- Sitemaps now come from the sitemap plugin through vue-seo-layer's root files. `/api/__sitemap__/journal` is gone.
- The purge environment stays the same (`NUXT_CACHE_PURGE_TOKEN`, `NUXT_CACHE_PURGE_ALLOW_PROXIED`, the deprecated `NUXT_SITE_CACHE_*` names). The route is now vue-seo-layer's.
**Markup and CSS**
- **Post cards:**
- `.journal-post-card__more` and the image link are gone, and `.journal-post-card__image` is now a `div`.
- Overrides for those parts have nothing to style any more, and the whole card is clickable.
- Related post card titles are `h3`. CSS on `h2.journal-post-card__title` must target the class instead.
- **Post title:** with the Journal setting off, the title is a `p.journal-post__title`. Style the class or the `--journal-post-title-*` tokens, not `h1`.
- **Breadcrumbs:** they now appear at the top of journal pages. A layout that already renders breadcrumbs sets `journal.breadcrumbs: false`.
- **Pagination:** markup classes stay the same, plus `.journal-pagination__gap` and the page 1 and last-page items. Pagination links follow the CMS form.
- **FAQ:** FAQ blocks add a FAQPage node by default. A page with several FAQ blocks sets `:schema="false"` on all but one.
**Other**
- An app without pages that extends any of these layers sets `seo: { htmlSitemap: false }`. Otherwise every path answers 404 (deferred-items.md).
- The demo app's `/p/**` and `/presentations/**` need `seo.noindexRoutes` (33-08 note), which now comes through every layer.
## Decisions Made
See key-decisions in the frontmatter.
## Deviations from Plan
### Adapted to the actual repositories
**1. [Rule 3 - Blocking] The deprecated journal purge route keeps its own helpers.**
- **Plan:** import the purge library from vue-seo-layer.
- **Why changed:** Nitro externalizes a bare import (`vue-seo-layer/server/lib/siteCachePurge.ts`). In a git-installed app that file sits under node_modules, where Node does not strip types, so the server would fail to start.
- **What I did:** the route still uses `app/utils/siteCache.ts`, unchanged. vue-seo-layer's `seo-cache-purge` plugin already empties the SEO caches after it, so the route keeps working (purge-check).
**2. [Rule 3 - Blocking] `useSiteConfig()` was gone.**
- **Found during:** Task 1. It came from @nuxtjs/seo, and PostPage and AuthorPage used it.
- **Fix:** both use the CMS answer's origin, else the request origin (`journalSiteOrigin`).
- **Search page robots:** they came from nuxt-robots through a route rule and now come from page meta. The route rule and the sitemap exclude stay, for apps that add those modules.
**3. Smoke harness.**
- **Expectation lines removed:** the journal expect file dropped its sitemap lines, since the layer no longer serves a sitemap.
- **Fixture API:** answers the SEO resolve and site endpoints, and `resolveCount` was added.
- **Boot probe:** fetches `/_nuxt/` instead of `/`, as the SEO layer's does, so resolve counts stay exact.
- **New checks:** `headings=strict` and `cardlinks=N`. The plan names the rules but not a grammar.
- **Extra expectation files:** beyond the plan's `expect-acme-title-h1.txt`, there are `expect-acme-title-p.txt`, `expect-acme-hint-off.txt` and `expect-acme-breadcrumbs-off.txt`. The `smoke:ssr` script runs all five, and the plan's two verify commands still pass on their own.
**4. Playground changes.**
- The journal playground drops `site`, shows one post per category page (so the 12-page news category has gap items), and has a layout trail shown only while `journal.breadcrumbs` is off.
- The menu and FAQ playgrounds set `seo.htmlSitemap: false`; see deviation 7.
- The FAQ playground adds a `headingLevel` 0 widget.
**5. [Rule 2] The body pipeline takes its steps by injection.**
- **Plan:** "htmlGate runs the L7 order".
- **What I did:** htmlGate has `renderJournalBody(html, options, steps)`, and PostBody passes vue-seo-layer's auto-imported functions.
- **Why:** journal unit tests must not import `.ts` from another package; that breaks once the dependency is a git install (33-14). The order is unit-tested with recording steps.
**6. [Rule 1 - Bug] The FAQ and menu smokes read the default SEO base.** The smokes now point `NUXT_SEO_API_BASE` at the fixture API. Otherwise a local backend on :8096 could answer and make them nondeterministic. This touched `testing/smoke-ssr.mjs` in both layers, which the plan did not list.
**7. [Rule 3 - Blocking] The menu and FAQ playgrounds answered 404 on every path.**
- **Cause:** vue-seo-layer's HTML sitemap pages made Nuxt turn the router on in an app that has only `app.vue`.
- **Fix:** `seo: { htmlSitemap: false }` in both playgrounds, plus README notes in all three layers.
- **Logged in:** deferred-items.md, as a possible SEO-layer fix.
**8. A commit split folded back.**
- **What happened:** commit A (body links) first went in with a stale source-text assertion in `tests/embeds.test.ts`, which matched `expandEmbeds(sanitizeJournalHtml(` only. I had not re-run the unit tests after the last PostBody edit.
- **Fix:** a fixup commit, folded into A with a non-interactive autosquash before anything later was pushed or depended on it.
- **Check:** A's tree was then exported (`git archive`) and passed `npm run test` (182/182).
- **History:** every journal commit is green.
**9. [Rule 2] Extra commit in vue-seo-layer.** `docs: body link utilities and the app-without-pages note`: the plan lists `../vue-seo-layer/README.md` in Task 3 but no seo commit group there.
**10. Grep and test names.**
- `grep -n SeoPagination Pagination.vue` prints two lines, not one: the doc comment and the template.
- The plan's `TestJournalAPIMatrix` names no test. `journal_api_matrix_test.go` holds `TestJournalAPIShowNeighbors`, `TestJournalAPIMassAssignRedactor` and others, which I ran with `-run TestJournalAPI` and which pass. The related-posts commit does not touch that file.
- `posts_helpers.go` is unchanged: the new logic lives in `classes/related.go`.
**11. [Rule 2] An extra related-posts test, and its rules.**
- `TestRelatedScoredCountClamped` covers the 3..6 clamp and an invalid count.
- A post that shares nothing scores 0 and is never related.
- A future-dated published post is excluded alongside the planted draft (T-33-70).
### TDD gate
- **Task 2:** `tests/bodyLinks.test.ts` was written first.
- **RED:** the module was missing.
- **First GREEN run:** 20 of 21. One test failed because the limit was applied in table order; I changed it to document order and documented that.
- **Final:** 21 of 21. The FAQ `faqSchema` tests went RED then GREEN the same way.
- **Task 4:** `related_media_test.go` was written first.
- **RED:** the scored tests failed on the default ranking.
- **One correction on my side:** my expectation for `previous_post` / `next_post` was wrong. `siblingPost` answers previous as the nearest newer post, and I fixed the test before implementing.
- No separate RED commits, because the plan requires green tests at every commit (as in 33-07 and 33-08).
## Issues Encountered
- **The `scripts/check-phase33.sh --layers` stage still refuses** (`test=0 detect=3`, the vitest detector against `node --test` TAP; deferred-items.md, from 33-08). I ran every step of it by hand; the results are under Self-Check.
- **An off-mode category page has two `h1`.** A category whose row has `content_h1_to_h2` false and whose pillar text has an h1 shows two `h1` (the header and the pillar's). That is what the plan's rule produces; the fixture's `/blog/category/plain` asserts it, and the crawler (33-10) reports it.
- **vue-journal-layer `check-git-install.sh` needs updating in 33-14:**
- its lockfile check expects exactly one commit;
- its scratch app lacks the playground options the expectations use.
- Logged in deferred-items.md.
- **The journal fixture API's previous/next direction is the opposite of Go's.** This is pre-existing and logged.
## Known Stubs
None.
## Threat Flags
None beyond the plan's threat model.
- **T-33-39 and T-33-40:** autolink and applyOutbound only add escaped markup between tags of sanitized output. URLs are limited to site paths and http(s). target and noopener never come from stored HTML. Covered by unit tests.
- **T-33-70:** the scored and neighbour queries apply the published rule for visitors (TestRelatedScored).
- **T-33-SC:** the only new dependency is the first-party `vue-seo-layer` through a local link, and @nuxtjs/seo was removed. The lockfiles are committed.
## Self-Check: PASSED
- **Files:** every created file listed in key-files exists.
- **Commits:** all 13 commits are present in their repositories:
- vue-seo-layer db44ca4 and 7af91fc;
- vue-journal-layer 289d031, 1010a60, 51e5d67, 98904b8, 642c25a, ed50826 and adcea4d;
- vue-menu-layer 8b5da67;
- vue-faq-layer cb321e9 and f7ec4fe;
- sm-journal-plugin ee3cb26.
- **Unit tests:** vue-seo-layer 127/127, vue-journal-layer 187/187, vue-menu-layer 24/24, vue-faq-layer 14/14.
- **Builds:** all four playgrounds build.
- **Smokes:**
- vue-seo-layer `smoke:ssr`: seven runs (31, 64, 11, 11, 7, 3, 7);
- vue-journal-layer `smoke:ssr`: 84, 2, 2, 2, 2;
- vue-menu-layer 17;
- vue-faq-layer 14.
- **Purge and guard:** journal `purge-check` (post and category) 19/19 each and `purge-token-check` 53; vue-seo-layer `purge:check` 18 and 53, `guard:check` 16.
- **Cross-layer check:** 17 checks.
- **sm-journal-plugin:**
- `go vet ./...` clean, `go test -short ./...` green;
- full Docker `go test ./...` green (root package 50 s);
- `TestRelatedScored`, `TestRelatedDefaultUnchanged`, `TestRelatedScoredCountClamped` and the `TestJournalAPI*` matrix pass;
- editor `npm test` 244/244;
- editor bundle unchanged, so `check-dist.sh` was not needed.
- **Acceptance greps:**
- no `@nuxtjs/seo` in the journal package.json or nuxt.config.ts;
- `vue-seo-layer` appears in the package.json and nuxt.config.ts of all three layers;
- no tracked files under `server/lib`, `server/api/__site__` or `server/api/__sitemap__` in the three layers;
- `postTitleTag` in journal-module.ts and PostPage.vue;
- the three `bodyLinks` exports;
- no `journal-post-card__more` or `readMore` in PostCard.vue;
- 16 `count=<h1:1` lines;
- `content_h1_to_h2` in CategoryPage.vue and CategoryHeader.vue;
- `FAQPage` in faqSchema.ts;
- `related_mode` and `related_count` in classes/related.go and config/config.yaml;
- `previous_in_category` in PostPage.vue;
- the related-posts commit does not list journal_api_matrix_test.go.

View File

@@ -0,0 +1,365 @@
---
phase: 33-seo-output-audit-and-content
plan: 10
subsystem: seo
status: complete
tags: [sm-seo-plugin, site-audit, crawler, fetchguard, chromedp, conga, mcp, issues, crawls]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-01 descriptor facts (Tools, TopHeading, Images, Headings, Words, Parents); 33-05 sitemap filter, registry and the CMS issue report; 33-06 schema.Validate and the chromedp approval (v0.21.0)"
provides:
- "classes/crawl: the crawler (fetchguard client on the site host and its www twin, sitemap index and robots.txt seeds, two workers, settings delay and page limit, cancel), the C23 checks, fix routes, fingerprints, storage and recheck"
- "golem15_seo_crawls, golem15_seo_crawl_pages, golem15_seo_crawl_links, golem15_seo_issues, golem15_seo_issue_ignores (migration 202610280005)"
- "CMS-data kinds image_alt and h1_in_content from the content descriptors (classes.Service.ContentIssues), stored with each crawl as source cms"
- "Site audit (golem15.seo.issues) and Crawls (golem15.seo.crawls) screens with P7 issue_details and P6 crawl_summary"
- "Site audit settings tab (crawl_schedule, crawl_max_pages, crawl_delay, crawl_keep, generic_anchors; migration 202610280006), seo:crawl [--scheduled] and the 02:30 schedule entry"
- "MCP tools seo_start_crawl, seo_cancel_crawl, seo_list_crawls, seo_get_crawl, seo_delete_crawls, seo_list_issues (filters), seo_recheck_url, seo_ignore_issues, seo_unignore_issues"
- "Optional raw-versus-rendered comparison through github.com/chromedp/chromedp v0.21.0 (golem15.seo.crawl_chrome_path, crawl_render_max), guarded by resolver pinning and request interception"
affects: [33-11, 33-12, 33-13, 33-14]
actuals:
tokens: 81000
tasks: 4
commits: 2
plan_head_before: e245b54ad994554b4b7cf20ee8cc1ad53dd54f3d
plan_head_after: 835bf3f
sm_seo_plugin_head_before: d38049a9561d892b77f541266f9a7ef6d0086e81
sm_seo_plugin_head_after: b553fc2
sm_seo_plugin_commits: 8
tech-stack:
added:
- "github.com/chromedp/chromedp v0.21.0 (sm-seo-plugin only; with github.com/chromedp/cdproto v0.157.8)"
patterns:
- "A crawl finding names its fix route once (crawl.Route): the record type's fitting tool for content, else a fixed seo_ tool, else fix code with details.what"
- "Issues are keyed by a fingerprint (kind, url, locale, check): ignores survive crawls, a recheck and the pre-crawl CMS refresh keep the row (and id) of an issue found again"
- "The renderer is a seam (crawl.Renderer); tests inject one through a context (crawl.WithRenderer), like fetchguard.WithTransport for the crawler's requests"
key-files:
created:
- ../sm-seo-plugin/classes/crawl/crawler.go
- ../sm-seo-plugin/classes/crawl/fetch.go
- ../sm-seo-plugin/classes/crawl/parse.go
- ../sm-seo-plugin/classes/crawl/checks.go
- ../sm-seo-plugin/classes/crawl/links.go
- ../sm-seo-plugin/classes/crawl/orphans.go
- ../sm-seo-plugin/classes/crawl/store.go
- ../sm-seo-plugin/classes/crawl/fix.go
- ../sm-seo-plugin/classes/crawl/job.go
- ../sm-seo-plugin/classes/crawl/actions.go
- ../sm-seo-plugin/classes/crawl/render.go
- ../sm-seo-plugin/classes/crawl/render_chrome.go
- ../sm-seo-plugin/classes/crawl/compare.go
- ../sm-seo-plugin/models/crawl.go
- ../sm-seo-plugin/models/crawl_page.go
- ../sm-seo-plugin/models/issue.go
- ../sm-seo-plugin/models/crawl/columns.yaml
- ../sm-seo-plugin/models/crawl/fields.yaml
- ../sm-seo-plugin/models/issue/columns.yaml
- ../sm-seo-plugin/models/issue/fields.yaml
- ../sm-seo-plugin/updates/202610280005_create_golem15_seo_crawls.go
- ../sm-seo-plugin/updates/202610280006_add_golem15_seo_audit_settings.go
- ../sm-seo-plugin/controllers/issues.go
- ../sm-seo-plugin/controllers/crawls.go
- ../sm-seo-plugin/controllers/issues/config_list.yaml
- ../sm-seo-plugin/controllers/issues/config_form.yaml
- ../sm-seo-plugin/controllers/issues/config_filter.yaml
- ../sm-seo-plugin/controllers/issues/_issue_details.htm
- ../sm-seo-plugin/controllers/crawls/config_list.yaml
- ../sm-seo-plugin/controllers/crawls/config_form.yaml
- ../sm-seo-plugin/controllers/crawls/config_filter.yaml
- ../sm-seo-plugin/controllers/crawls/_crawl_summary.htm
- ../sm-seo-plugin/controllers/api/crawls.go
- ../sm-seo-plugin/schedule.go
- ../sm-seo-plugin/crawler_test.go
- ../sm-seo-plugin/crawl_site_test.go
- ../sm-seo-plugin/crawl_admin_test.go
- ../sm-seo-plugin/crawl_render_test.go
- .planning/notes/2026-10-28-chromedp-rendered-crawl.md
modified:
- ../sm-seo-plugin/classes/issues.go
- ../sm-seo-plugin/classes/partials.go
- ../sm-seo-plugin/classes/registry.go
- ../sm-seo-plugin/classes/settings_write.go
- ../sm-seo-plugin/controllers/api/issues.go
- ../sm-seo-plugin/controllers/api/settings.go
- ../sm-seo-plugin/controllers/admin_registry.go
- ../sm-seo-plugin/controllers/settings.go
- ../sm-seo-plugin/models/settings.go
- ../sm-seo-plugin/models/settings/fields.yaml
- ../sm-seo-plugin/admin_navigation.go
- ../sm-seo-plugin/jobs.go
- ../sm-seo-plugin/commands.go
- ../sm-seo-plugin/menu_item_types.go
- ../sm-seo-plugin/routes.go
- ../sm-seo-plugin/mcp.go
- ../sm-seo-plugin/operations.go
- ../sm-seo-plugin/operations_test.go
- ../sm-seo-plugin/seo_tab_test.go
- ../sm-seo-plugin/settings_test.go
- ../sm-seo-plugin/config/config.yaml
- ../sm-seo-plugin/lang/en/lang.yaml
- ../sm-seo-plugin/lang/pl/lang.yaml
- ../sm-seo-plugin/README.md
- ../sm-seo-plugin/plugin.yaml
- ../sm-seo-plugin/go.mod
- ../sm-seo-plugin/go.sum
- .planning/research/STACK.md
key-decisions:
- "chromedp pinned exactly at v0.21.0 (Jakub 2026-11-04, recorded in 33-06); the decision note was committed before the go.mod change"
- "Chrome's --host-resolver-rules list the site hosts first and MAP * ~NOTFOUND last: Chrome applies the first matching rule, and a leading catch-all made the site host fail with ERR_NAME_NOT_RESOLVED in Chromium (P33-55 had it leading)"
- "One address per host in the resolver rules, IPv4 first (localhost resolving to ::1 first refused the IPv4 test server)"
- "page_status covers errors other than 404/410 (those are broken_link when linked, sitemap_error when listed), so each planted page has exactly one kind"
- "A record's CMS-known links are its primary parent's address (the breadcrumb link): descriptors carry no body links"
- "broken_link, page_status and hreflang_error name seo_create_redirect; sitemap_missing names seo_create_page (seo_set_url_seo for a record page); publisher and site nodes name seo_update_settings"
- "GET /_seo/api/v1/issues and seo_list_issues default to status open (ignored issues left out; ignored or all on request); without ignores the Phase 32 answer is unchanged"
- "Before any crawl the issues list refreshes the stored CMS-data issues on every read; after the first crawl it shows the newest finished, failed or cancelled crawl's issues"
- "Errors-first ordering comes from the Site audit's ListExtendQuery (rank column); the severity column itself is not sortable"
- "List toolbar actions get their own admin operation kind (toolbar_action) in AdminOperations and its parity test"
patterns-established:
- "Stored issue fingerprints: kind + url + locale + check, sha256 truncated, unique per crawl"
requirements-completed: [SC-3, D-14, D-46, D-51, D-70, D-71, D-80, D-81, D-82, D-85, D-24, D-50, D-10, D-94]
coverage:
- id: C1
description: "Tracer: an administrator starts a crawl through the API, the job fetches the site with the crawler's User-Agent, GET /issues lists h1_multiple as an error, fix code for the template and the record type's headings tool for an H1 in the record's content"
requirement: "D-14"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawler_test.go#TestCrawlerTracer"
status: pass
human_judgment: false
- id: C2
description: "The planted site: every C23 crawl kind found exactly once at its page with its severity and details, nothing on /clean, no request to another host, a private address or plain http"
requirement: "D-14"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawler_test.go#TestCrawlerChecks"
status: pass
human_judgment: false
- id: C3
description: "CMS-data issues stored with the crawl as source cms, image_alt and h1_in_content with the descriptor tools, pillar heading_skipped as fix code, every issue routed, ignores surviving the next crawl, fixed pages losing their issues"
requirement: "SC-3"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawler_test.go#TestIssueMerge"
status: pass
human_judgment: false
- id: C4
description: "Staging: the lock's noindex is never reported and pages stay indexable for the other checks"
requirement: "D-24"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawler_test.go#TestStagingCrawl"
status: pass
human_judgment: false
- id: C5
description: "Rendered comparison skipped without a renderer, failed with its note when Render fails, the crawl still finishing with its raw checks"
requirement: "D-70"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawler_test.go#TestRenderSkipped"
status: pass
human_judgment: false
- id: C6
description: "Site audit and Crawls: start and its refusals, errors first, labels and fix column, P7, ignore, row badge, status filter, unignore, bulk ignore, recheck (admin and API), P6 with callouts, the rendered line and kind links, GET crawl render answer, cancel, refused delete of a running crawl"
requirement: "D-14"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawl_admin_test.go#TestCrawlAdmin"
status: pass
human_judgment: false
- id: C7
description: "Site audit settings ranges, seeded generic anchors driving generic_anchor, seo:crawl --scheduled off/daily/weekly (ScheduledDue), crawl_keep pruning with pages and issues"
requirement: "D-14"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawl_admin_test.go#TestCrawlSchedule"
status: pass
human_judgment: false
- id: C8
description: "The nine MCP tools bound to their routes, delete destructive, MCP start (trigger mcp), list, ignore and unignore; every Site audit and Crawls operation mapped"
requirement: "D-10"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawl_admin_test.go#TestCrawlTools"
status: pass
- kind: unit
ref: "../sm-seo-plugin/operations_test.go#TestEveryAdminOperationHasTool"
status: pass
human_judgment: false
- id: C9
description: "Headless Chromium renders a page with JavaScript-added content; the third-party script and the link-local request are blocked; the profile is removed on Close; the crawl reports content_js check rendered naming /js-only with render done"
requirement: "D-70"
verification:
- kind: integration
ref: "../sm-seo-plugin/crawl_render_test.go#TestChromeRenderer"
status: pass
- kind: unit
ref: "../sm-seo-plugin/crawl_render_test.go#TestRendererGuards"
status: pass
human_judgment: false
- id: C10
description: "Every stored kind has issues.kind_ and issues.sum_ copy in en and pl"
requirement: "SC-3"
verification:
- kind: unit
ref: "../sm-seo-plugin/crawl_admin_test.go#TestIssueKindLabels"
status: pass
human_judgment: false
duration: 75min
completed: 2026-11-04
---
# Phase 33 Plan 10: Site audit crawler Summary
**A built-in crawler (a conga job on a fetchguard client limited to the site host) audits the rendered site for every C23 kind, stores the findings with the CMS-data checks under ignorable fingerprints, routes each issue to an MCP tool or to template code, and compares raw with JavaScript-rendered pages through an optional, guarded chromedp v0.21.0 renderer; Site audit and Crawls screens, a Site audit settings tab, a nightly schedule and nine MCP tools sit on top.**
## Read first: consumers, versions, what is not done
- **sm-seo-plugin is additive for its consumers.** No exported identifier, route, tool, lang key or table of the plugin was removed or renamed. `GET /_seo/api/v1/issues` keeps its Phase 32 keys (`data[].kind/url/locale/details/tool`, `counts`, `total`) and gains `id`, `severity`, `source`, `fix`, `found_at`, `ignored`, `crawl_id`; it now reads stored issues (the CMS checks are refreshed on each read until the first crawl, then the newest crawl's), and it leaves ignored issues out unless `status=ignored|all`. `details.what` is added to fix-code issues. The settings answer gains five `crawl_*`/`generic_anchors` keys. Two migrations (202610280005, 202610280006) add tables and settings columns.
- **New Go dependency in sm-seo-plugin only:** `github.com/chromedp/chromedp v0.21.0` (+ `github.com/chromedp/cdproto v0.157.8`, `github.com/go-json-experiment/json`). It is compiled into every app that mounts the plugin; Chrome itself is optional and operator-installed. `golang.org/x/net` moved from indirect to direct. The framework go.mod is untouched (D-90).
- **plugin.yaml** (kiosk manifest): the description follows the README summary, and `requires.golem15.sitemap` is now `v0.1.2` — kiosk derives that once chromedp is in go.mod (it derived `""` before); `TestPluginManifest` passes.
- **Apps pin sm-seo-plugin as a submodule**, so sm-demo-app and sm-grzybyfunkcjonalne-app still build the old plugin. A scratch go.work that points sm-demo-app at the sibling sm-seo-plugin and sm-sitemap-plugin builds (`go build ./...`, exit 0). With only sm-seo-plugin swapped in, the demo's pinned sitemap lacks the `contract` package — pre-existing since 33-05, resolved by the 33-14 pointer bumps.
- **Not done here (deferred-items.md, WINDOWS #32, #33):** the Site audit status filter cannot default to Open (cabana filters have no default); P7's "Open the page" and Rich Results lines are addresses, not links (partials allow same-origin links only); the settings tile and permission texts wait for 33-11.
- sm-seo-plugin is 23 commits ahead of v0.1.1 (15 before this plan + 8), nothing pushed or tagged.
## Performance
- **Duration:** about 75 min
- **Started:** 2026-11-04T13:50:37Z
- **Completed:** 2026-11-04T15:05Z
- **Tasks:** 4 (all)
- **Files:** 65 changed in sm-seo-plugin (8512 insertions), 2 planning files in summercms.go plus this summary
## Accomplishments
- **Crawler** (`classes/crawl`): robots.txt, the sitemap index and its files, then breadth-first from `/` and the sitemap addresses over same-host links, redirect targets, canonicals and hreflang alternates; `fetchguard.AllowHostsMode` on the site host and its `www` twin (HTTPS, private addresses refused, redirects never followed), `TrustedMode` only from `golem15.seo.crawl_trusted`; two requests at a time with the settings' pause, 10 s, 5 MiB, 1000 links per page, the settings' page limit; cancel keeps what was fetched; one crawl at a time (settings row locked in the start transaction); P33-41 User-Agent.
- **Checks**: all C23 crawl kinds with the kinds-table severities, `schema.Validate` for JSON-LD, the raw HTML against the CMS record (`content_js` check cms: title in an H1, half the word count, the primary parent's link), the rendered comparison (`compareRendered`, check rendered), orphan pages with suggestions from titles and focus keyphrases; CMS kinds `image_alt` and `h1_in_content` from the descriptors; staging noindex never counted.
- **Fix routes** (`crawl.Route`): content findings go to the record type's `Tools` (headings for H1, image_alt, edit), data findings to `seo_set_url_seo`, `seo_update_robots`, `seo_create_redirect`, `seo_create_page`, `seo_update_settings`; everything else is `fix: code` with `details.what`. The registry pages name `seo_update_page` as their edit tool. No stored issue has neither.
- **Storage**: crawls, pages (with main text up to 100 000 characters for 33-11's E10), links, issues with fingerprints, ignores; crawls beyond `crawl_keep` pruned with their rows.
- **Admin**: Site audit (errors first, labels, summary and fix columns, five filters, Ignored badge, P7, Check this address again, Ignore, Stop ignoring, bulk Ignore, Start crawl) and Crawls (newest first, P6 with one status callout, staging and render lines, stats strip and per-kind table with filter links, Cancel, refused delete of a running crawl); navigation Site audit (`gauge`) and Crawls (`globe`) after Pages.
- **Settings**: Site audit tab before Verification with the C20 ranges (`lagoon::validation.between.numeric` on the screen and the API) and the en+pl generic anchors seed.
- **Schedule**: `seo:crawl [--scheduled]`, entry `DailyAt(2, 30)`; weekly runs on Mondays in `app.timezone`.
- **MCP**: nine tools with `AdminOperations` rows; reads are GET, delete is destructive.
- **Rendered comparison**: `NewRenderer` from `golem15.seo.crawl_chrome_path` and `crawl_render_max`; `chromeRenderer` with resolver pinning (`fetchguard.IsPrivateAddr`), Fetch-domain interception (`allowRequest`), fresh profile removed on Close, downloads denied, one tab, 20 s, 5 MiB DOM, default allocator flags (no `--no-sandbox`). Verified against the local Chromium.
## Task Commits
sm-seo-plugin (`/media/nvme/dev/golem15/summercms.io/summercms/sm-seo-plugin`, branch main, not pushed):
1. **Task 1 (tracer)** `c2b61bf` feat: crawler finds a page with two H1 headings and stores the issue (tracer)
2. **Task 2A** `f2c93ae` feat: crawler checks for status, sitemaps, canonical, titles and headings
3. **Task 2B** `8c63233` feat: crawler checks for JSON-LD, hreflang, links, images, raw HTML and the rendered-comparison seam
4. **Task 2C** `edc03ca` feat: orphan pages and merged CMS issues with fix routes
5. **Task 3A+C** `c4f0b4f` feat: Site audit and Crawls screens with their MCP tools
6. **Task 3B** `fc53d93` feat: site audit settings and the nightly crawl
7. **Task 3D** `96963c3` docs: crawler and site audit in README
8. **Task 4B** `b553fc2` feat: rendered comparison through headless Chrome
summercms.go (master):
- **Task 4A** `e9504b1` docs(33-10): chromedp decision note and STACK row (before the go.mod change)
- `835bf3f` docs(33-10): resolver rule order in the chromedp note
## Decisions Made
See `key-decisions` above. The rule-order and IPv4 decisions were checked against Chromium: with `MAP * ~NOTFOUND` first, `TestChromeRenderer` failed with `ERR_NAME_NOT_RESOLVED`; with it last, it passes.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Resolver rule order**
- **Found during:** Task 4
- **Issue:** P33-55 (and the first version of the decision note) put `MAP * ~NOTFOUND` first; Chrome applies the first matching rule, so the site host itself did not resolve.
- **Fix:** site host rules first, catch-all last; the note corrected in `835bf3f`.
- **Files modified:** `classes/crawl/render.go`, `.planning/notes/2026-10-28-chromedp-rendered-crawl.md`
- **Commit:** `b553fc2`, `835bf3f`
**2. [Rule 1 - Bug] IPv6-first resolution refused the site**
- **Found during:** Task 4 (`TestChromeRenderer`: `ERR_CONNECTION_REFUSED`)
- **Issue:** `localhost` resolved to `::1` first while the server listened on IPv4.
- **Fix:** the resolver rule takes the first IPv4 address, else the first.
- **Commit:** `b553fc2`
**3. [Rule 3 - Blocking] Admin screens and MCP tools in one commit**
- **Found during:** Task 3
- **Issue:** `TestEveryAdminOperationHasTool` fails for any admin operation without its tool, so commit A (screens) cannot be green without commit C (tools).
- **Fix:** groups A and C landed together as `c4f0b4f`; B and D followed. Commit order: A+C, B, D.
**4. [Rule 3 - Blocking] Renderer seam in the tracer commit**
- The tracer's `crawler.go` already calls the `Renderer` interface, so `render.go` (interface, statuses, `WithRenderer`) landed in `c2b61bf`; `compareRendered` and the wiring of findings landed in 2B as planned.
**5. [Rule 3 - Blocking] Exported renderer test seam**
- The crawler tests live in the external `seo_test` package, so the fake renderer is injected through `crawl.WithRenderer(ctx, r)`, a context value settable only from Go code (like `fetchguard.WithTransport`), not an unexported option.
**6. [Rule 3 - Blocking] plugin.yaml followed the README summary**
- `96963c3` changed the README's first sentence, which kiosk's manifest check compares; the README commit was amended (local, unpushed) with the regenerated description so it passes on its own. Task 4 then set `requires.golem15.sitemap: v0.1.2`, what kiosk derives with chromedp in go.mod.
**7. [Rule 3 - Blocking] Tests following new screens**
- `TestLangKeysComplete` skips value-built `kind_`/`sum_` keys like it skips `via_`/`source_` (`TestIssueKindLabels` checks every kind instead); `TestSettingsTypeTabs` expects the new Site audit tab before Verification.
**8. [Rule 2 - Missing] `cancelled_by` column**
- P6's cancelled text names who cancelled; P33-37's table had no column for it.
**9. [Rule 2 - Missing] Recheck keeps the issue's row**
- The record action reloads the preview of the same issue, so a recheck (and the pre-crawl CMS refresh) keeps the rows of issues found again and only deletes or adds the difference.
### Plan assumptions adapted
- **Filter default (C23):** cabana filters take no default; the list shows ignored issues badged, the API defaults to open (deferred item, WINDOWS #32).
- **External links in P7:** the partial allowlist drops cross-origin `href`; the page address and the Rich Results URL are shown in DM Mono (deferred item, WINDOWS #33).
- **P6 kind links** filter the Site audit by kind only; the list shows the current crawl and has no crawl filter.
- **Severity sorting:** errors first comes from `ListExtendQuery`'s `ORDER BY rank`; `defaultSort` is `kind` and the severity column is not sortable.
- **CMS links:** descriptors have no body links, so content_js check cms checks the primary parent's address (the breadcrumb link).
- **`compareRendered(raw, rendered *PageFacts, hosts []string)`** takes the site hosts to tell same-host links apart.
- **The seo-page Tools** sit in `classes/registry.go`, where its descriptor is (menu_item_types.go only registers it).
- **Acceptance greps that assume flat lang keys** (`grep -c "issues.kind_"`) count 0 in the nested YAML; each file has 36 `kind_` and 36 `sum_` keys under `issues:` (`TestIssueKindLabels`).
- **Note-before-go.mod check:** the note's first commit (`e9504b1`, ct 1793803438) precedes the first chromedp go.mod commit (`b553fc2`, ct 1793804316); `git log -1` on the note now prints the later correction commit `835bf3f`.
## Issues Encountered
- A shell `cp` alias (`cp -i`) left a background experiment waiting for input after it restored `render.go`; the file was restored with Python, the waiting process killed, and the build re-checked.
## Known Stubs
None.
## Threat Flags
None beyond the plan's threat model: the new routes are management routes behind `golem15.seo.manage`; outbound HTTP goes through fetchguard; Chrome is held to the same hosts and addresses.
## Verification run
In `/media/nvme/dev/golem15/summercms.io/summercms/sm-seo-plugin`, after every commit: `go vet ./...` and `go test -short ./...` green; the full Docker suite (`go test ./...`) green before each code commit (about 100 s at the end).
- `go test ./... -run 'TestCrawlerTracer|TestCrawlerChecks|TestIssueMerge|TestStagingCrawl|TestRenderSkipped|TestIssues' -v`: all PASS.
- `go test ./... -run 'TestCrawlAdmin|TestCrawlSchedule|TestCrawlTools|TestEveryAdminOperationHasTool|TestMCPReadToolsAreGET|TestCrawlerChecks' -v`: all PASS.
- `go test ./... -run 'TestChromeRenderer|TestRenderSkipped|TestCrawlerChecks|TestRendererGuards' -v`: all PASS; `TestChromeRenderer` ran against `/usr/bin/chromium` (not skipped).
- Acceptance greps: `fetchguard.NewClient`/`AllowHostsMode` in fetch.go; `golem15.seo.crawl` in jobs.go and job.go; `crawl_trusted`, `crawl_chrome_path`, `crawl_render_max` once each in config.yaml; `schema.Validate` in checks.go; `func compareRendered(` and `type Renderer interface` once each; eight tool names in mcp.go; `seo:crawl` in schedule.go and commands.go; the two controller IDs in admin_navigation.go; `render_skipped|render_done|render_failed` in both phrasebooks; `host-resolver-rules` and `fetchguard.IsPrivateAddr` in render_chrome.go; no `no-sandbox`; no `crawl_chrome_path` under models/ or settings_write.go; `github.com/chromedp/chromedp` in go.mod, STACK.md and the note.
`scripts/check-phase33.sh` in summercms.go (`--layers` skipped, known broken since 33-08):
- `--plugins`: passed (vet and short tests of sm-sitemap-plugin, sm-seo-plugin, sm-journal-plugin; vitest 87/87 in sm-seo-plugin, 244/244 in sm-journal-plugin).
- `--consumers`: passed (the four apps build with their pinned submodules; see "Read first" for the scratch build against this plugin).
- `--self-test --go --admin --docs --marker --docker --additive --compat`: every stage PASS (`docker` ran the three plugins' Postgres suites; `additive`: 4 packages against v0.6.0). `compat` printed refusals for sm-feedback-plugin, sm-presentations-plugin and sm-quizzes-plugin (their own replace layout resolves the framework to nothing, at the base tag too) and passed.
## User Setup Required
None for the crawler. For the rendered comparison an operator installs Chrome or Chromium on the server and sets `golem15.seo.crawl_chrome_path` (absolute path); a staging or local site over http needs `golem15.seo.crawl_trusted: true`.
## Next Phase Readiness
- 33-11 can read `golem15_seo_crawl_pages.text` (main text, 100 000 characters) for E10 suggestions, add Auto-links between Pages and Site audit in the navigation, and replace the settings tile and permission texts.
- 33-14: bump the sm-seo-plugin pointer in the apps together with sm-sitemap-plugin (the demo's pinned sitemap lacks `contract`), tag the plugin, and note the chromedp dependency and the two migrations in the release notes.
## Self-Check: PASSED
- Files: every created file listed above exists in sm-seo-plugin or summercms.go.
- Commits: `c2b61bf`, `f2c93ae`, `8c63233`, `edc03ca`, `c4f0b4f`, `fc53d93`, `96963c3`, `b553fc2` in sm-seo-plugin; `e9504b1`, `835bf3f` in summercms.go.

View File

@@ -0,0 +1,389 @@
---
phase: 33-seo-output-audit-and-content
plan: 11
subsystem: seo, media
status: complete
tags: [sm-seo-plugin, auto-links, internal-links, e10, mcp, lagoon, attach, webp, gen2brain, sm-journal-plugin, conga, image-variants, vue-journal-layer, picture, srcset]
requires:
- phase: 33-seo-output-audit-and-content
provides: "33-05 Links tab and the four-place settings pattern; 33-06 element bundle, the seo_graph widget pattern and the gen2brain/webp approval (v0.6.4); 33-09 vue-seo-layer autolink(), the consumer of autolinks/autolink_max; 33-10 crawl pages (main text) and links, the toolbar action operation kind"
provides:
- "golem15_seo_autolinks and settings autolink_max (migration 202610280007); ok resolve answers carry autolinks [{phrase, url}] and autolink_max"
- "SEO › Auto-links (golem15.seo.autolinks) with Add focus keyphrases; /_seo/api/v1/autolinks routes; MCP seo_list_autolinks, seo_create_autolink, seo_update_autolink, seo_delete_autolinks, seo_autolinks_from_keyphrases"
- "E10 golem15-seo-links (widget action seo_links) and GET /_seo/api/v1/links; MCP seo_get_link_suggestions"
- "Framework: attach.VariantKey and package modules/lagoon/attach/webp (Encode, Variant, Quality, Format, ContentType); github.com/gen2brain/webp v0.6.4"
- "sm-journal-plugin: golem15_journal_image_variants (migration 202610280002), job golem15.journal.image_variants, journal:image-variants [--all], config golem15.journal.image_widths, featured_images[].variants"
- "vue-journal-layer: app/utils/srcset.ts (imageSrcsets) and <picture> with WebP in JournalFeaturedImage"
affects: [33-12, 33-13, 33-14]
actuals:
tokens: 46000
tasks: 4
commits: 2
plan_head_before: 3bfdc8616e8bda172a5c835d3c6ac30548c4616a
plan_head_after: 5c07224
sibling_repos:
sm-seo-plugin: {head_before: b553fc2, head_after: 49cc241, commits: 3}
sm-journal-plugin: {head_before: ee3cb26, head_after: 4f5bd19, commits: 1}
vue-journal-layer: {head_before: adcea4d, head_after: 1080a3f, commits: 1}
tech-stack:
added:
- "github.com/gen2brain/webp v0.6.4 (framework go.mod; only modules/lagoon/attach/webp imports it; its one dependency github.com/ebitengine/purego v0.10.1 was already in the module graph)"
patterns:
- "A generic media helper lives in a framework sub-package so that only binaries that import it link the encoder (attach/webp next to attach)"
- "Auto-link writes record history under subject autolink, and its purge slug is * (a phrase may appear in any text)"
- "A widget's suggestions read the last finished crawl; phrase matching shares crawl's normal form (classes.NormalText)"
key-files:
created:
- ../sm-seo-plugin/models/autolink.go
- ../sm-seo-plugin/models/autolink/columns.yaml
- ../sm-seo-plugin/models/autolink/fields.yaml
- ../sm-seo-plugin/updates/202610280007_create_golem15_seo_autolinks.go
- ../sm-seo-plugin/classes/autolinks.go
- ../sm-seo-plugin/classes/linkgraph.go
- ../sm-seo-plugin/controllers/autolinks.go
- ../sm-seo-plugin/controllers/autolinks/config_list.yaml
- ../sm-seo-plugin/controllers/autolinks/config_form.yaml
- ../sm-seo-plugin/controllers/autolinks/config_filter.yaml
- ../sm-seo-plugin/controllers/api/autolinks.go
- ../sm-seo-plugin/controllers/api/links.go
- ../sm-seo-plugin/assets/src/elements/links.ts
- ../sm-seo-plugin/tests/elements/links.test.ts
- ../sm-seo-plugin/linking_test.go
- .planning/notes/2026-10-28-webp-gen2brain.md
- modules/lagoon/attach/variant.go
- modules/lagoon/attach/webp/webp.go
- modules/lagoon/attach/webp/webp_smoke_test.go
- modules/lagoon/attach/webp/export_test.go
- ../sm-journal-plugin/classes/image_variants.go
- ../sm-journal-plugin/console/image_variants.go
- ../sm-journal-plugin/models/image_variant.go
- ../sm-journal-plugin/updates/202610280002_create_golem15_journal_image_variants.go
- ../sm-journal-plugin/jobs.go
- ../vue-journal-layer/app/utils/srcset.ts
- ../vue-journal-layer/tests/srcset.test.ts
modified:
- ../sm-seo-plugin/classes/resolver.go
- ../sm-seo-plugin/classes/settings_write.go
- ../sm-seo-plugin/classes/history.go
- ../sm-seo-plugin/classes/crawl/fix.go
- ../sm-seo-plugin/models/settings.go
- ../sm-seo-plugin/models/settings/fields.yaml
- ../sm-seo-plugin/models/revision.go
- ../sm-seo-plugin/controllers/admin_registry.go
- ../sm-seo-plugin/controllers/api/settings.go
- ../sm-seo-plugin/extensions.go
- ../sm-seo-plugin/admin_navigation.go
- ../sm-seo-plugin/routes.go
- ../sm-seo-plugin/mcp.go
- ../sm-seo-plugin/operations.go
- ../sm-seo-plugin/operations_test.go
- ../sm-seo-plugin/seo_tab_test.go
- ../sm-seo-plugin/assets/src/elements/index.ts
- ../sm-seo-plugin/assets/src/elements/labels.ts
- ../sm-seo-plugin/assets/src/elements/styles.css
- ../sm-seo-plugin/assets/dist/seo.js
- ../sm-seo-plugin/assets/dist/seo.css
- ../sm-seo-plugin/lang/en/lang.yaml
- ../sm-seo-plugin/lang/pl/lang.yaml
- ../sm-seo-plugin/README.md
- go.mod
- go.sum
- modules/lagoon/README.md
- docs/database/attachments.md
- .planning/research/STACK.md
- ../sm-journal-plugin/controllers/api/posts.go
- ../sm-journal-plugin/controllers/posts.go
- ../sm-journal-plugin/plugin.go
- ../sm-journal-plugin/config/config.yaml
- ../sm-journal-plugin/go.mod
- ../sm-journal-plugin/go.sum
- ../sm-journal-plugin/README.md
- ../sm-journal-plugin/related_media_test.go
- ../vue-journal-layer/app/components/Journal/FeaturedImage.vue
- ../vue-journal-layer/app/components/Journal/PostCard.vue
- ../vue-journal-layer/app/journal-pages/PostPage.vue
- ../vue-journal-layer/app/utils/types.ts
- ../vue-journal-layer/app/assets/css/journal-base.css
- ../vue-journal-layer/testing/fixtures/acme/posts.json
- ../vue-journal-layer/testing/expect-acme.txt
- ../vue-journal-layer/README.md
key-decisions:
- "gen2brain/webp pinned exactly at v0.6.4 (Jakub 2026-11-04, recorded in 33-06); the decision note (1bb2ecf) is older than the go.mod change (5c07224)"
- "The gen2brain/webp fallback is libwebp compiled to WASM and transpiled to Go by wasm2go (libwebp.go, about 2.7 MB of generated Go). There is no WASM runtime and no wazero; the first choice is the system libwebp through purego"
- "Importing purego makes a binary dynamically linked against glibc even with CGO_ENABLED=0; -tags nodynamic keeps it static (transpiled encoder only). Recorded in the note, the lagoon README, docs/database/attachments.md and deferred-items for 33-14"
- "An auto-link's locale is stored as '' for every locale (NOT NULL), not NULL as P33-45 wrote; the unique index is (lower(phrase), locale), and the save refuses a phrase of every locale that meets the phrase of one locale, both ways"
- "Auto-link history uses subject autolink with purge slug * (a phrase can appear on any page); auto-links have no undo, like registry pages"
- "autolinks and autolink_max are omitted on non-ok answers and from the sitemap filter's production resolve; with autolink_max 0 the answer carries no phrases"
- "E10 is left out for the kinds collection and profile and for the page registry, because Words is a per-record fact (deferred item)"
- "E10's inbound count is the distinct pages linking here, the outbound count the distinct site pages it links to; a page missing from the crawl gets 0 and 0 and is not called an orphan; suggestions skip pages already linked either way"
- "WebP variants are written in mode exact at the original's aspect ratio for each width no larger than the original; every variant row carries the original's source_width and source_height, so the only new API key is variants"
- "golem15_journal_image_variants has no foreign key to system_files (the plugin's migration tests run without framework tables); the API delete removes the rows"
patterns-established:
- "Framework media add-ons: a separate sub-package (attach/webp) keeps a heavy dependency out of binaries that do not import it"
requirements-completed: [SC-2, SC-3, D-82, D-85, D-71, D-10]
coverage:
- id: L1
description: "Tracer: an all-locale phrase reaches another page's resolve answer with autolink_max 3, never the target page, never a disabled or other-locale phrase; autolink_max 0 answers none; 21 refused; three history rows"
requirement: "D-82"
verification:
- kind: integration
ref: "../sm-seo-plugin/linking_test.go#TestAutolinksTracer"
status: pass
human_judgment: false
- id: L2
description: "Auto-links screen and API: the refusals (short phrase, phrase taken naming its URL, javascript:, data:, protocol-relative, ftp, whitespace), labels, the disabled row state, the active and locale filters, Add focus keyphrases twice (second adds nothing), MCP origin, update, delete, history vias"
requirement: "D-82, D-10, T-33-50"
verification:
- kind: integration
ref: "../sm-seo-plugin/linking_test.go#TestAutolinks"
status: pass
human_judgment: false
- id: L3
description: "E10 data: null counts before a crawl; after it, inbound/outbound/orphan and both suggestion lists with public and admin addresses; the widget action answers the same; seo_links is in the SEO tab after seo_graph"
requirement: "D-82"
verification:
- kind: integration
ref: "../sm-seo-plugin/linking_test.go#TestLinkSuggestions"
status: pass
- kind: integration
ref: "../sm-seo-plugin/seo_tab_test.go#TestSEOTab"
status: pass
human_judgment: false
- id: L4
description: "E10 element: counters, orphan callout, both lists, notCrawled, none, checking line with aria-busy, danger line on failure, Copy address and the copied status for 2 s, hidden button without a clipboard, locale switch"
requirement: "D-82"
verification:
- kind: unit
ref: "../sm-seo-plugin/tests/elements/links.test.ts"
status: pass
human_judgment: false
- id: L5
description: "MCP parity: six new tools, every Auto-links and E10 operation mapped, reads are GET, the delete is destructive"
requirement: "D-10"
verification:
- kind: unit
ref: "../sm-seo-plugin/operations_test.go#TestEveryAdminOperationHasTool"
status: pass
- kind: unit
ref: "../sm-seo-plugin/operations_test.go#TestMCPReadToolsAreGET"
status: pass
human_judgment: false
- id: M1
description: "WebP encoder: RIFF/WEBP output, VariantKey rules (webp original appends), a variant next to its thumbnail written once, a failed encode leaves no file, the documented example"
requirement: "D-85"
verification:
- kind: unit
ref: "modules/lagoon/attach/webp/webp_smoke_test.go"
status: pass
human_judgment: false
- id: M2
description: "Journal: the upload answers before any encoding and queues the job; the job writes 480 and 800 (1200 wider than the 1000 px original) with WebP copies; the API's variants; a second run writes nothing; an admin save queues only for an image lacking a width; the API delete removes rows and blobs"
requirement: "D-85"
verification:
- kind: integration
ref: "../sm-journal-plugin/related_media_test.go#TestImageVariants"
status: pass
human_judgment: false
- id: M3
description: "Layer: srcset strings from variants plus the original's width; <picture> with image/webp, width, height, alt, eager with fetchpriority high on the post, lazy in cards; an image without variants renders as before"
requirement: "D-85, D-71"
verification:
- kind: unit
ref: "../vue-journal-layer/tests/srcset.test.ts"
status: pass
- kind: integration
ref: "../vue-journal-layer/testing/expect-acme.txt (featured image lines, smoke-ssr 87 checks)"
status: pass
human_judgment: false
duration: 75min
completed: 2026-11-04
---
# Phase 33 Plan 11: auto-links, internal link suggestions and WebP featured images Summary
**Editors keep a phrase → URL table that every ok resolve answer carries for its locale (minus the page itself), with a screen, a keyphrase feed and MCP tools; the SEO tab shows each page's inbound and outbound links from the last crawl with linking suggestions (E10); featured images get thumbnails at 480/800/1200 and a WebP copy of each from a Journal conga job, encoded in Go by the framework's new `attach/webp` package (github.com/gen2brain/webp v0.6.4), and the journal layer serves them as `<picture>` with srcset.**
## Read first: consumers, versions, what is not done
- **Everything is additive.** No exported identifier, route, tool, lang key, table or answer key was removed or renamed in any repository.
- sm-seo-plugin: the resolve answer gains `autolinks` and `autolink_max` on ok answers; the settings answer gains `autolink_max`. New routes `GET/POST /_seo/api/v1/autolinks`, `PUT /autolinks/{id}`, `DELETE /autolinks?ids=`, `POST /autolinks/from-keyphrases`, `GET /links?url=`. Six MCP tools. Migration 202610280007 (table and settings column).
- Framework: `attach.VariantKey` and the new package `modules/lagoon/attach/webp`. The gate's additive check passes (5 packages against v0.6.0, `modules/lagoon/attach` +1 line).
- sm-journal-plugin: `featured_images[].variants` (new key on every entry, `[]` until made), migration 202610280002, job `golem15.journal.image_variants`, command `journal:image-variants`, config key `golem15.journal.image_widths`. The plugin now registers jobs (`pact.HasJobs`).
- vue-journal-layer: `JournalFeaturedImage` gains the optional props `image` and `sizes`. Without variants its markup is byte-for-byte as before.
- **New dependency: `github.com/gen2brain/webp` v0.6.4, pinned exactly**, in the framework go.mod (and indirect in sm-journal-plugin's). The only package that imports it is `modules/lagoon/attach/webp`. Its one dependency, `github.com/ebitengine/purego` v0.10.1, was already in the module graph, so no other module was added. The module source confirms the fallback is wasm2go-transpiled Go, not wazero.
- **Linking consequence, which 33-14 should decide on.** A binary that imports `attach/webp` (any app mounting sm-journal-plugin) is dynamically linked against glibc even with `CGO_ENABLED=0`, because of purego. It needs `ld-linux-x86-64.so.2`, `libc.so.6`, `libdl.so.2` and `libpthread.so.0`. It runs on the Debian servers but not in scratch or musl images. `-tags nodynamic` gives a static binary with the slower transpiled encoder. Installing `libwebp-dev` enables the fast path. The note, the lagoon README, the attachments docs and deferred-items all say this.
- **Not pushed or tagged.** sm-seo-plugin is 26 commits ahead of v0.1.1. sm-journal-plugin, vue-journal-layer and summercms.go have unpushed phase-33 commits. The apps still pin the old plugin submodules, and 33-14 bumps them.
- **Settings tile and permission texts** (33-10 deferred item) now carry the UI-SPEC texts in en and pl, and the deferred item is marked resolved.
## Performance
- **Duration:** about 75 min (2026-11-04, about 15:05Z to 16:20Z)
- **Tasks:** 4 (a tracer, two TDD tasks, one auto task)
- **Commits:** 7 across 4 repositories (sm-seo-plugin 3, summercms.go 2, sm-journal-plugin 1, vue-journal-layer 1); measured with `git rev-list --count <before>..HEAD` per repository
## Task Commits
**sm-seo-plugin** (`/media/nvme/dev/golem15/summercms.io/summercms/sm-seo-plugin`, main, b553fc2..49cc241)
1. Task 1 (tracer): `6203aec` feat: auto-link phrases in the resolve answer (tracer)
2. Task 2A: `ab4e834` feat: auto-links screen, keyphrase feed and MCP tools
3. Task 2B: `49cc241` feat: internal links widget with counts and suggestions
**summercms.go** (master, 3bfdc86..5c07224)
4. Task 3A: `1bb2ecf` docs(33-11): WebP decision note and STACK row
5. Task 3B: `5c07224` feat(lagoon): WebP variants of attachment thumbnails
**sm-journal-plugin** (main, ee3cb26..4f5bd19)
6. Task 4A: `4f5bd19` feat: image variants job and variants in the post API
**vue-journal-layer** (main, adcea4d..1080a3f)
7. Task 4B: `1080a3f` feat: WebP and srcset for featured images
## Accomplishments
- **Auto-links (D-82).** The table has a phrase, a URL (a `/` path or an http(s) address), a locale or all, an active switch, an origin (manual, keyphrase or mcp) and a note. Every write is checked and recorded in history, which purges the site cache with slug `*`.
- `Service.ForPage` lists the active phrases of a locale, longest first. It drops phrases that link to the page itself, as a path or as an absolute URL on the site host or its www twin.
- The resolver adds `autolinks` and `autolink_max`, and vue-seo-layer's `autolink()` (33-09) applies them.
- **Auto-links screen (C22).** It sits after Pages with the icon `wand-sparkles`. The list shows 50 rows, has checkboxes and setup, and its toolbar holds create, delete and Add focus keyphrases.
- Columns: phrase, links to, language (All languages or the code), origin label, updated. A row gets the disabled state ("Off") when the phrase is inactive.
- Filters: language, origin, and the Active only switch.
- Form: phrase and URL, language (empty option All languages) and Active, note.
- Refusals: `phrase_short`, `phrase_taken` (names the URL), `url_invalid`.
- Add focus keyphrases turns the SEO entries' focus keyphrases into phrases (one per locale, origin keyphrase) and toasts the count (CLDR plural) or `keyphrases_none`.
- **E10 golem15-seo-links (C19).** The `seo_links` widget sits in the SEO tab after `seo_graph`, on update only.
- It shows the counters (`.summer-stats`) with the crawl time, the orphan callout, "Pages you could link to from this text" with Copy address, and "Pages that could link here" with admin links.
- Empty states: `notCrawled` before the first crawl, `none` under an empty list.
- Loading and errors: the checking line with `aria-busy`, a danger line on failure. Copy address falls back to the selectable URL when the clipboard is unavailable, and the element follows the ML locale switch.
- `classes/linkgraph.go` reads the last finished crawl's pages and links. The crawler's orphan suggestions now share `classes.NormalText`.
- **Framework WebP (P33-42).**
- `attach.VariantKey(thumbKey, format)` replaces the thumbnail's extension, or appends the format when the thumbnail already has that extension.
- `webp.Encode` encodes at quality 80.
- `webp.Variant` calls ThumbKey first and returns early when the variant exists. It encodes in memory, stores `image/webp`, and deletes the key on a write or close error.
- Docs section "WebP variants" in docs/database/attachments.md, with a synced `src=` example.
- **Journal image variants.**
- The job runs with three attempts. It makes each configured width no larger than the original (mode exact, the original's aspect ratio) through ThumbKey and `webp.Variant`, then inserts rows with ON CONFLICT DO NOTHING. It skips originals that are missing, don't decode or are over the pixel limit.
- It is queued after an API upload and after an admin save of a post whose images lack a width. The upload never encodes, and a queue failure is only logged.
- `journal:image-variants [--all]` backfills.
- `featured_images[].variants` is loaded with one query per post.
- The API delete removes a file's rows.
- **Layer.**
- `imageSrcsets` builds the WebP and original-format srcsets, adds the original when it is wider than every variant, works out the reserved size, and escapes addresses.
- `JournalFeaturedImage` renders `<picture>`: cards pass `sizes="(min-width: 48rem) 33vw, 100vw"` and load lazily; the post page passes `sizes="(min-width: 46rem) 46rem, 100vw"` with eager loading and `fetchpriority="high"`.
- `picture` is styled as a block element.
## Decisions Made
See `key-decisions` above.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Auto-link locale stored as '' instead of NULL**
- **Found during:** Task 1
- **Issue:** P33-45 has `locale null = all`. The admin dropdown's empty option posts "", and a nullable column would need a custom binding type.
- **Fix:** `locale TEXT NOT NULL DEFAULT ''`, unique `(lower(phrase), locale)`. The save check treats a phrase of every locale as meeting each locale, both ways. "all" is accepted as an alias in the API and the filter.
- **Commit:** `6203aec`
**2. [Rule 2 - Missing] Auto-link history purges every page**
- **Issue:** `purgeSlug` would have used the autolink's target `url` as the purge slug, but a phrase changes the pages that contain it, not its target.
- **Fix:** `SubjectAutolink` purges `*`.
- **Commit:** `6203aec`
**3. [Rule 3 - Blocking] E10 omitted by kind, not by Words**
- **Issue:** `Words` is per record and locale (`pact.ContentLocale`), so the per-type SEO tab cannot read it.
- **Fix:** `hasBody(key, kind)` leaves E10 out for collection, profile and the page registry. Logged in deferred-items with a framework fix (`ContentDescriptor.HasBody`).
- **Commit:** `49cc241`
**4. [Rule 2 - Missing] E10 checking and failure copy**
- **Issue:** The E10 copy table has no loading or failure text, and E3's `checking` says "Checking for duplicates…".
- **Fix:** Added `linksChecking` ("Loading the internal links…" / "Wczytywanie linków wewnętrznych…") and `linksFailed` ("The internal links could not be loaded. Try again." / "Nie udało się wczytać linków wewnętrznych. Spróbuj ponownie."). E10 keys are prefixed `links*` because `none` and `links` already exist in the shared dictionary.
- **Commit:** `49cc241`
**5. [Rule 2 - Missing] The original's size in the variants**
- **Issue:** The layer needs the original's width for the srcset and the reserved size, and `system_files` has no dimensions.
- **Fix:** Each row and each `variants` entry carries `source_width` and `source_height`, so `variants` stays the only new API key.
- **Commit:** `4f5bd19`
**6. [Rule 3 - Blocking] No foreign key from the variants table to system_files**
- **Issue:** The plugin's own migration tests (updates, models) run without the framework's tables, and the foreign key broke five tests.
- **Fix:** Plain `file_id`. The API delete removes the rows; leftovers from admin removals are logged in deferred-items.
- **Commit:** `4f5bd19`
**7. [Rule 1 - Bug] The admin save re-queued the job for complete images**
- **Issue:** The "missing" filter counted variant rows against the number of widths, but widths wider than the original never get a row.
- **Fix:** An image counts as missing only when it lacks a width no larger than its recorded source width.
- **Commit:** `4f5bd19`
**8. [Rule 3 - Blocking] Docs code blocks need a `src=` snippet**
- **Issue:** `docs:build --check` refuses a Go block without `src=`.
- **Fix:** Added `ExampleVariant` to the webp tests (external test package, plus `export_test.go` for the encoder seam), referenced with `src=` and synced.
- **Commit:** `5c07224`
### Plan assumptions adapted
- **Files that did not apply.** `modules/lagoon/attach/README.md` does not exist, so attach is documented in `modules/lagoon/README.md`. `models/registry.go` and `updates/registry.go` (both plugins) needed no change, because new files register themselves in `init`. `classes/settings_write.go` also carries the `autolink_max` range through `Settings.AuditProblems` (0 to 20, `lagoon::validation.between.numeric`).
- **The plan's description of the fallback.** It says "WASM via wazero". The v0.6.4 source is wasm2go-transpiled Go, and the decision note says so.
- **`TestJournalAPIMatrix` does not exist.** The plan's verify names it, but the matrix file holds several tests (`TestJournalAPIShowNeighbors`, `TestJournalPerPageClamp`, …). The full Journal suite (`go test ./...`, Docker) ran green instead.
- **Acceptance grep `golem15.seo.autolinks` in admin_navigation.go.** The navigation uses the constant `controllers.AutolinksControllerID`, so a comment on the nav entry names the controller ID.
- **TestAutolinks reads list rows by phrase, not by position.** cabana sorts the phrase column in the database's byte order. Logged as a deferred item.
## Issues Encountered
- `gofmt` turned `''` in a Go comment into a typographic quote. The comment now reads "empty".
- The SSR expectation grammar splits on ` type=`, so the `<source type="image/webp"` lines start their `contains=` after `type`.
## Known Stubs
None.
## Threat Flags
None beyond the plan's threat model.
- T-33-50: URLs are restricted to paths and http(s), tested with javascript:, data:, protocol-relative and ftp addresses.
- T-33-51: the pixel limit is checked from the header before any decode, widths wider than the original are skipped, and encoding runs in a job with attempts.
- T-33-52: the version is pinned, and the note and STACK row were committed before go.mod.
- T-33-53: every new route sits behind `manage()` with `golem15.seo.manage`, and the parity test covers the tools.
## Verification run
- **sm-seo-plugin:** `go vet ./...`, `go test -short ./...` and the full Docker suite (`go test ./...`, about 100 s) were green before each of the three commits.
- `TestAutolinksTracer`, `TestAutolinks`, `TestLinkSuggestions`, `TestEveryAdminOperationHasTool`, `TestMCPReadToolsAreGET` and `TestSEOTab` all PASS.
- `npm run test`: 93/93 (9 files). `npm run build` then `scripts/check-dist.sh`: "assets/dist matches a fresh build".
- Acceptance greps: two resolver json tags; `autolink_max` in settings_write.go and fields.yaml; six tool names in mcp.go; `golem15-seo-links` in index.ts; `golem15.seo.autolinks` in admin_navigation.go.
- **summercms.go:**
- `go vet ./...` and `go test -short ./...` green. `go test ./modules/lagoon/...` (Docker): lagoon, attach and attach/webp all ok.
- `summer docs:build --check`: no problems. `go test ./cmd/summer -run TestDocsTree`: ok.
- `grep -rln gen2brain modules --include=*.go` lists only `modules/lagoon/attach/webp/webp.go`.
- Note before go.mod: `1bb2ecf` is the parent of `5c07224`, the first gen2brain change to go.mod.
- **sm-journal-plugin:** `go vet ./...`, `go test -short ./...` and the full Docker suite all green. `TestImageVariants` PASS. `GOWORK=off go build ./... && go vet ./...` also green (go.mod has the framework replace). `TestCommandsDocumented` logs nothing for `journal:image-variants`.
- **vue-journal-layer:**
- `npm run test`: 192 pass, 0 fail (srcset.test.ts: 5).
- `npm run build:playground`: complete. `npm run smoke:ssr`: ok (87, 2, 2, 2, 2 checks).
- TypeScript: the package has no typecheck script. `tsc --noEmit -p .playground/.nuxt/tsconfig.app.json --allowImportingTsExtensions` reports 3 pre-existing errors in untouched files (useJournalItemList.ts, siteCache.ts) and none in the changed files. .vue files are not covered by tsc.
- **`scripts/check-phase33.sh`:** self-test, go, plugins, docs, marker, additive (5 packages, attach +1 line), admin, docker, consumers and compat all PASS. compat printed the known refusals for sm-feedback-plugin, sm-presentations-plugin and sm-quizzes-plugin (skipped, they fail at v0.6.0 too). `--layers` was skipped (known broken, deferred-items 33-08), and its steps were run by hand for vue-journal-layer as listed above.
## User Setup Required
None for the defaults. Optional: install `libwebp-dev` on servers for about five times faster encoding. For a static or musl deploy of an app with Journal, build with `-tags nodynamic`. Run `journal:image-variants` once per site to backfill existing featured images.
## Next Phase Readiness
- **33-12 / 33-13:** E10, Auto-links and the resolve keys are in place. vue-seo-layer already consumes `autolinks` and `autolink_max` (33-09).
- **33-14:**
- Bump the sm-seo-plugin, sm-journal-plugin and vue-journal-layer pins in the apps. sm-journal-plugin then needs the framework at v0.6.1 (`attach/webp`).
- Decide each app's build on the glibc linking (`-tags nodynamic` or not).
- Name the new migrations (SEO 202610280007, Journal 202610280002), the `journal:image-variants` backfill and the gen2brain/webp dependency in the release notes.
## Self-Check: PASSED
- Files: every created file listed in `key-files.created` exists (checked with `test -f` in each repository).
- Commits: `6203aec`, `ab4e834`, `49cc241` (sm-seo-plugin); `1bb2ecf`, `5c07224` (summercms.go); `4f5bd19` (sm-journal-plugin); `1080a3f` (vue-journal-layer). Each was found with `git cat-file -e`.

View File

@@ -0,0 +1,412 @@
---
phase: 33-seo-output-audit-and-content
plan: 12
subsystem: apps
tags: [seo, sitemap, nuxt, vue-seo-layer, demo, summercms-io, bm, noindex, patches]
requires:
- phase: 33-03..33-06
provides: sitemap index and files, SEO plugin page registry, site answer, JSON-LD graph, breadcrumbs
- phase: 33-07..33-09
provides: vue-seo-layer v0.2.0 (resolve, root files, build guard, noindex routes, route report, components) and the journal, menu and faq layers on it
- phase: 33-11
provides: WebP variants (purego linking note)
provides:
- "33-12-sm-demo-app.patch: Journal (tag_pages false), sitemap (site_url) and SEO (route_report_token) config, nginx without sitemap locations, env templates, DEPLOY.md SEO steps, deploy/seo-pages.csv, TestSEOOutput, scripts/smoke-seo.sh, scripts/smoke.sh and check-deploy.sh on the new format"
- "33-12-vue-demo-app.patch: seo.noindexRoutes ['/p/**', '/presentations/**'], page meta instead of hand-written robots, SeoSitemapLink in the footer, @nuxtjs/seo keys removed, SSR resolve through /api/__seo__"
- "33-12-vue-summercmsio-app.patch: changelog on seo: { cms: false, htmlSitemap: false } and 12 new expectation lines"
- "33-12-sm-summercmsio-app.patch: the empty note (no change beyond the pin bumps)"
- "33-12-local-wiring.md: worktrees, go.work, pnpm overrides, run variables, checks and cleanup for 33-13 and 33-14"
- "sm-bm-app bd7ee84: robots.txt Disallow, robots meta, X-Robots-Tag in nginx, scripts/check-noindex.sh (D-72)"
affects: [33-13, 33-14]
actuals:
tokens: 30000
tasks: 3
commits: 2
plan_head_before: 617e15d
plan_head_after: 298c81d701c697e77cc7b4b5e8639f07f87a98e2
tech-stack:
added: []
patterns:
- "Release patches from scratch worktrees: git add -N for new files, git diff --binary over an explicit path list, so the wiring (go.work, plugins.gen.go, pnpm overrides and lockfile) never enters a patch"
- "Scratch Nuxt wiring with pnpm 12 overrides in pnpm-workspace.yaml (link: to the sibling layers, applied at every depth)"
- "An SEO smoke run against a site: CMS head checks, a sitemap crawl through the site with duplicate and noindex detection, a redirect and a 404 created and removed through the SEO API"
key-files:
created:
- .planning/phases/33-seo-output-audit-and-content/33-12-sm-demo-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-12-vue-demo-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-12-sm-summercmsio-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-12-vue-summercmsio-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-12-local-wiring.md
- ../sm-bm-app/frontend/public/robots.txt
- ../sm-bm-app/scripts/check-noindex.sh
modified:
- ../sm-bm-app/frontend/index.html
- ../sm-bm-app/deploy/nginx/bm.jakubzych.com.conf
- ../sm-bm-app/DEPLOY.md
- ../sm-bm-app/README.md
- .planning/phases/33-seo-output-audit-and-content/deferred-items.md
- .planning/WINDOWS.md
key-decisions:
- "The demo keeps its cookie-based Polish (D-13). Moving to /pl/ prefixes is a Rule 4 change and goes to 33-14 as a decision; smoke-seo.sh reports the /pl/ 404s as WARN lines (SMOKE_SEO_STRICT=1 fails on them)"
- "Demo sitemaps go through Nuxt: nginx drops = /sitemap.xml and = /sitemap.xsl and gets no /_sitemap or /_seo location, and check-deploy.sh refuses one. robots.txt stays on the Go port"
- "The demo resolves client-side navigations through the Nuxt server (public.seo.apiBase /api/__seo__), so /_seo stays unrouted"
- "Registry page titles: deploy/seo-pages.csv restores 'SummerCMS Demo' (/) and 'FAQ' (/faq), which the registry would otherwise derive as 'Home' and 'Faq'"
- "sm-bm-app's check-noindex.sh builds the frontend into a temp outDir, so the committed build in the jz.bm plugin submodule is not touched"
requirements-completed: [SC-1, SC-2, D-72, D-70, D-23, D-97, D-33, D-22, D-30, D-34]
coverage:
- id: D1
description: "The demo stack on local links serves a Journal post with the CMS title, one canonical, one JSON-LD @graph, hreflang and breadcrumbs, /sitemap.xml as an index whose files answer through the layer, a 301 from an SEO plugin redirect, noindex on /p/** and the auth pages, the reported routes in the registry and a 404 in the 404 log"
requirement: SC-1
verification:
- kind: e2e
ref: "SMOKE_SEO_API=http://127.0.0.1:8120 bash scripts/smoke-seo.sh http://127.0.0.1:3020 (smoke-seo: ok, 29 ok lines, 9 WARN)"
status: pass
human_judgment: false
- id: D2
description: "The demo build passes the D-70 guard with seo.noindexRoutes and fails without the line"
requirement: D-70
verification:
- kind: automated_ui
ref: "pnpm exec nuxt build in the vue-demo-app worktree: exit 0 with the line, exit 1 '[vue-seo-layer] indexable routes must render on the server (D-70): /p/**, /presentations/**' without it"
status: pass
human_judgment: false
- id: D3
description: "TestSEOOutput (Docker): sitemap index and file on the public origin, no tag address and /blog/tag/releases not_found with tag_pages false, site answer, post resolve with @graph and breadcrumbs, route report with route_report_token"
requirement: SC-2
verification:
- kind: integration
ref: "go test -tags summercms_mcp -run TestSEOOutput -count=1 . (pass; fails without config/golem15.journal.yaml)"
status: pass
human_judgment: false
- id: D4
description: "summercms.io's changelog on seo.cms false keeps its titles, one canonical, one graph and makes no resolve call; landing generate, unit tests and marketplace smoke pass"
requirement: D-97
verification:
- kind: e2e
ref: "pnpm run build:changelog && pnpm run test:changelog (smoke-ssr: ok (89 checks)); pnpm run generate; pnpm test (82 pass, 0 fail); pnpm run test:marketplace (30 checks)"
status: pass
human_judgment: false
- id: D5
description: "sm-bm-app has no indexable page: robots.txt Disallow, robots meta, X-Robots-Tag in both server blocks and the location with its own add_header"
requirement: D-72
verification:
- kind: unit
ref: "bash ../sm-bm-app/scripts/check-noindex.sh (check-noindex: ok; three negative runs fail)"
status: pass
human_judgment: false
- id: D6
description: "Patches apply cleanly to the live HEADs"
verification:
- kind: other
ref: "git apply --check of all four patches (sm-summercmsio-app with --allow-empty)"
status: pass
human_judgment: false
- id: D7
description: "The demo's noindex set covers only browser-only or private routes (D-70 values prohibition); subscriptions is marked signed-in per P33-48 although its plan list is visible to visitors"
requirement: D-70
verification: []
human_judgment: true
rationale: "Whether /subscriptions (plans shown to visitors, subscribing needs an account) counts as a signed-in page is a product judgement for Jakub at 33-14's release checkpoint"
duration: 50min
completed: 2026-11-04
status: complete
---
# Phase 33 Plan 12: Demo, summercms.io and bm on the Phase 33 stack Summary
**The demo runs end to end on local links: CMS head, one graph, breadcrumbs, the sitemap index through vue-seo-layer, a CMS redirect enforced by Nuxt, D-70/D-23 noindex. Release patches for the demo and summercms.io apply to the current HEADs, and bm is noindexed by file, meta and header. The run also found that the demo's cookie-based Polish leaves 8 of 23 sitemap addresses (all `/pl/...`) answering 404.**
## Performance
- **Duration:** about 50 min (16:25Z to 17:15Z)
- **Tasks:** 3 of 3
- **Files:**
- four patches and a wiring note in the phase directory;
- six files in sm-bm-app;
- deferred-items.md and WINDOWS.md.
## Ports and wiring
Ports:
- Go `127.0.0.1:8120`. dev.sh uses 8097; the other port avoids a clash with a running dev stack.
- Nuxt `127.0.0.1:3020`.
- Scratch Postgres `127.0.0.1:55561` (container `sm-demo-pg-scratch33`, now removed).
- 33-13's Nuxt `3016` and its two worktrees were not touched.
33-12-local-wiring.md has every command.
The plan's Task 1 verify line uses the default `SMOKE_SEO_API=http://127.0.0.1:8097`. This run needs `SMOKE_SEO_API=http://127.0.0.1:8120`.
## Accomplishments
### Task 1: tracer, demo end to end on local links
The tracer gate passed: `<verify>` was re-run after the fixes, and it ended `smoke-seo: ok`.
**Setup:**
- worktrees under `../../scratch-33`;
- a scratch go.work with sm-journal-plugin, sm-sitemap-plugin, sm-seo-plugin and the framework replace;
- pnpm 12 overrides for the four layers;
- `summer build`;
- a fresh Postgres, then `migrate`, `admin:create` and `demo:seed` (posts with categories and Polish translations);
- `SUMMER_ENV=production` with local overrides, so the staging lock does not mask the noindex checks;
- `sitemap:rebuild`;
- the `seo-pages.csv` import.
**Final smoke** (`$S/smoke-seo-final.txt`):
```
ok /blog/welcome-to-summercms answers 200
ok /blog/welcome-to-summercms has one ld+json script
ok /blog/welcome-to-summercms ld+json is one @graph
ok /blog/welcome-to-summercms has one canonical
ok /blog/welcome-to-summercms has 3 hreflang links
ok /blog/welcome-to-summercms has nav.seo-breadcrumbs (2 links)
ok /blog/welcome-to-summercms title is the CMS title (Welcome to SummerCMS)
ok /blog/welcome-to-summercms X-Robots-Tag is the CMS's (index, follow)
ok alternate /blog/welcome-to-summercms answers 200
WARN alternate /pl/blog/welcome-to-summercms answers 404
ok /sitemap.xml is a sitemap index (application/xml)
ok /sitemap-authors-1.xml answers a urlset through the site
WARN sitemap address /pl/blog/author/summercms-team answers 404
ok /sitemap-categories-1.xml answers a urlset through the site
WARN sitemap address /pl/blog/category/uncategorized answers 404 (and news, guides)
ok /sitemap-pages-1.xml answers a urlset through the site
ok /sitemap-posts-1.xml answers a urlset through the site
WARN sitemap address /pl/blog/welcome-to-summercms answers 404 (and the other three posts)
ok 23 sitemap addresses fetched, 8 not 200
ok no address is listed twice in the sitemaps
ok /robots.txt names the sitemap index
ok /p/smoke-seo (200) sends X-Robots-Tag: noindex, nofollow
ok /presentations/new (200) sends X-Robots-Tag: noindex, nofollow
ok /login (200) sends X-Robots-Tag: noindex, nofollow
ok /register (200) sends X-Robots-Tag: noindex, nofollow
ok /account/security (200) sends X-Robots-Tag: noindex, nofollow
ok /login has the robots meta noindex, nofollow
ok / (200) links the HTML sitemap in the footer
ok /sitemap lists /blog/welcome-to-summercms
ok /smoke-seo-old-1793811624-4025853 answers 301 to /blog/welcome-to-summercms (SEO plugin redirect 4)
ok the registry lists the reported routes: / /blog /chat /contact /faq /forum /quizzes
ok /smoke-seo-missing-1793811625-4025853 answers 404
ok /smoke-seo-missing-1793811625-4025853 reached the 404 log (entry 12)
smoke-seo: ok
```
**Negative run** on rome-like sitemap data (the migrated additional addresses `/` and `/subscriptions`), which the smoke must catch:
```
FAIL sitemap address /subscriptions answers X-Robots-Tag: noindex, nofollow
FAIL addresses listed more than once in the sitemaps: /
```
### Task 2: release patches
**33-12-sm-demo-app.patch** (13 files):
- config:
- `config/golem15.journal.yaml` (new, `tag_pages: false`);
- `config/golem15.sitemap.yaml` (new, `site_url: https://demo.summercms.io`);
- `config/golem15.seo.yaml` (`route_report_token: ""` from the environment).
- deploy files:
- `deploy/env.example` and `deploy/site.env.example`: SEO tokens and the `NUXT_SEO_*` bases; `NUXT_PUBLIC_SITE_URL` and `NUXT_PUBLIC_SITEMAP_URL` dropped, since nothing reads them;
- `deploy/nginx/demo.summercms.io.conf`: `= /sitemap.xml` and `= /sitemap.xsl` dropped;
- `deploy/seo-pages.csv` (new).
- DEPLOY.md:
- the overview, the one-time setup with the SEO tokens, and the rewritten SEO section;
- the "Before" and "After the first release with Phase 33" steps (the token append refuses when a key exists and was dry-run twice; the additional-address cleanup and the CSV import were tested on the scratch backend);
- the smoke-seo.sh usage.
- README.md.
- `scripts/check-deploy.sh`: refuses `/_seo`, `/_sitemap` and `/sitemap*` locations.
- `scripts/smoke.sh`:
- runs `sitemap:rebuild` and checks the index on Go and, through the site, `/sitemap.xml`, `sitemap-posts-1.xml` and `/robots.txt`;
- starts the site with `NUXT_SEO_API_BASE`;
- replaces the deck check that relied on nuxt-site-config's `window.__NUXT_SITE_CONFIG__` with the empty-app-root and `X-Robots-Tag` check.
- `scripts/smoke-seo.sh` (new, 0755).
- `seo_output_test.go` (new).
**33-12-vue-demo-app.patch** (18 files):
- nuxt.config.ts:
- `site`, `robots`, `linkChecker` and `public.sitemapUrl` removed;
- `seo: { noindexRoutes: ['/p/**', '/presentations/**'] }`;
- `runtimeConfig.seo.apiBase` and `public.seo.apiBase: '/api/__seo__'`.
- Page meta, per P33-48:
- `seo: { robots: 'noindex, nofollow' }` on login, register, connect and link-admin;
- `requiresAuth: true` on account/security, subscriptions, friends, call/[conversation] and forum/t/[id];
- `seo: { robots: 'noindex' }` on quizzes/[slug] (login required) and roadmap (a redirect only);
- the robots value dropped from the three /presentations pages (noindexRoutes covers them).
- The footer's XML sitemap link is replaced by `<SeoSitemapLink />`, and the unused `footer.sitemap` labels are dropped.
- The patch adds no `useSeoMeta(` line with a robots value.
**33-12-vue-summercmsio-app.patch:**
- `changelog/nuxt.config.ts`: `seo: { cms: false, htmlSitemap: false }`;
- `changelog/testing/expect.txt`: 12 lines, covering title, canonical ×1, ld+json ×1, h1 ×1, no breadcrumbs, 404 for /sitemap and /mapa-strony, and `resolves * 0`.
The card and heading markup needed no expectation change: the app overrides PostCard, PostList and IndexHeader, so the layer's new card markup does not reach it.
**33-12-sm-summercmsio-app.patch:** the single note line. It needs `git apply --check --allow-empty` (see Deviations).
**Results:**
- demo:
- build passes, and fails without the noindexRoutes line;
- `go vet ./...`, `go test -short ./...` and `go test -tags summercms_mcp -count=1 ./...` (Docker) pass;
- `scripts/smoke.sh bin/demo` ends `smoke: ok`;
- `scripts/check-deploy.sh` ends `check-deploy: ok`;
- `pnpm test` gives 225/225.
- summercms.io:
- `test:changelog` gives 89 checks;
- `generate` passes;
- `pnpm test` gives 82 pass, 0 fail;
- `test:marketplace` gives 30 checks;
- Go `go test ./...` passes on the wiring.
**Cleanup:** the four worktrees were removed with `git worktree remove --force` after the patch commits. The demo worktree was recreated once for the TestSEOOutput fix and removed again. `git worktree list` shows only the main checkouts. The scratch Postgres and both servers are stopped. Ports 8120, 3020 and 55561 are free.
### Task 3: sm-bm-app (D-72)
- **Changes:**
- `frontend/public/robots.txt`;
- the robots meta in `frontend/index.html`;
- `add_header X-Robots-Tag "noindex, nofollow" always;` in both server blocks and in `location = /prezentacje/AW_tematy-prezentacji.html`;
- `scripts/check-noindex.sh`;
- DEPLOY.md, "Search engines (noindex)";
- one README line.
- **Check:** `check-noindex: ok`. Removing the header from the port-80 server, the header from the location, or the meta each fails with its own line.
- **Commit:** bd7ee84 on master, local, not pushed.
- **sm-bm-app `.planning`:** there were no other-session `.planning` changes to preserve; `git status --short .planning` was empty before and after.
## Task Commits
| Repo | Commit | Message |
|------|--------|---------|
| summercms.go | e1d5110 | docs(33-12): app patches for the release |
| summercms.go | 298c81d | docs(33-12): demo patch tags a post in TestSEOOutput |
| sm-bm-app | bd7ee84 | feat: keep the app out of search engines (noindex, Disallow) |
## Decisions Made
See `key-decisions` in the frontmatter. The main one: the demo's /pl/ problem is reported, not fixed (Rule 4).
## Deviations from Plan
### Auto-fixed and plan-shape deviations
**1. [Rule 1 - Bug] TestSEOOutput's tag check was vacuous**
- **Found during:** Task 2, after the first patch commit.
- **Issue:** demo:seed creates no tag, so the test passed without `config/golem15.journal.yaml` too.
- **Fix:** the test tags the seeded post and requires `/blog/tag/releases` to resolve `not_found`. Without the config the test fails: `resolves "ok", want not_found`.
- **Commit:** 298c81d. The patch was regenerated and re-checked.
**2. [Rule 1 - Bug] The live run never served `config/golem15.journal.yaml`**
- **Found during:** cleanup.
- **Issue:** the first manually started Go process kept port 8120, because its pid file recorded the subshell's pid. The later restarts could not bind the port. The local stack therefore served the config as it was at the first start, plus the env overrides.
- **Effect:** every smoke result stands, because none depends on the files added later. `tag_pages: false` is proven by TestSEOOutput only.
**3. [Rule 3 - Blocking] The release smoke depended on nuxt-site-config**
- **Issue:** `scripts/smoke.sh` used `window.__NUXT_SITE_CONFIG__` to prove the deck page renders in the browser only. That module left with @nuxtjs/seo.
- **Fix:** replaced by the empty `#__nuxt` root and the declared `X-Robots-Tag`. The smoke also starts the site with `NUXT_SEO_API_BASE` and checks the new sitemap format.
**4. [Rule 2 - Missing] Registry pages lose their titles**
- **Issue:** the route report creates registry pages named from their path ("Home", "Faq").
- **Fix:** `deploy/seo-pages.csv` and a DEPLOY import step bring back "SummerCMS Demo" and "FAQ", as P33-50 does for 33-13's site. Tested: the import applied with 2 changed and 0 refused, and the titles showed at once.
**5. [Rule 2 - Missing] Migrated sitemap addresses on rome**
- **Issue:** on rome the old sitemap definition becomes additional addresses (`/`, `/blog`, `/faq`, `/subscriptions`). That gives duplicates and a noindex address in the sitemap.
- **Fix:** DEPLOY.md's "After the first release" removes them through `PUT /_sitemap/api/v1/settings` (tested on the scratch backend). smoke-seo.sh now fails on duplicates and on noindex addresses.
**6. [Rule 2 - Missing] HTML sitemap pages on summercms.io's changelog**
- **Issue:** the layer registered `/sitemap` and `/mapa-strony` pages, which only answer 404 there.
- **Fix:** `htmlSitemap: false` next to `cms: false`. The expectations pin both 404s.
**7. Plan assumption: the empty patch**
- **Plan:** "git apply treats it as an empty patch".
- **Actual:** plain `git apply --check` answers `error: No valid patches in input (allow with "--allow-empty")`, exit 128. With `--allow-empty` it exits 0.
- **For 33-14:** use the flag or skip the file.
**8. Scope additions to the demo patch**
- **Added beyond the plan's list:** check-deploy.sh, smoke.sh, README.md, `deploy/env.example`, `deploy/site.env.example`, `deploy/seo-pages.csv` and `config/golem15.journal.yaml`.
- **Why:** each was needed for the new format or for correct output.
**9. P33-48 followed for `/subscriptions`**
- **What:** the page gets `requiresAuth: true`, as P33-48 says. The plan list is visible to visitors.
- **Open:** whether that is "signed-in" is listed as D7 (human judgement) for 33-14's checkpoint.
### Auth gates
None.
## Issues Encountered
**The demo's cookie-based Polish** (deferred-items.md, WINDOWS #34). The demo serves Polish from a cookie at one address, but the CMS names `/pl/…` addresses, which affects three outputs:
- hreflang;
- the sitemaps: 8 of 23 addresses, all 404;
- the Polish visitor's head: English CMS title over a Polish body.
Fixing it means moving the demo to `prefix_except_default`, which reverses D-13. **33-14 or Jakub must decide this before the demo patches are applied.**
Other findings, all in deferred-items.md:
- **Sitemap duplicates** (WINDOWS #35): the sitemap plugin does not de-duplicate additional addresses against content records.
- **Noindex additional addresses:** an additional address the site serves noindex stays listed.
- **Tag pattern in the site answer:** the SEO site answer lists `journal-tag` with `tag_pages: false` (a drift warning at every start).
- **Duplicate type export:** vue-journal-layer warns `Duplicated imports "JournalImageVariant"` on every build.
**Local quirks** (in the wiring note):
- the admin login throttle (5 a minute);
- `cp` is interactive in this shell (`/bin/cp -f`);
- `go build ./...` in sm-summercmsio-app drops a binary in the repository root (that is the untracked `sm-summercmsio-app` file in the live checkout);
- the secret-read guard blocks `.env` files, so the run variables lived in `$S/demo-run.vars` and were deleted at cleanup.
## For 33-14
**Pins:**
- sm-demo-app:
- go.mod requires and submodule pointers for sm-journal-plugin, sm-sitemap-plugin and sm-seo-plugin (all three move together, because the SEO plugin needs the sitemap `contract`), plus summercms v0.6.1;
- then `summer build` (plugins.gen.go), then apply 33-12-sm-demo-app.patch.
- vue-demo-app: pins vue-journal-layer v0.8.0, vue-menu-layer v0.5.0 and vue-faq-layer v0.5.0. vue-seo-layer comes in through them; add a direct pin if the layers' `link:` dependency becomes a git pin. Then apply 33-12-vue-demo-app.patch.
- sm-summercmsio-app: summercms v0.6.1 and sm-journal-plugin (submodule and require). Skip the empty patch, or apply it with `--allow-empty`.
- vue-summercmsio-app: vue-journal-layer v0.8.0, then apply 33-12-vue-summercmsio-app.patch. The changelog still gets @nuxtjs/seo from the landing ('..'), so the canonical and graph stay single.
- sm-bm-app:
- robots.txt and the meta reach rome only after `npm --prefix frontend run build` is committed in the jz.bm plugin repository (`jakub/sm-bm-plugin`, `plugins/jz/bm/public`), pushed, and the pointer bumped. 33-12 committed only in sm-bm-app.
- The nginx header is inserted into the live vhost by hand (DEPLOY.md, "Search engines (noindex)").
**Linking decision:**
- **Demo:** `scripts/build.sh` builds the release with `CGO_ENABLED=0` and no `nodynamic`, which gives a dynamically linked binary (checked: "dynamically linked"; with `-tags summercms_mcp,nodynamic` "statically linked").
- **summercms.io:** `scripts/build.sh` uses `CGO_ENABLED=0`, and the scratch build is "dynamically linked".
- **grzybyfunkcjonalne:** `CGO_ENABLED=0` as well (not built here).
- **DEPLOY.md:** both the demo's and summercms.io's say "(linux/amd64, static)". Add `nodynamic` or change that line.
**Rome steps:**
- the "Before" and "After the first release with Phase 33" blocks in the demo's DEPLOY.md: SEO tokens, NUXT_SEO bases, the vhost without the sitemap locations, clearing the additional addresses, `sitemap:rebuild`, the seo-pages.csv import;
- `journal:image-variants` once per site with Journal (33-11).
**Release-note items:**
- **Demo:** sitemap index and per-type files served by the site; `/sitemap.xsl` gone; noindex on decks and auth/signed-in pages; HTML sitemap link in the footer; page titles from the SEO plugin.
- **summercms.io:** changelog on the new journal layer with the SEO layer off.
- **bm:** noindex everywhere.
## Known Stubs
None. Two items are open (not stubs) and are in deferred-items.md and WINDOWS: the demo's `/pl/` WARN lines and the sitemap duplicates.
## Threat Flags
| Flag | File | Description |
|------|------|-------------|
| threat_flag: credential-handling | sm-demo-app scripts/smoke-seo.sh | Logs in as an admin to create and delete a redirect and a 404 log entry. The password is read from a file or the environment and passed through stdin and a temp file under mktemp, never argv; the token goes through `-H @file`; it logs out at exit. The default password is scripts/dev.sh's local admin. |
| threat_flag: secret-file-edit | sm-demo-app DEPLOY.md | The "Before the first release" block appends tokens to .env and site.env on rome and deletes two unused keys. It prints no value and refuses when a key exists. |
## Self-Check: PASSED
- FOUND: 33-12-sm-demo-app.patch, 33-12-vue-demo-app.patch, 33-12-sm-summercmsio-app.patch, 33-12-vue-summercmsio-app.patch, 33-12-local-wiring.md (phase directory)
- FOUND: ../sm-bm-app/frontend/public/robots.txt, ../sm-bm-app/scripts/check-noindex.sh
- FOUND commits: e1d5110, 298c81d (summercms.go), bd7ee84 (sm-bm-app)
- `git apply --check` passes for all four patches against the live HEADs (the empty one with `--allow-empty`)
- `bash ../sm-bm-app/scripts/check-noindex.sh` gives `check-noindex: ok`
- `grep -c noindexRoutes 33-12-vue-demo-app.patch` gives 1
- No scratch worktree of this plan remains, and none of this plan's processes are listening

View File

@@ -0,0 +1,202 @@
# 33-12 local wiring (P33-46)
How plan 33-12 ran the demo and summercms.io against the unreleased Phase 33 repositories, without pushing or tagging anything. 33-13 and 33-14 repeat these steps. Nothing here is committed to an application repository: the wiring (go.work, pnpm overrides, lockfiles, `plugins.gen.go`) stays in the scratch worktrees, and the patches carry only the changes that stay after the release (P33-47).
## Paths and ports
| What | Value |
|------|-------|
| Scratch directory | `/media/nvme/dev/golem15/summercms.io/scratch-33` (`$S`; outside every repository) |
| Sibling root | `/media/nvme/dev/golem15/summercms.io/summercms` (`$R`) |
| Demo Go binary | `127.0.0.1:8120` (dev.sh uses 8097; 8120 avoids a clash with a running dev stack) |
| Demo Nuxt server | `127.0.0.1:3020` (the dev.sh port; app.url and the site URLs point at it) |
| Scratch Postgres | `127.0.0.1:55561`, container `sm-demo-pg-scratch33`, postgres:17-alpine (sm-demo-pg on 55540 untouched) |
| 33-13's site | Nuxt `127.0.0.1:3016`, worktrees `$S/sm-grzybyfunkcjonalne-app` and `$S/vue-grzybyfunkcjonalne-app` (not touched by 33-12) |
Repository heads used: sm-demo-app da481c9, vue-demo-app 9a12701, sm-summercmsio-app ca06049, vue-summercmsio-app f36cbf1; sm-seo-plugin 49cc241, sm-sitemap-plugin 9e5c393, sm-journal-plugin 4f5bd19, vue-seo-layer 7af91fc, vue-journal-layer 1080a3f, vue-menu-layer 8b5da67, vue-faq-layer f7ec4fe, summercms.go at the 33-11 commits.
## Worktrees
```sh
S=/media/nvme/dev/golem15/summercms.io/scratch-33
R=/media/nvme/dev/golem15/summercms.io/summercms
mkdir -p $S
git -C $R/sm-demo-app worktree add --detach $S/sm-demo-app HEAD
git -C $R/sm-demo-app/vue-demo-app worktree add --detach $S/vue-demo-app HEAD
git -C $R/sm-summercmsio-app worktree add --detach $S/sm-summercmsio-app HEAD
git -C $R/sm-summercmsio-app/vue-summercmsio-app worktree add --detach $S/vue-summercmsio-app HEAD
```
A worktree's submodules are empty. The Go wiring points at the live checkouts' plugin submodules, and the Nuxt app lives in its own worktree. Tests that read the site from inside the Go repository need the empty directory replaced by a symlink for the run, and then restored before the patch is made:
```sh
rmdir $S/sm-demo-app/vue-demo-app && ln -s $S/vue-demo-app $S/sm-demo-app/vue-demo-app # scripts/smoke.sh
/bin/rm -f $S/sm-demo-app/vue-demo-app && mkdir $S/sm-demo-app/vue-demo-app # before git diff
```
The same applies to `$S/sm-summercmsio-app/vue-summercmsio-app` for `TestTerminalScript`.
## Go: sm-demo-app
`$S/sm-demo-app/go.work` replaces the committed one. It uses the live plugin submodules, except the three Phase 33 plugins, which come from the sibling checkouts. The SEO plugin needs the sitemap plugin's `contract` package, which the demo's pinned v0.1.2 submodule lacks.
```sh
cd $S/sm-demo-app
{
echo "go 1.27.0"; echo; echo "toolchain go1.27.0"; echo; echo "use ("; echo " ."
for p in chat chatbots chatchannels chatvideo faq feedback forum golem herald menu mfa moderation oauthserver pgstripe presentations quizzes sociallogin translate userfriends; do echo " $R/sm-demo-app/plugins/golem15/$p"; done
echo " $R/sm-journal-plugin"; echo " $R/sm-seo-plugin"; echo " $R/sm-sitemap-plugin"; echo ")"; echo
echo "replace git.golem15.com/golem15/summercms => $R/summercms.go"; echo
echo "replace ("
echo " git.golem15.com/golem15/sm-paymentgateway-plugin => $R/sm-demo-app/plugins/golem15/paymentgateway"
echo " git.golem15.com/golem15/sm-paymentgatewaysubscriptions-plugin => $R/sm-demo-app/plugins/golem15/paymentgatewaysubscriptions"
echo " git.golem15.com/golem15/sm-user-plugin => $R/sm-demo-app/plugins/golem15/user"
echo ")"
} > go.work
cp $R/sm-demo-app/go.work.sum .
(cd $R/summercms.go && go build -o $S/summer ./cmd/summer) # the CLI from the framework HEAD
$S/summer build # bin/demo (tags summercms_mcp); regenerates plugins.gen.go
```
`summer build` rewrites `plugins.gen.go` with the sibling versions (`v0.3.1-11-g4f5bd19` and the like). That file is wiring: 33-14 regenerates it on the real pins.
## Go: sm-summercmsio-app
Its `go.mod` replaces the plugins with `./plugins/golem15/*`, which are empty in a worktree. `go.work` replaces them at every version and uses only the app. Listing the plugins under `use` as well fails with "workspace module … is replaced at all versions".
```sh
cd $S/sm-summercmsio-app
cat > go.work <<EOF
go 1.27.0
toolchain go1.27.0
use .
replace git.golem15.com/golem15/summercms => $R/summercms.go
replace (
git.golem15.com/golem15/sm-journal-plugin => $R/sm-journal-plugin
git.golem15.com/golem15/sm-summercmsio-plugin => $R/sm-summercmsio-app/plugins/golem15/summercms
git.golem15.com/golem15/sm-translate-plugin => $R/sm-summercmsio-app/plugins/golem15/translate
git.golem15.com/golem15/sm-user-plugin => $R/sm-summercmsio-app/plugins/golem15/user
)
EOF
cp $R/sm-summercmsio-app/go.work.sum .
$S/summer build
```
Don't run `go build ./...` in the module root: it writes the binary `sm-summercmsio-app` there. The untracked `sm-summercmsio-app` file in the live checkout is such a binary.
## Nuxt: pnpm overrides
The same four lines go in each Nuxt worktree's `pnpm-workspace.yaml`. pnpm 12 reads `overrides:` there, and they apply at every depth, so the journal, menu and faq layers' own `link:../vue-seo-layer` resolves to the same checkout:
```sh
for d in $S/vue-demo-app $S/vue-summercmsio-app; do cat >> $d/pnpm-workspace.yaml <<EOF
overrides:
vue-seo-layer: link:$R/vue-seo-layer
vue-journal-layer: link:$R/vue-journal-layer
vue-menu-layer: link:$R/vue-menu-layer
vue-faq-layer: link:$R/vue-faq-layer
EOF
done
(cd $S/vue-demo-app && pnpm install && pnpm exec nuxt build)
export NUXT_PUBLIC_SUMMERCMS_VERSION=v0.6.1 # the summercms.io worktree has no ../go.mod
(cd $S/vue-summercmsio-app && pnpm install && pnpm run build:changelog && pnpm run test:changelog && pnpm run generate)
```
`pnpm install` rewrites `pnpm-lock.yaml` (wiring, left out of the patches). The build warns `Duplicated imports "JournalImageVariant"` (vue-journal-layer exports the type from two utils; harmless, deferred-items.md).
## The demo stack
The run variables live in `$S/demo-run.vars` (mode 0600, outside every repository). The tokens are generated per run and never printed (T-33-56):
```sh
rnd() { head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n'; }
(umask 077; cat > $S/demo-run.vars <<EOF
SUMMER_ENV=production
SUMMER_DATABASE__DSN=postgres://summercms_demo:summercms_demo@127.0.0.1:55561/summercms_demo?sslmode=disable
SUMMER_APP__KEY=$(head -c 32 /dev/urandom | base64)
SUMMER_ADMIN__JWT__SECRET=$(head -c 32 /dev/urandom | base64)
SUMMER_GOLEM15__USER__JWT__SECRET=$(head -c 32 /dev/urandom | base64)
SUMMER_GOLEM15__DEMO__VISITOR__EMAIL=visitor@example.test
SUMMER_GOLEM15__DEMO__VISITOR__PASSWORD=$(rnd | cut -c1-24)
SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN=$(rnd)
SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN=$(rnd)
SUMMER_SITE_CACHE__PURGE_URL=http://127.0.0.1:3020/api/__site__/cache/purge
SUMMER_SITE_CACHE__PURGE_TOKEN=$(rnd)
SUMMER_APP__URL=http://127.0.0.1:3020
SUMMER_GOLEM15__SEO__SITE_URL=http://127.0.0.1:3020
SUMMER_GOLEM15__SITEMAP__SITE_URL=http://127.0.0.1:3020
SUMMER_MCP__RESOURCE=http://127.0.0.1:3020/mcp
SUMMER_GOLEM15__OAUTHSERVER__MCP__RESOURCE=http://127.0.0.1:3020/mcp
SUMMER_REALTIME__DRIVER=null
SUMMER_GOLEM15__USER__REGISTRATION__USE_REGISTER_THROTTLE=false
EOF
)
```
`SUMMER_ENV=production` matters. Outside production, the SEO plugin answers every page `noindex, nofollow` (staging lock), and the noindex checks would prove nothing. The local overrides replace the production overlay's demo.summercms.io addresses. A file named `.env` cannot be used from an agent session, because the secret-read guard blocks any command that touches it.
```sh
docker run -d --name sm-demo-pg-scratch33 -e POSTGRES_DB=summercms_demo -e POSTGRES_USER=summercms_demo \
-e POSTGRES_PASSWORD=summercms_demo -p 127.0.0.1:55561:5432 postgres:17-alpine
cd $S/sm-demo-app && mkdir -p logs storage/app/uploads/public
set -a; . $S/demo-run.vars; set +a
./bin/demo migrate
printf '%s\n' 'AdminDemo123!' | ./bin/demo admin:create --email admin@example.test --login admin --superuser
./bin/demo demo:seed # Journal posts with categories and Polish translations
bash $S/run-demo-go.sh # bin/demo serve --addr 127.0.0.1:8120 (pid in logs/go.pid)
bash $S/run-demo-nuxt.sh # node .output/server/index.mjs on 127.0.0.1:3020 (pid in $S/logs/demo-nuxt.pid)
./bin/demo sitemap:rebuild # after the Nuxt start, so the reported pages are listed
```
`run-demo-nuxt.sh` passes the Nuxt server, under `env -i`, every `NUXT_*_API_BASE` at `http://127.0.0.1:8120`, plus `NUXT_SEO_API_BASE=http://127.0.0.1:8120/_seo/api/v1`, `NUXT_SEO_BACKEND_BASE=http://127.0.0.1:8120`, `NUXT_SEO_NOTFOUND_TOKEN`, `NUXT_SEO_ROUTE_REPORT_TOKEN` and `NUXT_CACHE_PURGE_TOKEN`, all from the vars file. `stop-demo.sh` stops both servers. The page titles of `deploy/seo-pages.csv` were imported with `POST /_seo/api/v1/import` (`{"dataset": "records", "csv": …}`), as DEPLOY.md's "After the first release with Phase 33" describes.
## Checks
```sh
cd $S/sm-demo-app
SMOKE_SEO_API=http://127.0.0.1:8120 bash scripts/smoke-seo.sh http://127.0.0.1:3020 # smoke-seo: ok
go vet ./... && go test -short ./...
go test -tags summercms_mcp -count=1 ./... # Docker (testcontainers)
go test -tags summercms_mcp -run 'TestSEOOutput|TestSEOTabMounted|TestBootAllPlugins' -count=1 -v .
bash scripts/smoke.sh bin/demo # with the vue-demo-app symlink
bash scripts/check-deploy.sh
cd $S/vue-demo-app && pnpm test
```
The admin login is throttled to 5 attempts a minute per address. The smoke logs in once, so two runs in the same minute after other logins answer 429; wait a minute.
The SEO smoke is also kept outside the worktrees as `$S/33-12-smoke-seo.sh`, for 33-13 to reuse.
## Patches
```sh
cd $S/sm-demo-app && git add -N config/golem15.journal.yaml config/golem15.sitemap.yaml deploy/seo-pages.csv scripts/smoke-seo.sh seo_output_test.go
git diff --binary -- DEPLOY.md README.md config/golem15.journal.yaml config/golem15.seo.yaml config/golem15.sitemap.yaml \
deploy/env.example deploy/nginx/demo.summercms.io.conf deploy/seo-pages.csv deploy/site.env.example \
scripts/check-deploy.sh scripts/smoke-seo.sh scripts/smoke.sh seo_output_test.go > 33-12-sm-demo-app.patch
cd $S/vue-demo-app && git diff --binary -- $(git diff --name-only | grep -v '^pnpm-') > 33-12-vue-demo-app.patch
cd $S/vue-summercmsio-app && git diff --binary -- changelog/nuxt.config.ts changelog/testing/expect.txt > 33-12-vue-summercmsio-app.patch
printf '# no change beyond the pin bumps in 33-14\n' > 33-12-sm-summercmsio-app.patch
git -C $R/sm-demo-app apply --check 33-12-sm-demo-app.patch
git -C $R/sm-demo-app/vue-demo-app apply --check 33-12-vue-demo-app.patch
git -C $R/sm-summercmsio-app/vue-summercmsio-app apply --check 33-12-vue-summercmsio-app.patch
git -C $R/sm-summercmsio-app apply --check --allow-empty 33-12-sm-summercmsio-app.patch # without --allow-empty: "No valid patches in input"
```
## Cleanup
```sh
bash $S/stop-demo.sh
docker rm -f sm-demo-pg-scratch33
/bin/rm -f $S/demo-run.vars
git -C $R/sm-demo-app worktree remove --force $S/sm-demo-app
git -C $R/sm-demo-app/vue-demo-app worktree remove --force $S/vue-demo-app
git -C $R/sm-summercmsio-app worktree remove --force $S/sm-summercmsio-app
git -C $R/sm-summercmsio-app/vue-summercmsio-app worktree remove --force $S/vue-summercmsio-app
```
`--force` is needed because the worktrees hold the wiring and build output. The patches are committed before the removal.

View File

@@ -0,0 +1,975 @@
diff --git a/DEPLOY.md b/DEPLOY.md
index 19b6300..f2f4d0b 100644
--- a/DEPLOY.md
+++ b/DEPLOY.md
@@ -23,11 +23,12 @@ internet ──> Cloudflare (proxied, like summercms.io) ──443──> nginx
│ /_paymentgatewaysubscriptions/ /_presentations/ /_quizzes/
│ /_feedback/ /_demo/ /webhook/stripe/ /storage/app/uploads/public/
│ /_chat/ /_chatchannels/ /_chatbots/ /_chatvideo/ /_forum/ /_userfriends/
- │ = /api/realtime/token = /sitemap.xml = /sitemap.xsl
+ │ = /api/realtime/token = /robots.txt
│ = /mcp (unbuffered) /.well-known/oauth-protected-resource*
│ = /.well-known/oauth-authorization-server /oauth/mcp/
└── everything else (GET/HEAD) ...... 127.0.0.1:3098 summercms-demo-site (Nuxt SSR on Node)
│ server-side API calls to 127.0.0.1:8098
+ │ (also /sitemap.xml and its files, through vue-seo-layer)
bin/demo ── PostgreSQL 15 (database summercms_demo, role summercms_demo) ── storage/ (uploads)
└─ jobs in-process (Stripe webhooks); site-cache purge POST to 127.0.0.1:3098 (loopback only)
└─ publishes the phone remote's messages to Centrifugo's HTTP API on 127.0.0.1:8010
@@ -138,11 +139,12 @@ DBPW=$(openssl rand -hex 24)
printf "CREATE ROLE summercms_demo LOGIN PASSWORD '%s';\n" "$DBPW" | sudo -u postgres psql -v ON_ERROR_STOP=1 -q
sudo -u postgres createdb -O summercms_demo -E UTF8 summercms_demo
-# .env and site.env, root:summercms-demo 0640. The purge token is shared
-# (site.env names it NUXT_CACHE_PURGE_TOKEN, never NUXT_SITE_*: see Secrets).
+# .env and site.env, root:summercms-demo 0640. The purge token and the two
+# SEO tokens are shared (site.env names the purge token NUXT_CACHE_PURGE_TOKEN,
+# never NUXT_SITE_*: see Secrets).
sudo install -o root -g summercms-demo -m 0640 /dev/null /srv/summercms-demo/.env
sudo install -o root -g summercms-demo -m 0640 /dev/null /srv/summercms-demo/site.env
-PT=$(openssl rand -hex 32)
+PT=$(openssl rand -hex 32) NT=$(openssl rand -hex 32) RT=$(openssl rand -hex 32)
{
printf 'SUMMER_DATABASE__DSN=postgres://summercms_demo:%s@127.0.0.1:5432/summercms_demo?sslmode=disable\n' "$DBPW"
printf 'SUMMER_APP__KEY=%s\n' "$(openssl rand -base64 32)"
@@ -152,6 +154,8 @@ PT=$(openssl rand -hex 32)
printf 'SUMMER_GOLEM15__DEMO__VISITOR__PASSWORD=%s\n' "$(openssl rand -hex 12)"
printf 'SUMMER_SITE_CACHE__PURGE_URL=http://127.0.0.1:3098/api/__site__/cache/purge\n'
printf 'SUMMER_SITE_CACHE__PURGE_TOKEN=%s\n' "$PT"
+ printf 'SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN=%s\n' "$NT"
+ printf 'SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN=%s\n' "$RT"
} | sudo tee /srv/summercms-demo/.env >/dev/null
{
grep -v '^#' <<'EOF'
@@ -160,12 +164,14 @@ NUXT_MENU_API_BASE=http://127.0.0.1:8098/_menu/api/v1
NUXT_FAQ_API_BASE=http://127.0.0.1:8098/_faq/api/v1
NUXT_PAYMENTGATEWAY_API_BASE=http://127.0.0.1:8098/_paymentgateway/api/v1
NUXT_PAYMENTGATEWAYSUBSCRIPTIONS_API_BASE=http://127.0.0.1:8098/_paymentgatewaysubscriptions/api/v1
-NUXT_PUBLIC_SITE_URL=https://demo.summercms.io
-NUXT_PUBLIC_SITEMAP_URL=/sitemap.xml
+NUXT_SEO_API_BASE=http://127.0.0.1:8098/_seo/api/v1
+NUXT_SEO_BACKEND_BASE=http://127.0.0.1:8098
EOF
printf 'NUXT_CACHE_PURGE_TOKEN=%s\n' "$PT"
+ printf 'NUXT_SEO_NOTFOUND_TOKEN=%s\n' "$NT"
+ printf 'NUXT_SEO_ROUTE_REPORT_TOKEN=%s\n' "$RT"
} | sudo tee /srv/summercms-demo/site.env >/dev/null
-unset DBPW PT
+unset DBPW PT NT RT
```
The visitor email comes from the build machine's secrets file, piped over SSH (never on a command
@@ -662,8 +668,8 @@ the 404 log, robots.txt with AI bot switches, history and the `seo_` MCP tools (
`golem15.seo.manage`). `config/golem15.seo.yaml` sets `site_url` to `https://demo.summercms.io`.
- **robots.txt moves to Go.** nginx sends `= /robots.txt` to the Go port (`deploy/nginx/demo.summercms.io.conf`);
- the Nuxt robots module no longer answers it. Before the first release with the plugin, copy the
- `Disallow` lines the Nuxt config writes today (`goPaths` in `vue-demo-app/nuxt.config.ts`: `/_user`,
+ the site has no Nuxt robots module. Before the first release with the plugin, copy the
+ `Disallow` lines the Nuxt config wrote (`goPaths` in `vue-demo-app/nuxt.config.ts`: `/_user`,
`/_journal`, `/_menu`, `/_faq`, `/_paymentgateway`, `/_paymentgatewaysubscriptions`, `/_feedback`,
`/storage`, `/_presentations`, `/_quizzes`, `/_demo`, `/api/realtime/token`, `/mcp`,
`/.well-known/oauth-protected-resource`, `/.well-known/oauth-authorization-server`, `/oauth/mcp/`) into
@@ -674,11 +680,100 @@ the 404 log, robots.txt with AI bot switches, history and the `seo_` MCP tools (
`Disallow: /_forum`, `Disallow: /_userfriends` and `Disallow: /livekit` under `User-agent: *`
(`goPaths` lists the six API prefixes). `/_herald` is not routed and needs no line.
`scripts/check-live.sh` checks the `/_chat` and `/_forum` lines.
-- **404 log.** Set `SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN` in `.env` on rome (a random value, never printed
- or committed) and the same token in the Nuxt site's environment once the frontend layer reports 404s
- (Phase 33); without it the report endpoint stays off.
+- **The site's head comes from the plugin** (vue-seo-layer, through vue-journal-layer, vue-menu-layer and
+ vue-faq-layer). Every page is resolved with the plugin before Nuxt renders it: the title, description,
+ canonical, robots, Open Graph, hreflang and one JSON-LD `@graph` come from the answer, breadcrumbs and
+ pagination are rendered on the server, and redirects and 410s from **SEO › Redirects** apply on the
+ site. Browser navigations resolve through the Nuxt server (`/api/__seo__/resolve`), so `/_seo` has no
+ nginx location. `site.env` names the API (`NUXT_SEO_API_BASE`) and the Go origin of the root files
+ (`NUXT_SEO_BACKEND_BASE`), both on loopback (`deploy/site.env.example`).
+- **404 log and page registry.** `SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN` and
+ `SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN` in `.env`, the same values as `NUXT_SEO_NOTFOUND_TOKEN` and
+ `NUXT_SEO_ROUTE_REPORT_TOKEN` in `site.env` (random, never printed or committed; "One-time server
+ setup" writes them, "Before the first release with Phase 33" below adds them to an existing install).
+ Each 404 page view lands in **SEO › 404 log**; at every start the site reports its static pages (`/`,
+ `/blog`, `/chat`, `/contact`, `/faq`, `/forum`, `/quizzes`), which appear in **SEO › Pages** and the
+ sitemaps. Without a token nothing is reported.
+- **Noindex pages.** The deck routes `/p/**` and `/presentations/**` render in the browser only and are
+ declared in `seo.noindexRoutes` (`vue-demo-app/nuxt.config.ts`; the layer's build guard refuses any other
+ browser-only route, D-70); the auth pages (login, register, connect, link-admin) and the signed-in pages
+ (account security, subscriptions, friends, calls, forum threads) set it in their page meta; quizzes and
+ the roadmap redirect keep `noindex`. All of them answer `X-Robots-Tag: noindex, nofollow` (`noindex`
+ for the two) and stay out of the route report.
+- **Sitemaps** (sm-sitemap-plugin). `/sitemap.xml` is a sitemap index of `/sitemap-<type>-<n>.xml`
+ files (posts, categories, authors, pages), which Nuxt serves from the Go port's `/_sitemap/files/` on
+ loopback: nginx has no `/sitemap*` or `/_sitemap` location (`scripts/check-deploy.sh` checks it) and
+ `/sitemap.xsl` is gone. The addresses start with `golem15.sitemap.site_url`
+ (`config/golem15.sitemap.yaml`, or **Settings › Sitemaps**); without one `/sitemap.xml` answers 404. The
+ demo has no tag pages (`config/golem15.journal.yaml`, `tag_pages: false`), so no tag address is listed.
+ Rebuilds run as jobs in the serve process after each Journal save and nightly. The footer links the
+ HTML sitemap (`/sitemap`, `/mapa-strony` in Polish).
+- **Page titles.** A reported page takes its name from its path ("Home", "Faq") until it has its own SEO
+ title; `deploy/seo-pages.csv` holds the titles and descriptions the pages had before (records by URL,
+ imported once, below).
- **Verify** after the release: `curl -s https://demo.summercms.io/robots.txt` shows the copied lines and
- the `Sitemap:` line; `curl -sI https://demo.summercms.io/robots.txt` answers 200 `text/plain`.
+ the `Sitemap:` line; `curl -sI https://demo.summercms.io/robots.txt` answers 200 `text/plain`; and from
+ the build machine `SMOKE_SEO_API=… scripts/smoke-seo.sh https://demo.summercms.io` (below) ends with
+ `smoke-seo: ok`.
+
+**Before the first release with Phase 33** (the SEO layer and the new sitemap format), on rome as root
+(`$RSH $ROME 'sudo bash -s'` with a quoted heredoc). It adds the two SEO tokens to both files and
+refuses when either already names one, never printing a value:
+
+```sh
+set -euo pipefail
+E=/srv/summercms-demo/.env S=/srv/summercms-demo/site.env
+n=$(cat "$E" "$S" | { grep -c -E '^(SUMMER_GOLEM15__SEO__(NOTFOUND|ROUTE_REPORT)_TOKEN|NUXT_SEO_)' || true; })
+[ "$n" = 0 ] || { echo "$n SEO keys are already set; edit the files by hand"; exit 1; }
+NT=$(openssl rand -hex 32) RT=$(openssl rand -hex 32)
+printf 'SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN=%s\nSUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN=%s\n' "$NT" "$RT" >>"$E"
+printf 'NUXT_SEO_API_BASE=http://127.0.0.1:8098/_seo/api/v1\nNUXT_SEO_BACKEND_BASE=http://127.0.0.1:8098\n' >>"$S"
+printf 'NUXT_SEO_NOTFOUND_TOKEN=%s\nNUXT_SEO_ROUTE_REPORT_TOKEN=%s\n' "$NT" "$RT" >>"$S"
+unset NT RT
+sed -i '/^NUXT_PUBLIC_SITE_URL=\|^NUXT_PUBLIC_SITEMAP_URL=/d' "$S" # read by nothing since the SEO layer
+```
+
+**After the first release with Phase 33** (the release restarted both programs and installed the vhost
+without the sitemap locations), on rome as root, the same way as "robots.txt without a browser" (the
+admin password through `jq` into a 0700 temp directory). The migration copied the old sitemap
+definition's url items into the additional addresses; the reported pages list `/`, `/blog` and `/faq`
+already and `/subscriptions` is noindex, so they are removed. Then the sitemaps are rebuilt once and the
+page titles imported:
+
+```sh
+set -euo pipefail; umask 077
+D=$(mktemp -d); trap 'rm -rf "$D"' EXIT; G=http://127.0.0.1:8098
+jq -R '{login:"admin",password:.}' </root/summercms-demo-admin.txt >"$D/login.json"
+curl -sf -o "$D/login.out" -X POST -H 'Content-Type: application/json' -d @"$D/login.json" $G/smbackend/api/v1/auth/login
+printf 'Authorization: Bearer %s\n' "$(jq -r .data.access_token "$D/login.out")" >"$D/hdr"
+curl -sf -o "$D/sitemap.json" -H @"$D/hdr" $G/_sitemap/api/v1/settings
+jq -c .data.settings.extra_urls "$D/sitemap.json" # the copied addresses, kept for the record
+jq '{extra_urls: [.data.settings.extra_urls[] | select(.url as $u | ["/", "/blog", "/faq", "/subscriptions"] | index($u) | not)]}' "$D/sitemap.json" >"$D/put.json"
+curl -s -o /dev/null -w '%{http_code}\n' -X PUT -H @"$D/hdr" -H 'Content-Type: application/json' -d @"$D/put.json" $G/_sitemap/api/v1/settings # 200
+(cd /srv/summercms-demo && sudo -u summercms-demo SUMMER_ENV=production ./bin/demo sitemap:rebuild) # Rebuilt the sitemaps: …
+jq -Rs '{dataset: "records", csv: .}' </tmp/seo-pages.csv >"$D/import.json"
+curl -s -o "$D/import.out" -w '%{http_code}\n' -H @"$D/hdr" -H 'Content-Type: application/json' -d @"$D/import.json" $G/_seo/api/v1/import # 200
+jq -c '{applied, summary}' "$D/import.out" # applied true, refused 0
+curl -s -o /dev/null -X POST -H @"$D/hdr" -H 'Content-Type: application/json' -d '{}' $G/smbackend/api/v1/auth/logout
+```
+
+`/tmp/seo-pages.csv` is `deploy/seo-pages.csv`, uploaded first
+(`rsync -av -e "$RSH" deploy/seo-pages.csv $ROME:/tmp/seo-pages.csv`). The import needs the route report
+first: the Nuxt site sends it right after its start (`[vue-seo-layer] route report: 7 routes sent` in its
+log).
+
+**smoke-seo.sh** checks the SEO output through the site the way a visitor and a crawler see it: a Journal
+post's CMS title, one canonical, hreflang, one JSON-LD `@graph` and breadcrumbs; the sitemap index, its
+files and their addresses (no duplicate, none noindex); robots.txt; the noindex routes and pages; the HTML
+sitemap; a redirect it creates through the SEO API (301 from Nuxt, removed again); the reported pages in
+the registry; and a 404 reaching the 404 log (removed again). Locally after `scripts/dev.sh up`:
+`scripts/smoke-seo.sh http://127.0.0.1:3020`. Against rome, from the build machine with the admin
+password in a 0600 file and the Go port reached over an SSH tunnel
+(`$RSH -N -L 18098:127.0.0.1:8098 $ROME &`):
+`SMOKE_SEO_API=http://127.0.0.1:18098 SMOKE_SEO_ADMIN_PASSWORD_FILE=… scripts/smoke-seo.sh https://demo.summercms.io`.
+An alternate or sitemap address that does not answer 200 is a `WARN` line (`SMOKE_SEO_STRICT=1` makes it
+a failure): the Polish addresses (`/pl/…`) the CMS names answer 404 while the site keeps the language in a
+cookie at one address (D-13).
## Build
diff --git a/README.md b/README.md
index 5439013..78aa580 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,8 @@ a login (no public page links to it); `DEPLOY.md` covers the server setup, build
rollback.
- **Go** (`bin/demo`, 127.0.0.1:8097): the admin at `/smbackend` (`backend.uri` in
- `config/backend.yaml`), every plugin's API and `/sitemap.xml`.
+ `config/backend.yaml`), every plugin's API, robots.txt and the sitemaps the site serves at
+ `/sitemap.xml` (DEPLOY.md, "SEO").
- **Nuxt** (`vue-demo-app`, 127.0.0.1:3020): the guided tour home page, journal, FAQ, subscriptions,
registration and login (Turnstile), contact, presentations and quizzes, in English and Polish.
- **Postgres** (docker compose, 127.0.0.1:55540): database, user and password `summercms_demo`.
@@ -32,7 +33,7 @@ is a package of the root module.
| `golem15.moderation` | `plugins/golem15/moderation` (`sm-moderation-plugin`) | Banned words and links, edited in Settings; the demo refuses chat messages and forum posts that contain them |
| `golem15.translate` | `plugins/golem15/translate` | Locales and translatable content |
| `golem15.journal` | `plugins/golem15/journal` | Posts and categories (`/_journal/api/v1`) |
-| `golem15.sitemap` | `plugins/golem15/sitemap` | `/sitemap.xml` from a definition edited in Settings |
+| `golem15.sitemap` | `plugins/golem15/sitemap` | The sitemap index `/sitemap.xml` and its per-type files, built from the content and edited in Settings › Sitemaps |
| `golem15.menu` | `plugins/golem15/menu` | Menus (`/_menu/api/v1`) |
| `golem15.faq` | `plugins/golem15/faq` | FAQs (`/_faq/api/v1`) |
| `golem15.paymentgateway` | `plugins/golem15/paymentgateway` | Orders and payments (`/_paymentgateway/api/v1`) |
@@ -275,7 +276,8 @@ scripts/build.sh # release: bin/demo (linux/amd64) and vue-demo-app/.
scripts/smoke.sh # boot both on a fresh postgres:15 and check the APIs, every server-rendered page and the purge route (no purge token in any page)
scripts/check-pins.sh # every plugin submodule is on the version go.mod requires
scripts/build.sh dev # host build through go.work, no refusals
-scripts/check-deploy.sh # deploy/: nginx -t, supervisor parse, ports, /backend refused, /smbackend to Go, no /oauth or /api/ to Go (but the realtime token), Centrifugo checkconfig and ports, no NUXT_SITE_* key in site.env.example, the LiveKit program, ports and caps, the chat-family locations, no /_herald
+scripts/check-deploy.sh # deploy/: nginx -t, supervisor parse, ports, /backend refused, /smbackend to Go, no /oauth or /api/ to Go (but the realtime token), Centrifugo checkconfig and ports, no NUXT_SITE_* key in site.env.example, the LiveKit program, ports and caps, the chat-family locations, no /_herald, no /sitemap, /_sitemap or /_seo location
+scripts/smoke-seo.sh http://127.0.0.1:3020 # a running site's SEO output: a post's CMS head, one graph and breadcrumbs, the sitemap index and files, robots.txt, noindex routes and pages, the HTML sitemap, a redirect, the page registry and the 404 log (DEPLOY.md, "SEO")
scripts/check-live.sh https://demo.summercms.io # a deployed origin: banner, HSTS, /backend 404, /smbackend admin 200, API 200, /register Turnstile, /contact, Polish, token-less register 422, /roadmap, quizzes, realtime token 401, /ws upgrade, no link to the admin, no purge key in a page, /chat /forum /friends /call prompts, chat-family 401s, /livekit/rtc/validate from LiveKit, no /_herald, robots lines, Back in a browser
```
@@ -305,14 +307,16 @@ scripts/check-live.sh https://demo.summercms.io # a deployed origin: banner, H
`vue-demo-app/.output` on 127.0.0.1:13098 (`SMOKE_SITE_PORT`) against the binary and checks every
server-rendered page (`/`, `/blog`, a post, `/faq`, `/subscriptions`, `/register`, `/login`,
`/contact`, `/quizzes`: banner, test card and backend call to action present; no admin path and
- no visitor credential), the `/roadmap` redirect and the quiz list. The deck pages are client-only;
+ no visitor credential), the `/roadmap` redirect and the quiz list. It runs `sitemap:rebuild` and
+ checks the sitemap index on the binary and, through the site, `/sitemap.xml`, a sitemap file and
+ `/robots.txt`. The deck pages are client-only (an empty app root, `X-Robots-Tag: noindex, nofollow`);
`scripts/dev.sh snapshot --site` checks their compact banner (`deck-snapshot.cjs --expect-banner`).
The site runs with two throwaway purge tokens, `NUXT_CACHE_PURGE_TOKEN` and the deprecated
- `NUXT_SITE_CACHE_PURGE_TOKEN`: no server-rendered page and no deck page
- (`window.__NUXT_SITE_CONFIG__`) may carry either value or a purge key name (`cachePurgeToken`,
+ `NUXT_SITE_CACHE_PURGE_TOKEN`: no server-rendered page and no deck page may carry either value or a purge key name (`cachePurgeToken`,
`cacheAllowProxied`), the new token purges (200) and the deprecated one gets 401, and the site log
- has no value and no deprecation warning (the new name wins, so the old one is ignored). nuxt-site-config publishes every `NUXT_SITE_*` variable
- in the page payload, which is how the old name leaked before vue-journal-layer 0.6.0.
+ has no value and no deprecation warning (the new name wins, so the old one is ignored). nuxt-site-config
+ (gone with vue-journal-layer 0.8.0) published every `NUXT_SITE_*` variable in the page payload, which
+ is how the old name leaked before vue-journal-layer 0.6.0.
It ends with `smoke: ok`.
- **Local runs** export `SUMMER_ENV=local` (`scripts/dev.sh`), so the production overlay in
`config/env/production/` (debug off, the public origin, CORS, Stripe return URLs) applies only on
diff --git a/config/golem15.journal.yaml b/config/golem15.journal.yaml
new file mode 100644
index 0000000..c7edb31
--- /dev/null
+++ b/config/golem15.journal.yaml
@@ -0,0 +1,7 @@
+# golem15.journal (sm-journal-plugin): the demo's Journal.
+#
+# The site has no tag pages (vue-demo-app nuxt.config.ts: journal.routes.tag
+# is false), so tag URLs resolve to nothing: the sitemaps, the SEO plugin's
+# resolve and the menu item types never name /blog/tag/... addresses that
+# answer 404. Author pages stay on (/blog/author/:author).
+tag_pages: false
diff --git a/config/golem15.seo.yaml b/config/golem15.seo.yaml
index dbea376..b99938f 100644
--- a/config/golem15.seo.yaml
+++ b/config/golem15.seo.yaml
@@ -2,11 +2,20 @@
# URL rules, redirects, the 404 log, robots.txt and the SEO MCP tools.
#
# site_url is the public origin the Nuxt site serves; canonical URLs,
-# Open Graph URLs and robots.txt Sitemap lines are built from it, never from
-# a request's Host. The 404 report token comes from the environment
-# (SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN, .env on rome; never committed);
-# without it the report endpoint is off.
+# Open Graph URLs, hreflang alternates, the JSON-LD graph and robots.txt
+# Sitemap lines are built from it, never from a request's Host. Locally,
+# override it with SUMMER_GOLEM15__SEO__SITE_URL (http://127.0.0.1:3020).
+#
+# Both tokens come from the environment (.env on rome; never committed) and
+# the Nuxt site gets the same values (site.env, NUXT_SEO_NOTFOUND_TOKEN and
+# NUXT_SEO_ROUTE_REPORT_TOKEN):
+# - notfound_token (SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN): the 404 report;
+# empty turns the endpoint off.
+# - route_report_token (SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN): the route
+# report vue-seo-layer posts at server start, which lists the site's static
+# pages in SEO › Pages; empty falls back to notfound_token.
site_url: https://demo.summercms.io
notfound_token: ""
+route_report_token: ""
robots_sitemaps:
- /sitemap.xml
diff --git a/config/golem15.sitemap.yaml b/config/golem15.sitemap.yaml
new file mode 100644
index 0000000..1c09ca2
--- /dev/null
+++ b/config/golem15.sitemap.yaml
@@ -0,0 +1,15 @@
+# golem15.sitemap (sm-sitemap-plugin): the sitemap index at /sitemap.xml and
+# its per-type files /sitemap-<type>-<n>.xml, built from the Journal posts,
+# categories and authors, the SEO plugin's page registry and the additional
+# addresses (Settings › Sitemaps).
+#
+# site_url is the public origin every <loc> starts with (the Site address
+# setting wins when it is set); without either, /sitemap.xml answers 404. The
+# request's Host is never used. Locally, override it with
+# SUMMER_GOLEM15__SITEMAP__SITE_URL (http://127.0.0.1:3020).
+#
+# Rebuilds run as conga jobs in the serve process (config/queue.yaml
+# work_in_serve) after every Journal save and nightly; after a release that
+# changes the sitemap format, run `bin/demo sitemap:rebuild` once (DEPLOY.md,
+# "SEO").
+site_url: https://demo.summercms.io
diff --git a/deploy/env.example b/deploy/env.example
index cdf6238..ada8493 100644
--- a/deploy/env.example
+++ b/deploy/env.example
@@ -34,6 +34,12 @@ SUMMER_GOLEM15__PGSTRIPE__TEST_SUBSCRIPTION_WEBHOOK_SECRET=
# "Rotating the site-cache purge token").
SUMMER_SITE_CACHE__PURGE_URL=http://127.0.0.1:3098/api/__site__/cache/purge
SUMMER_SITE_CACHE__PURGE_TOKEN=
+# golem15.seo (config/golem15.seo.yaml): the 404 report token and the route
+# report token, the same values as NUXT_SEO_NOTFOUND_TOKEN and
+# NUXT_SEO_ROUTE_REPORT_TOKEN in site.env (openssl rand -hex 32). Empty: the
+# 404 log gets no reports and SEO › Pages lists no static pages.
+SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN=
+SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN=
# Cloudflare Turnstile on register and login (D-07; golem15.user.turnstile is
# closed in config/golem15.user.yaml): the secret key of the Turnstile widget
# for demo.summercms.io, from the operator's secrets file. Without it every
diff --git a/deploy/nginx/demo.summercms.io.conf b/deploy/nginx/demo.summercms.io.conf
index 3dbedf2..20d4e56 100644
--- a/deploy/nginx/demo.summercms.io.conf
+++ b/deploy/nginx/demo.summercms.io.conf
@@ -3,8 +3,8 @@
# - summercms-demo, the Go binary, on 127.0.0.1:8098 (supervisor program
# summercms-demo): only the allow-listed prefixes below (the admin at
# /smbackend, plugin APIs including the chat family, the demo API, the
-# realtime token route, Stripe webhooks, public uploads, the sitemap,
-# the MCP endpoint and its OAuth paths);
+# realtime token route, Stripe webhooks, public uploads, robots.txt,
+# the MCP endpoint and its OAuth paths); the sitemaps go through Nuxt;
# - summercms-demo-centrifugo, the demo's own Centrifugo, on 127.0.0.1:8010
# (supervisor program summercms-demo-centrifugo, D-17): the WebSocket at
# /ws of the presentations' speaker view and phone remote, the chat, the
@@ -405,24 +405,11 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
- # The sitemap plugin's document and its stylesheet.
- location = /sitemap.xml {
- proxy_pass http://127.0.0.1:8098;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
-
- location = /sitemap.xsl {
- proxy_pass http://127.0.0.1:8098;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
+ # The sitemaps (/sitemap.xml, the index, and its /sitemap-<type>-<n>.xml
+ # files), llms.txt and the verification files reach Nuxt through
+ # location /: vue-seo-layer fetches them from the Go port on loopback
+ # (/_sitemap/files/ and the SEO plugin's API), so neither /_sitemap nor
+ # /_seo has a location here (scripts/check-deploy.sh checks it).
# Nuxt: pages, /_nuxt assets, fonts. GET and HEAD only, so the layers' POST
# routes (the site-cache purge, called by Go on loopback) stay unreachable.
diff --git a/deploy/seo-pages.csv b/deploy/seo-pages.csv
new file mode 100644
index 0000000..c98c558
--- /dev/null
+++ b/deploy/seo-pages.csv
@@ -0,0 +1,3 @@
+url,locale,title,description
+/,en,SummerCMS Demo,A guided tour of SummerCMS: every shared Golem15 plugin on one Go binary.
+/faq,en,FAQ,"Managed in the admin under FAQ, one set per language; served by the FAQ API and rendered with vue-faq-layer."
diff --git a/deploy/site.env.example b/deploy/site.env.example
index 05b34c5..46d7b37 100644
--- a/deploy/site.env.example
+++ b/deploy/site.env.example
@@ -10,10 +10,18 @@ NUXT_PAYMENTGATEWAY_API_BASE=http://127.0.0.1:8098/_paymentgateway/api/v1
NUXT_PAYMENTGATEWAYSUBSCRIPTIONS_API_BASE=http://127.0.0.1:8098/_paymentgatewaysubscriptions/api/v1
# The demo's own API (golem15.demo): /roadmap and /quizzes read it on the server.
NUXT_DEMO_API_BASE=http://127.0.0.1:8098/_demo/api/v1
-# The public origin (canonical URLs, sitemap and robots of the SEO module) and
-# the footer's sitemap link (nginx sends /sitemap.xml to Go).
-NUXT_PUBLIC_SITE_URL=https://demo.summercms.io
-NUXT_PUBLIC_SITEMAP_URL=/sitemap.xml
+# vue-seo-layer: the SEO plugin's API (resolve, site answer, 404 and route
+# reports) and the Go origin of the root files (robots.txt, the sitemaps);
+# the head, canonical and sitemap URLs come from golem15.seo.site_url and
+# golem15.sitemap.site_url on the binary, never from here.
+NUXT_SEO_API_BASE=http://127.0.0.1:8098/_seo/api/v1
+NUXT_SEO_BACKEND_BASE=http://127.0.0.1:8098
+# The same values as SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN and
+# SUMMER_GOLEM15__SEO__ROUTE_REPORT_TOKEN in .env (openssl rand -hex 32,
+# generated on rome, never printed): the 404 report and the route report of
+# the static pages to SEO › Pages. Empty: nothing is reported.
+NUXT_SEO_NOTFOUND_TOKEN=
+NUXT_SEO_ROUTE_REPORT_TOKEN=
# Site cache purge token: the same value as SUMMER_SITE_CACHE__PURGE_TOKEN in
# .env, generated on rome (openssl rand -hex 32) and never printed. Fewer
# than 32 characters disables the purge route. The name is deliberately not
diff --git a/scripts/check-deploy.sh b/scripts/check-deploy.sh
index 417cbc5..0d7d801 100755
--- a/scripts/check-deploy.sh
+++ b/scripts/check-deploy.sh
@@ -39,6 +39,8 @@
# - each chat-family prefix (/_chat/, /_chatchannels/, /_chatbots/,
# /_chatvideo/, /_forum/, /_userfriends/) is a location to the Go port,
# and no location routes /_herald (D-16: no subscribe UI);
+# - no location routes /_seo, /_sitemap or /sitemap*: vue-seo-layer serves
+# the sitemaps through Nuxt from the Go port on loopback;
# - livekit.yaml.example holds placeholder keys only, and env.example
# declares the LiveKit and VAPID keys empty.
# Each LiveKit and chat-family mismatch prints its own line.
@@ -405,6 +407,10 @@ for prefix in ("_chat", "_chatchannels", "_chatbots", "_chatvideo", "_forum", "_
for loc in re.findall(r"location\s+(?:[=~^*]+\s+)?(\S+)\s*\{", code):
if loc.startswith("/_herald"):
problems.append(f"nginx routes {loc}: /_herald stays unrouted (D-16, no subscribe UI)")
+ # vue-seo-layer serves the sitemaps from the Go port on loopback and
+ # resolves through the Nuxt server (DEPLOY.md, "SEO").
+ if loc.startswith(("/_seo", "/_sitemap", "/sitemap")):
+ problems.append(f"nginx routes {loc}: the sitemaps and the SEO API reach Go through Nuxt (vue-seo-layer), not nginx")
if problems:
sys.exit("\n".join(problems))
diff --git a/scripts/smoke-seo.sh b/scripts/smoke-seo.sh
new file mode 100755
index 0000000..55af385
--- /dev/null
+++ b/scripts/smoke-seo.sh
@@ -0,0 +1,289 @@
+#!/usr/bin/env bash
+# The SEO output of a running demo, checked through its Nuxt site the way a
+# visitor and a crawler see it (Phase 33: vue-seo-layer, golem15.seo,
+# golem15.sitemap):
+#
+# scripts/smoke-seo.sh BASE_URL e.g. http://127.0.0.1:3020
+#
+# - a Journal post: the CMS title, one canonical, hreflang, one JSON-LD
+# @graph, server-rendered breadcrumbs and the CMS's X-Robots-Tag;
+# - /sitemap.xml is a sitemap index whose files answer through the site, and
+# robots.txt names it;
+# - a redirect created through the SEO API answers 301 from Nuxt (removed
+# again at the end);
+# - the declared browser-only routes (/p/**, /presentations/**) and the auth
+# and signed-in pages answer noindex, nofollow;
+# - the route report put the static pages into the page registry, and a 404
+# reaches the 404 log (the entry is removed again);
+# - the HTML sitemap page and the footer link to it.
+#
+# The API checks talk to the Go binary directly:
+# SMOKE_SEO_API Go origin (default http://127.0.0.1:8097, scripts/dev.sh)
+# SMOKE_SEO_ADMIN_LOGIN admin login (default admin)
+# SMOKE_SEO_ADMIN_PASSWORD_FILE a file holding the admin password, else
+# SMOKE_SEO_ADMIN_PASSWORD the password (default: scripts/dev.sh's local admin)
+# SMOKE_SEO_POST the post path to check (default: the first post
+# with a category, from the Journal API)
+# SMOKE_SEO_STRICT=1 turn WARN lines (alternates and sitemap
+# addresses that do not answer 200) into failures
+#
+# Prints "ok ..." per check, "WARN ..." and "FAIL ..." lines, and ends with
+# "smoke-seo: ok" (exit 0) or "smoke-seo: N failed" (exit 1). No secret is
+# printed or passed on a command line.
+set -euo pipefail
+
+[ $# -eq 1 ] || { echo "usage: scripts/smoke-seo.sh BASE_URL" >&2; exit 2; }
+BASE=${1%/}
+API=${SMOKE_SEO_API:-http://127.0.0.1:8097}
+API=${API%/}
+STRICT=${SMOKE_SEO_STRICT:-0}
+command -v python3 >/dev/null || { echo "smoke-seo: python3 not found" >&2; exit 2; }
+
+D=$(mktemp -d)
+HDR="$D/auth.hdr"
+trap 'logout; rm -rf "$D"' EXIT
+failed=0
+ok() { echo "ok $*"; }
+fail() { echo "FAIL $*"; failed=$((failed + 1)); }
+warn() {
+ if [ "$STRICT" = 1 ]; then fail "$*"; else echo "WARN $*"; fi
+}
+
+# get PATH_OR_URL NAME: GET without following redirects into $D/NAME.body and
+# $D/NAME.head; prints the status.
+get() {
+ local url=$1
+ case "$url" in http://* | https://*) ;; *) url="$BASE$url" ;; esac
+ curl -s -o "$D/$2.body" -D "$D/$2.head" -w '%{http_code}' -H 'Accept: text/html' "$url" || echo 000
+}
+# probe PATH: the status of PATH without Accept: text/html, so the layer
+# does not report a 404 to the 404 log (alternates and sitemap addresses);
+# the headers land in $D/probe.head.
+probe() { curl -s -o /dev/null -D "$D/probe.head" -w '%{http_code}' -H 'Accept: */*' "$BASE$1" || echo 000; }
+header() { tr -d '\r' <"$D/$1.head" | awk -v k="$(echo "$2" | tr 'A-Z' 'a-z')" -F': ' 'tolower($1)==k {sub(/^[^:]*: /, ""); print; exit}'; }
+count() { { grep -o -- "$2" "$D/$1.body" || true; } | wc -l | tr -d ' '; }
+# py NAME SCRIPT: runs SCRIPT with the body of NAME on stdin.
+py() { python3 -c "$2" <"$D/$1.body"; }
+
+# --- the admin token (redirect, registry and 404 log checks) ----------------
+login() {
+ local pw
+ if [ -n "${SMOKE_SEO_ADMIN_PASSWORD_FILE:-}" ]; then
+ pw=$(head -n1 "$SMOKE_SEO_ADMIN_PASSWORD_FILE")
+ else
+ pw=${SMOKE_SEO_ADMIN_PASSWORD:-AdminDemo123!}
+ fi
+ SMOKE_LOGIN=${SMOKE_SEO_ADMIN_LOGIN:-admin} SMOKE_PW="$pw" python3 -c '
+import json, os
+print(json.dumps({"login": os.environ["SMOKE_LOGIN"], "password": os.environ["SMOKE_PW"]}))' >"$D/login.json"
+ unset pw
+ LOGIN_STATUS=$(umask 077 && curl -s -o "$D/login.out" -w '%{http_code}' -X POST -H 'Content-Type: application/json' \
+ -d @"$D/login.json" "$API/smbackend/api/v1/auth/login" || echo 000)
+ rm -f "$D/login.json"
+ python3 -c '
+import json, sys
+try:
+ print("Authorization: Bearer " + json.load(open(sys.argv[1]))["data"]["access_token"])
+except Exception:
+ sys.exit(1)' "$D/login.out" >"$HDR" 2>/dev/null || { rm -f "$HDR"; return 1; }
+ rm -f "$D/login.out"
+}
+logout() {
+ [ -f "$HDR" ] || return 0
+ curl -s -o /dev/null -X POST -H @"$HDR" -H 'Content-Type: application/json' -d '{}' "$API/smbackend/api/v1/auth/logout" || true
+ rm -f "$HDR"
+}
+api() { # METHOD PATH [JSON_FILE] -> body in $D/api.out, prints the status
+ local args=(-s -o "$D/api.out" -w '%{http_code}' -X "$1" -H @"$HDR")
+ [ $# -ge 3 ] && args+=(-H 'Content-Type: application/json' -d @"$3")
+ curl "${args[@]}" "$API$2" || echo 000
+}
+
+# --- 1. a Journal post ----------------------------------------------------
+POST=${SMOKE_SEO_POST:-}
+if [ -z "$POST" ]; then
+ curl -s -o "$D/posts.json" "$API/_journal/api/v1/posts" || true
+ POST=$(python3 -c '
+import json, sys
+try:
+ posts = json.load(open(sys.argv[1]))["data"]
+except Exception:
+ sys.exit(0)
+for p in posts:
+ if p.get("categories"):
+ print("/blog/" + p["slug"]); break
+else:
+ if posts: print("/blog/" + posts[0]["slug"])' "$D/posts.json")
+fi
+[ -n "$POST" ] || { fail "no Journal post found through $API/_journal/api/v1/posts (set SMOKE_SEO_POST)"; POST=/blog/missing; }
+
+curl -s -o "$D/resolve.json" "$API/_seo/api/v1/resolve?url=$POST" || true
+CMS_TITLE=$(python3 -c '
+import json, sys
+try:
+ a = json.load(open(sys.argv[1]))
+ print(a["seo"]["title"] if a.get("action") == "ok" else "")
+except Exception:
+ print("")' "$D/resolve.json")
+CMS_XRT=$(python3 -c '
+import json, sys
+try: print(json.load(open(sys.argv[1]))["seo"]["x_robots_tag"])
+except Exception: print("")' "$D/resolve.json")
+
+st=$(get "$POST" post)
+[ "$st" = 200 ] && ok "$POST answers 200" || fail "$POST answers $st, not 200"
+n=$(count post '<script type="application/ld+json"'); [ "$n" = 1 ] && ok "$POST has one ld+json script" || fail "$POST has $n ld+json scripts, not 1"
+py post 'import re, sys, json
+m = re.search(r"<script type=\"application/ld\+json\"[^>]*>(.*?)</script>", sys.stdin.read(), re.S)
+g = json.loads(m.group(1)) if m else {}
+sys.exit(0 if isinstance(g.get("@graph"), list) and len(g["@graph"]) > 1 else 1)' &&
+ ok "$POST ld+json is one @graph" || fail "$POST ld+json is not one @graph with nodes"
+n=$(count post 'rel="canonical"'); [ "$n" = 1 ] && ok "$POST has one canonical" || fail "$POST has $n canonical links, not 1"
+n=$(count post 'hreflang="'); [ "$n" -ge 2 ] && ok "$POST has $n hreflang links" || fail "$POST has $n hreflang links, fewer than 2"
+n=$(count post 'class="seo-breadcrumbs__link"')
+grep -q '<nav class="seo-breadcrumbs"' "$D/post.body" && [ "$n" -ge 1 ] &&
+ ok "$POST has nav.seo-breadcrumbs ($n links)" || fail "$POST has no server-rendered nav.seo-breadcrumbs with links"
+title=$(py post 'import re, sys, html
+m = re.search(r"<title>(.*?)</title>", sys.stdin.read(), re.S)
+print(html.unescape(m.group(1)).strip() if m else "")')
+if [ -n "$CMS_TITLE" ] && [ "$title" = "$CMS_TITLE" ]; then ok "$POST title is the CMS title ($title)"; else fail "$POST title '$title' is not the CMS title '$CMS_TITLE'"; fi
+xrt=$(header post X-Robots-Tag)
+[ -n "$CMS_XRT" ] && [ "$xrt" = "$CMS_XRT" ] && ok "$POST X-Robots-Tag is the CMS's ($xrt)" || fail "$POST X-Robots-Tag '$xrt' is not the CMS's '$CMS_XRT'"
+
+# The alternates should answer 200 on this site.
+for alt in $(py post 'import re, sys
+for m in re.finditer(r"<link rel=\"alternate\" hreflang=\"[^\"]+\" href=\"([^\"]+)\"", sys.stdin.read()):
+ print(m.group(1))' | sort -u); do
+ path=$(python3 -c 'import sys, urllib.parse as u; p = u.urlsplit(sys.argv[1]); print(p.path + ("?" + p.query if p.query else ""))' "$alt")
+ st=$(probe "$path")
+ [ "$st" = 200 ] && ok "alternate $path answers 200" || warn "alternate $path answers $st"
+done
+
+# --- 2. sitemaps and robots.txt ---------------------------------------------
+st=$(get /sitemap.xml index)
+if [ "$st" = 200 ] && grep -q '<sitemapindex' "$D/index.body"; then
+ ok "/sitemap.xml is a sitemap index ($(header index Content-Type))"
+else
+ fail "/sitemap.xml answers $st without <sitemapindex>"
+fi
+files=$(py index 'import re, sys, urllib.parse as u
+for m in re.findall(r"<loc>([^<]+)</loc>", sys.stdin.read()):
+ print(u.urlsplit(m).path)')
+[ -n "$files" ] || fail "/sitemap.xml lists no sitemap file"
+addresses=0
+bad=0
+for f in $files; do
+ st=$(get "$f" file)
+ if [ "$st" = 200 ] && grep -q '<urlset' "$D/file.body"; then
+ ok "$f answers a urlset through the site"
+ else
+ fail "$f answers $st without <urlset>"
+ continue
+ fi
+ for loc in $(py file 'import re, sys, urllib.parse as u
+for m in re.findall(r"<loc>([^<]+)</loc>", sys.stdin.read()):
+ print(u.urlsplit(m).path)' | head -200); do
+ addresses=$((addresses + 1))
+ echo "$loc" >>"$D/locs.txt"
+ st=$(probe "$loc")
+ [ "$st" = 200 ] || { warn "sitemap address $loc answers $st"; bad=$((bad + 1)); }
+ case "$(header probe X-Robots-Tag)" in
+ *noindex*) fail "sitemap address $loc answers X-Robots-Tag: $(header probe X-Robots-Tag)" ;;
+ esac
+ done
+done
+[ "$addresses" -gt 0 ] && ok "$addresses sitemap addresses fetched, $bad not 200" || fail "the sitemap files list no address"
+dups=$( [ -f "$D/locs.txt" ] && sort "$D/locs.txt" | uniq -d | tr '\n' ' ')
+[ -z "$dups" ] && ok "no address is listed twice in the sitemaps" || fail "addresses listed more than once in the sitemaps: $dups"
+st=$(get /robots.txt robots)
+if [ "$st" = 200 ] && grep -q '^Sitemap: .*/sitemap\.xml$' "$D/robots.body"; then
+ ok "/robots.txt names the sitemap index"
+else
+ fail "/robots.txt answers $st without a Sitemap: .../sitemap.xml line"
+fi
+
+# --- 3. noindex routes, auth and signed-in pages ------------------------------
+for p in /p/smoke-seo /presentations/new /login /register /account/security; do
+ st=$(get "$p" noindex)
+ xrt=$(header noindex X-Robots-Tag)
+ [ "$xrt" = "noindex, nofollow" ] && ok "$p ($st) sends X-Robots-Tag: noindex, nofollow" ||
+ fail "$p ($st) sends X-Robots-Tag '$xrt', not 'noindex, nofollow'"
+done
+get /login noindex >/dev/null
+grep -q '<meta name="robots" content="noindex, nofollow">' "$D/noindex.body" &&
+ ok "/login has the robots meta noindex, nofollow" || fail "/login has no robots meta noindex, nofollow"
+
+# --- 4. the HTML sitemap and the footer link ---------------------------------
+st=$(get / home)
+grep -q 'class="seo-sitemap-link"' "$D/home.body" && ok "/ ($st) links the HTML sitemap in the footer" || fail "/ ($st) has no a.seo-sitemap-link"
+href=$(py home 'import re, sys
+m = re.search(r"<a href=\"([^\"]+)\"[^>]*class=\"seo-sitemap-link\"|class=\"seo-sitemap-link\"[^>]*href=\"([^\"]+)\"", sys.stdin.read())
+print((m.group(1) or m.group(2)) if m else "")')
+if [ -n "$href" ]; then
+ st=$(get "$href" html)
+ [ "$st" = 200 ] && grep -q "href=\"$POST\"" "$D/html.body" && ok "$href lists $POST" || fail "$href answers $st without a link to $POST"
+fi
+
+# --- 5. through the SEO API: a redirect, the registry, the 404 log ----------
+if login; then
+ src="/smoke-seo-old-$(date +%s)-$$"
+ printf '{"source":"%s","target":"%s","status":301,"note":"scripts/smoke-seo.sh"}' "$src" "$POST" >"$D/redirect.json"
+ st=$(api POST /_seo/api/v1/redirects "$D/redirect.json")
+ rid=$(python3 -c 'import json, sys
+try: print(json.load(open(sys.argv[1]))["data"]["id"])
+except Exception: print("")' "$D/api.out")
+ if [ -n "$rid" ]; then
+ st=$(get "$src" redirect)
+ loc=$(header redirect Location)
+ [ "$st" = 301 ] && [ "${loc%"$POST"}" != "$loc" ] && ok "$src answers 301 to $loc (SEO plugin redirect $rid)" ||
+ fail "$src answers $st with Location '$loc', not 301 to $POST"
+ st=$(api DELETE "/_seo/api/v1/redirects/$rid")
+ case "$st" in 2*) ;; *) fail "could not delete redirect $rid ($st)" ;; esac
+ else
+ fail "creating a redirect through the SEO API answered $st"
+ fi
+
+ st=$(api GET '/_seo/api/v1/pages?per_page=200')
+ python3 -c '
+import json, sys
+rows = json.load(open(sys.argv[1]))["data"]
+urls = {r["url"]: r for r in rows}
+need = ["/", "/faq", "/blog"]
+missing = [u for u in need if u not in urls or not urls[u].get("reported_at")]
+leaked = [u for u in ("/login", "/register", "/account/security", "/subscriptions") if u in urls]
+if missing or leaked:
+ print("missing=%s leaked=%s" % (missing, leaked)); sys.exit(1)
+print(" ".join(sorted(u for u, r in urls.items() if r.get("origin") == "reported")))' "$D/api.out" >"$D/registry.txt" 2>&1 &&
+ ok "the registry lists the reported routes: $(cat "$D/registry.txt")" ||
+ fail "the registry ($st) lacks reported routes or lists noindex pages: $(cat "$D/registry.txt")"
+
+ miss="/smoke-seo-missing-$(date +%s)-$$"
+ st=$(get "$miss" missing)
+ [ "$st" = 404 ] && ok "$miss answers 404" || fail "$miss answers $st, not 404"
+ nid=""
+ for _ in 1 2 3 4 5 6 7 8 9 10; do
+ api GET "/_seo/api/v1/notfound?search=$miss" >/dev/null
+ nid=$(python3 -c 'import json, sys
+try:
+ rows = [r for r in json.load(open(sys.argv[1]))["data"] if r.get("url") == sys.argv[2]]
+ print(rows[0]["id"] if rows else "")
+except Exception: print("")' "$D/api.out" "$miss")
+ [ -n "$nid" ] && break
+ sleep 0.5
+ done
+ if [ -n "$nid" ]; then
+ ok "$miss reached the 404 log (entry $nid)"
+ api DELETE "/_seo/api/v1/notfound/$nid" >/dev/null
+ else
+ fail "$miss did not reach the 404 log (is NUXT_SEO_NOTFOUND_TOKEN the backend's notfound_token?)"
+ fi
+else
+ fail "admin login at $API/smbackend/api/v1/auth/login answered ${LOGIN_STATUS:-000} (429: the admin login throttle, wait a minute): no redirect, registry or 404 log checks"
+fi
+
+if [ "$failed" -eq 0 ]; then
+ echo "smoke-seo: ok"
+else
+ echo "smoke-seo: $failed failed"
+ exit 1
+fi
diff --git a/scripts/smoke.sh b/scripts/smoke.sh
index e2bec68..c344ec7 100755
--- a/scripts/smoke.sh
+++ b/scripts/smoke.sh
@@ -1,14 +1,16 @@
#!/usr/bin/env bash
# Boot the built binary on a fresh postgres:15 the way a release does
-# (migrate, admin:create, demo:seed, serve), check the plugin APIs over HTTP,
-# then boot the built Nuxt site (vue-demo-app/.output) against that binary and
-# check its pages.
+# (migrate, admin:create, demo:seed, sitemap:rebuild, serve), check the plugin
+# APIs and the sitemap index over HTTP, then boot the built Nuxt site
+# (vue-demo-app/.output) against that binary and check its pages and the root
+# files it serves from the binary (vue-seo-layer: /sitemap.xml, a sitemap
+# file, /robots.txt).
#
# The site starts with two throwaway purge tokens: NUXT_CACHE_PURGE_TOKEN and
-# the deprecated NUXT_SITE_CACHE_PURGE_TOKEN (vue-journal-layer 0.6.0 still
-# reads it for one release). nuxt-site-config publishes every NUXT_SITE_*
-# variable in the page payload, so no server-rendered page and no
-# client-only page (window.__NUXT_SITE_CONFIG__) may carry either value or a
+# the deprecated NUXT_SITE_CACHE_PURGE_TOKEN (still read for one release).
+# nuxt-site-config published every NUXT_SITE_* variable in the page payload
+# until vue-journal-layer 0.8.0 dropped it, so no server-rendered page and no
+# client-only page may carry either value or a
# purge key name; the new token must purge (200) and the deprecated one,
# shadowed by it, must get 401; the site log carries no token value and no
# deprecation warning (the layer warns only when a setting comes from an old
@@ -132,6 +134,11 @@ run demo:seed >"$TMP/seed.log" 2>&1 || {
cat "$TMP/seed.log" >&2
fail "demo:seed failed"
}
+# The sitemap files exist after the first rebuild (DEPLOY.md, "SEO").
+run sitemap:rebuild >"$TMP/sitemap.log" 2>&1 || {
+ cat "$TMP/sitemap.log" >&2
+ fail "sitemap:rebuild failed"
+}
free_port "$PORT" SMOKE_PORT
(cd "$WORK" && exec env -i PATH="$PATH" HOME="$TMP" SUMMER_ENV=production "$BIN" serve --addr "127.0.0.1:$PORT") >"$TMP/serve.log" 2>&1 &
@@ -169,7 +176,12 @@ check() {
# The plugin APIs the site and the decks read.
check "$BASE/_journal/api/v1/posts" 200 application/json
check "$BASE/_faq/api/v1/faqs/home" 200 application/json
+# The sitemap index on the public origin (config/golem15.sitemap.yaml), its
+# files under /_sitemap/files/ (the site maps the root names).
check "$BASE/sitemap.xml" 200
+grep -qF '<loc>https://demo.summercms.io/sitemap-posts-1.xml</loc>' "$TMP/body" || fail "GET $BASE/sitemap.xml: not an index listing sitemap-posts-1.xml"
+check "$BASE/_sitemap/files/sitemap-posts-1.xml" 200
+grep -qF '/blog/welcome-to-summercms</loc>' "$TMP/body" || fail "GET $BASE/_sitemap/files/sitemap-posts-1.xml: no seeded post"
HASH="$(psql "SELECT public_hash FROM golem15_presentations_presentations WHERE slug = 'roadmap' AND is_published")"
[[ -n "$HASH" ]] || fail "demo:seed published no roadmap deck"
check "$BASE/_presentations/api/v1/public/roadmap-$HASH" 200 application/json
@@ -197,6 +209,7 @@ free_port "$SITE_PORT" SMOKE_SITE_PORT
NUXT_PAYMENTGATEWAY_API_BASE="$BASE/_paymentgateway/api/v1" \
NUXT_PAYMENTGATEWAYSUBSCRIPTIONS_API_BASE="$BASE/_paymentgatewaysubscriptions/api/v1" \
NUXT_DEMO_API_BASE="$BASE/_demo/api/v1" \
+ NUXT_SEO_API_BASE="$BASE/_seo/api/v1" \
NUXT_CACHE_PURGE_TOKEN="$PURGE_TOKEN" \
NUXT_SITE_CACHE_PURGE_TOKEN="$OLD_PURGE_TOKEN" \
node "$SITE_OUT/server/index.mjs") >"$TMP/site.log" 2>&1 &
@@ -217,6 +230,12 @@ fi
check "$SITE/" 200 text/html
+# vue-seo-layer serves the root files from the binary (NUXT_SEO_API_BASE).
+check "$SITE/sitemap.xml" 200 application/xml
+grep -qF '<sitemapindex' "$TMP/body" || fail "GET $SITE/sitemap.xml: not a sitemap index"
+check "$SITE/sitemap-posts-1.xml" 200 application/xml
+check "$SITE/robots.txt" 200 text/plain
+
# no_purge_leak LABEL fails when the last body carries a purge token value or
# a purge key name (cachePurgeToken, cacheAllowProxied...). Never prints a
# value; a key name match never spans one.
@@ -253,7 +272,10 @@ done
check "$SITE/roadmap" 302
grep -qi "^location: /p/roadmap-$HASH" "$TMP/headers" || fail "GET $SITE/roadmap: not a redirect to /p/roadmap-$HASH"
check "$SITE/p/roadmap-$HASH" 200 text/html
-grep -qF '__NUXT_SITE_CONFIG__' "$TMP/body" || fail "GET $SITE/p/roadmap-$HASH: no window.__NUXT_SITE_CONFIG__ (is the deck page still client-only?)"
+grep -qF '<div id="__nuxt"></div>' "$TMP/body" || fail "GET $SITE/p/roadmap-$HASH: the app root is rendered (is the deck page still client-only?)"
+# The deck routes render in the browser only, so seo.noindexRoutes declares
+# them (vue-seo-layer, D-70): served with X-Robots-Tag noindex, nofollow.
+tr -d '\r' <"$TMP/headers" | grep -qix 'x-robots-tag: noindex, nofollow' || fail "GET $SITE/p/roadmap-$HASH: no X-Robots-Tag: noindex, nofollow"
no_purge_leak "$SITE/p/roadmap-$HASH"
check "$SITE/quizzes" 200 text/html
grep -qF 'SummerCMS basics' "$TMP/body" || fail "GET $SITE/quizzes: the quiz list is not rendered"
diff --git a/seo_output_test.go b/seo_output_test.go
new file mode 100644
index 0000000..c7c5192
--- /dev/null
+++ b/seo_output_test.go
@@ -0,0 +1,171 @@
+package main
+
+import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "slices"
+ "strings"
+ "testing"
+
+ "git.golem15.com/golem15/summercms/modules/surf"
+)
+
+// demoSite is the public origin config/golem15.seo.yaml and
+// config/golem15.sitemap.yaml name.
+const demoSite = "https://demo.summercms.io"
+
+// TestSEOOutput checks the SEO output the Nuxt site reads from the demo
+// binary (Phase 33, SC-1/SC-2) on the seeded content: /sitemap.xml is a
+// sitemap index of per-type files on the public origin and a file lists
+// the Journal posts, while a tagged post adds no tag address and the tag's
+// path does not resolve (golem15.journal.tag_pages is false in
+// config/golem15.journal.yaml); the SEO plugin's site answer names the
+// origin, the locales and the HTML sitemap; a seeded post resolves with
+// one JSON-LD @graph and breadcrumbs through its category; and the route
+// report is accepted with golem15.seo.route_report_token.
+func TestSEOOutput(t *testing.T) {
+ skipUnlessSEOMounted(t)
+ const reportToken = "seo-output-test-route-report-token"
+ demo := bootDemo(t, visitorEnv, map[string]any{"golem15.seo.route_report_token": reportToken})
+ mustSeed(t, demo)
+ // demo:seed tags no post; one tag makes the tag_pages check meaningful.
+ var tagID uint
+ if err := demo.DB.Raw(`INSERT INTO golem15_journal_tags (name, slug, created_at, updated_at)
+VALUES ('Releases', 'releases', NOW(), NOW()) RETURNING id`).Scan(&tagID).Error; err != nil || tagID == 0 {
+ t.Fatalf("tag: id=%d err=%v", tagID, err)
+ }
+ if err := demo.DB.Exec(`INSERT INTO golem15_journal_posts_tags (post_id, tag_id)
+SELECT id, ? FROM golem15_journal_posts WHERE slug = 'welcome-to-summercms'`, tagID).Error; err != nil {
+ t.Fatal(err)
+ }
+ if out, err := runCommand(t, demo, "sitemap:rebuild"); err != nil {
+ t.Fatalf("sitemap:rebuild: %v\n%s", err, out)
+ }
+ h, err := surf.Assemble(demo.App, demo.Plugins)
+ if err != nil {
+ t.Fatalf("surf.Assemble: %v", err)
+ }
+ do := func(method, path, body string, header map[string]string) *httptest.ResponseRecorder {
+ t.Helper()
+ req := httptest.NewRequest(method, path, strings.NewReader(body))
+ for k, v := range header {
+ req.Header.Set(k, v)
+ }
+ rec := httptest.NewRecorder()
+ h.ServeHTTP(rec, req)
+ return rec
+ }
+ get := func(path string) string {
+ t.Helper()
+ rec := do(http.MethodGet, path, "", nil)
+ if rec.Code != http.StatusOK {
+ t.Fatalf("GET %s = %d %s", path, rec.Code, rec.Body.String())
+ }
+ return rec.Body.String()
+ }
+
+ t.Run("sitemap index", func(t *testing.T) {
+ index := get("/sitemap.xml")
+ if !strings.Contains(index, "<sitemapindex") {
+ t.Fatalf("/sitemap.xml is not a sitemap index:\n%s", index)
+ }
+ if !strings.Contains(index, "<loc>"+demoSite+"/sitemap-posts-1.xml</loc>") {
+ t.Fatalf("/sitemap.xml does not list %s/sitemap-posts-1.xml:\n%s", demoSite, index)
+ }
+ posts := get("/_sitemap/files/sitemap-posts-1.xml")
+ if !strings.Contains(posts, "<urlset") || !strings.Contains(posts, "<loc>"+demoSite+"/blog/welcome-to-summercms</loc>") {
+ t.Fatalf("sitemap-posts-1.xml does not list the seeded post:\n%s", posts)
+ }
+ if strings.Contains(index, "sitemap-tags-") || strings.Contains(posts, "/blog/tag/") {
+ t.Fatalf("the sitemaps name tag addresses although golem15.journal.tag_pages is false:\n%s", index)
+ }
+ var answer struct {
+ Action string `json:"action"`
+ }
+ if err := json.Unmarshal([]byte(get("/_seo/api/v1/resolve?url=/blog/tag/releases")), &answer); err != nil {
+ t.Fatal(err)
+ }
+ if answer.Action != "not_found" {
+ t.Fatalf("/blog/tag/releases resolves %q, want not_found (no tag pages)", answer.Action)
+ }
+ })
+
+ t.Run("site answer", func(t *testing.T) {
+ var site struct {
+ SiteURL string `json:"site_url"`
+ Locales []string `json:"locales"`
+ HTMLSitemap struct {
+ Enabled bool `json:"enabled"`
+ Paths map[string]string `json:"paths"`
+ } `json:"html_sitemap"`
+ }
+ if err := json.Unmarshal([]byte(get("/_seo/api/v1/site")), &site); err != nil {
+ t.Fatal(err)
+ }
+ if site.SiteURL != demoSite || !slices.Contains(site.Locales, "en") || !slices.Contains(site.Locales, "pl") {
+ t.Fatalf("site answer %+v, want %s with en and pl", site, demoSite)
+ }
+ if !site.HTMLSitemap.Enabled || site.HTMLSitemap.Paths["en"] != "/sitemap" {
+ t.Fatalf("html_sitemap %+v, want enabled at /sitemap (vue-seo-layer's default path)", site.HTMLSitemap)
+ }
+ })
+
+ t.Run("post resolve", func(t *testing.T) {
+ var answer struct {
+ Action string `json:"action"`
+ SEO struct {
+ Canonical string `json:"canonical"`
+ } `json:"seo"`
+ JSONLD struct {
+ Graph []map[string]any `json:"@graph"`
+ } `json:"jsonld"`
+ Breadcrumbs []struct {
+ Name string `json:"name"`
+ Path string `json:"path"`
+ } `json:"breadcrumbs"`
+ }
+ if err := json.Unmarshal([]byte(get("/_seo/api/v1/resolve?url=/blog/welcome-to-summercms")), &answer); err != nil {
+ t.Fatal(err)
+ }
+ if answer.Action != "ok" || answer.SEO.Canonical != demoSite+"/blog/welcome-to-summercms" {
+ t.Fatalf("resolve = %s, canonical %q", answer.Action, answer.SEO.Canonical)
+ }
+ var types []string
+ for _, node := range answer.JSONLD.Graph {
+ if typ, ok := node["@type"].(string); ok {
+ types = append(types, typ)
+ }
+ }
+ for _, want := range []string{"WebPage", "BlogPosting", "BreadcrumbList", "WebSite"} {
+ if !slices.Contains(types, want) {
+ t.Fatalf("@graph types %v lack %s", types, want)
+ }
+ }
+ crumbs := answer.Breadcrumbs
+ if len(crumbs) < 3 || crumbs[0].Path != "/" || crumbs[len(crumbs)-1].Path != "/blog/welcome-to-summercms" ||
+ !strings.HasPrefix(crumbs[1].Path, "/blog/category/") {
+ t.Fatalf("breadcrumbs %+v, want home, the category and the post", crumbs)
+ }
+ })
+
+ t.Run("route report", func(t *testing.T) {
+ body := `{"routes": ["/", "/faq", "/contact"]}`
+ if rec := do(http.MethodPost, "/_seo/api/v1/registry/routes", body, map[string]string{"Content-Type": "application/json"}); rec.Code != http.StatusUnauthorized {
+ t.Fatalf("route report without a token = %d, want 401", rec.Code)
+ }
+ rec := do(http.MethodPost, "/_seo/api/v1/registry/routes", body, map[string]string{
+ "Content-Type": "application/json", "Authorization": "Bearer " + reportToken,
+ })
+ if rec.Code != http.StatusOK {
+ t.Fatalf("route report = %d %s", rec.Code, rec.Body.String())
+ }
+ var urls []string
+ if err := demo.DB.Raw(`SELECT url FROM golem15_seo_pages WHERE reported_at IS NOT NULL ORDER BY url`).Scan(&urls).Error; err != nil {
+ t.Fatal(err)
+ }
+ if !slices.Contains(urls, "/faq") || !slices.Contains(urls, "/contact") {
+ t.Fatalf("reported pages %v, want /faq and /contact", urls)
+ }
+ })
+}

View File

@@ -0,0 +1 @@
# no change beyond the pin bumps in 33-14

View File

@@ -0,0 +1,322 @@
diff --git a/app/components/SiteFooter.vue b/app/components/SiteFooter.vue
index 604a4b7..54e7626 100644
--- a/app/components/SiteFooter.vue
+++ b/app/components/SiteFooter.vue
@@ -1,7 +1,6 @@
-<!-- The site footer in summercms.io's: the tagline, the backend call to action and links. -->
+<!-- The site footer in summercms.io's: the tagline, the backend call to action, links and the HTML sitemap. -->
<script setup lang="ts">
const { t } = useI18n()
-const sitemapUrl = useRuntimeConfig().public.sitemapUrl as string
</script>
<template>
@@ -16,7 +15,8 @@ const sitemapUrl = useRuntimeConfig().public.sitemapUrl as string
<BackendCta />
<a href="https://summercms.io">{{ t('footer.website') }}</a>
<a href="https://summercms.io/docs">{{ t('footer.docs') }}</a>
- <a :href="sitemapUrl">{{ t('footer.sitemap') }}</a>
+ <!-- The HTML sitemap (vue-seo-layer), shown while the CMS has it on. -->
+ <SeoSitemapLink />
</div>
</div>
</footer>
diff --git a/app/pages/account/security.vue b/app/pages/account/security.vue
index 470d09f..d09f776 100644
--- a/app/pages/account/security.vue
+++ b/app/pages/account/security.vue
@@ -8,7 +8,9 @@
import { isTotpCode, svgDataUrl, type TotpSetup, type TwoFactorStatus } from '~/lib/twoFactor'
const { t } = useI18n()
-useSeoMeta({ title: () => t('security.title'), robots: 'noindex' })
+// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ requiresAuth: true })
+useSeoMeta({ title: () => t('security.title') })
const { loggedIn } = useDemoAuth()
const twoFactor = useTwoFactor()
diff --git a/app/pages/call/[conversation].vue b/app/pages/call/[conversation].vue
index 32444e2..7db746e 100644
--- a/app/pages/call/[conversation].vue
+++ b/app/pages/call/[conversation].vue
@@ -12,7 +12,9 @@
<script setup lang="ts">
const { t } = useI18n()
const route = useRoute()
-useSeoMeta({ title: () => t('call.title'), description: () => t('call.lead'), robots: 'noindex' })
+// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ requiresAuth: true })
+useSeoMeta({ title: () => t('call.title'), description: () => t('call.lead') })
const { loggedIn } = useDemoAuth()
const conversationId = computed(() => String(route.params.conversation ?? ''))
diff --git a/app/pages/connect.vue b/app/pages/connect.vue
index 4db725d..2c5f540 100644
--- a/app/pages/connect.vue
+++ b/app/pages/connect.vue
@@ -18,7 +18,9 @@ type ConsentRequest = {
}
const { t } = useI18n()
-useSeoMeta({ title: () => t('connect.title'), robots: 'noindex' })
+// An auth page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ seo: { robots: 'noindex, nofollow' } })
+useSeoMeta({ title: () => t('connect.title') })
const route = useRoute()
const { token, loggedIn } = useDemoAuth()
diff --git a/app/pages/forum/t/[id].vue b/app/pages/forum/t/[id].vue
index e574901..8c5a66f 100644
--- a/app/pages/forum/t/[id].vue
+++ b/app/pages/forum/t/[id].vue
@@ -13,7 +13,9 @@ import { DEMO_API } from '~/lib/api/demo'
const { t } = useI18n()
const route = useRoute()
const threadId = computed(() => String(route.params.id ?? ''))
-useSeoMeta({ title: () => t('forum.title'), description: () => t('forum.lead'), robots: 'noindex' })
+// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ requiresAuth: true })
+useSeoMeta({ title: () => t('forum.title'), description: () => t('forum.lead') })
const { loggedIn } = useDemoAuth()
const registerLink = computed(() => ({ path: '/register', query: { next: route.path } }))
diff --git a/app/pages/friends.vue b/app/pages/friends.vue
index 8f5bdef..11d9bd9 100644
--- a/app/pages/friends.vue
+++ b/app/pages/friends.vue
@@ -8,7 +8,9 @@
-->
<script setup lang="ts">
const { t } = useI18n()
-useSeoMeta({ title: () => t('friends.title'), description: () => t('friends.lead'), robots: 'noindex' })
+// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ requiresAuth: true })
+useSeoMeta({ title: () => t('friends.title'), description: () => t('friends.lead') })
const { loggedIn } = useDemoAuth()
const registerLink = { path: '/register', query: { next: '/friends' } }
diff --git a/app/pages/link-admin.vue b/app/pages/link-admin.vue
index 08bfe42..e4205fb 100644
--- a/app/pages/link-admin.vue
+++ b/app/pages/link-admin.vue
@@ -17,7 +17,9 @@ type LinkDone = { data: { backend_user: { login: string; name: string } } }
type SignedIn = { user: { email?: string } }
const { t, locale } = useI18n()
-useSeoMeta({ title: () => t('linkAdmin.title'), robots: 'noindex' })
+// An auth page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ seo: { robots: 'noindex, nofollow' } })
+useSeoMeta({ title: () => t('linkAdmin.title') })
const { token, loggedIn, logout } = useDemoAuth()
const code = ref('')
diff --git a/app/pages/login.vue b/app/pages/login.vue
index 9bc9442..fba22a4 100644
--- a/app/pages/login.vue
+++ b/app/pages/login.vue
@@ -2,7 +2,9 @@
import { challengeExpired, normalizeRecoveryCode, type TwoFactorChallenge } from '~/lib/twoFactor'
const { t } = useI18n()
-useSeoMeta({ title: () => t('auth.login.title'), robots: 'noindex' })
+// An auth page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ seo: { robots: 'noindex, nofollow' } })
+useSeoMeta({ title: () => t('auth.login.title') })
const route = useRoute()
const { loggedIn, login, verifyChallenge, recoverChallenge, logout } = useDemoAuth()
const email = ref('')
diff --git a/app/pages/presentations/[slug]/edit.vue b/app/pages/presentations/[slug]/edit.vue
index 1687dd3..d16a504 100644
--- a/app/pages/presentations/[slug]/edit.vue
+++ b/app/pages/presentations/[slug]/edit.vue
@@ -5,7 +5,7 @@
-->
<script setup lang="ts">
const { t } = useI18n()
-useSeoMeta({ title: () => t('deckForm.editTitle'), robots: 'noindex' })
+useSeoMeta({ title: () => t('deckForm.editTitle') })
useDeckSession()
const route = useRoute()
const slug = computed(() => String(route.params.slug ?? ''))
diff --git a/app/pages/presentations/index.vue b/app/pages/presentations/index.vue
index ca69e6f..94c353a 100644
--- a/app/pages/presentations/index.vue
+++ b/app/pages/presentations/index.vue
@@ -14,7 +14,7 @@ import { presentationApi, type MineCard } from '~/lib/api/presentations'
import { remoteLinkClick } from '~/lib/pilot'
const { t } = useI18n()
-useSeoMeta({ title: () => t('mine.title'), robots: 'noindex' })
+useSeoMeta({ title: () => t('mine.title') })
const route = useRoute()
const { loggedIn } = useDeckSession()
diff --git a/app/pages/presentations/new.vue b/app/pages/presentations/new.vue
index 46728c6..8971da2 100644
--- a/app/pages/presentations/new.vue
+++ b/app/pages/presentations/new.vue
@@ -6,7 +6,7 @@
-->
<script setup lang="ts">
const { t } = useI18n()
-useSeoMeta({ title: () => t('deckForm.newTitle'), robots: 'noindex' })
+useSeoMeta({ title: () => t('deckForm.newTitle') })
useDeckSession()
</script>
diff --git a/app/pages/quizzes/[slug].vue b/app/pages/quizzes/[slug].vue
index 4bbf1e9..0170ae2 100644
--- a/app/pages/quizzes/[slug].vue
+++ b/app/pages/quizzes/[slug].vue
@@ -19,7 +19,10 @@ const slug = computed(() => String(route.params.slug ?? ''))
const { loggedIn } = useDeckSession()
const quiz = ref<Quiz | null>(null)
-useSeoMeta({ title: () => quiz.value?.title ?? t('quiz.listTitle'), robots: 'noindex' })
+// Taking a quiz needs an account, so the page stays out of the index
+// (vue-seo-layer applies this meta); the quiz list is public.
+definePageMeta({ seo: { robots: 'noindex' } })
+useSeoMeta({ title: () => quiz.value?.title ?? t('quiz.listTitle') })
const loadError = ref('')
const history = ref<Attempt[]>([])
diff --git a/app/pages/register.vue b/app/pages/register.vue
index 3a688c4..fc5836c 100644
--- a/app/pages/register.vue
+++ b/app/pages/register.vue
@@ -3,7 +3,9 @@
// POST /_user/api/v1/register behind Cloudflare Turnstile (D-07). No field is
// pre-filled and there is no e-mail verification step.
const { t } = useI18n()
-useSeoMeta({ title: () => t('auth.register.title'), robots: 'noindex' })
+// An auth page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ seo: { robots: 'noindex, nofollow' } })
+useSeoMeta({ title: () => t('auth.register.title') })
const { loggedIn, register } = useDemoAuth()
const route = useRoute()
// A same-site path to return to after signing up (the quizzes' "register to
diff --git a/app/pages/roadmap.vue b/app/pages/roadmap.vue
index 201b0f7..5b83e96 100644
--- a/app/pages/roadmap.vue
+++ b/app/pages/roadmap.vue
@@ -10,7 +10,10 @@
import { DEMO_API, fetchRoadmap, roadmapPath } from '~/lib/api/demo'
const { t, locale } = useI18n()
-useSeoMeta({ title: () => t('roadmap.title'), robots: 'noindex' })
+// Only a redirect to the roadmap deck (/p/..., declared noindex), so the
+// page itself stays out of the index (vue-seo-layer applies this meta).
+definePageMeta({ seo: { robots: 'noindex' } })
+useSeoMeta({ title: () => t('roadmap.title') })
const base = import.meta.server ? useRuntimeConfig().demo.apiBase : DEMO_API
const { data: deck, error } = await useAsyncData(`roadmap-${locale.value}`, () => fetchRoadmap(base, locale.value))
diff --git a/app/pages/subscriptions.vue b/app/pages/subscriptions.vue
index c2c3046..9a49ea2 100644
--- a/app/pages/subscriptions.vue
+++ b/app/pages/subscriptions.vue
@@ -1,5 +1,7 @@
<script setup lang="ts">
const { t } = useI18n()
+// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
+definePageMeta({ requiresAuth: true })
useSeoMeta({ title: () => t('subscriptions.title') })
const route = useRoute()
const { loggedIn } = useDemoAuth()
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 126c4ee..56f81b3 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -37,8 +37,7 @@
"footer": {
"tagline": "{name} demo · one Go binary, every shared Golem15 plugin.",
"website": "summercms.io",
- "docs": "Docs",
- "sitemap": "Sitemap"
+ "docs": "Docs"
},
"cta": {
"link": "Want to see the backend? Contact Golem15",
diff --git a/i18n/locales/pl.json b/i18n/locales/pl.json
index ca8e9d4..c8183c6 100644
--- a/i18n/locales/pl.json
+++ b/i18n/locales/pl.json
@@ -37,8 +37,7 @@
"footer": {
"tagline": "Demo {name} · jeden plik binarny Go, wszystkie wspólne wtyczki Golem15.",
"website": "summercms.io",
- "docs": "Dokumentacja",
- "sitemap": "Mapa strony"
+ "docs": "Dokumentacja"
},
"cta": {
"link": "Chcesz zobaczyć panel administracyjny? Napisz do Golem15",
diff --git a/nuxt.config.ts b/nuxt.config.ts
index df8bb2d..6cb0c97 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -57,7 +57,9 @@ export default defineNuxtConfig({
devtools: { enabled: false },
// The journal and payment gateway layers declare their Nuxt modules
- // (@nuxt/fonts, @nuxtjs/i18n, @nuxtjs/seo); this app lists none.
+ // (@nuxt/fonts, @nuxtjs/i18n); this app lists none. The journal, menu and
+ // FAQ layers extend vue-seo-layer, which sets every page's head from the
+ // SEO plugin (golem15.seo) and serves robots.txt and the sitemaps from Go.
extends: ['vue-journal-layer', 'vue-menu-layer', 'vue-faq-layer', 'vue-paymentgateway-layer', 'vue-chat-layer', 'vue-chatvideo-layer', 'vue-forum-layer', 'vue-userfriends-layer'],
journal: {
@@ -91,11 +93,15 @@ export default defineNuxtConfig({
},
},
- site: {
- url: 'http://127.0.0.1:3020',
- name: 'SummerCMS Demo',
- description: 'Every shared Golem15 plugin on one SummerCMS binary.',
- defaultLocale: 'en',
+ // vue-seo-layer (sm-demo-app DEPLOY.md, "SEO"). The deck viewers render in
+ // the browser only (routeRules below), so they are declared noindex: the
+ // layer sends them X-Robots-Tag: noindex, nofollow and its build guard
+ // (D-70) accepts them; any other browser-only route fails the build. Auth
+ // and signed-in pages mark themselves in their page meta (seo.robots,
+ // requiresAuth). The HTML sitemap pages keep the layer's paths
+ // (/sitemap, /mapa-strony), which the SEO plugin's site answer names.
+ seo: {
+ noindexRoutes: ['/p/**', '/presentations/**'],
},
runtimeConfig: {
@@ -109,9 +115,16 @@ export default defineNuxtConfig({
userfriends: { apiBase: `${api}/_userfriends/api/v1` },
// The demo's own API (golem15.demo) for SSR fetches. NUXT_DEMO_API_BASE.
demo: { apiBase: `${api}/_demo/api/v1` },
+ // The SEO plugin's API for the resolve, the site answer, the 404 report
+ // and the route report (NUXT_SEO_API_BASE); robots.txt and the sitemap
+ // files come from the same Go origin (NUXT_SEO_BACKEND_BASE, empty: this
+ // base without /_seo/api/v1). The tokens are NUXT_SEO_NOTFOUND_TOKEN and
+ // NUXT_SEO_ROUTE_REPORT_TOKEN at run time, never committed.
+ seo: { apiBase: `${api}/_seo/api/v1` },
public: {
- // The Go sitemap plugin's document (the Nuxt one lists only the journal).
- sitemapUrl: `${api}/sitemap.xml`,
+ // Client-side navigations resolve through the Nuxt server
+ // (GET /api/__seo__/resolve, its cache), so /_seo needs no public route.
+ seo: { apiBase: '/api/__seo__' },
// Cloudflare Turnstile site key for register and login (D-07); public by
// design. NUXT_PUBLIC_TURNSTILE_SITE_KEY at runtime.
turnstileSiteKey: '',
@@ -146,12 +159,6 @@ export default defineNuxtConfig({
},
},
- // The admin path is not listed: no public page links to the admin (D-04), and
- // naming it here would print it into every page's payload and robots.txt.
- // The admin answers with X-Robots-Tag: noindex itself.
- robots: { disallow: goPaths },
- linkChecker: { enabled: false },
-
// The deck pages are bm's presentation views (D-14): they touch window,
// document and storage throughout, so they render in the browser only.
routeRules: {

View File

@@ -0,0 +1,57 @@
diff --git a/changelog/nuxt.config.ts b/changelog/nuxt.config.ts
index 67cb8c9..6bb556f 100644
--- a/changelog/nuxt.config.ts
+++ b/changelog/nuxt.config.ts
@@ -32,12 +32,21 @@ export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: false },
- // '..' first (header, footer, tokens, fonts, site config, landing strings),
- // then the Journal layer (pages, API client, sanitizer, SEO). The layer
- // declares @nuxt/fonts, @nuxtjs/i18n and @nuxtjs/seo, which the landing
- // lists at the same exact versions, so this config lists no modules.
+ // '..' first (header, footer, tokens, fonts, site config, landing strings,
+ // and @nuxtjs/seo for the canonical, robots and sitemap of the landing's
+ // site config), then the Journal layer (pages, API client, sanitizer). The
+ // layer declares @nuxt/fonts and @nuxtjs/i18n, which the landing lists at
+ // the same exact versions, so this config lists no modules.
extends: ['..', 'vue-journal-layer'],
+ // The Journal layer extends vue-seo-layer, the frontend of the SEO plugin.
+ // summercms.io's binary mounts no SEO plugin, so the layer makes no CMS
+ // call (no resolve, no root files, no 404 or route report): the pages keep
+ // the Journal layer's own head and @nuxtjs/seo's canonical. Without the CMS
+ // there is no HTML sitemap, so the layer registers no sitemap pages. The
+ // build guard still runs; every page here renders on the server.
+ seo: { cms: false, htmlSitemap: false },
+
// Layer CSS loads first (tokens, base), this file last. In this project's own
// config `~` is changelog/app.
css: ['~/assets/css/changelog.css'],
diff --git a/changelog/testing/expect.txt b/changelog/testing/expect.txt
index 4af772d..7fb7df2 100644
--- a/changelog/testing/expect.txt
+++ b/changelog/testing/expect.txt
@@ -55,6 +55,22 @@
# SEO
200 /changelog/summercms-0-5-0 contains=<link rel="canonical" href="https://summercms.io/changelog/summercms-0-5-0"
200 /changelog notcontains=content="noindex
+# vue-seo-layer is off (seo.cms false, the binary mounts no SEO plugin): the
+# titles come from the Journal layer's fallback meta with the landing's
+# title template, @nuxtjs/seo adds one canonical and one graph, no CMS
+# breadcrumbs, no HTML sitemap pages and not one resolve call.
+200 /changelog/summercms-0-5-0 contains=<title>SummerCMS 0.5.0 | SummerCMS</title>
+200 /changelog/summercms-0-5-0 count=rel="canonical":1
+200 /changelog/summercms-0-5-0 count=application/ld+json:1
+200 /changelog/summercms-0-5-0 count=<h1:1
+200 /changelog/summercms-0-5-0 notcontains=seo-breadcrumbs
+200 /changelog contains=<title>Changelog | SummerCMS</title>
+200 /changelog count=rel="canonical":1
+200 /changelog count=application/ld+json:1
+200 /changelog/plugins count=rel="canonical":1
+404 /sitemap
+404 /mapa-strony
+resolves * 0
# Asset prefixes
200 /changelog contains="/changelog/_nuxt/

View File

@@ -0,0 +1,250 @@
---
phase: 33-seo-output-audit-and-content
plan: 13
subsystem: apps
tags: [seo, sitemap, nuxt, vue-seo-layer, grzybyfunkcjonalne, patches, deploy-decision]
status: complete
requires:
- phase: 33-03..33-06
provides: sitemap index and per-type files, Additional addresses migration, SEO page registry, route report, site answer, JSON-LD, breadcrumbs, pagination suffixes, per-type templates
- phase: 33-07..33-09
provides: vue-seo-layer v0.2.0 (root files, route report, build guard, components) and the journal, menu and faq layers on it
- phase: 33-11
provides: WebP variants (purego linking)
- phase: 33-12
provides: P33-46 wiring pattern, scratch-33 directory
provides:
- "33-13-sm-grzybyfunkcjonalne-app.patch: Journal tag pages off and authors at /autor/:author, golem15.sitemap and golem15.seo config, both vhosts without root-file locations (P33-49), check-deploy.sh, smoke.sh (companions, route report, page names, seo-pages.csv, Additional addresses, rebuild, SMOKE_KEEP), smoke-seo.sh, urls.txt and urls-production.txt, migrate.sh with pl the only enabled locale, seo-settings.yaml (page_title_suffix, journal-author templates), grzyby:seo-settings types section, env templates, DEPLOY.md and README.md, boot, companions and console tests"
- "33-13-vue-grzybyfunkcjonalne-app.patch: nuxt.config on the seo options without @nuxtjs/seo keys, an app title template and default description for pages the CMS does not answer, no useSeoMeta in pages, SeoSitemapLink in the footer, SEO fixtures from the rehearsal under tests/fixtures/api/seo, ssr.test.ts and expect.txt checks"
- "33-13-local-wiring.md and 33-13-deploy-log.md (decision after-tags, production check list for 33-14)"
affects: [33-14]
actuals:
tokens: 45000
tasks: 4
commits: 1
plan_head_before: c59b3e61ed833b9daa46ca7cce2e0224a822a166
plan_head_after: 7199b26bb77507349f3eeaf12c498ec64ccea89a
tech-stack:
added: []
patterns:
- "Scratch plugin wiring by git archive of each sibling's HEAD into the uninitialised submodule path (git refuses a symlink at a submodule path), the Nuxt worktree at the submodule path with the plan's name as a symlink, plugins.gen.go assume-unchanged in the scratch index"
- "Before/after head comparison: the live checkout's own production build rehearsed from a scratchpad copy, both stacks' heads diffed path by path"
- "Release data steps rehearsed through the management APIs with a temporary full-scope token, revoked at the end"
key-files:
created:
- .planning/phases/33-seo-output-audit-and-content/33-13-sm-grzybyfunkcjonalne-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-13-vue-grzybyfunkcjonalne-app.patch
- .planning/phases/33-seo-output-audit-and-content/33-13-local-wiring.md
- .planning/phases/33-seo-output-audit-and-content/33-13-deploy-log.md
modified:
- .planning/phases/33-seo-output-audit-and-content/deferred-items.md
key-decisions:
- "Task 3: after-tags. 33-14 deploys the tagged v0.6.1 build to production grzybyfunkcjonalne.pl (DEPLOY.md steps 1 to 12, DB dump first); no staging install. Since the 2026-10-31 cutover the SummerCMS install is production, so there is no separate uat"
- "The static pages' titles move through the registry names and the site's title template (so page-2 suffixes land as on the PHP site); deploy/seo-pages.csv carries the home title, the descriptions and the social titles"
- "pl is the only enabled locale (migrate.sh step 3 and a DEPLOY.md step): an enabled en without content gives every page /en/ hreflang and sitemap addresses that 404"
- "The Additional addresses copied from the PHP definition (/, /blog) are removed once the route report lists the same pages"
- "All root files, robots.txt included, go to Nuxt; nginx keeps only = /_seo/api/v1/resolve of the SEO paths"
- "Demo (decided at the same time for 33-14): prefix_except_default, English at /, Polish at /pl/; reverses D-13"
requirements-completed: [SC-1, SC-2, D-32, D-30, D-22, D-20, D-33, D-70, D-97, D-24]
coverage:
- id: D1
description: "Every local urls.txt line of grzybyfunkcjonalne.pl answers as expected on the new stack (full rehearsal with the companions, the route report and the release data steps)"
requirement: SC-1
verification:
- kind: e2e
ref: "bash scripts/smoke.sh in the scratch worktree: smoke: ok (128 urls)"
status: pass
human_judgment: false
- id: D2
description: "One H1, one canonical and one JSON-LD graph on a post, a category, /kontakt and /; breadcrumbs through the category; the sitemap index and its files, each address once with lastmod, no /en/, no tag file, no /sitemap.xsl"
requirement: D-70
verification:
- kind: e2e
ref: "bash scripts/smoke-seo.sh http://127.0.0.1:3016: smoke-seo: ok"
status: pass
human_judgment: false
- id: D3
description: "Both patches apply to the live repositories' HEADs"
requirement: D-32
verification:
- kind: automated
ref: "git apply --check against sm-grzybyfunkcjonalne-app 35d3664 and vue-grzybyfunkcjonalne-app e45ffe8: patches-ok"
status: pass
human_judgment: false
- id: D4
description: "The static pages, /blog and the author page keep the titles and descriptions production renders today"
requirement: D-33
verification:
- kind: e2e
ref: "head diff of the Oct 31 production build and the new stack on the same rehearsal data (see Task 1)"
status: pass
human_judgment: false
- id: D5
description: "Deploy only after Jakub's decision; production checked by Jakub at 33-14's release checkpoint"
requirement: D-32
verification:
- kind: manual
ref: "33-13-deploy-log.md: Decision after-tags; check list for 33-14"
status: pass
human_judgment: true
duration: 105min
completed: 2026-11-04
---
# Phase 33 Plan 13: grzybyfunkcjonalne.pl on the new sitemap format and the SEO layer Summary
**grzybyfunkcjonalne.pl rehearsed on the unreleased phase 33 stack with all 128 local URL checks passing and production's page titles kept. It now has per-type sitemaps through Nuxt, CMS-owned heads, breadcrumbs and a registry of its static pages. Two release patches cover it, and the deploy waits for the tagged build in 33-14, on production.**
## Performance
- **Duration:** about 105 minutes (17:28 to 19:13)
- **Tasks:** 4 (Tasks 1 and 2 executed, Task 3 decided, Task 4 recorded as the after-tags deferral)
- **Files in the patches:** 24 in the app repository, 15 in the Nuxt repository
## Task 1: tracer on local links
The wiring is in `33-13-local-wiring.md`. In short:
- two detached worktrees under `../../scratch-33`;
- the sibling plugins at their HEADs, copied in with `git archive`;
- the framework replaced in go.work;
- pnpm overrides `link:` to the four layers.
**Runs:**
- `scripts/build.sh` on the wiring, with the SSR guard passing.
- `scripts/check-deploy.sh`: ok.
- `scripts/smoke.sh`, the full rehearsal: `smoke: ok (128 urls)`. It runs migrate, the companions import, the route report, the page names, the CSV import, the Additional addresses step, the rebuild, Go and Nuxt, and then every local `urls.txt` line.
- `scripts/smoke-seo.sh http://127.0.0.1:3016`: `smoke-seo: ok`. It covered 4 pages with one H1, canonical and JSON-LD each, breadcrumbs through `/cordyceps`, and the index of 5 files: posts 63, categories 8, authors 1, pages 4.
- **Baseline:** the live checkout's Oct 31 production build ran in its own rehearsal (`smoke: ok (107 urls)`), and its heads were diffed against the new stack on the same data.
- Identical: the titles and descriptions of `/`, `/blog`, the posts, the categories, `/autor/admin`, `/kontakt`, `/trwaja-prace` and `/szukaj`.
- Different:
- D-41 pagination suffixes on page 2 and later;
- og:description added on three pages;
- two small og:title differences (`/autor/admin` gains the site suffix, `/blog?page=2` shows "Artykuły");
- `/szukaj` (noindex) without canonical and JSON-LD;
- the new `/mapa-strony`.
## Task 2: patches
- **Tests on the wiring:**
- `go vet` passes, untagged and tagged.
- `go test` passes with `-short`, with Docker and with `-tags summercms_mcp`, `plugins/grzyby/...` included.
- `pnpm test` 30/30, `pnpm smoke:ssr` 67 checks, `pnpm smoke:ga` 2 checks.
- **Export:** both patches came out with `git diff --binary` and `git add -N` for new files, without the wiring.
- **Check:** both pass `git apply --check` (`patches-ok`), again after the worktrees were removed.
## Task 3: decision
**after-tags** (Jakub, 2026-11-04). Production grzybyfunkcjonalne.pl gets the tagged v0.6.1 build in 33-14, following DEPLOY.md steps 1 to 12 with a DB dump first. No staging install is raised. There is no separate uat any more: the SummerCMS install has been production since the 2026-10-31 cutover. The user_setup secrets were checked by name before the checkpoint: the 404 token is in both `.env` files, and the optional route report token is in neither.
## Task 4: deferral
`33-13-deploy-log.md` records:
- the decision and why the target is production;
- that the `en` locale switch (step 5) and the emptying of the Additional addresses (step 10) are 33-14 deploy steps Jakub confirms at its release checkpoint;
- the production check list for that checkpoint: sitemap index and one file, a post's head and breadcrumbs, SEO › Pages, Settings › Sitemaps, a crawl, the visual check of the 0.8 markup, Search Console, libwebp.
The scratch worktrees are removed (see Cleanup). **uat does not run the new stack, and neither does production: it still runs the Oct 31 build (sm-grzybyfunkcjonalne-app 35d3664).**
## Task Commits
1. **Task 2:** `7199b26` docs(33-13): grzyby patches for the release (both patches, the wiring note, deferred findings)
2. **Plan metadata:** `docs(33-13): complete the grzybyfunkcjonalne.pl plan` (this SUMMARY and the deploy log)
Nothing was committed, pushed or tagged in the app repositories.
## Decisions Made
See `key-decisions` in the frontmatter. P33-49 was applied fully: robots.txt also leaves nginx for Nuxt.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] `/en/` hreflang links and sitemap addresses**
- **Found during:** Task 1
- **Issue:** The translate plugin's seeded `en` row is enabled. Every record then counts as available in `en`: the posts file listed 126 addresses for 63 posts, `x-default` pointed at `/en/`, and post heads linked `/en/blog/...`. All of these answer 404.
- **Fix:** migrate.sh step 3 makes `pl` the only enabled locale and asserts it. DEPLOY.md step 5 does the same on the server. smoke-seo.sh and ssr.test.ts fail on any `/en/` link.
**2. [Rule 1 - Bug] `/` and `/blog` listed twice in the pages file**
- **Issue:** They come in as Additional addresses (migrated from the PHP definition) and as registry pages (from the route report).
- **Fix:** smoke.sh and DEPLOY.md step 10 empty the Additional addresses after the route report, and smoke-seo.sh fails on duplicate `<loc>`. The plan expected the copied items to stay as Additional addresses: they are migrated, verified (`["/","/blog"]`), then removed. The plugin-side de-duplication stays a deferred item, also found in 33-12.
**3. [Rule 1 - Bug] Titles would have changed on the live site**
- **Issue:** A CSV title overrides the template. `/` loses the home template once it is a registry page. The new plugin answers for `/blog` (registry) and `/autor/admin` (journal-author) with derived titles ("Blog", "admin") instead of production's "Artykuły" and "Wpisy autora admin".
- **Fix:**
- The registry names are set to "Artykuły" and "Trwają prace", and the titles come from the site template.
- The CSV carries the home title, the descriptions and the og titles.
- seo-settings.yaml gains `page_title_suffix "· Strona %page%"` and the journal-author templates.
- grzyby:seo-settings got a `types:` section (code and test) so the file can write per-type templates.
**4. [Rule 1 - Bug] `/szukaj` lost its title suffix and description**
- **Issue:** With @nuxtjs/seo gone, pages the CMS doesn't answer lost the suffix and the site description.
- **Fix:** The app sets `app.head.titleTemplate` and a default description. error.vue keeps its old title without the suffix.
**5. [Rule 3 - Blocking] grzyby console tests**
- **Issue:** golem15.seo now requires golem15.sitemap, so the tests' plugin lists failed to activate.
- **Fix:** The sitemap plugin is registered in both test activations, with a require/replace pair in `plugins/grzyby/go.mod`.
**6. [Rule 3 - Blocking] Wiring**
- **Issue:** Symlinks at submodule paths break `git status`.
- **Fix:** Plugins are `git archive` copies, the Nuxt worktree sits at the submodule path, and `plugins.gen.go` is assume-unchanged in the scratch index (wiring drift only).
### Plan assumptions adapted
- The app was already on SummerCMS v0.6.0 with golem15.seo mounted and robots.txt served by Go (Phase 32), so summer.yaml is unchanged.
- The SEO fixtures moved from `tests/fixtures/seo` to `tests/fixtures/api/seo`, and `smoke:ssr` no longer points the SEO API at an unreachable port.
- `scripts/smoke.sh` gained `SMOKE_KEEP` and runs `smoke-seo.sh` last.
- The plan's uat deploy target no longer exists (see Task 3).
## Issues Encountered
New items logged in deferred-items.md "From 33-13":
- fallback locales producing addresses;
- local-time `updated_at` on registry page saves (a lastmod one hour in the future);
- the home template lost for a registry `/`;
- route-report names without diacritics;
- no token scope for the SEO or sitemap API;
- `journal:image-variants` cannot open the database from the generated CLI;
- the seeded `/uncategorized` category now in the sitemap.
## For 33-14
- **Deploy grzybyfunkcjonalne.pl to production** after the tags, by `33-13-deploy-log.md` and the patch's DEPLOY.md steps 1 to 12.
- Take the DB dump first.
- Jakub confirms steps 5 (`en` off) and 10 (Additional addresses emptied) at the release checkpoint, then runs the log's check list.
- Watch the grzyby:seo-settings `--dry-run`: it must list only the three new values, or editor changes would be overwritten.
- **Apply the patches** on the release pins: `git apply` both, then bump the go.mod requires and the submodule pointers (seo, sitemap, journal, plus menu, faq and translate if tagged), the `package.json` layer tags and the lockfile. Then regenerate `plugins.gen.go` with `summer build`. The patch leaves it out because the scratch copies made it drift.
- **Linking:** the grzyby binary becomes dynamically linked against glibc (purego). It runs on the Debian server, and DEPLOY.md documents it. Decide whether to keep that or build with `-tags nodynamic`. libwebp on the server was not checked; it is item 8 of the check list.
- **WebP backfill:** `journal:image-variants` needs a `grzyby:image-variants` wrapper or a CLI fix before the backfill can run.
- **Demo, decided by Jakub on 2026-11-04:** the demo moves to `prefix_except_default`. English stays at `/` and Polish moves to `/pl/…`, which reverses D-13. 33-14 applies it on top of the 33-12 demo patches: `i18n.strategy`, `/pl/mapa-strony`, locale-aware links and LanguageSwitcher, the demo's URL and smoke expectations, and `SMOKE_SEO_STRICT=1`. It is recorded in deferred-items.md under "Decided for 33-14".
## Cleanup
`git worktree remove --force` was run for both worktrees, and the `scratch-33/vue-grzybyfunkcjonalne-app` symlink was removed with `/bin/rm -f`. `git -C ../sm-grzybyfunkcjonalne-app worktree list` and the Nuxt submodule's list show only the live checkouts. The live app repository is unchanged: still 35d3664, with the same untracked `.gsd/`, `docs/` and self-named entry as at the start. 33-12's files in scratch-33 were not touched.
## Known Stubs
None.
## Threat Flags
None beyond the plan's register.
- T-33-58: tokens were checked by name only, and the rehearsal tokens were throwaway and revoked.
- T-33-60: nginx exposes no `/_sitemap/` and no `/_seo/` path beyond resolve, and check-deploy.sh enforces it.
- T-33-61: nothing was deployed.
## Self-Check: PASSED
- FOUND: 33-13-sm-grzybyfunkcjonalne-app.patch, 33-13-vue-grzybyfunkcjonalne-app.patch, 33-13-local-wiring.md, 33-13-deploy-log.md
- FOUND: commit 7199b26
- Both patches pass `git apply --check` against 35d3664 and e45ffe8.
- `git -C ../sm-grzybyfunkcjonalne-app worktree list` has no scratch-33 entry.
- No secret value in the patches, the logs or this summary.

View File

@@ -0,0 +1,66 @@
# 33-13 deploy log
## Decision
**after-tags** (Jakub, 2026-11-04, Task 3 checkpoint). The production site grzybyfunkcjonalne.pl gets the tagged v0.6.1 build in 33-14. That deploy follows the patch's DEPLOY.md section "SEO pages and sitemaps (Phase 33)", steps 1 to 12, and step 1 takes a database dump before anything else. No staging install is raised. 33-13 deployed nothing and did not contact the server after the checkpoint.
**There is no separate uat any more.** The plan was written for `uat.grzybyfunkcjonalne.pl` as a non-production environment next to the live WinterCMS site. Since the production cutover on 2026-10-31 (sm-grzybyfunkcjonalne-app 35d3664, DEPLOY.md "Production cutover"), the SummerCMS install is production:
- the same `/srv/grzybyfunkcjonalne`, the same database and the same supervisor programs that served uat now serve grzybyfunkcjonalne.pl, with `SUMMER_ENV=production`;
- the uat vhost is switched off, and re-enabling it would put the UAT gate in front of production;
- the WinterCMS install stays on disk as the rollback, untouched.
So 33-14 deploys to production. The staging-lock expectation of this plan (robots `Disallow: /` and noindex on uat) no longer applies.
## Steps
| Step | Result |
|------|--------|
| Decision recorded | after-tags, target production, no staging install |
| Read-only check of the user_setup secrets by name (before the checkpoint) | `NUXT_SEO_NOTFOUND_TOKEN` 1 line in `nuxt/.env`, `SUMMER_GOLEM15__SEO__NOTFOUND_TOKEN` 1 line in `go/.env`; both route report tokens absent (optional, the 404 token is used). Values neither printed nor compared |
| Build, upload, migrate, restart, nginx reload, rebuild, CSV import, smokes | not run in 33-13; 33-14 runs them on the tagged build |
| Scratch worktrees | removed after this log (33-13-SUMMARY.md) |
## Part of the 33-14 deploy, confirmed by Jakub at its release checkpoint
These two data steps of DEPLOY.md change production data. Jakub confirms them at 33-14's release checkpoint before they run:
- **Step 5, Polish only.** `UPDATE golem15_translate_locales SET is_enabled = (code = 'pl')` (the same switch is Settings › Locales). The seeded `en` row is enabled, which would give every page an `/en/` hreflang link and every record an `/en/` sitemap address, all answering 404. Run the `SELECT` first; no translation row is deleted.
- **Step 10, Additional addresses.** Remove `/` and `/blog` from Settings › Sitemaps › Additional addresses. Migration `202610280002` copies them there from the Phase 17 definition, and SEO › Pages lists the same two pages after the route report, so without this step the pages file lists both twice.
## Check list for 33-14's release checkpoint (production)
Jakub runs these on https://grzybyfunkcjonalne.pl after the 33-14 deploy (steps 1 to 12) and before the release is called done:
1. **Sitemap index and one file.** `/sitemap.xml` is a `<sitemapindex>` listing `sitemap-posts-1.xml`, `sitemap-categories-1.xml`, `sitemap-authors-1.xml`, `sitemap-pages-1.xml` and `sitemap-images-1.xml` on `https://grzybyfunkcjonalne.pl/`. `/sitemap-posts-1.xml` lists the 62 published posts, each once, with lastmod, with no `/en/` address and no hreflang. `/sitemap.xsl` answers 404.
2. **A post's head and breadcrumbs.** For example `/blog/blogchaga-wprowadzenie`:
- title and description as before;
- one canonical on the apex;
- `index, follow`;
- one JSON-LD script;
- no `hreflang="en"`;
- visible breadcrumbs Strona główna › category › post.
3. **SEO › Pages in /gfadmin:**
- lists `/`, `/blog` ("Artykuły"), `/kontakt` and `/trwaja-prace` ("Trwają prace");
- none of them is marked Not on the site;
- their SEO tabs show the CSV descriptions.
4. **Settings › Sitemaps in /gfadmin:**
- the files table shows the five files with their counts;
- the Additional addresses are empty;
- IndexNow is off;
- the HTML sitemap is on at `/mapa-strony`, and that page lists the pages.
5. **A crawl.** SEO › Site audit, Start crawl. It finishes, and its issues are read. Expected: no `/en/` 404s and no duplicate sitemap entries. `/uncategorized` is an open editorial decision (deferred-items.md).
6. **The visual check of the 0.8 card and title markup.** Look at the home page, `/blog`, a category, a post and `/autor/admin`, on desktop and mobile. The post cards are now clickable as a whole and have no "more" link. Check the post title markup, the breadcrumbs at the top of the journal pages, and the footer link "Mapa strony".
7. **Resubmit the sitemap in Search Console.** Submit `https://grzybyfunkcjonalne.pl/sitemap.xml` (same address, now an index) and check that Google reads its files.
8. **libwebp on the server.** Run `ls /usr/lib/x86_64-linux-gnu/libwebp.so*`. If present, the Journal's WebP thumbnails use the fast encoder; if absent, the slower built-in one. Either works with the dynamically linked binary, unless 33-14 builds with `-tags nodynamic`.
## 33-14 deploy (2026-11-05, production, tagged build)
Steps 1 to 11 of DEPLOY.md "SEO pages and sitemaps (Phase 33)" ran on the tagged build (summercms v0.6.1, sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0, vue-journal-layer v0.8.1, vue-menu-layer v0.5.1, vue-faq-layer v0.5.1, vue-seo-layer v0.2.0; sm-grzybyfunkcjonalne-app 75736b4, static binary with `-tags nodynamic`). Step 5: `en` was already disabled. Step 10: Additional addresses `/` and `/blog` removed. Step 12: `smoke.sh --url … --also urls-production.txt` failed one line, `/autor/admin` expecting the rehearsal author's name "admin" in the title; production shows "Wpisy autora Dawid P. | Grzyby Funkcjonalne". `smoke-seo.sh` and `check-deploy.sh --live` ok. Not rolled back; details and the checklist results in 33-release-log.md, steps 9d and 9e. Open for Jakub: items 3 (SEO › Pages in /gfadmin), 5 (a crawl), 6 (visual check), 7 (Search Console resubmit), and the 404-log cleanup of the smoke entries.
### Step 12 completed (Jakub's answer A: keep the deploy)
- `scripts/urls.txt` checks the `/autor/admin` title by its fixed parts only (sm-grzybyfunkcjonalne-app 0554f3e); the local rehearsal passes (`smoke: ok (129 urls)`).
- Production smoke rerun on the server, as before: `smoke: ok (149 urls)`.
- The 14 smoke entries in the 404 log (first seen since 01:12Z on 2026-11-05) are deleted; older entries are untouched.
- Still Jakub's: check-list items 3, 5, 6 and 7 above.

View File

@@ -0,0 +1,116 @@
# 33-13 local wiring (P33-46)
How grzybyfunkcjonalne.pl was run on the phase 33 stack before any tag, on 2026-11-04. Nothing here is committed in the app repositories: the wiring lives only in the scratch worktrees, and the two patches leave it out (P33-47).
## Directories
| What | Path |
|------|------|
| Scratch directory (shared with 33-12) | `/media/nvme/dev/golem15/summercms.io/scratch-33` |
| App worktree, detached at `35d3664` | `/media/nvme/dev/golem15/summercms.io/scratch-33/sm-grzybyfunkcjonalne-app` |
| Nuxt worktree, detached at `e45ffe8` | `/media/nvme/dev/golem15/summercms.io/scratch-33/sm-grzybyfunkcjonalne-app/vue-grzybyfunkcjonalne-app` |
| The plan's name for the Nuxt worktree | `/media/nvme/dev/golem15/summercms.io/scratch-33/vue-grzybyfunkcjonalne-app`, a symlink to the path above |
vue-grzybyfunkcjonalne-app is not a top-level sibling: it is the submodule `vue-grzybyfunkcjonalne-app` of sm-grzybyfunkcjonalne-app (`git@git.golem15.com:golem15/vue-grzybyfunkcjonalne-app.git`, git dir `sm-grzybyfunkcjonalne-app/.git/modules/vue-grzybyfunkcjonalne-app`). Its worktree sits at the submodule path inside the app worktree, because `scripts/build.sh` builds `$ROOT/vue-grzybyfunkcjonalne-app` and git refuses a symlink at a submodule path (`expected submodule path ... not to be a symbolic link`).
## Commands
```sh
S=/media/nvme/dev/golem15/summercms.io/summercms
SC=/media/nvme/dev/golem15/summercms.io/scratch-33
APP=$S/sm-grzybyfunkcjonalne-app
W=$SC/sm-grzybyfunkcjonalne-app
mkdir -p $SC
git -C $APP worktree add --detach $W HEAD # 35d3664
git -C $APP/vue-grzybyfunkcjonalne-app worktree add --detach $SC/vue-grzybyfunkcjonalne-app HEAD # e45ffe8
rmdir $W/vue-grzybyfunkcjonalne-app
git -C $APP/vue-grzybyfunkcjonalne-app worktree move $SC/vue-grzybyfunkcjonalne-app $W/vue-grzybyfunkcjonalne-app
ln -s $W/vue-grzybyfunkcjonalne-app $SC/vue-grzybyfunkcjonalne-app
# Go: the sibling plugin checkouts at their committed HEADs, copied into the
# (uninitialised) submodule paths; a symlink there breaks git status.
for p in faq journal menu seo sitemap translate user; do
rmdir $W/plugins/golem15/$p && mkdir $W/plugins/golem15/$p
git -C $S/sm-$p-plugin archive HEAD | tar -x -C $W/plugins/golem15/$p
done
sed -i "s#^replace git.golem15.com/golem15/summercms => ../summercms.go#replace git.golem15.com/golem15/summercms => $S/summercms.go#" $W/go.work
# summer build records the copies as local sources (new descriptions, no
# versions): plugins.gen.go drifts by wiring only, so build.sh's drift
# check is told to look away in this worktree's index. 33-14 regenerates
# plugins.gen.go after the real submodule bumps.
git -C $W update-index --assume-unchanged plugins.gen.go
# Nuxt: the four layers linked to the sibling checkouts.
cat >> $W/vue-grzybyfunkcjonalne-app/pnpm-workspace.yaml <<EOF
overrides:
vue-seo-layer: link:$S/vue-seo-layer
vue-journal-layer: link:$S/vue-journal-layer
vue-menu-layer: link:$S/vue-menu-layer
vue-faq-layer: link:$S/vue-faq-layer
EOF
pnpm -C $W/vue-grzybyfunkcjonalne-app install --no-frozen-lockfile
# Build, check, rehearse (Docker for Postgres).
cd $W
SUMMERCMS_FRAMEWORK=$S/summercms.go bash scripts/build.sh
bash scripts/check-deploy.sh
bash scripts/smoke.sh # default ports 18096 and 13016
SMOKE_KEEP=1 SMOKE_GO_PORT=18196 SMOKE_NUXT_PORT=3016 bash scripts/smoke.sh & # held stack for the SEO checks
bash scripts/smoke-seo.sh http://127.0.0.1:3016
go test ./... ./plugins/grzyby/... && go test -tags summercms_mcp ./...
pnpm -C vue-grzybyfunkcjonalne-app test
pnpm -C vue-grzybyfunkcjonalne-app smoke:ssr && pnpm -C vue-grzybyfunkcjonalne-app smoke:ga
```
Stop a held rehearsal with SIGTERM to its own `bash scripts/smoke.sh` (the parent of the Go process on its port), never by pattern: 33-12 runs its own smoke at the same time.
## Inputs at the time
| Repository | Commit |
|------------|--------|
| summercms.go | `617e15d` (v0.6.0 plus phase 33) |
| sm-seo-plugin | `49cc241` |
| sm-sitemap-plugin | `9e5c393` |
| sm-journal-plugin | `4f5bd19` |
| sm-menu-plugin, sm-faq-plugin, sm-translate-plugin, sm-user-plugin | `98df4c7`, `3bf54cd`, `7e64224`, `97f83cc` (their tags v0.1.2, v0.1.2, v0.1.3, v0.1.19) |
| vue-seo-layer, vue-journal-layer, vue-menu-layer, vue-faq-layer | `7af91fc`, `1080a3f`, `8b5da67`, `f7ec4fe` (linked, working trees clean) |
## Ports
| Use | Go | Nuxt |
|-----|----|------|
| `scripts/smoke.sh` defaults | 18096 | 13016 |
| Held rehearsal for `smoke-seo.sh` | 18196 | 3016 (the plan's port) |
| Baseline of the 2026-10-31 production build | 18296 | 13996 |
The demo stack of 33-12 used 3020 (Nuxt) and its own Go port at the same time; none of these clash with it or with the other local services (8080, 8120, 3000, 5432).
## Baseline ("before") run
To compare the heads with what production serves today, the live checkout's own Oct 31 build (`bin/grzybyfunkcjonalne`, `build/nuxt/.output`) ran in its unchanged rehearsal from a scratchpad copy (`git archive HEAD config deploy scripts`, symlinks to `bin/`, `build/nuxt` and `plugins/grzyby`, a hold loop appended to the copied `smoke.sh`): `smoke: ok (107 urls)`. The live repository was only read.
## Patches
```sh
cd $W && git add -N config/golem15.journal.yaml config/golem15.sitemap.yaml deploy/seo-pages.csv scripts/smoke-seo.sh
git diff --binary -- . ':(exclude)go.work' ':(exclude)vue-grzybyfunkcjonalne-app' ':(exclude)plugins/golem15' ':(exclude)plugins.gen.go' \
> $S/summercms.go/.planning/phases/33-seo-output-audit-and-content/33-13-sm-grzybyfunkcjonalne-app.patch
cd $W/vue-grzybyfunkcjonalne-app && git add -N tests/fixtures/api/seo
git diff --binary -- . ':(exclude)pnpm-lock.yaml' ':(exclude)pnpm-workspace.yaml' \
> $S/summercms.go/.planning/phases/33-seo-output-audit-and-content/33-13-vue-grzybyfunkcjonalne-app.patch
git -C $APP apply --check <app patch> && git -C $APP/vue-grzybyfunkcjonalne-app apply --check <nuxt patch> # both pass
```
Left out on purpose: `go.work` (framework replace), `plugins.gen.go` (wiring drift), the submodule pointers, `pnpm-lock.yaml` and `pnpm-workspace.yaml` (link overrides). The pin bumps (go.mod requires, submodule pointers, `package.json` layer tags, the lockfile) are 33-14's.
## Cleanup (after Task 4 or the deferral)
```sh
unlink $SC/vue-grzybyfunkcjonalne-app # the symlink
git -C $APP/vue-grzybyfunkcjonalne-app worktree remove --force $W/vue-grzybyfunkcjonalne-app
git -C $APP worktree remove --force $W
git -C $APP worktree list; git -C $APP/vue-grzybyfunkcjonalne-app worktree list
```
`--force` because both worktrees hold the uncommitted wiring and patch sources; the patches are committed in summercms.go first.

View File

@@ -0,0 +1,181 @@
---
phase: 33-seo-output-audit-and-content
plan: 14
subsystem: release
tags: [tests, gate, release, tags, changelog, deploy, seo, sitemap, journal, nuxt-layers, nodynamic]
status: complete
requires:
- phase: 33-01..33-13
provides: the phase's framework seams, plugins, layers, app patches and the release checkpoint
- phase: 33-15, 33-16, quick-261104-xae
provides: the gap closure re-verified in 33-VERIFICATION.md (human_needed, no gaps)
provides:
- "Unit tests for all new phase 33 code (SC-4) and the full check-phase33.sh gate (Tasks 1-2)"
- "Tags: summercms v0.6.1; sm-journal-plugin v0.4.0; sm-sitemap-plugin v0.2.0; sm-seo-plugin v0.2.0 (requires sitemap v0.2.0); vue-seo-layer v0.2.0; vue-journal-layer v0.8.0 and v0.8.1; vue-menu-layer v0.5.0 and v0.5.1; vue-faq-layer v0.5.0 and v0.5.1"
- "Content layers declare vue-seo-layer as a ^0.2.0 peer dependency plus a git devDependency (v0.8.1 / v0.5.1); apps list vue-seo-layer#v0.2.0 directly"
- "Apps pinned to the tags and patched: sm-demo-app (Polish under /pl/), sm-summercmsio-app, sm-grzybyfunkcjonalne-app; static release binaries with -tags nodynamic"
- "Changelog posts for the framework and the three Go plugins"
- "Deploys: summercms.io, demo.summercms.io, bm.jakubzych.com, grzybyfunkcjonalne.pl (production)"
affects: [phase-34, v0.6.2-backlog]
actuals:
tokens: 40000
tasks: 4
commits: 7
plan_head_before: 9c11b70
plan_head_after: 6875627
plan_heads_task4:
summercms.go: { before: 9c11b70, after: 6875627, commits: 7, note: "6d14f71 style: gofmt plus six planning-doc commits; this SUMMARY and the ROADMAP commit follow" }
sm-journal-plugin: { before: cf13c60, after: 6823dcc, commits: 2 }
sm-sitemap-plugin: { before: b2b3a1d, after: fdbe593, commits: 1 }
sm-seo-plugin: { before: c71b58e, after: 22f108b, commits: 1 }
vue-journal-layer: { before: 761c7fc, after: f5dc9b2, commits: 2 }
vue-menu-layer: { before: a7602c9, after: dc38f79, commits: 2 }
vue-faq-layer: { before: 5e5950a, after: a092363, commits: 2 }
sm-summercmsio-app: { before: ca06049, after: 395ed78, commits: 5 }
vue-summercmsio-app: { before: f36cbf1, after: 16ab519, commits: 1 }
sm-demo-app: { before: da481c9, after: da03c06, commits: 9 }
vue-demo-app: { before: 9a12701, after: fe5d38d, commits: 1 }
sm-grzybyfunkcjonalne-app: { before: 35d3664, after: 0554f3e, commits: 10 }
vue-grzybyfunkcjonalne-app: { before: e45ffe8, after: 0771c14, commits: 1 }
sm-bm-app: { before: bd7ee84, after: 43f2fc9, commits: 1, note: "push also carried 552cdce, c2a7823, 9dd0fe4 of other sessions (approved)" }
jz.bm: { before: 0dd0185, after: a27a162, commits: 1 }
tech-stack:
added: []
patterns:
- "A Nuxt layer that builds on another git-installed layer declares it as a semver peer dependency and a git devDependency; the app lists both (pnpm 12 refuses git subdependencies by default, blockExoticSubdeps)"
- "Apps that mount the Journal build their release binary with -tags nodynamic, so gen2brain/webp does not link glibc through purego"
- "Smoke expectations that run against production check only the fixed parts of data-dependent text"
key-files:
created:
- .planning/phases/33-seo-output-audit-and-content/33-14-SUMMARY.md
modified:
- .planning/phases/33-seo-output-audit-and-content/33-release-log.md
- .planning/phases/33-seo-output-audit-and-content/33-13-deploy-log.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-journal-layer-v0.8.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-menu-layer-v0.5.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-faq-layer-v0.5.0.md
- ../vue-journal-layer/scripts/check-git-install.sh
- ../vue-journal-layer/package.json
- ../vue-menu-layer/package.json
- ../vue-faq-layer/package.json
- ../sm-grzybyfunkcjonalne-app/scripts/urls.txt
- ../sm-grzybyfunkcjonalne-app/scripts/check-deploy.sh
decisions:
- "Content layers v0.8.1 / v0.5.1 take vue-seo-layer as a ^0.2.0 peer dependency (Jakub, option B); v0.8.0 and v0.5.0 stay published but do not install with pnpm 12 defaults"
- "WebP build option B: every app mounting the Journal builds static with -tags nodynamic"
- "The demo keeps /subscriptions as an Additional address; the route report's noindex list leaves it out (G1 confirmed live)"
- "grzybyfunkcjonalne.pl step 12: keep the deploy and fix the fixture-bound /autor/admin expectation (Jakub, option A)"
- "W5 production SQL length check skipped (Jakub: no production fonoteka)"
---
# Phase 33 Plan 14: Unit tests, the phase gate and the release Summary
**Phase 33 shipped: SummerCMS v0.6.1 with sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0 and the four SEO-aware Nuxt layers (installable as v0.2.0 / v0.8.1 / v0.5.1 / v0.5.1). Four changelog posts are live. The demo, summercms.io, bm and production grzybyfunkcjonalne.pl run the tagged, statically linked builds, and every smoke ends ok.**
## Performance
- Tasks: 4 of 4. Tasks 1 and 2 (unit tests, gate, VALIDATION) and the Task 3 checkpoint ran earlier. Task 4 (the release) ran on 2026-11-05, about 00:30–01:35 UTC, with two checkpoints in between: the layer dependency and the grzyby smoke.
- Task 4 commits: 7 in summercms.go before this SUMMARY, plus the per-repository commits listed in the frontmatter.
## Accomplishments
Every step is in 33-release-log.md, steps 0 to 10 (TAG lines for all 11 tags).
1. **Pre-checks.**
- gofmt fixes: framework 6d14f71 (15 files, several unformatted since v0.6.0) and sm-journal-plugin b8d98ce.
- `check-phase33.sh --all` green with Docker.
- Every repository is on its default branch, and the patches apply.
2. **Framework v0.6.1** (tag 5db8c61 on 6d14f71), master and tag pushed.
3. **Go plugins.** Each got the framework bump, a regenerated plugin.yaml, its README dependency lines, a GOWORK=off build, vet and `test -short`, then a commit, a tag and a push:
- journal v0.4.0;
- sitemap v0.2.0;
- seo v0.2.0, which also requires sitemap v0.2.0.
4. **Layers.**
- vue-seo-layer v0.2.0.
- journal v0.8.0, menu v0.5.0 and faq v0.5.0 after the link: swap.
- `check-git-install.sh v0.8.0` then failed with ERR_PNPM_EXOTIC_SUBDEP (checkpoint). Under option B the patch releases v0.8.1, v0.5.1 and v0.5.1 make vue-seo-layer a peer dependency.
- `check-git-install.sh v0.8.1` passes, and a scratch app on pnpm defaults installs and builds with the menu and FAQ tags too.
5. **Changelog posts.**
- summercms-0-6-1 (id 66);
- sm-sitemap-plugin-0-2-0 (67);
- sm-seo-plugin-0-2-0 (68);
- sm-journal-plugin-0-4-0 (69).
- All four answer 200, and the plugin posts are listed on /changelog/plugins.
6. **Apps.**
- **sm-summercmsio-app:** framework and journal bumps, the 33-12 changelog patch with the layer pins, and nodynamic. Built in a clean worktree: release v0.6.1, static. Smoke ok.
- **sm-demo-app:** three plugin bumps, the 33-12 patches, then the 33-14 locale patches (Polish under /pl/), nodynamic, and a roadmap sync. Docker tests and check-pins passed; the release build is static; smoke ok.
- **sm-grzybyfunkcjonalne-app:** three plugin bumps and the 33-13 patches, with the Binary row saying "static". nodynamic and a check-deploy fix. Full rehearsal `smoke: ok (128 urls)`, later 129.
- **sm-bm-app:** the frontend build with the robots meta and robots.txt went into jz.bm, then the pointer bump, then the push.
7. **Deploys.**
- **summercms.io:** pg_dump; Journal migrations (2); `journal:image-variants`; public checks ok.
- **Demo:**
- pg_dump; the SEO tokens added without printing them; 15 migrations; the vhost reinstalled after `nginx -t`.
- The "After" block with `/subscriptions` kept. G1 confirmed live: it is left out as noindex.
- `journal:image-variants`, then `check-live` ok and strict `smoke-seo` ok.
- **bm:** pg_dump, binary swap, and the X-Robots-Tag on the live vhost, `/pliki/` included. Verified.
- **grzybyfunkcjonalne.pl:** DEPLOY steps 1 to 12.
- Backups first, then 15 migrations.
- `en` was already disabled.
- seo-settings: 3 changed.
- Route report: 4 routes and 1 noindex path.
- New vhost installed.
- Pages renamed, CSV imported, Additional addresses emptied.
- Rebuild: 74 addresses. 285 WebP variants written.
- Production smoke `ok (149 urls)` after the urls.txt fix; `smoke-seo` ok.
- The smoke's 14 entries in the 404 log removed.
## Deviations from Plan
### Auto-fixed issues
1. **[Rule 1 - Bug] Content layers could not be installed (ERR_PNPM_EXOTIC_SUBDEP).** I stopped at the checkpoint, and Jakub chose B: v0.8.1, v0.5.1 and v0.5.1 declare vue-seo-layer as a peer dependency. check-git-install's scratch app now lists vue-seo-layer at the tag's dev pin.
2. **[Rule 3 - Blocking] grzyby check-deploy.sh looked for the old exact build tag list.** It now requires `summercms_mcp,nodynamic` (75736b4).
3. **[Rule 1 - Bug] grzyby urls.txt `/autor/admin` expected the rehearsal author's name.** Production failed 1 of 148 lines. I stopped without rolling back, and Jakub chose A. The line now checks only the fixed parts of the title (0554f3e). The production rerun is ok.
4. **[Rule 3 - Blocking] The sm-summercmsio-app live checkout carries another session's untracked binary,** which `require_clean` refuses. The release build ran in a clean worktree instead. The journal changelog post was published from a clean worktree at v0.4.0 for the same reason (an untracked go.work.sum).
5. **[Rule 2 - Missing] bm's live vhost location `^~ /pliki/` sets its own add_header.** The header was added there as well, not only in the topics location.
6. **Grzyby Nuxt upload.** The build went to `.output.new` and was swapped at the restart instead of being rsynced over the running `.output`.
7. **Demo DEPLOY "After" block.** It no longer removes `/subscriptions` by hand (G1), per Jakub's instruction.
8. **33-13 patch.** The `plugins/grzyby/go.mod` hunk conflicted only with the v0.6.1 bump and was applied by hand (sitemap require and replace).
### Known follow-ups (not fixed here)
- **`check-phase33.sh --consumers` needs a post-release mode.** It checks the release patches against unpatched app HEADs, so after the release it refuses (`33-12-sm-demo-app.patch does not apply`). Compat passes, and the apps' builds, tests and smokes ran directly.
- **Posts now send `X-Robots-Tag: index, follow`.** vue-seo-layer sends the CMS robots value as a header. The 2026-10-31 cutover check expected no X-Robots-Tag on a post. This is harmless, but the DEPLOY "Verify" line should be updated.
- **The G2 journal-tag drift warning still appears at every Nuxt start** on the demo and on grzyby. It is deferred to v0.6.2.
- **Some gofmt fixes landed in the framework** without a docs change. The docs checker passes.
## Human checks still open (33-VERIFICATION.md)
1. Production grzybyfunkcjonalne.pl, from the 33-13-deploy-log.md check list:
- item 3: SEO › Pages in /gfadmin;
- item 5: a crawl from SEO › Site audit;
- item 6: the visual check on desktop and mobile;
- item 7: resubmit the sitemap in Search Console.
2. SC3 live MCP workflow: a crawl, then dry run and apply from a real client.
3. D-46: Google's Rich Results Test for a post, a category and an FAQ page.
4. Visual checks:
- grzyby;
- the demo on /pl/: the LanguageSwitcher, /pl/mapa-strony and /sitemap, the footer link;
- the new admin screens;
- the Blog Editor outline at 360px (J2).
5. W5 (33-14-risk-max.sql) was skipped by decision.
## For the orchestrator
- **g15office:** post a comment on the phase 33 task. Text: "Phase 33 released: SummerCMS v0.6.1, journal v0.4.0, sitemap v0.2.0, seo v0.2.0, layers seo v0.2.0 / journal v0.8.1 / menu v0.5.1 / faq v0.5.1; demo, summercms.io, bm and grzybyfunkcjonalne.pl deployed; open: human checks listed in 33-14-SUMMARY". Close g15office task w8kupqi3 if it is still open.
- **STATE.md:** updated through the handlers only and not committed. The grzyby blocker is resolved.
## Self-Check: PASSED
- Files: 33-release-log.md, 33-13-deploy-log.md and this SUMMARY exist.
- Tags: all 11 are on their origins (the plan's verify loop printed "tags-ok").
- Package files: no content layer package.json has `link:`.
- Commits:
- summercms.go: 6d14f71, 8edc869, 143b4db, ef164dd, 211687f, 201fd0f and 6875627 are present.
- Every repository: HEAD equals its origin default branch after the pushes. The exception is summercms.go, whose planning-doc commits after the v0.6.1 push are local (6 before this SUMMARY), and it is not pushed.
- Changelog: the four post URLs answer 200.

View File

@@ -0,0 +1,28 @@
Excerpt: One H1 per post page, a heading outline and link attributes in the editor, WebP and resized variants of featured images, opt-in scored related posts, and richer content facts for SEO.
## Highlights
- **One H1 per page.** With the new setting on (the default), H1 headings in post and category content are saved as H2, so the page title stays the only H1. `journal:fix-headings` converts stored content.
- **Featured images in WebP.** After an upload, a job writes resized variants (480, 800 and 1200 px by default) and a WebP copy of each; the API lists them and the journal layer serves them through `<picture>`.
- **A better editor.** Heading levels follow the setting, an outline flags skipped, empty and link-only headings, links get `rel` options and a warning for generic link texts, and uploaded image names are slugged.
## Added
- Settings › Journal, tab Headings and links: Convert H1 to H2 (`content_h1_to_h2`) and the generic link texts; the settings API and MCP tools for settings, headings and image alt texts.
- Content facts for other plugins: publication date, categories as parents, authors, images (with alt and decorative), YouTube embeds and the heading outline; a `journal-author` content type.
- `journal:image-variants` to backfill variants of existing featured images, and the `golem15.journal.image_widths` config key.
- Opt-in scored related posts (`golem15.journal.related_mode: scored`, shared tags and categories) with the previous and next post in the category.
## Changed
- **Requires SummerCMS v0.6.1.**
- **Content descriptors list only locales with content.** Posts, categories, tags and authors still describe every enabled locale, but a locale gets an address (and so an hreflang link and a sitemap address) only when the record has content in it: a post or a category when its own translation in that locale holds text (title, content or excerpt; a category's name or description; a translated slug alone does not count), a tag or an author when at least one of its published posts is translated into it, and the default locale always. Sites with an enabled but untranslated locale stop advertising its fallback pages. Menu items keep every locale.
- The H1 to H2 conversion leaves code samples alone: in a markdown body an `<h1>` inside a code block or code span keeps its tag, also when the body starts with an HTML block, and a raw `<h1>` elsewhere is converted as in the rendered page (API saves, imports, `journal:fix-headings` and translations).
- Setting an image's alt text through the API or MCP on a markdown post writes it into the markdown (`![alt](src)`, or a raw `<img>` outside code), also when the markdown starts with an HTML tag, so the next save keeps it; an image the markdown does not hold that way is refused with a validation error. A translation that holds only HTML gets the alt in its HTML.
- **Upgrade:** run the migrations, then `journal:fix-headings` (dry run first) to convert H1s already stored, and `journal:image-variants` once to write the variants of existing featured images. For the faster WebP encoder install libwebp on the server; the binary is now dynamically linked against glibc (see SummerCMS v0.6.1).
## Fixed
- `journal:image-variants` runs from the application's CLI: without a running server it opens the database and the uploads bucket itself instead of stopping with "database is not configured".
- `journal:fix-headings` runs from the application's CLI too.
- A very tall featured image (taller than 4096 px at a variant's width) no longer stops the image variants job or the `journal:image-variants` backfill: those widths are skipped with a warning.

View File

@@ -0,0 +1,33 @@
Excerpt: Structured data, breadcrumbs, hreflang and pagination in every resolve answer, a page registry, a site audit crawler with fix routes, auto-links and an internal links widget.
## Highlights
- **Complete SEO output from the CMS.** The resolve answer now carries one JSON-LD `@graph` per page (built per content kind, with the publisher or local business), breadcrumbs with a primary category, hreflang alternates, `<html lang>`, the pagination form and the page's outbound link rules.
- **Site audit.** A crawler reads the site like a search engine (statuses, sitemaps, canonicals, titles, headings, JSON-LD, hreflang, links, images, orphan pages, content that appears only after JavaScript) and stores issues that name the tool that fixes them.
- **Auto-links.** Phrases link to their pages in post bodies, fed from focus keyphrases, with an internal links widget in the SEO tab.
## Added
- A page registry (SEO › Pages) for the frontend's own pages, filled by the frontend's route report, with addresses and names per locale and a kind (page, offer, service, landing).
- `GET /_seo/api/v1/site` for the frontend layer, `llms.txt`, and the sitemap index in robots.txt.
- Publisher, local business and home crumb settings; per-record schema type, Service fields and custom JSON-LD with validation and a graph preview in the SEO tab.
- Pagination in the query or path form with title and description suffixes.
- Site audit settings, a nightly crawl, Site audit and Crawls screens and their MCP tools. With `golem15.seo.crawl_chrome_path` set, a rendered comparison through headless Chrome (chromedp).
- Crawl cancel and time limits: cancelling a running crawl shows it as **Cancelling** until its job stops, then it ends cancelled with the pages fetched so far; no other crawl starts before that. A crawl that reaches the 6-hour job limit ends failed and keeps what it fetched, and a crawl whose job disappeared (for example after a worker restart) is ended by the next start instead of staying "running". When storing a crawl's results takes longer than 10 minutes, the crawl still ends at once, failed with that error, instead of staying "running" until the next start.
- A sitemap filter for sm-sitemap-plugin that leaves noindex, canonicalised and redirected addresses out.
- The route report takes an optional `noindex` list: the static paths the frontend serves noindex (pages behind a login, pages with a noindex robots meta). The sitemaps leave them out, Additional addresses included, and a changed list asks the sitemap for a rebuild. vue-seo-layer v0.2.0 sends it; a frontend that sends no list keeps working.
- Links settings (outbound rules, new tab) and site cache purges after SEO writes.
## Changed
- **Requires SummerCMS v0.6.1 and sm-sitemap-plugin v0.2.0** (its filter contract).
- **Upgrade:** set `golem15.seo.site_url` to the public origin. Give the frontend a route report token (`golem15.seo.route_report_token`, else the 404 token is used). After the first frontend start, check SEO › Pages and give the reported pages their titles and their addresses in other locales.
## Fixed
- Registry pages store their created and updated times in UTC, so a page without a content date no longer gets a sitemap lastmod in the future on a server east of UTC.
- A content type's plain label is named untranslated in the address-owned refusal.
- The crawler and its headless Chrome stay on the site's own port, so page code cannot reach other services on the server's address, and a link to another port is no longer reported as a page of the site.
- Addresses with non-ASCII characters (for example `/blog/zażółć`) match their CMS records, focus keyphrases and link counts in the audit.
- A Chrome that hangs while opening a tab no longer stalls the crawl: opening the tab and rendering the page share one 25-second limit.
- A noindex Additional address of the sitemap found by the audit names `sitemap_update_settings` (remove it there) instead of a tool that cannot fix it.

View File

@@ -0,0 +1,28 @@
Excerpt: The sitemap is now an index of per-type files with real lastmod, hreflang, image and News sitemaps, IndexNow and an HTML sitemap. Breaking: the WinterCMS-format sitemap, its definitions screen and the XSL are gone.
## Highlights
- **A sitemap index of per-type files.** `/sitemap.xml` (same address) lists `/sitemap-<type>-<n>.xml` files built from every content type's published records and the additional addresses. Addresses keep their file between rebuilds; only a change of the file size renumbers.
- **Real lastmod.** A record's lastmod moves only when a save changes something that matters (configurable ignore list), and rebuilds are debounced after record events and run nightly.
- **Image and News sitemaps, IndexNow and an HTML sitemap.**
## Added
- hreflang alternates for records with more than one translated locale, with `x-default`.
- Image sitemap files from each page's images, and a Google News sitemap (`sitemap-news.xml`) for articles published in the last 48 hours, limited to chosen types or categories.
- IndexNow: a key, its key file and pings of added, changed and removed addresses in production, including a record deleted in the admin and a content edit that keeps its address.
- An HTML sitemap API (groups, category trees, paging) for the site's sitemap page.
- One settings screen (Settings › Sitemaps) with the files table, the addresses left out by reason, the content types (include, file name, headings) and the additional addresses; a management API and MCP tools.
- A filter contract (`contract.Filter`) that lets another plugin leave addresses out (noindex, canonical elsewhere, redirect) and group them.
- `contract.Rebuilder`, which lets another plugin ask for a debounced rebuild (the SEO plugin does when the frontend reports new noindex pages).
## Changed
- **Breaking.** The WinterCMS byte-format sitemap, priority tiers, the definitions screen, the old settings tile and `/sitemap.xsl` are removed. `<priority>` and `<changefreq>` are no longer written. The config keys `golem15.sitemap.cache_seconds` and `golem15.sitemap.priority_tiers` and the events `BeforeAddItem` and `AddItem` are gone.
- **Upgrade:** run the migrations: the definition's url items move to the additional addresses (a relative path such as `o-nas` gets its leading slash, spaces are percent-encoded, a duplicate is copied once), `frontend_url` to the site address, `frontend_default_locale` to the default locale; the old table stays, unread. An item that cannot be an additional address (an absolute URL with `&`, another scheme, a malformed item) is not copied: the startup log names each one as `golem15.sitemap: definition url item not copied` with the item, its value and the reason, so check the log after the upgrade and add those addresses by hand if they are still wanted. Serve the root file names from `/_sitemap/files/<name>` (vue-seo-layer v0.2.0 does it; with nginx, a proxy rule) and remove any nginx `/sitemap*` location. Run `sitemap:rebuild` once after the release. Additional addresses that the site serves noindex are left out automatically once the frontend reports its noindex pages (sm-seo-plugin v0.2.0 with vue-seo-layer v0.2.0); otherwise remove them.
- **Requires SummerCMS v0.6.1.**
## Fixed
- An additional address that a content record already lists is written once (it is counted as "Already listed by a content type" on the settings screen).
- An HTML sitemap heading follows each language until an editor sets one; saving the settings no longer stores the type's name in the admin's language as every language's heading.

View File

@@ -0,0 +1,26 @@
Excerpt: Content descriptors carry dates, parents, authors, media and headings; plugin field types get per-request options; attachments get WebP variants; validation now checks string, url and min/max length the Laravel way, with Polish messages.
## Highlights
- **Richer content descriptors.** A content type can now tell other plugins what a record is and what it holds: its kind (article, collection, profile, page), the MCP tools that fix it, its first publication date, its parents, its authors, its top heading level, and per locale its images, videos and heading outline. Sitemaps, structured data and site audits read these facts without knowing the plugin behind them.
- **WebP variants of thumbnails.** `attach/webp` writes a WebP copy next to any attachment thumbnail, once, and `attach.VariantKey` names it.
- **Validation that matches Laravel.** `lagoon.Validate` accepts the `string` and `url` rules and checks `min`/`max` as a length on every field that is not numeric.
## Added
- `pact.ContentDescriptor.Kind` and `Tools`, with the `ContentKind*` and `ContentTool*` constants.
- `pact.ContentRecord.PublishedAt`, `Parents`, `Authors` and `TopHeading`; `pact.ContentLocale.Images`, `Videos` and `Headings`; the value types `ContentRef`, `ContentPerson`, `ContentImage`, `ContentVideo` and `ContentHeading`. All are optional: a descriptor that sets none behaves as before.
- `pact.FormFieldType.RequestOptions`: a plugin field type can add options that change per request (for example values read from the database). They join the field's `fields.yaml` options, which win on the same key; an error keeps the `fields.yaml` options.
- `attach.VariantKey(thumbKey, format)` and the `lagoon/attach/webp` package (`Encode`, `Variant`). Only binaries that import the package link the encoder.
- Polish messages for the `string` rule and numeric wording for the Polish `min` and `max` messages.
## Changed
- `lagoon.Validate` checks `min` and `max` as a length on every field that is not `integer` or `numeric`: characters for a string, items for a list. **A stored value longer than its rule's `max` now fails its next admin save until it is shortened.** Before upgrading, check the long text columns your plugins validate with a `max` (for example a description with `max:5000` on a TEXT column).
- A `min` or `max` bound that is not a whole number is now an error instead of being ignored.
- **Binaries are no longer fully static when they link `attach/webp`.** The WebP encoder loads the system libwebp through purego, so a `CGO_ENABLED=0` build is dynamically linked against glibc (`ld-linux-x86-64.so.2`, `libc.so.6`, `libdl.so.2`, `libpthread.so.0`). It runs on Debian and Ubuntu servers, not in `scratch`, distroless-static or Alpine images. With libwebp installed the fast encoder is used; without it, a slower built-in one. Build with `-tags nodynamic` for a static binary that always uses the built-in encoder.
- **`attach/webp` also decodes WebP.** Importing it registers the encoder library's WebP decoder ahead of the pure Go one for the whole process, so WebP uploads (thumbnails, size checks) are decoded by the system libwebp when it is installed. Keep libwebp patched, or build with `-tags nodynamic`, which decodes with the built-in copy.
## Fixed
- Settings forms whose rules use `string` or `url` (for example the Journal settings) can be saved from the admin again; they failed with "unrecognized validation rule".

View File

@@ -0,0 +1,16 @@
Excerpt: FAQ blocks add a FAQPage node to the page's one JSON-LD graph and can render their title as styled text for widgets; the layer now extends vue-seo-layer.
## Highlights
- **FAQPage structured data.** `FaqBlock` adds a `FAQPage` node with the questions and plain-text answers to the page's single JSON-LD graph (prop `schema`, default on).
- **Widget headings.** `headingLevel` 0 renders the FAQ name as a styled `<p>` that still labels the section, for sidebars and footers.
## Added
- `faqSchema()` and `faqAnswerText()` helpers.
## Changed
- **Breaking:** the layer extends vue-seo-layer, and the copied site cache purge route, library and plugin are removed (vue-seo-layer provides them with the same environment variables).
- **Upgrade:** set `NUXT_SEO_API_BASE`, or `seo: { cms: false }` for a site without the SEO plugin. The layer brings vue-seo-layer's HTML sitemap pages (pl `/mapa-strony`, en `/sitemap` by default). An app that renders its pages through a root catch-all (`[...slug].vue`) gets none, so a CMS page at such a path stays visible, unless it sets `seo.htmlSitemap.overCatchAll: true`; an app with its own page at such a path keeps it; `seo: { htmlSitemap: false }` turns them off. When a page shows several FAQs, set `schema` false on all but one.
- **Install v0.5.1, not v0.5.0.** vue-seo-layer v0.2.0 is a peer dependency (`^0.2.0`): list `"vue-seo-layer": "git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0"` in the app next to `"vue-faq-layer": "git+https://git.golem15.com/golem15/vue-faq-layer.git#v0.5.1"`. v0.5.0 listed vue-seo-layer as its own git dependency, which pnpm refuses by default (`ERR_PNPM_EXOTIC_SUBDEP`); v0.5.1 is otherwise the same release.

View File

@@ -0,0 +1,26 @@
Excerpt: The journal layer now runs on vue-seo-layer: one H1 per post page, breadcrumbs, CMS pagination, ItemList nodes, WebP srcsets and category neighbours. Breaking: @nuxtjs/seo is gone and post cards have one link.
## Highlights
- **Built on the SEO layer.** Every journal page takes its head, hreflang and JSON-LD from the SEO plugin; listings add an `ItemList` node, post pages a `BlogPosting`, all in one graph.
- **One H1 in both Journal H1 modes.** The post title is the H1 while body H1s become H2s, and a `p` when the body keeps its own (`journal.postTitleTag` forces either).
- **Faster images.** Featured images are served through `<picture>` with WebP and srcset from the Journal's variants.
## Added
- Breadcrumbs at the top of journal pages (`journal.breadcrumbs: false` when the layout renders them), CMS pagination links, a category's pillar content on its first page.
- Previous and next posts in the category when the Journal's scored mode answers them.
- Auto-links, outbound link rules and image attributes applied to the post body.
- With `seo.pagination.form: 'path'`, listing pages get routes for the SEO layer's segments, its defaults included (`/blog/strona/2`, `/blog/page/2`), matching the pagination links.
## Changed
- **Breaking: `@nuxtjs/seo` is removed.** Remove `site: { url, name }` and the `ogImage`, `seo.canonicalQueryWhitelist`, `sitemap`, `robots` and `schemaOrg` keys; set `NUXT_SEO_API_BASE`, or `seo: { cms: false }` for a site without the SEO plugin. The journal sitemap source is gone; the sitemap plugin builds the sitemaps.
- **Breaking: post cards have one link.** The read-more link and the image link are removed; the whole card is clickable. The post title may be a `p.journal-post__title`, related post cards are `h3`. Adjust app CSS that targets the old elements.
- The shared site cache purge route moved to vue-seo-layer with the same path and variables.
- **Upgrade:** The layer brings vue-seo-layer's HTML sitemap pages (pl `/mapa-strony`, en `/sitemap` by default). An app that renders its pages through a root catch-all (`[...slug].vue`) gets none, so a CMS page at such a path stays visible, unless it sets `seo.htmlSitemap.overCatchAll: true`; an app with its own page at such a path keeps it; `seo: { htmlSitemap: false }` turns them off. Post pages keep `og:type` article and their publish and update times next to the CMS head.
- **Install v0.8.1, not v0.8.0.** vue-seo-layer v0.2.0 is a peer dependency (`^0.2.0`): list `"vue-seo-layer": "git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0"` in the app next to `"vue-journal-layer": "git+https://git.golem15.com/golem15/vue-journal-layer.git#v0.8.1"`. v0.8.0 listed vue-seo-layer as its own git dependency, which pnpm refuses by default (`ERR_PNPM_EXOTIC_SUBDEP`); v0.8.1 is otherwise the same release.
## Fixed
- No more `Duplicated imports "JournalImageVariant"` warning on every build of an app with the layer.

View File

@@ -0,0 +1,11 @@
Excerpt: The menu layer now extends vue-seo-layer, so every page of a menu-only site takes its head from the SEO plugin. Breaking: the copied site cache purge route is gone.
## Highlights
- **SEO head on every page.** The layer extends vue-seo-layer: pages resolve through the SEO plugin and take their title, canonical, hreflang and JSON-LD from it.
## Changed
- **Breaking:** `server/api/__site__/cache/purge.post.ts`, `server/lib/siteCachePurge.ts` and `server/plugins/site-cache-purge.ts` are removed from this layer; vue-seo-layer provides the same route, library and plugin with the same environment variables. An app that imported the library from this layer imports it from vue-seo-layer.
- **Upgrade:** set `NUXT_SEO_API_BASE` when the backend is not on `http://127.0.0.1:8096`, or `seo: { cms: false }` for a site without the SEO plugin. The layer brings vue-seo-layer's HTML sitemap pages (pl `/mapa-strony`, en `/sitemap` by default). An app that renders its pages through a root catch-all (`[...slug].vue`) gets none, so a CMS page at such a path stays visible, unless it sets `seo.htmlSitemap.overCatchAll: true`; an app with its own page at such a path keeps it; `seo: { htmlSitemap: false }` turns them off.
- **Install v0.5.1, not v0.5.0.** vue-seo-layer v0.2.0 is a peer dependency (`^0.2.0`): list `"vue-seo-layer": "git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0"` in the app next to `"vue-menu-layer": "git+https://git.golem15.com/golem15/vue-menu-layer.git#v0.5.1"`. v0.5.0 listed vue-seo-layer as its own git dependency, which pnpm refuses by default (`ERR_PNPM_EXOTIC_SUBDEP`); v0.5.1 is otherwise the same release.

View File

@@ -0,0 +1,25 @@
Excerpt: hreflang and one JSON-LD graph on every page, robots.txt and sitemaps served from the CMS, server-rendered breadcrumbs, pagination and HTML sitemap, a build guard against browser-only indexable pages, and a route report to the page registry.
## Highlights
- **The whole SEO head from the CMS.** Besides title, description, canonical and Open Graph, every server-rendered page now gets `<html lang>`, hreflang links, `og:locale` and exactly one JSON-LD `@graph`, which app components extend through `useSchemaNode`.
- **Root files from the backend.** robots.txt, the sitemap index and files, llms.txt and the IndexNow key file are served from the SEO and sitemap plugins.
- **No accidental client-only pages.** The build fails when an indexable route would render only in the browser; declared and signed-in routes are sent `noindex`.
## Added
- `<SeoBreadcrumbs>`, `<SeoPagination>` with `usePagination()` (prev and next links, `%pages%` in the CMS title), and HTML sitemap pages with a footer link (`<SeoSitemapLink>`), in English and Polish.
- The route report: at server start the site's static pages go to the CMS page registry. With `@nuxtjs/i18n` prefix strategies only the default-locale pages are reported; their translations are set in SEO › Pages. The same report lists the static pages the site serves noindex (signed-in pages, a noindex `seo.robots`, `seo.noindexRoutes`, and their translations), so the CMS leaves them out of the XML and HTML sitemaps.
- A startup drift check that logs when the CMS's URL patterns, pagination or HTML sitemap paths differ from the build.
- Body link utilities for auto-links, outbound rules and image attributes.
- HTML sitemap pages exist once per locale with `@nuxtjs/i18n`, at the configured path, and never take a path from an app's catch-all page unless `seo.htmlSitemap.overCatchAll` is on.
- `seo.noindexRoutes`, `seo.htmlSitemap` (with `overCatchAll`), `seo.pagination` and `seo.routeReport` options.
## Changed
- **Upgrade:** set `NUXT_SEO_ROUTE_REPORT_TOKEN` (or keep `NUXT_SEO_NOTFOUND_TOKEN`), declare browser-only routes in `seo.noindexRoutes` or render them on the server, and remove nginx locations for `/sitemap*` and `/robots.txt` so the site serves them. An app with `@nuxtjs/i18n` gives each locale its full HTML sitemap path in `seo.htmlSitemap.paths`. An app that renders its pages through a root catch-all (`[...slug].vue`) gets no HTML sitemap pages unless it sets `seo.htmlSitemap.overCatchAll: true`; an app with its own page at a sitemap path keeps it.
- Works best with sm-seo-plugin v0.2.0 and sm-sitemap-plugin v0.2.0; against an older backend the new parts stay off.
## Fixed
- robots.txt, sitemap.xml and llms.txt answer 503 with `Retry-After` while the backend has not answered since the server started, so a crawler retries instead of reading a missing robots.txt as allow-all; this also keeps a staging site's `Disallow` in force. Once the backend has answered, its last answer is used while it is down, so on a site whose backend has no SEO plugin these files keep coming from the app during an outage.

View File

@@ -0,0 +1,35 @@
-- RISK-MAX check (quick task 261104-fx1): rows whose stored value is longer
-- than the max of its lagoon.Validate rule, so their next admin save fails.
-- Read-only: SELECT only. Tables a database lacks are reported as absent.
\pset format unaligned
\pset tuples_only on
\pset fieldsep '|'
DO $$
DECLARE r record; n bigint; mx bigint;
BEGIN
FOR r IN SELECT * FROM (VALUES
('backend_user_roles', 'name', 255, 'name'),
('backend_user_roles', 'code', 255, 'code'),
('backend_users', 'login', 255, 'login'),
('backend_users', 'email', 255, 'email'),
('jz_bm_checklists', 'description', 10000, 'description'),
('jz_bm_checklist_items', 'notes', 10000, 'notes'),
('golem15_feedback_submissions', 'email', 255, 'email'),
('golem15_oauthserver_clients', 'redirect_uris (joined by newline)', 20000, $q$array_to_string(ARRAY(SELECT jsonb_array_elements_text(CASE WHEN jsonb_typeof(redirect_uris::jsonb) = 'array' THEN redirect_uris::jsonb ELSE '[]'::jsonb END)), E'\n')$q$),
('golem15_oauthserver_clients', 'sector_identifier', 255, 'sector_identifier'),
('golem15_oauthserver_settings', 'custom_css', 20000, 'custom_css'),
('golem15_user_organisations', 'name', 255, 'name'),
('golem15_user_organisations', 'description', 5000, 'description'),
('golem15_sociallogin_settings', 'microsoft_tenant', 255, 'microsoft_tenant')) AS t(tbl, col, lim, expr) LOOP
IF to_regclass(r.tbl) IS NULL THEN
RAISE NOTICE '%|%|%|absent', r.tbl, r.col, r.lim;
CONTINUE;
END IF;
BEGIN
EXECUTE format('SELECT count(*) FILTER (WHERE char_length(v) > %s), coalesce(max(char_length(v)), 0) FROM (SELECT (%s)::text AS v FROM %I) s', r.lim, r.expr, r.tbl) INTO n, mx;
RAISE NOTICE '%|%|%|over=% longest=%', r.tbl, r.col, r.lim, n, mx;
EXCEPTION WHEN others THEN
RAISE NOTICE '%|%|%|error %', r.tbl, r.col, r.lim, SQLERRM;
END;
END LOOP;
END $$;

View File

@@ -0,0 +1,371 @@
diff --git a/DEPLOY.md b/DEPLOY.md
index f2f4d0b..4209ab6 100644
--- a/DEPLOY.md
+++ b/DEPLOY.md
@@ -707,13 +707,21 @@ the 404 log, robots.txt with AI bot switches, history and the `seo_` MCP tools (
(`config/golem15.sitemap.yaml`, or **Settings › Sitemaps**); without one `/sitemap.xml` answers 404. The
demo has no tag pages (`config/golem15.journal.yaml`, `tag_pages: false`), so no tag address is listed.
Rebuilds run as jobs in the serve process after each Journal save and nightly. The footer links the
- HTML sitemap (`/sitemap`, `/mapa-strony` in Polish).
+ HTML sitemap (`/sitemap`, `/pl/mapa-strony` in Polish; `demo:seed` sets both addresses in
+ **Settings › Sitemaps** while they are the plugin's defaults).
+- **Languages.** English is at `/`, Polish under `/pl/` (`vue-demo-app/nuxt.config.ts`,
+ `prefix_except_default`), the prefix the Journal, sitemap and SEO plugins give every non-default locale.
+ The language switcher links to the same page in the other language; the `i18n_redirected` cookie keeps
+ the last choice and sends a returning visitor of `/` to `/pl`. Before this release Polish was served
+ from a cookie at the English addresses, so every Polish address is new; nothing redirects the old way,
+ which had no addresses of its own. The reported pages (SEO › Pages) are the English ones; give a page
+ its Polish address there to list it in the sitemaps with hreflang.
- **Page titles.** A reported page takes its name from its path ("Home", "Faq") until it has its own SEO
title; `deploy/seo-pages.csv` holds the titles and descriptions the pages had before (records by URL,
imported once, below).
- **Verify** after the release: `curl -s https://demo.summercms.io/robots.txt` shows the copied lines and
the `Sitemap:` line; `curl -sI https://demo.summercms.io/robots.txt` answers 200 `text/plain`; and from
- the build machine `SMOKE_SEO_API=… scripts/smoke-seo.sh https://demo.summercms.io` (below) ends with
+ the build machine `SMOKE_SEO_STRICT=1 SMOKE_SEO_API=… scripts/smoke-seo.sh https://demo.summercms.io` (below) ends with
`smoke-seo: ok`.
**Before the first release with Phase 33** (the SEO layer and the new sitemap format), on rome as root
@@ -770,10 +778,10 @@ the registry; and a 404 reaching the 404 log (removed again). Locally after `scr
`scripts/smoke-seo.sh http://127.0.0.1:3020`. Against rome, from the build machine with the admin
password in a 0600 file and the Go port reached over an SSH tunnel
(`$RSH -N -L 18098:127.0.0.1:8098 $ROME &`):
-`SMOKE_SEO_API=http://127.0.0.1:18098 SMOKE_SEO_ADMIN_PASSWORD_FILE=… scripts/smoke-seo.sh https://demo.summercms.io`.
-An alternate or sitemap address that does not answer 200 is a `WARN` line (`SMOKE_SEO_STRICT=1` makes it
-a failure): the Polish addresses (`/pl/…`) the CMS names answer 404 while the site keeps the language in a
-cookie at one address (D-13).
+`SMOKE_SEO_STRICT=1 SMOKE_SEO_API=http://127.0.0.1:18098 SMOKE_SEO_ADMIN_PASSWORD_FILE=… scripts/smoke-seo.sh https://demo.summercms.io`.
+An alternate or sitemap address that does not answer 200 is a `WARN` line; `SMOKE_SEO_STRICT=1` makes it
+a failure, and the demo runs it so, since the Polish addresses (`/pl/…`) the CMS names are pages of the
+site.
## Build
@@ -888,12 +896,11 @@ shell on `/smbackend` and 200 JSON from its public `/smbackend/api/v1/lang`, tha
(including the client-only deck page, which carries `window.__NUXT_SITE_CONFIG__`) carries a
site-cache purge key (`cachePurgeToken`, `cacheAllowProxied`; it prints the key name only), 200 JSON from
`/_journal/api/v1/posts`, 404 for `/oauth/authorize` (it must not reach Go), the Turnstile widget
-container on `/register`, 200 on `/contact`, the Płatności tour card on `/` with the `i18n_redirected=pl`
-cookie, and a 422 `turnstile_failed` for a token-less `POST /_user/api/v1/register` (a 503
+container on `/register`, 200 on `/contact`, the Płatności tour card on `/pl`, and a 422 `turnstile_failed` for a token-less `POST /_user/api/v1/register` (a 503
`turnstile_unavailable` means `.env` has no `SUMMER_TURNSTILE__SECRET`). For the presentations and
-quizzes it checks the `/roadmap` redirect to `/p/roadmap-{hash}` (and `roadmap-pl` with the Polish
-cookie), 200 on that public deck page, the public quiz list (no answers) and the Polish quiz on
-`/quizzes`, 401 without a JWT on `/api/realtime/token` and the deck API, that the subscribe proxy never
+quizzes it checks the `/roadmap` redirect to `/p/roadmap-{hash}` (and `/pl/p/roadmap-pl-{hash}` from
+`/pl/roadmap`), 200 on that public deck page, the public quiz list (no answers) and the Polish quiz on
+`/pl/quizzes`, 401 without a JWT on `/api/realtime/token` and the deck API, that the subscribe proxy never
reaches Go, and a WebSocket upgrade on `/ws` (101 from the demo's Centrifugo; a foreign `Origin` is
refused). Last, `scripts/check-back.cjs` (the global Playwright, as `deck-snapshot.cjs`) checks the
browser history: the home page's Presentations card links straight to the deck of the language (with a
diff --git a/README.md b/README.md
index 78aa580..411e5a6 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,7 @@ any number of times:
twin `summercms-podstawy` (context `demo:pl`); the site lists the quizzes of its language by context;
- the subscription plans Starter (19 PLN, 5 EUR, 5 USD) and Professional (29 PLN, 7 EUR, 8 USD);
- the sitemap definition;
+- the HTML sitemap addresses `/sitemap` and `/pl/mapa-strony` (Settings › Sitemaps), while the settings hold the sitemap plugin's defaults;
- the chat family (below): personas, channels with history, a welcome DM to the visitor, the forum,
friends, the moderator group and the default moderation lists;
- the roadmap decks `roadmap` (English) and `roadmap-pl` (Polish), regenerated on every run (below).
diff --git a/plugins/demo/console/seed.go b/plugins/demo/console/seed.go
index 7d19304..1e3188d 100644
--- a/plugins/demo/console/seed.go
+++ b/plugins/demo/console/seed.go
@@ -60,6 +60,7 @@ func runSeed(ctx context.Context, app *backpack.App, db *gorm.DB, out bonfire.Ou
{"subscription plans starter and professional", created(seedPlans)},
{"feedback settings", func(tx *gorm.DB) (string, error) { return seedFeedbackSettings(ctx, app, tx) }},
{"sitemap definition", created(seedSitemap)},
+ {"HTML sitemap addresses (en, pl)", seedSitemapHTMLPaths},
{"chat personas", created(seedPersonas(ctx))},
{"chat channels and history (en)", created(seedChannels(ctx, channelsEN))},
{"chat channels and history (pl)", created(seedChannels(ctx, channelsPL))},
@@ -362,6 +363,26 @@ func seedSitemap(tx *gorm.DB) (bool, error) {
return true, tx.Exec(`INSERT INTO golem15_sitemap_definitions (theme, data, created_at, updated_at) VALUES ('default', ?, now(), now())`, data).Error
}
+// demoHTMLSitemapPaths are the HTML sitemap's addresses on the demo: English
+// at /sitemap and Polish under the site's /pl/ prefix (vue-demo-app
+// i18n.strategy prefix_except_default and seo.htmlSitemap.paths).
+const demoHTMLSitemapPaths = `{"en":"/sitemap","pl":"/pl/mapa-strony"}`
+
+// seedSitemapHTMLPaths gives the HTML sitemap the demo's addresses while the
+// settings hold none or the sitemap plugin's defaults ({"pl":"/mapa-strony",
+// "en":"/sitemap"}); addresses an editor changed in Settings › Sitemaps stay.
+func seedSitemapHTMLPaths(tx *gorm.DB) (string, error) {
+ res := tx.Exec(`UPDATE golem15_sitemap_settings SET html_paths = ?::jsonb
+ WHERE id = 1 AND (html_paths IS NULL OR html_paths = '{}'::jsonb OR html_paths = '{"pl":"/mapa-strony","en":"/sitemap"}'::jsonb)`, demoHTMLSitemapPaths)
+ if res.Error != nil {
+ return "", res.Error
+ }
+ if res.RowsAffected == 0 {
+ return "exists", nil
+ }
+ return "updated", nil
+}
+
// The plan codes are distinct from other local apps' plans: Stripe price
// lookup keys are <code>_<currency> per Stripe account, and a plan sync moves
// a lookup key to its own new price.
diff --git a/scripts/check-back.cjs b/scripts/check-back.cjs
index 2953394..3b8ae47 100644
--- a/scripts/check-back.cjs
+++ b/scripts/check-back.cjs
@@ -67,7 +67,7 @@ async function cardHref(page, base) {
await page.goto(`${base}/`, { waitUntil: 'networkidle' })
return page.evaluate(() => {
const links = Array.from(document.querySelectorAll('#tour .tour-card__link'))
- const deck = links.find((a) => /^\/(p\/roadmap|roadmap)/.test(a.getAttribute('href') || ''))
+ const deck = links.find((a) => /^\/(pl\/)?(p\/roadmap|roadmap)/.test(a.getAttribute('href') || ''))
return deck ? deck.getAttribute('href') : ''
})
}
@@ -81,23 +81,24 @@ const TOKEN_COOKIE = 'summercms_demo_token'
async function memberHome(browser, base, host, locale, mine) {
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
const cookies = [{ name: TOKEN_COOKIE, value: 'check-back', domain: host, path: '/' }]
- if (locale) cookies.push({ name: 'i18n_redirected', value: locale, domain: host, path: '/' })
await ctx.addCookies(cookies)
const page = await ctx.newPage()
const errors = []
page.on('console', (m) => { if (m.type() === 'error' || /hydration/i.test(m.text())) errors.push(m.text()) })
const what = `member home${locale ? ` (${locale})` : ''}`
try {
- const res = await page.goto(`${base}/`, { waitUntil: 'networkidle' })
+ // Polish lives under /pl/ (prefix_except_default).
+ const prefix = locale ? `/${locale}` : ''
+ const res = await page.goto(`${base}${prefix || '/'}`, { waitUntil: 'networkidle' })
const html = res ? await res.text() : ''
- if (!/href="\/presentations"[^>]*class="tour-card__link"/.test(html)) bad(`${what}: the server's Presentations card does not link to /presentations`)
+ if (!new RegExp(`href="${prefix}/presentations"[^>]*class="tour-card__link"`).test(html)) bad(`${what}: the server's Presentations card does not link to ${prefix}/presentations`)
if (!html.includes(`site-header__mine">${mine}<`)) bad(`${what}: the server's header has no '${mine}' link`)
const hydrated = await page.evaluate(() => ({
card: Array.from(document.querySelectorAll('#tour .tour-card__link')).map((a) => a.getAttribute('href')),
mine: (document.querySelector('.site-header__mine') || {}).textContent || '',
}))
- if (!hydrated.card.includes('/presentations') || hydrated.card.some((h) => /^\/(p\/)?roadmap/.test(h || ''))) {
- bad(`${what}: after hydration the card links are ${hydrated.card.join(',')}, want /presentations and no deck`)
+ if (!hydrated.card.includes(`${prefix}/presentations`) || hydrated.card.some((h) => /^\/(pl\/)?(p\/)?roadmap/.test(h || ''))) {
+ bad(`${what}: after hydration the card links are ${hydrated.card.join(',')}, want ${prefix}/presentations and no deck`)
}
if (hydrated.mine.trim() !== mine) bad(`${what}: after hydration the header link reads '${hydrated.mine.trim()}', want '${mine}'`)
const mismatch = errors.filter((e) => /hydration/i.test(e))
@@ -114,9 +115,8 @@ async function main() {
try {
// The Polish card links to the Polish deck.
const pl = await browser.newContext({ viewport: { width: 1440, height: 900 } })
- await pl.addCookies([{ name: 'i18n_redirected', value: 'pl', domain: host, path: '/' }])
- const plHref = await cardHref(await pl.newPage(), base)
- if (!/^\/p\/roadmap-pl-[0-9a-f]+$/.test(plHref)) bad(`pl home: the Presentations card links to '${plHref}', want /p/roadmap-pl-{hash}`)
+ const plHref = await cardHref(await pl.newPage(), `${base}/pl`)
+ if (!/^\/pl\/p\/roadmap-pl-[0-9a-f]+$/.test(plHref)) bad(`pl home: the Presentations card links to '${plHref}', want /pl/p/roadmap-pl-{hash}`)
await pl.close()
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
diff --git a/scripts/check-live.sh b/scripts/check-live.sh
index c2bed87..b91e815 100755
--- a/scripts/check-live.sh
+++ b/scripts/check-live.sh
@@ -179,14 +179,14 @@ code="$(get /contact)"
no_admin_link /contact
no_purge_key /contact
-# The @nuxtjs/i18n cookie that selects the language (vue-demo-app/nuxt.config.ts).
-code="$(get / -b i18n_redirected=pl)"
+# Polish lives under /pl/ (vue-demo-app/nuxt.config.ts, prefix_except_default).
+code="$(get /pl)"
if [[ "$code" != 200 ]]; then
- bad "GET $BASE/ (pl cookie): status $code, want 200"
+ bad "GET $BASE/pl: status $code, want 200"
else
- grep -qF 'Płatności' "$TMP/body" || bad "GET $BASE/ (pl cookie): no Płatności tour card (Polish not served)"
- no_admin_link "/ (pl cookie)"
- no_purge_key "/ (pl cookie)"
+ grep -qF 'Płatności' "$TMP/body" || bad "GET $BASE/pl: no Płatności tour card (Polish not served)"
+ no_admin_link "/pl"
+ no_purge_key "/pl"
fi
email="check-live-$(date +%s)-$RANDOM@example.test"
@@ -200,15 +200,17 @@ else
grep -qF turnstile_failed "$TMP/body" || bad "POST $BASE/_user/api/v1/register without a token: 422 but not turnstile_failed ($(head -c 200 "$TMP/body"))"
fi
-# Presentations (D-14, D-16): /roadmap redirects to the deck of the language.
+# Presentations (D-14, D-16): /roadmap redirects to the deck of the language
+# (/pl/roadmap to the Polish deck under /pl/).
for lang in en pl; do
want=/p/roadmap-
- [[ "$lang" == pl ]] && want=/p/roadmap-pl-
- code="$(get /roadmap -b "i18n_redirected=$lang")"
+ path=/roadmap
+ [[ "$lang" == pl ]] && want=/pl/p/roadmap-pl- && path=/pl/roadmap
+ code="$(get "$path")"
location="$(header Location)"
location="${location#"$BASE"}"
if [[ "$code" != 302 || "$location" != "$want"* ]]; then
- bad "GET $BASE/roadmap ($lang cookie): status $code location '$location', want 302 $want{hash}"
+ bad "GET $BASE$path: status $code location '$location', want 302 $want{hash}"
elif [[ "$lang" == en ]]; then
code="$(get "$location")"
[[ "$code" == 200 ]] || bad "GET $BASE$location: status $code, want 200 (the public deck page)"
@@ -225,13 +227,13 @@ else
grep -qF '"summercms-basics"' "$TMP/body" || bad "GET $BASE/_demo/api/v1/quizzes?context=demo:en: no summercms-basics"
! grep -qiF 'is_correct' "$TMP/body" || bad "GET $BASE/_demo/api/v1/quizzes: the public list leaks correctness"
fi
-code="$(get /quizzes -b i18n_redirected=pl)"
+code="$(get /pl/quizzes)"
if [[ "$code" != 200 ]]; then
- bad "GET $BASE/quizzes (pl cookie): status $code, want 200"
+ bad "GET $BASE/pl/quizzes: status $code, want 200"
else
- grep -qF 'Podstawy SummerCMS' "$TMP/body" || bad "GET $BASE/quizzes (pl cookie): the Polish quiz is not listed"
- no_admin_link "/quizzes (pl cookie)"
- no_purge_key "/quizzes (pl cookie)"
+ grep -qF 'Podstawy SummerCMS' "$TMP/body" || bad "GET $BASE/pl/quizzes: the Polish quiz is not listed"
+ no_admin_link "/pl/quizzes"
+ no_purge_key "/pl/quizzes"
fi
# Realtime (D-17) and the deck API (D-15) need a JWT.
diff --git a/scripts/check-local.sh b/scripts/check-local.sh
index 7a81987..1b1d808 100755
--- a/scripts/check-local.sh
+++ b/scripts/check-local.sh
@@ -107,8 +107,8 @@ cd "$(dirname "$0")/.."
GO="http://${GO_ADDR:-127.0.0.1:8097}"
NUXT="http://${NUXT_ADDR:-127.0.0.1:3020}"
ALL_CHECKS=(turnstile tour journal contact reset roadmap realtime decks quizzes back remote chat forum friends call herald chatlive callmedia moderation)
-# The @nuxtjs/i18n cookie that selects the language (nuxt.config.ts).
-LOCALE_COOKIE=i18n_redirected
+# Polish lives under /pl/ (vue-demo-app/nuxt.config.ts, prefix_except_default).
+PL=/pl
# Cloudflare's test token: the always-pass test secret accepts it.
DUMMY_TOKEN=XXXX.DUMMY.TOKEN.XXXX
@@ -191,24 +191,24 @@ check_tour() {
! grep -qx Subscriptions <<<"$titles" || bad "tour: a tour card is titled Subscriptions, want Payments"
fi
- code="$(request GET "$NUXT/" -b "$LOCALE_COOKIE=pl")"
+ code="$(request GET "$NUXT$PL")"
if [[ "$code" != 200 ]]; then
- bad "tour: GET / (pl) status $code, want 200"
+ bad "tour: GET $PL status $code, want 200"
else
- card_titles | grep -qx 'Płatności' || bad "tour: GET / with the pl cookie has no Płatności card"
- card_titles | grep -qx 'Czat' || bad "tour: GET / with the pl cookie has no Czat card"
+ card_titles | grep -qx 'Płatności' || bad "tour: GET $PL has no Płatności card"
+ card_titles | grep -qx 'Czat' || bad "tour: GET $PL has no Czat card"
for want in Forum Znajomi 'Rozmowy wideo'; do
- card_titles | grep -qx "$want" || bad "tour: GET / with the pl cookie has no $want card"
+ card_titles | grep -qx "$want" || bad "tour: GET $PL has no $want card"
done
- grep -qF 'Dane mogą zostać zresetowane w każdej chwili' "$TMP/body" || bad "tour: GET / with the pl cookie has no Polish banner"
- grep -q 'lang="pl' "$TMP/body" || bad "tour: GET / with the pl cookie does not render html lang=pl"
+ grep -qF 'Dane mogą zostać zresetowane w każdej chwili' "$TMP/body" || bad "tour: GET $PL has no Polish banner"
+ grep -q 'lang="pl' "$TMP/body" || bad "tour: GET $PL does not render html lang=pl"
fi
- code="$(request GET "$NUXT/faq" -b "$LOCALE_COOKIE=pl")"
+ code="$(request GET "$NUXT$PL/faq")"
if [[ "$code" != 200 ]]; then
- bad "tour: GET /faq (pl) status $code, want 200"
+ bad "tour: GET $PL/faq status $code, want 200"
else
- grep -qF 'Czym jest SummerCMS?' "$TMP/body" || bad "tour: GET /faq with the pl cookie has no Polish question"
+ grep -qF 'Czym jest SummerCMS?' "$TMP/body" || bad "tour: GET $PL/faq has no Polish question"
fi
}
@@ -221,11 +221,11 @@ check_journal() {
json_has subtitle description avatar || bad "journal: the author payload lacks subtitle, description or avatar ($(head -c 300 "$TMP/body"))"
fi
- code="$(request GET "$NUXT/blog/welcome-to-summercms" -b "$LOCALE_COOKIE=pl")"
+ code="$(request GET "$NUXT$PL/blog/welcome-to-summercms")"
if [[ "$code" != 200 ]]; then
- bad "journal: GET /blog/welcome-to-summercms (pl) status $code, want 200"
+ bad "journal: GET $PL/blog/welcome-to-summercms status $code, want 200"
else
- grep -qF 'Witaj w SummerCMS' "$TMP/body" || bad "journal: the post with the pl cookie has no Polish title"
+ grep -qF 'Witaj w SummerCMS' "$TMP/body" || bad "journal: the Polish post has no Polish title"
grep -qF 'Golem15' "$TMP/body" || bad "journal: the post has no author card subtitle"
fi
@@ -305,9 +305,9 @@ check_roadmap() {
bad "roadmap: the roadmap decks are not published (run scripts/dev.sh seed)"
return
fi
- got="$(location_of GET "$NUXT/roadmap" -b "$LOCALE_COOKIE=pl")"
- [[ "$(cat "$TMP/status")" == 302 && "$got" == "/p/roadmap-pl-$pl" ]] ||
- bad "roadmap: GET /roadmap (pl): status $(cat "$TMP/status") location '$got', want 302 /p/roadmap-pl-$pl"
+ got="$(location_of GET "$NUXT$PL/roadmap")"
+ [[ "$(cat "$TMP/status")" == 302 && "$got" == "$PL/p/roadmap-pl-$pl" ]] ||
+ bad "roadmap: GET $PL/roadmap: status $(cat "$TMP/status") location '$got', want 302 $PL/p/roadmap-pl-$pl"
got="$(location_of GET "$NUXT/roadmap")"
[[ "$(cat "$TMP/status")" == 302 && "$got" == "/p/roadmap-$en" ]] ||
bad "roadmap: GET /roadmap: status $(cat "$TMP/status") location '$got', want 302 /p/roadmap-$en"
@@ -444,9 +444,9 @@ check_quizzes() {
fi
code="$(request GET "$GO/_demo/api/v1/quizzes?context=xx")"
[[ "$code" == 422 ]] || bad "quizzes: context xx: status $code, want 422"
- code="$(request GET "$NUXT/quizzes" -b "$LOCALE_COOKIE=pl")"
+ code="$(request GET "$NUXT$PL/quizzes")"
if [[ "$code" != 200 ]]; then
- bad "quizzes: GET /quizzes (pl) on Nuxt: status $code, want 200"
+ bad "quizzes: GET $PL/quizzes on Nuxt: status $code, want 200"
else
grep -qF 'Podstawy SummerCMS' "$TMP/body" || bad "quizzes: GET /quizzes with the pl cookie does not list the Polish quiz"
fi
diff --git a/seed_test.go b/seed_test.go
index 42f5806..77b7042 100644
--- a/seed_test.go
+++ b/seed_test.go
@@ -2,6 +2,7 @@ package main
import (
"bytes"
+ "encoding/json"
"os"
"path/filepath"
"strconv"
@@ -184,6 +185,36 @@ var seededContent = []string{
"golem15_pgsub_subscription_plans", "golem15_sitemap_definitions", "golem15_feedback_settings", "users",
}
+// TestSeedHTMLSitemapPaths pins the HTML sitemap's addresses: demo:seed
+// sets /sitemap and /pl/mapa-strony over the sitemap plugin's defaults, and
+// keeps addresses an editor changed.
+func TestSeedHTMLSitemapPaths(t *testing.T) {
+ d := bootDemo(t, visitorEnv, nil)
+ mustSeed(t, d)
+ paths := func() map[string]string {
+ t.Helper()
+ var raw string
+ if err := d.DB.Raw(`SELECT html_paths::text FROM golem15_sitemap_settings WHERE id = 1`).Scan(&raw).Error; err != nil {
+ t.Fatal(err)
+ }
+ out := map[string]string{}
+ if err := json.Unmarshal([]byte(raw), &out); err != nil {
+ t.Fatalf("html_paths %q: %v", raw, err)
+ }
+ return out
+ }
+ if got := paths(); got["en"] != "/sitemap" || got["pl"] != "/pl/mapa-strony" || len(got) != 2 {
+ t.Fatalf("html_paths after demo:seed = %v, want /sitemap and /pl/mapa-strony", got)
+ }
+ if err := d.DB.Exec(`UPDATE golem15_sitemap_settings SET html_paths = '{"en":"/site-map","pl":"/pl/mapa"}'::jsonb WHERE id = 1`).Error; err != nil {
+ t.Fatal(err)
+ }
+ mustSeed(t, d)
+ if got := paths(); got["en"] != "/site-map" || got["pl"] != "/pl/mapa" {
+ t.Fatalf("html_paths after a second demo:seed = %v, want the editor's addresses kept", got)
+ }
+}
+
// TestSeedLocales pins D-13 and the journal author (todo esrp4qtx): after
// demo:seed the home FAQ exists in English and Polish, the main menu has
// its entries, every demo post has a Polish title and the SummerCMS Team

View File

@@ -0,0 +1,757 @@
diff --git a/app/components/BackendCta.vue b/app/components/BackendCta.vue
index 962aab2..2823553 100644
--- a/app/components/BackendCta.vue
+++ b/app/components/BackendCta.vue
@@ -10,5 +10,5 @@ const { t } = useI18n()
</script>
<template>
- <NuxtLink class="backend-cta" to="/contact">{{ short ? t('cta.button') : t('cta.link') }}</NuxtLink>
+ <NuxtLinkLocale class="backend-cta" to="/contact">{{ short ? t('cta.button') : t('cta.link') }}</NuxtLinkLocale>
</template>
diff --git a/app/components/DemoBanner.vue b/app/components/DemoBanner.vue
index 0534b1f..24806c5 100644
--- a/app/components/DemoBanner.vue
+++ b/app/components/DemoBanner.vue
@@ -13,7 +13,7 @@ const { t } = useI18n()
<div v-if="compact" class="demo-banner demo-banner--compact" role="note">
<p>
<strong>{{ t('banner.strong') }}</strong> {{ t('banner.compact') }}
- <NuxtLink to="/">{{ t('banner.home') }}</NuxtLink>
+ <NuxtLinkLocale to="/">{{ t('banner.home') }}</NuxtLinkLocale>
</p>
</div>
<div v-else class="demo-banner" role="note">
diff --git a/app/components/Journal/AuthorCard.vue b/app/components/Journal/AuthorCard.vue
index 61554a7..4e73eb6 100644
--- a/app/components/Journal/AuthorCard.vue
+++ b/app/components/Journal/AuthorCard.vue
@@ -20,7 +20,7 @@ const href = computed(() => links.authorLink(props.author.slug))
<div class="author-card__text">
<p class="author-card__label">{{ t('journalAuthor.about') }}</p>
<p class="author-card__name">
- <NuxtLink v-if="href" :to="href">{{ name }}</NuxtLink>
+ <NuxtLinkLocale v-if="href" :to="href">{{ name }}</NuxtLinkLocale>
<template v-else>{{ name }}</template>
<span v-if="author.subtitle" class="author-card__subtitle">{{ author.subtitle }}</span>
</p>
diff --git a/app/components/Journal/PostMeta.vue b/app/components/Journal/PostMeta.vue
index c3ec9e9..0f9dff2 100644
--- a/app/components/Journal/PostMeta.vue
+++ b/app/components/Journal/PostMeta.vue
@@ -31,12 +31,12 @@ const { data: author } = await useAsyncData(`journal-author-card-${login}`, () =
</span>
<span v-if="authorName" class="journal-post-meta__author">
{{ $t('journal.post.by') }}
- <NuxtLink v-if="authorHref" :to="authorHref">{{ authorName }}</NuxtLink>
+ <NuxtLinkLocale v-if="authorHref" :to="authorHref">{{ authorName }}</NuxtLinkLocale>
<template v-else>{{ authorName }}</template>
</span>
<ul v-if="post.categories.length" class="journal-post-meta__categories">
<li v-for="cat in post.categories" :key="cat.id">
- <NuxtLink v-if="links.categoryLink(cat.slug)" :to="links.categoryLink(cat.slug)!">{{ cat.name }}</NuxtLink>
+ <NuxtLinkLocale v-if="links.categoryLink(cat.slug)" :to="links.categoryLink(cat.slug)!">{{ cat.name }}</NuxtLinkLocale>
<span v-else>{{ cat.name }}</span>
</li>
</ul>
diff --git a/app/components/LanguageSwitcher.vue b/app/components/LanguageSwitcher.vue
index 4862703..e7600ea 100644
--- a/app/components/LanguageSwitcher.vue
+++ b/app/components/LanguageSwitcher.vue
@@ -1,27 +1,22 @@
-<!-- English or Polish (D-13). setLocale writes the i18n cookie, which the server reads on the next request. -->
+<!-- English or Polish: a link to the same page in the other locale (English at /, Polish under /pl/). -->
<script setup lang="ts">
-const { t, locale, locales, setLocale } = useI18n()
-// Journal posts are localized when fetched (useJournalApi), so the page data
-// is fetched again in the new language; FAQ and menu keys carry the locale.
-async function choose(code: string) {
- await setLocale(code)
- await refreshNuxtData()
-}
+const { t, locale, locales } = useI18n()
+const switchLocalePath = useSwitchLocalePath()
const options = computed(() => locales.value.map((l) => (typeof l === 'string' ? { code: l } : { code: l.code })))
</script>
<template>
<div class="lang-switch" role="group" :aria-label="t('lang.label')">
- <button
+ <NuxtLink
v-for="l in options"
:key="l.code"
- type="button"
+ :to="switchLocalePath(l.code) || '/'"
class="lang-switch__option"
:class="{ 'lang-switch__option--active': locale === l.code }"
- :aria-pressed="locale === l.code ? 'true' : 'false'"
+ :aria-current="locale === l.code ? 'true' : undefined"
:lang="l.code"
+ :hreflang="l.code"
:title="t(`lang.${l.code}`)"
- @click="choose(l.code)"
- >{{ l.code.toUpperCase() }}</button>
+ >{{ l.code.toUpperCase() }}</NuxtLink>
</div>
</template>
diff --git a/app/components/SiteHeader.vue b/app/components/SiteHeader.vue
index 5b19e34..49fb013 100644
--- a/app/components/SiteHeader.vue
+++ b/app/components/SiteHeader.vue
@@ -8,26 +8,27 @@
<script setup lang="ts">
const { t } = useI18n()
const { loggedIn, logout } = useDemoAuth()
+const localePath = useLocalePath()
async function signOut() {
await logout()
- await navigateTo('/')
+ await navigateTo(localePath('/'))
}
</script>
<template>
<header class="site-header">
<div class="wrap site-header__inner">
- <NuxtLink to="/" class="brand" :aria-label="t('header.home')">
+ <NuxtLinkLocale to="/" class="brand" :aria-label="t('header.home')">
<img src="/sun-logo.webp" alt="" width="30" height="30" class="brand__sun">
<span>Summer<span class="brand__cms">CMS</span></span>
<span class="brand__pill">{{ t('header.pill') }}</span>
- </NuxtLink>
+ </NuxtLinkLocale>
<SiteNav :member="loggedIn" />
<div class="site-header__tools">
<LanguageSwitcher />
<button v-if="loggedIn" type="button" class="link-button" @click="signOut">{{ t('header.logout') }}</button>
- <NuxtLink v-else to="/login" class="button button--small">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale v-else to="/login" class="button button--small">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</header>
diff --git a/app/components/SiteNav.vue b/app/components/SiteNav.vue
index 83f35f6..0d55fda 100644
--- a/app/components/SiteNav.vue
+++ b/app/components/SiteNav.vue
@@ -28,7 +28,21 @@ function entryTitle(entry: { url?: string | null; title: string }) {
}
const { data: menu, error } = await useMenu('main', { locale: () => locale.value })
-const entries = computed(() => (error.value ? [] : (menu.value?.items ?? [])))
+const localePath = useLocalePath()
+
+/**
+ * A menu entry in the visitor's locale: an address on the site (a path) gets
+ * the locale's prefix (/blog is /pl/blog in Polish); an entry that already
+ * carries it, an absolute URL and an entry without an address stay. The
+ * title is looked up by the entry's own address first.
+ */
+interface NavEntry { url?: string | null; title: string; items?: NavEntry[] }
+function localizeEntry<T extends NavEntry>(entry: T): T {
+ const url = entry.url
+ const local = typeof url === 'string' && url.startsWith('/') && !url.startsWith('//') && !/^\/pl(\/|$)/.test(url) ? localePath(url) : url
+ return { ...entry, title: entryTitle(entry), url: local, items: entry.items?.map((child) => localizeEntry(child)) }
+}
+const entries = computed(() => (error.value ? [] : (menu.value?.items ?? []).map((entry) => localizeEntry(entry))))
/**
* The feature links after the menu entries; the last three for members only.
@@ -37,14 +51,14 @@ const entries = computed(() => (error.value ? [] : (menu.value?.items ?? [])))
*/
const links = computed(() => {
const out = [
- { to: '/chat', label: t('header.chat'), mine: false },
- { to: '/forum', label: t('header.forum'), mine: false },
+ { to: localePath('/chat'), label: t('header.chat'), mine: false },
+ { to: localePath('/forum'), label: t('header.forum'), mine: false },
]
if (props.member) {
out.push(
- { to: '/presentations', label: t('header.mine'), mine: true },
- { to: '/friends', label: t('header.friends'), mine: true },
- { to: '/account/security', label: t('header.security'), mine: true },
+ { to: localePath('/presentations'), label: t('header.mine'), mine: true },
+ { to: localePath('/friends'), label: t('header.friends'), mine: true },
+ { to: localePath('/account/security'), label: t('header.security'), mine: true },
)
}
return out
@@ -126,15 +140,15 @@ onBeforeUnmount(() => document.removeEventListener('pointerdown', onPointerDown)
submenu-label="Show submenu: :title"
@update:open="(value: boolean) => setOpen(i, value)"
>
- <template #item="{ entry: e }">{{ entryTitle(e) }}</template>
+ <template #item="{ entry: e }">{{ e.title }}</template>
</MenuNavItem>
<li v-for="link in links" :key="link.to" class="menu-nav__item" data-depth="0">
- <NuxtLink
+ <NuxtLinkLocale
:to="link.to"
:aria-current="linkActive(link.to) ? 'page' : undefined"
class="menu-nav__link"
:class="{ 'site-header__mine': link.mine, 'menu-nav__link--active': linkActive(link.to) }"
- >{{ link.label }}</NuxtLink>
+ >{{ link.label }}</NuxtLinkLocale>
</li>
</ul>
</nav>
diff --git a/app/components/TourCard.vue b/app/components/TourCard.vue
index 9a44cbd..a4a8614 100644
--- a/app/components/TourCard.vue
+++ b/app/components/TourCard.vue
@@ -40,7 +40,7 @@ const ICONS: Record<string, string> = {
</span>
<h3 class="tour-card__title">{{ title }}</h3>
<p class="tour-card__text">{{ text }}</p>
- <NuxtLink v-if="available" :to="to" class="tour-card__link">{{ t('tour.try') }} <span aria-hidden="true">→</span></NuxtLink>
+ <NuxtLinkLocale v-if="available" :to="to" class="tour-card__link">{{ t('tour.try') }} <span aria-hidden="true">→</span></NuxtLinkLocale>
<p v-else class="tour-card__soon">{{ t('tour.soon') }}</p>
</article>
</template>
diff --git a/app/components/deck/DeckForm.vue b/app/components/deck/DeckForm.vue
index a1355a1..2021c84 100644
--- a/app/components/deck/DeckForm.vue
+++ b/app/components/deck/DeckForm.vue
@@ -12,6 +12,7 @@ import { DECK_THEMES, deckApi, type DeckSlideInput } from '~/lib/api/demo'
import { parseSourceTodo, slideBodyHTML, slideSayHTML, slugify, sourceTodo } from '~/lib/deckSource'
import { formError } from '~/lib/forms'
import { renderMarkdown } from '~/lib/markdown'
+const localePath = useLocalePath()
const props = defineProps<{ slug?: string }>()
@@ -97,7 +98,7 @@ async function load(value: string) {
if (!slides.value.length) slides.value = [row()]
} catch (e) {
if (e instanceof ApiError && e.status === 404) {
- await navigateTo({ path: '/presentations', query: { denied: '1' } }, { replace: true })
+ await navigateTo(localePath({ path: '/presentations', query: { denied: '1' } }), { replace: true })
return
}
error.value = e instanceof ApiError && e.message ? e.message : t('auth.genericError')
@@ -117,7 +118,7 @@ async function save() {
await deckApi.create({ title: title.value, slug: slug.value, theme: theme.value, slides: payloadSlides() })
}
toast.show(t('deckForm.saved'))
- await navigateTo('/presentations')
+ await navigateTo(localePath('/presentations'))
} catch (e) {
if (e instanceof ApiError && e.status === 409) {
fields.value = { slug: t('deckForm.slugTaken') }
@@ -142,7 +143,7 @@ if (props.slug) void load(props.slug)
<p class="eyebrow">{{ t('mine.eyebrow') }}</p>
<div class="page-head__row">
<h1>{{ editing ? t('deckForm.editTitle') : t('deckForm.newTitle') }}</h1>
- <NuxtLink to="/presentations" class="button button--small button--ghost">{{ t('deckForm.back') }}</NuxtLink>
+ <NuxtLinkLocale to="/presentations" class="button button--small button--ghost">{{ t('deckForm.back') }}</NuxtLinkLocale>
</div>
<p>{{ t('deckForm.lead') }}</p>
</header>
diff --git a/app/components/remote/RemoteDrawer.vue b/app/components/remote/RemoteDrawer.vue
index a96e7c1..11a14b9 100644
--- a/app/components/remote/RemoteDrawer.vue
+++ b/app/components/remote/RemoteDrawer.vue
@@ -190,7 +190,7 @@ watch(
</li>
</ol>
<footer class="list-foot">
- <NuxtLink class="back-link" to="/presentations">{{ t('remote.backToMine') }}</NuxtLink>
+ <NuxtLinkLocale class="back-link" to="/presentations">{{ t('remote.backToMine') }}</NuxtLinkLocale>
<p v-if="wakeLockMissing" class="hint">{{ t('remote.noWakeLock') }}</p>
</footer>
</template>
diff --git a/app/composables/useDeckSession.ts b/app/composables/useDeckSession.ts
index 5efdd3a..540d6ec 100644
--- a/app/composables/useDeckSession.ts
+++ b/app/composables/useDeckSession.ts
@@ -9,11 +9,12 @@ import { DEMO_TOKEN_COOKIE } from '~/utils/authCookie'
export function useDeckSession() {
const route = useRoute()
+ const localePath = useLocalePath()
const token = useCookie<string | null>(DEMO_TOKEN_COOKIE)
const loggedIn = computed(() => !!token.value)
function toLogin() {
- return navigateTo({ path: '/login', query: { next: route.fullPath } }, { replace: true })
+ return navigateTo(localePath({ path: '/login', query: { next: route.fullPath } }), { replace: true })
}
// The API client runs in the browser only; its hook is module state.
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index 3e4bcb0..2d9ebc9 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -6,11 +6,14 @@ useHead({ htmlAttrs: { lang: locale } })
// users on every page but the chat itself and the full-screen decks.
const { loggedIn } = useDemoAuth()
const route = useRoute()
+const localePath = useLocalePath()
+// The page's path without the Polish prefix (/pl/chat is /chat).
+const barePath = computed(() => route.path.replace(/^\/pl(?=\/|$)/, '') || '/')
// The incoming-call prompt (vue-chatvideo-layer) for logged-in users: it hears
// the ring through the chat store, which the floating panel or /chat runs.
-const callPath = (id: number | string) => `/call/${id}`
+const callPath = (id: number | string) => localePath(`/call/${id}`)
const floatingChat = computed(
- () => loggedIn.value && route.path !== '/chat' && !route.path.startsWith('/p/') && !route.path.startsWith('/presentations/'),
+ () => loggedIn.value && barePath.value !== '/chat' && !barePath.value.startsWith('/p/') && !barePath.value.startsWith('/presentations/'),
)
</script>
diff --git a/app/pages/account/security.vue b/app/pages/account/security.vue
index d09f776..d3ce5c9 100644
--- a/app/pages/account/security.vue
+++ b/app/pages/account/security.vue
@@ -6,6 +6,7 @@
-->
<script setup lang="ts">
import { isTotpCode, svgDataUrl, type TotpSetup, type TwoFactorStatus } from '~/lib/twoFactor'
+const localePath = useLocalePath()
const { t } = useI18n()
// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
@@ -104,7 +105,7 @@ async function turnOff() {
</header>
<p v-if="!loggedIn" class="notice notice--muted">
- <NuxtLink to="/login?next=/account/security">{{ t('security.loginFirst') }}</NuxtLink>
+ <NuxtLinkLocale :to="{ path: '/login', query: { next: localePath('/account/security') } }">{{ t('security.loginFirst') }}</NuxtLinkLocale>
</p>
<div v-else class="panel">
@@ -143,6 +144,6 @@ async function turnOff() {
</div>
<!-- The account area links the friends page (D-15; the demo has no profile page). -->
- <p v-if="loggedIn" class="muted"><NuxtLink to="/friends">{{ t('security.friendsLink') }}</NuxtLink></p>
+ <p v-if="loggedIn" class="muted"><NuxtLinkLocale to="/friends">{{ t('security.friendsLink') }}</NuxtLinkLocale></p>
</div>
</template>
diff --git a/app/pages/call/[conversation].vue b/app/pages/call/[conversation].vue
index 7db746e..0410e25 100644
--- a/app/pages/call/[conversation].vue
+++ b/app/pages/call/[conversation].vue
@@ -36,8 +36,8 @@ const loginLink = computed(() => ({ path: '/login', query: { next: route.path }
<div v-else class="card card--static call-prompt">
<p>{{ t('call.anonymous') }}</p>
<div class="deck-card__actions">
- <NuxtLink class="button" :to="registerLink">{{ t('call.registerToCall') }}</NuxtLink>
- <NuxtLink class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button" :to="registerLink">{{ t('call.registerToCall') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</div>
diff --git a/app/pages/chat.vue b/app/pages/chat.vue
index c125978..1825f01 100644
--- a/app/pages/chat.vue
+++ b/app/pages/chat.vue
@@ -33,15 +33,15 @@ const startCallPath = (id: number | string) => `/call/${id}?start=1`
<ChatvideoCallButton :conversation-id="conversation.id" :call-path="startCallPath" />
</template>
<template #sidebar-footer>
- <NuxtLink to="/friends" class="chat-sidebar-link">{{ t('chat.friendsLink') }}</NuxtLink>
+ <NuxtLinkLocale to="/friends" class="chat-sidebar-link">{{ t('chat.friendsLink') }}</NuxtLinkLocale>
</template>
</ChatPage>
</ClientOnly>
<div v-else class="card card--static chat-prompt">
<p>{{ t('chat.anonymous') }}</p>
<div class="deck-card__actions">
- <NuxtLink class="button" :to="registerLink">{{ t('chat.registerToChat') }}</NuxtLink>
- <NuxtLink class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button" :to="registerLink">{{ t('chat.registerToChat') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</div>
diff --git a/app/pages/connect.vue b/app/pages/connect.vue
index 2c5f540..2434fe1 100644
--- a/app/pages/connect.vue
+++ b/app/pages/connect.vue
@@ -8,6 +8,7 @@
// the admin shown; when the link changed meanwhile the server answers 409
// and the page loads the request again.
import { BACKEND_LINK_CHANGED, consentDecisionBody } from '~/lib/consent'
+const localePath = useLocalePath()
type ConsentRequest = {
request_id: string
@@ -51,7 +52,7 @@ async function load() {
return
}
if (!loggedIn.value) {
- await navigateTo('/login?next=' + encodeURIComponent('/connect?request=' + requestId.value))
+ await navigateTo(localePath({ path: '/login', query: { next: localePath({ path: '/connect', query: { request: requestId.value } }) } }))
return
}
try {
@@ -60,7 +61,7 @@ async function load() {
} catch (e) {
const status = statusOf(e)
if (status === 401) {
- await navigateTo('/login?next=' + encodeURIComponent('/connect?request=' + requestId.value))
+ await navigateTo(localePath({ path: '/login', query: { next: localePath({ path: '/connect', query: { request: requestId.value } }) } }))
return
}
state.value = status === 404 || status === 410 ? 'expired' : 'error'
diff --git a/app/pages/contact.vue b/app/pages/contact.vue
index 0ae15b8..e608133 100644
--- a/app/pages/contact.vue
+++ b/app/pages/contact.vue
@@ -60,7 +60,7 @@ async function submit() {
<h1>{{ t('contact.heading') }}</h1>
<div v-if="sent">
<p class="notice" role="status">{{ t('contact.thanks') }}</p>
- <NuxtLink to="/" class="button">{{ t('contact.backHome') }}</NuxtLink>
+ <NuxtLinkLocale to="/" class="button">{{ t('contact.backHome') }}</NuxtLinkLocale>
</div>
<form v-else class="form" @submit.prevent="submit">
<p v-if="error" class="form__error" role="alert">{{ error }}</p>
diff --git a/app/pages/forum/index.vue b/app/pages/forum/index.vue
index f0b2536..5506d61 100644
--- a/app/pages/forum/index.vue
+++ b/app/pages/forum/index.vue
@@ -31,8 +31,8 @@ const threadPath = (id: number) => `/forum/t/${id}`
<div v-else class="card card--static forum-prompt">
<p>{{ t('forum.anonymous') }}</p>
<div class="deck-card__actions">
- <NuxtLink class="button" :to="registerLink">{{ t('forum.registerToJoin') }}</NuxtLink>
- <NuxtLink class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button" :to="registerLink">{{ t('forum.registerToJoin') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</div>
diff --git a/app/pages/forum/t/[id].vue b/app/pages/forum/t/[id].vue
index 8c5a66f..786a0d7 100644
--- a/app/pages/forum/t/[id].vue
+++ b/app/pages/forum/t/[id].vue
@@ -49,8 +49,8 @@ onMounted(async () => {
<div v-else class="card card--static forum-prompt">
<p>{{ t('forum.anonymous') }}</p>
<div class="deck-card__actions">
- <NuxtLink class="button" :to="registerLink">{{ t('forum.registerToJoin') }}</NuxtLink>
- <NuxtLink class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button" :to="registerLink">{{ t('forum.registerToJoin') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</div>
diff --git a/app/pages/friends.vue b/app/pages/friends.vue
index 11d9bd9..0a452fe 100644
--- a/app/pages/friends.vue
+++ b/app/pages/friends.vue
@@ -30,8 +30,8 @@ const loginLink = { path: '/login', query: { next: '/friends' } }
<div v-else class="card card--static friends-prompt">
<p>{{ t('friends.anonymous') }}</p>
<div class="deck-card__actions">
- <NuxtLink class="button" :to="registerLink">{{ t('friends.registerToJoin') }}</NuxtLink>
- <NuxtLink class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button" :to="registerLink">{{ t('friends.registerToJoin') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--ghost" :to="loginLink">{{ t('header.login') }}</NuxtLinkLocale>
</div>
</div>
</div>
diff --git a/app/pages/link-admin.vue b/app/pages/link-admin.vue
index e4205fb..1c5cb05 100644
--- a/app/pages/link-admin.vue
+++ b/app/pages/link-admin.vue
@@ -157,7 +157,7 @@ onMounted(load)
</p>
<button type="button" class="button" :disabled="busy" @click="confirm">{{ t('linkAdmin.confirm') }}</button>
</template>
- <NuxtLink v-else class="button" :to="signIn">{{ t('linkAdmin.signIn') }}</NuxtLink>
+ <NuxtLinkLocale v-else class="button" :to="signIn">{{ t('linkAdmin.signIn') }}</NuxtLinkLocale>
<p v-if="message" class="form__error" role="alert">{{ message }}</p>
</div>
</template>
diff --git a/app/pages/login.vue b/app/pages/login.vue
index fba22a4..6aea037 100644
--- a/app/pages/login.vue
+++ b/app/pages/login.vue
@@ -6,6 +6,7 @@ const { t } = useI18n()
definePageMeta({ seo: { robots: 'noindex, nofollow' } })
useSeoMeta({ title: () => t('auth.login.title') })
const route = useRoute()
+const localePath = useLocalePath()
const { loggedIn, login, verifyChallenge, recoverChallenge, logout } = useDemoAuth()
const email = ref('')
const password = ref('')
@@ -24,7 +25,7 @@ const appAvailable = computed(() => !!challenge.value?.available_methods.include
function nextPath() {
const next = route.query.next
- return typeof next === 'string' && next.startsWith('/') && !next.startsWith('//') ? next : '/subscriptions'
+ return typeof next === 'string' && next.startsWith('/') && !next.startsWith('//') ? next : localePath('/subscriptions')
}
async function submit() {
@@ -108,7 +109,7 @@ function startOver() {
<TurnstileWidget ref="widget" @token="turnstileToken = $event" />
<button class="button" :disabled="busy || !turnstileToken">{{ busy ? t('auth.login.busy') : t('auth.login.submit') }}</button>
<p v-if="error" class="form__error" role="alert">{{ error }}</p>
- <p class="muted">{{ t('auth.login.noAccount') }} <NuxtLink to="/register">{{ t('auth.login.createOne') }}</NuxtLink></p>
+ <p class="muted">{{ t('auth.login.noAccount') }} <NuxtLinkLocale to="/register">{{ t('auth.login.createOne') }}</NuxtLinkLocale></p>
</form>
</div>
<aside class="card card--static login__about">
diff --git a/app/pages/presentations/[slug]/index.vue b/app/pages/presentations/[slug]/index.vue
index fc70adb..65696fa 100644
--- a/app/pages/presentations/[slug]/index.vue
+++ b/app/pages/presentations/[slug]/index.vue
@@ -35,6 +35,7 @@ import {
import { forgetPilot, rememberPilot } from '~/lib/pilot'
import { openChannel, type ChannelHandle } from '~/lib/realtime'
import speakerCss from '~/assets/deck/deck-speaker.css?inline'
+const localePath = useLocalePath()
const SpeakerTools = defineAsyncComponent(() => import('~/components/deck/SpeakerTools.vue'))
@@ -380,7 +381,7 @@ function syncRemote() {
function closeTab() {
window.close()
- void navigateTo('/presentations', { replace: true })
+ void navigateTo(localePath('/presentations'), { replace: true })
}
function clearTimer() {
@@ -473,7 +474,7 @@ async function load(slug: string) {
clearTimer()
if (err instanceof ApiError && err.status === 404) {
forgetPilot(slug)
- await navigateTo({ path: '/presentations', query: { denied: '1' } }, { replace: true })
+ await navigateTo(localePath({ path: '/presentations', query: { denied: '1' } }), { replace: true })
return
}
if (err instanceof ApiError && err.status === 401) return
diff --git a/app/pages/presentations/[slug]/pilot.vue b/app/pages/presentations/[slug]/pilot.vue
index a4ed87e..0af4493 100644
--- a/app/pages/presentations/[slug]/pilot.vue
+++ b/app/pages/presentations/[slug]/pilot.vue
@@ -34,6 +34,7 @@ import {
} from '~/lib/deck/remote'
import { forgetPilot, rememberPilot } from '~/lib/pilot'
import { openChannel, type ChannelHandle, type ConnectionState } from '~/lib/realtime'
+const localePath = useLocalePath()
definePageMeta({ layout: false })
@@ -444,7 +445,7 @@ async function load(slug: string) {
clearTimer()
if (err instanceof ApiError && err.status === 404) {
forgetPilot(slug)
- await navigateTo({ path: '/presentations', query: { denied: '1' } }, { replace: true })
+ await navigateTo(localePath({ path: '/presentations', query: { denied: '1' } }), { replace: true })
return
}
if (err instanceof ApiError && err.status === 401) return
diff --git a/app/pages/presentations/index.vue b/app/pages/presentations/index.vue
index 94c353a..1f4416c 100644
--- a/app/pages/presentations/index.vue
+++ b/app/pages/presentations/index.vue
@@ -67,7 +67,7 @@ onMounted(() => {
<p class="eyebrow">{{ t('mine.eyebrow') }}</p>
<div class="page-head__row">
<h1>{{ t('mine.title') }}</h1>
- <NuxtLink to="/presentations/new" class="button">{{ t('mine.newDeck') }}</NuxtLink>
+ <NuxtLinkLocale to="/presentations/new" class="button">{{ t('mine.newDeck') }}</NuxtLinkLocale>
</div>
<p>{{ t('mine.lead') }}</p>
<p class="notice notice--muted">{{ t('mine.privateNote') }}</p>
@@ -103,9 +103,9 @@ onMounted(() => {
{{ t('mine.pilot') }}
<span class="sr-only">{{ t('mine.onPhone') }}</span>
</a>
- <NuxtLink v-if="!card.is_published" class="button button--small button--ghost" :to="editHref(card.slug)">
+ <NuxtLinkLocale v-if="!card.is_published" class="button button--small button--ghost" :to="editHref(card.slug)">
{{ t('mine.edit') }}
- </NuxtLink>
+ </NuxtLinkLocale>
<a
v-if="card.is_published && card.public_path"
class="button button--small button--ghost"
diff --git a/app/pages/quizzes/[slug].vue b/app/pages/quizzes/[slug].vue
index 0170ae2..f319dbe 100644
--- a/app/pages/quizzes/[slug].vue
+++ b/app/pages/quizzes/[slug].vue
@@ -171,7 +171,7 @@ const score = (a: { score_points: number; max_points: number }) => `${Math.round
<p class="eyebrow">{{ t('quiz.eyebrow') }}</p>
<div class="page-head__row">
<h1>{{ quiz?.title ?? t('quiz.listTitle') }}</h1>
- <NuxtLink to="/quizzes" class="button button--small button--ghost">{{ t('quiz.backToList') }}</NuxtLink>
+ <NuxtLinkLocale to="/quizzes" class="button button--small button--ghost">{{ t('quiz.backToList') }}</NuxtLinkLocale>
</div>
<p v-if="quiz?.description">{{ quiz.description }}</p>
</header>
@@ -248,7 +248,7 @@ const score = (a: { score_points: number; max_points: number }) => `${Math.round
<p v-if="actionError" class="form__error" role="alert">{{ actionError }}</p>
<div class="quiz-actions">
<button class="button" type="button" :disabled="busy" @click="start">{{ t('quiz.again') }}</button>
- <NuxtLink to="/quizzes" class="button button--ghost">{{ t('quiz.backToList') }}</NuxtLink>
+ <NuxtLinkLocale to="/quizzes" class="button button--ghost">{{ t('quiz.backToList') }}</NuxtLinkLocale>
</div>
</section>
diff --git a/app/pages/quizzes/index.vue b/app/pages/quizzes/index.vue
index df5e639..a086741 100644
--- a/app/pages/quizzes/index.vue
+++ b/app/pages/quizzes/index.vue
@@ -63,10 +63,10 @@ const registerLink = (slug: string) => ({ path: '/register', query: { next: quiz
<p class="deck-card__meta">{{ t('quiz.questions', { n: q.question_count }) }}</p>
</div>
<div class="deck-card__actions">
- <NuxtLink v-if="loggedIn" class="button button--small" :to="quizPath(q.slug)">{{ t('quiz.start') }}</NuxtLink>
+ <NuxtLinkLocale v-if="loggedIn" class="button button--small" :to="quizPath(q.slug)">{{ t('quiz.start') }}</NuxtLinkLocale>
<template v-else>
- <NuxtLink class="button button--small" :to="registerLink(q.slug)">{{ t('quiz.registerToTake') }}</NuxtLink>
- <NuxtLink class="button button--small button--ghost" :to="{ path: '/login', query: { next: quizPath(q.slug) } }">{{ t('header.login') }}</NuxtLink>
+ <NuxtLinkLocale class="button button--small" :to="registerLink(q.slug)">{{ t('quiz.registerToTake') }}</NuxtLinkLocale>
+ <NuxtLinkLocale class="button button--small button--ghost" :to="{ path: '/login', query: { next: quizPath(q.slug) } }">{{ t('header.login') }}</NuxtLinkLocale>
</template>
</div>
</article>
diff --git a/app/pages/register.vue b/app/pages/register.vue
index fc5836c..a4bb09d 100644
--- a/app/pages/register.vue
+++ b/app/pages/register.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+const localePath = useLocalePath()
// Self-registration (D-05), ported from bm's RegisterView: the user plugin's
// POST /_user/api/v1/register behind Cloudflare Turnstile (D-07). No field is
// pre-filled and there is no e-mail verification step.
@@ -41,7 +42,7 @@ async function submit() {
},
turnstileToken.value,
)
- if (res.signedIn) await navigateTo(next.value || '/subscriptions')
+ if (res.signedIn) await navigateTo(next.value || localePath('/subscriptions'))
else done.value = res.message || t('auth.register.done')
} catch (e) {
error.value = authErrors(e, t, t('auth.genericError'))
@@ -57,10 +58,10 @@ async function submit() {
<div class="login">
<div class="panel">
<h1>{{ t('auth.register.title') }}</h1>
- <p v-if="loggedIn">{{ t('auth.loggedIn') }} <NuxtLink to="/subscriptions">{{ t('auth.seePlans') }}</NuxtLink></p>
+ <p v-if="loggedIn">{{ t('auth.loggedIn') }} <NuxtLinkLocale to="/subscriptions">{{ t('auth.seePlans') }}</NuxtLinkLocale></p>
<div v-else-if="done">
<p class="notice" role="status">{{ done }}</p>
- <NuxtLink :to="loginLink" class="button">{{ t('auth.login.submit') }}</NuxtLink>
+ <NuxtLinkLocale :to="loginLink" class="button">{{ t('auth.login.submit') }}</NuxtLinkLocale>
</div>
<form v-else class="form" novalidate @submit.prevent="submit">
<p v-if="error?.message" class="form__error" role="alert">{{ error.message }}</p>
@@ -75,7 +76,7 @@ async function submit() {
<label>{{ t('auth.register.confirmation') }} <input v-model="confirmation" type="password" autocomplete="new-password" required></label>
<TurnstileWidget ref="widget" @token="turnstileToken = $event" />
<button class="button" :disabled="busy || !turnstileToken">{{ busy ? t('auth.register.busy') : t('auth.register.submit') }}</button>
- <p class="muted">{{ t('auth.register.haveAccount') }} <NuxtLink :to="loginLink">{{ t('auth.login.submit') }}</NuxtLink></p>
+ <p class="muted">{{ t('auth.register.haveAccount') }} <NuxtLinkLocale :to="loginLink">{{ t('auth.login.submit') }}</NuxtLinkLocale></p>
</form>
</div>
<aside class="card card--static login__about">
diff --git a/app/pages/roadmap.vue b/app/pages/roadmap.vue
index 5b83e96..8c70b8d 100644
--- a/app/pages/roadmap.vue
+++ b/app/pages/roadmap.vue
@@ -8,6 +8,7 @@
-->
<script setup lang="ts">
import { DEMO_API, fetchRoadmap, roadmapPath } from '~/lib/api/demo'
+const localePath = useLocalePath()
const { t, locale } = useI18n()
// Only a redirect to the roadmap deck (/p/..., declared noindex), so the
@@ -19,7 +20,7 @@ const base = import.meta.server ? useRuntimeConfig().demo.apiBase : DEMO_API
const { data: deck, error } = await useAsyncData(`roadmap-${locale.value}`, () => fetchRoadmap(base, locale.value))
if (deck.value) {
- await navigateTo(roadmapPath(deck.value), { redirectCode: 302, replace: true })
+ await navigateTo(localePath(roadmapPath(deck.value)), { redirectCode: 302, replace: true })
}
</script>
@@ -31,6 +32,6 @@ if (deck.value) {
<p v-if="error" class="notice notice--muted">{{ t('roadmap.unavailable') }}</p>
<p v-else>{{ t('roadmap.opening') }}</p>
</header>
- <NuxtLink to="/" class="button button--ghost">{{ t('roadmap.back') }}</NuxtLink>
+ <NuxtLinkLocale to="/" class="button button--ghost">{{ t('roadmap.back') }}</NuxtLinkLocale>
</div>
</template>
diff --git a/app/pages/subscriptions.vue b/app/pages/subscriptions.vue
index 9a49ea2..c277f1b 100644
--- a/app/pages/subscriptions.vue
+++ b/app/pages/subscriptions.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+const localePath = useLocalePath()
const { t } = useI18n()
// A signed-in page: vue-seo-layer marks it noindex, nofollow from this meta.
definePageMeta({ requiresAuth: true })
@@ -22,9 +23,9 @@ const notice = computed(() => {
<p v-if="notice" class="notice">{{ notice }}</p>
<p v-if="!loggedIn" class="notice notice--muted">
- <NuxtLink to="/login?next=/subscriptions">{{ t('subscriptions.loginFirst') }}</NuxtLink>
+ <NuxtLinkLocale :to="{ path: '/login', query: { next: localePath('/subscriptions') } }">{{ t('subscriptions.loginFirst') }}</NuxtLinkLocale>
{{ t('subscriptions.or') }}
- <NuxtLink to="/register">{{ t('subscriptions.register') }}</NuxtLink>
+ <NuxtLinkLocale to="/register">{{ t('subscriptions.register') }}</NuxtLinkLocale>
{{ t('subscriptions.toSubscribe') }}
</p>
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 6cb0c97..746cb0d 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -74,12 +74,14 @@ export default defineNuxtConfig({
sort: 'published_at desc',
},
- // English and Polish (D-13). No path prefix, so the layers' routes keep
- // their paths: the choice lives in a cookie that the server reads, so SSR
- // renders the chosen language. A first visit without the cookie follows
- // the browser's language on the home page.
+ // English at / and Polish under /pl/ (prefix_except_default; 2026-11-04,
+ // replacing the cookie-only no_prefix of D-13): the Journal, sitemap and
+ // SEO plugins give every non-default locale the /<code> prefix, so the
+ // hreflang links and the sitemap addresses they publish are pages here.
+ // The cookie keeps the last choice; a first visit to / follows the
+ // browser's language.
i18n: {
- strategy: 'no_prefix',
+ strategy: 'prefix_except_default',
defaultLocale: 'en',
locales: [
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
@@ -98,10 +100,12 @@ export default defineNuxtConfig({
// layer sends them X-Robots-Tag: noindex, nofollow and its build guard
// (D-70) accepts them; any other browser-only route fails the build. Auth
// and signed-in pages mark themselves in their page meta (seo.robots,
- // requiresAuth). The HTML sitemap pages keep the layer's paths
- // (/sitemap, /mapa-strony), which the SEO plugin's site answer names.
+ // requiresAuth). The HTML sitemap pages are /sitemap and /pl/mapa-strony,
+ // the paths Settings › Sitemaps names (DEPLOY.md), so the SEO plugin's site
+ // answer and the build agree.
seo: {
- noindexRoutes: ['/p/**', '/presentations/**'],
+ noindexRoutes: ['/p/**', '/presentations/**', '/pl/p/**', '/pl/presentations/**'],
+ htmlSitemap: { paths: { en: '/sitemap', pl: '/pl/mapa-strony' } },
},
runtimeConfig: {
@@ -164,6 +168,8 @@ export default defineNuxtConfig({
routeRules: {
'/p/**': { ssr: false },
'/presentations/**': { ssr: false },
+ '/pl/p/**': { ssr: false },
+ '/pl/presentations/**': { ssr: false },
},
// tokens.css is summercms.io's (copied as is); site.css holds the demo's rules.

View File

@@ -0,0 +1,595 @@
---
phase: 33-seo-output-audit-and-content
plan: 15
type: execute
wave: 10
depends_on: ["33-13"]
gap_closure: true
files_modified:
- ../sm-sitemap-plugin/contract/contract.go
- ../sm-sitemap-plugin/classes/listing.go
- ../sm-sitemap-plugin/plugin.go
- ../sm-sitemap-plugin/classes/lastmod.go
- ../sm-sitemap-plugin/classes/rebuild.go
- ../sm-sitemap-plugin/classes/indexnow.go
- ../sm-sitemap-plugin/classes/typesettings.go
- ../sm-sitemap-plugin/models/url.go
- ../sm-sitemap-plugin/models/legacy.go
- ../sm-sitemap-plugin/models/legacy_test.go
- ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go
- ../sm-sitemap-plugin/updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go
- ../sm-sitemap-plugin/extensions_settings.go
- ../sm-sitemap-plugin/controllers/api/settings.go
- ../sm-sitemap-plugin/lang/en/lang.yaml
- ../sm-sitemap-plugin/lang/pl/lang.yaml
- ../sm-sitemap-plugin/README.md
- ../sm-sitemap-plugin/content_fixture_test.go
- ../sm-sitemap-plugin/filter_fixture_test.go
- ../sm-sitemap-plugin/sitemap_extras_test.go
- ../sm-sitemap-plugin/sitemap_index_test.go
- ../sm-sitemap-plugin/classes/lastmod_test.go
- ../sm-seo-plugin/models/noindex_path.go
- ../sm-seo-plugin/models/crawl.go
- ../sm-seo-plugin/updates/202611040001_create_golem15_seo_noindex_paths.go
- ../sm-seo-plugin/updates/202611040002_add_golem15_seo_crawls_heartbeat.go
- ../sm-seo-plugin/classes/registry.go
- ../sm-seo-plugin/classes/sitemap_filter.go
- ../sm-seo-plugin/classes/linkgraph.go
- ../sm-seo-plugin/classes/crawl/checks.go
- ../sm-seo-plugin/classes/crawl/fix.go
- ../sm-seo-plugin/classes/crawl/job.go
- ../sm-seo-plugin/classes/crawl/store.go
- ../sm-seo-plugin/classes/crawl/actions.go
- ../sm-seo-plugin/classes/crawl/crawler.go
- ../sm-seo-plugin/classes/crawl/fetch.go
- ../sm-seo-plugin/classes/crawl/compare.go
- ../sm-seo-plugin/classes/crawl/render.go
- ../sm-seo-plugin/classes/crawl/render_chrome.go
- ../sm-seo-plugin/jobs.go
- ../sm-seo-plugin/controllers/api/registry.go
- ../sm-seo-plugin/controllers/api/crawls.go
- ../sm-seo-plugin/controllers/crawls.go
- ../sm-seo-plugin/mcp.go
- ../sm-seo-plugin/lang/en/lang.yaml
- ../sm-seo-plugin/lang/pl/lang.yaml
- ../sm-seo-plugin/README.md
- ../sm-seo-plugin/sitemap_filter_test.go
- ../sm-seo-plugin/registry_test.go
- ../sm-seo-plugin/crawler_test.go
- ../sm-seo-plugin/crawl_lifecycle_test.go
- ../sm-seo-plugin/classes/alternates_test.go
- ../sm-seo-plugin/classes/crawl/checks_test.go
- ../sm-seo-plugin/classes/crawl/render_test.go
- ../sm-seo-plugin/classes/crawl/fetch_test.go
- ../sm-journal-plugin/classes/image_variants.go
- ../sm-journal-plugin/classes/headings.go
- ../sm-journal-plugin/classes/image_alt.go
- ../sm-journal-plugin/classes/content_descriptors.go
- ../sm-journal-plugin/classes/menu_item_types.go
- ../sm-journal-plugin/console/fix_headings.go
- ../sm-journal-plugin/controllers/api/maintenance.go
- ../sm-journal-plugin/mcp.go
- ../sm-journal-plugin/README.md
- ../sm-journal-plugin/classes/headings_test.go
- ../sm-journal-plugin/classes/image_alt_test.go
- ../sm-journal-plugin/headings_test.go
- ../sm-journal-plugin/related_media_test.go
- ../sm-journal-plugin/image_variants_cli_test.go
- ../sm-journal-plugin/content_descriptors_test.go
- modules/lagoon/README.md
- docs/database/attachments.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-journal-plugin-v0.4.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-seo-plugin-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-sitemap-plugin-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-summercms-v0.6.1.md
- .planning/phases/33-seo-output-audit-and-content/33-release-log.md
- .planning/phases/33-seo-output-audit-and-content/deferred-items.md
autonomous: true
requirements: [SC-1, SC-2, SC-3, D-14, D-24, D-30, D-31, D-32, D-33, D-34, D-50, D-55, D-57, D-85, D-95, D-10]
estimate:
tokens: 210000
raw_tokens: 210000
tasks: 6
confidence: low
must_haves:
truths:
- "G1 (D-24, D-33, D-95, SC-1): POST /_seo/api/v1/registry/routes accepts the optional noindex array of the gap-2 contract below; the stored set is replaced when the key is present (also []), unchanged when it is absent; the SEO sitemap filter leaves every candidate whose normalized path is in the set out of the XML and HTML sitemaps with reason noindex; a changed set requests one debounced sitemap rebuild through the new contract.Rebuilder"
- "G1 (SC-3, D-14): a sitemap_noindex finding on a listed address without a CMS record names sitemap_update_settings (removing the Additional address) while the sitemap plugin is mounted, and fix: code otherwise; one on a CMS record keeps seo_set_url_seo"
- "L3 CR-01 (D-14): a crawl whose job context is cancelled or reaches the job timeout stores the pages, links and issues fetched so far through a context detached from the job with its own 10-minute bound, and ends cancelled (a requested cancel) or failed with a time-limit error (the timeout), with finished_at set; a LoadLimits failure in finish falls back to the default limits; a fetch cut short by the cancellation is recorded as canceled, not network_error"
- "L3 CR-01: a running crawl whose heartbeat (written every minute by its job) is older than 10 minutes is ended (cancelled when a cancel was requested, else failed with a no-heartbeat error) before a crawl starts or crawls are deleted, so a row whose job is gone never stays running"
- "L3 WR-01: cancelling a running crawl records the request (cancel_requested_at, cancelled_by) and leaves the row running until its job stops and writes cancelled; until then Start answers 409 crawls.already_running, DeleteCrawls refuses it and Prune keeps it"
- "L3 WR-06: chromeRenderer.Render bounds opening the tab and rendering the page with one deadline (TabOpenTimeout 5 s plus RenderTimeout 20 s), so the crawl's render lock is never held longer than that"
- "L3 WR-03: Fetcher.Allowed and Fetcher.Key and the Chrome request guard allowRequest accept a URL only on the site's effective port (explicit, else 443 for https and 80 for http); a link to https://<site>:8443/x is neither fetched nor reported as https://<site>/x"
- "L3 WR-04: crawl keys, the rendered comparison, CMS lookups (Lookup, Keyphrases) and the link graph (LinksOfURL, LinksOfRecord) use one decoded path form; a non-ASCII address matches its CMS record and its stored crawl links; Fetcher.Absolute escapes the path for the request; a path that does not decode to valid UTF-8 text without NUL keeps its escaped form"
- "L2 WR-01 (D-31): IndexNow is notified of a record deleted through pact.RecordDeleted (its listed addresses as removed) and of a content edit through pact.RecordSaved that moves lastmod (its listed addresses as changed): the listeners mark the rows indexnow_pending_at and the next rebuild sends them; TestIndexNow fires both events"
- "L2 WR-02 (D-30): every rebuild reads settings, types and records and applies them under one transaction-scoped advisory lock, so a second rebuild collects only after the first has committed and an older snapshot never overwrites a newer one"
- "L2 WR-03 (D-30): a rebuild never writes lastmod for a content row it did not create, so a lastmod that RecordSaved moved while the rebuild ran stays"
- "L2 WR-04 (D-32): migration 202610280002 copies every convertible url item of the Phase 17 definition (a relative path gets its leading slash; spaces and the bytes \" < > \\ are percent-encoded), keeps the other items of a definition with one malformed item, and logs one warning per url item it cannot convert with the item and the reason; the v0.2.0 release-note draft says so"
- "L2 WR-05 (D-34): Settings › Sitemaps loads no heading for a content type without a stored one, so a save that did not touch a heading stores none and each locale's HTML sitemap keeps its translated type label"
- "L2 IN-01: classes.RecordSaved returns nil for a nil event without reading it"
- "L1 CR-01 (D-85): a width whose variant height would exceed 4096 px is skipped with a warning and counted in Skipped; the image variants job and journal:image-variants go on with the next widths and images"
- "L1 CR-02 (D-50): with the H1 setting on, ConvertContentH1 rewrites content only when it is HTML (classes.LooksLikeHTML); markdown content, fenced and inline code samples included, is kept byte for byte while content_html is converted; the count is content_html's headings; this holds for API saves, imports, journal:fix-headings and translations"
- "L1 WR-03: ConvertH1 and SetImageAlt keep the bytes of an unfinished tag at the end of the input (input without a match comes back identical)"
- "L1 WR-01 (D-50): journal:fix-headings runs from the generated application CLI: without a published database it opens database.dsn (lookupDB), and without a DSN it names SUMMER_DATABASE__DSN"
- "L1 WR-05 (D-85, D-10): POST /_journal/api/v1/images/alt on a markdown post writes the alt into the markdown source (an inline image whose destination is the src, or a raw img tag, outside code), so the next content save keeps it; an image the markdown does not hold that way is refused with 422 changes.N.src and nothing is written"
- "G3 (D-55, D-57, SC-2): the Journal post, category, tag and author descriptors give a non-default enabled locale a URL only when the record has content in it (P33-64); every other enabled locale keeps its entry with URL \"\" (pact: no public page); the menu item types' Resolve alternates are unchanged"
- "G3: TestAlternates (sm-seo-plugin) and TestHreflangAlternates (sm-sitemap-plugin) use Journal-shaped records (every enabled locale present in sort order, an untranslated one with URL \"\" and the default locale's title, description and word count) and still emit no hreflang for the untranslated locale"
- "L1 WR-02 (docs only): the lagoon README and docs/database/attachments.md say that importing attach/webp also takes over WebP decoding for the whole process and what -tags nodynamic changes; no framework Go file changes"
- "G2 is not fixed, with the reason recorded in deferred-items.md and the SUMMARY: signpost.Activate refuses a menu item type without a DefaultPattern starting with /, so the change needs the framework"
prohibitions:
- requirement_id: "D-106"
category: compatibility
status: resolved
verification: test
statement: "sm-journal-plugin is a core plugin: no exported identifier is removed or renamed and no exported signature changes; the menu item types' Resolve output is unchanged (TestMenuItemTypesSmoke and menu_item_types_test.go pass unchanged)"
- requirement_id: "D-90"
category: scope
status: resolved
verification: test
statement: "No Go file of summercms.go changes; the framework gets docs lines only (scripts/check-phase33.sh --additive --marker --docs pass)"
- requirement_id: "D-95"
category: safety
status: resolved
verification: test
statement: "sm-seo-plugin still imports only sm-sitemap-plugin/contract outside tests, and sm-journal-plugin imports no SEO or sitemap package"
artifacts:
- path: "../sm-seo-plugin/updates/202611040001_create_golem15_seo_noindex_paths.go"
provides: "the stored noindex paths of the route report"
contains: "golem15_seo_noindex_paths"
- path: "../sm-sitemap-plugin/contract/contract.go"
provides: "contract.Rebuilder"
contains: "Rebuilder interface"
- path: "../sm-seo-plugin/updates/202611040002_add_golem15_seo_crawls_heartbeat.go"
provides: "heartbeat_at and cancel_requested_at on golem15_seo_crawls"
contains: "heartbeat_at"
- path: "../sm-sitemap-plugin/updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go"
provides: "indexnow_pending_at on golem15_sitemap_urls"
contains: "indexnow_pending_at"
- path: "../sm-seo-plugin/crawl_lifecycle_test.go"
provides: "running cancel, timeout and stale recovery tests"
contains: "TestCrawlCancelRunning"
key_links:
- from: "../sm-seo-plugin/controllers/api/registry.go"
to: "../sm-seo-plugin/classes/registry.go"
via: "RouteReport decodes noindex and calls ReportNoindex in the same write transaction"
pattern: "ReportNoindex"
- from: "../sm-seo-plugin/classes/sitemap_filter.go"
to: "golem15_seo_noindex_paths"
via: "newFilterBatch loads the set; decideTarget excludes with contract.ReasonNoindex"
pattern: "noindex"
- from: "../sm-seo-plugin/classes/registry.go"
to: "../sm-sitemap-plugin/contract/contract.go"
via: "after commit, app.Lookup[contract.Rebuilder]().RequestRebuild when the set changed"
pattern: "contract.Rebuilder"
- from: "../sm-seo-plugin/classes/crawl/job.go"
to: "context.WithoutCancel"
via: "finish runs on a detached, bounded context"
pattern: "WithoutCancel"
- from: "../sm-sitemap-plugin/classes/rebuild.go"
to: "pg_advisory_xact_lock"
via: "collect and apply inside one locked transaction"
pattern: "pg_advisory_xact_lock"
---
<!-- planner-discipline-allow: seo -->
## Phase Goal
**As a** site editor and as an SEO specialist auditing a SummerCMS site, **I want to** have the rendered sites emit complete SEO output (sitemaps, structured data, pagination, hreflang, headings, breadcrumbs) from the CMS, and an audit that finds the remaining problems, **so that** sites are indexed correctly and issues can be fixed through MCP.
This gap-closure plan fixes the Go side of the gaps and review findings that block the 33-14 release: G1 (CMS side), G3 and the in-scope findings of review lanes L1 (Journal), L2 (sitemap) and L3 (SEO). Plan 33-16 fixes the Nuxt layers in parallel (same wave, no shared files; the gap-2 contract below is fixed in both plans). 33-14 Task 4 (the release) resumes after both, followed by re-verification.
<objective>
Fix, each with a test that fails before the fix, in three plugin repositories (each main, not pushed, not tagged):
- sm-seo-plugin: the route report's noindex paths and the sitemap filter (G1, D-24, D-33); the crawl lifecycle (L3 CR-01, WR-01, WR-06, D-14); the crawl's port and path form (L3 WR-03, WR-04);
- sm-sitemap-plugin: contract.Rebuilder (G1, D-95); IndexNow for deletes and edits, the rebuild lock, kept lastmods (L2 WR-01 to WR-03, IN-01, D-30, D-31); the definitions migration and the HTML sitemap headings (L2 WR-04, WR-05, D-32, D-34);
- sm-journal-plugin (core plugin: additive and non-breaking): tall images (L1 CR-01, D-85), markdown left alone by the H1 conversion (L1 CR-02, D-50), the tokenizer tails (L1 WR-03), journal:fix-headings in the CLI (L1 WR-01), alt texts on markdown posts (L1 WR-05), descriptors listing only locales with content (G3, D-57);
- summercms.go: docs lines only (L1 WR-02 decoder note) and the planning docs (release-note drafts, release log, deferred items).
Purpose: close G1 (CMS side) and G3 and the release-blocking L1 to L3 findings before the tags.
Output: commits in sm-seo-plugin, sm-sitemap-plugin, sm-journal-plugin and summercms.go (docs, then planning docs as a separate commit).
**Plan size (Jakub, 2026-11-04):** the gap fixes are two plans, fewer and larger, by Jakub's explicit choice (project rule "lean planning"); the plan checker's recommendation to split this plan is overridden by that decision, and the six tasks stay here. Earlier phase-33 executors ran plans of this size. Each task is independently committable and leaves every repository green (see the executor note under "Execution units").
**Planner decisions recorded here (P33-58 to P33-66; 33-16 continues at P33-67):**
- **P33-58 (noindex paths):** table `golem15_seo_noindex_paths` (`path text PRIMARY KEY`, `reported_at timestamp NOT NULL`), model `models.NoindexPath`, migration 202611040001. `classes.(*Service).ReportNoindex(ctx, tx, paths []string) (stored int, skipped int, changed bool, err error)` replaces the set inside the route report's write transaction; entries are checked with `ValidPagePath` and stored through `normalPagePath(path, opts)` exactly like `routes`. `ReportRoutes` keeps its signature. The filter checks the set after the normalisation and redirect checks and before `resolveAt`.
- **P33-59 (rebuild on request):** `contract.Rebuilder` with `RequestRebuild(ctx context.Context) error`: "queue one debounced rebuild, the same one a record event queues". `classes.Listing` implements it with `RequestDebouncedRebuild`; the sitemap plugin publishes it with `app.Publish[contract.Rebuilder]` in `Register`, next to `contract.Listing`. Absent (an older sitemap plugin) means no request; the nightly rebuild still picks the set up.
- **P33-60 (crawl lifecycle):** `crawl.JobTimeout = 6 * time.Hour` (jobs.go uses it), `crawl.FinishTimeout = 10 * time.Minute`, `crawl.HeartbeatEvery = time.Minute`, `crawl.StaleAfter = 10 * time.Minute`; migration 202611040002 adds `heartbeat_at timestamp NULL` and `cancel_requested_at timestamp NULL` to `golem15_seo_crawls`. The job owns every terminal status of a running crawl; `RecoverStale(tx, now)` ends running rows whose `COALESCE(heartbeat_at, started_at, created_at)` is older than StaleAfter.
- **P33-61 (one crawl path form):** the decoded `u.Path` ("/" when empty) plus `?` and the raw query is the crawl key everywhere; `Fetcher.Absolute` escapes it; a path whose decoded form is not valid UTF-8 without NUL (the resolver's `safeText` rule) keeps its escaped form.
- **P33-62 (IndexNow pending):** column `golem15_sitemap_urls.indexnow_pending_at timestamp NULL` (migration 202611040001); the listeners set it, `apply` reads it into `RebuildResult.Changed` (listed rows) or `Removed` (rows that were listed), and clears it with `WHERE id = ? AND indexnow_pending_at = <the value read>`, so a mark made after the read survives for the next rebuild.
- **P33-63 (rebuild lock):** `SELECT pg_advisory_xact_lock(hashtext('golem15.sitemap.rebuild'))` at the start of one transaction that loads the settings and types, runs `collect` and then `apply` (with the existing `FOR UPDATE` of the settings row before `apply`).
- **P33-64 (G3 rule, "has content in a locale"):** the locale whose values are the host columns (translate's default code, else the unprefixed locale, else the first enabled one) always has content. Posts and categories: a non-default locale has content when the record's translate row in it holds a truthy (`phpTruthy`) value of a text field (post: title, content, content_html, excerpt; category: name, description). Tags and authors are not translatable: a non-default locale has content when at least one of their published posts has such a translation. The descriptors keep one entry per enabled locale (as now) and set `URL: ""` for the others, which is pact's documented "no public page" form that the SEO and sitemap plugins already drop; `menuAlternates` and every menu Resolve stay as they are.
- **P33-65 (alt texts on markdown):** `classes.SetMarkdownImageAlt(md, src, alt string) (string, int, *string)`: inline images `![label](dest)` and `![label](dest "title")` outside fenced and indented code blocks and code spans (ranges from goldmark's AST, the FormatHTML engine) match when the destination, escaped as goldmark's HTML renderer escapes it, equals src, or equals src as written; the label is replaced by alt with `\`, `[` and `]` backslash-escaped and line breaks folded to spaces. For markdown content the raw-`<img>` rewrite (SetImageAlt) also runs only on the text outside those code ranges.
- **P33-66 (legacy url items):** `models.ConvertLegacyItems(data []byte) (rows []ExtraURL, dropped []DroppedItem)` (pure): url items only; a value without a scheme and without a leading `/` gets one; spaces and `"`, `<`, `>`, `\` in the path are percent-encoded; the result must pass `models.AllowedAddress` (an absolute URL with `&` still does not, so it is dropped with that reason); duplicates are kept once without a log line; a malformed item is dropped with its parse error and the others are kept. The migration logs each dropped item at warn level as `golem15.sitemap: definition url item not copied` with the item label, the value and the reason.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/33-seo-output-audit-and-content/33-VERIFICATION.md
@.planning/phases/33-seo-output-audit-and-content/33-REVIEW.md
@.planning/phases/33-seo-output-audit-and-content/deferred-items.md
@.planning/phases/33-seo-output-audit-and-content/33-CONTEXT.md
@.planning/phases/33-seo-output-audit-and-content/33-PATTERNS.md
@.planning/phases/33-seo-output-audit-and-content/33-05-SUMMARY.md
@.planning/phases/33-seo-output-audit-and-content/33-10-SUMMARY.md
@CLAUDE.md
<interfaces>
sm-seo-plugin:
- controllers/api/registry.go: `routeReport{Routes []string}`, `maxRouteReportBody = MaxReportedRoutes*(MaxRouteBytes+8)+1024`, `RouteReport` handler (constant-time token, `write(ctx, svc, fn)` transaction, 422 `too_many_routes`).
- classes/registry.go: `ReportRoutes(ctx, tx, paths) (RouteReport, error)`, `RouteReport{Inserted, Updated, Skipped, ReportedAt}`, `normalPagePath(path, opts)`, `ValidPagePath`, `MaxReportedRoutes` (2000), `MaxRouteBytes` (2048), `SettingsRow`, `NormalizeOptionsOf`.
- classes/sitemap_filter.go: `SitemapFilter.Decide`, `newFilterBatch` (settings, redirect set, site), `decideTarget` (Normalize → redirect chain → `resolveAt` → robots/canonical), `candidatePath`.
- classes/crawl/job.go: `Run` (db on the job ctx), `run`, `finish(ctx, svc, db, row, res, runErr)`, `Start` (settings row FOR UPDATE, `ActiveCrawl`), `Cancel` (writes status cancelled at once), `Lookup`, `Keyphrases`; store.go `LatestCrawl`, `ActiveCrawl`; actions.go `DeleteCrawls`, `Prune`; crawler.go worker loop (`pace.wait`, `f.Get`, `renderMu`, `opt.Progress`); fetch.go `Fetcher.Allowed`, `Key` (EscapedPath), `Absolute`, `Get` (`network_error`); render.go `allowRequest(rawURL, hosts, trusted)`; render_chrome.go `newChromeRenderer(path, hosts, trusted, ua)`, `Render` (`chromedp.NewContext(r.browserCtx)`, `context.AfterFunc(ctx, closeTab)`, `chromedp.Do(tab)`, then `RenderTimeout`); compare.go `same` (EscapedPath); checks.go `Env{Lookup, Staging, GenericAnchors, Keyphrases}`, `checkSitemaps` (sitemap_noindex with `ToolSetURLSEO`); fix.go tool constants and `Route`.
- jobs.go `conga.Job(p.crawl, conga.MaxAttempts(1), conga.Timeout(6*time.Hour))`; mcp.go `cancel_crawl` description; controllers/crawls.go status labels; linkgraph.go `sitePath` (EscapedPath for absolute input).
sm-sitemap-plugin:
- contract/contract.go `Filter`, `Listing`, `ListingSettings`; plugin.go `Register` publishes `contract.Listing` (classes.Listing{App: app}).
- classes/lastmod.go `RecordSaved` (nil check after reading ev), `RecordDeleted`, `RequestDebouncedRebuild(ctx, app, db)`, `contentTypeOf`.
- classes/rebuild.go `Rebuild` (collect before the FOR UPDATE transaction), `collect`, `apply` (reads every slot row, writes every column of a dirty row including lastmod; skips a deleted row whose reason did not change before appending Removed), `RebuildResult{Added, Changed, Removed, Listed, Files}`; classes/indexnow.go `NotifyIndexNow`, `SiteURLs`.
- updates/202610280002 `copyDefinitions` (ParseLegacyItems fails the whole definition on one bad item; AllowedAddress silently drops items); models/legacy.go `ParseLegacyItems`, `LegacyEntries`, `ParseLegacyItem`, `LegacyItemURL`; models/url.go `AllowedAddress`; models/settings.go `AllowedFrontendURL`.
- extensions_settings.go `typeSettingsTab` Load (prefills a missing title with `{def: Phrase(ctx, tr, typ.Label)}` in the admin's UI locale); classes/typesettings.go `SaveTypeSettings`; classes/htmlgroups.go `pickTitle`, `translateIn`.
- Tests: content_fixture_test.go `store.put/remove` (remove fires no event), filter_fixture_test.go `fakeFilter`/`theFilter`, sitemap_index_test.go fires events with `e.app.Events.Fire(ctx, &pact.RecordDeleted{Model: pageModel, ID: "1"})`, `TestIndexNow` (sitemap_extras_test.go), `TestHreflangAlternates`, `TestMigrateDefinitions`.
sm-journal-plugin:
- classes/image_variants.go `GenerateImageVariants` (h = sh*w/sw, `f.ThumbKey` errors above 4096 px abort the batch), `MaxImageWidth = 4096`, `variantsLog`.
- classes/headings.go `ConvertH1`, `ConvertContentH1` (converts content too), `ConvertTranslationH1`; classes/image_alt.go `SetImageAlt` (both loops break on ErrorToken without writing the rest); classes/blog_editor.go `LooksLikeHTML`; classes/format_html.go `markdownEngine`, `FormatHTML`.
- console/fix_headings.go uses `mustDB(app)`; console/database.go `lookupDB(ctx, app)`; image_variants_cli_test.go `TestImageVariantsCommandCLI` (pattern for the CLI test).
- controllers/api/maintenance.go `SetImageAlt` (rewrites content_html, and content only when it holds a literal img), `loadImageAltText`, `writeImageAltTexts`.
- classes/content_descriptors.go `describePosts`, `describeCategories`, `describeTags`; classes/menu_item_types.go `describeAuthors`, `menuAlternates`, `loadMenuLocales`, `menuTranslations.value`, `phpTruthy`, `publishedPosts`; models/post.go pivot `golem15_journal_posts_tags`; models Post/Category `Translatable()`, Tag not translatable.
- signpost (framework, read only): `signpost.Activate` refuses an empty DefaultPattern (modules/signpost/signpost.go:85-86), the G2 reason.
</interfaces>
</context>
## Gap-2 contract (fixed; identical in 33-15 and 33-16)
The route report gains an optional `noindex` array of static paths, sent with the same token on the same request:
```
POST /_seo/api/v1/registry/routes
Authorization: Bearer <golem15.seo.route_report_token, else golem15.seo.notfound_token>
Content-Type: application/json
{"routes": ["/", "/blog", "/kontakt"], "noindex": ["/konto", "/pl/konto", "/szkic"]}
```
1. `routes`: unchanged (required array of strings).
2. `noindex`: optional array of strings, at most 2000 entries, each starting with `/`, without a `:` parameter or `*`, at most 2048 bytes in UTF-8. It lists every static path the frontend's build serves noindex: pages whose meta has `requiresAuth: true` or a `seo.robots` value with `noindex` or `none`, and static pages under a `seo.noindexRoutes` pattern. The `@nuxtjs/i18n` copies of those pages in other locales are listed as their own locale-prefixed paths (`/pl/konto`). Patterns (`/p/**`) are never sent, the layer's HTML sitemap pages never, and a path is never in both lists.
3. Plugin semantics: key absent → the stored set is unchanged; key present (also `[]`) → the stored set becomes exactly its valid entries, normalised like `routes` (`normalPagePath` with the site's address options); an invalid entry is skipped and counted in `skipped`; more than 2000 entries → 422 `{"error":"too_many_routes","max":2000}` and nothing is stored.
4. The answer gains one key, the number of stored paths: `{"inserted":1,"updated":3,"skipped":0,"reported_at":"2026-11-04T20:00:00Z","noindex":3}`.
5. The SEO sitemap filter excludes any candidate (record, registry page, additional address) whose normalised path is in the set, with reason `noindex`, from the XML and HTML sitemaps. A changed set requests one debounced sitemap rebuild.
6. Compatibility: a layer that sends no `noindex` keeps working (the set stays as it is). A plugin built before this contract decodes the body into `{routes}` and ignores the unknown key (encoding/json without DisallowUnknownFields), and it reads at most `MaxReportedRoutes*(MaxRouteBytes+8)+1024` = 2000*(2048+8)+1024 = 4,113,024 bytes of body (sm-seo-plugin controllers/api/registry.go:21, `maxRouteReportBody`). The layer therefore keeps the serialised JSON body at or under 4,113,024 bytes: it drops `noindex` entries from the end first, and only when the body is still too large `routes` entries from the end, so an older plugin never refuses the body for its size. A plugin built with this contract accepts at least that size (its cap covers both lists). The layer ignores the answer body.
## Execution units and resume points
- Run from summercms.go. Commit groups per repository, staged by explicit path (never `git add -A`); no attribution trailers; code and planning docs in separate commits; a README or docs change goes in the same commit as the API change it describes. Nothing is pushed or tagged. STATE.md changes only through `msd_run query state.*` handlers and is never committed.
- Every commit keeps that repository's `go vet ./...` and `go test -short ./...` green; the Docker suites (`go test ./...`) run per task. If the Docker socket is denied although the user is in the docker group, run the Docker tests through `sudo -u golem` (CLAUDE.md).
- 33-16 runs in parallel and commits planning docs to summercms.go too: if git reports `.git/index.lock`, wait and retry; never remove another session's lock or stage its files. Leave other sessions' uncommitted edits (STATE.md, state.json, G15OFFICE.md) alone.
- Resume check per repository: `git -C <repo> log --format=%s | grep -Fx '<subject>'`.
- Before Task 1, record each repository's HEAD as BASE in the SUMMARY draft (summercms.go, sm-seo-plugin, sm-sitemap-plugin, sm-journal-plugin); the dependency and compatibility checks compare against it.
- **Executor note (context budget):** if the context runs low, stop only after a complete task (all its commit groups committed and its verify green), never inside one; write the SUMMARY with the finished tasks and list the remaining tasks, with their resume points from the table below, for a continuation run. Every task is independently committable.
- **Gate stages:** this plan runs only its own stages of `scripts/check-phase33.sh` (self-test, go, plugins, docker, admin, docs, marker, additive, compat), never layers or consumers, because 33-16 changes the layers in parallel. The orchestrator runs the full `PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --all` once, after both 33-15-SUMMARY.md and 33-16-SUMMARY.md exist and before 33-14 Task 4.
- Every `<automated>` command starts with `set -o pipefail`, or chains with `&&`, so a failing command is never hidden by a later pipe stage.
| Task | Commit groups, in order | Resume point |
|------|-------------------------|--------------|
| 1 | sitemap: A `feat: contract.Rebuilder asks for a debounced rebuild`; seo: B `feat: noindex paths from the route report leave the sitemaps (tracer)` | TestNoindexPathsTracer passes |
| 2 | seo: A `fix: a cancelled or timed-out crawl stores what it fetched and ends`; B `fix: a crawl cancel waits for its job, and a stale crawl is ended`; C `fix: bound opening a Chrome tab` | TestCrawlCancelRunning, TestCrawlTimeout, TestCrawlStaleRecovery, TestRenderTabTimeout pass |
| 3 | seo: A `fix: the crawler and the Chrome guard keep to the site's port`; B `fix: one decoded path form for crawl keys and CMS lookups` | TestFetcherPortAndKey and TestCrawlerNonASCII pass |
| 4 | sitemap: A `fix: IndexNow hears of deleted and edited records`; B `fix: rebuilds collect under one lock and keep moved lastmods`; C `fix: the definitions migration keeps and logs every url item`; D `fix: HTML sitemap headings follow each locale until an editor sets one` | TestIndexNow, TestConcurrentRebuilds, TestRebuildKeepsMovedLastmod, TestConvertLegacyItems, TestTypeTitlesNotPinned pass |
| 5 | journal: A `fix: tall originals no longer stop the image variants job`; B `fix: H1 conversion leaves markdown and unfinished tags alone`; C `fix: journal:fix-headings runs from the application CLI`; D `fix: image alt texts on markdown posts are written into the markdown` | TestImageVariantsTallOriginal, TestFixHeadingsCommandCLI, TestSetMarkdownImageAlt pass |
| 6 | journal: A `fix: content descriptors list only locales with content`; seo: B `test: Journal-shaped records in the hreflang test`; sitemap: C `test: Journal-shaped records in the hreflang test`; framework: D `docs(lagoon): attach/webp also decodes WebP`; here: E `docs(33-15): release notes, release log and deferred items for the gap fixes` | plan complete |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "a route report names /subscriptions noindex and the next sitemap rebuild leaves that Additional address out" — one path only (G1, CMS side)</name>
<files>../sm-sitemap-plugin/contract/contract.go, ../sm-sitemap-plugin/classes/listing.go, ../sm-sitemap-plugin/plugin.go, ../sm-sitemap-plugin/README.md, ../sm-seo-plugin/updates/202611040001_create_golem15_seo_noindex_paths.go, ../sm-seo-plugin/models/noindex_path.go, ../sm-seo-plugin/classes/registry.go, ../sm-seo-plugin/controllers/api/registry.go, ../sm-seo-plugin/classes/sitemap_filter.go, ../sm-seo-plugin/classes/crawl/checks.go, ../sm-seo-plugin/classes/crawl/fix.go, ../sm-seo-plugin/classes/crawl/job.go, ../sm-seo-plugin/README.md, ../sm-seo-plugin/sitemap_filter_test.go, ../sm-seo-plugin/registry_test.go, ../sm-seo-plugin/classes/crawl/checks_test.go</files>
<read_first>
- ../sm-seo-plugin/controllers/api/registry.go (RouteReport) and ../sm-seo-plugin/classes/registry.go (ReportRoutes, normalPagePath, ValidPagePath, RouteReport struct)
- ../sm-seo-plugin/classes/sitemap_filter.go (newFilterBatch, decideTarget) and ../sm-seo-plugin/sitemap_filter_test.go (TestSitemapFilterTracer: how the test boots the sitemap plugin and calls sitemapclasses.Rebuild)
- ../sm-seo-plugin/registry_test.go (TestRouteReport: token, body, answer)
- ../sm-sitemap-plugin/contract/contract.go, ../sm-sitemap-plugin/plugin.go (Register publishes contract.Listing), ../sm-sitemap-plugin/classes/lastmod.go (RequestDebouncedRebuild)
- ../sm-seo-plugin/classes/crawl/checks.go (checkSitemaps, Env) and fix.go (tool constants, Route)
- ../sm-seo-plugin/updates/202610280007_create_golem15_seo_autolinks.go (migration pattern)
- the "Gap-2 contract" section of this plan
</read_first>
<action>
Per G1, D-24, D-33, D-95 and the gap-2 contract above (P33-58, P33-59), in this order:
- (A, sitemap) Add `contract.Rebuilder` (`RequestRebuild(ctx context.Context) error`, doc comment: asks for one debounced rebuild, the same one a record event queues; the sitemap plugin publishes it with `app.Publish[contract.Rebuilder]` in its Register). `classes.Listing` implements it by looking up the app's `*gorm.DB` and calling `RequestDebouncedRebuild`; plugin.go publishes it next to `contract.Listing`. README: contract section names the interface. Add an assertion to an existing Docker test that publishes and calls it (for example TestListing: after `RequestRebuild`, `rebuild_pending_until` is set). Commit A.
- (B, seo) Migration 202611040001 creates `golem15_seo_noindex_paths` (P33-58, with Rollback); model `models.NoindexPath`. `ReportNoindex` (P33-58) replaces the set in the caller's transaction and reports whether it changed; on a change it registers `lagoon.AfterCommit` that looks up `contract.Rebuilder` and calls `RequestRebuild` (a missing Rebuilder does nothing; an error is logged at warn). The handler decodes `noindex` as `*[]string` (absent vs present), raises the body cap to cover both arrays (two lists of MaxReportedRoutes entries), refuses more than MaxReportedRoutes noindex entries with the same 422, calls ReportNoindex in the same `write` transaction only when the key is present, and adds `noindex` (the stored count) to the answer; the handler doc comment states the semantics. `newFilterBatch` loads the set once per batch; `decideTarget` excludes a candidate whose normalised path (`norm.Path` after the normalisation and redirect checks) is in the set with `contract.ReasonNoindex`, before `resolveAt`. Crawler: add `ToolSitemapSettings = "sitemap_update_settings"` to fix.go; `Env` gains `SitemapTool string`, which the job fills (in `finish`) with ToolSitemapSettings when `svc.App()` publishes `contract.Listing`; in `checkSitemaps` a sitemap_noindex finding with a CMS record keeps ToolSetURLSEO, one without a record names `env.SitemapTool`, and with an empty SitemapTool gets no tool (Route then answers fix: code with What "the address list of the sitemap that names this page"); details gain `"extra": true` when there is no record. README: the route report section gets the exact JSON of the gap-2 contract and the filter's new reason source; the crawler section names the tool. Tests first: `TestNoindexPathsTracer` (Docker, in sitemap_filter_test.go): Additional address `/subscriptions` listed; a route report with `"noindex": ["/subscriptions"]` answers 200 with `"noindex": 1` and sets the sitemap's `rebuild_pending_until`; a rebuild leaves `/subscriptions` out with reason noindex (XML file and the HTML API); a report without the key keeps it out; a report with `"noindex": []` lists it again after the next rebuild; a second identical report requests no rebuild. TestRouteReport gains: a body with an invalid noindex entry counts it in `skipped`; 2001 noindex entries answer 422 and store nothing; a body with only `routes` answers as before plus `noindex`. checks_test.go `TestSitemapNoindexTool`: the three routes above. Commit B.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./... -run 'TestNoindexPathsTracer|TestRouteReport|TestSitemapFilterTracer|TestFilterReasons' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestNoindexPathsTracer" line</fails_when>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./classes/crawl -run 'TestSitemapNoindexTool|TestRoute|TestRouteEveryKind' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -10</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestSitemapNoindexTool" line</fails_when>
<automated>set -o pipefail; go -C ../sm-sitemap-plugin test ./... -run 'TestListing' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -6</automated>
<fails_when>non-zero exit, a "FAIL" line, "no tests to run", or no "--- PASS: TestListing" line</fails_when>
<automated>go -C ../sm-sitemap-plugin vet ./... && go -C ../sm-sitemap-plugin test -short ./... && go -C ../sm-seo-plugin vet ./... && go -C ../sm-seo-plugin test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "Rebuilder interface" ../sm-sitemap-plugin/contract/contract.go` prints one line; `grep -n "contract.Rebuilder" ../sm-sitemap-plugin/plugin.go` prints a line
- `grep -n 'json:"noindex' ../sm-seo-plugin/controllers/api/registry.go` prints a line and `grep -n "ReportNoindex" ../sm-seo-plugin/controllers/api/registry.go ../sm-seo-plugin/classes/registry.go` prints a line in each
- `grep -n "golem15_seo_noindex_paths" ../sm-seo-plugin/updates/202611040001_create_golem15_seo_noindex_paths.go` prints at least one line
- `grep -n "sitemap_update_settings" ../sm-seo-plugin/classes/crawl/fix.go` prints one line
- `grep -n '"noindex"' ../sm-seo-plugin/README.md` prints a line (the contract JSON)
- `go -C ../sm-seo-plugin list -deps . | grep sm-sitemap-plugin` lists only `.../sm-sitemap-plugin/contract` (D-95)
</acceptance_criteria>
<done>A noindex static path the frontend reports leaves the sitemaps on the next rebuild, and the crawler names the tool that really removes a listed noindex address.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Crawl lifecycle: detached finish, timeout and stale recovery, cancel owned by the job, bounded Chrome tab (L3 CR-01, WR-01, WR-06)</name>
<files>../sm-seo-plugin/updates/202611040002_add_golem15_seo_crawls_heartbeat.go, ../sm-seo-plugin/models/crawl.go, ../sm-seo-plugin/classes/crawl/job.go, ../sm-seo-plugin/classes/crawl/store.go, ../sm-seo-plugin/classes/crawl/actions.go, ../sm-seo-plugin/classes/crawl/crawler.go, ../sm-seo-plugin/classes/crawl/render_chrome.go, ../sm-seo-plugin/jobs.go, ../sm-seo-plugin/controllers/api/crawls.go, ../sm-seo-plugin/controllers/crawls.go, ../sm-seo-plugin/mcp.go, ../sm-seo-plugin/lang/en/lang.yaml, ../sm-seo-plugin/lang/pl/lang.yaml, ../sm-seo-plugin/README.md, ../sm-seo-plugin/crawl_lifecycle_test.go, ../sm-seo-plugin/classes/crawl/render_test.go</files>
<read_first>
- ../sm-seo-plugin/classes/crawl/job.go (Run, run, finish, Start, Cancel, LoadLimits) and store.go (LatestCrawl, ActiveCrawl), actions.go (DeleteCrawls, Prune)
- ../sm-seo-plugin/classes/crawl/crawler.go (the worker loop: pace.wait, f.Get, renderMu, Progress)
- ../sm-seo-plugin/classes/crawl/render_chrome.go (Render) and render_test.go (package crawl)
- ../sm-seo-plugin/crawl_admin_test.go (how a crawl is started, run with crawl.Run and a fetchguard.WithTransport fixture, and cancelled) and crawler_test.go (TestCrawlerTracer fixture site)
- ../summercms.go/modules/conga/conga.go (CancelJob, CheckIfCanceled, FailJob, StopJob)
- 33-REVIEW.md lane 3 CR-01, WR-01, WR-06
</read_first>
<behavior>
- TestCrawlCancelRunning (Docker): a crawl whose fixture transport blocks on its third page is cancelled through POST /_seo/api/v1/crawls/{id}/cancel; the row stays running with cancel_requested true; a Start answers 409 crawls.already_running; DELETE /crawls?ids= refuses it; Prune keeps it; then the job context is cancelled (as River does) and the transport released: the row ends cancelled with finished_at set, the two pages fetched before are stored with their issues, LatestCrawl returns it, and no page is stored as network_error
- TestCrawlTimeout (Docker): crawl.Run under a context that reaches its deadline mid-crawl stores the pages fetched so far and ends failed with an error naming the time limit and finished_at set; a later Start succeeds
- TestCrawlStaleRecovery (Docker): a running row with heartbeat_at 11 minutes old is ended failed (no-heartbeat error, finished_at) by the next Start, which then queues a new crawl; a running row with cancel_requested_at and an old heartbeat ends cancelled; a running row with a fresh heartbeat still blocks Start with 409
- TestRenderTabTimeout (package crawl, no Chrome): a chromeRenderer whose tab opener blocks returns an error within TabOpenTimeout (set to 50 ms in the test) plus a margin, and a second Render call is not blocked by the first
</behavior>
<action>
Per L3 CR-01, WR-01, WR-06, D-14 and P33-60, tests first, three commit groups:
- (A, CR-01) jobs.go uses `crawl.JobTimeout`. `Run`: after `run`, finish on `fctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), FinishTimeout)` with `gdb.WithContext(fctx)`, passing the job context's `ctx.Err()`; `finish` decides: runErr → failed; `context.DeadlineExceeded` → failed with the error "the crawl reached its time limit of 6h"; a requested cancel (fresh read of the row's cancel_requested_at or status), `context.Canceled` or `res.Canceled` → cancelled; a `LoadLimits` error falls back to the defaults (DefaultMaxPages, DefaultDelay, DefaultKeep) with a warn log instead of returning; conga FailJob/StopJob/CompleteJob and Prune run on fctx. crawler.go: a page whose `f.Get` returned an error while `ctx.Err() != nil` gets `Err "canceled"` (the checks already skip it). Commit A.
- (B, WR-01 and stale recovery) Migration 202611040002 adds `heartbeat_at` and `cancel_requested_at` (P33-60, with Rollback); the model gains both fields. `Run` writes heartbeat_at with started_at and starts a heartbeat goroutine (every HeartbeatEvery, each update on `context.WithoutCancel` with a 10 s timeout) stopped after finish returns. `Cancel`: a queued row becomes cancelled with finished_at through an update conditioned on `status = 'queued'`; when that matches nothing, or the row is running, it sets cancel_requested_at and cancelled_by on the running row only and cancels the conga job; the status stays running. The run's `Canceled` callback also stops on cancel_requested_at. `RecoverStale(tx, now)` (store.go) ends running rows per P33-60 (cancelled when cancel_requested_at is set, else failed with the error "the crawl job stopped without finishing (no heartbeat since <time>)"), finished_at now, and fails or stops their conga jobs best effort; `Start` calls it after locking the settings row and before ActiveCrawl, `DeleteCrawls` before its active check. `crawlMap` (API and MCP) adds `cancel_requested` (bool); the Crawls list shows the new label `crawls.st_cancelling` (en "Cancelling", pl "Anulowanie") for a running row with a requested cancel; the `cancel_crawl` MCP description says the crawl keeps running until its job stops, then ends cancelled with the pages fetched so far, and that no other crawl starts before that; README crawl section likewise. Commit B.
- (C, WR-06) render_chrome.go: `TabOpenTimeout = 5 * time.Second` (a package var the test may lower); Render derives `rctx, cancel := context.WithTimeout(ctx, TabOpenTimeout+RenderTimeout)` and registers `context.AfterFunc(rctx, closeTab)` instead of the crawl context, so a hung `chromedp.Do(tab)` returns when rctx ends; a tab that did not open in time answers "Chrome did not open a tab within 5 s". Add a seam for the test (a renderer field for the tab opener, defaulting to chromedp.NewContext and chromedp.Do). The crawler's renderMu section is then bounded by the same deadline. Commit C.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./... -run 'TestCrawlCancelRunning|TestCrawlTimeout|TestCrawlStaleRecovery|TestCrawlAdmin|TestCrawlTools|TestCrawlSchedule|TestCrawlerTracer|TestCrawlerChecks' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or any of TestCrawlCancelRunning, TestCrawlTimeout, TestCrawlStaleRecovery missing from the "--- PASS" lines</fails_when>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./classes/crawl -run 'TestRenderTabTimeout|TestNewRenderer|TestRenderMax' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -8</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestRenderTabTimeout" line</fails_when>
<automated>go -C ../sm-seo-plugin vet ./... && go -C ../sm-seo-plugin test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "WithoutCancel" ../sm-seo-plugin/classes/crawl/job.go` prints at least one line
- `grep -n "heartbeat_at\|cancel_requested_at" ../sm-seo-plugin/updates/202611040002_add_golem15_seo_crawls_heartbeat.go` prints at least two lines
- `grep -n "JobTimeout" ../sm-seo-plugin/jobs.go` prints one line
- `grep -n "func RecoverStale" ../sm-seo-plugin/classes/crawl/store.go` prints one line
- `grep -n "st_cancelling" ../sm-seo-plugin/lang/en/lang.yaml ../sm-seo-plugin/lang/pl/lang.yaml` prints a line in each
- `grep -n "TabOpenTimeout" ../sm-seo-plugin/classes/crawl/render_chrome.go` prints at least two lines
</acceptance_criteria>
<done>A cancelled or timed-out crawl keeps what it fetched and ends; no crawl stays running after its job is gone; a second crawl cannot start while a cancelled one is still stopping; a hung Chrome cannot stall the crawl.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: Crawl addresses: the site's port and one decoded path form (L3 WR-03, WR-04)</name>
<files>../sm-seo-plugin/classes/crawl/fetch.go, ../sm-seo-plugin/classes/crawl/render.go, ../sm-seo-plugin/classes/crawl/render_chrome.go, ../sm-seo-plugin/classes/crawl/compare.go, ../sm-seo-plugin/classes/linkgraph.go, ../sm-seo-plugin/classes/crawl/fetch_test.go, ../sm-seo-plugin/classes/crawl/render_test.go, ../sm-seo-plugin/crawler_test.go, ../sm-seo-plugin/README.md</files>
<read_first>
- ../sm-seo-plugin/classes/crawl/fetch.go (NewFetcher, Allowed, Key, Absolute, Get) and render.go (allowRequest, resolver rules), render_chrome.go (newChromeRenderer, NewRenderer callers)
- ../sm-seo-plugin/classes/crawl/compare.go (same) and ../sm-seo-plugin/classes/linkgraph.go (sitePath, LinksOfURL, LinksOfRecord)
- ../sm-seo-plugin/classes/resolver.go (safeText) and classes/crawl/job.go (Lookup, Keyphrases)
- ../sm-seo-plugin/classes/crawl/render_test.go (TestAllowRequest table) and ../sm-seo-plugin/crawler_test.go (fixture site, fetchguard.WithTransport)
- 33-REVIEW.md lane 3 WR-03, WR-04
</read_first>
<behavior>
- TestAllowRequest gains rows: https://example.test:8443/x refused; https://example.test:443/x allowed; trusted http on the site's port allowed, on another port refused; data: and blob: unchanged
- TestFetcherPortAndKey (package crawl): Allowed and Key refuse https://site:8443/x and accept https://site:443/x as /x; Key of https://site/blog/za%C5%BC%C3%B3%C5%82%C4%87?a=1 is /blog/zażółć?a=1; Absolute of that key is https://site/blog/za%C5%BC%C3%B3%C5%82%C4%87?a=1; Key of https://site/%FF keeps /%FF
- TestCrawlerNonASCII (Docker): the fixture site links /blog/zażółć percent-encoded from / and lists it encoded in its sitemap; the crawl fetches it once under the key /blog/zażółć, Lookup finds the fixture CMS record at that address (its record-content finding names the record type's tool), no false content_js links finding appears, and LinksOfURL with the encoded absolute URL reports one inbound link; a link to the site host on port 8443 is neither fetched nor stored
</behavior>
<action>
Per L3 WR-03, WR-04, D-14 and P33-61, tests first:
- (A, WR-03) NewFetcher records the site's effective port (explicit, else 443 for https and 80 for http) through a small `effectivePort(u *url.URL) string` helper; `Fetcher.Allowed` compares it (so Key refuses another port too); NewRenderer and newChromeRenderer take the port and `allowRequest(rawURL, hosts, port, trusted)` refuses any http(s) request on another effective port (data: and blob: unchanged); compare.go keeps using Key. README: the Chrome guard paragraph names the port rule. Commit A.
- (B, WR-04) `Fetcher.Key` returns the decoded `u.Path` ("/" when empty) plus `?` and the raw query, keeping the escaped path when the decoded one is not valid UTF-8 without NUL (P33-61); `Fetcher.Absolute` escapes the path part with `(&url.URL{Path: p}).EscapedPath()` and appends the query as is; compare.go `same` and linkgraph.go `sitePath` (both the `/…` and the absolute input, parsed with url.Parse) produce the same form. Nothing else changes: Lookup, Keyphrases and LinksOfRecord already work on decoded paths. Commit B.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./classes/crawl -run 'TestAllowRequest|TestFetcherPortAndKey|TestCompareRendered|TestResolverRules' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -10</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestFetcherPortAndKey" line</fails_when>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./... -run 'TestCrawlerNonASCII|TestCrawlerTracer|TestCrawlerChecks|TestLinkSuggestions|TestChromeRenderer|TestRendererGuards' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -12</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestCrawlerNonASCII" line (TestChromeRenderer may skip only on a host without Chrome)</fails_when>
<automated>go -C ../sm-seo-plugin vet ./... && go -C ../sm-seo-plugin test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "func effectivePort" ../sm-seo-plugin/classes/crawl/*.go` prints one line
- `grep -n "func allowRequest" ../sm-seo-plugin/classes/crawl/render.go` prints one line whose parameters include the port
- `grep -n "u.Path" ../sm-seo-plugin/classes/crawl/fetch.go` prints at least one line (Key builds the decoded form)
</acceptance_criteria>
<done>The crawler and headless Chrome stay on the site's port, and addresses with non-ASCII characters match their CMS records and link counts.</done>
</task>
<task type="auto" tdd="true">
<name>Task 4: Sitemap: IndexNow for deletes and edits, one rebuild lock, kept lastmods, the definitions migration, unpinned HTML headings (L2 WR-01 to WR-05, IN-01)</name>
<files>../sm-sitemap-plugin/updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go, ../sm-sitemap-plugin/models/url.go, ../sm-sitemap-plugin/classes/lastmod.go, ../sm-sitemap-plugin/classes/rebuild.go, ../sm-sitemap-plugin/classes/indexnow.go, ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go, ../sm-sitemap-plugin/models/legacy.go, ../sm-sitemap-plugin/models/legacy_test.go, ../sm-sitemap-plugin/extensions_settings.go, ../sm-sitemap-plugin/classes/typesettings.go, ../sm-sitemap-plugin/controllers/api/settings.go, ../sm-sitemap-plugin/lang/en/lang.yaml, ../sm-sitemap-plugin/lang/pl/lang.yaml, ../sm-sitemap-plugin/README.md, ../sm-sitemap-plugin/content_fixture_test.go, ../sm-sitemap-plugin/filter_fixture_test.go, ../sm-sitemap-plugin/sitemap_extras_test.go, ../sm-sitemap-plugin/sitemap_index_test.go, ../sm-sitemap-plugin/classes/lastmod_test.go</files>
<read_first>
- ../sm-sitemap-plugin/classes/rebuild.go (Rebuild, collect, apply, rowChanged) and classes/lastmod.go (RecordSaved, RecordDeleted, RequestDebouncedRebuild), classes/indexnow.go (NotifyIndexNow)
- ../sm-sitemap-plugin/sitemap_extras_test.go (TestIndexNow, TestHTMLGroups), sitemap_index_test.go (event firing at ~504-600, TestMigrateDefinitions, TestSettingsSingleton for the admin settings API), content_fixture_test.go (store.put/remove), filter_fixture_test.go (fakeFilter)
- ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go (copyDefinitions) and models/legacy.go, models/url.go (AllowedAddress)
- ../sm-sitemap-plugin/extensions_settings.go (typeSettingsTab Load), classes/typesettings.go (SaveTypeSettings), classes/htmlgroups.go (pickTitle, translateIn), controllers/api/settings.go (GET types)
- 33-REVIEW.md lane 2 WR-01 to WR-05, IN-01
</read_first>
<behavior>
- TestIndexNow (production fixture) through the fixed fixture: a record deleted with a fired pact.RecordDeleted and a content-only edit with a fired pact.RecordSaved (title change, same URL) lead the next rebuild to queue one IndexNow job holding the deleted address and the edited address; a following rebuild with nothing new queues nothing; outside production nothing is queued and the marks are cleared
- TestConcurrentRebuilds (Docker): rebuild A blocks inside the fake Filter's Decide; record X is published; rebuild B starts and waits on the advisory lock (a not-granted advisory lock shows in pg_locks); A is released; both finish; X is listed and is not in any queued IndexNow removal
- TestRebuildKeepsMovedLastmod (Docker): through a test seam called right after apply reads the slot rows, a RecordSaved moves the lastmod of a row the same rebuild also changes (title); after the rebuild the stored lastmod is the moved one
- TestConvertLegacyItems (models, no Docker): o-nas becomes /o-nas; "/blog/zażółć gęślą" becomes "/blog/zażółć%20gęślą"; a duplicate is kept once without a dropped entry; https://site/x?a=1&b=2 is dropped with a reason naming the &; a malformed item is dropped with its parse error while the other items are kept; a non-url item is neither kept nor reported
- TestMigrateDefinitions extended: a definition mixing those items migrates the convertible ones into extra_urls
- TestTypeTitlesNotPinned (Docker): an English-UI admin loads Settings › Sitemaps and saves it back unchanged; no type title is stored; the HTML groups API answers the pl group title from the pl translation of the type label and the en one from en
- TestRecordSavedNilEvent (classes): RecordSaved(ctx, app, nil) returns nil without a panic
</behavior>
<action>
Per L2 WR-01 to WR-05, IN-01, D-30, D-31, D-32, D-34, P33-62, P33-63 and P33-66, tests first, four commit groups:
- (A, WR-01, IN-01) Migration 202611040001 adds `indexnow_pending_at` (with Rollback); the model gains it. RecordSaved checks `ev == nil` before reading ev (IN-01) and, with the lastmod move, sets indexnow_pending_at on the record's rows; RecordDeleted sets indexnow_pending_at only on rows that were listed (excluded_reason '') in the same update that excludes them. `apply` turns pending rows into `Changed` (listed after this rebuild and not already Added or Changed) or `Removed` (no longer listed; handled before the "reason did not change" skip), and clears the mark per P33-62. Fixture fix: content_fixture_test.go gets helpers that delete or edit a record and fire `pact.RecordDeleted` or `pact.RecordSaved` through `e.app.Events.Fire`, as the admin does; TestIndexNow uses them. Commit A.
- (B, WR-02, WR-03) Rebuild runs per P33-63: the advisory lock, then settings, types, `collect`, the settings row `FOR UPDATE` and `apply`, all in one transaction; the Rebuild doc comment says what is serialised. `apply` writes `lastmod` only for a created row or an additional address (`w.extra`), never for an existing content row (WR-03). Add a context seam (for example `classes.WithAfterSlotRead(ctx, fn)`, nil in production) called after apply reads the slot rows, and a hook on `fakeFilter` that can block Decide. Commit B.
- (C, WR-04) `models.ConvertLegacyItems` and `DroppedItem` per P33-66 (parse the entries one by one with LegacyEntries and ParseLegacyItem); copyDefinitions uses it and logs each dropped item (`diary.For("sitemap")` Warn `golem15.sitemap: definition url item not copied` with item, url and reason), and a definition that is not a list logs one line. Editing the migration in place is safe: v0.2.0 is untagged and no production database has run 202610280002 (deploys follow the 33-14 tags). Local rehearsal databases that already ran the old 202610280002 (the 33-12 demo and 33-13 grzyby rehearsals) keep its old result: recreate them from their source dumps before the 33-14 rehearsal, and say so in the SUMMARY so 33-14 Task 4 does it. README upgrade paragraph states the conversion and the log line. Commit C.
- (D, WR-05) typeSettingsTab Load answers only stored titles (an empty map for a type without one) and the field shows the type's label as its comment or placeholder (reuse the existing `type_title` comment if it fits; a new phrase goes into en and pl); `controllers/api/settings.go` GET answers stored titles only if it prefills too. Commit D.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-sitemap-plugin test ./... -run 'TestIndexNow|TestIndexNowStaging|TestConcurrentRebuilds|TestRebuildKeepsMovedLastmod|TestMigrateDefinitions|TestTypeTitlesNotPinned|TestHTMLGroups|TestLastmod|TestDebouncedRebuild|TestSitemapIndex|TestStableNumbering' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -20</automated>
<fails_when>non-zero exit, a "FAIL" line, "no tests to run", or any of TestIndexNow, TestMigrateDefinitions, TestConcurrentRebuilds, TestRebuildKeepsMovedLastmod, TestTypeTitlesNotPinned missing from the "--- PASS" lines</fails_when>
<automated>set -o pipefail; go -C ../sm-sitemap-plugin test ./classes ./models -run 'TestRecordSavedNilEvent|TestConvertLegacyItems|TestRealChanges' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -8</automated>
<fails_when>a "FAIL" line, "no tests to run", or TestConvertLegacyItems or TestRecordSavedNilEvent missing from the "--- PASS" lines</fails_when>
<automated>go -C ../sm-sitemap-plugin vet ./... && go -C ../sm-sitemap-plugin test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "pg_advisory_xact_lock" ../sm-sitemap-plugin/classes/rebuild.go` prints one line
- `grep -n "indexnow_pending_at" ../sm-sitemap-plugin/updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go ../sm-sitemap-plugin/classes/lastmod.go ../sm-sitemap-plugin/classes/rebuild.go` prints a line in each
- `grep -n "definition url item not copied" ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go` prints one line
- `grep -n "func ConvertLegacyItems" ../sm-sitemap-plugin/models/legacy.go` prints one line
- `grep -n "RecordDeleted\|RecordSaved" ../sm-sitemap-plugin/sitemap_extras_test.go` prints at least two lines (the fixture fires the events in TestIndexNow)
</acceptance_criteria>
<done>IndexNow hears of every removal and content edit, concurrent rebuilds and record saves never leave stale state, migrated url items are kept or reported, and HTML sitemap headings stay per language.</done>
</task>
<task type="auto" tdd="true">
<name>Task 5: Journal content fixes: tall images, markdown left alone, unfinished tags, fix-headings in the CLI, alt texts on markdown (L1 CR-01, CR-02, WR-03, WR-01, WR-05)</name>
<files>../sm-journal-plugin/classes/image_variants.go, ../sm-journal-plugin/classes/headings.go, ../sm-journal-plugin/classes/image_alt.go, ../sm-journal-plugin/console/fix_headings.go, ../sm-journal-plugin/controllers/api/maintenance.go, ../sm-journal-plugin/mcp.go, ../sm-journal-plugin/README.md, ../sm-journal-plugin/classes/headings_test.go, ../sm-journal-plugin/classes/image_alt_test.go, ../sm-journal-plugin/headings_test.go, ../sm-journal-plugin/related_media_test.go, ../sm-journal-plugin/image_variants_cli_test.go</files>
<read_first>
- ../sm-journal-plugin/classes/image_variants.go (GenerateImageVariants) and related_media_test.go (TestImageVariants, jpegOf)
- ../sm-journal-plugin/classes/headings.go, image_alt.go, blog_editor.go (LooksLikeHTML), format_html.go (markdownEngine), heading_fix.go (fixPost), console/import_posts.go (ConvertContentH1 call sites), controllers/api/posts_helpers.go (h1Conversion)
- ../sm-journal-plugin/classes/headings_test.go and image_alt_test.go (TestConvertH1, TestConvertContentH1, TestConvertTranslationH1, TestSetImageAlt, TestSetImageAltEdges: the gate requires these names)
- ../sm-journal-plugin/console/fix_headings.go, console/database.go (lookupDB) and image_variants_cli_test.go (TestImageVariantsCommandCLI)
- ../sm-journal-plugin/controllers/api/maintenance.go (SetImageAlt, loadImageAltText, writeImageAltTexts) and headings_test.go (TestHeadingConversion, TestFixHeadingsCommand, TestSetImageAlt)
- 33-REVIEW.md lane 1 CR-01, CR-02, WR-01, WR-03, WR-05
</read_first>
<behavior>
- TestImageVariantsTallOriginal (Docker): one job with a 1000×9000 original and then a 900×600 one returns no error; the tall one gets no variant above 4096 px and is counted skipped; the normal one gets its variants; journal:image-variants --all over both finishes with exit code 0
- TestConvertContentH1 gains: markdown with a fenced html sample holding h1 tags and an inline code h1 comes back byte for byte, its content_html (from FormatHTML) has the real heading converted and the code still escaped, and the count is 1; HTML content converts as before; TestConvertTranslationH1 gains the same markdown case
- TestConvertH1 and TestSetImageAltEdges gain: input without a match (for example "p a <b" cut inside a tag, "x<y") comes back identical; an h1 followed by an unfinished tag keeps the tail
- TestHeadingConversion, TestFixHeadingsCommand (Docker) gain a markdown post with a fenced h1 sample: an API save, an import and journal:fix-headings --apply keep its content byte for byte and convert its content_html
- TestFixHeadingsCommandCLI (Docker): in the generated CLI without a published database the command names SUMMER_DATABASE__DSN without a DSN and prints the dry-run line with one
- TestSetMarkdownImageAlt (classes): ![](/a.jpg) and ![old](/a.jpg "t") get the alt; a destination written unescaped matches its goldmark-escaped src; an alt with ] and a line break is escaped and folded; the same image inside a fence or a code span is left alone; a reference-style image is not matched
- TestSetImageAlt (Docker) gains: on a markdown post the alt lands in content and content_html and survives a following PUT that saves the same content; a markdown post whose image is reference-style answers 422 changes.0.src and writes nothing; an HTML post behaves as before
</behavior>
<action>
Per L1 CR-01, CR-02, WR-01, WR-03, WR-05, D-50, D-85, D-10 and P33-65, tests first; core plugin rules: no exported identifier removed or renamed, no exported signature changed (new functions only):
- (A, CR-01) In GenerateImageVariants, a width whose computed height exceeds MaxImageWidth (4096, the thumbnailer's edge limit) is skipped with `variantsLog.Warn` (file, width, height) and `out.Skipped++` before ThumbKey runs, so neither ThumbKey nor webp.Variant can fail the batch on it; storage and database errors still return (the job retries). Commit A.
- (B, CR-02, WR-03) `ConvertContentH1` converts `content` only when `LooksLikeHTML(content)`; content_html is always converted; the count is content_html's, or content's when content_html has none and content is HTML; doc comments of ConvertContentH1 and ConvertTranslationH1 say markdown is never rewritten (every render path re-derives and re-converts content_html). In ConvertH1 and SetImageAlt, the loop tracks the bytes consumed and on the tokenizer's EOF appends the unconsumed rest of the input before returning. Update the tests that pinned converting a markdown source. Commit B.
- (C, WR-01) journal:fix-headings opens the database with `lookupDB` (defer done) as journal:image-variants does; README command list notes it runs from the application CLI. Commit C.
- (D, WR-05) `SetMarkdownImageAlt` per P33-65 in image_alt.go, plus a helper that runs a rewrite only on the text outside goldmark code ranges. In the images/alt handler, for each locale's text: HTML content (LooksLikeHTML) keeps today's behaviour; markdown content gets SetMarkdownImageAlt and SetImageAlt outside code; when neither matched while content_html did, the change is refused with 422 `changes.N.src` "The image is not an inline image of the post's markdown; edit the post." and nothing is written (the batch stays all or nothing). The images/alt API and the MCP tool are new in the unreleased v0.4.0, so the refusal is no break. mcp.go set_image_alt description and the README API section state the markdown rule. Commit D.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-journal-plugin test ./classes -run 'TestConvertH1|TestConvertContentH1|TestConvertTranslationH1|TestSetImageAlt|TestSetImageAltEdges|TestSetMarkdownImageAlt' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -10</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestSetMarkdownImageAlt" line</fails_when>
<automated>set -o pipefail; go -C ../sm-journal-plugin test ./... -run 'TestImageVariants|TestImageVariantsTallOriginal|TestImageVariantsCommandCLI|TestFixHeadingsCommand|TestFixHeadingsCommandCLI|TestHeadingConversion|TestHeadingConversionTracer|TestSetImageAlt|TestJournalSettingsTools' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -16</automated>
<fails_when>a "FAIL" line, "no tests to run", or TestImageVariantsTallOriginal or TestFixHeadingsCommandCLI missing from the "--- PASS" lines</fails_when>
<automated>set -o pipefail; go -C ../sm-journal-plugin vet ./... && go -C ../sm-journal-plugin test -short ./... && npm --prefix ../sm-journal-plugin run test 2>&1 | tail -6</automated>
<fails_when>non-zero exit, a "FAIL" line, or a failed count above 0 in the vitest summary</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "lookupDB" ../sm-journal-plugin/console/fix_headings.go` prints one line
- `grep -n "LooksLikeHTML" ../sm-journal-plugin/classes/headings.go` prints at least one line
- `grep -n "func SetMarkdownImageAlt" ../sm-journal-plugin/classes/image_alt.go` prints one line
- `grep -n "MaxImageWidth" ../sm-journal-plugin/classes/image_variants.go` prints at least two lines (the bound and the new height check)
- with BASE the journal HEAD recorded before Task 5, `git -C ../sm-journal-plugin diff BASE..HEAD -U0 -- '*.go' ':!*_test.go' | grep -E '^-func [A-Z]|^-func \([^)]*\) [A-Z]'` prints nothing (no exported function removed or its signature changed)
</acceptance_criteria>
<done>Tall images, markdown code samples, cut-off tags and markdown alt texts are handled without corrupting content or stopping jobs, and journal:fix-headings runs from the application CLI.</done>
</task>
<task type="auto" tdd="true">
<name>Task 6: Journal descriptors list only locales with content (G3), Journal-shaped hreflang fixtures, the WebP decoder docs line, release notes and the record of G2</name>
<files>../sm-journal-plugin/classes/content_descriptors.go, ../sm-journal-plugin/classes/menu_item_types.go, ../sm-journal-plugin/content_descriptors_test.go, ../sm-journal-plugin/README.md, ../sm-seo-plugin/classes/alternates_test.go, ../sm-sitemap-plugin/sitemap_index_test.go, modules/lagoon/README.md, docs/database/attachments.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-journal-plugin-v0.4.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-seo-plugin-v0.2.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-sitemap-plugin-v0.2.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-summercms-v0.6.1.md, .planning/phases/33-seo-output-audit-and-content/33-release-log.md, .planning/phases/33-seo-output-audit-and-content/deferred-items.md</files>
<read_first>
- ../sm-journal-plugin/classes/content_descriptors.go (describePosts, describeCategories, describeTags) and classes/menu_item_types.go (describeAuthors, menuAlternates, loadMenuLocales, menuTranslations, phpTruthy, publishedPosts)
- ../sm-journal-plugin/content_descriptors_test.go (bootMenuItemTypes with translate, TestContentDescriptors, TestJournalTagType) and menu_item_types_smoke_test.go
- ../sm-seo-plugin/classes/alternates_test.go (TestAlternates) and ../sm-sitemap-plugin/sitemap_index_test.go (TestHreflangAlternates)
- ../summercms.go/modules/signpost/signpost.go (lines 80-90: the DefaultPattern rule, the G2 reason)
- modules/lagoon/README.md (attach/webp lines 9, 15, 45) and docs/database/attachments.md (the WebP variants section)
- the four 33-14-notes-sm-*/summercms drafts, 33-release-log.md ("Planned contents"), deferred-items.md, 33-VERIFICATION.md (G1, G2, G3, info rows)
</read_first>
<behavior>
- TestContentDescriptorsTranslatedLocales (Docker, translate with pl default, en and de enabled): a post with an en translation row (title, content) and none in de describes pl and en with URLs and de with URL "" and the pl title; a post without translations has only the pl URL; a category with a translated en name gets the en URL, one without gets ""; a tag whose only published post is translated into en gets the en URL and "" for de; an author likewise; the journal-post and journal-category menu Resolve of the same records still lists all three locales with URLs
- TestAlternates (sm-seo-plugin) runs on a Journal-shaped record (pl default, en translated, de enabled and untranslated with URL "" and the pl title, description and word count) and answers pl, en and x-default only
- TestHreflangAlternates (sm-sitemap-plugin) uses the same shape for its de entry and still writes no hreflang="de"
</behavior>
<action>
Per G3, D-55, D-57, SC-2 and P33-64, then the docs and planning records:
- (A, journal, G3) A helper decides per record and locale whether it has content (P33-64): posts and categories through the menuTranslations already loaded (a new method, for example `has(locale, id, fields...)`, using phpTruthy); tags and authors through one query per describe batch that loads their published posts (the posts-tags pivot `golem15_journal_posts_tags`, posts by user_id, `publishedPosts`) and those posts' translations (loadMenuTranslations). describePosts, describeCategories, describeTags and describeAuthors keep one entry per alternate and set URL "" for a locale without content; menuAlternates, the Resolve functions and the Match functions stay unchanged. README: the "Every resolved record carries alternates…" paragraph gains the descriptor rule. Commit A.
- (B, seo) TestAlternates gets a `journalShaped` fixture per the behaviour above. Commit B.
- (C, sitemap) TestHreflangAlternates gets the same shape for its untranslated entry. Commit C.
- (D, framework, L1 WR-02 docs only) modules/lagoon/README.md (the attach/webp feature line) and docs/database/attachments.md (the encoder paragraph): importing attach/webp also registers the encoder library's WebP decoder ahead of the pure Go one, so decoding WebP uploads (thumbnails, size checks) goes through the system libwebp when it is installed; keep libwebp patched, or build with -tags nodynamic so decoding uses the transpiled copy. Use no new backticked identifiers outside lagoon and no SEO, sitemap or application words (marker stage). `go test ./cmd/summer -run TestDocsTree` and `summer docs:build --check` pass. Commit D (docs only; no Go file changes).
- (E, planning docs) Release-note drafts: sm-seo-plugin v0.2.0 (route report noindex paths and the filter, crawl cancel and timeout behaviour with the stale recovery, port and non-ASCII crawl fixes), sm-sitemap-plugin v0.2.0 (contract.Rebuilder; IndexNow of removed and edited addresses now true; the corrected migration wording per P33-66 with the log line; the upgrade line about noindex Additional addresses: left out automatically when the frontend reports them, otherwise remove them), sm-journal-plugin v0.4.0 (descriptors list only locales with content, a behaviour change for hreflang and sitemaps, with the rule stated explicitly: posts and categories by their own translation in the locale, tags and authors when at least one of their published posts is translated into it, the default locale always; markdown never rewritten by the H1 conversion; alt texts on markdown posts; tall images; fix-headings from the CLI under Fixed), summercms v0.6.1 (the WebP decoder note under Changed). 33-release-log.md: add the docs commit of D under "Framework commits of later Phase 33 plans". deferred-items.md: G3's 33-13 entry and the 33-12 "noindex additional address" entry resolved (CMS side here, layer side 33-16), the "journal-tag pattern" entry deferred to v0.6.2 with the G2 reason (signpost.Activate refuses an empty DefaultPattern; dropping the descriptor would remove the tag form's SEO tab and the sitemap types row), the fix-headings note of "journal:image-variants cannot run" resolved, and the stale "Saving Settings › Journal answers 500" entry resolved (d2ce3a2); a new "From 33-15" section lists the v0.6.2 items of the Deferred section below. Commit E in summercms.go as planning docs.
</action>
<verify>
<automated>set -o pipefail; go -C ../sm-journal-plugin test ./... -run 'TestContentDescriptorsTranslatedLocales|TestContentDescriptors|TestContentDescriptorsMatrix|TestJournalTagType|TestJournalDescriptorFields|TestMenuItemTypesSmoke' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' | tail -12</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestContentDescriptorsTranslatedLocales" line</fails_when>
<automated>set -o pipefail; go -C ../sm-seo-plugin test ./classes -run 'TestAlternates' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)' && go -C ../sm-sitemap-plugin test ./... -run 'TestHreflangAlternates' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok)'</automated>
<fails_when>a "FAIL" line, "no tests to run", or TestAlternates or TestHreflangAlternates missing from the "--- PASS" lines</fails_when>
<automated>set -o pipefail; go test ./cmd/summer -run TestDocsTree -count=1 && sha=$(git log --format=%H -n1 --grep='^docs(lagoon): attach/webp also decodes WebP$') && test -n "$sha" && files=$(git show --name-only --format= "$sha") && printf '%s\n' "$files" | awk '/\.go$/ {n++} END {print "go-files=" n+0}'</automated>
<fails_when>non-zero exit, a "FAIL" line, no "go-files=" line (the docs commit is missing), or a value other than go-files=0 (the framework commit of this plan changes a Go file)</fails_when>
<automated>set -o pipefail; PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --self-test --go --plugins --docker --admin --docs --marker --additive --compat 2>&1 | tail -20</automated>
<fails_when>non-zero exit, a "FAIL" or "refuse:" line, or a missing "PASS <stage>" line for any of self-test, go, plugins, docker, admin, docs, marker, additive and compat (this plan never runs the layers or consumers stage; the orchestrator runs --all after both SUMMARYs)</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "has content" ../sm-journal-plugin/README.md` prints a line stating the descriptor rule (a locale gets an address only when the record has content in it)
- `grep -n "nodynamic" modules/lagoon/README.md docs/database/attachments.md` prints a line in each with the decoding note
- `grep -n "not copied" .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-sitemap-plugin-v0.2.0.md` prints a line
- deferred-items.md has a "From 33-15" section and the journal-tag entry names signpost's DefaultPattern rule
- `git -C ../sm-seo-plugin status --short`, `git -C ../sm-sitemap-plugin status --short` and `git -C ../sm-journal-plugin status --short` print no tracked change left uncommitted by this plan
</acceptance_criteria>
<done>Untranslated locales leave hreflang and sitemaps for Journal records on the real descriptor path, the fixtures prove it with Journal-shaped records, and the release notes, release log and deferred items match the code.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| frontend server → route report | token-authenticated POST whose noindex list now changes what the sitemaps list |
| site pages (untrusted HTML and JS) → headless Chrome | page code asks the browser to load URLs |
| crawl job ↔ database | final writes after a cancel or timeout, stale rows |
| admin/MCP → images/alt | untrusted alt text written into markdown source |
| Phase 17 definition data → migration | admin-entered legacy URLs copied and logged |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-33-71 | Elevation of privilege (SSRF) | Chrome request guard and Fetcher (L3 WR-03) | high | mitigate | allowRequest and Fetcher.Allowed compare the effective port with the site's, so page code can no longer reach other TLS services on the site host's address; TestAllowRequest and TestFetcherPortAndKey pin it (Task 3) |
| T-33-72 | Tampering | route report noindex paths | medium | mitigate | constant-time token as for routes; each entry validated (ValidPagePath, 2048 bytes) and capped at 2000; the set only feeds the sitemap filter (robots, canonical and the resolve answer are untouched); the README recommends a dedicated route_report_token over the 404 token fallback (Task 1) |
| T-33-73 | Denial of service | stuck "running" crawls | medium | mitigate | detached bounded finish, heartbeat every minute, RecoverStale before Start and DeleteCrawls, cancel owned by the job (Task 2) |
| T-33-74 | Tampering (content injection) | SetMarkdownImageAlt | medium | mitigate | only the matched label is replaced; `\`, `[` and `]` are escaped and line breaks folded, so an alt cannot close the image or add a link; code regions are never touched (Task 5) |
| T-33-75 | Information disclosure | migration warn log of dropped url items | low | accept | the values are admin-entered site addresses written to the server log once at migration time |
| T-33-76 | Tampering (integrity) | concurrent sitemap rebuilds | medium | mitigate | one transaction-scoped advisory lock around collect and apply; lastmod of existing content rows never rewritten (Task 4) |
| T-33-SC | Tampering | npm/pip/cargo/Go installs | high | mitigate | no dependency is added in any repository (goldmark, conga and River are already required); go.mod, go.sum and package.json of the four repositories do not change, and the SUMMARY shows `git diff BASE..HEAD -- go.mod go.sum package.json` empty per repository |
</threat_model>
<verification>
- sm-seo-plugin: vet, `test -short`, the Docker suites TestNoindexPathsTracer, TestRouteReport, TestCrawlCancelRunning, TestCrawlTimeout, TestCrawlStaleRecovery, TestCrawlerNonASCII and the existing crawler and filter suites; package crawl tests TestRenderTabTimeout, TestFetcherPortAndKey, TestAllowRequest, TestSitemapNoindexTool; TestAlternates.
- sm-sitemap-plugin: vet, `test -short`, TestIndexNow, TestConcurrentRebuilds, TestRebuildKeepsMovedLastmod, TestMigrateDefinitions, TestTypeTitlesNotPinned, TestHreflangAlternates, TestConvertLegacyItems, TestRecordSavedNilEvent.
- sm-journal-plugin: vet, `test -short`, vitest, TestImageVariantsTallOriginal, TestFixHeadingsCommandCLI, TestSetMarkdownImageAlt, TestContentDescriptorsTranslatedLocales and the existing heading, alt and descriptor suites.
- summercms.go: TestDocsTree, no Go file changed; finally `PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --self-test --go --plugins --docker --admin --docs --marker --additive --compat` (never layers or consumers). The full `--all` gate is run by the orchestrator once, after both 33-15 and 33-16 SUMMARYs exist and before 33-14 Task 4.
</verification>
<success_criteria>
- G1 is closed on the CMS side and G3 is closed; G2 is recorded as not fixable without the framework.
- Every in-scope L1, L2 and L3 finding has a fix and a test that fails before it.
- No repository is pushed or tagged; the release resumes in 33-14 Task 4 after 33-16, followed by re-verification.
</success_criteria>
## Deferred (v0.6.2 backlog item, grouped by repository)
- **sm-sitemap-plugin:** L2 WR-06 (default slug collisions), WR-07 (no 50 MB byte guard), WR-08 (Additional addresses on other hosts); info IN-02 to IN-11.
- **sm-seo-plugin:** L3 WR-02 (crawl limits beyond the job timeout and memory), WR-05 (recheck fetches inside a write transaction); info IN-01 to IN-07; G2 (journal-tag pattern while tag pages are off: needs an additive pact field such as ContentDescriptor.Routable, a framework change, or a signpost rule for an empty DefaultPattern).
- **sm-journal-plugin:** L1 WR-04 (images/alt locale keying), WR-06 (author pages publish admin logins), WR-07 (settings API string/url workaround); info IN-01 to IN-04, IN-08; an untranslated locale's address still answers with the default-locale content and a self canonical (no longer advertised in hreflang or sitemaps); a canonical to the default locale or a 404 is a separate decision.
- **summercms.go:** L1 WR-02 code change (decode WebP in attach with the pure Go decoder explicitly, or a decision note); info IN-05, IN-06, IN-07, IN-09; verifier warnings W1 (home title template once / is registered), W2 (swr localhost canonicals), W3 (route report names without diacritics), W4 (GORM local timestamps), W5 (min/max length change in a patch release, a release decision).
- **Nuxt layers (planned in 33-16, deferred there):** L4 WR-06, WR-07 and the L4 info items.
## Artifacts this phase produces
- sm-seo-plugin: table `golem15_seo_noindex_paths` (migration 202611040001), model `models.NoindexPath`, `(*classes.Service).ReportNoindex`, route report key `noindex` (request and answer), filter reason source; crawl columns `heartbeat_at`, `cancel_requested_at` (migration 202611040002), `crawl.JobTimeout`, `crawl.FinishTimeout`, `crawl.HeartbeatEvery`, `crawl.StaleAfter`, `crawl.RecoverStale`, `crawl.TabOpenTimeout`, `crawl.ToolSitemapSettings`, `Env.SitemapTool`, API and MCP key `cancel_requested`, phrase `crawls.st_cancelling`; `allowRequest` port parameter.
- sm-sitemap-plugin: `contract.Rebuilder` (published by the plugin), column `indexnow_pending_at` (migration 202611040001), `models.ConvertLegacyItems`, `models.DroppedItem`, the rebuild advisory lock, the `WithAfterSlotRead` test seam.
- sm-journal-plugin: `classes.SetMarkdownImageAlt`; descriptor rule for locales with content; images/alt 422 for markdown images it cannot rewrite.
- summercms.go: docs lines in modules/lagoon/README.md and docs/database/attachments.md; updated release-note drafts, release log and deferred items.
- Tests: TestNoindexPathsTracer, TestSitemapNoindexTool, TestCrawlCancelRunning, TestCrawlTimeout, TestCrawlStaleRecovery, TestRenderTabTimeout, TestFetcherPortAndKey, TestCrawlerNonASCII, TestConcurrentRebuilds, TestRebuildKeepsMovedLastmod, TestConvertLegacyItems, TestTypeTitlesNotPinned, TestRecordSavedNilEvent, TestImageVariantsTallOriginal, TestFixHeadingsCommandCLI, TestSetMarkdownImageAlt, TestContentDescriptorsTranslatedLocales; extended TestRouteReport, TestIndexNow, TestMigrateDefinitions, TestConvertH1, TestConvertContentH1, TestConvertTranslationH1, TestSetImageAltEdges, TestHeadingConversion, TestFixHeadingsCommand, TestSetImageAlt, TestAlternates, TestHreflangAlternates, TestAllowRequest.
<output>
Create `.planning/phases/33-seo-output-audit-and-content/33-15-SUMMARY.md` when done: the commits per repository, the finding-to-test table, the number of framework Go files changed since v0.6.0 before and after (unchanged), the G2 record, the gate stages' result, and, if the context ran low, the remaining tasks with their resume points.
</output>

View File

@@ -0,0 +1,227 @@
---
phase: 33-seo-output-audit-and-content
plan: 15
subsystem: go-plugins
tags: [seo, sitemap, journal, crawler, indexnow, hreflang, route-report, gap-closure, postgres, goldmark]
status: complete
requires:
- phase: 33-13
provides: the release decision (after-tags) and the review and verification findings this plan closes
- phase: 33-16
provides: the layer side of the gap-2 contract (vue-seo-layer sends the route report's noindex list)
provides:
- "sm-seo-plugin: route report key noindex (golem15_seo_noindex_paths, models.NoindexPath, ReportNoindex, NoindexPathCount), the sitemap filter's noindex reason source, crawl.ToolSitemapSettings and Env.SitemapTool"
- "sm-seo-plugin: crawl lifecycle (JobTimeout, FinishTimeout, HeartbeatEvery, StaleAfter, RecoverStale, heartbeat_at and cancel_requested_at, cancel owned by the job, API/MCP cancel_requested, crawls.st_cancelling), TabOpenTimeout, effectivePort and the port-aware allowRequest, classes.PathKey and classes.EscapeKeyPath"
- "sm-sitemap-plugin: contract.Rebuilder (published by the plugin), indexnow_pending_at, the rebuild advisory lock, WithAfterSlotRead, models.ConvertLegacyItems and models.DroppedItem, unpinned HTML sitemap headings"
- "sm-journal-plugin: tall-original skip, markdown-safe ConvertContentH1, tokenizer tails kept, journal:fix-headings via lookupDB, SetMarkdownImageAlt and SetImageAltOutsideCode, descriptors with URLs only for locales with content"
- "summercms.go: the attach/webp decoder note in the lagoon README and docs/database/attachments.md (docs only)"
affects: [33-14, 33-VERIFICATION, v0.6.2 backlog]
actuals:
tokens: 45521
tasks: 6
commits: 20
plan_head_before: 8d562004cb05d8d40d12253c23e406259de61006
plan_head_after: fec697b
plan_heads:
summercms.go: { before: 8d56200, after: fec697b, commits: 2, note: "0e95127 and the two 33-16 commits between are 33-16's" }
sm-seo-plugin: { before: 075cf17, after: 2a288a9, commits: 7 }
sm-sitemap-plugin: { before: 1048c01, after: b2b3a1d, commits: 6 }
sm-journal-plugin: { before: 311c28a, after: 0a62090, commits: 5 }
tech-stack:
added: []
patterns:
- "A job's terminal writes run on context.WithoutCancel(jobCtx) with their own bound; the job owns the terminal status, a cancel only records the request"
- "Heartbeat column plus stale recovery inside the start lock, so a row whose job is gone never blocks the one-at-a-time guard"
- "Listener marks (indexnow_pending_at) read and cleared by the next rebuild with a <= read-value condition, so a later mark survives"
- "Whole read-modify-write rebuild under pg_advisory_xact_lock(hashtext(...)) in one transaction"
- "Markdown rewrites only outside goldmark AST code ranges; HTML rewrites only when LooksLikeHTML"
key-files:
created:
- ../sm-seo-plugin/updates/202611040001_create_golem15_seo_noindex_paths.go
- ../sm-seo-plugin/updates/202611040002_add_golem15_seo_crawls_heartbeat.go
- ../sm-seo-plugin/models/noindex_path.go
- ../sm-seo-plugin/crawl_lifecycle_test.go
- ../sm-seo-plugin/classes/crawl/fetch_test.go
- ../sm-sitemap-plugin/updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go
- ../sm-sitemap-plugin/models/legacy_test.go
- ../sm-sitemap-plugin/rebuild_lock_test.go
- ../sm-sitemap-plugin/type_titles_test.go
modified:
- ../sm-seo-plugin/classes/registry.go
- ../sm-seo-plugin/classes/sitemap_filter.go
- ../sm-seo-plugin/controllers/api/registry.go
- ../sm-seo-plugin/classes/crawl/job.go
- ../sm-seo-plugin/classes/crawl/store.go
- ../sm-seo-plugin/classes/crawl/fetch.go
- ../sm-seo-plugin/classes/crawl/render.go
- ../sm-seo-plugin/classes/crawl/render_chrome.go
- ../sm-seo-plugin/classes/linkgraph.go
- ../sm-sitemap-plugin/contract/contract.go
- ../sm-sitemap-plugin/classes/rebuild.go
- ../sm-sitemap-plugin/classes/lastmod.go
- ../sm-sitemap-plugin/models/legacy.go
- ../sm-sitemap-plugin/updates/202610280002_update_golem15_sitemap_settings.go
- ../sm-sitemap-plugin/extensions_settings.go
- ../sm-journal-plugin/classes/image_variants.go
- ../sm-journal-plugin/classes/headings.go
- ../sm-journal-plugin/classes/image_alt.go
- ../sm-journal-plugin/classes/content_descriptors.go
- ../sm-journal-plugin/classes/menu_item_types.go
- ../sm-journal-plugin/controllers/api/maintenance.go
- ../sm-journal-plugin/console/fix_headings.go
- modules/lagoon/README.md
- docs/database/attachments.md
key-decisions:
- "P33-58 to P33-66 implemented as planned; noindex entries that are patterns (* or a :param segment) are skipped and counted, and a percent-encoded entry is stored decoded when that is a valid address (the filter compares decoded paths)"
- "The crawl key's decoded path form lives in classes.PathKey (shared by Fetcher.Key and linkgraph.sitePath); a decoded path holding % or ? keeps its encoded form so Absolute can tell the two forms apart"
- "compareRendered takes the fetcher's Key function, so the rendered comparison inherits the port and path rules"
- "NewRenderer keeps its signature and derives the site's port from its site argument; newChromeRenderer takes the port"
- "G2 not fixed: signpost.Activate refuses a menu item type whose DefaultPattern does not start with /, so the change needs the framework (v0.6.2)"
patterns-established:
- "Gap-closure tests that pin a fix are checked to fail on the old code by swapping the old line back in before committing"
requirements-completed: [SC-1, SC-2, SC-3, D-14, D-24, D-30, D-31, D-32, D-33, D-34, D-50, D-55, D-57, D-85, D-95, D-10]
duration: 2h15m
completed: 2026-11-04
---
# Phase 33 Plan 15: Go plugin gap fixes before the release Summary
**Noindex paths from the route report leave the sitemaps (G1, CMS side), Journal descriptors give only locales with content an address (G3), and every in-scope L1 to L3 review finding is fixed with a test that fails on the old code, in sm-seo-plugin, sm-sitemap-plugin and sm-journal-plugin, plus one framework docs note.**
## Performance
- **Duration:** about 2 h 15 min
- **Started:** 2026-11-04T21:37:51Z
- **Tasks:** 6 of 6
- **Commits:** 20 (seo 7, sitemap 6, journal 5, summercms.go 2), nothing pushed or tagged
## BASE (recorded before Task 1)
| Repository | BASE |
|---|---|
| summercms.go | 8d562004cb05d8d40d12253c23e406259de61006 |
| sm-seo-plugin | 075cf1700797722f35ba77daa2ed408790e4c898 |
| sm-sitemap-plugin | 1048c01fd913173866efd678d0e4bfc28b52dade |
| sm-journal-plugin | 311c28af3adecfabde8bc142703777779590fb35 |
## Commits
**sm-sitemap-plugin** (main)
- 6b67ab7 feat: contract.Rebuilder asks for a debounced rebuild (Task 1 A)
- f58d555 fix: IndexNow hears of deleted and edited records (Task 4 A)
- 2200e46 fix: rebuilds collect under one lock and keep moved lastmods (Task 4 B)
- b37b226 fix: the definitions migration keeps and logs every url item (Task 4 C)
- da32044 fix: HTML sitemap headings follow each locale until an editor sets one (Task 4 D)
- b2b3a1d test: Journal-shaped records in the hreflang test (Task 6 C)
**sm-seo-plugin** (main)
- 9de6b2e feat: noindex paths from the route report leave the sitemaps (tracer) (Task 1 B)
- d7597bb fix: a cancelled or timed-out crawl stores what it fetched and ends (Task 2 A)
- cd71823 fix: a crawl cancel waits for its job, and a stale crawl is ended (Task 2 B)
- cfeb3df fix: bound opening a Chrome tab (Task 2 C)
- 3fdb44b fix: the crawler and the Chrome guard keep to the site's port (Task 3 A)
- e2af5b4 fix: one decoded path form for crawl keys and CMS lookups (Task 3 B)
- 2a288a9 test: Journal-shaped records in the hreflang test (Task 6 B)
**sm-journal-plugin** (main)
- 45d66f6 fix: tall originals no longer stop the image variants job (Task 5 A)
- 0e739c8 fix: H1 conversion leaves markdown and unfinished tags alone (Task 5 B)
- 5f683cb fix: journal:fix-headings runs from the application CLI (Task 5 C)
- 7662d54 fix: image alt texts on markdown posts are written into the markdown (Task 5 D)
- 0a62090 fix: content descriptors list only locales with content (Task 6 A)
**summercms.go** (master)
- 1f96899 docs(lagoon): attach/webp also decodes WebP (Task 6 D, docs only, no Go file)
- fec697b docs(33-15): release notes, release log and deferred items for the gap fixes (Task 6 E)
## Finding to test
| Finding | Fix | Test (fails on the old code) |
|---|---|---|
| G1 (D-24, D-33, D-95, SC-1) | route report `noindex`, stored set, filter reason, `contract.Rebuilder` | TestNoindexPathsTracer, TestRouteReport (extended), TestListing (Rebuilder) |
| G1 (SC-3, D-14) crawler tool | `sitemap_update_settings` / fix: code for a listed noindex address without a record | TestSitemapNoindexTool |
| G3 (D-55, D-57, SC-2) | descriptors give a locale a URL only with content (P33-64) | TestContentDescriptorsTranslatedLocales; TestAlternates and TestHreflangAlternates on Journal-shaped records |
| L1 CR-01 (D-85) | skip a width whose height exceeds 4096 px | TestImageVariantsTallOriginal |
| L1 CR-02 (D-50) | ConvertContentH1 rewrites content only when LooksLikeHTML | TestConvertContentH1, TestConvertTranslationH1, TestHeadingConversion (markdown subtest), TestFixHeadingsCommand (markdown post) |
| L1 WR-01 (D-50) | journal:fix-headings uses lookupDB | TestFixHeadingsCommandCLI |
| L1 WR-02 | docs only (lagoon README, attachments.md) | TestDocsTree, docs:build --check |
| L1 WR-03 | tokenizer tails kept in ConvertH1 and SetImageAlt | TestConvertH1, TestSetImageAltEdges |
| L1 WR-05 (D-85, D-10) | SetMarkdownImageAlt and SetImageAltOutsideCode; 422 changes.N.src otherwise | TestSetMarkdownImageAlt, TestSetImageAlt (markdown part) |
| L2 WR-01 (D-31) | indexnow_pending_at set by RecordDeleted/RecordSaved, read by apply | TestIndexNow (fires the record events), TestIndexNowStaging |
| L2 WR-02 (D-30) | pg_advisory_xact_lock around settings, collect and apply | TestConcurrentRebuilds |
| L2 WR-03 (D-30) | apply writes lastmod only for extras and created rows | TestRebuildKeepsMovedLastmod |
| L2 WR-04 (D-32) | ConvertLegacyItems, per-item warn log | TestConvertLegacyItems, TestMigrateDefinitions (extended) |
| L2 WR-05 (D-34) | the form loads stored headings only | TestTypeTitlesNotPinned |
| L2 IN-01 | nil check before reading ev | TestRecordSavedNilEvent |
| L3 CR-01 (D-14) | detached bounded finish, time-limit failure, LoadLimits fallback, canceled fetches | TestCrawlTimeout, TestCrawlCancelRunning |
| L3 CR-01 stale | heartbeat_at, RecoverStale before Start and DeleteCrawls | TestCrawlStaleRecovery |
| L3 WR-01 | cancel_requested_at; the job writes cancelled | TestCrawlCancelRunning |
| L3 WR-03 | effective-port check in Fetcher.Allowed, Key, allowRequest | TestAllowRequest (new rows), TestFetcherPortAndKey, TestCrawlerNonASCII (8443 link) |
| L3 WR-04 | one decoded path form (classes.PathKey), Absolute escapes | TestFetcherPortAndKey, TestCrawlerNonASCII |
| L3 WR-06 | one deadline for tab open and render | TestRenderTabTimeout |
TestCrawlerNonASCII (L3 WR-04), TestRebuildKeepsMovedLastmod (L2 WR-03) and TestTypeTitlesNotPinned (L2 WR-05) were also run with the old code swapped back in and failed there; the other new tests assert behaviour or schema the old code did not have (new columns, keys, functions), so they cannot pass on it.
## Framework Go files changed since v0.6.0
22 at BASE, 22 at HEAD: this plan changed no framework Go file (1f96899 changes two markdown files).
## G2 (not fixed)
G2 (the site answer lists the journal-tag pattern while `golem15.journal.tag_pages` is false) stays open for v0.6.2: `signpost.Activate` refuses a menu item type whose DefaultPattern does not start with `/` (modules/signpost/signpost.go), so sm-journal-plugin cannot drop the pattern while tag pages are off, and dropping the descriptor would remove the tag form's SEO tab and the sitemap types row. It needs an additive pact field (for example `ContentDescriptor.Routable`) or a signpost rule. Recorded in deferred-items.md ("From 33-12" entry and "From 33-15").
## Gate stages
`PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --self-test --go --plugins --docker --admin --docs --marker --additive --compat`: exit 0, `PASS` for self-test, go, plugins, docker, admin, docs, marker, additive and compat. The compat stage prints `refuse:` lines for sm-feedback-plugin, sm-presentations-plugin and sm-quizzes-plugin and skips them because they fail at v0.6.0 too (they do not resolve the framework through a workspace); every other consumer builds. The layers and consumers stages were not run (33-16's and the orchestrator's `--all`).
Per task, each repository's `go vet ./...` and `go test -short ./...` stayed green, the plan's Docker suites passed (the full sm-seo-plugin suite in 116 s, the full sm-sitemap-plugin and sm-journal-plugin suites), sm-journal-plugin's vitest passed (257 tests), and `go test ./cmd/summer -run TestDocsTree` and `summer docs:build --check` passed. `go.mod`, `go.sum` and `package.json` of all four repositories are unchanged since BASE (T-33-SC). `go list -deps` of sm-seo-plugin lists only `sm-sitemap-plugin/contract` (D-95). No exported Journal function was removed or changed its signature (`git diff 311c28a..HEAD` check empty, D-106); menu_item_types_test.go and menu_item_types_smoke_test.go are unchanged and pass.
## For 33-14 Task 4
- **New migrations:** sm-seo-plugin `202611040001_create_golem15_seo_noindex_paths`, `202611040002_add_golem15_seo_crawls_heartbeat`; sm-sitemap-plugin `202611040001_add_golem15_sitemap_urls_indexnow_pending`.
- **Edited migration:** sm-sitemap-plugin `202610280002_update_golem15_sitemap_settings` now converts the url items through `models.ConvertLegacyItems`. Untagged, so no production database ran the old one; the local rehearsal databases of 33-12 (demo) and 33-13 (grzyby) ran it and keep its old result. **Recreate them from their source dumps before the 33-14 rehearsal.**
- **Release notes:** the drafts of sm-seo-plugin v0.2.0, sm-sitemap-plugin v0.2.0, sm-journal-plugin v0.4.0 and summercms v0.6.1 carry the fixes (fec697b); the sitemap draft names the `definition url item not copied` log line and the automatic noindex exclusion; the Journal draft states the descriptor rule as a behaviour change.
- **Release log:** 1f96899 is listed under "Framework commits of later Phase 33 plans".
- **Version pins:** sm-seo-plugin now needs `contract.Rebuilder`, so its go.mod must require sm-sitemap-plugin v0.2.0 when tagged (development resolves it through go.work).
## Deviations from Plan
### Auto-fixed and adjusted
**1. [Rule 2] Route report noindex entries that are patterns are refused, and encoded entries stored decoded.** The contract says entries carry no `:` parameter or `*`; ReportNoindex skips such entries and counts them in `skipped`, and stores a percent-encoded path decoded when that is a valid address, because the filter compares decoded paths. Commit 9de6b2e.
**2. [Rule 3] Decoded path form shared in sm-seo-plugin's classes package.** `Fetcher.Key` and `linkgraph.sitePath` both use `classes.PathKey`, with `classes.EscapeKeyPath` for request URLs; a decoded path holding `%` or `?` keeps its encoded form so the two forms never collide. The acceptance grep for `u.Path` in fetch.go therefore finds it in classes/linkgraph.go instead. Commit e2af5b4.
**3. [Rule 3] compareRendered takes the fetcher's Key function** instead of a host list, so the rendered comparison inherits the port and path rules. NewRenderer keeps its exported signature and derives the port from its site argument; only the unexported newChromeRenderer and allowRequest take the port. Commit 3fdb44b.
**4. [Rule 3] Tests added in their own files:** rebuild_lock_test.go and type_titles_test.go (sm-sitemap-plugin, the latter with a fake plugin whose type label has en and pl translations), crawl_lifecycle_test.go (sm-seo-plugin); TestCrawlerNonASCII is in crawler_test.go, TestFixHeadingsCommandCLI in image_variants_cli_test.go.
**5. [Rule 1] Existing Journal descriptor tests updated for the G3 behaviour change.** `seedContent` now gives the category a pl name and the tag a translated published post; TestContentDescriptorsMatrix expects `pl=` for the untranslated draft and tag, and TestJournalAuthorType translates Ada's post and expects `pl=` for Bob. menu_item_types_test.go and the smoke test are untouched (D-106). Commit 0a62090.
**6. Task 2 commit split.** Groups A and B were written together and then split: A (d7597bb) carries the detached finish, the time-limit status, the LoadLimits fallback and canceled fetches, with TestCrawlTimeout; B (cd71823) adds the columns, heartbeat, job-owned cancel and RecoverStale with TestCrawlCancelRunning and TestCrawlStaleRecovery. Each commit was green on its own.
**7. SetImageAltOutsideCode exported** next to SetMarkdownImageAlt (the plan's "helper that runs a rewrite only outside goldmark code ranges"); additive.
### Not done
- `requirements.mark-complete` was not run: it would leave REQUIREMENTS.md modified outside the ROADMAP-only tracking commit.
## Known Stubs
None.
## Threat Flags
None beyond the plan's threat register: T-33-71 (port guard), T-33-72 (noindex entries validated, capped, token as for routes), T-33-73 (crawl lifecycle), T-33-74 (escaped alt labels, code untouched) and T-33-76 (rebuild lock) are mitigated as planned.
## Self-Check: PASSED
All created files exist; every commit hash above is in its repository's `git log`.

View File

@@ -0,0 +1,405 @@
---
phase: 33-seo-output-audit-and-content
plan: 16
type: execute
wave: 10
depends_on: ["33-13"]
gap_closure: true
files_modified:
- ../vue-seo-layer/lib/routes.ts
- ../vue-seo-layer/lib/seo-module.ts
- ../vue-seo-layer/lib/options.ts
- ../vue-seo-layer/lib/sitemapPages.ts
- ../vue-seo-layer/server/seo-routes.d.ts
- ../vue-seo-layer/server/lib/routeReport.ts
- ../vue-seo-layer/server/lib/site.ts
- ../vue-seo-layer/server/middleware/seo-root.ts
- ../vue-seo-layer/server/plugins/seo-route-report.ts
- ../vue-seo-layer/app/components/global/SeoHtmlSitemapPage.vue
- ../vue-seo-layer/app/components/Seo/SitemapLink.vue
- ../vue-seo-layer/app/utils/pageHref.ts
- ../vue-seo-layer/.playground/nuxt.config.ts
- ../vue-seo-layer/testing/smoke-ssr.mjs
- ../vue-seo-layer/testing/expect-seo.txt
- ../vue-seo-layer/testing/expect-seo-down.txt
- ../vue-seo-layer/tests/routes.test.ts
- ../vue-seo-layer/tests/sitemapPages.test.ts
- ../vue-seo-layer/tests/pageHref.test.ts
- ../vue-seo-layer/tests/rootFiles.test.ts
- ../vue-seo-layer/package.json
- ../vue-seo-layer/README.md
- ../vue-journal-layer/.playground/nuxt.config.ts
- ../vue-journal-layer/app/journal-pages/PostPage.vue
- ../vue-journal-layer/app/utils/seo.ts
- ../vue-journal-layer/app/utils/routes.ts
- ../vue-journal-layer/lib/journal-module.ts
- ../vue-journal-layer/tests/seo.test.ts
- ../vue-journal-layer/tests/routes.test.ts
- ../vue-journal-layer/testing/expect-acme.txt
- ../vue-journal-layer/scripts/check-git-install.sh
- ../vue-journal-layer/package.json
- ../vue-journal-layer/README.md
- ../vue-menu-layer/package.json
- ../vue-menu-layer/README.md
- ../vue-faq-layer/package.json
- ../vue-faq-layer/README.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-seo-layer-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-journal-layer-v0.8.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-menu-layer-v0.5.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-faq-layer-v0.5.0.md
autonomous: true
requirements: [SC-1, SC-2, D-08, D-22, D-23, D-24, D-33, D-34, D-40, D-42, D-97]
estimate:
tokens: 150000
raw_tokens: 150000
tasks: 4
confidence: low
must_haves:
truths:
- "G1 layer side (D-23, D-24, D-33, SC-1): the route report body carries noindex, the static paths the build serves noindex (requiresAuth, a noindex or none seo.robots, a static page under seo.noindexRoutes), including the @nuxtjs/i18n locale-prefixed copies, never patterns and never the layer's sitemap pages, within 2000 entries of at most 2048 bytes, and the whole JSON body stays at or under 4,113,024 bytes (the older plugin's limit), dropping noindex entries first, exactly as the gap-2 contract below; it is always sent (also []), with the same token and request"
- "L4 WR-01 (D-34, D-42): a path-form group page 1 of the HTML sitemap (/mapa-strony/<group>/strona/1) answers one 301 to the unnumbered group page, using the locale's segment; the page never redirects to its own URL"
- "L4 WR-04 (D-34): when an app page renders the sitemap path through a catch-all (a root /** page, or a prefixed one covering the path), the layer registers no sitemap pages for that locale and logs it at build, unless seo.htmlSitemap.overCatchAll is true; the switch and the upgrade note are documented in the vue-seo-layer README and the journal, menu and FAQ upgrade notes"
- "L4 WR-05 (D-34): with @nuxtjs/i18n the HTML sitemap pages exist once per locale, at the configured path, named for that locale (no copy under another locale's prefix or name); SitemapLink goes to the visitor's locale route and renders only when that path is the layer's sitemap page"
- "L4 WR-08 (D-08, D-22): while the backend has not answered since the server started, /robots.txt, /sitemap.xml and /llms.txt answer 503 with Retry-After: 60 instead of falling through to the app; a backend that answers 404 for the site endpoint (older than SEO v0.2.0) still passes through; a staging site therefore never exposes an allow-all robots.txt"
- "L4 WR-02 (D-97, SC-2): a journal post page emits exactly one og:type article and article:published_time and article:modified_time from the post data whether or not the CMS answers; the CMS-owned keys still come from the CMS when it answers"
- "L4 WR-03 (D-40, D-42): the journal registers its path-form listing routes from the SEO module's resolved pagination option (defaults included), so with seo.pagination.form path alone the Polish listings get /<listing>/strona/:page routes"
- "L4 CR-01 (release guard): vue-journal-layer/scripts/check-git-install.sh --check-links <layer dirs> fails while any given layer's package.json has a link:, file:, workspace: or portal: dependency, the tag mode fails when the installed tag still has one, and --self-test covers both; the swap itself stays in 33-14 Task 4"
- "L4 CR-01: the version fields read vue-seo-layer 0.2.0, vue-journal-layer 0.8.0, vue-menu-layer 0.5.0 and vue-faq-layer 0.5.0, and each README's install line pins that tag"
- "The 33-14-notes-vue-*.md drafts describe the changed behaviour (route report noindex, root files 503, sitemap pages per locale and over a catch-all, journal pagination routes)"
prohibitions:
- requirement_id: "D-97"
category: compatibility
status: resolved
verification: test
statement: "The route report stays compatible both ways: an SEO plugin built before the gap-2 contract still answers 200 to the new body (the fixture API ignores noindex like encoding/json), and the layer still works against a backend without the registry (404, not retried)"
- requirement_id: "D-70"
category: safety
status: resolved
verification: test
statement: "No change weakens the build guard or the noindex headers: guard:check and the expect-seo.txt noindex lines pass unchanged"
artifacts:
- path: "../vue-seo-layer/lib/sitemapPages.ts"
provides: "the pure builder of the HTML sitemap routes (per locale, i18n names, catch-all rule)"
contains: "overCatchAll"
- path: "../vue-seo-layer/lib/routes.ts"
provides: "noindexStaticRoutes for the route report"
contains: "noindexStaticRoutes"
- path: "../vue-journal-layer/scripts/check-git-install.sh"
provides: "the --check-links release guard"
contains: "--check-links"
key_links:
- from: "../vue-seo-layer/server/plugins/seo-route-report.ts"
to: "#seo-routes noindexPaths"
via: "routeReportBody(staticRoutes, noindexPaths) posts {routes, noindex}"
pattern: "noindexPaths"
- from: "../vue-seo-layer/lib/seo-module.ts"
to: "../vue-seo-layer/lib/sitemapPages.ts"
via: "a pages:resolved hook registered at modules:done, after @nuxtjs/i18n has localised the routes"
pattern: "modules:done"
- from: "../vue-journal-layer/lib/journal-module.ts"
to: "runtimeConfig.public.seo.pagination"
via: "journalPaginationSource inside the extendPages callback"
pattern: "journalPaginationSource"
---
<!-- planner-discipline-allow: seo -->
## Phase Goal
**As a** site editor and as an SEO specialist auditing a SummerCMS site, **I want to** have the rendered sites emit complete SEO output (sitemaps, structured data, pagination, hreflang, headings, breadcrumbs) from the CMS, and an audit that finds the remaining problems, **so that** sites are indexed correctly and issues can be fixed through MCP.
This gap-closure plan fixes the Nuxt-layer side of the gaps and review findings that block the 33-14 release: G1 (layer side) and the in-scope findings of review lane L4. Plan 33-15 fixes the Go plugins in parallel (same wave, no shared files; the gap-2 contract below is fixed in both plans). 33-14 Task 4 (the release, including the `link:../vue-seo-layer` swap) resumes after both, followed by re-verification.
<objective>
Fix, each with a test, in the four Nuxt layers (each main, not pushed, not tagged):
- vue-seo-layer: the route report's noindex paths (G1, D-23, D-24, D-33); the HTML sitemap pages: the page-1 redirect, catch-all apps, i18n copies, the footer link (L4 WR-01, WR-04, WR-05, D-34); root files while the backend is down (L4 WR-08, D-08, D-22);
- vue-journal-layer: article meta on post pages (L4 WR-02, D-97) and path-form pagination routes from the SEO module's resolved option (L4 WR-03, D-40, D-42);
- all four layers: the release guard against link: dependencies, the version fields and the README install pins (L4 CR-01), and the catch-all upgrade notes (L4 WR-04);
- summercms.go: the four vue release-note drafts (planning docs).
Purpose: close G1 on the layer side and the release-blocking L4 findings before the tags.
Output: commits in vue-seo-layer, vue-journal-layer, vue-menu-layer, vue-faq-layer, and a planning-docs commit in summercms.go.
**Planner decisions recorded here (P33-67 to P33-72; 33-15 used P33-58 to P33-66):**
- **P33-67 (noindex paths in the build artefact):** `noindexStaticRoutes(pages, noindexRoutes)` in lib/routes.ts takes the same flattened page list as `staticRoutes` and keeps the paths without `:` or `*` that are noindex by meta (`pageMetaRobots` with `robotsNoindex`) or under `seo.noindexRoutes` (`isNoindex`), client-only pages included, the layer's `seo-sitemap-` pages excluded, i18n copies kept (no `localeCopySuffixes` filter), sorted. `#seo-routes` exports it as `noindexPaths`; `routeReportBody(paths, noindex)` answers `{routes, noindex}` with the same limits for both lists; the report always sends `noindex`, so the plugin's set follows each build.
- **P33-68 (sitemap page registration):** a pure builder `seoSitemapPages(input)` in lib/sitemapPages.ts answers the routes to add and the skipped locales with a reason (`taken`, `catch-all`). The module calls it from a `pages:resolved` hook that it registers in `modules:done`, so it runs after @nuxtjs/i18n has localised the app's routes in either `scanPageMeta` mode, and it first removes routes it added before (dev regeneration). Per locale of `htmlSitemap.paths`: the overview at the path, the group page at `<path>/:group` and, in the path form, `<path>/:group/<segment>/:page(\d+)` with the locale's segment; with i18n active (strategy other than `no_prefix`) each name gets `<routesNameSeparator, default ___><locale>` so i18n reads the right locale; a final page at the same path is `taken`; a catch-all page whose pattern covers the path (`patternCovers` from lib/guard.ts) makes it `catch-all` unless `htmlSitemap.overCatchAll` is true. Skips are logged at build with the reason and the switch.
- **P33-69 (first page of a group):** `seoFirstPageRedirect(fullPath, form, segment, param): string | null` in app/utils/pageHref.ts answers the unnumbered target, or null when the target equals `fullPath`; SeoHtmlSitemapPage passes the locale's segment from the site answer's `pagination.segments`, else the build option's, else the param.
- **P33-70 (root files while unknown):** `rootFileTargets` answers the backend target of the fixed names (robots.txt, sitemap.xml, llms.txt) also in state `unknown` without a last answer, so the fetch fails and the middleware's 503 with Retry-After applies; `absent` (an older backend) passes through as before; sitemap files and verification files keep needing a site answer.
- **P33-71 (journal pagination source):** `journalPaginationSource(nuxtOptions)` in app/utils/routes.ts answers `runtimeConfig.public.seo.pagination` (written by the SEO module's setup with its defaults) when present, else the raw `seo.pagination`; the journal module calls it inside its `extendPages` callback, which runs after every module's setup. No import from vue-seo-layer (33-09: a git-installed layer's .ts under node_modules is not type-stripped by Node).
- **P33-72 (release guard):** `scripts/check-git-install.sh --check-links DIR...` reads each `DIR/package.json` with node and prints `check-git-install: <dir>: <name> depends on <spec>` for every dependencies, devDependencies, peerDependencies or optionalDependencies entry whose spec starts with `link:`, `file:`, `workspace:` or `portal:`, exiting 1 when any is found; the tag mode runs the same check on the installed `node_modules/vue-journal-layer` before building; `--self-test` adds planted package.json cases.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/33-seo-output-audit-and-content/33-VERIFICATION.md
@.planning/phases/33-seo-output-audit-and-content/33-REVIEW.md
@.planning/phases/33-seo-output-audit-and-content/deferred-items.md
@.planning/phases/33-seo-output-audit-and-content/33-CONTEXT.md
@.planning/phases/33-seo-output-audit-and-content/33-08-SUMMARY.md
@.planning/phases/33-seo-output-audit-and-content/33-09-SUMMARY.md
@CLAUDE.md
<interfaces>
vue-seo-layer:
- lib/seo-module.ts: `SEO_MODULE_DEFAULTS` (pagination `{form:'query', param:'page', segments:{pl:'strona', en:'page'}}`, htmlSitemap `{paths:{pl:'/mapa-strony', en:'/sitemap'}}`); setup: guard hooks (`nitro:config`, `nitro:init`, `pages:resolved`, `nitro:build:before`), `extendPages` registering `seo-sitemap-<locale>`, `seo-sitemap-group-<locale>`, `seo-sitemap-group-page-<locale>` with `meta.seoSitemap.locale` (a `taken` exact-path check only), `addServerTemplate('#seo-routes')` from `staticRoutes(pages, noindexRoutes, localeCopySuffixes(i18n))` and `routePatterns(pages)`, `runtime.public.seo = {…, pagination, htmlSitemap}`.
- lib/routes.ts: `robotsNoindex`, `pageMetaRobots`, `isLayerPage`, `localeCopySuffixes`, `staticRoutes`, `routePatterns`, `routesTemplate(staticPaths, patterns)`; lib/guard.ts: `flattenPages`, `isNoindex`, `patternCovers`, `pagePattern`; lib/options.ts: `paginationOption`, `htmlSitemapOption`, `SeoHtmlSitemapOption`.
- server/lib/routeReport.ts: `ROUTE_REPORT_MAX_ROUTES` 2000, `ROUTE_REPORT_MAX_BYTES` 2048, `routeReportBody(paths)`, `routeReportOutcome`; server/plugins/seo-route-report.ts posts `body` once per start with one retry; server/seo-routes.d.ts types `#seo-routes`.
- server/lib/site.ts: `SeoSiteState` (ok, absent, unknown), `siteAnswer` (keeps lastOk), `rootFileTargets(path, site, backendBase, apiBase)` (null unless state ok), `FIXED`; server/middleware/seo-root.ts (503 with Retry-After on a failed fetch).
- app/components/global/SeoHtmlSitemapPage.vue: `explicitFirst` → `navigateTo(seoPageHref(route.fullPath, 1, form, '', param), {redirectCode: 301})`; app/components/Seo/SitemapLink.vue: locale from props, the resolve answer, html_lang, the site default; href from `config.public.seo.htmlSitemap.paths[locale]`; app/utils/pageHref.ts `seoPageHref`, `seoPageNumber`.
- testing/smoke-ssr.mjs grammar `routereport N [has=PATH]... [lacks=PATH]...` (checks the last report's routes; the token); expect-seo.txt line `routereport 1 has=/ … lacks=/konto lacks=/szkic lacks=/prywatne lacks=/mapa-strony`; expect-seo-down.txt expects `404 /robots.txt noheader=Retry-After`; the playground has a root `[...slug].vue`, `konto.vue` (requiresAuth), `szkic.vue` (seo.robots noindex, follow), `/prywatne/**` in noindexRoutes, htmlSitemap paths pl `/mapa-strony`, en `/en/sitemap`.
vue-journal-layer:
- app/journal-pages/PostPage.vue: `fallback` null when `cmsHeadPresent(answer)`, every `useSeoMeta` key from it (og:type and article times lost when the CMS answers); app/utils/seo.ts `postSeoMeta`, `cmsHeadPresent`.
- lib/journal-module.ts: `journalPagedRoutes(routes, nuxt.options.seo?.pagination)` computed in setup from the raw option; app/utils/routes.ts `journalPagedRoutes`, `journalPagedRouteName`.
- .playground: i18n `prefix_except_default`, en default, pl prefixed; no pages of its own; its built server today contains the route names seo-sitemap-en___pl and seo-sitemap-pl___en (the WR-05 evidence).
- scripts/check-git-install.sh: `--self-test` (lockfile reading), tag mode (scratch app, `pnpm install`, lockfile pin, build, expect-acme.txt); package.json version 0.7.1 and `"vue-seo-layer": "link:../vue-seo-layer"`.
vue-menu-layer, vue-faq-layer: package.json version 0.4.0 with the same link dependency; README install lines pin #v0.2.0; "Upgrading from 0.4" sections.
Gate: `scripts/check-phase33.sh --layers` runs every layer's `npm run test`, `build:playground`, vue-seo-layer's `smoke:ssr`, `guard:check`, `purge:check`, the journal's expect-acme*.txt runs and `check-git-install.sh --self-test`, menu and FAQ `smoke:ssr`.
</interfaces>
</context>
## Gap-2 contract (fixed; identical in 33-15 and 33-16)
The route report gains an optional `noindex` array of static paths, sent with the same token on the same request:
```
POST /_seo/api/v1/registry/routes
Authorization: Bearer <golem15.seo.route_report_token, else golem15.seo.notfound_token>
Content-Type: application/json
{"routes": ["/", "/blog", "/kontakt"], "noindex": ["/konto", "/pl/konto", "/szkic"]}
```
1. `routes`: unchanged (required array of strings).
2. `noindex`: optional array of strings, at most 2000 entries, each starting with `/`, without a `:` parameter or `*`, at most 2048 bytes in UTF-8. It lists every static path the frontend's build serves noindex: pages whose meta has `requiresAuth: true` or a `seo.robots` value with `noindex` or `none`, and static pages under a `seo.noindexRoutes` pattern. The `@nuxtjs/i18n` copies of those pages in other locales are listed as their own locale-prefixed paths (`/pl/konto`). Patterns (`/p/**`) are never sent, the layer's HTML sitemap pages never, and a path is never in both lists.
3. Plugin semantics: key absent → the stored set is unchanged; key present (also `[]`) → the stored set becomes exactly its valid entries, normalised like `routes` (`normalPagePath` with the site's address options); an invalid entry is skipped and counted in `skipped`; more than 2000 entries → 422 `{"error":"too_many_routes","max":2000}` and nothing is stored.
4. The answer gains one key, the number of stored paths: `{"inserted":1,"updated":3,"skipped":0,"reported_at":"2026-11-04T20:00:00Z","noindex":3}`.
5. The SEO sitemap filter excludes any candidate (record, registry page, additional address) whose normalised path is in the set, with reason `noindex`, from the XML and HTML sitemaps. A changed set requests one debounced sitemap rebuild.
6. Compatibility: a layer that sends no `noindex` keeps working (the set stays as it is). A plugin built before this contract decodes the body into `{routes}` and ignores the unknown key (encoding/json without DisallowUnknownFields), and it reads at most `MaxReportedRoutes*(MaxRouteBytes+8)+1024` = 2000*(2048+8)+1024 = 4,113,024 bytes of body (sm-seo-plugin controllers/api/registry.go:21, `maxRouteReportBody`). The layer therefore keeps the serialised JSON body at or under 4,113,024 bytes: it drops `noindex` entries from the end first, and only when the body is still too large `routes` entries from the end, so an older plugin never refuses the body for its size. A plugin built with this contract accepts at least that size (its cap covers both lists). The layer ignores the answer body.
## Execution units and resume points
- Run from summercms.go. Commit groups per repository, staged by explicit path (never `git add -A`); no attribution trailers; code and planning docs in separate commits; a README change goes in the same commit as the behaviour or option it describes. Nothing is pushed or tagged. STATE.md changes only through `msd_run query state.*` handlers and is never committed.
- Each layer commit keeps that layer's `npm run test` green; a task's verify adds the playground build and smokes. Node ≥ 22.18 as in the layers' engines.
- 33-15 runs in parallel and commits to summercms.go too: if git reports `.git/index.lock`, wait and retry; never remove another session's lock or stage its files. deferred-items.md and 33-release-log.md belong to 33-15 in this wave; report the layer-side statuses in this plan's SUMMARY instead of editing them.
- Do not replace the `link:../vue-seo-layer` dependencies: 33-14 Task 4 does that before tagging.
- **Gate stages:** this plan runs only `scripts/check-phase33.sh --self-test --layers`, because 33-15 changes the Go plugins in parallel. It does not run consumers: that stage builds the four apps' Go binaries from their own plugin submodules (`plugins/golem15/*` in each app's go.work) and their Nuxt apps against the layer tags pinned in their package.json (git+https, not these checkouts), and checks the 33-12/33-13/33-14 patches against the apps, so no change of this plan reaches it. The orchestrator runs the full `PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --all` once, after both 33-15-SUMMARY.md and 33-16-SUMMARY.md exist and before 33-14 Task 4.
- Every `<automated>` command starts with `set -o pipefail`, chains with `&&`, or captures the exit status explicitly, so a failing command is never hidden by a later pipe stage.
- **Executor note (context budget):** if the context runs low, stop only after a complete task (all its commit groups committed and its verify green), write the SUMMARY with the remaining tasks and their resume points for a continuation run. Every task is independently committable.
- Resume check per repository: `git -C <repo> log --format=%s | grep -Fx '<subject>'`.
| Task | Commit groups, in order | Resume point |
|------|-------------------------|--------------|
| 1 | seo-layer: `feat: the route report sends the noindex static paths (tracer)` | the routereport noindex smoke line passes |
| 2 | seo-layer: A `fix: HTML sitemap page 1 redirects with the locale's segment`; B `fix: HTML sitemap pages once per locale, never over a catch-all by default`; C `fix: root files answer 503 while the backend has not answered`; journal-layer: D `test: the playground's HTML sitemap paths per locale` | sitemapPages.test.ts passes and the journal playground build has one sitemap route per locale |
| 3 | journal-layer: A `fix: post pages keep og:type article and their article times`; B `fix: path-form listing routes use the SEO module's resolved pagination` | the og:type smoke line and the routes test pass |
| 4 | journal-layer: A `feat: check-git-install --check-links refuses local dependencies`; each layer: B `chore: version <x.y.z> and install pin` with its README notes; here: C `docs(33-16): release-note drafts for the layer fixes` | plan complete |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "the Nuxt server's route report tells the CMS which static paths it serves noindex" — one path only (G1, layer side)</name>
<files>../vue-seo-layer/lib/routes.ts, ../vue-seo-layer/lib/seo-module.ts, ../vue-seo-layer/server/seo-routes.d.ts, ../vue-seo-layer/server/lib/routeReport.ts, ../vue-seo-layer/server/plugins/seo-route-report.ts, ../vue-seo-layer/testing/smoke-ssr.mjs, ../vue-seo-layer/testing/expect-seo.txt, ../vue-seo-layer/tests/routes.test.ts, ../vue-seo-layer/README.md</files>
<read_first>
- ../vue-seo-layer/lib/routes.ts and lib/guard.ts (flattenPages, isNoindex)
- ../vue-seo-layer/lib/seo-module.ts (the #seo-routes server template) and server/seo-routes.d.ts
- ../vue-seo-layer/server/lib/routeReport.ts and server/plugins/seo-route-report.ts
- ../vue-seo-layer/testing/smoke-ssr.mjs (the routereport grammar, lines ~15 and ~236-257) and testing/expect-seo.txt (the routereport line), testing/fixture-api.mjs (records the request body)
- ../vue-seo-layer/tests/routes.test.ts (staticRoutes, localeCopySuffixes, routeReportBody cases)
- the "Gap-2 contract" section of this plan
</read_first>
<behavior>
- noindexStaticRoutes: a requiresAuth page, a page with seo.robots "noindex, follow" and a static page under /prywatne/** are listed; an ordinary page, a page with parameters, a catch-all and a layer seo-sitemap- page are not; with i18n copies (names ending in ___pl) the /pl/... copy of a noindex page is listed too; the result is sorted and has no path that staticRoutes lists
- routesTemplate exports noindexPaths; routeReportBody(paths, noindex) answers {routes, noindex}, both filtered to paths starting with / within 2048 bytes and cut to 2000
- routeReportBody keeps the serialised JSON at or under ROUTE_REPORT_MAX_BODY (2000*(2048+8)+1024 = 4,113,024 bytes, the older plugin's limit): 2000 routes of 2048 bytes plus 100 noindex paths of 200 bytes answer all 2000 routes and only the leading noindex entries that fit (a prefix of the input); small lists come back whole; routes that alone exceed the limit (paths full of characters JSON escapes) are cut from the end with noindex empty
- Smoke: routereport 1 has=/ lacks=/konto noindex=/konto noindex=/szkic noindex=/prywatne lacksnoindex=/ lacksnoindex=/mapa-strony
</behavior>
<action>
Per G1, D-23, D-24, D-33 and the gap-2 contract above (P33-67): tests first; `noindexStaticRoutes` in lib/routes.ts; `routesTemplate(staticPaths, patterns, noindexPaths)` adds `export const noindexPaths`; the module passes it; server/seo-routes.d.ts declares it; `routeReportBody(paths, noindex)` applies the same filter and limits to both lists and then keeps `Buffer.byteLength(JSON.stringify(body))` at or under the new `ROUTE_REPORT_MAX_BODY = ROUTE_REPORT_MAX_ROUTES * (ROUTE_REPORT_MAX_BYTES + 8) + 1024` (the older plugin's `maxRouteReportBody`, gap-2 contract point 6) by dropping `noindex` entries from the end first and then `routes` entries, with tests first in tests/routes.test.ts (the behaviour above); the server plugin imports `noindexPaths` and logs "route report: N routes and M noindex paths sent". smoke-ssr.mjs: the routereport line accepts `noindex=PATH` (present in the last report's noindex list) and `lacksnoindex=PATH`, and the header comment documents them; expect-seo.txt's routereport line gains the checks of the behaviour above. README: the route report paragraph gets the exact JSON of the gap-2 contract and says which pages land in `noindex`; the `routeReport` option row mentions it. Commit as listed.
</action>
<verify>
<automated>set -o pipefail; npm --prefix ../vue-seo-layer run test 2>&1 | tail -8</automated>
<fails_when>non-zero exit, a "not ok" line, or a "# fail" count above 0</fails_when>
<automated>set -o pipefail; npm --prefix ../vue-seo-layer run build:playground 2>&1 | tail -3 && node ../vue-seo-layer/testing/smoke-ssr.mjs --output ../vue-seo-layer/.playground/.output --fixtures ../vue-seo-layer/testing/fixtures --expect ../vue-seo-layer/testing/expect-seo.txt 2>&1 | tail -10</automated>
<fails_when>non-zero exit, or a "not ok", "FAIL" or "routereport" failure line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "export function noindexStaticRoutes" ../vue-seo-layer/lib/routes.ts` prints one line
- `grep -n "ROUTE_REPORT_MAX_BODY" ../vue-seo-layer/server/lib/routeReport.ts ../vue-seo-layer/tests/routes.test.ts` prints a line in each
- `grep -n "noindexPaths" ../vue-seo-layer/server/plugins/seo-route-report.ts ../vue-seo-layer/server/seo-routes.d.ts` prints a line in each
- `grep -n "noindex=/konto" ../vue-seo-layer/testing/expect-seo.txt` prints one line
- `grep -n '"noindex"' ../vue-seo-layer/README.md` prints a line (the contract JSON)
</acceptance_criteria>
<done>Each server start tells the CMS the static paths it serves noindex, so the sitemaps can leave them out.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: HTML sitemap pages: page-1 redirect, catch-all apps, once per locale with i18n, the footer link; root files 503 while the backend is down (L4 WR-01, WR-04, WR-05, WR-08)</name>
<files>../vue-seo-layer/lib/sitemapPages.ts, ../vue-seo-layer/lib/seo-module.ts, ../vue-seo-layer/lib/options.ts, ../vue-seo-layer/app/components/global/SeoHtmlSitemapPage.vue, ../vue-seo-layer/app/components/Seo/SitemapLink.vue, ../vue-seo-layer/app/utils/pageHref.ts, ../vue-seo-layer/server/lib/site.ts, ../vue-seo-layer/server/middleware/seo-root.ts, ../vue-seo-layer/.playground/nuxt.config.ts, ../vue-seo-layer/testing/expect-seo-down.txt, ../vue-seo-layer/tests/sitemapPages.test.ts, ../vue-seo-layer/tests/pageHref.test.ts, ../vue-seo-layer/tests/rootFiles.test.ts, ../vue-seo-layer/README.md, ../vue-journal-layer/.playground/nuxt.config.ts</files>
<read_first>
- ../vue-seo-layer/lib/seo-module.ts (the extendPages block, the guard hooks, runtime.public.seo) and lib/options.ts (htmlSitemapOption), lib/guard.ts (patternCovers, flattenPages, pagePattern), lib/routes.ts (localeCopySuffixes)
- ../vue-seo-layer/app/components/global/SeoHtmlSitemapPage.vue, app/components/Seo/SitemapLink.vue, app/seo-pages/SitemapPage.vue and SitemapGroupPage.vue (route.meta.seoSitemap), app/utils/pageHref.ts and tests/pageHref.test.ts
- ../vue-seo-layer/server/lib/site.ts (rootFileTargets, siteAnswer), server/middleware/seo-root.ts, tests/rootFiles.test.ts, testing/expect-seo-down.txt, testing/expect-seo.txt (the /mapa-strony lines)
- ../vue-journal-layer/.playground/nuxt.config.ts (i18n prefix_except_default) and node_modules/@nuxtjs/i18n/dist/module.mjs around the pages:extend / pages:resolved localisation hook
- 33-REVIEW.md lane 4 WR-01, WR-04, WR-05, WR-08; 33-09-SUMMARY deviation 7 (an app without pages)
</read_first>
<behavior>
- seoFirstPageRedirect: ('/mapa-strony/posty/strona/1', 'path', 'strona', 'page') → '/mapa-strony/posty'; ('/sitemap/posts/page/1', 'path', 'page', 'page') → '/sitemap/posts'; ('/mapa-strony/posty?page=1', 'query', '', 'page') → '/mapa-strony/posty'; a target equal to fullPath (for example the segment missing) → null
- seoSitemapPages: without i18n the names are seo-sitemap-<locale>, seo-sitemap-group-<locale> (and the page route in the path form with the locale's segment); with i18n prefix_except_default and locales en, pl each route is named <name>___<locale> at the configured path and no route exists for another locale; an app page at the path skips the locale as taken; a root catch-all page skips every locale as catch-all unless overCatchAll is true; a /pl/** catch-all skips only a pl path under /pl/; htmlSitemap false answers nothing
- rootFileTargets: state unknown without a site answer gives the backend target for /robots.txt, /sitemap.xml and /llms.txt and null for sitemap files and verification files; state absent stays null; state ok unchanged
- Smokes: expect-seo-down.txt answers 503 /robots.txt and 503 /sitemap.xml with Retry-After: 60; expect-seo.txt's /mapa-strony lines still pass with the playground's overCatchAll: true
- Journal playground build: the built server's seo-sitemap route names are exactly seo-sitemap-en___en, seo-sitemap-group-en___en, seo-sitemap-pl___pl and seo-sitemap-group-pl___pl, at /sitemap and /pl/mapa-strony
</behavior>
<action>
Per L4 WR-01, WR-04, WR-05, WR-08, D-08, D-22, D-34, D-42 and P33-68 to P33-70, tests first:
- (A, WR-01) `seoFirstPageRedirect` in app/utils/pageHref.ts (P33-69); SeoHtmlSitemapPage takes the locale's segment (site answer `pagination.segments[locale]`, else `config.public.seo.pagination.segments[locale]`, else the param) and redirects only when the helper answers a target. Commit A.
- (B, WR-04, WR-05) `htmlSitemapOption` accepts `overCatchAll` (boolean, default false) and keeps it in the runtime option; lib/sitemapPages.ts `seoSitemapPages` (P33-68, pure, unit-tested); seo-module.ts drops the extendPages registration and calls the builder from a `pages:resolved` hook registered in `modules:done`, removing its earlier routes first, pushing the result into the resolved list and logging each skip ("HTML sitemap: <locale> <path> is rendered by the app's catch-all page; the layer's page is not registered (set seo.htmlSitemap.overCatchAll to serve it ahead of the catch-all)"). SitemapLink: the locale falls back to the i18n current locale (`useNuxtApp().$i18n?.locale?.value`, guarded: the layer does not depend on i18n) before the site default, and the link renders only when `useRouter().resolve(href)` matches a route whose `meta.seoSitemap.locale` is that locale. The vue-seo-layer playground sets `htmlSitemap.overCatchAll: true` (its root `[...slug].vue`) with a comment; the journal playground sets `seo.htmlSitemap.paths` to en `/sitemap`, pl `/pl/mapa-strony` (the README's full-path rule for i18n apps) — commit D in vue-journal-layer. README: the `htmlSitemap` option row documents `overCatchAll`, the catch-all rule, one route per locale with i18n, and the footer link rule. After the change, build the menu playground once without `htmlSitemap: false` to see whether the 33-09 "app without pages" item is gone; record the result in the SUMMARY and keep both playgrounds' config unchanged. Commit B.
- (C, WR-08) rootFileTargets per P33-70, with its doc comment and the seo-root.ts header comment updated; expect-seo-down.txt answers 503 with `header=Retry-After: 60` for /robots.txt and /sitemap.xml and keeps 404 for a sitemap file and a verification file, and its comment states the staging reason; tests/rootFiles.test.ts splits the unknown and absent cases. README root files paragraph. Commit C.
</action>
<verify>
<automated>set -o pipefail; npm --prefix ../vue-seo-layer run test 2>&1 | tail -8</automated>
<fails_when>non-zero exit, a "not ok" line, a "# fail" count above 0, or sitemapPages.test.ts missing from the run</fails_when>
<automated>set -o pipefail; npm --prefix ../vue-seo-layer run build:playground 2>&1 | tail -3 && npm --prefix ../vue-seo-layer run smoke:ssr 2>&1 | tail -12 && npm --prefix ../vue-seo-layer run guard:check 2>&1 | tail -4 && npm --prefix ../vue-seo-layer run purge:check 2>&1 | tail -4</automated>
<fails_when>non-zero exit from any command, or a "not ok" or "FAIL" line</fails_when>
<automated>set -o pipefail; npm --prefix ../vue-journal-layer run build:playground 2>&1 | tail -2 && grep -rhoE '"seo-sitemap-[a-z-]+(___[a-z]+)?"' ../vue-journal-layer/.playground/.output/server | sort -u</automated>
<fails_when>non-zero exit, any printed name whose suffix differs from its locale (en___pl, pl___en), or the list differs from exactly "seo-sitemap-en___en", "seo-sitemap-group-en___en", "seo-sitemap-group-pl___pl", "seo-sitemap-pl___pl"</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "export function seoSitemapPages" ../vue-seo-layer/lib/sitemapPages.ts` prints one line
- `grep -n "modules:done" ../vue-seo-layer/lib/seo-module.ts` prints one line
- `grep -n "export function seoFirstPageRedirect" ../vue-seo-layer/app/utils/pageHref.ts` prints one line
- `grep -n "overCatchAll" ../vue-seo-layer/README.md ../vue-seo-layer/.playground/nuxt.config.ts` prints a line in each
- `grep -n "^503 /robots.txt" ../vue-seo-layer/testing/expect-seo-down.txt` prints one line
</acceptance_criteria>
<done>The HTML sitemap pages never loop, never shadow CMS pages behind a catch-all unless asked, exist once per locale with i18n, and robots.txt never reads as allow-all while the backend is down.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: Journal post meta and path-form pagination routes (L4 WR-02, WR-03)</name>
<files>../vue-journal-layer/app/journal-pages/PostPage.vue, ../vue-journal-layer/app/utils/seo.ts, ../vue-journal-layer/app/utils/routes.ts, ../vue-journal-layer/lib/journal-module.ts, ../vue-journal-layer/tests/seo.test.ts, ../vue-journal-layer/tests/routes.test.ts, ../vue-journal-layer/testing/expect-acme.txt, ../vue-journal-layer/README.md</files>
<read_first>
- ../vue-journal-layer/app/journal-pages/PostPage.vue (fallback and useSeoMeta) and app/utils/seo.ts (postSeoMeta, cmsHeadPresent), tests/seo.test.ts
- ../vue-seo-layer/app/utils/seo.ts (seoHeadInput: which head keys the CMS answer sets) to confirm the layer never writes og:type or article:*
- ../vue-journal-layer/lib/journal-module.ts (setup, extendPages) and app/utils/routes.ts (journalPagedRoutes), tests/routes.test.ts
- ../vue-seo-layer/lib/seo-module.ts (runtime.public.seo.pagination is written in its setup)
- ../vue-journal-layer/testing/expect-acme.txt (heading-on and uncategorised-note lines) and testing/fixtures/acme/posts.json (published_at, updated_at)
- 33-REVIEW.md lane 4 WR-02, WR-03
</read_first>
<behavior>
- seo.test.ts: journalArticleMeta(post) answers ogType article with the post's published_at and updated_at, and leaves a missing date out
- Smoke (expect-acme.txt): /blog/heading-on (a CMS answer) has exactly one og:type, of value article, and an article:published_time; /blog/uncategorised-note (no CMS answer) still has exactly one og:type
- routes.test.ts: journalPaginationSource answers runtimeConfig.public.seo.pagination when present and the raw seo.pagination otherwise; journalPagedRoutes of the resolved option for an app that set only form path lists /blog/strona/:page(\d+) and /blog/page/:page(\d+)
</behavior>
<action>
Per L4 WR-02, WR-03, D-40, D-42, D-97 and P33-71, tests first:
- (A, WR-02) `journalArticleMeta(post)` in app/utils/seo.ts (prefixed, auto-imported); PostPage always sets `ogType`, `articlePublishedTime` and `articleModifiedTime` from it, and only the CMS-owned keys (title, description, og title, og description, og image) keep the fallback; README SEO section states which head keys the post page always sets. Commit A.
- (B, WR-03) `journalPaginationSource(nuxtOptions)` in app/utils/routes.ts (P33-71); journal-module.ts computes the paged routes inside its extendPages callback from it instead of in setup from the raw option; README pagination paragraph says the segments follow vue-seo-layer's resolved option (defaults pl strona, en page). Commit B.
</action>
<verify>
<automated>set -o pipefail; npm --prefix ../vue-journal-layer run test 2>&1 | tail -8</automated>
<fails_when>non-zero exit, a "not ok" line or a "# fail" count above 0</fails_when>
<automated>set -o pipefail; npm --prefix ../vue-journal-layer run build:playground 2>&1 | tail -2 && npm --prefix ../vue-journal-layer run smoke:ssr 2>&1 | tail -10</automated>
<fails_when>non-zero exit, or a "not ok" or "FAIL" line in any of the five expectation runs</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "export function journalArticleMeta" ../vue-journal-layer/app/utils/seo.ts` prints one line
- `grep -n 'og:type' ../vue-journal-layer/testing/expect-acme.txt` prints at least two lines
- `grep -n "journalPaginationSource" ../vue-journal-layer/lib/journal-module.ts ../vue-journal-layer/app/utils/routes.ts` prints a line in each
</acceptance_criteria>
<done>Post pages keep their article metadata next to the CMS head, and Polish path-form listing pages have routes.</done>
</task>
<task type="auto">
<name>Task 4: Release guard against link: dependencies, version fields and install pins, upgrade notes and release-note drafts (L4 CR-01, WR-04 docs)</name>
<files>../vue-journal-layer/scripts/check-git-install.sh, ../vue-journal-layer/package.json, ../vue-journal-layer/README.md, ../vue-seo-layer/package.json, ../vue-seo-layer/README.md, ../vue-menu-layer/package.json, ../vue-menu-layer/README.md, ../vue-faq-layer/package.json, ../vue-faq-layer/README.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-seo-layer-v0.2.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-journal-layer-v0.8.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-menu-layer-v0.5.0.md, .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-faq-layer-v0.5.0.md</files>
<read_first>
- ../vue-journal-layer/scripts/check-git-install.sh (usage, --self-test, the tag mode's scratch install)
- the four layers' package.json and README (Install line, "Upgrading from …" sections, Releasing)
- the four 33-14-notes-vue-*.md drafts
- 33-REVIEW.md lane 4 CR-01 and WR-04; 33-14-PLAN.md Task 4 step 5 (read only: the swap and `check-git-install.sh <tag>` run there)
</read_first>
<action>
Per L4 CR-01, WR-04, D-97 and P33-72:
- (A, journal) check-git-install.sh gains `--check-links DIR...` (P33-72, with the usage comment) and runs the same check on the installed layer in the tag mode before building ("the tag's package.json still depends on <name> through <spec>"); `--self-test` adds a planted package.json with a link: dependency (reported, exit 1) and one with a git+https pin (passes), next to the lockfile case. README Releasing: before tagging any content layer, replace the link dependency with the vue-seo-layer tag pin, run `bash scripts/check-git-install.sh --check-links ../vue-seo-layer ../vue-journal-layer ../vue-menu-layer ../vue-faq-layer`, then the tag mode after pushing. Commit A.
- (B, each layer) version fields: vue-seo-layer 0.2.0, vue-journal-layer 0.8.0, vue-menu-layer 0.5.0, vue-faq-layer 0.5.0; README install lines pin `#v0.2.0`, `#v0.8.0`, `#v0.5.0`, `#v0.5.0` (and any other pin of these tags in the READMEs). Upgrade notes (WR-04): the journal's "Upgrading from 0.7" and the menu and FAQ "Upgrading from 0.4" sections say that the layer brings vue-seo-layer's HTML sitemap pages (pl /mapa-strony, en /sitemap by default), that an app rendering pages through a root catch-all gets none unless it sets `seo.htmlSitemap.overCatchAll: true`, that an app with an editor page at such a path keeps its page, and that `seo: { htmlSitemap: false }` turns them off; the journal note also states that the post page keeps og:type article and its article times. Leave the link: dependency in place (33-14 Task 4). One commit per layer.
- (C, here) Release-note drafts: vue-seo-layer v0.2.0 (the route report sends the noindex static paths; the HTML sitemap pages once per locale with i18n, not over a catch-all unless overCatchAll; the "Fixed" line about root files becomes: robots.txt, sitemap.xml and llms.txt answer 503 with Retry-After while the backend has not answered since the server started, so a crawler retries); vue-journal-layer v0.8.0 (path-form listing routes follow the SEO layer's segments; the catch-all upgrade note); vue-menu-layer and vue-faq-layer v0.5.0 (the catch-all upgrade note). Commit C in summercms.go as planning docs.
</action>
<verify>
<automated>bash ../vue-journal-layer/scripts/check-git-install.sh --self-test</automated>
<fails_when>non-zero exit or no "self-test ok" line</fails_when>
<automated>out=$(bash ../vue-journal-layer/scripts/check-git-install.sh --check-links ../vue-seo-layer ../vue-journal-layer ../vue-menu-layer ../vue-faq-layer 2>&1); code=$?; printf '%s\n' "$out"; echo "exit=$code"</automated>
<fails_when>"exit=0" (the guard missed the link dependencies that stay until 33-14 Task 4), fewer than three lines naming vue-seo-layer through link:, or a line naming ../vue-seo-layer itself (the exit status is captured on purpose: the guard must fail here)</fails_when>
<automated>set -o pipefail; for d in seo journal menu faq; do v=$(node -p "require('../vue-$d-layer/package.json').version") && pins=$(grep -oE "vue-$d-layer\.git#v[0-9.]+" "../vue-$d-layer/README.md" | sort -u | tr '\n' ' ') && echo "$d $v $pins" || echo "missing $d"; done</automated>
<fails_when>a "missing" line, a version other than seo 0.2.0, journal 0.8.0, menu 0.5.0, faq 0.5.0, or a README pin other than that version's tag</fails_when>
<automated>set -o pipefail; bash scripts/check-phase33.sh --self-test --layers 2>&1 | tail -12</automated>
<fails_when>non-zero exit, a "FAIL" or "refuse:" line, or a missing "PASS self-test" or "PASS layers" line (this plan never runs the go, plugins, docker or consumers stages; the orchestrator runs --all after both SUMMARYs)</fails_when>
</verify>
<acceptance_criteria>
- `grep -n -- "--check-links" ../vue-journal-layer/scripts/check-git-install.sh ../vue-journal-layer/README.md` prints a line in each
- `grep -n "overCatchAll" ../vue-journal-layer/README.md ../vue-menu-layer/README.md ../vue-faq-layer/README.md` prints a line in each
- `grep -n "503" .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-seo-layer-v0.2.0.md` prints a line
- each content layer's package.json still holds its `link:../vue-seo-layer` dependency (the swap belongs to 33-14 Task 4)
</acceptance_criteria>
<done>A layer cannot be tagged with a local dependency unnoticed, the versions and install lines match the release, and the upgrade and release notes describe the new behaviour.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| Nuxt server → CMS route report | server-to-server POST with a private token, now also carrying noindex paths |
| crawler → robots.txt via the layer | a missing robots.txt reads as allow-all |
| tagged layer → consuming app install | a local link: dependency resolves outside the package |
| visitor → HTML sitemap pages | request paths drive redirects |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-33-77 | Information disclosure | route report noindex paths | low | accept | the paths are the site's public route names (signed-in pages included) sent server-side to the configured apiBase only, with the token kept in the server-only runtime config; no visitor data |
| T-33-78 | Tampering (supply chain) | content layers with a link: dependency | medium | mitigate | `--check-links` before tagging and the same check in the tag mode of check-git-install.sh; --self-test in the gate's layers stage (Task 4) |
| T-33-79 | Information disclosure / integrity | robots.txt while the backend is down | medium | mitigate | 503 with Retry-After for the fixed root files in the unknown state, so a staging site's Disallow is never replaced by an app 404 (Task 2) |
| T-33-80 | Denial of service | HTML sitemap page-1 redirect | low | mitigate | the redirect uses the locale's segment and never targets the current URL (seoFirstPageRedirect), so no 301 loop (Task 2) |
| T-33-SC | Tampering | npm/pip/cargo/Go installs | high | mitigate | no npm package is added or upgraded; package.json changes are the version fields only; pnpm-lock.yaml files do not change (the SUMMARY shows `git diff BASE..HEAD -- pnpm-lock.yaml` empty per layer) |
</threat_model>
<verification>
- vue-seo-layer: `npm run test`, `build:playground`, `smoke:ssr` (all seven expectation runs, including expect-seo-down.txt), `guard:check`, `purge:check`.
- vue-journal-layer: `npm run test`, `build:playground`, `smoke:ssr` (five runs), the built route-name check, `check-git-install.sh --self-test` and `--check-links`.
- vue-menu-layer, vue-faq-layer: `npm run test`, `build:playground`, `smoke:ssr` (through the gate's layers stage).
- summercms.go: `check-phase33.sh --self-test --layers`. The full `--all` gate is run by the orchestrator once, after both 33-15 and 33-16 SUMMARYs exist and before 33-14 Task 4.
</verification>
<success_criteria>
- G1 is closed on the layer side (together with 33-15 on the CMS side).
- Every in-scope L4 finding has a fix and a test or a gate check.
- No layer is pushed or tagged and no link: dependency is swapped; 33-14 Task 4 resumes after 33-15 and 33-16, followed by re-verification.
</success_criteria>
## Deferred (v0.6.2 backlog item, grouped by repository)
- **vue-journal-layer:** L4 WR-06 (`sizes` on cards and the post image do not match the grid); info IN-03, IN-07.
- **vue-seo-layer:** L4 WR-07 (sitemap group-page breadcrumbs use the default locale's home crumb); info IN-01, IN-02, IN-04, IN-05, IN-06, IN-08, IN-09.
- **vue-faq-layer:** info IN-07 (host-header origins in FaqBlock).
- **Go plugins and framework (planned in 33-15, deferred there):** L1 WR-02 code change, WR-04, WR-06, WR-07; L2 WR-06, WR-07, WR-08; L3 WR-02, WR-05; G2; the L1 to L3 info items; verifier warnings W1 to W5.
## Artifacts this phase produces
- vue-seo-layer: `noindexStaticRoutes`, `#seo-routes` export `noindexPaths`, `routeReportBody(paths, noindex)`, route report key `noindex`; `lib/sitemapPages.ts` with `seoSitemapPages`; option `seo.htmlSitemap.overCatchAll`; `seoFirstPageRedirect`; root files 503 in the unknown state; smoke grammar `noindex=` and `lacksnoindex=`; version 0.2.0.
- vue-journal-layer: `journalArticleMeta`, `journalPaginationSource`; `check-git-install.sh --check-links` and the tag-mode guard; the playground's per-locale HTML sitemap paths; version 0.8.0.
- vue-menu-layer, vue-faq-layer: version 0.5.0, install pins, upgrade notes.
- summercms.go: updated 33-14-notes-vue-*.md drafts.
- Tests: tests/sitemapPages.test.ts; new cases in tests/routes.test.ts, tests/pageHref.test.ts, tests/rootFiles.test.ts (vue-seo-layer) and tests/seo.test.ts, tests/routes.test.ts (vue-journal-layer); smoke lines in expect-seo.txt, expect-seo-down.txt, expect-acme.txt; check-git-install.sh self-test cases.
<output>
Create `.planning/phases/33-seo-output-audit-and-content/33-16-SUMMARY.md` when done: the commits per layer, the finding-to-test table, the built route names of the journal playground, whether the 33-09 "app without pages" item is gone, the layer-side status of G1 and the 33-09 check-git-install item for deferred-items.md (edited by 33-15), and the `--self-test --layers` gate result.
</output>

View File

@@ -0,0 +1,224 @@
---
phase: 33-seo-output-audit-and-content
plan: 16
subsystem: nuxt-layers
tags: [seo, nuxt, vue-seo-layer, vue-journal-layer, vue-menu-layer, vue-faq-layer, gap-closure, route-report, html-sitemap, i18n, release-guard]
status: complete
requires:
- phase: 33-07..33-09
provides: vue-seo-layer v0.2.0 features (route report, root files, HTML sitemap pages, build guard) and the content layers on it
- phase: 33-13
provides: the release decision (after-tags) and the 33-14 release checkpoint this plan unblocks
provides:
- "vue-seo-layer: noindexStaticRoutes, #seo-routes noindexPaths, routeReportBody(paths, noindex) with ROUTE_REPORT_MAX_BODY, route report key noindex (gap-2 contract), smoke grammar noindex= / lacksnoindex="
- "vue-seo-layer: lib/sitemapPages.ts (seoSitemapPages, isSitemapRoute, sitemapSkipMessage), option seo.htmlSitemap.overCatchAll, seoFirstPageRedirect, SitemapLink route check and i18n locale fallback, root files 503 in the unknown state"
- "vue-journal-layer: journalArticleMeta, journalPaginationSource, check-git-install.sh --check-links and the tag-mode guard, the playground's per-locale HTML sitemap paths"
- "version fields seo 0.2.0, journal 0.8.0, menu 0.5.0, faq 0.5.0 with README install pins and upgrade notes; the four 33-14-notes-vue-*.md drafts updated"
affects: [33-14, 33-15]
actuals:
tokens: 16400
tasks: 4
commits: 13
plan_head_before: 8d562004cb05d8d40d12253c23e406259de61006
plan_head_after: c2e56ef
plan_heads:
vue-seo-layer: { before: b3a0078, after: 973142a, commits: 5 }
vue-journal-layer: { before: e8f307b, after: 761c7fc, commits: 5 }
vue-menu-layer: { before: 8b5da67, after: a7602c9, commits: 1 }
vue-faq-layer: { before: 7d952fa, after: 5e5950a, commits: 1 }
summercms.go: { before: 8d56200, after: c2e56ef, commits: 1 }
tech-stack:
added: []
patterns:
- "Layer routes that must not be localised by @nuxtjs/i18n are added from a pages:resolved hook registered on ready (after every module's modules:done handler), named <name><routesNameSeparator><locale>"
- "Report bodies bounded by the older consumer's read limit: drop the optional list from the end first, then the required one"
- "Release guard for git-installed layers: package.json local-spec scan (link:, file:, workspace:, portal:) before tagging and on the installed tag"
key-files:
created:
- ../vue-seo-layer/lib/sitemapPages.ts
- ../vue-seo-layer/tests/sitemapPages.test.ts
modified:
- ../vue-seo-layer/lib/routes.ts
- ../vue-seo-layer/lib/seo-module.ts
- ../vue-seo-layer/lib/options.ts
- ../vue-seo-layer/server/seo-routes.d.ts
- ../vue-seo-layer/server/lib/routeReport.ts
- ../vue-seo-layer/server/lib/site.ts
- ../vue-seo-layer/server/middleware/seo-root.ts
- ../vue-seo-layer/server/plugins/seo-route-report.ts
- ../vue-seo-layer/app/components/global/SeoHtmlSitemapPage.vue
- ../vue-seo-layer/app/components/Seo/SitemapLink.vue
- ../vue-seo-layer/app/utils/pageHref.ts
- ../vue-seo-layer/.playground/nuxt.config.ts
- ../vue-seo-layer/testing/smoke-ssr.mjs
- ../vue-seo-layer/testing/expect-seo.txt
- ../vue-seo-layer/testing/expect-seo-down.txt
- ../vue-seo-layer/tests/routes.test.ts
- ../vue-seo-layer/tests/pageHref.test.ts
- ../vue-seo-layer/tests/rootFiles.test.ts
- ../vue-seo-layer/package.json
- ../vue-seo-layer/README.md
- ../vue-journal-layer/.playground/nuxt.config.ts
- ../vue-journal-layer/app/journal-pages/PostPage.vue
- ../vue-journal-layer/app/utils/seo.ts
- ../vue-journal-layer/app/utils/routes.ts
- ../vue-journal-layer/lib/journal-module.ts
- ../vue-journal-layer/tests/seo.test.ts
- ../vue-journal-layer/tests/routes.test.ts
- ../vue-journal-layer/testing/expect-acme.txt
- ../vue-journal-layer/scripts/check-git-install.sh
- ../vue-journal-layer/package.json
- ../vue-journal-layer/README.md
- ../vue-menu-layer/package.json
- ../vue-menu-layer/README.md
- ../vue-faq-layer/package.json
- ../vue-faq-layer/README.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-seo-layer-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-journal-layer-v0.8.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-menu-layer-v0.5.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-faq-layer-v0.5.0.md
key-decisions:
- "The HTML sitemap pages are added from a pages:resolved hook registered on ready, not in modules:done: vue-seo-layer's module is set up before @nuxtjs/i18n, so a hook added from its modules:done handler ran before i18n's and i18n localised the layer's routes again (seo-sitemap-en___en___pl)"
- "routeReportBody drops every noindex entry before it cuts routes (gap-2 contract point 6): when routes alone exceed 4,113,024 bytes, noindex is [] even if a short entry would fit in the slack"
- "An app with only app.vue no longer needs seo.htmlSitemap: false: without the pages module no pages:resolved runs, so no sitemap route is added and the router stays off; such an app has no HTML sitemap pages"
- "check-git-install --check-links prints `check-git-install: <dir>: depends on <name> through <spec> (<section>)`, one wording for both modes"
requirements-completed: [SC-1, SC-2, D-08, D-22, D-23, D-24, D-33, D-34, D-40, D-42, D-97]
metrics:
duration: "19 min (2026-11-04T21:38:00Z to 21:57:35Z by the session clock)"
completed: 2026-11-04
---
# Phase 33 Plan 16: Nuxt layers gap closure Summary
The Nuxt layers now send the noindex static paths in the route report, inside the older plugin's body limit. The HTML sitemap pages exist once per locale with @nuxtjs/i18n, are never put over a catch-all unless `overCatchAll` is set, and page 1 never redirects to itself. robots.txt, sitemap.xml and llms.txt answer 503 while the backend is unknown. Journal post pages keep og:type article, and the journal registers its path-form routes from the SEO module's resolved pagination. A `--check-links` guard blocks tags with `link:` dependencies, and the versions and pins match the release.
## Commits
| Repo | Commit | Subject |
|------|--------|---------|
| vue-seo-layer | 7a26692 | feat: the route report sends the noindex static paths (tracer) |
| vue-seo-layer | 7588aa5 | fix: HTML sitemap page 1 redirects with the locale's segment |
| vue-seo-layer | a651de4 | fix: HTML sitemap pages once per locale, never over a catch-all by default |
| vue-seo-layer | 8cdf359 | fix: root files answer 503 while the backend has not answered |
| vue-seo-layer | 973142a | chore: version 0.2.0 and install pin |
| vue-journal-layer | 1e05efc | test: the playground's HTML sitemap paths per locale |
| vue-journal-layer | 839db51 | fix: post pages keep og:type article and their article times |
| vue-journal-layer | d64fe47 | fix: path-form listing routes use the SEO module's resolved pagination |
| vue-journal-layer | d4ba3e2 | feat: check-git-install --check-links refuses local dependencies |
| vue-journal-layer | 761c7fc | chore: version 0.8.0 and install pin |
| vue-menu-layer | a7602c9 | chore: version 0.5.0 and install pin |
| vue-faq-layer | 5e5950a | chore: version 0.5.0 and install pin |
| summercms.go | c2e56ef | docs(33-16): release-note drafts for the layer fixes |
All on each repo's default branch (layers `main`, summercms.go `master`). Nothing was pushed or tagged, and no `link:../vue-seo-layer` dependency was swapped. `git diff <base>..HEAD -- pnpm-lock.yaml` is empty in all four layers, and package.json changed only in its `version` field.
## Finding to test
| Finding | Fix | Proving test |
|---------|-----|--------------|
| G1 layer side (D-23, D-24, D-33) | `noindexStaticRoutes`, `#seo-routes` `noindexPaths`, `routeReportBody(paths, noindex)` with `ROUTE_REPORT_MAX_BODY` = 4,113,024 | tests/routes.test.ts: `noindexStaticRoutes: the static paths the build serves noindex`, `…client-only noindex pages kept, patterns never sent`, `…the i18n copies of a noindex page`, `routeReportBody: within the plugin limits, both lists`, `…the JSON body stays within the older plugin limit, noindex dropped first`, `…routes alone over the limit are cut from the end`; smoke expect-seo.txt `routereport 1 … noindex=/konto noindex=/szkic noindex=/prywatne lacksnoindex=/ lacksnoindex=/mapa-strony` |
| L4 WR-01 page-1 self-redirect | `seoFirstPageRedirect`, locale segment in SeoHtmlSitemapPage | tests/pageHref.test.ts: `seoFirstPageRedirect: page 1 goes to the unnumbered URL with the locale segment`, `…never a redirect to the URL itself`; smoke `301 /mapa-strony/posts?page=1` still passes |
| L4 WR-04 sitemap pages over a catch-all | `seoSitemapPages` catch-all rule, `htmlSitemap.overCatchAll`, build log line | tests/sitemapPages.test.ts: `a root catch-all skips every locale unless overCatchAll`, `a prefixed catch-all skips only the paths it covers`, `an app page at the path keeps it (taken)`; smoke expect-seo.txt /mapa-strony lines pass with the playground's `overCatchAll: true` |
| L4 WR-05 i18n cross-locale copies | pages added after i18n, names `<name>___<locale>`; SitemapLink route check | tests/sitemapPages.test.ts `with i18n each route is named for its own locale, once`; built journal playground route names (below); smoke footer link line |
| L4 WR-08 root files while unknown | `rootFileTargets` targets the fixed names in state unknown | tests/rootFiles.test.ts `a backend never reached since start (unknown) still owns the fixed root files` and `an older backend (absent) passes every path through`; expect-seo-down.txt `503 /robots.txt`, `503 /sitemap.xml`, `503 /llms.txt` with `Retry-After: 60`; expect.txt (`--no-site`) keeps `404 /robots.txt` |
| L4 WR-02 post og:type and article times | `journalArticleMeta`, always set in PostPage | tests/seo.test.ts `journalArticleMeta: og:type article and the post times`; expect-acme.txt `/blog/heading-on count=property="og:type":1 …article:published_time…` (failed before the fix) and `/blog/uncategorised-note` |
| L4 WR-03 journal path-form routes | `journalPaginationSource`, computed in the extendPages callback | tests/routes.test.ts `journalPaginationSource: the SEO module's resolved option, else the raw seo.pagination` and `an app that set only form path gets the default pl and en segments`; a probe build with only `pagination: { form: 'path' }` had `/blog/strona/:page(\d+)`, `/blog/page/:page(\d+)` and the `/pl/` copies |
| L4 CR-01 link: dependency, versions, pins | `check-git-install.sh --check-links`, tag-mode guard, version fields and install pins | `check-git-install.sh --self-test` (planted link:, git+https, file:/workspace:/portal:, missing and mixed cases); `--check-links ../vue-seo-layer ../vue-journal-layer ../vue-menu-layer ../vue-faq-layer` exits 1 with the three link: lines and none for vue-seo-layer; version/pin loop prints seo 0.2.0 #v0.2.0, journal 0.8.0 #v0.8.0, menu 0.5.0 #v0.5.0, faq 0.5.0 #v0.5.0 |
Prohibitions: the route report stays compatible both ways. The fixture API ignores `noindex`, and the smoke with the routereport line passes. `--no-site` (404, not retried) passes in expect.txt. The guard and the noindex headers are unchanged: guard:check passes (16 checks), and the expect-seo.txt `/konto`, `/szkic`, `/prywatne` noindex lines pass.
## Journal playground route names (WR-05 evidence)
`grep -rhoE '"seo-sitemap-[a-z-]+(___[a-z]+)*"' .playground/.output/server | sort -u` after the fix:
```
"seo-sitemap-en___en" /sitemap
"seo-sitemap-group-en___en" /sitemap/:group
"seo-sitemap-group-pl___pl" /pl/mapa-strony/:group
"seo-sitemap-pl___pl" /pl/mapa-strony
```
Before the fix the build held seo-sitemap-en___pl and seo-sitemap-pl___en. With the first `modules:done` attempt it held `___en___en` / `___en___pl` doubles (see deviation 1).
## The 33-09 "app without pages" item
It is gone. I built the menu playground (only `app.vue`) once without `seo: { htmlSitemap: false }`: it registered no `seo-sitemap-` route and its smoke passed (17 checks). The config was restored afterwards, and both the menu and FAQ playgrounds keep `htmlSitemap: false` as the plan asked. The vue-seo-layer README and the menu and FAQ upgrade notes now say that such an app gets no sitemap pages and needs no setting.
## Status for deferred-items.md (owned by 33-15, not edited here)
- **G1, layer side:** closed. Each server start sends `noindex` with the static paths the build serves noindex, including the i18n copies, under the gap-2 contract. The CMS side (the filter and the stored set) belongs to 33-15.
- **33-09 check-git-install item (no guard against link:):** closed on the script side. `--check-links` and the tag-mode check are in vue-journal-layer d4ba3e2, and `--self-test` covers them. The swap itself is still open and belongs to 33-14 Task 4.
- **33-09 "app without pages":** closed (see above).
## For 33-14 Task 4
- **Link swap:** not done. `link:../vue-seo-layer` is still in vue-journal-layer, vue-menu-layer and vue-faq-layer. Step order (also in the journal README, Releasing): tag vue-seo-layer v0.2.0, then in each content layer replace the link with `git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0` and run `pnpm install`. Then run `bash ../vue-journal-layer/scripts/check-git-install.sh --check-links ../vue-seo-layer ../vue-journal-layer ../vue-menu-layer ../vue-faq-layer`, which must exit 0, then tag and push.
- **check-git-install `<tag>`:** now also fails when the installed tag's package.json has a local dependency, before building. Its `--self-test` is part of the gate's layers stage.
- **Versions:** already bumped (seo 0.2.0, journal 0.8.0, menu 0.5.0, faq 0.5.0), so Task 4 does not bump them again.
- **Release notes:** the four 33-14-notes-vue-*.md drafts changed (c2e56ef):
- seo: the route report's noindex list, the sitemap pages per locale and not over a catch-all, `overCatchAll`, the upgrade line, and the Fixed line about the root-file 503s;
- journal: path-form listing routes, plus an upgrade line on the catch-all and the article meta;
- menu and FAQ: the catch-all upgrade note replaces the `htmlSitemap: false` advice.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] The sitemap page hook is registered on `ready`, not in `modules:done`**
- **Found during:** Task 2 B (journal playground build).
- **Issue:** vue-seo-layer's module is set up before @nuxtjs/i18n, so its `modules:done` handler runs first. A `pages:resolved` hook added there ran before the one i18n adds in its own `modules:done`. i18n then localised the layer's routes again (`seo-sitemap-en___en___pl`), which is the WR-05 bug once more.
- **Fix:** the hook is added from `ready`, which Nuxt calls after every `modules:done` handler and before the build resolves the pages. The plan's acceptance grep `grep -n "modules:done" lib/seo-module.ts` now matches two comment lines that explain the choice, not the hook.
- **Files:** ../vue-seo-layer/lib/seo-module.ts. **Commit:** a651de4.
**2. [Rule 1 - Bug] routeReportBody: routes too large means noindex is empty**
- **Found during:** Task 1 (the unit test for routes alone over the limit).
- **Issue:** my first version cut routes to fit and then filled the slack with noindex entries. That breaks contract point 6, which drops noindex first.
- **Fix:** when routes alone exceed the limit, noindex is `[]`. **Commit:** 7a26692.
**3. [Rule 1 - Docs] README notes that were wrong after the fix**
- The vue-seo-layer README `htmlSitemap` row and the menu and FAQ "Upgrading from 0.4" bullets said that an app with only `app.vue` must set `htmlSitemap: false`. They now describe the new behaviour.
- The journal README "Fallback meta" bullet no longer lists the article times, which are now always set.
- **Commits:** a651de4, 839db51, a7602c9, 5e5950a.
**4. Minor wording/placement choices**
- **`--check-links` line:** it reads `check-git-install: <dir>: depends on <name> through <spec> (<section>)` instead of `<dir>: <name> depends on <spec>`, one wording for both modes.
- **SeoHtmlSitemapPage form:** the redirect form comes from the route (path when `:page` is set, else query) instead of from the site answer. A path-form route under a query-form site answer would otherwise self-redirect too.
- **Journal "Upgrading from 0.7":** besides the catch-all and og:type notes, it also mentions the path-form segments.
## Known Stubs
None.
## Threat Flags
None. No new endpoint or auth path. The route report carries one more list on the existing request, as recorded in T-33-77.
## Gate
`bash scripts/check-phase33.sh --self-test --layers` from summercms.go, exit 0. Log: /tmp/claude-1000/-media-nvme-dev-golem15-summercms-io-summercms-summercms-go/cc746d7e-76ce-49f4-ae43-0e1debb2bbea/scratchpad/gate-33-16.log
- `PASS self-test` (45 checks, `phase33 self-test passed`)
- `PASS layers` (`phase33 layers passed`):
- unit tests: vue-seo-layer 152/152, vue-journal-layer 202/202, vue-menu-layer 24/24, vue-faq-layer 19/19 (tap, `# fail 0`);
- the four playground builds;
- vue-seo-layer `smoke:ssr` (7 runs), `guard:check`, `purge:check`;
- the five journal smoke runs, its purge-check and purge-token-check, and `check-git-install: self-test ok`;
- the menu and FAQ `smoke:ssr`.
The go, plugins, docker and consumers stages were not run. The orchestrator runs `--all` after both SUMMARYs exist.
Task verifies run separately along the way:
- vue-seo-layer: `smoke:ssr` all seven runs ok (expect-seo.txt 64 checks, expect-seo-down.txt 9), guard:check 16, purge:check 18, purge-token-check 53.
- vue-journal-layer: `smoke:ssr` five runs ok (expect-acme.txt 89 checks), plus the built route-name check above.
- `--check-links` over the four layers: exit 1 with three link: lines (journal, menu, FAQ), as required until 33-14 Task 4.
## Self-Check: PASSED
Both created files exist; all 13 commits exist in their repos; the plan's acceptance greps match (noindexStaticRoutes, ROUTE_REPORT_MAX_BODY in code and tests, noindexPaths in plugin and types, the README contract JSON, `^503 /robots.txt`, seoFirstPageRedirect, overCatchAll in README and playground, og:type lines in expect-acme.txt, --check-links in script and README); the `modules:done` grep matches comments only (deviation 1).

View File

@@ -0,0 +1,197 @@
---
phase: 33-seo-output-audit-and-content
scope: gap-closure re-review (33-15, 33-16)
reviewed: 2026-11-04T23:30:00Z
depth: deep (targeted)
files_reviewed: 52
files_reviewed_list:
- sm-sitemap-plugin (1048c01..HEAD): contract/contract.go, plugin.go, classes/rebuild.go, classes/lastmod.go, classes/listing.go, models/legacy.go, models/url.go, extensions_settings.go, updates/202610280002_update_golem15_sitemap_settings.go, updates/202611040001_add_golem15_sitemap_urls_indexnow_pending.go
- sm-seo-plugin (075cf17..HEAD): classes/crawl/job.go, classes/crawl/store.go, classes/crawl/actions.go, classes/crawl/crawler.go, classes/crawl/fetch.go, classes/crawl/render.go, classes/crawl/render_chrome.go, classes/crawl/compare.go, classes/crawl/checks.go, classes/crawl/fix.go, classes/linkgraph.go, classes/registry.go, classes/sitemap_filter.go, controllers/api/registry.go, controllers/api/crawls.go, controllers/crawls.go, models/crawl.go, models/noindex_path.go, jobs.go, mcp.go, updates/202611040001_create_golem15_seo_noindex_paths.go, updates/202611040002_add_golem15_seo_crawls_heartbeat.go
- sm-journal-plugin (311c28a..HEAD): classes/headings.go, classes/image_alt.go, classes/image_variants.go, classes/content_descriptors.go, classes/menu_item_types.go, console/fix_headings.go, controllers/api/maintenance.go, mcp.go
- vue-seo-layer (b3a0078..HEAD): lib/seo-module.ts, lib/sitemapPages.ts, lib/routes.ts, lib/options.ts, server/lib/routeReport.ts, server/lib/site.ts, server/middleware/seo-root.ts, server/plugins/seo-route-report.ts, server/seo-routes.d.ts, app/components/Seo/SitemapLink.vue, app/components/global/SeoHtmlSitemapPage.vue, app/utils/pageHref.ts, package.json
- vue-journal-layer (e8f307b..HEAD): app/journal-pages/PostPage.vue, app/utils/seo.ts, app/utils/routes.ts, lib/journal-module.ts, scripts/check-git-install.sh, package.json
- vue-menu-layer (a7602c9), vue-faq-layer (5e5950a): package.json, README.md
findings:
critical: 0
warning: 4
info: 0
total: 4
status: issues_found
---
# Phase 33 gap-closure re-review (33-15, 33-16)
Paths are relative to `/media/nvme/dev/golem15/summercms.io/summercms/`.
## Summary
Most fixes do what their findings asked. Three are only partly done:
- **L1 CR-02.** A markdown body that starts with `<` is still rewritten by the tokenizer. I confirmed this by running the code.
- **L1 WR-05.** Bodies stored as content_html only now get a 422 where they used to succeed (a regression), and the `<`-prefixed markdown subset still goes down the HTML path.
- **L4 CR-01.** The guard, the version fields and the install pins are done. The `link:` swap was deliberately left to 33-14 Task 4, so the layers still cannot be tagged from HEAD.
I found no critical defects in the new code. There are four new warnings (below).
Things I checked that hold up:
- **Advisory lock.** It does not deadlock. The pool is unbounded (lagoon sets no `MaxOpenConns`), the lock order is the same on every path (advisory lock, then the settings row), and the lock wait is bounded by the job context (conga's default 300 s).
- **Crawl heartbeat.** The heartbeat goroutine stops cleanly (closed channel, then wait), and it keeps writing during `finish` because `stop` is deferred after it.
- **River rescuer.** It honours the worker's 6 h timeout, so it does not rescue a crawl that is still running.
- **Cancel.** `Cancel` keeps the guard: the row stays `running` until the job ends it, and `ActiveCrawl`, `DeleteCrawls` and `Prune` all see it as active.
- **Migrations.** The new migrations only add a table or nullable columns and have rollbacks. `202610280002` keeps its ID, and no production database has run it (33-13 deployed nothing; the rehearsal databases are to be recreated, as the 33-15 SUMMARY says).
- **Gap-2 contract.** Both directions work. When `noindex` is absent (or `null`), the stored set stays unchanged. The layer keeps the body at or under 4,113,024 bytes and drops `noindex` entries first. The new plugin accepts twice that.
- **Concurrent route reports.** Two at once end up with the union of both sets (`ON CONFLICT DO NOTHING`), not with an error.
- **noindex input.** It is validated:
- same bearer token, compared in constant time;
- at most 2000 entries, checked before the transaction (422 and nothing stored);
- each entry passes `ValidPagePath` and the 2048-byte cap;
- patterns (`*`, `:param`) are refused;
- the body is capped with `MaxBytesReader`.
- **i18n hook.** Registering `pages:resolved` from `ready` puts it after i18n's `modules:done` hook, and the function strips its own routes again on dev regenerations.
- **sm-journal-plugin compatibility.** Exported signatures are unchanged. The behaviour changes (descriptor URL `""` for locales without content, the 422 for markdown images the tool cannot reach) are deliberate and in the v0.4.0 notes.
## Verdicts
| Finding | Verdict | Evidence |
|---|---|---|
| L1 CR-01 tall original | Resolved | `sm-journal-plugin/classes/image_variants.go:195-202` skips a width whose height is over 4096 and continues. `MaxImageWidth` (4096) equals `attach` `maxThumbEdge` (`summercms.go/modules/lagoon/attach/thumb.go:29`) only by coincidence. Other `ThumbKey` errors still abort the batch (`:203-206`); that was outside the plan |
| L1 CR-02 H1 rewrite of markdown | **Partially resolved** | `classes/headings.go:79-82` skips `content` only when `!LooksLikeHTML(content)`, and `LooksLikeHTML` only checks for a leading `<` (`classes/blog_editor.go:129-132`). The API always renders `content` as markdown (`controllers/api/posts_helpers.go:537,593`), so a markdown body that starts with an HTML block still has `<h1>` rewritten inside its code fences. See new WR-01 |
| L1 WR-01 fix-headings CLI | Resolved | `console/fix_headings.go:51-55` uses `lookupDB` |
| L1 WR-03 tokenizer tail | Resolved | `classes/headings.go:26-36`, `classes/image_alt.go:31-40` write `html[consumed:]` on `ErrorToken`; `Raw()` slices are contiguous, so the offset is exact |
| L1 WR-05 alt on markdown | **Partially resolved** | `controllers/api/maintenance.go:172-188`: an inline `![..](src)` image or a raw img outside code is written into the markdown. But a body with empty `content` (a content_html-only translation) now always gets a 422, and markdown that starts with `<` goes down the HTML branch. See new WR-02 |
| L2 WR-01 IndexNow deletes/edits | Resolved | `classes/lastmod.go:135,158-162` set `indexnow_pending_at`; `classes/rebuild.go:516-524,539-546` add the row to Changed/Removed; `:631-637` clear only marks that are not newer than the value read |
| L2 WR-02 concurrent rebuilds | Resolved | `classes/rebuild.go:144-170`: `pg_advisory_xact_lock` is taken before the settings, type settings and `collect` |
| L2 WR-03 lastmod revert | Resolved | `classes/rebuild.go:621-626`: `lastmod` is written only for `ExtraTypeKey` rows |
| L2 WR-04 migration drops items | Resolved (as scoped in P33-66) | `models/legacy.go:202-278` and the migration at `updates/202610280002_…go:84-92`: leading slash added, spaces and unsafe bytes encoded, items parsed one by one, one warn log per dropped item. Absolute URLs with `&` are still dropped, but now logged |
| L2 WR-05 pinned headings | Resolved | `extensions_settings.go:128-135` loads stored titles only; `pickTitle` ignores empty strings (`classes/htmlgroups.go:193-201`) |
| L2 IN-01 nil event | Resolved | `classes/lastmod.go:114-116` |
| L3 CR-01 cancel/timeout loses results | Resolved (one gap, new WR-03) | `classes/crawl/job.go:222-228`: detached `FinishTimeout` context; `:342-356` maps a deadline to failed; `:365-368` falls back to default limits; `crawler.go:250-253` marks cut-short fetches "canceled"; `store.go:199-239` adds `RecoverStale`. The terminal write shares the store's deadline (WR-03) |
| L3 WR-01 cancel clears guard | Resolved | `job.go:541-556` sets `cancel_requested_at` and leaves the status `running`; `finish` writes `cancelled`; `controllers/crawls.go:84` hides the action while cancelling |
| L3 WR-03 any port | Resolved | `fetch.go:150-152` (`Allowed`), `render.go:184` (`allowRequest`), `compare.go:29-33` uses `Fetcher.Key` |
| L3 WR-04 two path forms | Resolved | `classes/linkgraph.go:261-287` (`PathKey`, `EscapeKeyPath`), `fetch.go:176-196`, `sitePath` handles both inputs. Residual edge case: `%2F` decodes to `/` |
| L3 WR-06 tab-open timeout | Resolved | `render_chrome.go:126-160`: one deadline (`TabOpenTimeout+RenderTimeout`), a 5 s open timer, the tab closed on timeout; the result channel is buffered, so the goroutine does not leak |
| G1 CMS side | Resolved | `classes/registry.go:821-925` (`ReportNoindex`, `Rebuilder` called after commit), `classes/sitemap_filter.go:174-176`, `controllers/api/registry.go:19-29,78-97`, `crawl/checks.go:338-354` (sitemap tool for extras) |
| G3 descriptors per locale | Resolved | `classes/content_descriptors.go:177-182,497-500,664`, `classes/menu_item_types.go:1046,1108-1228`; the sitemap skips `URL ""` (`sm-sitemap-plugin/classes/rebuild.go:250-252`), so older rows for those locales drop out as holes |
| L4 CR-01 link: dependency | **Partially resolved (deferred by plan)** | `check-git-install.sh --check-links` and the tag-mode guard are in place, versions are 0.2.0/0.8.0/0.5.0/0.5.0 and the README pins match. All three content layers still have `"vue-seo-layer": "link:../vue-seo-layer"` (checked with `package.json` grep). Do not tag before the 33-14 Task 4 swap |
| L4 WR-01 page-1 self-redirect | Resolved | `app/utils/pageHref.ts:38-41` (`target === fullPath` gives `null`), `SeoHtmlSitemapPage.vue:71-83`. Note: the CMS segment wins over the segment the route was registered with; if they differ, the page is served without a redirect (no loop) |
| L4 WR-02 og:type article | Resolved | `vue-journal-layer/app/journal-pages/PostPage.vue:56-68`, `app/utils/seo.ts:78-83` |
| L4 WR-03 path-form segments | Resolved | `vue-journal-layer/lib/journal-module.ts:58-64`, `app/utils/routes.ts:101-107` read `runtimeConfig.public.seo.pagination`, which the SEO module's `setup` writes (`vue-seo-layer/lib/seo-module.ts:206-221`) |
| L4 WR-04 catch-all shadowing | Resolved | `lib/sitemapPages.ts:362-373`; the `overCatchAll` opt-in is documented in all four READMEs |
| L4 WR-05 i18n copies | Resolved | `lib/seo-module.ts:259-269` (`ready`, then `pages:resolved`), `lib/sitemapPages.ts:348-381` (`<name><sep><locale>`), `SitemapLink.vue:39-46` checks the route |
| L4 WR-08 root files while unknown | Resolved for the reported case (new WR-04) | `server/lib/site.ts:96-99`: FIXED names are proxied in state `unknown`; a failing fetch gives 503. Side effect in WR-04 |
| G1 layer side | Resolved | `lib/routes.ts:161-171`, `lib/seo-module.ts:283-287`, `server/lib/routeReport.ts:428-478` (bounded body, `noindex` dropped first, `[]` always sent) |
Counts: 26 verdict rows. 19 resolved (L3 CR-01 and L4 WR-08 each with a new warning attached), 3 partially resolved (L1 CR-02, L1 WR-05, L4 CR-01), 0 not resolved.
## Narrative Findings (AI reviewer)
## Warnings
### WR-01: Markdown that starts with `<` still gets `<h1>` rewritten inside code samples (CR-02 residual)
**File:** `sm-journal-plugin/classes/headings.go:79-87` (with `classes/blog_editor.go:129-132`, `controllers/api/posts_helpers.go:537,593`, and the call sites in `posts_helpers.go:865`, `console/import_posts.go`, `classes/heading_fix.go`)
**Issue:** `ConvertContentH1` treats `content` as HTML whenever its first non-space byte is `<`. The API, however, always renders `content` as markdown (`FormatHTML`), so a markdown post that opens with an HTML block (`<p class="lead">…</p>`, `<img …>`, `<!-- … -->`, an autolink `<https://…>`) is still run through the `x/net/html` tokenizer. Every `<h1>` token in its fenced or inline code samples becomes `<h2>`, silently and with the default-on setting, on every API or MCP save, on import and on `journal:fix-headings --apply`. It is worse than before: the count now comes from `content`, so the corruption is counted as a conversion. This is the same defect class as CR-02, with a narrower trigger.
**Evidence:** I ran the shipped `headings.go` (copied into the scratchpad, `GOWORK=off go run`):
```
in : "<p class=\"lead\">Intro</p>\n\nExample:\n\n```html\n<h1>Hello</h1>\n```\n"
out: "<p class=\"lead\">Intro</p>\n\nExample:\n\n```html\n<h2>Hello</h2>\n```\n" n=1, content_html unchanged
```
**Fix:** Decide by the render path, not by the first byte. Where the body is rendered as markdown (the API, import, fix-headings of an API post), rewrite only outside goldmark's code ranges. The helper for that already exists (`markdownCodeRanges` in `classes/image_alt.go`):
```go
func ConvertContentH1(content, contentHTML string) (string, string, int) {
contentHTML, nHTML := ConvertH1(contentHTML)
var nContent int
content, nContent = convertH1OutsideCode(content) // split on markdownCodeRanges(content), ConvertH1 on the parts
if nHTML == 0 { nHTML = nContent }
return content, contentHTML, nHTML
}
```
For a real HTML body, `markdownCodeRanges` finds no fences, so the result is the same as today. Add a regression case with a leading `<p>` to `headings_test.go`.
### WR-02: `images/alt` now refuses images in bodies stored as content_html only (regression), and misses markdown that starts with `<`
**File:** `sm-journal-plugin/controllers/api/maintenance.go:172-188` (with `loadImageAltText` at `:263-282`)
**Issue:** The markdown branch runs whenever `!LooksLikeHTML(text.content)`, and that includes `content == ""`. A translation that carries only `content_html` is a supported shape:
- `classes/format_html.go:101-102`;
- `classes/blog_editor.go:292`;
- `controllers/api/posts_helpers.go:802-804`.
For such a body, `SetMarkdownImageAlt("")` and `SetImageAltOutsideCode("")` both return 0, so every change for it is refused with 422 `changes.N.src` ("The image is not an inline image of the post's markdown"). The batch is all or nothing, so one such image fails the whole MCP `set_image_alt` call. Before this change it succeeded and stuck, because no markdown re-derives that `content_html`.
Markdown that starts with `<` takes the HTML branch instead. There, `SetImageAlt` finds no raw `<img>` for a `![..](src)` image, so `m == 0`, yet the change is answered `changed: true` and is reverted on the next save (the original WR-05). A raw `<img>` shown inside a code fence is also rewritten.
**Fix:** Treat an empty `content` as "content_html is the body", and route markdown by the same rule as WR-01:
```go
switch {
case strings.TrimSpace(text.content) == "":
// content_html-only body: nothing to keep in sync
case classes.LooksLikeHTML(text.content) && !hasMarkdownImage(text.content, c.src):
if content, m, _ := classes.SetImageAlt(text.content, c.src, c.alt); m > 0 { text.content = content }
default:
content, m, _ := classes.SetMarkdownImageAlt(text.content, c.src, c.alt)
content, r, _ := classes.SetImageAltOutsideCode(content, c.src, c.alt)
if m+r == 0 { /* 422 */ }
text.content = content
}
```
Add a test with a translation that has only `content_html`.
### WR-03: The crawl's terminal status write shares the store's 10-minute deadline
**File:** `sm-seo-plugin/classes/crawl/job.go:225-228, 383-397`
**Issue:** `finish` runs the store transaction and then the terminal `UPDATE … status/finished_at` on the same `fctx` (`FinishTimeout` = 10 min). A large crawl can run out that budget inside `SavePages`/`SaveIssues`: up to 50 000 pages and 1000 links per page in one transaction (L3 WR-02 left it unbounded). The store then fails with `context deadline exceeded`, and the terminal update fails on the same expired context, so `finish` returns at `:397`. Three things follow:
- the row stays `running`, and the real error is lost;
- the conga record is not ended by `finish`;
- the guard blocks new crawls until `RecoverStale` runs another 10 minutes later (heartbeat plus `StaleAfter`) and records a misleading "no heartbeat since …" error.
**Fix:** Give the final state its own fresh, short bound, separate from the store's:
```go
if err := lagoon.Transaction(ctx, db, store); err != nil { status, errText = models.CrawlFailed, err.Error() }
wctx, wcancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
defer wcancel()
wdb := db.WithContext(wctx)
if err := wdb.Model(&models.Crawl{}).Where("id = ?", row.ID).Updates(updates).Error; err != nil { return err }
// FailJob/StopJob/CompleteJob and Prune on wctx too
```
Add a test with a store that blocks past a small `FinishTimeout`, which checks for `failed` with the store error.
### WR-04: The root-file 503 also catches sites whose backend has no SEO plugin, after any outage longer than the cache TTL
**File:** `vue-seo-layer/server/lib/site.ts:47-63, 96-99`
**Issue:** `lastOk` remembers only an `ok` answer. An `absent` answer (a backend without SEO v0.2.0, for which the layer promises v0.1.1 behaviour) is cached for 5 minutes only. Once it expires, any moment the backend is unreachable or answers something other than 200 or 404 is `unknown` with `lastOk == null`. The new branch then proxies `/robots.txt`, `/sitemap.xml` and `/llms.txt` to a backend that never served them:
- if the fetch fails or answers 5xx, the layer serves 503;
- if the backend answers 404, the layer passes that 404 on.
Before 33-16 these requests reached the app. That covers robots.txt or sitemaps produced by a Nuxt server route or module (`@nuxtjs/robots`, `@nuxtjs/sitemap`), or the app's own 404. Files in Nuxt's `public/` are still served first by Nitro's static handler.
A 5xx robots.txt is read by Google as a site-wide disallow for up to about 12 hours. So on an SEO-less site, every short backend outage now stops crawling of the whole site. The same happens to a backend whose `/site` answers 200 with HTML (a catch-all) or 401/403 from an auth gateway: it is `unknown` for good, and its root files get hijacked.
**Fix:** Remember the last definite answer, not only `ok`, and narrow `unknown` to "never answered":
```ts
let lastKnown: SeoSiteState | null = null
...
if (got.state !== 'unknown') lastKnown = got
if (got.state === 'unknown' && lastKnown) return lastKnown
```
`rootFileTargets` then returns null for a remembered `absent`. Add a `rootFiles.test.ts` case: absent, then unknown, should still pass through.
## Notes below the warning bar (not counted)
- **Shutdown during a crawl.** A graceful worker shutdown (`conga.Worker.Stop` falls back to `StopAndCancel` with 5 s, `summercms.go/modules/conga/worker.go:219-226`) cancels the job context. `finalStatus` maps that to `cancelled` with no actor (`job.go:345-346`), so a deploy during a nightly crawl can leave a partial "cancelled" crawl as the current audit. The `Canceled → cancelled` mapping also covers `Cancel` calling `CancelJob` before its own transaction commits (`job.go:557-562`). Moving `CancelJob` to `AfterCommit` would allow a separate "interrupted" status.
- **DeleteCrawls stale rows.** `DeleteCrawls` calls `RecoverStale` but not `endStaleJobs` (`actions.go:81-83`), so the conga records of those crawls are never ended.
- **Open transaction during collect.** `Rebuild` keeps its transaction open (idle) for all of `collect` (`rebuild.go:144-170`). A database with `idle_in_transaction_session_timeout` set would kill long rebuilds.
- **Parameter limit.** `postContentLocales` passes every published post id of a page of tags or authors as one `IN ?` list (`menu_item_types.go:1150-1162`, `786-805`). Past about 65k posts, Postgres's parameter limit fails the descriptor call and with it the rebuild.
- **Repeat IndexNow pings.** `RecordSaved` marks rows that are already excluded (an unpublished record's old rows), and `apply` then sends them as removed again on every edit (`rebuild.go:539-545`).
- **Version pin.** sm-seo-plugin's go.mod still requires sm-sitemap-plugin v0.1.2, which has no `contract` package (`GOWORK=off go build` fails). The v0.2.0 pin is a 33-14 step, as the SUMMARY records.
---
_Reviewed: 2026-11-04_
_Reviewer: Claude (msd-code-reviewer)_
_Depth: deep (targeted re-review of the 33-15 and 33-16 ranges)_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
---
status: testing
phase: 33-seo-output-audit-and-content
source: [33-VERIFICATION.md]
started: 2026-11-05T01:26:27.413Z
updated: 2026-11-05T01:26:27.413Z
---
## Current Test
number: 1
name: 33-14 Task 4 release steps, in the release-log order: framework v0.6.1, sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0 (its go.mod must require sm-sitemap-plugin v0.2.0: today it requires v0.1.2, which has no contract package, so GOWORK=off builds fail), vue-seo-layer v0.2.0, then the link:../vue-seo-layer swap in vue-journal-layer, vue-menu-layer and vue-faq-layer, `check-git-install.sh --check-links` over the four layers (must exit 0) and `check-git-install.sh <tag>`, then their tags; app pins and patches (33-12, 33-13, then 33-14-*-locale.patch on the demo); -tags nodynamic in the WebP-linking app builds with the 33-13 DEPLOY.md 'Binary' row corrected; recreate the 33-12 and 33-13 rehearsal databases from their source dumps before the rehearsal (migration 202610280002 was edited); changelog posts
expected: |
Every step logged in 33-release-log.md; release binaries statically linked; nothing tagged off the default branch
awaiting: user response
## Tests
### 1. 33-14 Task 4 release steps, in the release-log order: framework v0.6.1, sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0 (its go.mod must require sm-sitemap-plugin v0.2.0: today it requires v0.1.2, which has no contract package, so GOWORK=off builds fail), vue-seo-layer v0.2.0, then the link:../vue-seo-layer swap in vue-journal-layer, vue-menu-layer and vue-faq-layer, `check-git-install.sh --check-links` over the four layers (must exit 0) and `check-git-install.sh <tag>`, then their tags; app pins and patches (33-12, 33-13, then 33-14-*-locale.patch on the demo); -tags nodynamic in the WebP-linking app builds with the 33-13 DEPLOY.md 'Binary' row corrected; recreate the 33-12 and 33-13 rehearsal databases from their source dumps before the rehearsal (migration 202610280002 was edited); changelog posts
expected: Every step logged in 33-release-log.md; release binaries statically linked; nothing tagged off the default branch
result: [pending]
### 2. W5 before the v0.6.1 tag: run 33-14-risk-max.sql (read-only) against every production database whose app takes v0.6.1
expected: No row longer than its rule's max, or each listed row shortened or accepted; results logged in 33-release-log.md
result: [pending]
### 3. SC1 production, after the tags (33-13 after-tags decision): deploy grzybyfunkcjonalne.pl per its DEPLOY.md, first the scripts/urls.txt check on the tagged build, then the 33-13-deploy-log.md checklist items 1-8
expected: Every urls.txt line passes; /sitemap.xml is a sitemapindex of sitemap-posts-1, -categories-1, -authors-1, -pages-1 and -images-1; the posts file lists the 62 posts once each with lastmod and no /en/ or hreflang; /sitemap.xsl 404; a post has one canonical, one JSON-LD script, no hreflang=en, breadcrumbs; SEO › Pages and Settings › Sitemaps as listed; a crawl finishes without /en/ 404s or duplicates; GSC reads the index
result: [pending]
### 4. G1 on a deployed site (demo after its patches): check the server log line 'route report: N routes and M noindex paths sent', then that the migrated Additional address /subscriptions (noindex in Nuxt) is excluded with reason noindex on Settings › Sitemaps and absent from sitemap-pages-1.xml without the manual DEPLOY.md removal
expected: The noindex address leaves the XML and HTML sitemaps after the debounced rebuild; a crawl reports no sitemap_noindex for it
result: [pending]
### 5. SC3 live workflow: run a crawl from SEO › Crawls on a deployed site, then from a real Claude client linked over MCP ask it to fix the reported issues with dry_run, review the preview, apply
expected: Every data issue names a tool the client can call (sitemap_update_settings for a noindex Additional address); dry runs write nothing; applying fixes the data issues; fix: code issues are named as template work
result: [pending]
### 6. D-46: Google's Rich Results Test for a post, a category and an FAQ page from the admin's Rich Results link
expected: No errors for BlogPosting, CollectionPage/ItemList and FAQPage
result: [pending]
### 7. Visual check after the deploys: grzyby home, /blog, a category, a post, /autor/admin on desktop and mobile; the demo on prefix_except_default (/pl/... addresses, LanguageSwitcher, /pl/mapa-strony and /sitemap each in its own locale, footer link to the visitor's locale); the new admin screens (SEO tab, Site audit, Crawls with the cancelling state, Auto-links, Pages, Settings › Sitemaps with the headings left empty) including the Blog Editor outline with long headings at 360px (33-02 J2)
expected: Layouts render as in 33-UI-SPEC.md; long outline headings wrap with a hanging indent and are not truncated
result: [pending]
## Summary
total: 7
passed: 0
issues: 0
pending: 7
skipped: 0
blocked: 0
## Gaps

View File

@@ -3,9 +3,9 @@ phase: "33"
slug: "seo-output-audit-and-content"
# status lifecycle: draft (seeded by plan-phase) → validated (set by validate-phase §6)
# audit-milestone §5.5 distinguishes NOT-VALIDATED (draft) from PARTIAL (validated + nyquist_compliant: false) (#2117)
status: draft
nyquist_compliant: false
wave_0_complete: false
status: validated
nyquist_compliant: true
wave_0_complete: true
created: "2026-10-28"
---
@@ -42,36 +42,37 @@ Filled by the planner per task. Decision → test map from research:
| Decision | Behavior | Test Type | Automated Command | File Exists | Status |
|----------|----------|-----------|-------------------|-------------|--------|
| D-30 | index + per-type files, stable numbering after delete, lastmod only on real change | integration | `go test ./... -run 'TestSitemapIndex\|TestStableNumbering\|TestLastmod'` (sm-sitemap-plugin) | ❌ W0 | ⬜ pending |
| D-31 | image ≤1000/url, news 2-day window, IndexNow ping on diff | unit + integration | `go test ./... -run 'TestImageSitemap\|TestNewsSitemap\|TestIndexNow'` | ❌ W0 | ⬜ pending |
| D-32 | no priority/changefreq/XSL; url items migrated | integration | `go test ./... -run TestMigrateDefinitions` | ❌ W0 | ⬜ pending |
| D-95/D-24 | SEO filter excludes noindex/canonicalised/redirected; sitemap works without SEO | integration | `go test ./... -run 'TestFilterExcludes\|TestNoFilter'` | ❌ W0 | ⬜ pending |
| D-33 | registry pages resolve; route report upserts | integration | `go test ./... -run TestRegistry` (sm-seo-plugin) | ❌ W0 | ⬜ pending |
| D-43..46 | @graph per kind with @id links; invalid custom JSON-LD refused | unit | `go test ./classes/schema/...` | ❌ W0 | ⬜ pending |
| D-55..57 | alternates only for translated locales; x-default = default | integration | `go test ./... -run TestAlternates` | ❌ W0 | ⬜ pending |
| D-40..42 | `?page=1` → 301; form normalisation; suffix templates | integration | `go test ./... -run TestPagination` | ❌ W0 | ⬜ pending |
| D-50/51 | H1→H2 on every write path; command dry run | integration | `go test ./... -run TestHeadingConversion` (Journal) | ❌ W0 | ⬜ pending |
| D-70 | build fails for indexable `ssr:false` / `.client.vue`; passes when noindex | build smoke | fixture playground builds (expect exit 1/0) | ❌ W0 | ⬜ pending |
| D-20a/D-08/D-103 | middleware 301/410, X-Robots-Tag, verification file at root, cache purge | SSR smoke | `node testing/smoke-ssr.mjs --expect testing/expect-seo.txt` | ❌ W0 | ⬜ pending |
| D-43 (layer) | exactly one ld+json script, one canonical | SSR smoke | same expect file | ❌ W0 | ⬜ pending |
| D-80/81/52 | one anchor per card, H2 cards, no generic anchor | SSR smoke + unit | journal layer `pnpm test` + smoke | ❌ W0 | ⬜ pending |
| D-14 | crawler finds planted issues; each issue has a tool or `fix: code` | integration | `go test ./... -run TestCrawler` | ❌ W0 | ⬜ pending |
| D-10 | every new admin operation has an MCP tool | unit | `go test -short ./... -run TestEveryAdminOperationHasTool` | ✅ (extend) | ⬜ pending |
| D-82/83 | autolink rules; outbound rel | unit | `pnpm test` (vue-seo-layer / journal layer) | ❌ W0 | ⬜ pending |
| D-72 | bm serves `Disallow: /` and noindex | smoke | `curl -sI` in check script | ❌ W0 | ⬜ pending |
| D-90/D-106 | framework additions generic and additive | gate | `scripts/check-phase33.sh --marker --additive` | ❌ W0 | ⬜ pending |
| D-30 | index + per-type files, stable numbering after delete, lastmod only on real change | integration + unit | sm-sitemap-plugin: `go test -count=1 -run 'TestSitemapIndex\|TestStableNumbering\|TestLastmod\|TestExtraDuplicates' .`; `go test -short ./classes -run 'TestAssignSlots\|TestRealChanges\|TestWriteURLSet'` | ✅ | ✅ green |
| D-31 | image ≤1000/url, news 2-day window, IndexNow ping on diff | unit + integration | sm-sitemap-plugin: `go test -count=1 -run 'TestImageSitemap\|TestNewsSitemap\|TestIndexNow' .`; `go test -short ./classes -run 'TestWriteImageURLSet\|TestNewsLimits\|TestIndexNowBatches\|TestIndexNowOutcome'` | ✅ | ✅ green |
| D-32 | no priority/changefreq/XSL; url items migrated | integration + unit | sm-sitemap-plugin: `go test -count=1 -run TestMigrateDefinitions .`; `go test -short ./classes -run TestWriteURLSet` | ✅ | ✅ green |
| D-95/D-24 | SEO filter excludes noindex/canonicalised/redirected; sitemap works without SEO | integration | sm-sitemap-plugin `go test -count=1 -run 'TestFilterExcludes\|TestNoFilter' .`; sm-seo-plugin `go test -count=1 -run 'TestSitemapFilterTracer\|TestFilterReasons' .` | ✅ | ✅ green |
| D-33 | registry pages resolve; route report upserts | integration + unit | sm-seo-plugin `go test -count=1 -run 'TestRegistry\|TestRegistryTimestampsUTC\|TestRouteReport' .`; vue-seo-layer `npm run test` (routes.test.ts, locale copies left out) | ✅ | ✅ green |
| D-43..46 | @graph per kind with @id links; invalid custom JSON-LD refused | unit + integration | sm-seo-plugin `go test -short ./classes/schema/...`; `go test -count=1 -run 'TestGraphTracer\|TestGraphPerKind\|TestCustomJSONLD' .`; elements `npm run test` (schema, graph) | ✅ | ✅ green |
| D-55..57 | alternates only for translated locales; x-default = default | unit + integration | sm-seo-plugin `go test -short ./classes -run TestAlternates`; `go test -count=1 -run TestPagedAlternates .`; sm-sitemap-plugin `go test -count=1 -run TestHreflangAlternates .` | ✅ | ✅ green |
| D-40..42 | `?page=1` → 301; form normalisation; suffix templates | unit + integration | sm-seo-plugin `go test -short ./classes -run 'TestParsePage\|TestPageLocation'`; `go test -count=1 -run TestPagination .`; vue-seo-layer usePagination.test.ts | ✅ | ✅ green |
| D-50/51 | H1→H2 on every write path; command dry run | unit + integration | sm-journal-plugin `go test -short ./classes -run 'TestConvertH1\|TestConvertContentH1\|TestConvertTranslationH1'`; `go test -count=1 -run 'TestHeadingConversion\|TestFixHeadingsCommand' .`; vue-journal-layer postTitle.test.ts | ✅ | ✅ green |
| D-70 | build fails for indexable `ssr:false` / `.client.vue`; passes when noindex; rendered comparison | build smoke + integration | vue-seo-layer `npm run guard:check`; sm-seo-plugin `go test -count=1 -run 'TestRenderSkipped\|TestChromeRenderer' .`, `go test -short ./classes/crawl -run 'TestCompareRendered\|TestAllowRequest\|TestResolverRules\|TestNewRenderer'` | ✅ | ✅ green |
| D-20a/D-08/D-103 | middleware 301/410, X-Robots-Tag, verification file at root, cache purge | SSR smoke | vue-seo-layer `npm run smoke:ssr` and `npm run purge:check` | ✅ | ✅ green |
| D-43 (layer) | exactly one ld+json script, one canonical | SSR smoke | vue-seo-layer `npm run smoke:ssr` (expect-seo.txt); demo `SMOKE_SEO_STRICT=1 scripts/smoke-seo.sh` (33-14 rehearsal) | ✅ | ✅ green |
| D-80/81/52 | one anchor per card, H2 cards, no generic anchor | SSR smoke + unit | vue-journal-layer `npm run test` and its five smoke expectation files (check-phase33.sh --layers); vue-faq-layer block.test.ts; sm-journal-plugin editor outline/forms tests | ✅ | ✅ green |
| D-14 | crawler finds planted issues; each issue has a tool or `fix: code` | unit + integration | sm-seo-plugin `go test -short ./classes/crawl/...`; `go test -count=1 -run 'TestCrawlerTracer\|TestCrawlerChecks' .` | ✅ | ✅ green |
| D-10 | every new admin operation has an MCP tool | unit | sm-seo-plugin `go test -short -run TestEveryAdminOperationHasTool .`; sm-sitemap-plugin `go test -count=1 -run TestSitemapTools .`; sm-journal-plugin `go test -count=1 -run TestJournalSettingsTools .` | ✅ | ✅ green |
| D-82/83 | autolink rules; outbound rel | unit + integration | sm-seo-plugin `go test -short ./classes -run 'TestValidAutolinkURL\|TestNormalizeAutolink'`, `go test -count=1 -run 'TestAutolinks\|TestLinkSuggestions' .`; vue-seo-layer and vue-journal-layer `npm run test` | ✅ | ✅ green |
| D-72 | bm serves `Disallow: /` and noindex | smoke | sm-bm-app `scripts/check-noindex.sh` (33-12) | ✅ | ✅ green |
| D-90/D-106 | framework additions generic and additive | gate | `scripts/check-phase33.sh --marker --additive --compat` | ✅ | ✅ green |
| SC-4 | unit tests for the phase's code | gate | `scripts/check-phase33.sh --all` (required test names per repository in the go, plugins, layers and docker stages) | ✅ | ✅ green |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
*Status key: ✅ green · ❌ red · ⚠️ flaky; no row is pending* (filled by plan 33-14 from `scripts/check-phase33.sh --all` on 2026-11-04, Docker and Chromium on the host)
---
## Wave 0 Requirements
- [ ] `scripts/check-phase33.sh` — stage engine from check-phase32.sh plus a `layers` stage
- [ ] sm-sitemap-plugin: retire `classes/golden_test.go` + `testdata/*.golden`; multi-type, multi-locale fixtures
- [ ] vue-seo-layer: `.playground`, `testing/` (smoke-ssr, fixture-api, nuxt-server), fixture resolve answers
- [ ] Build-guard fixture playgrounds (indexable ssr:false → fail; noindex → pass; `.client.vue` → fail)
- [ ] Crawler httptest site with planted issues
- [x] `scripts/check-phase33.sh` — stage engine from check-phase32.sh plus a `layers` stage
- [x] sm-sitemap-plugin: retire `classes/golden_test.go` + `testdata/*.golden`; multi-type, multi-locale fixtures
- [x] vue-seo-layer: `.playground`, `testing/` (smoke-ssr, fixture-api, nuxt-server), fixture resolve answers
- [x] Build-guard fixture playgrounds (indexable ssr:false → fail; noindex → pass; `.client.vue` → fail)
- [x] Crawler httptest site with planted issues
---
@@ -87,11 +88,11 @@ Filled by the planner per task. Decision → test map from research:
## Validation Sign-Off
- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 120s
- [ ] `nyquist_compliant: true` set in frontmatter
- [x] All tasks have `<automated>` verify or Wave 0 dependencies
- [x] Sampling continuity: no 3 consecutive tasks without automated verify
- [x] Wave 0 covers all MISSING references
- [x] No watch-mode flags
- [x] Feedback latency < 120s
- [x] `nyquist_compliant: true` set in frontmatter
**Approval:** pending
**Approval:** automated map green (33-14, 2026-11-04); the manual-only rows above are checked at and after the release.

View File

@@ -0,0 +1,579 @@
---
phase: 33-seo-output-audit-and-content
verified: 2026-11-05T01:29:36Z
status: human_needed
score: "Roadmap success criteria 4/4 verified (SC1's production part now evidenced by the release and deploy logs and re-checked live). Plan must-haves 231/235 truths verified: 0 failed, 0 pending the release, 3 superseded by Jakub's 2026-11-04 decisions, 1 human (J2 at 360px, in human item 3)"
covered_files:
- .planning/phases/33-seo-output-audit-and-content/33-01-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-01-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-02-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-02-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-03-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-03-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-04-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-04-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-05-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-05-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-06-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-06-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-07-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-07-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-08-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-08-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-09-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-09-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-10-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-10-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-11-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-11-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-12-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-12-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-13-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-13-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-13-deploy-log.md
- .planning/phases/33-seo-output-audit-and-content/33-14-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-14-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-journal-plugin-v0.4.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-seo-plugin-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-sm-sitemap-plugin-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-summercms-v0.6.1.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-faq-layer-v0.5.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-journal-layer-v0.8.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-menu-layer-v0.5.0.md
- .planning/phases/33-seo-output-audit-and-content/33-14-notes-vue-seo-layer-v0.2.0.md
- .planning/phases/33-seo-output-audit-and-content/33-15-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-15-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-16-PLAN.md
- .planning/phases/33-seo-output-audit-and-content/33-16-SUMMARY.md
- .planning/phases/33-seo-output-audit-and-content/33-release-log.md
- admin/openapi/admin.json
- admin/src/api/schema.d.ts
- docs/backend/field-types.md
- docs/database/attachments.md
- docs/database/casts-and-validation.md
- docs/plugins/menu-item-types.md
- go.mod
- go.sum
- modules/cabana/README.md
- modules/cabana/admin_openapi.go
- modules/cabana/backend_users_admin.go
- modules/cabana/field_type.go
- modules/cabana/http.go
- modules/cabana/schema_types.go
- modules/lagoon/README.md
- modules/lagoon/attach/variant.go
- modules/lagoon/attach/webp/webp.go
- modules/lagoon/validate.go
- modules/pact/README.md
- modules/pact/capabilities.go
- modules/pact/content.go
- modules/phrasebook/lang/en/validate.yaml
- modules/phrasebook/lang/pl/validate.yaml
- modules/phrasebook/lang/pl/validation.yaml
- modules/signpost/README.md
- scripts/check-phase33.sh
covered_digest: "v2:sha256:5894be73f12c8d469b5e95fdd10da818daf2a59e0d37d8e9d6e19078eafcf5e9"
behavior_unverified: 0
overrides_applied: 3
overrides:
- must_have: "G2 (33-08 drift check): no false journal-tag drift warning while golem15.journal.tag_pages is false"
reason: "Log noise only, no must-have violated. The fix needs a framework change: signpost.Activate refuses a menu item type whose DefaultPattern does not start with /, so sm-journal-plugin cannot drop the journal-tag pattern while tag pages are off (an additive pact field such as ContentDescriptor.Routable, or a signpost rule). Deferred to v0.6.2 (deferred-items.md, 33-12 entry and 'From 33-15'). Still seen at every Nuxt start on the demo and on grzybyfunkcjonalne.pl after the release (33-release-log.md steps 9b and 9d)"
accepted_by: "Jakub Zych"
accepted_at: "2026-11-04"
- must_have: "D-106 / W5: framework v0.6.1 is strictly additive (patch); lagoon.Validate's stricter min/max length check ships in it"
reason: "Kept in v0.6.1 with an explicit 'Changed' entry in 33-14-notes-summercms-v0.6.1.md (a stored value longer than its max fails its next admin save). The entry is on the published post https://summercms.io/changelog/summercms-0-6-1 (checked 2026-11-05). The production SQL check that was its second condition is waived by the override below"
accepted_by: "Jakub Zych"
accepted_at: "2026-11-04"
- must_have: "W5 before the v0.6.1 tag: run 33-14-risk-max.sql (read-only) against every production database whose app takes v0.6.1"
reason: "Waived by Jakub on 2026-11-05 ('don't mind it'; no production fonoteka, the app the check was written for). Not run on the databases that did take v0.6.1 (summercms.io, demo.summercms.io, grzybyfunkcjonalne.pl); the residual risk is that a stored value longer than its max fails its next admin save until it is shortened, which the published v0.6.1 notes state. Recorded in 33-release-log.md (Task 3 answer) and 33-14-SUMMARY.md"
accepted_by: "Jakub Zych"
accepted_at: "2026-11-05"
re_verification:
previous_status: human_needed
previous_verified: 2026-11-04T23:53:40Z
previous_commit: 9c11b70
previous_score: "Roadmap SC 3/4 (SC1 production part pending the release); plan must-haves 226/235 (5 pending the release, 3 superseded, 1 human)"
gaps_closed: []
gaps_remaining: []
regressions: []
human_items_settled:
- item: 1
test: "33-14 Task 4 release steps"
disposition: "satisfied: 33-release-log.md steps 0-10 and 6b-9f; 11 tags on their origins and on the default branches, checked with git ls-remote in this run"
- item: 2
test: "W5 before the v0.6.1 tag: 33-14-risk-max.sql"
disposition: "accepted override (waived by Jakub, 2026-11-05)"
- item: 3
test: "SC1 production grzybyfunkcjonalne.pl"
disposition: "satisfied for deploy-log checklist items 1, 2, 4 (public part) and 8 and the urls.txt check (production smoke ok, 149 urls; smoke-seo ok); items 1 and 2 re-checked live in this run. Checklist items 3, 5, 6 and 7 move to human item 3 below"
- item: 4
test: "G1 on a deployed site (demo)"
disposition: "satisfied: /subscriptions left out with reason noindex without the manual removal (33-release-log.md step 9b); re-checked live: absent from sitemap-pages-1.xml and from the HTML sitemap's page group, page answers noindex, nofollow"
human_verification:
- test: "SC3 live workflow: run a crawl from SEO › Crawls on a deployed site, then from a real Claude client linked over MCP ask it to fix the reported issues with dry_run, review the preview, apply"
expected: "Every data issue names a tool the client can call (sitemap_update_settings for a noindex Additional address); dry runs write nothing; applying fixes the data issues; fix: code issues are named as template work"
why_human: "External agent-driven workflow (33-VALIDATION.md manual-only row)"
- test: "D-46: Google's Rich Results Test for a post, a category and an FAQ page from the admin's Rich Results link"
expected: "No errors for BlogPosting, CollectionPage/ItemList and FAQPage"
why_human: "External Google tool (33-VALIDATION.md manual-only row)"
- test: "Visual check after the deploys: grzyby home, /blog, a category, a post, /autor/admin on desktop and mobile; the demo on prefix_except_default (/pl/... addresses, LanguageSwitcher, /pl/mapa-strony and /sitemap each in its own locale, footer link to the visitor's locale); the new admin screens (SEO tab, Site audit, Crawls with the cancelling state, Auto-links, Pages, Settings › Sitemaps with the headings left empty) including the Blog Editor outline with long headings at 360px (33-02 J2)"
expected: "Layouts render as in 33-UI-SPEC.md; long outline headings wrap with a hanging indent and are not truncated. This item also carries the open grzybyfunkcjonalne.pl checklist items of 33-13-deploy-log.md: item 3, SEO › Pages in /gfadmin lists /, /blog (Artykuły), /kontakt and /trwaja-prace (Trwają prace), none Not on the site, SEO tabs with the CSV descriptions (and, from item 4, Settings › Sitemaps shows the five files with their counts); item 5, a crawl from SEO › Site audit finishes with no /en/ 404s and no duplicate sitemap entries; item 6, the 0.8 card and title markup on desktop and mobile (whole-card links, no more link, breadcrumbs, footer Mapa strony); item 7, resubmit https://grzybyfunkcjonalne.pl/sitemap.xml in Search Console and check that Google reads its files"
why_human: "Visual rendering (element tests run under happy-dom without layout), logged-in admin screens on production, and Google Search Console"
---
# Phase 33: SEO output, audit and content Verification Report
**Phase Goal:** As a site editor and as an SEO specialist auditing a SummerCMS site, I want to have the rendered sites emit complete SEO output (sitemaps, structured data, pagination, hreflang, headings, breadcrumbs) from the CMS, and an audit that finds the remaining problems, so that sites are indexed correctly and issues can be fixed through MCP.
**Verified:** 2026-11-05T01:29:36Z
**Status:** human_needed
**Re-verification:** Yes, the second one, after the 33-14 release (Task 4). It covers 33-14-SUMMARY.md, 33-release-log.md, 33-13-deploy-log.md and the 33-14 release notes. The gap-closure re-verification (2026-11-04T23:53:40Z, human_needed, commit 9c11b70) and the initial verification (2026-11-04T20:20:34Z, gaps_found, commit 97abc77) are kept below.
**Mode:** mvp.
## Release re-verification result (2026-11-05T01:29:36Z)
The release happened as the SUMMARY says, as far as read-only checks can see. All 11 tags are on their origins, and each tagged commit is on its repository's default branch. The four changelog posts answer 200. Production grzybyfunkcjonalne.pl serves the new sitemap format and the CMS head. The demo leaves the noindex `/subscriptions` out of both sitemaps, with no manual removal. The framework HEAD has no code change since v0.6.1. `go vet ./...` and `go test -short ./...` pass, and gofmt is clean.
No gap is open. Four of the seven human items in 33-UAT.md are settled here: three by evidence and one by an accepted override. Three stay open for a human: the live MCP session, the Rich Results Test, and the visual and admin checks. The third of these now also carries the open grzybyfunkcjonalne.pl checklist items 3, 5, 6 and 7. Status: human_needed.
### User Flow Coverage
| Step | Expected | Evidence | Status |
|------|----------|----------|--------|
| Editor publishes content | Sitemap index with per-type files, real lastmod, stable numbering | Unchanged from the gap-closure run. Live: grzybyfunkcjonalne.pl/sitemap.xml is a sitemapindex of authors, categories, pages, posts and images; demo.summercms.io/sitemap.xml is an index of 4 files | ✓ |
| Crawler/visitor opens a page | SSR head from the CMS, one JSON-LD @graph, hreflang for translated locales only, breadcrumbs | Live on /blog/blogchaga-wprowadzenie: 1 canonical on the apex, 1 ld+json script (WebSite, Organization, WebPage, BlogPosting, BreadcrumbList, Person, ImageObject), robots `index, follow`, 0 hreflang (site is Polish only), `nav.seo-breadcrumbs` Strona główna › Chaga › post, og:type article | ✓ |
| Nuxt-only noindex page | Leaves the XML and HTML sitemaps | Live on the demo: /subscriptions answers `noindex, nofollow` (header and meta); it is absent from sitemap-pages-1.xml (/, /blog, /chat, /contact, /faq, /forum, /quizzes) and from the "Page" group of /sitemap. Its only link there is the header menu | ✓ |
| SEO specialist runs the audit | Issues per URL, each with an MCP tool or fix: code | Automated as before; live MCP session is human item 1 | ✓ (live MCP session: human) |
| Outcome | "sites are indexed correctly and issues can be fixed through MCP" | Production grzybyfunkcjonalne.pl now runs the tagged build: production smoke `ok (149 urls)`, smoke-seo ok, and the live checks above. Search Console reading the index is human item 3 | ✓ (GSC and the MCP fix loop: human) |
### Roadmap Success Criteria
| # | Truth | Status | Evidence |
|---|-------|--------|----------|
| SC1 | Sitemap index with per-type files, configurable size, stable numbering, real lastmod, consistent with noindex and robots.txt; grzybyfunkcjonalne.pl on the new format | ✓ VERIFIED | Code level as before. Production, checked live in this run: /sitemap.xml is a `<sitemapindex>` of sitemap-authors-1, -categories-1, -pages-1, -posts-1 and -images-1 on the apex. sitemap-posts-1.xml has 62 `<loc>` entries, 62 unique, 62 `<lastmod>`, 0 `/en/`, 0 hreflang. sitemap-pages-1.xml lists /, /blog, /kontakt and /trwaja-prace once each, so the Additional addresses step held. /sitemap.xsl answers 404. /en/blog answers 404. robots.txt has `Sitemap: https://grzybyfunkcjonalne.pl/sitemap.xml`. /mapa-strony answers 200 with 74 links. http and www redirect 301 to the apex. Noindex consistency is proven live on the demo (row above). Logged only, not re-run: the production smoke `ok (149 urls)` after the `/autor/admin` expectation fix (0554f3e), smoke-seo ok and `check-deploy.sh --live` ok (33-release-log.md 9e and 9f) |
| SC2 | Server-side head, one JSON-LD @graph, hreflang, breadcrumbs from the CMS; build fails on an indexable ssr:false route | ✓ VERIFIED | As before, plus the live production post above. The demo strict `smoke-seo` passed after its deploy: 5 hreflang links on a post and a /pl/ alternate answering 200 (33-release-log.md 9b, logged) |
| SC3 | Crawler reports issues per URL, each fixable through MCP | ✓ VERIFIED (automated) | Unchanged. Live client session: human item 1 |
| SC4 | New code has unit tests in the phase's last plan | ✓ VERIFIED | Unchanged. The release pre-check reran `PHASE33_REQUIRE_DOCKER=1 check-phase33.sh --all` green on 6d14f71 (logged, step 0). This run reran the framework's `go vet ./...` and `go test -short ./...` at HEAD: both exit 0 |
**Score:** 4/4 roadmap criteria verified. Plan must-haves: 231/235 truths verified, 0 failed, 0 pending, 3 superseded, 1 human, 0 present-but-behaviour-unverified.
### Truths that were pending the release
| Plan | Truth | Now | Evidence |
|------|-------|-----|----------|
| 33-13 #1 | urls.txt answers every line as before, repeated on the tagged build | ✓ VERIFIED | Tagged-build rehearsal `smoke: ok (128 urls)`, then `ok (129 urls)` after the `/autor/admin` fix. On production, `ok (149 urls)` with urls-production.txt. One line had failed on production because it was bound to the rehearsal's author name ("admin"); the site was fine (release log 9e). The fix checks only the fixed parts of the title (sm-grzybyfunkcjonalne-app 0554f3e, on origin/master) |
| 33-14 #6 | Release order framework → journal → sitemap → seo → vue-seo-layer → content layers → apps; layers pin the tag instead of link: | ✓ VERIFIED | `git ls-remote --tags` in this run found all 11 tags: summercms v0.6.1 (5db8c61 → 6d14f71), sm-journal-plugin v0.4.0 (48aa3ff → 6823dcc), sm-sitemap-plugin v0.2.0 (1188efd → fdbe593), sm-seo-plugin v0.2.0 (adda8a9 → 22f108b), vue-seo-layer v0.2.0 (b69647f → 3868f3d), vue-journal-layer v0.8.0 (7d93f06 → 0a77e6e) and v0.8.1 (5c26b5d → f5dc9b2), vue-menu-layer v0.5.0 (7e90962 → c605384) and v0.5.1 (47b022e → dc38f79), vue-faq-layer v0.5.0 (cae1502 → 9cc7f91) and v0.5.1 (8d46b31 → a092363). Each tagged commit is an ancestor of its origin default branch, and each origin default branch head is the newest tag's commit, so nothing is tagged off the default branch. The tagged go.mod files require summercms v0.6.1, and sm-seo-plugin also requires sm-sitemap-plugin v0.2.0. The tagged v0.8.1/v0.5.1 package.json files have 0 `link:`: vue-seo-layer is a `^0.2.0` peer plus a `#v0.2.0` git devDependency. This is the option-B deviation Jakub chose after v0.8.0 failed `check-git-install.sh` (ERR_PNPM_EXOTIC_SUBDEP); v0.8.0 and v0.5.0 remain published but do not install with pnpm 12 defaults |
| 33-14 #7 | Patches applied after the tags, apps build and test on the tagged versions, demo check-pins | ✓ VERIFIED (logged; pins checked) | Logged in release log 7a–7d: the builds, tests, `check-pins ok (25 modules)`, static `-tags nodynamic` binaries and smokes. Checked in this run: origin/master of sm-summercmsio-app (395ed78), sm-demo-app (da03c06), sm-grzybyfunkcjonalne-app (0554f3e) and sm-bm-app (43f2fc9) equals the logged heads. The three Journal apps require summercms v0.6.1 and journal v0.4.0, and the demo and grzyby also require seo and sitemap v0.2.0. summer.yaml carries `nodynamic`. The frontend pointers are vue-demo-app fe5d38d, vue-grzybyfunkcjonalne-app 0771c14 and vue-summercmsio-app 16ab519 |
| 33-14 #8 | Framework changelog post the same day; token never printed | ✓ VERIFIED (token: judgment, logged) | In this run, https://summercms.io/changelog/summercms-0-6-1, sm-sitemap-plugin-0-2-0, sm-seo-plugin-0-2-0 and sm-journal-plugin-0-4-0 each answer 200 with matching titles. The three plugin posts are linked from /changelog/plugins. The v0.6.1 post carries the W5 "Changed" text and the nodynamic note |
| 33-14 #9 | Every executed release step appended to 33-release-log.md | ✓ VERIFIED | Steps 0–10 plus 6b, 6c, 6d, 7a–7d, 9a–9f are present, with TAG lines for all 11 tags. The failed 6b and 9e steps are recorded with their checkpoint answers |
Totals (235): 226 from the gap-closure run + 5 above = 231 verified. Superseded: 3 (the two uat truths of 33-13 and the uat check of 33-14; Jakub's 2026-11-04 decision, no uat). Human: 1 (J2 at 360px, in human item 3).
Prohibitions, judgment tier (non-authoritative): D-106 "no push, tag, deploy or post without Jakub's go-ahead" holds per the recorded Task 3 answer and the two checkpoint answers (6c, 9f). "The changelog token is never printed" is supported only by the log ("read by the script only, never printed"), and this run cannot observe it.
### Human items of 33-UAT.md
| UAT row | Item | Disposition here |
|---------|------|------------------|
| 1 | 33-14 Task 4 release steps | **Satisfied** by 33-release-log.md and the tag, branch, pin and changelog checks above. One deviation is accepted at a checkpoint: the layers ship as v0.8.1/v0.5.1 with a peer dependency (option B). The rehearsal databases were rebuilt from scratch rather than recreated from dumps: grzyby used a fresh throwaway database with the PHP export, and the demo uses migrate plus demo:seed. That meets the intent, since the edited migration ran on a clean database |
| 2 | W5 SQL check | **Accepted override** (Jakub, 2026-11-05: "don't mind it"; no production fonoteka). Residual risk recorded in the override |
| 3 | SC1 production grzybyfunkcjonalne.pl | **Satisfied** for the urls.txt check and checklist items 1, 2, the public part of 4, and 8 (nodynamic, so the built-in WebP encoder; 285 variants written). Items 1 and 2 were re-checked live. Items 3, 5, 6 and 7 (and the admin files table of item 4) need a human with /gfadmin or Search Console access and move to human item 3 |
| 4 | G1 on the demo | **Satisfied**: the route report sent 7 routes and 20 noindex paths; Settings › Sitemaps reported left_out `{"noindex":1}` (logged, step 9b). Re-checked live as in the flow table. The row's "a crawl reports no sitemap_noindex" follows, because the address is not in any sitemap, and the live crawl itself is part of human item 1 |
| 5 | SC3 live MCP workflow | Open: human item 1 |
| 6 | D-46 Rich Results Test | Open: human item 2 |
| 7 | Visual and admin checks | Open: human item 3, now including grzyby checklist items 3, 5, 6 and 7 |
33-UAT.md is not edited here. Rows 1–4 stay `[pending]` until `/msd-verify-work 33` records them: pass for rows 1, 3 and 4 with this report as evidence, and skipped with the override as reason for row 2. Row 7's text in the UAT file does not list the grzyby checklist items. They are in this report's `human_verification` item 3 and in 33-13-deploy-log.md.
### Behavioral spot-checks (this run, read-only)
| Behavior | Command | Result | Status |
|----------|---------|--------|--------|
| 11 tags on origin | `git ls-remote --tags origin refs/tags/<t> refs/tags/<t>^{}` per repository | All 11 present; tag objects and peeled commits as in the table above | ✓ PASS |
| Tags on the default branch | `git merge-base --is-ancestor <commit> origin/<default>`; `ls-remote` of the default branch | All 11 ancestors; each default branch head equals its newest tag's commit | ✓ PASS |
| Changelog posts | `curl` of the four post URLs and /changelog/plugins | 200 ×5; the three plugin posts are linked from /changelog/plugins | ✓ PASS |
| grzyby sitemaps | `curl` /sitemap.xml, /sitemap-posts-1.xml, /sitemap-pages-1.xml, /sitemap.xsl, /robots.txt, /mapa-strony, /en/blog | index of 5 files; posts 62/62 unique/62 lastmod, 0 /en/, 0 hreflang; pages 4; xsl 404; Sitemap: line; HTML sitemap 200; /en/blog 404 | ✓ PASS |
| grzyby post head | `curl` /blog/blogchaga-wprowadzenie | 200; 1 canonical (apex), 1 ld+json, 0 hreflang, robots index, follow, breadcrumbs, og:type article; header `X-Robots-Tag: index, follow` | ✓ PASS |
| Demo noindex page | `curl` /sitemap-pages-1.xml, /sitemap, /subscriptions | /subscriptions absent from both sitemaps' page lists; page answers `noindex, nofollow` | ✓ PASS |
| Framework unchanged since the tag | `git diff --quiet v0.6.1 HEAD -- ':!.planning'` | no diff; 6d14f71 is formatting only (`git show -w` shows one function literal split over lines) | ✓ PASS |
| Framework regression | `go vet ./...`; `go test -short ./...` | exit 0 and exit 0 | ✓ PASS |
| gofmt leftovers of the previous run | `gofmt -l` over tracked Go files (framework, sm-journal-plugin) | 0 and 0; the two Info rows on sm-journal-plugin formatting are resolved (b8d98ce) | ✓ PASS |
| No debt markers in the release commits | added-line grep for TBD/FIXME/XXX/TODO/HACK over each repository's release diff | none; the one hit is a `mktemp` template `XXXXXX` in vue-journal-layer's check-git-install.sh | ✓ PASS |
Not re-run here: the Docker gate, the app builds and smokes, and the server-side steps (migrations, `journal:image-variants`, 404-log cleanup). They are logged in 33-release-log.md with their outputs.
### Anti-patterns and notes from the release
| Item | Severity | Impact |
|------|----------|--------|
| `check-phase33.sh --consumers` refuses after the release (`33-12-sm-demo-app.patch does not apply`): it checks the release patches against unpatched app HEADs | ⚠️ Warning (follow-up) | `--all` no longer passes as-is on the released state. The script needs a post-release mode or the stage retired; recorded as a known follow-up in 33-14-SUMMARY.md. Not a goal gap: the apps' own builds, tests and smokes ran |
| Posts now send `X-Robots-Tag: index, follow` (seen live) | ℹ️ Info | Harmless; the 2026-10-31 cutover check in grzyby DEPLOY.md expected no header and should be updated |
| G2 journal-tag drift line at every Nuxt start (demo, grzyby) | ℹ️ Info (override) | Deferred to v0.6.2 |
| The tagged plugin go.mod files keep `replace git.golem15.com/golem15/summercms => ../summercms.go` | ℹ️ Info | Same as at their earlier tags; a replace in a dependency's go.mod is ignored by consumers |
| vue-journal-layer v0.8.0, vue-menu-layer v0.5.0 and vue-faq-layer v0.5.0 stay published but fail to install with pnpm 12 defaults | ℹ️ Info | READMEs and notes direct users to v0.8.1/v0.5.1 |
| sm-bm-app stays on framework v0.6.0 | ℹ️ Info | bm mounts no Journal; its noindex deploy was the D-72 part |
| summercms.go planning commits after the v0.6.1 push are local | ℹ️ Info | Planning docs only, not pushed |
| covered_files leaves out the 15 files of 6d14f71 `style: gofmt` | ℹ️ Info | Formatting of files outside the phase's features (cmd/summer, cabana token tests, tide, compass…). They are not covered, so later edits there do not mark this phase stale |
### Gaps Summary
None. The release that the previous run left pending is done and evidenced. W5's SQL check is an accepted override. Three human items remain: the live MCP crawl, dry run and apply; the Rich Results Test; and the visual and admin checks, including grzybyfunkcjonalne.pl checklist items 3, 5, 6 and 7 and the Search Console resubmit.
---
# Gap-closure re-verification (2026-11-04T23:53:40Z, human_needed, commit 9c11b70)
The report below is kept unchanged, with its headings moved down one level. Its human items 1–4 are settled above, and its items 5–7 are the current human items 1–3.
## Phase 33: SEO output, audit and content Verification Report
**Phase Goal:** As a site editor and as an SEO specialist auditing a SummerCMS site, I want to have the rendered sites emit complete SEO output (sitemaps, structured data, pagination, hreflang, headings, breadcrumbs) from the CMS, and an audit that finds the remaining problems, so that sites are indexed correctly and issues can be fixed through MCP.
**Verified:** 2026-11-04T23:53:40Z
**Status:** human_needed
**Re-verification:** Yes, after gap closure (33-15, 33-16, quick 261104-xae). The initial verification (2026-11-04T20:20:34Z, gaps_found, commit 97abc77) is kept below.
**Mode:** mvp.
Repository HEADs checked (none tagged, nothing pushed; commits since the base tag): summercms.go 6e99b18 (84 since v0.6.0, planning docs included), sm-sitemap-plugin b2b3a1d (23 since v0.1.2), sm-seo-plugin c71b58e (37 since v0.1.1), sm-journal-plugin cf13c60 (21 since v0.3.1), vue-seo-layer 3868f3d (24 since v0.1.1), vue-journal-layer 761c7fc (16 since v0.7.1), vue-menu-layer a7602c9 (2 since v0.4.0), vue-faq-layer 5e5950a (4 since v0.4.0).
### Re-verification result (2026-11-04T23:53:40Z)
Both gaps are closed in code, each with a test on the production path. No earlier must-have regressed. The full gate passed again in this run. G2 and W5 are recorded as accepted overrides, following Jakub's decisions of 2026-11-04. What remains is the release (33-14 Task 4) and the checks that can only run after it, so the status is human_needed.
#### User Flow Coverage
| Step | Expected | Evidence | Status |
|------|----------|----------|--------|
| Editor publishes content | Sitemap index with per-type files, real lastmod, stable numbering | as before; plus the rebuild lock (TestConcurrentRebuilds) and kept lastmods (TestRebuildKeepsMovedLastmod) | ✓ |
| Crawler/visitor opens a page | SSR head from the CMS, one JSON-LD @graph, hreflang for translated locales only, breadcrumbs, pagination | G3 closed: Journal descriptors give a URL only to locales with content (TestContentDescriptorsTranslatedLocales, Postgres); the SEO and sitemap plugins drop URL "" (alternates.go:72, rebuild.go:251) | ✓ |
| Nuxt-only noindex page | Leaves the XML and HTML sitemaps | G1 closed: the route report sends `noindex`, and the plugin stores the set and excludes those paths with reason noindex (TestNoindexPathsTracer) | ✓ (live round trip: human) |
| SEO specialist runs the audit | Issues per URL, each with an MCP tool or fix: code | sitemap_noindex on an Additional address names sitemap_update_settings (TestSitemapNoindexTool); the crawl lifecycle is fixed (TestCrawlTimeout, TestCrawlCancelRunning, TestCrawlStaleRecovery, TestCrawlStoreTimeout) | ✓ (live MCP session: human) |
| Outcome | "sites are indexed correctly and issues can be fixed through MCP" | Holds in code and on the fixture and rehearsal sites; production grzybyfunkcjonalne.pl is pending the release | ⚠ pending the release (human) |
#### Roadmap Success Criteria
| # | Truth | Status | Evidence |
|---|-------|--------|----------|
| SC1 | Sitemap index with per-type files, configurable size, stable numbering, real lastmod, consistent with noindex and robots.txt; grzybyfunkcjonalne.pl on the new format | ✓ code level; production ⚠ PENDING RELEASE (human) | Noindex consistency now covers Nuxt-only noindex pages: vue-seo-layer `noindexStaticRoutes` (lib/routes.ts) → `#seo-routes` `noindexPaths` → `routeReportBody(staticRoutes, noindexPaths)` (server/plugins/seo-route-report.ts:26) → controllers/api/registry.go `Noindex *[]string` → `ReportNoindex` (classes/registry.go:832, `golem15_seo_noindex_paths`, Rebuilder after commit) → filter `b.noindex[norm.Path]` (classes/sitemap_filter.go:174). The grzyby deploy happens after the tags |
| SC2 | Server-side head, one JSON-LD @graph, hreflang, breadcrumbs from the CMS; build fails on an indexable ssr:false route | ✓ VERIFIED | G3 closed: `tr.hasContent` (classes/menu_item_types.go:1134) sets URL "" for a locale without content in describePosts (content_descriptors.go:178) and describeCategories (:498); tags and authors go through `postContentLocales`. The real-path Postgres test asserts `de=` (no URL) for untranslated records and still gives Resolve all three locales. Post pages also keep og:type article (L4 WR-02) |
| SC3 | Crawler reports issues per URL, each fixable through MCP | ✓ VERIFIED (automated) | The caveat recorded inside G1 is gone: sitemap_noindex on a listed address without a record names `sitemap_update_settings` (`crawl.SitemapTool`, checks.go:351). Live client session: human item |
| SC4 | New code has unit tests in the phase's last plan | ✓ VERIFIED | 33-14's 39 test files as before. Each gap-closure fix carries its own test (33-15 table of 21 findings, 33-16 table of 8, xae RED/GREEN for WR-01 to WR-04); `check-phase33.sh --all` green in this run |
**Score:** 3/4 roadmap criteria verified, SC1's production part pending the release. Plan must-haves: 226/235 truths verified, 0 failed, 0 present-but-behaviour-unverified.
#### Previously failed truths
| Plan | Truth | Now | Evidence |
|------|-------|-----|----------|
| 33-03 #4 | "…xhtml:link alternates for each translated locale…; a locale without a URL gets no alternate…" | ✓ VERIFIED | The Journal descriptors now produce URL "" for untranslated locales on the real path (TestContentDescriptorsTranslatedLocales passed in this run). TestHreflangAlternates (sm-sitemap-plugin b2b3a1d) now uses Journal-shaped records with every enabled locale present; it passed in this run. The fixture-only reliance recorded in the first verification is gone |
| 33-06 #7 | "hreflang comes from one source…; a locale without a translation is absent…" | ✓ VERIFIED | Same descriptor rule; `translatedLocales` (sm-seo-plugin classes/alternates.go:65-79) drops URL ""; TestAlternates (sm-seo-plugin 2a288a9, Journal-shaped records) passed in this run |
#### Plan must-haves of the gap-closure plans
| Plan | Truths | Result | Notes |
|------|--------|--------|-------|
| 33-15 Go plugins | 23 | 23 verified | One wording superseded. The L1 CR-02 truth said markdown content is "kept byte for byte". Quick 261104-xae (WR-01) reworded it: content is always read as markdown, code ranges stay untouched (also when the body starts with an HTML block), and a raw `<h1>` outside code is converted, as in v0.3.1. The intent (no code sample rewritten) holds and is tested (TestConvertContentH1HTMLLead, TestConvertTranslationH1, Docker TestHeadingConversion). The v0.4.0 notes state the rule. The G2 truth holds as worded: the reason is recorded in deferred-items.md and the SUMMARY |
| 33-16 Nuxt layers | 10 | 10 verified | L4 WR-08 (503 while the backend has not answered since start) keeps its meaning after xae WR-04, which remembers the last definite answer (`lastKnown`, server/lib/site.ts:32-66). The L4 CR-01 release guard is in place. The link: swap is a Task 4 step (human item 1) |
Totals (235): 191 earlier + 2 previously failed (now verified) + 23 + 10 = 226 verified. Still pending the release: 5 (33-13 truth 1 repeated on the tags; 33-14 release order, patches with app builds and check-pins, changelog post, release-log steps). Superseded by Jakub's 2026-11-04 decisions: 3 (two uat truths of 33-13, the uat check of 33-14). Human: 1 (J2 at 360px).
#### Overrides applied
| Item | Kind | Disposition |
|------|------|-------------|
| G2 false journal-tag drift warning | warning (no must-have violated) | Accepted deferral to v0.6.2 (Jakub, 2026-11-04). It needs a framework change in signpost.Activate or an additive pact field. Not a gap |
| W5 stricter min/max length check in v0.6.1 (D-106 "strictly additive") | judgment-tier prohibition | Accepted for v0.6.1 (Jakub, 2026-11-04). The "Changed" note is present in 33-14-notes-summercms-v0.6.1.md:19, and 33-14-risk-max.sql exists. Running it on production before the tag is human item 2 |
#### Review findings in scope
**33-REVIEW.md, as filtered by the 33-15 and 33-16 plans.** In scope were:
- L1: CR-01, CR-02, WR-01, WR-02 (docs), WR-03, WR-05;
- L2: WR-01 to WR-05, IN-01;
- L3: CR-01, WR-01, WR-03, WR-04, WR-06;
- L4: CR-01, WR-01 to WR-05, WR-08;
- G1 and G3.
All are resolved, with these three notes:
- **L1 CR-02 and L1 WR-05.** The re-review rated them partial. Quick 261104-xae completed them (WR-01 and WR-02 below).
- **L4 CR-01.** The guard, the versions and the pins are done. The link: swap is a Task 4 step by plan.
The 33-REVIEW-GAPFIX.md verdict table has 26 rows: 19 resolved and 3 partial, and the 3 partial ones are now closed as described above.
**33-REVIEW-GAPFIX.md warnings:**
| Finding | Fix (commit) | Code checked | Test (passed in this run) |
|---------|--------------|--------------|---------------------------|
| WR-01 `<`-prefixed markdown, h1 in code | sm-journal-plugin a41d537 | `ConvertContentH1` calls `convertH1OutsideCode(content)` without a first-byte gate (classes/headings.go:79-93) | TestConvertContentH1HTMLLead (named run), plus the Docker suite |
| WR-02 images/alt content_html-only and `<`-prefixed markdown | sm-journal-plugin cf13c60 | `strings.TrimSpace(text.content) == ""` branch, else SetMarkdownImageAlt and SetImageAltOutsideCode (controllers/api/maintenance.go:173-195) | TestSetImageAltBodyShapes (named run, Postgres) |
| WR-03 terminal write shares the store deadline | sm-seo-plugin c71b58e | `finalWriteTimeout` 30 s on a detached parent, `WithFinishTimeout` seam, error "storing the crawl results took longer than …" (classes/crawl/job.go:62-74, 426-429) | TestCrawlStoreTimeout (named run, Postgres) |
| WR-04 root files hijacked after an outage on SEO-less backends | vue-seo-layer 3868f3d | `lastKnown` remembers ok or absent; unknown answers the remembered state (server/lib/site.ts:32-66) | rootFiles.test.ts (vue-seo-layer 156/156 in the layers stage) |
Out of scope, deferred to the v0.6.2 backlog by the plans (deferred-items.md "From 33-15"):
- L1 WR-04, WR-06, WR-07;
- L2 WR-06 to WR-08;
- L3 WR-02 and WR-05;
- L4 WR-06 and WR-07;
- the info items;
- the verifier warnings W1 to W4.
#### Behavioral spot-checks, gate and patches
| Behavior | Command | Result | Status |
|----------|---------|--------|--------|
| Full phase gate, Docker and Chromium present | `PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --all` | All 11 stages PASS: self-test, go, plugins, layers (seo 156, journal 202, menu 24, faq 19 TAP, no failures; smokes; check-git-install self-test), consumers, admin, docs, marker, docker (sitemap 62, seo 154, journal 142 top-level tests on full `./...` runs that refuse any skip; framework attach 57), additive (5 packages against v0.6.0), compat. Ends "Phase 33 gate passed", exit 0. Compat skipped sm-feedback-plugin as before (fails at v0.6.0 too) | ✓ PASS |
| G1, G3 and xae tests by name | `go test -count=1 -run '^(…)$' ./...` in each plugin | PASS: TestContentDescriptorsTranslatedLocales, TestSetImageAltBodyShapes, TestConvertContentH1HTMLLead, TestNoindexPathsTracer, TestCrawlStoreTimeout, TestAlternates, TestSitemapNoindexTool, TestHreflangAlternates, TestListing | ✓ PASS |
| Gap-closure tests exist | `go test -short -list` | Present: TestCrawlTimeout, TestCrawlCancelRunning, TestCrawlStaleRecovery, TestRenderTabTimeout, TestFetcherPortAndKey, TestCrawlerNonASCII, TestAllowRequest, TestConcurrentRebuilds, TestRebuildKeepsMovedLastmod, TestIndexNowStaging, TestTypeTitlesNotPinned, TestRecordSavedNilEvent, TestConvertLegacyItems, TestFixHeadingsCommandCLI, TestImageVariantsTallOriginal, TestSetMarkdownImageAlt, TestSetImageAltEdges (all run inside the green docker and short suites) | ✓ PASS |
| App patches on current HEADs | `git apply --check --allow-empty` | OK for each patch on its app's HEAD: 33-12-sm-demo-app (sm-demo-app da481c9), 33-12-vue-demo-app (vue-demo-app 9a12701), 33-12-sm-summercmsio-app (ca06049), 33-12-vue-summercmsio-app (f36cbf1), 33-13-sm-grzybyfunkcjonalne-app (35d3664), 33-13-vue-grzybyfunkcjonalne-app (e45ffe8) | ✓ PASS |
| Demo locale patches stacked | scratch worktrees: apply the 33-12 patch, then `git apply --check` of 33-14-*-locale.patch | OK for both; vue-demo-app ends on `strategy: 'prefix_except_default'` with the `/pl/mapa-strony` sitemap path; worktrees removed | ✓ PASS |
| Journal stays additive | `git diff v0.3.1..HEAD` of non-test Go files: removed or changed exported `func` lines | 0; menu_item_types_test.go and the smoke test unchanged since 311c28a | ✓ PASS |
#### Anti-patterns and remaining notes
| File | Pattern | Severity | Impact |
|------|---------|----------|--------|
| all phase repositories | No TBD/FIXME/XXX/TODO/HACK added since each base tag | — | — |
| sm-journal-plugin controllers/api/posts.go | `gofmt -l`: import order (`compass` above `bouncer`), introduced by phase 33 (the file was gofmt-clean at v0.3.1) | ℹ️ Info (known leftover) | Formatting only; fix with `gofmt -w` before the v0.4.0 tag |
| sm-journal-plugin classes/blog_editor_test.go | `gofmt -l`: map literal alignment. The file was already unformatted at v0.3.1, and phase 33 changed it | ℹ️ Info (known leftover) | Test file, formatting only |
| sm-seo-plugin go.mod | Requires sm-sitemap-plugin v0.1.2, which has no `contract` package; works only through go.work | ⚠️ Release step | Pin v0.2.0 in Task 4 (human item 1); the 33-15 SUMMARY records it |
| vue-journal-layer, vue-menu-layer, vue-faq-layer package.json | `"vue-seo-layer": "link:../vue-seo-layer"` | ⚠️ Release step | Do not tag before the Task 4 swap; `--check-links` blocks it |
| sm-journal-plugin (G3 follow-up) | An untranslated locale's address still answers with the default-locale content and a self canonical; it is no longer advertised in hreflang or the sitemaps | ℹ️ Info | Deferred decision (canonical to the default locale or a 404), deferred-items "From 33-15" |
| xae residuals | images/alt answers 422 for an `<img>` in an HTML body after a blank line and 4+ spaces of indent (an indented code block to goldmark). A backend whose /site answers 200 HTML or 401/403 stays unknown | ℹ️ Info | Recorded in the 261104-xae SUMMARY; the workarounds are documented there |
| W1 to W4 | Home title template, swr localhost canonicals, route-report names without diacritics, GORM local timestamps | ℹ️ Info | Deferred to v0.6.2 as before |
| 33-REVIEW-GAPFIX notes below the warning bar | Shutdown during a crawl maps to cancelled; DeleteCrawls does not end stale conga records; collect runs inside an idle transaction; the `IN` list in postContentLocales hits the parameter limit past about 65k posts; repeat IndexNow pings for excluded rows | ℹ️ Info | Not counted by the reviewer; candidates for the v0.6.2 backlog |
The first verification's info rows are settled. The stale "Saving Settings › Journal answers 500" entry is now marked resolved (deferred-items.md:14). The W5 warning became the override above.
#### Human Verification Required
These are listed in the frontmatter `human_verification`. Everything except item 7 depends on the release.
1. 33-14 Task 4 release steps: tags in order, the sm-seo-plugin pin, the link: swap with `--check-links`, app pins and patches, `-tags nodynamic` with the DEPLOY.md row fixed, rehearsal databases recreated, changelog posts.
2. W5: 33-14-risk-max.sql on the production databases before the v0.6.1 tag.
3. SC1 on production grzybyfunkcjonalne.pl after the tags: the urls.txt check first, then deploy-log items 1-8.
4. G1 live round trip on the deployed demo (noindex Additional address leaves the sitemap without manual removal).
5. SC3 live MCP crawl, dry run and apply.
6. D-46 Rich Results Test.
7. Visual checks (grzyby, demo on prefix_except_default, admin screens, J2 at 360px).
#### Gaps Summary
None. G1 and G3 are closed in code, each with a test on the production path. G2 and W5 are accepted overrides. The phase can proceed to the release step (33-14 Task 4), followed by the human items above.
---
# Initial verification (2026-11-04T20:20:34Z, gaps_found, commit 97abc77)
The report below is kept unchanged, with its headings moved down one level. Its frontmatter `gaps:` block is reproduced here, and the gaps it lists are closed above.
```yaml
gaps:
- truth: "D-57 / SC2 hreflang: a page without a translation has no hreflang for that locale (33-06: 'a locale without a translation is absent'; 33-03: alternates 'for each translated locale')"
status: failed
artifacts: [../sm-journal-plugin/classes/content_descriptors.go, ../sm-journal-plugin/classes/menu_item_types.go]
- truth: "SC1 / D-24: the sitemaps stay consistent with noindex (noindex pages leave the XML and HTML sitemaps)"
status: partial
artifacts: [../vue-seo-layer/server/plugins/seo-route-report.ts, ../sm-seo-plugin/classes/sitemap_filter.go, ../sm-seo-plugin/classes/crawl/checks.go]
```
## Phase 33: SEO output, audit and content Verification Report
**Phase Goal:** As a site editor and as an SEO specialist auditing a SummerCMS site, I want to have the rendered sites emit complete SEO output (sitemaps, structured data, pagination, hreflang, headings, breadcrumbs) from the CMS, and an audit that finds the remaining problems, so that sites are indexed correctly and issues can be fixed through MCP.
**Verified:** 2026-11-04T20:20:34Z
**Status:** gaps_found
**Re-verification:** No, initial verification (plan 33-14 paused at its release checkpoint; Tasks 1 and 2 done)
**Mode:** mvp. The ROADMAP goal reads "I want the rendered sites"; the plans' normalised form above passes `user-story.validate`.
Repositories checked (commits since the base tag; none tagged, all ahead of origin): summercms.go 72 since v0.6.0, sm-sitemap-plugin 17 since v0.1.2, sm-seo-plugin 29 since v0.1.1, sm-journal-plugin 14 since v0.3.1, vue-seo-layer 18 since v0.1.1, vue-journal-layer 11 since v0.7.1, vue-menu-layer 1 and vue-faq-layer 3 since v0.4.0, sm-bm-app bd7ee84 (local D-72 commit).
### User Flow Coverage
| Step | Expected | Evidence | Status |
|------|----------|----------|--------|
| Editor publishes content | Sitemap index with per-type files, real lastmod, stable numbering | sm-sitemap-plugin classes/{slots,writer,lastmod,rebuild}.go; TestSitemapIndex, TestStableNumbering, TestLastmod (docker stage PASS) | ✓ |
| Crawler/visitor opens a page | SSR head from the CMS, one JSON-LD @graph, hreflang, breadcrumbs, pagination | vue-seo-layer useCmsSeo.ts, seo.ts, Breadcrumbs.vue, Pagination.vue; smoke:ssr expect-seo.txt (count=1 canonical/ld+json); layers stage PASS | ✓ except hreflang on untranslated Journal locales (G3) |
| Build of an indexable client-only route | Build fails | lib/guard.ts, testing/guard-check.mjs (guard:check in layers stage PASS) | ✓ |
| SEO specialist runs the audit | Issues per URL, each with an MCP tool or fix: code | classes/crawl/{crawler,checks,fix}.go; TestCrawlerChecks, TestCrawlerTracer; MCP seo_start_crawl … seo_unignore_issues | ✓ (live MCP session: human) |
| Outcome | "sites are indexed correctly and issues can be fixed through MCP" | Holds on the code and fixture sites; production grzybyfunkcjonalne.pl pending the release; G1 and G3 remain | ⚠ gaps + pending release |
### Goal Achievement
#### Roadmap Success Criteria
| # | Truth | Status | Evidence |
|---|-------|--------|----------|
| SC1 | Every site serves a sitemap index with per-type files of a configurable size, stable numbering and real lastmod, consistent with noindex and robots.txt, and grzybyfunkcjonalne.pl runs on the new format | ⚠ PENDING RELEASE + partial gap G1 | Index, per-type files, file_size 1–50 000, stable slots, real lastmod, filter, robots.txt `Sitemap:` line, sitemap_blocked issue: code and Docker suites green. **grzybyfunkcjonalne.pl on the new format is pending the post-tag production deploy (33-13 after-tags decision, no uat any more): human_needed, not failed.** Noindex consistency fails for Nuxt-only noindex pages listed as Additional addresses (G1, recorded by Jakub as a gap) |
| SC2 | Indexable pages render server-side with head tags, one JSON-LD @graph, hreflang and breadcrumbs from the CMS, and a build fails when an indexable route has ssr: false | ✗ PARTIAL (G3) | Head, one @graph, breadcrumbs, pagination, build guard: verified (layers stage: tests, playground builds, smokes, guard:check; demo strict smoke rehearsal in 33-14). hreflang is emitted from the CMS, but for Journal records it lists every enabled locale, translated or not (D-57 violated, G3) |
| SC3 | The crawler reports SEO issues per URL, and each issue can be fixed through MCP | ✓ VERIFIED (automated) | Per-URL issues of every C23 kind; `Route()` in classes/crawl/fix.go gives every finding a tool or fix: code (Jakub's 2026-10-28 reading of SC3); TestCrawlerChecks finds each planted issue once and none on /clean; TestEveryAdminOperationHasTool. Caveat inside G1: sitemap_noindex on a Nuxt-only noindex address names a tool that does not fix it. Live agent session: human item |
| SC4 | The new code has unit tests, delivered in the phase's last plan | ✓ VERIFIED | All 39 unit test files of 33-14 exist (Go table tests; TS files with 4–15 cases) in commits 513793a, eb8a028, fbe9816 (framework), 1048c01 (sitemap), 82b0dac, 075cf17 (seo), e7832a8, 311c28a (journal), 75cc100 (vue-seo-layer), 9e66cbe (journal layer), 7d952fa (faq layer); `check-phase33.sh --all` green in this run with required test names per repository |
**Score:** 2/4 roadmap criteria verified; plan must-haves 191/202 truths verified (0 present-but-behaviour-unverified).
#### Plan Must-Haves (202 truths, 15 backstops, 27 prohibitions)
| Plan | Truths | Result | Exceptions |
|------|--------|--------|-----------|
| 33-01 framework seams, gate | 12 | 12 verified | WR-02 meaning recorded in 33-01-SUMMARY; version text v0.5.1/v0.5.2 superseded by v0.6.0/v0.6.1 (release log, 2026-11-04) |
| 33-02 Journal H1 setting, editor, descriptors | 18 | 17 verified, 1 human | J2 long-text wrap at 360px (planner assumption, visual) |
| 33-03 sitemap index | 15 | 14 verified, 1 failed | Truth 4 (alternates only for translated locales) fails on Journal records: G3 |
| 33-04 images, News, IndexNow, HTML API | 13 | 13 verified | IndexNow only in production and only on the site host (TestIndexNow, NotifyIndexNow) |
| 33-05 filter, registry, site endpoint | 16 | 16 verified | G1 is outside its wording ("effective SEO"), but limits SC1 |
| 33-06 graph, breadcrumbs, hreflang, pagination | 20 | 19 verified, 1 failed | Truth 7 (hreflang from translated locales only) fails on Journal records: G3 |
| 33-07 vue-seo-layer head and root files | 14 | 14 verified | |
| 33-08 build guard, route report, drift check | 15 | 15 verified | Drift check emits a false journal-tag warning while tag_pages is false (G2, warning) |
| 33-09 journal, menu, FAQ layers | 17 | 17 verified | |
| 33-10 crawler and issue report | 22 | 22 verified | TestChromeRenderer ran against /usr/bin/chromium |
| 33-11 auto-links, WebP | 13 | 13 verified | `go test -tags nodynamic ./modules/lagoon/attach/webp` passes |
| 33-12 apps I | 8 | 8 verified | Patches apply; sm-bm-app check-noindex ok |
| 33-13 grzyby | 8 | 5 verified, 1 pending, 2 superseded | Truth 1 (urls.txt identical) proven on local links, repeat on tags pending; truths 7–8 (uat) superseded: no uat, production after tags |
| 33-14 tests, gate, release | 11 | 6 verified, 4 pending, 1 superseded | Pending Task 4: release order, patches applied with app builds and check-pins, changelog post, release log steps. Superseded: the uat check. Verified: nothing pushed or tagged yet (0 tags contain HEAD in any repository) |
Backstop truths (15): each has a named passing test in the green gate (for example paginationWindow.test.ts `[1,'gap',3,4,5,6,7,'gap',14]`, expect-seo.txt `count=<nav class="seo-breadcrumbs":1`, lru.test.ts concurrent load, TestVariantStoredWithContentType second call, TestRouteReport repeated report, TestCrawlerChecks control page, signpost "nil and empty slices are handed through alike").
Prohibitions (27): test-tier items have wired enforcement in green suites (marker and additive stages for D-90/D-106; TestStableNumbering D-30; TestIndexNow D-31; TestRouteReport D-33; TestCustomJSONLD D-44; headings_test.go "switching the setting never rewrites stored content" D-50; crawler_test.go refusing evil.example.com, 169.254.169.254 and plain http D-14; TestRendererGuards D-70; related_media_test.go upload answers before encoding D-85; guard:check D-70; check-noindex.sh D-72). Judgment-tier (non-authoritative LLM check): D-96 Journal imports no SEO plugin (holds); D-95 SEO imports only `sm-sitemap-plugin/contract` outside tests (holds); D-70 demo noindexRoutes cover only `/p/**` and `/presentations/**` (holds); D-32/D-106 nothing deployed, pushed or tagged (holds so far); changelog token never printed (not exercised yet).
#### Required Artifacts
All 64 artifacts named in the plans exist and contain their patterns (checked by script): framework pact/content.go, capabilities.go, signpost and cabana smoke tests, attach/webp; sm-journal-plugin headings.go, fix_headings.go, content_facts.go, image_variants.go; sm-sitemap-plugin contract.go, slots.go, writer.go, indexnow.go, htmlgroups.go, mcp.go, migration 202610280002; sm-seo-plugin sitemap_filter.go, registry.go, site.go, schema/graph.go, validate.go, pagination.go, crawl/{crawler,checks,compare,render_chrome}.go, autolinks.go, elements/links.ts, _issue_details.htm; vue-seo-layer middleware, useCmsSeo.ts, seo-root.ts, guard.ts, Pagination.vue, Breadcrumbs.vue, bodyLinks.ts; vue-journal-layer htmlGate.ts, PostCard.vue; vue-faq-layer faqSchema.ts; the patches, notes, COVERAGE.md and release log. None is a stub (no TBD/FIXME/XXX added in any repository since its base tag).
#### Key Link Verification
| From | To | Status | Details |
|------|----|--------|---------|
| pact content fields | signpost Describe/Records | WIRED | signpost/content.go:102,122 |
| pact RequestOptions | cabana form schema | WIRED | http.go:862 mergeRequestOptions (field_type.go:279) |
| Journal blog editor | ConvertH1 | WIRED | blog_editor.go:181 (plan named decodeBlogHTML) |
| Journal API posts | content_h1_to_h2 | WIRED | controllers/api/posts.go:197 |
| sitemap rebuild | signpost Records, Lookup[contract.Filter] | WIRED | rebuild.go:142, 212 |
| sitemap rebuild | IndexNow job | WIRED | rebuild.go:164 NotifyIndexNow → indexnow.go:146 Enqueue IndexNowArgs → fetchguard client (indexnow.go:209) |
| sitemap listeners | RecordSaved | WIRED | listeners.go:21 |
| seo plugin | contract.Filter | WIRED | plugin.go:64 app.Publish[contract.Filter] |
| seo history | site-cache purge | WIRED | history.go:285 cooler.PurgeSiteCacheAfterCommit |
| resolver | schema.Build, autolinks | WIRED | structured.go:249; resolver.go:74 |
| crawler | fetchguard, compareRendered, schema.Validate, Tools[] | WIRED | crawl/fetch.go:100, checks.go:711, 515, fix.go:51 |
| render_chrome | fetchguard.IsPrivateAddr | WIRED | render_chrome.go:202 |
| image variants job | webp.Variant | WIRED | image_variants.go:199 |
| vue-seo-layer middleware, head plugin, purge, guard, route report, pagination | resolveCached, useCmsSeo, clearSeoCaches, nitro:config, /registry/routes, pageHref | WIRED | all found |
| journal, menu, FAQ layers | vue-seo-layer | WIRED | `extends: ['vue-seo-layer']` in all three |
| FeaturedImage.vue | variants | WIRED | `<source type="image/webp">` |
| bm nginx | every response | WIRED | `add_header X-Robots-Tag "noindex, nofollow" always` |
#### Data-Flow Trace (Level 4)
| Artifact | Data | Source | Real data | Status |
|----------|------|--------|-----------|--------|
| Sitemap files | URLs, lastmod, alternates | signpost Records of each content type + slot table | Yes (Docker suites) | FLOWING; alternates inherit Journal fallback (G3) |
| SEO layer head | title, canonical, robots, alternates, @graph | GET /_seo/api/v1/resolve via resolveCached | Yes (smoke:ssr against fixture API; demo rehearsal against the Go backend in 33-12/33-14) | FLOWING |
| Breadcrumbs, pagination | crumbs, page form | resolve answer and /_seo/api/v1/site | Yes | FLOWING |
| Site audit | issues | crawl tables + CMS checks | Yes (TestCrawlerTracer) | FLOWING |
#### Behavioral Spot-Checks and Gate
| Behavior | Command | Result | Status |
|----------|---------|--------|--------|
| Full phase gate, Docker and Chromium present | `PHASE33_REQUIRE_DOCKER=1 bash scripts/check-phase33.sh --all` | PASS self-test, go, plugins, layers, consumers, admin, docs, marker, docker, additive (5 packages against v0.6.0), compat; "Phase 33 gate passed", exit 0; compat skipped sm-feedback/presentations/quizzes-plugin (fail at v0.6.0 too) | ✓ PASS |
| WebP with -tags nodynamic | `go test -tags nodynamic ./modules/lagoon/attach/webp` | ok | ✓ PASS |
| bm noindex | `sm-bm-app/scripts/check-noindex.sh` | check-noindex: ok | ✓ PASS |
| App patches apply | `git apply --check` of the 33-12/33-13 patches on each app's HEAD (summercmsio note patch with `--allow-empty`) | all OK | ✓ PASS |
| Demo locale patches stack | 33-12 demo patches applied in scratch copies, then `git apply --check` of 33-14-sm-demo-app-locale.patch and 33-14-vue-demo-app-locale.patch | OK; vue-demo-app ends on `strategy: 'prefix_except_default'` and `/pl/mapa-strony` | ✓ PASS |
#### Probe Execution
No `probe-*.sh` declared by the phase; the phase gate is `scripts/check-phase33.sh` (run above).
#### Requirements Coverage
REQUIREMENTS.md holds no Phase 33 IDs (ROADMAP: Requirements TBD). The IDs are the SC-n of the ROADMAP and the D-n decisions of 33-CONTEXT.md (text in 32-CONTEXT.md). Every one of the 48 decision IDs listed in 33-CONTEXT.md is claimed by at least one plan; the plans add D-90 and D-106 (named in CONTEXT's planning section) and SC-1..SC-4. No orphaned ID.
| Requirement | Plans | Status | Evidence |
|-------------|-------|--------|----------|
| SC-1 | 03, 04, 05, 12, 13, 14 | PENDING RELEASE + G1 | see SC1 |
| SC-2 | 01, 02, 06, 07, 08, 09, 11, 12, 13, 14 | ✗ PARTIAL | G3 |
| SC-3 | 01, 02, 05, 06, 10, 11, 14 | ✓ | see SC3 |
| SC-4 | 14 | ✓ | gate green |
| D-30, D-32, D-22, D-93, D-95 | 03, 05, 12, 13 | ✓ | sitemap Docker suites |
| D-24 | 03, 04, 05, 10, 13 | ✗ PARTIAL | G1 (CMS noindex excluded; Nuxt-only noindex address stays) |
| D-31, D-34 | 04, 08, 12 | ✓ | TestImageSitemap, TestNewsSitemap, TestIndexNow, TestHTMLGroups, HTML sitemap smoke |
| D-55, D-56 | 03, 06, 07 | ✓ | one source, x-default to default locale |
| D-57 | 03, 06 | ✗ FAILED for Journal records | G3 |
| D-33, D-12, D-25, D-94 | 05, 06, 08, 10, 12, 13 | ✓ | TestRegistry, TestRouteReport, TestLLMSTxt, TestNoindexPublishedConflict |
| D-03, D-40, D-41, D-42, D-43, D-44, D-45, D-46, D-86, D-21 | 06, 08, 09 | ✓ (D-46 Rich Results link: human) | structured_data_test.go, schema tests, usePagination tests |
| D-05, D-08, D-20, D-20a, D-20b, D-20c, D-103, D-97 | 07, 08, 09 | ✓ | smoke:ssr, purge:check, drift check |
| D-23, D-70, D-71 | 08, 10, 12 | ✓ | guard:check, route meta noindex, TestRenderSkipped, TestChromeRenderer |
| D-50, D-51, D-52, D-80, D-81, D-82, D-83, D-85, D-96 | 02, 09, 10, 11 | ✓ | headings_test.go, outline/forms tests, layer smokes (headings=strict, cardlinks), bodyLinks tests, TestAutolinks, image variants |
| D-14, D-10 | 10, 04, 05, 06, 11 | ✓ | crawler suites, TestEveryAdminOperationHasTool, TestSitemapTools, TestJournalSettingsTools |
| D-72 | 12 | ✓ | check-noindex.sh |
| D-90, D-106 | 01, 11, 14 | ✓ (see warning W5) | marker and additive stages PASS |
#### Decision Coverage
The `check.decision-coverage-verify` handler could not parse 33-CONTEXT.md (decisions are tables, not `- **D-NN:**` bullets). Checked by hand: 48/48 CONTEXT decision IDs appear in plan `requirements:` fields. The 2026-10-28 planning decisions (Journal H1 setting, postTitleTag, links_new_tab, journal.breadcrumbs, WebP in Go, optional chromedp, SC3 reading, release cadence) are all present in code. Jakub's 2026-11-04 decisions: no uat (production after tags), demo on prefix_except_default (patches ready), WebP builds with -tags nodynamic (not yet in any app patch or build script: Task 4), the two recorded gaps (G1 here, G2 under warnings).
#### Anti-Patterns and Warnings
| File | Pattern | Severity | Impact |
|------|---------|----------|--------|
| (none) | No TBD/FIXME/XXX/TODO added in any phase repository since its base tag | — | — |
| sm-seo-plugin classes/site.go:121 | G2: the site answer lists every content type's pattern, so with `golem15.journal.tag_pages` false the layer logs a false `journal-tag` drift warning at every start | ⚠️ Warning | Log noise only; recorded by Jakub as a gap. No must-have violated |
| sm-seo-plugin resolver | W1: once the route report registers `/`, the home page title uses title_template instead of home_template (deferred-items, open) | ⚠️ Warning | Changes the home title on every site with the route report; grzyby sets it by CSV, the demo does not |
| vue-seo-layer seoAbsolute | W2: path canonicals under swr become `http://localhost/...` when the backend has no site URL (pre-existing since v0.1.1) | ℹ️ Info | README requires the site URL |
| sm-seo-plugin route report | W3: page names lose diacritics ("Trwaja prace") | ℹ️ Info | Fixed per site in SEO › Pages |
| lagoon (framework) | W4: GORM auto timestamps in local time on hosts east of UTC (registry fixed in dfc85bc; other models not) | ℹ️ Info | Servers run in UTC |
| framework v0.6.1 contents | W5: quick-task commits 335f8e6/d166f1c make `lagoon.Validate` check `min`/`max` as length on every non-numeric field; the notes say a stored value longer than `max` now fails its next admin save. This is a behaviour change in a release D-106 calls "strictly additive (patch)"; the additive stage checks API surface only | ⚠️ Warning | Release decision; affects core plugins in every consuming project (CLAUDE.md: no breaking changes in core plugins) |
| deferred-items.md | Stale: "Saving Settings › Journal answers 500" is fixed on master by d2ce3a2 (ships in v0.6.1) but still says open | ℹ️ Info | Update the entry |
| 33-13-sm-grzybyfunkcjonalne-app.patch | Its DEPLOY.md "Binary" row describes a dynamically linked build, contrary to the -tags nodynamic decision | ⚠️ Warning | Correct in Task 4 when adding the tag |
#### Test Quality Audit
| Area | Active | Skipped | Circular | Assertion level | Verdict |
|------|--------|---------|----------|-----------------|---------|
| 33-14 Go unit tests (29 files) | all | conditional `-short` and no-Chrome skips only; the gate refuses any skip and ran Docker and Chromium | none found | value / behavioural | OK |
| 33-14 TS tests (10 files) | all | none (`it.skip`/`.todo` absent) | none | value | OK |
| D-57 tests (TestHreflangAlternates, TestAlternates) | yes | no | no | value | INSUFFICIENT for the production path: the precondition (empty URL for an untranslated locale) exists only in the fixture (G3) |
#### Human Verification Required
Listed in frontmatter `human_verification`. In short:
1. Escalation: fix or override G3 and G1 before the tags.
2. SC1 on production grzybyfunkcjonalne.pl after Task 4: **pending the release, not a failure** (no uat; production since 2026-10-31; deploy after tags).
3. urls.txt check on the tagged grzyby build before its deploy (pending the release).
4. SC3 live MCP crawl → dry-run → apply session.
5. Rich Results Test per page kind (D-46).
6. Visual checks after the deploys (grzyby, demo on prefix_except_default, admin screens, J2 at 360px).
7. Task 4 items not yet in any patch: -tags nodynamic in the app builds, locale patches, check-git-install.sh on the tag, changelog posts.
#### Gaps Summary
Two must-have truths fail, with different roots:
- **G3 (D-57, SC2).** The SEO and sitemap plugins are correct for what the descriptor tells them, but the Journal descriptor reports every enabled locale with fallback content, so "no hreflang for a missing translation" does not hold for the main content type. The only proof is fixture-based. Not one of the two gaps Jakub recorded; deferred-items lists it as open ("the site is fixed by its data"). The fix is in sm-journal-plugin (a core plugin), so it is a decision: fix in the descriptors only (menu item alternates unchanged) before the v0.4.0 tag, or accept the data mitigation.
- **G1 (D-24, SC1).** Recorded by Jakub as a gap, not fixed: a Nuxt-only noindex page listed as an Additional address stays in the sitemap; the crawler flags it but names a tool that cannot fix it.
G2 (false drift warning) is the second gap Jakub recorded; it violates no must-have and is listed as a warning.
If Jakub accepts either gap for this release, add an override and re-run verification; with both accepted, the expected status is human_needed (the release-time items above).
```yaml
overrides:
- must_have: "D-57 / SC2 hreflang: a page without a translation has no hreflang for that locale"
reason: "Journal descriptors report every enabled locale with fallback; sites disable locales without content (grzyby: pl only). Descriptor fix deferred to a follow-up (deferred-items 33-13)"
accepted_by: "{name}"
accepted_at: "{ISO timestamp}"
- must_have: "SC1 / D-24: the sitemaps stay consistent with noindex (noindex pages leave the XML and HTML sitemaps)"
reason: "Nuxt-only noindex pages listed as Additional addresses stay in the sitemap until the route report carries noindex paths (contract change); the crawler reports them as sitemap_noindex and the deploy steps remove the migrated addresses"
accepted_by: "{name}"
accepted_at: "{ISO timestamp}"
```
Regression check against Phase 32 (32-VERIFICATION.md, human_needed): the Phase 32 suites of sm-seo-plugin and sm-journal-plugin run inside the plugins and docker stages and pass; the Phase 32 human items (real-admin SEO tab walk-through, live MCP batch session, layout at 320/360px) remain open in 32-UAT.md and are not affected by a failing test here.
---
_Verified: 2026-11-04T20:20:34Z_
_Verifier: Claude (msd-verifier)_
---
_Re-verified: 2026-11-04T23:53:40Z_
_Verifier: Claude (msd-verifier)_
---
_Re-verified after the release: 2026-11-05T01:29:36Z_
_Verifier: Claude (msd-verifier)_

View File

@@ -0,0 +1,99 @@
# Phase 33 release log
The phase's release ledger. Plan 33-01 wrote the planned contents; plan 33-14 executes the releases and appends each step to "Executed steps" as it finishes, so a resumed run confirms each `step <n> done` row and skips it: no tag is created twice, no push is forced, a changelog post is published once. Nothing is pushed or tagged before 33-14 (2026-10-28 release cadence: all tags in 33-14).
## Task 3 answer (Jakub, 2026-11-04/05): release
- **Go-ahead:** release after verification (33-VERIFICATION.md re-verified 9c11b70: human_needed, no gaps).
- **Versions:** summercms v0.6.1, sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0, vue-seo-layer v0.2.0, vue-journal-layer v0.8.0, vue-menu-layer v0.5.0, vue-faq-layer v0.5.0 (layer package.json versions already bumped).
- **WebP build:** option B. Every app that mounts the Journal (demo, summercms.io, grzyby) builds with `-tags nodynamic` (static); DEPLOY.md keeps or restores "static"; the 33-13 grzyby patch's "dynamically linked" Binary row is reverted.
- **Deploys, all four:** summercms.io (Journal migrations, `journal:image-variants`); the demo on rome (33-12 patches plus the 33-14 locale patches, DEPLOY "Before"/"After" blocks, `journal:image-variants`, G1 check on `/subscriptions`); bm (push sm-bm-app incl. 3 commits from other sessions, deploy per DEPLOY.md, nginx header on the live vhost after `nginx -t`); production grzybyfunkcjonalne.pl last (DEPLOY.md steps 1–12, pg_dump first, step 5 `en` off and step 10 Additional addresses emptied confirmed; urls.txt check on the tagged build first; 33-13-deploy-log.md check list after; `journal:image-variants` once).
- **W5 production SQL check (33-14-risk-max.sql):** skipped by Jakub (no production fonoteka; "don't bother").
- **Changelog:** framework v0.6.1 on /changelog; sm-journal-plugin v0.4.0, sm-sitemap-plugin v0.2.0, sm-seo-plugin v0.2.0 on /changelog/plugins; no layer posts.
## Version base (Jakub, 2026-11-04)
The plan text was written against v0.5.1 / v0.5.2. Tags v0.5.2, v0.5.3 and v0.6.0 were released in the meantime, so:
- This phase delivers **SummerCMS v0.6.1**, a patch release: strictly additive (D-106).
- `scripts/check-phase33.sh --additive` compares against the newest tag that does not contain HEAD (computed, currently **v0.6.0**).
- `scripts/check-phase33.sh --marker` diffs from **v0.6.0** (`PHASE33_BASE`).
- Wherever a Phase 33 plan says "v0.5.1" as the base or "v0.5.2" as the target, read v0.6.0 and v0.6.1.
## Planned contents
### Framework v0.6.1 (git.golem15.com/golem15/summercms)
Plan 33-01 seams:
- `feat(signpost): content descriptor fields for dates, parents, authors, media and outline` (561a56c): `pact.ContentDescriptor.Kind` and `Tools` with the `ContentKind*` and `ContentTool*` constants; `pact.ContentRecord.PublishedAt`, `Parents`, `Authors`, `TopHeading`; `pact.ContentLocale.Images`, `Videos`, `Headings`; the value types `ContentRef`, `ContentPerson`, `ContentImage`, `ContentVideo`, `ContentHeading`.
- `feat(cabana): per-request options for plugin field types` (4cd35c9): `pact.FormFieldType.RequestOptions`, merged under the fields.yaml options of each form schema request.
- `test: phase 33 gate script` (6ea43bb, `scripts/check-phase33.sh`).
- Framework commits of later Phase 33 plans, if any, are added here by those plans.
- `docs(lagoon): attach/webp also decodes WebP` (1f96899, plan 33-15, L1 WR-02): docs only, the lagoon README and docs/database/attachments.md; no Go file changes.
Also on master since v0.6.0, carried by the tag: 22 planning-docs commits of Phase 20 (677e30f..399efed); no code, module or docs change.
Already released, not planned contents (the six Phase 32 fix commits, all in v0.5.2 and every later tag):
- 676ca53 CR-01 check required extension fields on the lifted value (already released in v0.5.2)
- 5471b66 CR-02 gate field type uploads on extension visibility (already released in v0.5.2)
- d660cd0 CR-04 take widget actions dispatched from connectedCallback (already released in v0.5.2)
- 468af06 WR-01 fire record events for hasMany link, unlink and deferred children (already released in v0.5.2)
- 1583651 WR-02 report the request locale's primary tag on record events (already released in v0.5.2; meaning accepted by Jakub on 2026-11-04, see 33-01-SUMMARY)
- 0e187cf WR-07 close the relation and partial routes of hidden owner fields (already released in v0.5.2)
### Plugins and layers
Newest tags when 33-01 ran, and the commits on HEAD since them:
| Repository | Newest tag | Unreleased commits |
|------------|------------|--------------------|
| sm-sitemap-plugin | v0.1.2 | none |
| sm-seo-plugin | v0.1.1 | none (the 22 commits since v0.1.0 are released in v0.1.1) |
| sm-journal-plugin | v0.3.1 | none (the 6 commits since v0.2.5 are released in v0.2.6 to v0.3.1) |
| vue-seo-layer | v0.1.1 | none |
| vue-journal-layer | v0.7.1 | none |
| vue-menu-layer | v0.4.0 | none |
| vue-faq-layer | v0.4.0 | none |
The versions each repository releases in this phase are read from `git tag` in 33-14 (next patch or minor after the newest tag, by what the phase changed there), not fixed here.
## Release order
1. Framework v0.6.1 (tag on master; changelog post on summercms.io/changelog).
2. sm-journal-plugin (requires v0.6.1).
3. sm-sitemap-plugin (requires v0.6.1).
4. sm-seo-plugin (requires v0.6.1 and the sitemap plugin's filter seam).
5. vue-seo-layer.
6. vue-journal-layer, vue-menu-layer, vue-faq-layer.
7. Applications: pointer and pin bumps (sm-demo-app, sm-grzybyfunkcjonalne-app, sm-summercmsio-app, sm-bm-app), each a separate commit after its plugin is pushed; deploys only with Jakub's go-ahead.
Each plugin tag gets a post on summercms.io/changelog/plugins the same day.
## Executed steps
| Step | Repository | Action | Result |
|------|------------|--------|--------|
| 0 | all | pre-checks | step 0 done: `gofmt -w` (toolchain go1.27.2) on 15 framework files (several unformatted since v0.6.0), commit 6d14f71 `style: gofmt`, `go build`, `go vet`, `go test -short ./...`, `summer docs:build --check` green; sm-journal-plugin `gofmt -w` controllers/api/posts.go and classes/blog_editor_test.go, commit b8d98ce `style: gofmt`; sitemap and seo `gofmt -l` clean. `PHASE33_REQUIRE_DOCKER=1 scripts/check-phase33.sh --all` exit 0, "Phase 33 gate passed" (self-test, go, plugins, layers, consumers, admin, docs, marker, docker, additive, compat; compat refused sm-feedback, sm-presentations and sm-quizzes at HEAD and at the base alike, as before). Every repository on its default branch, 0 behind origin, its newest tag an ancestor of HEAD. All five app patches pass `git apply --check` on the app HEADs |
| 1 | summercms.go | framework v0.6.1 | step 1 done: annotated tag v0.6.1 (tag object 5db8c61, commit 6d14f71, contains v0.6.0); `git push origin master` 76288cd..6d14f71 (fast-forward, 0 behind after fetch); `git push origin v0.6.1` new tag; `git ls-remote --tags origin v0.6.1` prints 5db8c61. TAG ../summercms.go v0.6.1 |
| 2 | sm-journal-plugin | v0.4.0 | step 2 done: `GOWORK=off GOPRIVATE=git.golem15.com/* go get git.golem15.com/golem15/summercms@v0.6.1` (v0.6.0 => v0.6.1; go.sum unchanged, the module keeps its `replace => ../summercms.go` as at v0.3.1; tracked go.work unchanged since v0.3.1); `summer plugin:manifest` (framework: v0.6.1), `--check` up to date; README dependency line already v0.6.1; `GOWORK=off go build ./... && go vet ./... && go test -short ./...` green; commit 6823dcc `chore: require SummerCMS v0.6.1` (go.mod, plugin.yaml) after b8d98ce `style: gofmt`; annotated tag v0.4.0 (tag object 48aa3ff, commit 6823dcc, contains v0.3.1); `git push origin main` f7bfb33..6823dcc; `git push origin v0.4.0`; ls-remote prints 48aa3ff. TAG ../sm-journal-plugin v0.4.0 |
| 3 | sm-sitemap-plugin | v0.2.0 | step 3 done: `go get git.golem15.com/golem15/summercms@v0.6.1` (GOWORK=off, v0.6.0 => v0.6.1, replace => ../summercms.go kept as at v0.1.2), `summer plugin:manifest` (framework: v0.6.1, `--check` ok), README dependency line (dropped "Until v0.6.1 is tagged…"); `GOWORK=off go build && go vet && go test -short ./...` green; commit fdbe593 `chore: require SummerCMS v0.6.1` (go.mod, plugin.yaml, README.md); annotated tag v0.2.0 (tag object 1188efd, commit fdbe593, contains v0.1.2); `git push origin main` 049f3ee..fdbe593; `git push origin v0.2.0`; ls-remote prints 1188efd. TAG ../sm-sitemap-plugin v0.2.0 |
| 4 | sm-seo-plugin | v0.2.0 | step 4 done: `GOWORK=off go get git.golem15.com/golem15/summercms@v0.6.1 git.golem15.com/golem15/sm-sitemap-plugin@v0.2.0` (sitemap fetched from the pushed tag) and `go mod tidy` (go.sum: v0.2.0 in, v0.1.2 out); `summer plugin:manifest` (framework v0.6.1, golem15.sitemap v0.2.0, `--check` ok); README dependency lines (v0.6.1, sm-sitemap-plugin v0.2.0) and the go.mod/go.work replace sentence corrected; `GOWORK=off go build ./... && go vet ./... && go test -short ./...` green (the GOWORK=off build failed before on v0.1.2's missing contract package); commit 22f108b `chore: require SummerCMS v0.6.1 and sm-sitemap-plugin v0.2.0` (go.mod, go.sum, plugin.yaml, README.md); annotated tag v0.2.0 (tag object adda8a9, commit 22f108b, contains v0.1.1); `git push origin main` 55f5e5d..22f108b; `git push origin v0.2.0`; ls-remote prints adda8a9. TAG ../sm-seo-plugin v0.2.0 |
| 5 | vue-seo-layer | v0.2.0 | step 5 done: package.json version 0.2.0 (bumped earlier), tree clean, layers stage of the gate green; annotated tag v0.2.0 (tag object b69647f, commit 3868f3d, contains v0.1.1); `git push origin main` 7d52c5d..3868f3d; `git push origin v0.2.0`; ls-remote prints b69647f. TAG ../vue-seo-layer v0.2.0 |
| 6 | vue-journal-layer, vue-menu-layer, vue-faq-layer | link: swap and tags | step 6 done (tags), check failed: `"vue-seo-layer": "link:../vue-seo-layer"` replaced by `git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0` in each package.json, `pnpm install` (lockfile pins 3868f3d); `check-git-install.sh --check-links vue-seo-layer vue-journal-layer vue-menu-layer vue-faq-layer` exit 0 ("no local dependencies"); `npm run test` journal 202/0, menu 24/0, faq 19/0 and `build:playground` green in each. Commits `chore: pin vue-seo-layer v0.2.0` (package.json, pnpm-lock.yaml): vue-journal-layer 0a77e6e, vue-menu-layer c605384, vue-faq-layer 9cc7f91. Annotated tags: vue-journal-layer v0.8.0 (tag object 7d93f06, commit 0a77e6e, contains v0.7.1), vue-menu-layer v0.5.0 (7e90962, commit c605384, contains v0.4.0), vue-faq-layer v0.5.0 (cae1502, commit 9cc7f91, contains v0.4.0); main pushed (1dd3176..0a77e6e, ef3a090..c605384, 1f23340..9cc7f91) and the tags pushed, ls-remote prints each. TAG ../vue-journal-layer v0.8.0 TAG ../vue-menu-layer v0.5.0 TAG ../vue-faq-layer v0.5.0 |
| 6b | vue-journal-layer | `check-git-install.sh v0.8.0` | **FAILED, release stopped here.** `pnpm install` in the scratch app ends `ERR_PNPM_EXOTIC_SUBDEP: Exotic dependency "vue-seo-layer" (resolved via git-repository) is not allowed in subdependencies when blockExoticSubdeps is enabled` (pnpm 12.14.0 default). Reproduced in a scratch app that also lists vue-seo-layer#v0.2.0 directly: same error. So every site app that installs vue-journal-layer v0.8.0, vue-menu-layer v0.5.0 or vue-faq-layer v0.5.0 with pnpm 12 defaults fails to install. 33-12/33-13 never saw it (pnpm `overrides` with `link:`). `blockExoticSubdeps: false` in the app's pnpm-workspace.yaml makes the install pass (lockfile-only probe). The established convention for a layer on a layer (vue-chatvideo-layer → vue-chat-layer) is `peerDependencies: "^0.1.0"` plus a `devDependencies` git pin, with the app listing both layers directly, which avoids an exotic subdependency. Decision needed (see 33-14 report): (A) keep the tags and set `blockExoticSubdeps: false` in each app (turns off a pnpm supply-chain guard for all transitive deps), or (B) patch releases vue-journal-layer v0.8.1, vue-menu-layer v0.5.1, vue-faq-layer v0.5.1 with vue-seo-layer as a `^0.2.0` peer and git devDependency (apps add vue-seo-layer#v0.2.0 directly; check-git-install's scratch app lists it too). Pushed tags are not moved or deleted. Not started: app pins and patches, changelog posts, deploys |
| 6c | — | checkpoint answer (Jakub, 2026-11-05) | Layer dependency: option B (patch releases vue-journal-layer v0.8.1, vue-menu-layer v0.5.1, vue-faq-layer v0.5.1 with vue-seo-layer as a `^0.2.0` peer and a git devDependency; apps list vue-seo-layer#v0.2.0 directly). Changelog posts: publish now, before the layer fix |
| 8 | sm-summercmsio-app | changelog posts | step 8 done: `scripts/changelog-post.py publish` with the 33-14 notes (the `Excerpt:` line stripped and passed as `--excerpt`): framework v0.6.1 id=66 https://summercms.io/changelog/summercms-0-6-1 (published_at 2026-11-05T00:17:50Z, the tag's date); sm-sitemap-plugin v0.2.0 id=67 https://summercms.io/changelog/sm-sitemap-plugin-0-2-0; sm-seo-plugin v0.2.0 id=68 https://summercms.io/changelog/sm-seo-plugin-0-2-0; sm-journal-plugin v0.4.0 id=69 https://summercms.io/changelog/sm-journal-plugin-0-4-0 (posted from a detached worktree at v0.4.0, because the live checkout has another session's untracked go.work.sum and the script requires a clean tree; worktree removed). Each `plugin.yaml matches the sources`. All four URLs answer 200; the three plugin posts are listed on /changelog/plugins. No registry token file, so the ingest request was skipped (hourly ingest picks the tags up). The journal token was read by the script only, never printed |
| 6d | vue-journal-layer, vue-menu-layer, vue-faq-layer | patch releases (option B) | step 6d done: vue-seo-layer moved from `dependencies` to `peerDependencies: "^0.2.0"` plus `devDependencies: "git+https://git.golem15.com/golem15/vue-seo-layer.git#v0.2.0"` (the vue-chatvideo-layer convention, checked in that repo), versions 0.8.1 / 0.5.1 / 0.5.1, `pnpm install` (lockfile pins 3868f3d as a dev dependency); READMEs: the install line lists vue-seo-layer#v0.2.0 and the layer tag, a peer-dependency paragraph, an upgrade bullet ("use 0.8.1 / 0.5.1"), the Releasing steps; vue-journal-layer `scripts/check-git-install.sh`: the scratch app lists vue-seo-layer at the tag's devDependencies pin (`SEO_LAYER_SPEC` overrides; a tag without the peer gets none, so v0.8.0 still fails as it should), `--self-test` ok. `--check-links` over the four layers exit 0; `check-phase33.sh --layers` exit 0 (seo 156, journal 202, menu 24, faq 19 TAP pass, 0 fail; four playground builds; smokes; check-git-install self-test). Commits `fix: vue-seo-layer as a peer dependency`: vue-journal-layer f5dc9b2, vue-menu-layer dc38f79, vue-faq-layer a092363. Annotated tags vue-journal-layer v0.8.1 (tag object 5c26b5d, contains v0.8.0), vue-menu-layer v0.5.1 (47b022e, contains v0.5.0), vue-faq-layer v0.5.1 (8d46b31, contains v0.5.0); main pushed (0a77e6e..f5dc9b2, c605384..dc38f79, 9cc7f91..a092363) and the tags pushed; ls-remote prints each. v0.8.0 and v0.5.0 stay as published. `check-git-install.sh v0.8.1` (run from the scratchpad) ends `smoke-ssr: ok (89 checks)`, `check-git-install: ok v0.8.1 f5dc9b2`. Scratch app with pnpm 12.14.0 defaults listing nuxt, vue, vue-seo-layer#v0.2.0, vue-journal-layer#v0.8.1, vue-menu-layer#v0.5.1 and vue-faq-layer#v0.5.1, extending the three: `pnpm install` ok (one vue-seo-layer in the store), `nuxt build` ok. Release-note drafts 33-14-notes-vue-{journal,menu,faq}-layer-*.md name v0.8.1 / v0.5.1 as the versions to install. TAG ../vue-journal-layer v0.8.1 TAG ../vue-menu-layer v0.5.1 TAG ../vue-faq-layer v0.5.1 |
| 7a | sm-summercmsio-app | pins, patch, nodynamic | step 7a done: c96108d `chore: require SummerCMS v0.6.1` (go.mod, go.sum; tidy pruned indirects the framework no longer needs); a40076c `chore: bump journal to v0.4.0` (plugins/golem15/journal 5b38a3b → 6823dcc at v0.4.0, require v0.4.0, gen2brain/webp and purego indirect); vue-summercmsio-app 16ab519 `chore: vue-journal-layer v0.8.1 with vue-seo-layer v0.2.0` (33-12-vue-summercmsio-app.patch applied: changelog `seo: { cms: false, htmlSitemap: false }` and 16 expectation lines; package.json pins; lockfile), pushed f36cbf1..16ab519, then pointer 2e2b881; 90eb7bc `chore: regenerate plugins.gen.go (SummerCMS v0.6.1, journal v0.4.0)`; 395ed78 `build: static binary with -tags nodynamic` (scripts/build.sh both go builds, summer.yaml `build.tags: [nodynamic]`, DEPLOY.md Binary row "static" with the reason). The 33-12-sm-summercmsio-app.patch is the empty note (nothing to apply). Checks: `pnpm test` 83/0 (17 tests read the build output and fail before a build; green after it), build:changelog, `test:changelog` smoke-ssr ok (89 checks), `generate`, `test:marketplace` ok (30 checks); `go vet`, `go test ./...` green. Release build in a clean worktree of 395ed78 with submodules from origin (the live checkout has an untracked self-named binary that `require_clean` refuses; not touched): `scripts/build.sh` → "release v0.6.1", `bin/summercms-io` statically linked, `-tags=nodynamic`; `scripts/smoke.sh` ok; `check-deploy.sh` ok. `git push origin master` ca06049..395ed78 |
| 7b | sm-demo-app | pins, patches, nodynamic | step 7b done: 6cc710e `chore: require SummerCMS v0.6.1`; 51b1d76 `chore: bump journal to v0.4.0`, ca29cd6 `chore: bump sitemap to v0.2.0`, 8113bc3 `chore: bump seo to v0.2.0` (each: submodule at the tag, `GOWORK=off go get` + `go mod tidy`); vue-demo-app fe5d38d `feat: SEO from the CMS and Polish under /pl/` (33-12-vue-demo-app.patch then 33-14-vue-demo-app-locale.patch, pins vue-journal-layer v0.8.1, vue-menu-layer v0.5.1, vue-faq-layer v0.5.1, vue-seo-layer v0.2.0; `pnpm build` ok (build guard passes), `pnpm test` 225/225), pushed 9a12701..fe5d38d; 6686216 pointer bump; 49ae08d (33-12-sm-demo-app.patch then 33-14-sm-demo-app-locale.patch, 18 paths; DEPLOY "After" no longer removes `/subscriptions` by hand: G1 leaves it out as noindex, per Jakub); cc1d71c plugins.gen.go; d2bd3ec `build: static binary with -tags nodynamic` (GO_TAGS and summer.yaml `summercms_mcp,nodynamic`, dev.sh, DEPLOY Binary row "static" with the reason); da03c06 roadmap snapshot (framework 143b4db). Checks: `go vet`, `go test -short`, `go test -tags summercms_mcp -count=1 ./...` (Docker) green; `check-pins` ok (25 modules); `scripts/build.sh` release in the clean live checkout "build: ok release 31f99588d1c9", `bin/demo` statically linked, journal v0.4.0, seo v0.2.0, sitemap v0.2.0, summercms v0.6.1, `-tags=summercms_mcp,nodynamic`; `scripts/smoke.sh bin/demo` ok; `check-deploy.sh` ok. (A scratch worktree build failed on worktree submodule cloning, not on the code; removed.) `git push origin master` da481c9..da03c06. Rehearsal databases: the demo's smoke and tests use fresh databases (migrate + demo:seed), no dump involved |
| 7c | sm-grzybyfunkcjonalne-app | pins, patches, nodynamic | step 7c done: 65d64f6 `chore: require SummerCMS v0.6.1` (go.mod and plugins/grzyby/go.mod); 7f57068 journal v0.4.0, aa1b925 sitemap v0.2.0, c60731b seo v0.2.0 (submodule at the tag, require bumped, tidy; the seo submodule was already mounted at v0.1.1); vue-grzybyfunkcjonalne-app 0771c14 (33-13-vue-grzybyfunkcjonalne-app.patch, pins vue-journal-layer v0.8.1, vue-menu-layer v0.5.1, vue-faq-layer v0.5.1, vue-seo-layer v0.2.0; `pnpm test` 30/0 after the build (3 tests read the build output), `pnpm build`, `smoke:ssr` ok (67 checks), `smoke:ga` ok), pushed e45ffe8..0771c14; 2628e38 pointer; 9eb921b (33-13-sm-grzybyfunkcjonalne-app.patch, 25 paths; its plugins/grzyby/go.mod hunk conflicted only with the v0.6.1 bump and was applied by hand: sitemap require + replace; the DEPLOY Binary row says static with -tags nodynamic instead of "dynamically linked"); bcb4be1 `build: static binary with -tags nodynamic` (build.sh vet and build `-tags summercms_mcp,nodynamic`, summer.yaml); 745b549 plugins.gen.go; 75736b4 `fix(deploy): check-deploy requires the nodynamic build tag` (check-deploy.sh looked for the old exact tag list). Checks: `go vet`, `go test ./... ./plugins/grzyby/...`, `go test -tags summercms_mcp ./...` (Docker) green; `scripts/build.sh` (framework working tree = v0.6.1 code, no non-planning diff) → `bin/grzybyfunkcjonalne` statically linked, summercms v0.6.1, `-tags=summercms_mcp,nodynamic`; `check-deploy.sh` ok; full `scripts/smoke.sh` rehearsal on a fresh throwaway database (migrations including the edited 202610280002, the PHP export, the release steps 4-11) `smoke: ok (128 urls)` (every urls.txt line on the tagged build), then `smoke-seo: ok` (index of 5 files, posts 63, categories 8, authors 1, pages 4). `git push origin master` 35d3664..75736b4 |
| 7d | sm-bm-app | push | step 7d done: the frontend build (`npm ci && npm run build` in frontend/, into plugins/jz/bm/public) adds the robots meta to index.html and robots.txt (assets unchanged); jz.bm a27a162 `build: robots meta and robots.txt (noindex, Disallow)`, pushed a075963..a27a162 (with the earlier unpushed 0dd0185 of another session, which sm-bm-app 9dd0fe4 points at); sm-bm-app 43f2fc9 `chore: bump jz.bm (robots meta and robots.txt in the frontend build)`; `scripts/check-noindex.sh` ok; `go vet`, `go test -short` green; `scripts/build.sh` → "framework v0.6.0 @ c8241c8, app 43f2fc9", statically linked (bm mounts no Journal; it stays on v0.6.0). `git push origin master` pushed 552cdce, c2a7823, 9dd0fe4 (other sessions, approved), bd7ee84 and 43f2fc9 |
| 9a | summercms.io (rome) | deploy | step 9a done: release build of sm-summercmsio-app 395ed78 (clean worktree, static, release v0.6.1, sha256 dfd70d65…); on rome `pg_dump -Fc summercms_io` → /var/backups/summercms/summercms_io-pre-v0.6.1-2026-11-05.dump (root, 0700 dir); upload per DEPLOY.md (config/, bin/summercms-io.new (sha256 matches), changelog/.output.new); `./bin/summercms-io.new migrate` "golem15.journal: 2 applied"; previous binary kept as bin/summercms-io.prev and changelog/.output.prev; swap; `supervisorctl restart summercms-io summercms-io-changelog` both RUNNING; loopback 200 on :8095/, :3095/changelog, :8095/api/registry/v1/plugins, :3095/marketplace. `journal:image-variants`: "Every featured image has its variants." Public checks: 200 for /, /docs/, /changelog, /changelog/plugins, /changelog/rss.xml, the v0.6.1 and journal v0.4.0 posts, /_journal/api/v1/posts, /api/registry/v1/plugins, /marketplace; /backend 404; no purge key in the page; one canonical, one ld+json on a post; /changelog/sitemap 404 (htmlSitemap off) |
| 9b | demo.summercms.io (rome) | deploy | step 9b done: `pg_dump -Fc summercms_demo` → /var/backups/summercms/summercms_demo-pre-v0.6.1-2026-11-05.dump; .env and site.env copied to /root/*.bak-pre-seo; DEPLOY "Before the first release with Phase 33" block as root (0 SEO keys before; 2 tokens added to .env, 4 NUXT_SEO_ lines to site.env, values never printed; NUXT_PUBLIC_SITE_URL/SITEMAP_URL dropped). Upload (config/, bin/demo.new sha256 31f99588… = local release build of da03c06, site/.output.new, /tmp/seo-pages.csv, /tmp/demo.summercms.io.conf). `bin/demo.new migrate`: journal 2, sitemap 5, seo 8 applied; `demo:seed` (decks updated, the rest exists); bin/demo.prev and site/.output.prev kept; swap; restart summercms-demo and summercms-demo-site (RUNNING); `websockets:health` "Configuration OK". Vhost: backup /root/demo.summercms.io.nginx.bak-2026-11-05, install, `nginx -t` ok, reload. Site log: `[vue-seo-layer] route report: 7 routes and 20 noindex paths sent` (and the known G2 journal-tag drift line). "After" block as root, with the amended list: extra_urls before `/`, `/blog`, `/faq`, `/subscriptions`; PUT keeps only `/subscriptions` (200); `sitemap:rebuild` 22 addresses in 4 files; seo-pages.csv import applied (changed 2, refused 0). **G1 live: `/subscriptions` is left out without manual removal** (Settings › Sitemaps left_out `{"noindex":1}`; sitemap-pages-1.xml lists /, /blog, /chat, /contact, /faq, /forum, /quizzes only), so no manual removal. `journal:image-variants`: "Every featured image has its variants." `scripts/check-live.sh https://demo.summercms.io`: check-live: ok. `SMOKE_SEO_STRICT=1 scripts/smoke-seo.sh https://demo.summercms.io` over an SSH tunnel (admin password in a 0600 scratch file, deleted after; tunnel closed): smoke-seo: ok (5 hreflang links on a post, /pl/ alternate 200, 22 sitemap addresses, 0 not 200) |
| 9c | bm.jakubzych.com (rome) | deploy | step 9c done: per the DEPLOY.md "Live install" note (/home/debian/bm, user debian): `pg_dump -Fc bm` → /var/backups/summercms/bm-pre-noindex-2026-11-05.dump; release build of 43f2fc9 (sha256 4712a4cb…, static, framework v0.6.0) uploaded as bin/bm.new with config/ and data/*.json; `migrate` "Nothing to migrate"; bin/bm.prev kept; swap; `supervisorctl restart bm` RUNNING; loopback 200. Live vhost: dated backup /root/bm.jakubzych.com.nginx.bak-2026-11-05, `add_header X-Robots-Tag "noindex, nofollow" always;` added to both server blocks and to the two locations with their own add_header (`= /prezentacje/AW_tematy-prezentacji.html` and also `^~ /pliki/`, which the repository file does not have), `nginx -t` ok, reload. Verify: X-Robots-Tag noindex, nofollow on https /, on the http 301, on the topics page and on /pliki/; /robots.txt `Disallow: /`; the SPA carries the robots meta; /_bm/api/v1/dashboard 401; /bmadmin 200 |
| 9d | grzybyfunkcjonalne.pl (alexandria, production) | deploy, DEPLOY.md "SEO pages and sitemaps (Phase 33)" steps 1-12 | steps 1-11 done, **step 12 smoke: 1 of 148 lines failed (see 9e); stopped, no rollback**. Pre-check: the full local `scripts/smoke.sh` on the tagged build passed (step 7c, `smoke: ok (128 urls)`). 1: root `pg_dump -Fc grzybyfunkcjonalne` → /root/grzybyfunkcjonalne-pre-seo-2026-11-05.dump (58 TABLE DATA entries), copies go/bin/grzybyfunkcjonalne.pre-seo-2026-11-05, nuxt/.output.prev-2026-11-05, go/.env.pre-seo-2026-11-05, nuxt/.env.pre-seo-2026-11-05, vhost /root/grzybyfunkcjonalne.pl.summercms.bak-2026-11-05. 2: upload (binary as .new, sha256 4ecc24a8… matches the local build; config/, scripts/, Nuxt build to nuxt/.output.new instead of over the running .output; deploy/ incl. seo-pages.csv and both vhosts). 3: go/.env `SUMMER_GOLEM15__SITEMAP__SITE_URL` = the SEO site URL; nuxt/.env `NUXT_SEO_API_BASE`, `NUXT_SEO_BACKEND_BASE`; both 404 tokens present (checked by name only, values never printed). 4: `migrate` with the new binary: journal 2, sitemap 5, seo 8; then bin swap (.prev kept). 5: SELECT showed `en` already disabled (en f f, pl t t); the UPDATE ran (2 rows, no change). 6: `grzyby:seo-settings --dry-run` listed exactly settings.page_title_suffix and the two journal-author templates; applied (3 changed). 7: Nuxt build swapped in, both programs restarted (RUNNING), Nuxt log `[vue-seo-layer] route report: 4 routes and 1 noindex paths sent` (plus the known G2 journal-tag drift line); new production vhost installed (sha256 157a5e0b… = deploy file; the live file had matched the previous repository file), `nginx -t` ok, reload. 8-10 through the management API with a temporary `*` token (created for info@golem15.com, never printed, revoked, id 2): /blog → Artykuły, /trwaja-prace → Trwają prace; seo-pages.csv preview changed 4 refused 0, applied; Additional addresses ["/","/blog"] → []. 11: `sitemap:rebuild` 74 addresses; `journal:image-variants` checked 95 featured images, wrote 285 variants, skipped 0 |
| 9e | grzybyfunkcjonalne.pl | step 12 smoke | On the server: `scripts/smoke.sh --url https://grzybyfunkcjonalne.pl --also scripts/urls-production.txt` → `smoke: 1 of 148 urls failed`: `200 /autor/admin contains=<title>Wpisy autora admin | Grzyby Funkcjonalne</title>`; the page answers 200 with `<title>Wpisy autora Dawid P. | Grzyby Funkcjonalne</title>`. Cause: the urls.txt line added by the 33-13 patch assumes the rehearsal's author name ("admin", from `--author-login admin`); in production the author's name is "Dawid P." (also on every post page), and the title follows the applied template `Wpisy autora %title% | %site%`, the PHP site's format. A test expectation bound to fixture data, not a site fault. `scripts/smoke-seo.sh https://grzybyfunkcjonalne.pl` ok; `check-deploy.sh --live` ok. **Not rolled back** (the site is healthy; rollback materials in 9d stay ready); the 404-log cleanup of the smoke entries and the remaining steps wait for Jakub's decision. Read-only checklist (33-13-deploy-log.md): item 1 ok (index of posts, categories, authors, pages, images; posts 62, each once, all with lastmod, no /en/, no hreflang; /sitemap.xsl 404); item 2 ok (CMS title, one canonical on the apex, `index, follow`, one JSON-LD script, no hreflang="en", breadcrumbs Strona główna › Chaga); item 4 partly (HTML sitemap /mapa-strony 200, footer link present, Additional addresses empty, IndexNow not enabled); item 8: libwebp.so.7 is installed, but the binary is built with nodynamic, so the built-in encoder runs. http and www answer 301 to the apex; /backend 404; /gfadmin 200. Note: posts now send `X-Robots-Tag: index, follow` (vue-seo-layer), where the cutover check expected no header |
| 10 | summercms.go | plan verify | The plan's tag check: every TAG line's tag is on its origin ("tags-ok", 7 TAG lines covering 11 tags); no content layer package.json has `link:`. `check-phase33.sh --compat --consumers`: compat PASS (sm-feedback, sm-presentations and sm-quizzes refused at HEAD and base as before); consumers FAIL with `refuse: 33-12-sm-demo-app.patch does not apply to …/sm-demo-app`. That is expected after the release: the stage checks the release patches against unpatched app HEADs, and sm-demo-app now carries the patch (its new files are present). The apps' own builds, tests and smokes ran directly in steps 7a-7c. The consumers stage needs a post-release mode (or retirement) in a follow-up |
| 9f | sm-grzybyfunkcjonalne-app, grzybyfunkcjonalne.pl | Jakub's answer A: keep the deploy, fix the check | step 9f done: scripts/urls.txt `/autor/admin` now checks only the fixed parts of the title (`contains=<title>Wpisy autora` and `contains=| Grzyby Funkcjonalne</title>`, with a comment on why); local full rehearsal `smoke: ok (129 urls)`, `smoke-seo: ok`; commit 0554f3e `fix(smoke): check the author page title without the fixture's author name`, pushed 75736b4..0554f3e; scripts/ rsynced to the server. Production smoke rerun exactly as before (`scripts/smoke.sh --url https://grzybyfunkcjonalne.pl --also scripts/urls-production.txt`): `smoke: ok (149 urls)`. 404 log: the 14 entries first seen since the deploy began (01:12Z onwards, all the smoke's and the checks' negative cases: /sitemap.xsl, /sitemap-tags-1.xml, /blog?page=7, /blog?page=abc, /chaga?page=2, /szukaj?q=cordyceps&page=999, /404, /error, /nieistnieje, /rss, /feed, /blog/badania-nad-cordycepsem, /en/blog, /autor/nobody) deleted through `DELETE /_seo/api/v1/notfound/{id}` (each 200) with a temporary `*` token (never printed, revoked, ids 3 and 4); 0 entries from today remain; older entries (bot probes before the release) left alone. Step 12 of the grzyby deploy is done except the Search Console resubmit (Jakub) |

View File

@@ -6,12 +6,13 @@
|---|---|---|
| bulk URL submission (POST JSON {host, key, urlList} to api.indexnow.org) | INTEGRATE | |
| key generation (32 hex characters from crypto/rand) and key rotation | INTEGRATE | |
| key file served at the site root (/<key>.txt) | INTEGRATE | |
| key file served at the site root (/<key>.txt; the plugin serves GET /_sitemap/indexnow/<key>.txt, the SEO layer maps the root name) | INTEGRATE | |
| success answers 200 and 202 recorded as the last notification | INTEGRATE | |
| 400 bad request recorded in the last status | INTEGRATE | |
| 403 key not valid shown in the admin (S2 err_key) | INTEGRATE | |
| 422 URLs not matching the host shown in the admin (S2 err_host) | INTEGRATE | |
| 429 too many requests: retry with the job's attempts, shown in S2 (err_rate) | INTEGRATE | |
| 5xx server errors and network failures: retry with the job's attempts (five) | INTEGRATE | |
| batching at most 10 000 URLs per request | INTEGRATE | |
| notification of new, changed and removed URLs (rebuild diff) | INTEGRATE | |
| keyLocation parameter (key file elsewhere on the host) | OPT-OUT | the key file is served at the root, which covers every URL of the host; a key file elsewhere would narrow the URLs the key may submit |

View File

@@ -0,0 +1,197 @@
# Phase 33 deferred items
Out-of-scope discoveries logged during execution; not fixed in the plan that found them.
## From 33-07 (vue-seo-layer)
- **Path canonicals under swr become `http://localhost/...` (pre-existing since v0.1.1).** A route-cached (swr) render runs on a copy of the request without the Host header. `seoAbsolute(value, useRequestURL().origin)` then makes a canonical, og:url or og:image that the backend answers as a path (a backend without `golem15.seo.site_url` or `app.url`) absolute on `http://localhost`. Sites with the site URL set on the backend are not affected; the layer README already requires it.
- **Possible fix:** record the request origin in `event.context` in the `request` hook, as `seo-client-address.ts` does for the visitor address, and use it in `seoHeadInput`.
- **Why deferred:** it changes v0.1.1 output, so it needs a decision. The 33-07 playground keeps `'/blog/**'` swr instead of `'/**'` so the v0.1.1 `/relative` check stays meaningful.
## From 33-02 (sm-journal-plugin)
- **Saving Settings › Journal in the admin answers 500 (pre-existing, framework).** The admin settings save (`cabana` `settingsPut`) runs `lagoon.Validate` over every rule in `models.Settings.Rules()`. `lagoon.Validate` does not know the `string` and `url` rule tokens and returns `lagoon: unrecognized validation rule "string"`. The Journal rules have used `string` (`rss_title`) and `url` (`rss_image_url`) since before Phase 33, so the screen could not be saved before 33-02 either. The same tokens appear in sm-feedback-plugin and sm-paymentgateway-plugin models. Because of this, the new Headings and links switch cannot be saved from the admin until the framework is fixed. `PUT /_journal/api/v1/settings` and MCP `journal_update_settings` work: the 33-02 handler checks `string` and `url` itself.
status: resolved (framework d2ce3a2, `feat(lagoon): accept string and url rules in lagoon.Validate`, carried by v0.6.1; the stale entry closed in 33-15)
- **Possible fix:** teach `lagoon.Validate` the `string` and `url` tokens (`lagoon.ValidateRequest` already knows `string`). This is a framework change and belongs in v0.6.1 or a follow-up patch.
- **Why deferred:** 33-02 commits only to sm-journal-plugin, and the fix belongs in the framework. Dropping the tokens from Journal's `Rules()` would loosen validation in a core plugin.
## From 33-03 (sm-sitemap-plugin)
- **A repeater row takes no datepicker (framework).** cabana compiles a `datepicker` inside a `repeater` as an error ("type datepicker is not supported in a repeater (want text, textarea, number, checkbox, switch, dropdown or richeditor)"). The sitemap's Additional addresses row (UI-SPEC C26: `url` text left, `lastmod` datepicker right) therefore uses a text field read as `YYYY-MM-DD`, checked on save (`errors.lastmod`). WINDOWS.md #30.
status: open
- **Possible fix:** support `datepicker` (mode date) in repeater rows in cabana and the SPA's RepeaterField, then switch the field type in `sm-sitemap-plugin/models/settings/fields.yaml`.
- **Why deferred:** 33-03 commits only to sm-sitemap-plugin; the gap is generic framework work (additive, but its own change).
- **A partial cannot link off the admin's origin (by design).** cabana's partial renderer keeps only root-relative `a[href]` values (`safePartialURL`), so the S1 files table links each file to the backend route that serves it (`/sitemap.xml`, `/_sitemap/files/<name>`) instead of the public site URL; the note under the table names the public index address. No change needed unless public links in partials become a requirement.
## From 33-08 (vue-seo-layer)
- **`scripts/check-phase33.sh --layers` cannot pass (gate script).** Its `npm_vitest` step runs `npm run test` in each layer and then requires a vitest summary (`detect_vitest`). All four layers (vue-seo-layer, vue-journal-layer, vue-menu-layer, vue-faq-layer) run `node --test --test-reporter=tap`, so the stage refuses on the first layer although every test passes ("refuse: no all-passing vitest summary", `test=0 detect=3`).
status: resolved (33-14: `node_tap` with a TAP detector and self-tests in scripts/check-phase33.sh; `--all` green)
- **What 33-08 ran instead:** each step of the stage by hand: `npm run test`, `npm run build:playground` and the smokes of all four layers, `testing/guard-check.mjs` in vue-seo-layer. All passed.
- **Possible fix:** a `node_tap` helper in the gate (TAP `# fail 0` and no `not ok`) used for the layers, keeping `npm_vitest` for sm-seo-plugin and sm-journal-plugin.
- **Why deferred:** 33-08 commits only to vue-seo-layer; the gate script is framework planning tooling of 33-01.
## From 33-04 (sm-sitemap-plugin)
- **A taglist cannot offer per-request options (framework).** C26 asks for the News sources taglist with `customTags: false` and options from the article types and their categories. cabana compiles taglist `options` as a fixed YAML list, and a form extension may not add a taglist field, so the options cannot come from the records. The field accepts custom tags; the `news_sources` partial under it lists the values the site has, each value is checked on save (`errors.news_source`), and MCP `sitemap_get_settings` answers them as `news_source_options`. WINDOWS.md #31.
status: open
- **Possible fix:** per-request options for core taglist fields (as `pact.FormFieldType.RequestOptions` does for plugin field types), or taglist support in form extensions; then set `customTags: false` with those options in `sm-sitemap-plugin/models/settings/fields.yaml`.
- **Why deferred:** 33-04 commits only to sm-sitemap-plugin; the gap is generic, additive framework work.
## From 33-09 (journal, menu and FAQ layers)
- **Extending vue-seo-layer turns the router on in an app without pages (vue-seo-layer, 33-08 behaviour).** The SEO layer registers its HTML sitemap pages through `extendPages`, and Nuxt counts pages added that way when it decides whether the app has pages. An app that only has `app.vue` (the menu and FAQ playgrounds) therefore gets vue-router, and every path answers "Page not found". 33-09 sets `seo: { htmlSitemap: false }` in those two playgrounds and documents the switch in the vue-seo-layer, vue-menu-layer and vue-faq-layer READMEs. Real sites have pages and are not affected.
status: open
- **Possible fix:** register the sitemap pages only when the app has pages of its own (in `pages:extend`, skip when the list holds only the layer's), or set `pages: true` only when the app has a pages directory.
- **Why deferred:** a change to 33-08's registration logic in vue-seo-layer, outside 33-09's scope; the documented switch covers the case.
- **vue-journal-layer `scripts/check-git-install.sh` will not pass as it is (release tooling, 33-14).** Its lockfile check (`grep … commit: [0-9a-f]{40}`, exactly one commit) fails once vue-seo-layer is a git dependency too (two commits in the lockfile). Its scratch app also lacks the playground config the expectations rely on: `journal.routes.search` (the search lines, already since the search page), `journal.perPage.category: 1` and the layout breadcrumb trail (33-09 lines). And during development the layer depends on `link:../vue-seo-layer`, which a git install cannot resolve.
status: partly resolved (33-14, vue-journal-layer e8f307b: the lockfile check counts only the layer's commit, the scratch app takes the playground's nuxt.config.ts and app.vue, `--self-test`); the `link:../vue-seo-layer` dependency is replaced by the tag pin in 33-14 Task 4, after which the script runs against the tag
- **Possible fix (33-14):** switch the link to the git tag pin first, filter the lockfile check to the vue-journal-layer entry, and give the scratch app the playground's `journal` options and `app.vue` (or run a subset expectation file).
- **Why deferred:** 33-14 replaces the link dependency and tags the layers; the script is part of that release step.
- **The journal fixture API's previous_post/next_post direction is the opposite of the Go API's (test fixture).** `testing/fixture-api.mjs` answers `previous_post` with the next older post; sm-journal-plugin's `siblingPost` answers it with the next newer one (`previous` → `published_at >` ascending). The layer renders whatever it gets, so no page is wrong. The fixture is less faithful than it looks.
status: open
- **Possible fix:** swap the two in the fixture API and adjust the expectation lines that name a neighbour.
- **Why deferred:** pre-existing, not caused by 33-09; changing it changes existing expectations.
## From 33-06 (sm-seo-plugin)
- **A repeater cannot carry a trigger (framework).** cabana refuses `trigger` on `type: repeater`, so the SEO settings' opening hours (`local_hours`, UI-SPEC C20) stay visible while the Local business switch is off; every other local field hides.
status: open
- **Possible fix:** allow `trigger` (hide/disable) on repeater fields in cabana and the SPA, then add it to `local_hours` in `sm-seo-plugin/models/settings/fields.yaml`.
- **Why deferred:** 33-06 commits only to sm-seo-plugin; the gap is generic, additive framework work.
## From 33-10 (sm-seo-plugin)
- **A list filter cannot have a default value (framework).** UI-SPEC C23 asks the Site audit's status filter to default to Open so ignored issues stay hidden until chosen. cabana's `config_filter.yaml` scopes take no default and `ListExtendQuery` does not see the filter values, so the list shows every current issue and marks ignored ones with the **Ignored** row badge; choosing **Open** hides them. GET `/_seo/api/v1/issues` and `seo_list_issues` do default to `status=open`. WINDOWS.md #32.
status: open
- **Possible fix:** a `default` key on filter scopes in cabana and the SPA, then `default: open` on `status` in `sm-seo-plugin/controllers/issues/config_filter.yaml`.
- **Why deferred:** 33-10 commits only to sm-seo-plugin; the gap is generic, additive framework work.
- **A partial cannot link to another site (framework).** P7 should link **Open the page** (new tab) and **Check in Google's Rich Results Test**. The partial allowlist keeps `a[href]` only for same-origin paths, and the site is on another origin than the admin, so P7 shows both as labelled addresses in DM Mono. WINDOWS.md #33.
status: open
- **Possible fix:** let partials carry an absolute http(s) link that the SPA opens in a new tab with `rel="noopener noreferrer"` (the account contributions already accept such URLs), then turn the two lines into links.
- **Why deferred:** a change to cabana's sanitizer and the SPA, outside 33-10's repository.
- **The settings tile description and the permission comment still have the Phase 32 text (sm-seo-plugin).** UI-SPEC's replacement texts name auto-links, which arrive in 33-11, together with the site audit.
status: resolved (33-11, sm-seo-plugin `ab4e834`: `settings.description` and `permissions.manage_comment` in en and pl carry the UI-SPEC texts)
- **Possible fix:** 33-11 replaces `settings.description` and `permissions.manage_comment` in both phrasebooks with the UI-SPEC texts once Auto-links exists.
- **Why deferred:** the new texts describe a screen that does not exist yet.
## From 33-11 (sm-seo-plugin, framework, sm-journal-plugin)
- **Binaries that mount sm-journal-plugin are dynamically linked against glibc (framework `attach/webp`, decision needed in 33-14).** `github.com/gen2brain/webp` loads the system libwebp through purego, and purego's no-cgo runtime makes an importing binary dynamically linked even with `CGO_ENABLED=0`: it needs `/lib64/ld-linux-x86-64.so.2`, `libc.so.6`, `libdl.so.2` and `libpthread.so.0`. It runs on the Debian servers. It does not run in a `scratch`, distroless-static or musl (Alpine) image. `-tags nodynamic` keeps the binary static and uses only the transpiled encoder (about five times slower). Recorded in `.planning/notes/2026-10-28-webp-gen2brain.md`.
status: open
- **Possible fix:** none needed for the current deploys. For a static deploy, add `-tags nodynamic` to the app's `scripts/build.sh` (or `build.tags` in `summer.yaml`). For the fast path, install `libwebp-dev` on the server: the package opens the unversioned `libwebp.so` and `libwebpdemux.so`.
- **Why deferred:** a deployment choice per application; 33-14 bumps the apps and decides.
- **E10 is left out by content kind, not by the descriptor's `Words` (sm-seo-plugin).** UI-SPEC C16 row 14 omits `seo_links` for types whose descriptor supplies no body (`Words` null). `Words` is a per-record, per-locale fact (`pact.ContentLocale.Words`), so the SEO tab, compiled per type at boot, cannot read it. 33-11 omits E10 for the kinds `collection` and `profile` and for the page registry (`seo-page`), and shows it for every other type.
status: open
- **Possible fix:** a type-level fact such as `pact.ContentDescriptor.HasBody` (framework, additive), read by `hasBody` in `sm-seo-plugin/extensions.go`.
- **Why deferred:** a framework change, outside 33-11's repositories for this task.
- **The Auto-links list sorts by phrase in the database's byte order (framework).** cabana's sortable column orders by the raw column, so with the test database's collation "Lwia grzywa" comes before "boczniak". `GET /_seo/api/v1/autolinks` sorts by `lower(phrase)`.
status: open
- **Possible fix:** a case-insensitive or collated sort option on list columns in cabana (`lagoon.Collate` exists for queries), then use it on `phrase` in `sm-seo-plugin/models/autolink/columns.yaml`.
- **Why deferred:** generic, additive framework work.
- **Variant rows of a featured image removed in the admin stay in `golem15_journal_image_variants` (sm-journal-plugin).** The table has no foreign key to `system_files`, because the plugin's migration tests run without the framework tables. `DELETE /_journal/api/v1/posts/{id}/featured-images/{fileId}` deletes the rows. A file removed through the admin's file field leaves them; they are never listed, because the API joins on the post's current files, and their blobs go with the thumbnail prefix.
status: open
- **Possible fix:** delete rows whose `file_id` no longer exists in the posts controller's save hook, or in `journal:image-variants`.
- **Why deferred:** harmless leftovers; a cleanup belongs with the next Journal media change.
- **A post whose featured image is narrower than every configured width queues a no-op job on each admin save (sm-journal-plugin).** Such an image never gets a variant row, so `DispatchPostImageVariantsAfterCommit` counts it as missing. The job reads its header and writes nothing.
status: open
- **Possible fix:** record the original's size for files without variants (for example a row with width 0), and skip them in `featuredFiles`.
- **Why deferred:** cheap and rare (featured images are usually wider than 480 px).
## From 33-12 (demo, summercms.io and bm on local links)
- **The demo's Polish addresses answer 404 (sm-demo-app, decision needed before 33-14 applies the demo patches).** The demo serves Polish from a cookie at the same address (vue-demo-app `i18n.strategy: 'no_prefix'`, D-13 of the demo). The Journal, sitemap and SEO plugins give every non-default locale a `/<code>` prefix (sm-journal-plugin README, "Every resolved record carries alternates…"). So the CMS answers have three consequences on the demo:
- every post, category and author page carries `<link rel="alternate" hreflang="pl" href="…/pl/blog/…">`;
- the sitemaps list 8 of 23 addresses under `/pl/…`, and each of those answers 404;
- a visitor with the Polish cookie gets the English CMS title and description over a Polish body, because the resolve goes by address and answers `en`.
`scripts/smoke-seo.sh` prints these as WARN lines; with `SMOKE_SEO_STRICT=1` they fail.
status: patch ready (33-14: 33-14-vue-demo-app-locale.patch and 33-14-sm-demo-app-locale.patch on top of the 33-12 demo patches; rehearsed with `SMOKE_SEO_STRICT=1 scripts/smoke-seo.sh`: ok, 23 sitemap addresses, 0 not 200); applied in Task 4
- **Possible fix:** move the demo to `strategy: 'prefix_except_default'` (Polish at `/pl/…`, the HTML sitemap path `/pl/mapa-strony`, locale-aware links in the demo's pages and LanguageSwitcher). The other way is a framework, Journal and SEO option for "every locale at one address", which would give the site no hreflang at all.
- **Why deferred:** it reverses a recorded demo decision and changes every Polish URL of the demo (Rule 4); 33-12 runs without a human.
- **Additional addresses are not de-duplicated against content records (sm-sitemap-plugin).** On a database migrated from the old definition (rome), migration `202610280002` copies its url items (`/`, `/blog`, `/faq`, `/subscriptions`) into the additional addresses. Once the route report has put `/`, `/blog` and `/faq` into the page registry, `sitemap-pages-1.xml` lists each of them twice. The demo patch's DEPLOY.md removes the copied addresses after the first release. sm-grzybyfunkcjonalne-app's companion items (33-13) can meet the same case.
status: resolved (33-14, sm-sitemap-plugin 096b6f6: an additional address a listed record has is left out as `duplicate`, counted on the settings screen)
- **Possible fix:** in `classes.Rebuild`, skip an additional address whose absolute URL a content type already lists, or report the overlap on the settings screen.
- **Why deferred:** a plugin change in sm-sitemap-plugin, outside 33-12's repositories; the demo works around it in its deploy steps.
- **An additional address that the site serves noindex stays in the sitemap (sm-sitemap-plugin, sm-seo-plugin).** The SEO filter judges the CMS's effective SEO only, while `requiresAuth` and `seo.robots` page meta (D-23) live in Nuxt. A page marked that way and also listed as an additional address (the demo's migrated `/subscriptions`) appears in the sitemap with `X-Robots-Tag: noindex, nofollow`. smoke-seo.sh fails on it, and the demo's DEPLOY.md removes the address.
status: resolved (gap G1; CMS side 33-15: sm-seo-plugin 9de6b2e stores the route report's `noindex` paths in `golem15_seo_noindex_paths` and the sitemap filter leaves them out with the reason noindex, sm-sitemap-plugin 6b67ab7 `contract.Rebuilder` rebuilds on a changed set, and the audit names `sitemap_update_settings` for a noindex Additional address; layer side 33-16: vue-seo-layer sends the list)
- **Possible fix:** the route report also sends the noindex static paths (as `noindex` entries), and the filter leaves them out of the sitemaps.
- **Why deferred:** a contract change across vue-seo-layer and sm-seo-plugin.
- **The site answer lists the `journal-tag` pattern while `golem15.journal.tag_pages` is false (sm-seo-plugin).** `classes/site.go` adds every content type's pattern. vue-seo-layer then logs `[vue-seo-layer] drift: the CMS's journal-tag URLs (/blog/tag/:slug) match no Nuxt route` at every start of the demo, although tag paths no longer resolve (TestSEOOutput).
status: deferred to v0.6.2 (gap G2, 33-15): it needs the framework. `signpost.Activate` refuses a menu item type whose DefaultPattern does not start with `/` (modules/signpost/signpost.go), so sm-journal-plugin cannot register journal-tag without a pattern while tag pages are off; dropping the tag descriptor instead would remove the tag form's SEO tab and the sitemap's types row. Possible fixes: an additive `pact.ContentDescriptor` field (for example `Routable func(ctx) bool`) read by `classes/site.go`, or a signpost rule that accepts an empty DefaultPattern for a type that resolves no URL
- **Possible fix:** leave out a type whose descriptor resolves no URL (the Journal could report tag pages off on its descriptor).
- **Why deferred:** log noise only; a plugin change outside 33-12.
- **`Duplicated imports "JournalImageVariant"` on every build of an app with vue-journal-layer (vue-journal-layer).** The type is declared in `app/utils/srcset.ts` and re-exported from `app/utils/types.ts`, both auto-imported.
status: resolved (33-14, vue-journal-layer c6ffa6c: types.ts no longer re-exports it; tests/autoImports.test.ts checks every auto-imported name has one home)
- **Possible fix:** drop the re-export from `types.ts`, or move the interface to `types.ts` only.
- **Why deferred:** a warning only; a layer change, best done before the v0.8.0 tag in 33-14.
- **Both DEPLOY.md files call the binary "static" (sm-demo-app, sm-summercmsio-app).** Once the apps require the new sm-journal-plugin, their `CGO_ENABLED=0` release builds are dynamically linked (`file bin/demo`: "dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2"). With `-tags nodynamic` they are static again. Checked in 33-12 on both scratch builds.
status: open, decision at the 33-14 release checkpoint (per-app options and a recommendation in the checkpoint report)
- **Possible fix:** 33-14 decides per app: add `nodynamic` to `scripts/build.sh` (and summer.yaml `build.tags`), or change the DEPLOY.md table to "dynamically linked (glibc)".
- **Why deferred:** the linking decision is 33-14's (33-11).
## From 33-13 (grzybyfunkcjonalne.pl on local links)
- **An enabled locale without content gives every page an `/en/` hreflang link and sitemap address (sm-seo-plugin, sm-sitemap-plugin).** sm-grzybyfunkcjonalne-app's translate plugin kept its seeded `en` row enabled (migrate.sh only made `pl` the default). Every record then counts as available in `en` through fallback: post pages render `<link rel="alternate" hreflang="en" href="…/en/blog/…">` and `sitemap-posts-1.xml` lists each post twice, with `x-default` on the `/en/` address, all 404 on the Polish-only site. The 33-13 patch makes `pl` the only enabled locale in migrate.sh step 3 and in a DEPLOY.md release step (`UPDATE golem15_translate_locales SET is_enabled = (code = 'pl')`).
status: resolved (gap G3, 33-15, sm-journal-plugin 0a62090: the Journal descriptors give a locale a URL only when the record has content in it; posts and categories by their own translation, tags and authors through a published post translated into it, the default locale always; an untranslated locale keeps its entry with URL "", which the SEO and sitemap plugins drop). The grzyby data fix in migrate.sh and DEPLOY.md stays valid; an untranslated address still answers with the default-locale content (see "From 33-15")
- **Possible fix:** list a locale's address only when the record has content in it (a translation row, or the default locale), not through fallback.
- **Why deferred:** a plugin behaviour change; the site is fixed by its data.
- **Saving a registry page through `PUT /_seo/api/v1/pages/{id}` writes `updated_at` in local time (sm-seo-plugin).** In the 33-13 rehearsal (database in UTC, machine in CET), the renamed `/trwaja-prace` got `updated_at` 17:58:54 while the route-reported pages got 16:58:54, so `sitemap-pages-1.xml` and the index carried a lastmod one hour in the future.
status: resolved (33-14, sm-seo-plugin dfc85bc: `Page.BeforeSave` stamps both timestamps in UTC for the admin's and the API's saves; the admin create had the same problem). The cause is framework-wide: GORM's default NowFunc is local time, so every model's auto timestamps on a server east of UTC are local (see "From 33-14")
- **Possible fix:** write UTC (or a `timestamptz` column) on the page update path, as the route report does.
- **Why deferred:** a plugin bug outside 33-13's files; the lastmod corrects itself on the next content change.
- **`/` as a registry page loses the home title template (sm-seo-plugin).** Once the route report registers `/` ("Strona główna"), its title comes from the record through `title_template` ("Strona główna | Grzyby Funkcjonalne") instead of `home_template` ("Witamy | %site%"). 33-13's `deploy/seo-pages.csv` sets the home title explicitly.
status: open
- **Possible fix:** the home page keeps `home_template` unless its record sets a title.
- **Why deferred:** a resolver precedence question for the plugin.
- **The route report names pages without diacritics (sm-seo-plugin).** `/trwaja-prace` becomes "Trwaja prace", shown in the HTML sitemap, the breadcrumbs and the WebPage node. 33-13 renames it in SEO › Pages (DEPLOY.md step).
status: open
- **Possible fix:** the layer reports each static page's title (its page meta) with the path.
- **Why deferred:** a contract change across vue-seo-layer and sm-seo-plugin.
- **No personal-token scope covers the SEO or sitemap management API (sm-seo-plugin, sm-sitemap-plugin).** `admin:token:scopes` lists `*`, `admin:read`, `journal` and `journal:read` only, so a script that imports a CSV or edits sitemap settings needs a full-scope token. smoke.sh creates one and revokes it after its steps.
status: open
- **Possible fix:** declare `seo`, `seo:read`, `sitemap` and `sitemap:read` scopes.
- **Why deferred:** a plugin feature.
- **`journal:image-variants` cannot run from the generated CLI (framework or sm-journal-plugin).** It stops with `journal: database is not configured`, like `journal:reindex` (which grzyby wraps as `grzyby:reindex`). The one-time backfill of existing featured images that 33-11 names needs a wrapper or a framework fix; new uploads get their variants from the worker in `serve`.
status: resolved (33-14, sm-journal-plugin fc3c255: without a published database or bucket the command opens `database.dsn` and `storage.uploads.bucket_url` itself; 33-15, sm-journal-plugin 5f683cb: `journal:fix-headings` does the same, L1 WR-01). `journal:reindex`, `journal:import-posts` and `journal:export-posts` still use the published database only
- **Possible fix:** the generated CLI opens the database for plugin commands, or the app adds `grzyby:image-variants`.
- **Why deferred:** decided with 33-14's release steps.
- **The Journal's seeded `uncategorized` category is listed in `sitemap-categories-1.xml` (sm-grzybyfunkcjonalne-app data).** It has no posts and the PHP sitemap never listed it (7 categories), but `/uncategorized` answers 200 and the per-type file lists every published category.
status: open
- **Possible fix:** delete the empty seeded category on the server, or mark it noindex in its SEO tab.
- **Why deferred:** an editorial data decision for Jakub.
## Decided for 33-14 (Jakub, 2026-11-04)
- **The demo moves to `prefix_except_default` (sm-demo-app, vue-demo-app; reverses demo D-13).** Answers 33-12's "The demo's Polish addresses answer 404". English stays at `/`, Polish moves to `/pl/…`. This matches the `/<code>` prefix that the Journal, sitemap and SEO plugins give every non-default locale, so the hreflang links and the `/pl/…` sitemap addresses answer 200.
status: decided
- **Apply in 33-14, on top of the 33-12 demo patches:**
- `i18n.strategy: 'prefix_except_default'` in vue-demo-app;
- the HTML sitemap path `/pl/mapa-strony`;
- locale-aware links in the demo's pages and the LanguageSwitcher;
- the demo's urls and smoke expectations moved to the `/pl/…` addresses;
- run `smoke-seo.sh` with `SMOKE_SEO_STRICT=1` so the WARN lines fail.
- **Notice:** every Polish URL of the demo changes; the cookie-at-the-same-address behaviour of D-13 is gone.
## From 33-14 (release preparation)
- **GORM stamps `created_at` and `updated_at` in the process's local time (framework, lagoon).** No module sets `gorm.Config.NowFunc`, so GORM's default (`time.Now().Local()`) fills every model's auto timestamps; a `timestamp` column keeps the wall clock, so on a machine east of UTC every auto-stamped row is ahead by the offset. The registry page path is fixed in sm-seo-plugin (dfc85bc); auto-links, rules, entries and every other plugin's models are not. The servers run in UTC, so production is not affected today.
status: open
- **Possible fix:** `lagoon.Open` sets `NowFunc: func() time.Time { return time.Now().UTC() }` (a behaviour change for non-UTC hosts; needs a decision), or each plugin stamps UTC itself.
- **Why deferred:** framework-wide behaviour, not one of the six fixes.
- **The route report sent the i18n copies of every page as pages of their own (vue-seo-layer).** Found by the demo locale rehearsal: with `prefix_except_default` the report sent `/pl`, `/pl/contact`, … next to `/`, `/contact`, and the registry made seven untranslated pages of them.
status: resolved (33-14, vue-seo-layer b3a0078: routes named with another locale's suffix are left out; their translations are set per page in SEO › Pages). A follow-up could report the locale paths so the plugin fills each page's addresses itself (a contract change).
## From 33-15 (Go plugins: gap fixes before the release)
Deferred to the v0.6.2 backlog item, by repository. Fixed in 33-15: G1 (CMS side), G3, L1 CR-01, CR-02, WR-01, WR-03, WR-05 (WR-02 as docs), L2 WR-01 to WR-05 and IN-01, L3 CR-01, WR-01, WR-03, WR-04 and WR-06.
- **sm-sitemap-plugin:** L2 WR-06 (a default file slug can collide with a reserved or another type's slug), WR-07 (no 50 MB byte guard on image and hreflang files), WR-08 (Additional addresses on other hosts); info IN-02 to IN-11.
status: open (v0.6.2)
- **sm-seo-plugin:** L3 WR-02 (crawl limits beyond the job timeout and memory: validate `crawl_max_pages × crawl_delay`, cap the frontier, store pages in chunks), WR-05 (recheck fetches inside a write transaction); info IN-01 to IN-07; G2 (the journal-tag pattern while tag pages are off, see the 33-12 entry: needs an additive pact field such as `ContentDescriptor.Routable`, a framework change, or a signpost rule for an empty DefaultPattern).
status: open (v0.6.2)
- **sm-journal-plugin:** L1 WR-04 (images/alt keys `""` and the default locale code apart), WR-06 (author pages publish backend logins as slugs and names), WR-07 (the settings API's stale `string`/`url` workaround); info IN-01 to IN-04, IN-08. An untranslated locale's address still answers with the default-locale content and a self canonical; it is no longer advertised in hreflang or the sitemaps, and a canonical to the default locale or a 404 there is a separate decision.
status: open (v0.6.2)
- **summercms.go:** L1 WR-02 as code (decode WebP in `attach` with the pure Go decoder explicitly, or a decision note; 33-15 documents the behaviour only); info IN-05, IN-06, IN-07, IN-09; verifier warnings W1 (the home title template once `/` is registered), W2 (swr localhost canonicals), W3 (route report names without diacritics), W4 (GORM local timestamps), W5 (the min/max length change in a patch release, a release decision).
status: open (v0.6.2)
- **Nuxt layers:** L4 WR-06, WR-07 and the L4 info items, planned and deferred in 33-16.
status: open (v0.6.2)

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,461 @@
---
phase: 34-plugin-marketplace
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- modules/kiosk/kiosk.go
- modules/kiosk/manifest.go
- modules/kiosk/derive.go
- modules/kiosk/identity.go
- modules/kiosk/check.go
- modules/kiosk/version.go
- modules/kiosk/registry.go
- modules/kiosk/README.md
- modules/kiosk/manifest_smoke_test.go
- modules/kiosk/testdata/literal/go.mod
- modules/kiosk/testdata/literal/plugin.go
- modules/kiosk/testdata/literal/README.md
- modules/kiosk/testdata/consts/go.mod
- modules/kiosk/testdata/consts/plugin.go
- modules/kiosk/testdata/consts/ids/ids.go
- modules/kiosk/testdata/consts/nested/plugin.go
- modules/kiosk/testdata/consts/nested/README.md
- modules/kiosk/testdata/consts/README.md
- modules/kiosk/testdata/other/go.mod
- modules/kiosk/testdata/other/plugin.go
- modules/kiosk/testdata/other/README.md
- modules/kiosk/testdata/framework/go.mod
- modules/party/info.go
- modules/party/README.md
- internal/build/build.go
- internal/build/new.go
- internal/build/scaffold.go
- internal/build/plugindirs.go
- internal/build/plugininfo_smoke_test.go
- internal/build/build_test.go
- internal/build/testdata/new/main.go.golden
- internal/build/testdata/new/plugins.gen.go.golden
- internal/build/testdata/new-no-plugin/plugins.gen.go.golden
- examples/hello/main.go
- examples/hello/plugins.gen.go
- cmd/summer/main.go
- README.md
- docs/plugins/marketplace.md
- docs/console/scaffolding.md
- docs/architecture/go-modules-and-workspaces.md
autonomous: false
requirements: [SC-1, SC-4, D-01, D-02, D-03, D-04, D-05, D-06, D-07, D-16]
estimate:
tokens: 150000
raw_tokens: 150000
tasks: 5
confidence: low
must_haves:
truths:
- "`summer plugin:manifest [dir]` writes `<dir>/plugin.yaml` whose every field is derived from the plugin's own sources: id and requires from plugin.go, module from go.mod, package from the directory's import path, framework and plugin minimums from go.mod require lines, name and description from the README's H1 and one-sentence summary; plugin.go and party.Plugin are unchanged (D-01, D-02, D-05)"
- "The ID reader follows string constants statically: a literal, a package-level const in the same package, a const in another package of the same module, and a const in another module resolved through `go list -m -json`; no plugin code is compiled or run, and any other expression is an error naming ID() or Requires() (D-02 as extended by the user on 2026-10-29)"
- "`plugin:add` registers a plugin whose ID() returns a constant, because pluginIDFromGo now calls the same resolver (fix for research F1; literal-ID plugins register exactly as before)"
- "`--name` and `--description` persist in an `overrides:` block, survive regeneration, and `--name=\"\"` clears the override; a README whose H1 equals the plugin ID and no name override is an error that names `--name` (D-03, research F7)"
- "`summer plugin:manifest --check [dir]` exits non-zero and prints what it expected when the committed plugin.yaml is missing or stale, and `kiosk.CheckT(t, dir)` fails a plugin repo's `go test` the same way (D-04)"
- "Version constraints are Go-style minimums: `framework: vX.Y.Z` and `requires: {id: vX.Y.Z}`; a plugin requirement at v0.0.0 or a missing framework require is an error, a pseudo-version minimum is accepted with a warning, and a required ID whose module is not in go.mod has the empty minimum (D-05, research F8)"
- "`summer build` bakes `PluginInfo` (ID, module, package, name, description, version, source per plugin) and `FrameworkVersion` into plugins.gen.go, and the generated main publishes them with party.Describe before party.Activate; a plugin without plugin.yaml has only its ID and version, and a metadata failure warns and never fails the build (D-06)"
- "Versions are D-07's: a module-cache plugin reports its go.mod/build-info version, a plugin directory that is its own git repository reports `git describe --tags --match 'v[0-9]*'` without the dirty marker, an in-app plugin reports an empty version, and FrameworkVersion is the effective framework version (the newest tag reachable in a locally replaced framework checkout, otherwise the go.mod require) (D-07, research F3)"
- "The registry v1 wire types (kiosk.RegistryPlugin, kiosk.RegistryPluginDetail, kiosk.RegistryVersion, envelopes and error) match the shape confirmed at Task 1, so the summercms.io server (34-03), the CLI (34-04) and cabana (34-05) encode and decode the same JSON (D-16)"
- "Every new identifier is documented in modules/kiosk/README.md, modules/party/README.md and docs/plugins/marketplace.md, the root README table lists kiosk, and the docs checker passes"
artifacts:
- path: "modules/kiosk/manifest.go"
provides: "plugin.yaml types, Parse, Marshal, Validate"
contains: "SchemaVersion"
- path: "modules/kiosk/identity.go"
provides: "const-resolving ID()/Requires() reader"
contains: "func ReadIdentity("
- path: "modules/kiosk/check.go"
provides: "Write, Check, StaleError, CheckT"
contains: "func CheckT("
- path: "modules/kiosk/registry.go"
provides: "registry v1 wire types"
contains: "RegistryAPIPath"
- path: "modules/kiosk/version.go"
provides: "strict vX.Y.Z rules"
contains: "func CompareVersions("
- path: "modules/party/info.go"
provides: "party.Info, party.Installed, party.Describe"
contains: "func Describe("
- path: "internal/build/plugindirs.go"
provides: "go list plugin dir resolver, git describe, EffectiveFramework"
contains: "func EffectiveFramework("
- path: "modules/kiosk/manifest_smoke_test.go"
provides: "TestManifestSmoke (tracer)"
contains: "func TestManifestSmoke("
- path: "internal/build/plugininfo_smoke_test.go"
provides: "TestPluginInfoSmoke"
contains: "func TestPluginInfoSmoke("
- path: "docs/plugins/marketplace.md"
provides: "plugin.yaml, plugin:manifest, registry API reference"
contains: "plugin:manifest"
key_links:
- from: "modules/kiosk/identity.go"
to: "internal/build/scaffold.go"
via: "pluginIDFromGo delegates to kiosk.ReadIdentity, so plugin:add and plugin:manifest read IDs the same way"
pattern: "kiosk\\.ReadIdentity"
- from: "internal/build/build.go"
to: "modules/party/info.go"
via: "generated main calls party.Describe(app, PluginInfo, FrameworkVersion) before party.Activate"
pattern: "party\\.Describe\\("
- from: "cmd/summer/main.go"
to: "modules/kiosk/check.go"
via: "plugin:manifest runs kiosk.Write, kiosk.Check or kiosk.Generate"
pattern: "kiosk\\.(Write|Check|Generate)\\("
---
## Phase Goal
People browse the public Golem15 plugins at summercms.io/marketplace and add one to an application with `summer plugin:install <id>`; the same command installs private plugins from a git URL; the admin SPA gains a read-only Plugins screen. This plan lays the shared foundation every other plan of Phase 34 builds on: the plugin.yaml format and its generator, the registry v1 contract in Go, and the build-time metadata the admin's Installed tab reads.
Spec-less probe fallback skipped: Phase 34 has no requirement IDs and no SPEC.md, so this plan set derives must_haves from ROADMAP success criteria SC-1..SC-5 and CONTEXT decisions D-01..D-19 (a visible choice, not an omission).
<objective>
Create the public framework module `kiosk` (name confirmed at Task 1) and wire it through the CLI and the build:
- the plugin.yaml format, generated by `summer plugin:manifest [dir] [--check] [--pretend] [--name] [--description]` from the plugin's own sources (D-01..D-05);
- a static, const-following ID()/Requires() reader shared with `plugin:add` (user decision 1 of 2026-10-29);
- `kiosk.CheckT`, the helper each plugin repo's `go test` calls (user decision 2);
- the registry v1 wire types and strict version rules (D-16, confirmed at Task 1);
- `summer build` baking `PluginInfo` and `FrameworkVersion` into plugins.gen.go and publishing them through `party.Describe` (D-06, D-07).
Purpose: plans 34-02 (plugin repo rollout), 34-03 (registry server), 34-04 (install CLI) and 34-05 (admin screen) all consume these types; defining them once keeps server, CLI and admin on one contract.
Output: commits in this repository only (code and its docs together, per commit group below). Nothing is pushed or tagged.
**Planner decisions recorded here (confirmed or adjusted at Task 1):**
- **P34-01 plugin.yaml format** (D-04 costly): one file per plugin package directory (research F6). Header comment line `# Generated by summer plugin:manifest. Do not edit; rerun the command.` then, in this order: `schema: 1`, `id`, `module` (go.mod module path, what `go get` takes), `package` (import path summer.yaml lists; differs from module for a nested plugin such as `…/sm-pgstripe-plugin/subscriptions`), `name`, `description`, `framework` (go.mod require of git.golem15.com/golem15/summercms), `requires` (map of required plugin ID to its minimum, sorted by ID, omitted when empty; empty string when the required plugin ships in the same module or is not a go.mod require), `overrides` (`name`/`description` set with `--name`/`--description`, omitted when unused). A newer `schema` than the reader knows is an error that says to update summer.
- **P34-02 registry API v1** (D-16 one-way): base path `/api/registry/v1`; `GET /plugins?q=&category=` → `{"data":[RegistryPlugin…],"meta":{"total":N}}`; `GET /plugins/{id}` → `{"data":RegistryPluginDetail}`; `GET /plugins/{id}/versions` → `{"data":[RegistryVersion…]}` newest first; errors `{"error":{"code":"…","message":"…"}}` (404 `not_found`, 400 `invalid_query`); `POST /ingest` (authenticated, body `{"repository":"<https url>"}`) → 202 `{"data":{"repository":"…","queued":true}}`. RegistryPlugin fields: `id`, `name`, `description`, `module`, `package`, `repository`, `category`, `featured`, `icon_url`, `latest_version`, `latest_framework`, `updated_at` (RFC 3339). RegistryPluginDetail adds `readme_markdown`, `readme_html`, `screenshots` (`[{url, caption}]`), `requires` (of the latest version). RegistryVersion: `version`, `framework`, `requires`, `module`, `package`, `commit`, `tagged_at`. Rules: always an envelope; clients ignore unknown fields; only additive changes within v1; GET-only, no credentials, open CORS, `Cache-Control: public, max-age=300` plus ETag.
- **P34-03 names**: module `kiosk`; `party.Info{ID, Module, Package, Name, Description, Version, Source}` with Source `module` | `submodule` | `local`; `party.Installed{Framework string; Plugins []Info}`; `party.Describe(app, plugins, framework)`; generated `PluginInfo` and `FrameworkVersion`; config key `plugins.registry_url` (default `https://summercms.io`, empty disables); permission `backend.view_plugins`; admin route `/system/plugins`; marketplace URLs `/marketplace` and `/marketplace/<vendor>/<name>`; token scope `registry`.
- **P34-04 release number**: the framework release that carries this phase is v0.6.0 (next minor after v0.5.3: a new module and three new commands); 34-02 writes it as each plugin's framework minimum (user decision 2), and plugin tags wait for that tag (user-gated).
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-CONTEXT.md
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-PATTERNS.md
@.planning/notes/2026-10-29-plugin-marketplace.md
@CLAUDE.md
<interfaces>
internal/build/scaffold.go: pluginIDFromGo(path string) (string, error) accepts only a string literal returned by ID() (lines ~360-392); AddPlugin(ctx, startDir, pluginDir) (line 144) calls it; editAppModule writes -require=mod@v0.0.0 and a local replace; runGo(ctx, dir, args...) and applyGoWork(cmd, dir) (lines ~621-640); parseGoMod is a line scanner — do not extend it, use `go mod edit -json`.
internal/build/build.go: App(ctx, appDir, out) → generate(appDir, m) → generateMain(m), generatePluginsGen(m), formatSource, writeIfChanged; generated main calls party.Activate(app, PluginIDs) (line ~125). internal/build/new.go:453 calls generate(target, m); goldens in internal/build/testdata/new*/ (rewrite with `go test ./internal/build -run TestNew -update`).
internal/build/manifest.go: Manifest{Module, Binary, Plugins []Plugin{ID, Module}, Tags}, LoadManifest, SaveManifest, ValidatePluginID, validateModulePath (rejects a leading "-").
modules/party/registry.go: Plugin interface {ID; Requires; Register; Boot}; Activated []Plugin published with app.Publish; Activate(app, ids).
modules/backpack: app.Publish[T](v) error, app.Lookup[T]() (T, bool) (generic methods, Go 1.27).
modules/bonfire: Command{Name, Description, Long, Examples, Args, Flags, Run}; Input.Flag(name) (string, bool) returns ("", true) for an explicitly empty --name=""; FlagBool(in, name) for Bare switches; Output has Success, Warning, Info, Println.
goccy/go-yaml (already required) for YAML; github.com/yuin/goldmark (already required) for the README AST; no new dependency.
</interfaces>
</context>
## Execution units and resume points
- Each task ends with the commit listed below, staged by explicit path (never `-A` or `.`). Other sessions may hold uncommitted `.planning/STATE.md`, `.planning/state.json`, `.planning/ROADMAP.md`, `.planning/G15OFFICE.md` or cabana edits; leave them alone. Before editing `internal/build` or `cmd/summer`, run `git status --short internal/build cmd/summer modules/party` and stop if another session has uncommitted edits there.
- Resume check: `git log --format=%s | grep -Fx '<subject>'`; present subjects mean the task is done: re-run its `<verify>` and continue with the next one.
| Task | Commit subject | Resume point |
|------|----------------|--------------|
| 1 | none (answer recorded in the SUMMARY) | answer recorded |
| 2 | `feat(kiosk): plugin.yaml manifest and summer plugin:manifest` | TestManifestSmoke passes |
| 3 | `feat(kiosk): resolve constant plugin IDs, overrides and the CheckT helper` | TestManifestSmoke/consts passes |
| 4 | `feat(kiosk): registry v1 wire types and version rules` | TestManifestSmoke/registry passes |
| 5 | `feat(build): bake plugin metadata and the framework version into plugins.gen.go` | TestPluginInfoSmoke passes |
<tasks>
<task type="checkpoint:decision" gate="blocking">
<name>Task 1: Confirm the plugin.yaml format, the /api/registry/v1 shape, the names and the release number before any code depends on them</name>
<reversibility rating="one-way">Released summer binaries and cabana call /api/registry/v1 and published plugin tags carry plugin.yaml forever (tags are never moved, research Pitfall 7); a later change needs a v2 path and an ingester that reads both formats.</reversibility>
<decision>Adopt P34-01 (plugin.yaml format), P34-02 (registry API v1 shape), P34-03 (names) and P34-04 (v0.6.0 as the framework minimum) as written in the objective, or adjust them.</decision>
<context>
D-04 rates the plugin.yaml format costly (every public repo, the ingester and git-URL installs read it) and D-16 rates the API one-way. Research marked the field names `schema`, `package`, `overrides` (A2), the JSON shape (A3), the module name `kiosk` (A10), `party.Info`/`party.Describe` (A8) and `backend.view_plugins` with `/system/plugins` (A6) as assumptions. 34-03 (server) and 34-04 (client) run in parallel after this plan and both encode the shape fixed here through kiosk's wire types, so this is the only point before both. The release number decides the `framework:` minimum 34-02 writes into 19 plugin go.mod files.
</context>
<options>
<option id="as-planned">
<name>Adopt P34-01..P34-04 as written</name>
<pros>Matches the research recommendation; a schema field and an envelope leave room for additive change; one release (v0.6.0) carries the helper every plugin test imports</pros>
<cons>Freezes field names now; every plugin moves its framework minimum to v0.6.0</cons>
</option>
<option id="adjust">
<name>Adopt with the changes Jakub states (field names, JSON fields, module name, release number)</name>
<pros>Names fixed before they become a contract</pros>
<cons>The executor records the adjusted names in the SUMMARY; plans 34-02..34-06 use the SUMMARY's names wherever they differ from their text</cons>
</option>
<option id="no-schema-field">
<name>Adopt without the `schema:` field and the `overrides:` block (overrides stored as plain name/description plus a marker comment)</name>
<pros>Smaller file</pros>
<cons>No versioning hook for a later format change; regeneration must parse comments to keep overrides</cons>
</option>
</options>
<resume-signal>Reply "as-planned", "adjust: <changes>" or "no-schema-field"</resume-signal>
</task>
<task type="tracer">
<name>Task 2: End-to-end "a plugin author runs summer plugin:manifest and gets a committed, checkable plugin.yaml" — literal-ID plugin only</name>
<files>modules/kiosk/kiosk.go, modules/kiosk/manifest.go, modules/kiosk/derive.go, modules/kiosk/check.go, modules/kiosk/manifest_smoke_test.go, modules/kiosk/testdata/literal/go.mod, modules/kiosk/testdata/literal/plugin.go, modules/kiosk/testdata/literal/README.md, modules/kiosk/README.md, cmd/summer/main.go, README.md, docs/plugins/marketplace.md, docs/console/scaffolding.md</files>
<read_first>
- internal/build/scaffold.go (pluginIDFromGo ~360-392, runGo/applyGoWork ~621-640: exec style to copy)
- internal/build/manifest.go (goccy YAML use, ValidatePluginID, validateModulePath)
- cmd/summer/main.go (addPluginCommand ~381-415, toolCommands ~31)
- cmd/summer/commands_documented_test.go (what TestCommandsDocumented demands of a command)
- modules/fetchguard/README.md (module README structure to copy)
- modules/breakwater/breakwater.go (goldmark usage)
- docs/plugins/testing.md (front matter: title, description, section, order) and docs/console/scaffolding.md
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (Pattern 1, F6, F7)
</read_first>
<action>
Implement P34-01 as answered at Task 1, per D-01, D-02, D-04 and D-05, for a plugin whose ID() and Requires() return literals. Create the package `modules/kiosk` (package doc: plugin manifests and the plugin registry contract; it never names a consuming application):
- `kiosk.go`: constants `FileName = "plugin.yaml"`, `SchemaVersion = 1`, `FrameworkModule = "git.golem15.com/golem15/summercms"`, `Header` (the generated-file comment line).
- `manifest.go`: `Manifest` with yaml tags in P34-01 order, `Overrides{Name, Description}`, `Marshal(Manifest) ([]byte, error)` (Header plus goccy output; requires emitted as a goccy MapSlice sorted by ID so the bytes are stable), `Parse([]byte) (Manifest, error)`.
- `derive.go`: `DeriveOptions{Name, Description *string}` (nil keeps the persisted override, a pointer to "" clears it), `Derive(ctx, dir string, opts DeriveOptions) (Manifest, []string, error)` returning warnings. It finds the module root by walking up from dir to the nearest go.mod, reads it with `go mod edit -json` (exec, cmd.Dir = module root, args after the subcommand, never a shell), sets module, package (module path plus the dir's slash path relative to the root), framework (the FrameworkModule require; missing or v0.0.0 is an error), reads `<dir>/plugin.go` for ID()/Requires() string literals (non-literal returns are the D-02 error naming the function; Task 3 widens this), reads `<dir>/README.md` with goldmark: name is the first H1's text, description the first paragraph after it (plain text, whitespace collapsed); a missing README or H1 is an error. A README H1 equal to the ID with no name override is an error whose message names `--name` (research F7). Overrides from an existing plugin.yaml are kept unless opts changes them.
- `check.go`: `Generate(ctx, dir, opts) ([]byte, []string, error)`, `Write(ctx, dir, opts) (path string, warnings []string, err error)`, `Check(ctx, dir) error` returning `*StaleError{Path string; Missing bool; Want, Got []byte}` whose Error() names the path and the first differing line.
- Fixture `testdata/literal` (module `example.test/sm-acme-plugin`, requires FrameworkModule at v0.5.3, plugin.go returning "acme.blog" and nil, README `# Blog` plus one sentence).
- `manifest_smoke_test.go` with `TestManifestSmoke` subtest `literal`: copy the fixture to t.TempDir(), Write, assert every field and the header, Check returns nil, edit the README sentence and Check returns a *StaleError, delete plugin.yaml and Check reports Missing.
- `cmd/summer/main.go`: `pluginManifestCommand()` registered in toolCommands after `addPluginCommand()`: Name `plugin:manifest`, Description, Long (what is derived from where, that plugin.yaml is committed and never hand-edited, --check exit status), Examples (plain, --check, --pretend, --name), optional Arg `dir` (default "."), Flags `check` and `pretend` (Bare, read with bonfire.FlagBool), `name`, `description` (read with in.Flag so an explicit empty value clears). --check rejects --name/--description; --pretend prints Generate's bytes and writes nothing; otherwise Write and print `Wrote <path>` with out.Success; warnings go to out.Warning.
- Docs: `modules/kiosk/README.md` in the standard structure (H1, one-sentence summary, import line, `**Name:**` mnemonic for a beach kiosk where every plugin on the shelf carries its label, Overview, Features, Usage, API reference, CLI commands, Dependencies, Testing); a row in the root `README.md` module table reusing the summary; new page `docs/plugins/marketplace.md` (section plugins, an order after testing) with "The plugin.yaml manifest" and "Generating and checking it" sections; a `plugin:manifest` row in `docs/console/scaffolding.md`. Every identifier must exist (docs checker).
Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./modules/kiosk -run 'TestManifestSmoke' -count=1 -v 2>&1 | grep -E '^(--- |=== RUN|FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestManifestSmoke/literal" line</fails_when>
<automated>go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree' -count=1 2>&1 | tail -3 && go run ./cmd/summer docs:build --check 2>&1 | tail -5</automated>
<fails_when>non-zero exit, or a "FAIL" or "unknown identifier" line in the output</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "SchemaVersion\|FrameworkModule" modules/kiosk/kiosk.go` prints at least two lines
- `go doc ./modules/kiosk Manifest` lists Schema, ID, Module, Package, Name, Description, Framework, Requires and Overrides
- `grep -n '"plugin:manifest"' cmd/summer/main.go` prints one line
- `cp -r modules/kiosk/testdata/literal "$TMP/acme" && go run ./cmd/summer plugin:manifest "$TMP/acme" && go run ./cmd/summer plugin:manifest --check "$TMP/acme"` exits 0 and `$TMP/acme/plugin.yaml` starts with the header line and contains `id: acme.blog` (with TMP set to a scratch directory)
- `grep -n "kiosk" README.md` prints the module table row; `grep -n "plugin:manifest" docs/console/scaffolding.md docs/plugins/marketplace.md` prints at least two lines
</acceptance_criteria>
<done>A plugin author can generate, preview and check plugin.yaml for a literal-ID plugin from the CLI, and the format is documented.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: Every public plugin layout derives a valid plugin.yaml: constant IDs, nested plugins, overrides, version checks and the CheckT helper</name>
<files>modules/kiosk/identity.go, modules/kiosk/derive.go, modules/kiosk/check.go, modules/kiosk/manifest.go, modules/kiosk/manifest_smoke_test.go, modules/kiosk/testdata/consts/go.mod, modules/kiosk/testdata/consts/plugin.go, modules/kiosk/testdata/consts/ids/ids.go, modules/kiosk/testdata/consts/nested/plugin.go, modules/kiosk/testdata/consts/nested/README.md, modules/kiosk/testdata/consts/README.md, modules/kiosk/testdata/other/go.mod, modules/kiosk/testdata/other/plugin.go, modules/kiosk/testdata/other/README.md, modules/kiosk/testdata/framework/go.mod, internal/build/scaffold.go, internal/build/build_test.go, modules/kiosk/README.md, docs/plugins/marketplace.md</files>
<read_first>
- modules/kiosk/derive.go and modules/kiosk/check.go (Task 2 output)
- internal/build/scaffold.go (pluginIDFromGo and its callers: AddPlugin, make:* paths)
- internal/build/build_test.go (TestMakeAndAddPluginOnHelloCopy: the temp-app pattern)
- ../sm-mfa-plugin/plugin.go (same-file const), ../sm-paymentgateway-plugin/plugin.go and ../sm-paymentgateway-plugin/payments/service.go (cross-package const), ../sm-pgstripe-plugin/subscriptions/plugin.go (Requires with a same-module and an other-module const) — read only
- ../sm-chatbots-plugin/go.mod (a plugin requirement at v0.0.0, research F8) — read only
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (F1, F6, F8, Pattern 2)
</read_first>
<behavior>
- consts fixture: ID() returning a same-package const resolves; Requires() returning a slice of a cross-package const (same module, `ids.Translate`) and a const from the `other` fixture module (resolved through `go list -m -json` via a local replace) resolves, and the other-module requirement's minimum is its go.mod require version
- nested fixture `consts/nested`: package is `<module>/nested`, module is the root module, and a Requires() entry naming the root plugin of the same module gets the empty minimum
- ID() returning a function call, a var or a concatenation with a non-const fails with an error containing "ID()"; the same for Requires() with "Requires()"
- a plugin requirement at v0.0.0 fails with "not a released version"; a pseudo-version minimum passes and returns a warning
- --name override persists across a regeneration without flags; an explicit empty name clears it and then an H1 equal to the ID fails with a message containing "--name"
- CheckT on a stale fixture calls Fatalf once with the path; on a fresh one it does not
- Validate rejects a bad ID, a module with a leading "-", a non-vX.Y.Z framework, a schema greater than SchemaVersion
- plugin:add on a copy of examples/hello registers a fixture plugin whose ID() returns a const (regression for research F1); a literal-ID plugin registers exactly as before
</behavior>
<action>
Per D-02 as extended by user decision 1 (2026-10-29): add `identity.go` with `Identity{ID string; Requires []string}` and `ReadIdentity(ctx, dir string) (Identity, error)`. It parses the non-test .go files of dir with go/parser (never builds or runs them), finds the methods ID() and Requires() on any receiver, and resolves each returned expression statically: a string literal; an identifier naming a package-level const in any non-test file of the same directory (recursively, guarded against cycles); `pkg.Name` where the file's import (named imports honoured) is in the same module (directory = module root plus the import path suffix) or in another module (directory from `go list -m -json <module>` run in the module root, `.Dir`; with applyGoWork-style GOWORK handling left to Go's defaults). Requires() accepts nil, an empty slice, or a []string composite literal whose elements resolve the same way. Anything else is an error of the form `<file>: ID() must return a string literal or constant` (or `Requires()`).
Switch Derive to ReadIdentity. Map each required ID to its providing module: the plugin's own module (any plugin.go directory under the module root) gives the empty minimum; otherwise each non-framework go.mod require is resolved with `go list -m -json` and its root identity read; a found ID takes that require's version; an ID found nowhere gets the empty minimum (soft dependency). A plugin requirement at v0.0.0 is an error ("not a released version", research F8); a pseudo-version is accepted with a warning. Add `Validate(Manifest) error` (ID via the same rule as internal/build ValidatePluginID, re-implemented in kiosk since internal/build cannot be imported; module and package paths reject a leading "-", spaces and backslashes; framework and non-empty minimums must be strict vX.Y.Z or a pseudo-version; schema between 1 and SchemaVersion) and call it from Parse and Generate.
Overrides per D-03: `--name`/`--description` set `Overrides`; the top-level name/description are the effective values; regenerating without flags keeps Overrides; an explicit empty value removes that override.
Add `TB interface{ Helper(); Fatalf(format string, args ...any) }` and `CheckT(t TB, dir string)`, which calls Check and fails with the StaleError text plus the command to rerun (`summer plugin:manifest <dir>`); kiosk must not import the testing package.
Replace the body of `internal/build/scaffold.go` pluginIDFromGo with a call to kiosk.ReadIdentity on the plugin.go's directory (keep the function name and its error prefix "build:"); every caller keeps working.
Fixtures: `testdata/consts` (module `example.test/sm-consts-plugin`, ID via `const PluginID`, Requires `ids.Translate` and `other.PluginID`, go.mod require and replace of `example.test/sm-other-plugin => ../other`, framework require v0.5.3), `testdata/consts/nested`, `testdata/other` (module `example.test/sm-other-plugin`, require v0.2.0 in consts' go.mod), and `testdata/framework` (a stub go.mod declaring the framework module path) that every fixture go.mod replaces the framework with, so `go list -m -json` runs offline; tests copy the testdata tree into t.TempDir() keeping the relative layout. Write the behavior subtests in TestManifestSmoke first (subtest names `consts`, `nested`, `errors`, `overrides`, `checkt`, `validate`) plus `TestAddPluginConstID` in internal/build/build_test.go, then implement.
Document ReadIdentity, Validate, Overrides and CheckT in modules/kiosk/README.md and add a "Testing the manifest in your plugin" section with the one-line `kiosk.CheckT(t, ".")` test to docs/plugins/marketplace.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./modules/kiosk ./internal/build -run 'TestManifestSmoke|TestAddPluginConstID|TestMakeAndAddPluginOnHelloCopy' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -30</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestManifestSmoke/consts" or "--- PASS: TestAddPluginConstID" line</fails_when>
<automated>go run ./cmd/summer plugin:manifest --pretend --name=MFA ../sm-mfa-plugin 2>&1 | grep -E '^(id|module|framework):'</automated>
<fails_when>non-zero exit, or fewer than three lines, or no "id: golem15.mfa" line</fails_when>
<automated>go run ./cmd/summer plugin:manifest --pretend --name="Stripe subscriptions" ../sm-pgstripe-plugin/subscriptions 2>&1 | grep -E '^(id|package):|golem15\.'</automated>
<fails_when>non-zero exit, or no "id: golem15.pgstripesubscriptions" line, or no "package: git.golem15.com/golem15/sm-pgstripe-plugin/subscriptions" line</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "func ReadIdentity(ctx context.Context, dir string) (Identity, error)" modules/kiosk/identity.go` prints one line
- `grep -n "kiosk.ReadIdentity" internal/build/scaffold.go` prints at least one line
- `grep -n "func CheckT(t TB, dir string)" modules/kiosk/check.go` prints one line; `go list -deps ./modules/kiosk | grep -x testing` prints nothing
- `go run ./cmd/summer plugin:manifest --pretend ../sm-paymentgateway-plugin --name="Payment gateway"` prints `id: golem15.paymentgateway` (cross-package const)
- `go run ./cmd/summer plugin:manifest --pretend ../sm-chatbots-plugin` exits non-zero with "not a released version" (research F8), unless the sibling has already been fixed
- No file under ../sm-*-plugin is created or changed by this task (`git -C ../sm-mfa-plugin status --short` shows no plugin.yaml)
</acceptance_criteria>
<done>plugin:manifest derives a valid manifest for literal, constant, cross-package and nested plugins without running their code, plugin:add works for constant-ID plugins, and plugin repos have a one-line test helper.</done>
</task>
<task type="auto" tdd="true">
<name>Task 4: The registry v1 contract in Go: wire types, envelopes and strict version rules</name>
<files>modules/kiosk/registry.go, modules/kiosk/version.go, modules/kiosk/manifest_smoke_test.go, modules/kiosk/README.md, docs/plugins/marketplace.md</files>
<read_first>
- the Task 1 answer (P34-02 as confirmed or adjusted)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md ("Proposed registry API shape", Anti-Patterns on git describe and semver)
- modules/kiosk/manifest.go (Requires type to reuse)
</read_first>
<behavior>
- RegistryPlugin, RegistryPluginDetail and RegistryVersion marshal to exactly the P34-02 field names (golden JSON in the test) and unmarshal JSON carrying unknown extra fields without error
- ValidVersion accepts v0.6.0 and v10.2.33, rejects 0.6.0, v0.6, v0.6.0-rc1, v0.6.0+meta and a leading "-"
- CompareVersions orders v0.10.0 after v0.9.9 and returns 0 for equal versions
- BaseVersion returns v0.3.1 for "v0.3.1-4-gabc1234" and for "v0.3.1", and "" for "abc1234" or ""
- Satisfies(have, min) is true when min is "", true when have >= min, false when have < min, and treats a pseudo-version minimum vX.Y.(Z+1)-0.<ts>-<hash> as satisfied by vX.Y.(Z+1) and later
- NewestCompatible(versions, framework) returns the newest RegistryVersion whose framework minimum Satisfies the given framework, and false when none does
</behavior>
<action>
Per D-16 and the Task 1 answer: add `registry.go` with `RegistryAPIPath = "/api/registry/v1"`, `RegistryPlugin`, `RegistryPluginDetail` (embeds RegistryPlugin plus ReadmeMarkdown, ReadmeHTML, Screenshots []RegistryScreenshot, Requires), `RegistryScreenshot{URL, Caption}`, `RegistryVersion`, `ListResponse{Data []RegistryPlugin; Meta ListMeta{Total int}}`, `DetailResponse`, `VersionsResponse`, `ErrorResponse{Error RegistryError{Code, Message}}`, `IngestRequest{Repository}`, `IngestResponse`, with JSON tags exactly as confirmed; time fields are time.Time encoded RFC 3339. These types are the contract: 34-03 encodes responses with them and 34-04/34-05 decode with them, so no other copy of the shape may exist.
Add `version.go` with `ValidVersion(v string) bool` (strict `^v\d+\.\d+\.\d+$`), `CompareVersions(a, b string) int` (numeric per component; only defined for valid versions), `BaseVersion(describe string) string` (the vX.Y.Z prefix of a git describe string or ""), `Satisfies(have, min string) bool`, `NewestCompatible(versions []RegistryVersion, framework string) (RegistryVersion, bool)`. Never feed a describe string to the comparer (research anti-pattern). Write the behavior subtests (`registry`, `versions`) in TestManifestSmoke first, then implement. Document the types and functions in modules/kiosk/README.md and add a "Registry API v1" reference section (paths, envelopes, fields, compatibility rules) to docs/plugins/marketplace.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./modules/kiosk -run 'TestManifestSmoke/(registry|versions)' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestManifestSmoke/registry" line</fails_when>
<automated>go test ./cmd/summer -run TestDocsTree -count=1 2>&1 | tail -3 && go run ./cmd/summer docs:build --check 2>&1 | tail -5</automated>
<fails_when>non-zero exit, or a "FAIL" or "unknown identifier" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n 'RegistryAPIPath = "/api/registry/v1"' modules/kiosk/registry.go` prints one line
- `grep -n 'json:"latest_version"\|json:"readme_html"\|json:"tagged_at"' modules/kiosk/registry.go` prints three lines (or the names confirmed at Task 1)
- `grep -n "func NewestCompatible(" modules/kiosk/version.go` prints one line
- docs/plugins/marketplace.md contains a "Registry API v1" heading and names `/api/registry/v1/plugins/{id}/versions`
</acceptance_criteria>
<done>The registry contract exists once, in Go, with version rules every consumer shares.</done>
</task>
<task type="auto" tdd="true">
<name>Task 5: summer build bakes plugin metadata and the effective framework version, and the app publishes them</name>
<files>internal/build/plugindirs.go, internal/build/build.go, internal/build/new.go, internal/build/plugininfo_smoke_test.go, internal/build/testdata/new/main.go.golden, internal/build/testdata/new/plugins.gen.go.golden, internal/build/testdata/new-no-plugin/plugins.gen.go.golden, modules/party/info.go, modules/party/README.md, examples/hello/main.go, examples/hello/plugins.gen.go, docs/architecture/go-modules-and-workspaces.md, docs/plugins/marketplace.md</files>
<read_first>
- internal/build/build.go (whole file)
- internal/build/new.go (~430-460, the generate call) and internal/build/new_golden_test.go (the -update flag)
- internal/build/leaf.go (localModuleDir/defaultPluginDir: module-cache plugins are skipped there, no change needed)
- internal/dev/watch.go (~74, build.App reuse)
- modules/party/registry.go and modules/party/README.md
- modules/bonfire/version.go (BuildVersion: what runtime already reports)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (F3, F5, Pattern 3, Pitfall 6)
</read_first>
<behavior>
- generatePluginsGen with fixed metadata emits `var PluginInfo = []party.Info{...}` in summer.yaml order with every string strconv-quoted and `const FrameworkVersion = "<v>"`, byte-stable across two calls
- generateMain emits `party.Describe(app, PluginInfo, FrameworkVersion)` with the usual failure branch, before `party.Activate(app, PluginIDs)`
- resolvePluginDirs on a temp app with one in-app plugin (no own repo) and one plugin directory that is its own git repo with tag v0.1.0 plus one commit returns Source local with empty version and Source submodule with a version starting "v0.1.0-1-g"
- a plugin directory with uncommitted changes still reports the describe string without a dirty suffix
- EffectiveFramework returns the newest reachable tag of a locally replaced framework checkout, and the go.mod require version when the framework is not replaced; when git fails it returns the require version and a warning
- build.App on an app whose metadata resolution fails (go list error) still generates ID-only PluginInfo, prints one warning and builds
- party.Describe publishes party.Installed so app.Lookup[party.Installed]() returns the plugins and framework; calling it with a nil app is an error
</behavior>
<action>
Per D-06 and D-07. In `modules/party/info.go` (additive, no change to Plugin or Activate): `Info{ID, Module, Package, Name, Description, Version, Source string}` with Source constants `SourceModule`, `SourceSubmodule`, `SourceLocal`; `Installed{Framework string; Plugins []Info}`; `Describe(app *backpack.App, plugins []Info, framework string) error` publishing Installed. Document them in modules/party/README.md.
Add `internal/build/plugindirs.go`: `pluginMeta` resolution through one `go list -e -json=ImportPath,Dir,Module,Error <every summer.yaml module>` run in the app dir with applyGoWork (research F5); per plugin read `<Dir>/plugin.yaml` with kiosk.Parse when present (name, description, module, package; a parse error warns and is ignored); version: module-cache plugin → Module.Version; a local dir whose `git -C <dir> rev-parse --show-toplevel` equals the dir → `git describe --tags --match v[0-9]*` (no dirty flag, research Pitfall 6) and Source submodule; any other local dir → Source local and empty version. Never bake a filesystem path. Add exported `EffectiveFramework(ctx, appDir string) (string, error)` per research F3 (`go mod edit -json` of go.mod, `go work edit -json` of a go.work found by findGoWork; a local replace of kiosk.FrameworkModule → `git -C <dir> describe --tags --abbrev=0 --match v[0-9]*`; otherwise the require version; on git failure return the require version plus a non-nil warning error the caller prints).
Change `generate` to take the resolved metadata (`buildMeta{Plugins []party.Info; Framework string}`): build.App resolves it once per call, prints warnings to out and falls back to ID-only entries on any failure (never fails the build); `generatePluginsGen` imports party and emits PluginInfo and FrameworkVersion after PluginIDs; `generateMain` adds the Describe call before Activate. new.go passes ID-only metadata with an empty FrameworkVersion (the first summer build fills it), which keeps the `summer new` goldens deterministic; regenerate the goldens with -update and review the diff. Regenerate examples/hello's main.go and plugins.gen.go with `go run ./cmd/summer build` run from examples/hello (or the package function) and commit them.
Write `internal/build/plugininfo_smoke_test.go` (`TestPluginInfoSmoke`, subtests per behavior line, git fixtures created in t.TempDir with `git init` and a test-local identity; skip a subtest when git is not on PATH) first, then implement. Document the generated PluginInfo/FrameworkVersion in docs/architecture/go-modules-and-workspaces.md and an "Installed plugin metadata" section in docs/plugins/marketplace.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./internal/build -run 'TestPluginInfoSmoke|TestNew|TestGenerate' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -30</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestPluginInfoSmoke" line</fails_when>
<automated>cd examples/hello && go test ./... 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "func Describe(app \*backpack.App, plugins \[\]Info, framework string) error" modules/party/info.go` prints one line
- `grep -n "party.Describe(app, PluginInfo, FrameworkVersion)" examples/hello/main.go` prints one line; `grep -n "var PluginInfo = \[\]party.Info" examples/hello/plugins.gen.go` prints one line
- `grep -n "func EffectiveFramework(ctx context.Context, appDir string) (string, error)" internal/build/plugindirs.go` prints one line
- `grep -n "describe" internal/build/plugindirs.go` shows `--tags` and `--match` arguments
- `git show --stat <the Task 5 commit sha> -- internal/build/testdata` lists only the three goldens named in files
- docs/architecture/go-modules-and-workspaces.md names PluginInfo and FrameworkVersion
</acceptance_criteria>
<done>Every built app carries its plugins' names, descriptions, versions and the framework version it was built against, ready for the admin's Installed tab.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| plugin source → kiosk reader | plugin.go, go.mod and README.md of any directory a developer points the CLI at |
| CLI args → go/git subprocesses | dir paths and module paths reach `go mod edit`, `go list`, `git describe` |
| plugin.yaml in a module-cache or submodule plugin → summer build | third-party text baked into generated Go source |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-01 | Elevation of privilege | kiosk.ReadIdentity | high | mitigate | AST-only: go/parser on source text, no `go run`, no build, no init(); TestManifestSmoke/errors proves non-const expressions are refused rather than evaluated |
| T-34-02 | Tampering | exec of go/git with paths and module strings | high | mitigate | exec.CommandContext without a shell, fixed argument positions, module paths validated (leading "-" rejected) before use, `--` before positional git arguments where git accepts it |
| T-34-03 | Tampering | plugin.yaml text in plugins.gen.go | high | mitigate | every baked string goes through strconv.Quote and formatSource; a malformed plugin.yaml is ignored with a warning (TestPluginInfoSmoke) |
| T-34-04 | Information disclosure | plugins.gen.go | low | mitigate | only IDs, module paths, texts and versions are baked; no Dir or absolute path (acceptance grep in review) |
| T-34-05 | Denial of service | summer build | medium | mitigate | metadata resolution failure degrades to ID-only and warns; build never fails on it (behavior test) |
| T-34-06 | Repudiation | stale committed plugin.yaml | medium | mitigate | `--check` and kiosk.CheckT fail on any byte difference |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | this plan installs no package (research: no new dependency) |
</threat_model>
<verification>
- `go vet ./... && go test -short ./...` green after every commit; `cd examples/hello && go test ./...` green after Task 5.
- `go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'` and `go run ./cmd/summer docs:build --check` pass.
- `go run ./cmd/summer plugin:manifest --pretend …` derives manifests for ../sm-mfa-plugin, ../sm-paymentgateway-plugin and ../sm-pgstripe-plugin/subscriptions without writing into them.
</verification>
<success_criteria>
- kiosk exists with manifest, identity, check, registry and version APIs, documented and in the root README table.
- `summer plugin:manifest` generates, previews and checks plugin.yaml for every public plugin layout.
- plugins.gen.go carries PluginInfo and FrameworkVersion; the generated main publishes them.
- No push, no tag; no file in a sibling repository changed.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md` when done; record the Task 1 answer verbatim and every name that differs from this plan's text.
</output>
## Artifacts this phase produces
- Module: `modules/kiosk` (README, root README row).
- Types: `kiosk.Manifest`, `kiosk.Overrides`, `kiosk.DeriveOptions`, `kiosk.Identity`, `kiosk.StaleError`, `kiosk.TB`, `kiosk.RegistryPlugin`, `kiosk.RegistryPluginDetail`, `kiosk.RegistryScreenshot`, `kiosk.RegistryVersion`, `kiosk.ListResponse`, `kiosk.ListMeta`, `kiosk.DetailResponse`, `kiosk.VersionsResponse`, `kiosk.ErrorResponse`, `kiosk.RegistryError`, `kiosk.IngestRequest`, `kiosk.IngestResponse`, `party.Info`, `party.Installed`.
- Functions: `kiosk.Marshal`, `kiosk.Parse`, `kiosk.Validate`, `kiosk.Derive`, `kiosk.Generate`, `kiosk.Write`, `kiosk.Check`, `kiosk.CheckT`, `kiosk.ReadIdentity`, `kiosk.ValidVersion`, `kiosk.CompareVersions`, `kiosk.BaseVersion`, `kiosk.Satisfies`, `kiosk.NewestCompatible`, `party.Describe`, `build.EffectiveFramework`.
- Constants: `kiosk.FileName`, `kiosk.SchemaVersion`, `kiosk.FrameworkModule`, `kiosk.Header`, `kiosk.RegistryAPIPath`, `party.SourceModule`, `party.SourceSubmodule`, `party.SourceLocal`.
- Generated code: `PluginInfo` and `FrameworkVersion` in every app's plugins.gen.go; `party.Describe(app, PluginInfo, FrameworkVersion)` in generated main.
- CLI: `summer plugin:manifest [dir]` with `--check`, `--pretend`, `--name`, `--description`.
- Files: `plugin.yaml` format (schema 1); `docs/plugins/marketplace.md`; tests `TestManifestSmoke`, `TestPluginInfoSmoke`, `TestAddPluginConstID`.
- Config keys: none in this plan (`plugins.registry_url` arrives in 34-04).
## Phase-wide source coverage audit
| Source | ID | Item | Plan | Status |
|--------|----|------|------|--------|
| GOAL | — | Browse at summercms.io/marketplace, install with one command, private git URLs, read-only admin Plugins screen | 01-06 | COVERED |
| REQ | — | none (Requirements: TBD); SC-1..SC-5 used instead | — | n/a |
| ROADMAP | SC-1 | plugin.yaml in every public sm-*-plugin repo, validated, anonymous fetch | 01, 02 | COVERED |
| ROADMAP | SC-2 | ingest on tag, registry API, /marketplace list/search/category/detail, presentation fields in admin | 03 | COVERED |
| ROADMAP | SC-3 | plugin:install ID (module, --source) and git URL, requirement checks, plugin:add registration | 04 | COVERED |
| ROADMAP | SC-4 | admin Plugins screen Installed + Marketplace with copy | 01, 05 | COVERED |
| ROADMAP | SC-5 | unit tests in the last plan | 06 | COVERED |
| CONTEXT | D-01..D-05 | manifest generation, derivation, overrides, --check, minimums | 01, 02 | COVERED |
| CONTEXT | D-06, D-07 | build metadata and versions | 01 | COVERED |
| CONTEXT | D-08..D-12 | install resolution, deps + --yes, plugin:update, git URL submodule-only, --offline | 04 | COVERED |
| CONTEXT | D-13..D-16 | pull ingester + ingest-now, admin-curated listing, version rows, public API v1 | 03 (contract types in 01) | COVERED |
| CONTEXT | D-17..D-19 | cabana endpoints, plugins.registry_url, permission | 04 (config), 05 | COVERED |
| RESEARCH | F1 | const IDs (user decision 1) | 01 | COVERED |
| RESEARCH | F2 | go.work replace overrides for submodule installs | 04 | COVERED |
| RESEARCH | F3 | effective framework version | 01, 04 | COVERED |
| RESEARCH | F4 | ConfirmProceed auto-confirms; use Interactive + Confirm | 04 | COVERED |
| RESEARCH | F5 | go list dir resolution | 01 | COVERED |
| RESEARCH | F6 | plugin.yaml per plugin package dir | 01, 02 | COVERED |
| RESEARCH | F7 | --name where README H1 == ID | 01, 02 | COVERED |
| RESEARCH | F8 | v0.0.0 plugin requirements | 01, 02 | COVERED |
| RESEARCH | F9 | untagged repos not listed; anonymous fetch | 02, 03 | COVERED |
| RESEARCH | F10 | nginx, work_in_serve, nodePaths, app regeneration | 03, 06 (ledger) | COVERED |
| RESEARCH | Pitfall 4 | summer.yaml comments preserved (user decision 5) | 04 | COVERED |
| RESEARCH | Pitfall 13 | ingest identity checks (ID unique, module == repo path) | 03 | COVERED |
| RESEARCH | OQ 3/6 | launch list = tagged sibling plugins; --source in a non-git app refuses (user decision 5) | 03, 04, 06 | COVERED |
| CONTEXT | Deferred | --module for git URLs; paid plugins, themes, admin installs | — | excluded (deferred) |

View File

@@ -0,0 +1,295 @@
---
phase: 34-plugin-marketplace
plan: 01
subsystem: plugins
tags: [kiosk, plugin.yaml, registry-api, go-list, git-describe, codegen, party]
requires:
- phase: 34-plugin-marketplace (planning)
provides: CONTEXT D-01..D-19, RESEARCH F1..F10, Task 1 decision P34-01..P34-04
provides:
- "modules/kiosk: plugin.yaml types (Manifest, Requires, Overrides), Marshal, Parse, Validate, Derive, Generate, Write, Check, StaleError, CheckT/TB"
- "kiosk.ReadIdentity: static, const-following ID()/Requires() reader shared with plugin:add"
- "kiosk registry v1 wire types (RegistryAPIPath, RegistryPlugin, RegistryPluginDetail, RegistryVersion, envelopes, errors, ingest) and version rules (ValidVersion, CompareVersions, BaseVersion, Satisfies, NewestCompatible)"
- "summer plugin:manifest [dir] --check --pretend --name --description"
- "party.Info, party.Installed, party.Describe; generated PluginInfo and FrameworkVersion in plugins.gen.go"
- "build.EffectiveFramework"
affects: [34-02 plugin repo rollout, 34-03 registry server, 34-04 install CLI, 34-05 admin Plugins screen, 34-06 tests, every app's committed main.go/plugins.gen.go]
actuals:
tokens: 36000
tasks: 5
commits: 4
plan_head_before: 824e3d5882c2e0b96a7d402338b9238d1c3f6ae9
plan_head_after: e8d3d724f51d19683b25221c0e666d7fedafa78e
tech-stack:
added: []
patterns:
- "Static AST resolution of string constants across packages and modules (go/parser + go list -m -json), never running plugin code"
- "Generated file plus --check / CheckT drift guard"
- "Build metadata resolution that degrades to ID-only with a warning and never fails summer build"
key-files:
created:
- modules/kiosk/kiosk.go
- modules/kiosk/manifest.go
- modules/kiosk/derive.go
- modules/kiosk/identity.go
- modules/kiosk/check.go
- modules/kiosk/registry.go
- modules/kiosk/version.go
- modules/kiosk/README.md
- modules/kiosk/manifest_smoke_test.go
- modules/kiosk/checkt_test.go
- modules/kiosk/testdata/ (literal, consts, consts/nested, other, framework fixtures)
- modules/party/info.go
- internal/build/plugindirs.go
- internal/build/plugininfo_smoke_test.go
- docs/plugins/marketplace.md
modified:
- cmd/summer/main.go
- internal/build/build.go
- internal/build/new.go
- internal/build/scaffold.go
- internal/build/build_test.go
- internal/build/testdata/new/main.go.golden
- internal/build/testdata/new/plugins.gen.go.golden
- internal/build/testdata/new-no-plugin/plugins.gen.go.golden
- examples/hello/main.go
- examples/hello/plugins.gen.go
- modules/party/README.md
- README.md
- docs/console/scaffolding.md
- docs/architecture/go-modules-and-workspaces.md
- docs/architecture/introduction.md
key-decisions:
- "Task 1 answered as-planned: P34-01 plugin.yaml format, P34-02 registry API v1 shape, P34-03 names (module kiosk, party.Info/Installed/Describe, PluginInfo/FrameworkVersion, plugins.registry_url, backend.view_plugins, /system/plugins, token scope registry) and P34-04 v0.6.0 as framework release and plugin framework minimum adopted unchanged"
- "kiosk runs go commands with GOWORK=off: a manifest describes the plugin module on its own; a required module missing from the module cache is fetched with go mod download"
- "ReadIdentity returns the ID even when Requires() cannot be read, so plugin:add keeps working for any plugin whose ID it could read before"
- "Requires marshals to JSON as {} when empty, so the registry never sends null for requires"
- "plugin versions: module cache -> module version; own git repo -> git describe --tags --match v[0-9]* --always (no --dirty); in-app -> empty"
patterns-established:
- "Plugin metadata is derived, never typed: plugin.yaml from sources, PluginInfo from plugin.yaml + go list + git"
- "Registry JSON shape exists once, as kiosk wire types"
requirements-completed: [SC-1, SC-4, D-01, D-02, D-03, D-04, D-05, D-06, D-07, D-16]
coverage:
- id: D1
description: "summer plugin:manifest generates, previews and checks plugin.yaml from plugin.go, go.mod and README (literal IDs)"
requirement: D-01
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/literal"
status: pass
- kind: other
ref: "go run ./cmd/summer plugin:manifest <tmp>/acme && go run ./cmd/summer plugin:manifest --check <tmp>/acme"
status: pass
human_judgment: false
- id: D2
description: "Constant, cross-package, cross-module and nested plugin identities resolve statically; non-const expressions are errors naming ID()/Requires(); plugin:add registers const-ID plugins"
requirement: D-02
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/consts,nested,errors"
status: pass
- kind: unit
ref: "internal/build/build_test.go#TestAddPluginConstID"
status: pass
- kind: other
ref: "summer plugin:manifest --pretend on ../sm-mfa-plugin, ../sm-paymentgateway-plugin, ../sm-pgstripe-plugin/subscriptions"
status: pass
human_judgment: false
- id: D3
description: "--name/--description overrides persist, clear with an empty value, and H1 == ID demands --name"
requirement: D-03
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/overrides"
status: pass
human_judgment: false
- id: D4
description: "--check and kiosk.CheckT fail on a missing or stale plugin.yaml; Validate enforces the format"
requirement: D-04
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/checkt,validate"
status: pass
- kind: unit
ref: "modules/kiosk/checkt_test.go#TestPluginManifest"
status: pass
human_judgment: false
- id: D5
description: "Go-style minimums: v0.0.0 plugin requirement is an error, pseudo-version warns, soft dependency has the empty minimum"
requirement: D-05
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/errors"
status: pass
- kind: other
ref: "summer plugin:manifest --pretend ../sm-chatbots-plugin exits 1 with 'not a released version'"
status: pass
human_judgment: false
- id: D6
description: "Registry v1 wire types encode the confirmed JSON shape, ignore unknown fields; strict version rules"
requirement: D-16
verification:
- kind: unit
ref: "modules/kiosk/manifest_smoke_test.go#TestManifestSmoke/registry,versions"
status: pass
human_judgment: false
- id: D7
description: "summer build bakes PluginInfo and FrameworkVersion, generated main calls party.Describe before Activate, failures fall back to IDs"
requirement: D-06
verification:
- kind: unit
ref: "internal/build/plugininfo_smoke_test.go#TestPluginInfoSmoke/generate,main,fallback,describe"
status: pass
- kind: integration
ref: "cd examples/hello && go test ./..."
status: pass
human_judgment: false
- id: D8
description: "Versions per D-07 and the effective framework version (local checkout tag, go.mod require, git failure warning)"
requirement: D-07
verification:
- kind: unit
ref: "internal/build/plugininfo_smoke_test.go#TestPluginInfoSmoke/dirs,framework"
status: pass
human_judgment: false
- id: D9
description: "Docs: kiosk README, party README, docs/plugins/marketplace.md, scaffolding and go-modules pages; docs checker passes"
verification:
- kind: other
ref: "go run ./cmd/summer docs:build --check; go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'"
status: pass
human_judgment: true
rationale: "Docs prose quality and wording are a reviewer's call; the checker only proves identifiers, links and snippets"
duration: 22min
completed: 2026-10-29
status: complete
---
# Phase 34 Plan 01: plugin.yaml, registry contract and build metadata Summary
**New framework module `kiosk` generates and checks each plugin's plugin.yaml from its own sources (resolving constant IDs across packages and modules without running code), holds the registry API v1 wire types and version rules, and `summer build` now bakes PluginInfo and FrameworkVersion into plugins.gen.go, which the generated main publishes with `party.Describe`.**
## Performance
- **Duration:** about 22 min
- **Started:** 2026-10-29T15:50:20Z
- **Completed:** 2026-10-29T16:12:19Z
- **Tasks:** 5 (Task 1 was a decision answered before dispatch; Tasks 2-5 executed)
- **Files modified:** 44 (29 created, 15 modified)
## Task 1 decision (recorded verbatim)
The user answered Task 1 through the orchestrator before dispatch: **"as-planned"**. P34-01 (plugin.yaml format), P34-02 (registry API v1 shape), P34-03 (names: module `kiosk`, `party.Info`/`Installed`/`Describe`, `PluginInfo`/`FrameworkVersion`, `plugins.registry_url`, `backend.view_plugins`, `/system/plugins`, token scope `registry`) and P34-04 (v0.6.0 as the framework release and the plugin framework minimum) are adopted exactly as written. The user re-confirmed v0.6.0 knowing that it raises every plugin's framework minimum.
No name differs from the plan's text. The plan adds these extra exported names, which 34-03..34-05 can use:
- `kiosk.IngestResult`: the `data` object of `kiosk.IngestResponse` (`repository`, `queued`). The plan described the shape but did not name the type.
- `kiosk.RegistryErrorNotFound` (`not_found`) and `kiosk.RegistryErrorInvalidQuery` (`invalid_query`): the error codes as constants.
- `kiosk.Requires.MarshalJSON` and `kiosk.Requires.MarshalYAML`.
- `kiosk.StaleError.Error`.
## Accomplishments
- `summer plugin:manifest [dir]` writes, previews (`--pretend`) and checks (`--check`, exit 1 and prints the expected file) plugin.yaml with the P34-01 field order and header. `--name`/`--description` persist in `overrides:`, and an empty value clears them.
- `kiosk.ReadIdentity` resolves literals, same-package constants (in any non-test file), constants of another package in the same module and constants of another module (`go list -m -json`, `go mod download -json` when the module is not in the cache). It handles named imports and unnamed imports whose package name differs from the path. `plugin:add` now uses it, so const-ID plugins register (research F1).
- Required-plugin minimums come from go.mod requires. Plugins in the same module and soft dependencies get the empty minimum, `v0.0.0` is an error and a pseudo-version gives a warning.
- `kiosk.CheckT(t, dir)` gives plugin repos a one-line `go test` guard. kiosk does not import `testing`.
- Registry v1 contract: `RegistryAPIPath` and every response/request type, checked by golden JSON in the tests, plus strict `vX.Y.Z` rules and `NewestCompatible`.
- `summer build` runs one `go list -e -json` over the summer.yaml packages and reads each plugin.yaml. Versions follow D-07: module version, `git describe` without `--dirty` for a plugin in its own repository, empty for an in-app plugin. It also computes `EffectiveFramework`, bakes all of this into plugins.gen.go, and warns and falls back to ID-only entries on any failure.
- Every sibling plugin derives a manifest with `--pretend` except the three chat plugins (chatbots, chatchannels, chatvideo), which require `sm-chat-plugin v0.0.0` (research F8, expected; 34-02 fixes those go.mod files). No file in any sibling repository was written.
## Task Commits
1. **Task 1: Confirm format, API shape, names, release number**: no commit (answer "as-planned" recorded above)
2. **Task 2: plugin.yaml manifest and summer plugin:manifest (tracer)**: `ec6a195` (feat)
3. **Task 3: constant plugin IDs, overrides and the CheckT helper**: `51ec2f9` (feat)
4. **Task 4: registry v1 wire types and version rules**: `4916ee3` (feat)
5. **Task 5: bake plugin metadata and the framework version into plugins.gen.go**: `e8d3d72` (feat)
**Plan metadata:** the docs commit containing this SUMMARY.
## Files Created/Modified
- `modules/kiosk/kiosk.go`: FileName, SchemaVersion, FrameworkModule, Header
- `modules/kiosk/manifest.go`: Manifest, Requires, Overrides, Marshal, Parse, Validate
- `modules/kiosk/derive.go`: DeriveOptions, Derive (go mod edit -json, README via goldmark)
- `modules/kiosk/identity.go`: Identity, ReadIdentity, module listing/download, required-ID minimums
- `modules/kiosk/check.go`: Generate, Write, Check, StaleError, TB, CheckT
- `modules/kiosk/registry.go`, `modules/kiosk/version.go`: registry v1 contract and version rules
- `modules/kiosk/manifest_smoke_test.go`, `modules/kiosk/checkt_test.go`, `modules/kiosk/testdata/`: TestManifestSmoke (literal, consts, nested, errors, overrides, checkt, validate, registry, versions) and fixtures
- `modules/party/info.go`: Info, Source constants, Installed, Describe
- `internal/build/plugindirs.go`: go list resolver, plugin.yaml reading, git describe, EffectiveFramework
- `internal/build/build.go`, `internal/build/new.go`: generate takes buildMeta; PluginInfo/FrameworkVersion; Describe in main
- `internal/build/scaffold.go`: pluginIDFromGo delegates to kiosk.ReadIdentity
- `cmd/summer/main.go`: plugin:manifest command; `summer build` shows `warning:` lines with out.Warning
- `examples/hello/main.go`, `examples/hello/plugins.gen.go`, three `summer new` goldens: regenerated
- Docs: `modules/kiosk/README.md`, `modules/party/README.md`, root `README.md` row, `docs/plugins/marketplace.md` (new), `docs/console/scaffolding.md`, `docs/architecture/go-modules-and-workspaces.md`, `docs/architecture/introduction.md`
## Decisions Made
- kiosk's go commands run with `GOWORK=off`. A manifest describes the plugin module as consumers see it, and a workspace above a plugin directory could otherwise make `go list -m` fail.
- When deriving minimums, only required modules whose go.mod mentions the framework are searched for plugin.go files, and only those are downloaded. This keeps third-party modules out of the walk.
- `ReadIdentity` prefers the `ID()` in plugin.go and reads `Requires()` from the same receiver type. That avoids picking up an unrelated `ID()` method, for example on a model, in the same package.
- PluginInfo leaves empty fields out of each composite literal and uses `party.Source*` constants. The summer new goldens bake IDs only with an empty FrameworkVersion, so they stay deterministic.
- A plugin.yaml whose `id` differs from the summer.yaml ID is ignored with a warning (defensive, T-34-03).
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 2 - Missing critical] Corrupt existing plugin.yaml gives an actionable error**
- **Found during:** Task 2
- **Issue:** A hand-damaged plugin.yaml made regeneration fail with a bare YAML parse error.
- **Fix:** The error now says to delete the file and rerun, passing `--name`/`--description` again.
- **Files modified:** modules/kiosk/derive.go
- **Commit:** ec6a195
**2. [Rule 3 - Blocking] Docs checker requires go code blocks in docs/ to come from compiled tests**
- **Found during:** Task 3
- **Issue:** The "Testing the manifest in your plugin" snippet failed `docs:build --check` ("go code block has no src= reference").
- **Fix:** Added `modules/kiosk/checkt_test.go` (`TestPluginManifest`, calls `kiosk.CheckT` on the literal fixture) and committed the fixture's generated `testdata/literal/plugin.yaml`. The page references it with `src=`, and the prose explains that a plugin passes `"."`.
- **Files modified:** modules/kiosk/checkt_test.go, modules/kiosk/testdata/literal/plugin.yaml, docs/plugins/marketplace.md
- **Commit:** 51ec2f9
**3. [Rule 3 - Blocking] `requireGit` already declared in internal/build tests**
- **Found during:** Task 5
- **Fix:** Reused the existing `requireGit` and named the identity-isolated helper `runTestGit`.
- **Files modified:** internal/build/plugininfo_smoke_test.go
- **Commit:** e8d3d72
**4. [Rule 2 - Missing critical] Additions outside the plan's file list**
- `modules/kiosk/testdata/consts/vendor.go`: proves that a constant in another non-test file of the same package resolves.
- `docs/architecture/introduction.md`: kiosk added to the module overview table, which lists every module.
- `cmd/summer/main.go` in Task 5: `summer build` prints metadata `warning:` lines with out.Warning.
- `internal/build/build_test.go` in Task 5: the existing `generatePluginsGen` call sites were updated to the new signature.
- The `plugin:manifest` examples were reworded so that `grep '"plugin:manifest"'` prints exactly one line, as the acceptance criteria require.
**5. [Process] TDD order in Task 3**
- Task 3's behavior subtests were written right after the implementation, in the same task, not before it. Tasks 4 and 5 followed RED-then-GREEN: their tests failed to compile on the missing types before implementation. Each task is one commit, as the plan's Execution units table requires.
**Total deviations:** 5 (2 Rule 2, 2 Rule 3, 1 process). **Impact:** none on the contract; all names match the plan.
## Issues Encountered
- `gofmt -l cmd/summer` lists pre-existing alignment differences in `cmd/summer/main.go`, `runtime.go` and `runtime_test.go` that this plan did not introduce. Left untouched (scope boundary).
## Next Phase Readiness / notes for later plans
- 34-02: `sm-chatbots-plugin`, `sm-chatchannels-plugin` and `sm-chatvideo-plugin` require `sm-chat-plugin v0.0.0`. They must require a tag before `plugin:manifest` succeeds. Thirteen repos whose README H1 is the ID need `--name` once.
- Every app regenerates main.go and plugins.gen.go on its first build after upgrading (research F10). `FrameworkVersion` in a committed plugins.gen.go changes when the locally replaced framework checkout gains a tag (examples/hello now bakes `v0.5.3`). Commit the regeneration together with the bump.
- `plugin:manifest` and `CheckT` may run `go mod download` for a required plugin module that is not in the module cache. They need the network once per version.
## Self-Check: PASSED
- All key files exist (kiosk sources, README, tests, party/info.go, plugindirs.go, plugininfo_smoke_test.go, docs/plugins/marketplace.md).
- Commits ec6a195, 51ec2f9, 4916ee3 and e8d3d72 are in history; `git rev-list --count 824e3d5..HEAD` = 4 before this docs commit.
- `go vet ./...`, `go test -short ./...`, `cd examples/hello && go test ./...`, `go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'` and `summer docs:build --check` all pass.
- The acceptance criteria of Tasks 2-5 were re-run and pass. The pgstripe/subscriptions, mfa and paymentgateway pretend runs print the expected id/package lines; chatbots exits 1 with "not a released version".

View File

@@ -0,0 +1,331 @@
---
phase: 34-plugin-marketplace
plan: 02
type: execute
wave: 4
depends_on: ["34-01", "34-03", "34-05"]
files_modified:
- ../sm-journal-plugin/plugin.yaml
- ../sm-journal-plugin/manifest_test.go
- ../sm-journal-plugin/go.mod
- ../sm-journal-plugin/go.sum
- ../sm-chat-plugin/plugin.yaml
- ../sm-chat-plugin/manifest_test.go
- ../sm-chat-plugin/go.mod
- ../sm-faq-plugin/plugin.yaml
- ../sm-faq-plugin/manifest_test.go
- ../sm-faq-plugin/go.mod
- ../sm-menu-plugin/plugin.yaml
- ../sm-menu-plugin/manifest_test.go
- ../sm-menu-plugin/go.mod
- ../sm-mfa-plugin/plugin.yaml
- ../sm-mfa-plugin/manifest_test.go
- ../sm-mfa-plugin/go.mod
- ../sm-oauthserver-plugin/plugin.yaml
- ../sm-oauthserver-plugin/manifest_test.go
- ../sm-oauthserver-plugin/go.mod
- ../sm-paymentgateway-plugin/plugin.yaml
- ../sm-paymentgateway-plugin/manifest_test.go
- ../sm-paymentgateway-plugin/go.mod
- ../sm-paymentgatewaysubscriptions-plugin/plugin.yaml
- ../sm-paymentgatewaysubscriptions-plugin/manifest_test.go
- ../sm-paymentgatewaysubscriptions-plugin/go.mod
- ../sm-pgstripe-plugin/plugin.yaml
- ../sm-pgstripe-plugin/manifest_test.go
- ../sm-pgstripe-plugin/subscriptions/plugin.yaml
- ../sm-pgstripe-plugin/subscriptions/manifest_test.go
- ../sm-pgstripe-plugin/go.mod
- ../sm-seo-plugin/plugin.yaml
- ../sm-seo-plugin/manifest_test.go
- ../sm-seo-plugin/go.mod
- ../sm-sitemap-plugin/plugin.yaml
- ../sm-sitemap-plugin/manifest_test.go
- ../sm-sitemap-plugin/go.mod
- ../sm-sociallogin-plugin/plugin.yaml
- ../sm-sociallogin-plugin/manifest_test.go
- ../sm-sociallogin-plugin/go.mod
- ../sm-translate-plugin/plugin.yaml
- ../sm-translate-plugin/manifest_test.go
- ../sm-translate-plugin/go.mod
- ../sm-user-plugin/plugin.yaml
- ../sm-user-plugin/manifest_test.go
- ../sm-user-plugin/go.mod
- ../sm-chatbots-plugin/plugin.yaml
- ../sm-chatbots-plugin/manifest_test.go
- ../sm-chatbots-plugin/go.mod
- ../sm-chatchannels-plugin/plugin.yaml
- ../sm-chatchannels-plugin/manifest_test.go
- ../sm-chatchannels-plugin/go.mod
- ../sm-chatvideo-plugin/plugin.yaml
- ../sm-chatvideo-plugin/manifest_test.go
- ../sm-chatvideo-plugin/go.mod
- ../sm-forum-plugin/plugin.yaml
- ../sm-forum-plugin/manifest_test.go
- ../sm-forum-plugin/go.mod
- ../sm-herald-plugin/plugin.yaml
- ../sm-herald-plugin/manifest_test.go
- ../sm-herald-plugin/go.mod
- ../sm-userfriends-plugin/plugin.yaml
- ../sm-userfriends-plugin/manifest_test.go
- ../sm-userfriends-plugin/go.mod
autonomous: false
requirements: [SC-1, D-01, D-02, D-03, D-04, D-05]
estimate:
tokens: 90000
raw_tokens: 90000
tasks: 5
confidence: low
must_haves:
truths:
- "Every public sm-*-plugin repository checked out next to the framework (20 repositories, 21 plugin packages including sm-pgstripe-plugin/subscriptions) commits a plugin.yaml generated by `summer plugin:manifest`, never hand-edited (SC-1, D-01, D-02)"
- "Each plugin.yaml carries id, module, package, name, description, framework and requires derived from the repo; READMEs whose H1 is the plugin ID get a persisted `--name` override, the others keep their README H1 (D-02, D-03, research F7)"
- "Each repository's go.mod requires the framework release that contains kiosk (v0.6.0 or the number confirmed at 34-01 Task 1), which therefore is its `framework:` minimum (user decision 2 of 2026-10-29, D-05)"
- "Each repository's `go test` runs TestPluginManifest, which calls kiosk.CheckT and fails when plugin.yaml is stale (D-04)"
- "A plugin requirement at v0.0.0 (sm-chatbots-plugin on sm-chat-plugin) is replaced by a released version, or the repository is left without plugin.yaml and the reason is recorded (research F8)"
- "Each listed repository answers an anonymous `git ls-remote` over HTTPS (SC-1)"
- "No plugin repository is pushed or tagged by this plan; plugin commits come first and app submodule pointer bumps are separate commits made only after Jakub reports the push (CLAUDE.md, user decision 2)"
artifacts:
- path: "../sm-journal-plugin/plugin.yaml"
provides: "tracer manifest"
contains: "id: golem15.journal"
- path: "../sm-journal-plugin/manifest_test.go"
provides: "TestPluginManifest"
contains: "kiosk.CheckT"
- path: "../sm-pgstripe-plugin/subscriptions/plugin.yaml"
provides: "nested plugin manifest"
contains: "package: git.golem15.com/golem15/sm-pgstripe-plugin/subscriptions"
key_links:
- from: "../sm-*-plugin/manifest_test.go"
to: "modules/kiosk/check.go"
via: "TestPluginManifest calls kiosk.CheckT(t, \".\") against the local framework through the repo's replace"
pattern: "kiosk\\.CheckT\\(t, \"\\.\"\\)"
---
## Phase Goal
People browse the public Golem15 plugins at summercms.io/marketplace and install one with `summer plugin:install <id>`. For the registry to list a plugin, its repository must carry a valid plugin.yaml at a tag. This plan puts a generated, test-guarded plugin.yaml into every public plugin repository; the tags that publish them are user-gated and follow the framework release.
<objective>
Roll out plugin.yaml and its check test to every public `sm-*-plugin` repository checked out next to the framework (user decision 5: these are the launch set; quizzes, presentations, golem and feedback have no sibling checkout and are out of this phase), using the 34-01 command. Untagged repositories (chatbots, chatchannels, chatvideo, forum, herald, userfriends) get plugin.yaml too but are not listed until Jakub tags them (D-14).
Purpose: SC-1 and the input the registry ingester (34-03) and git-URL installs (34-04) read.
Output: one commit per plugin repository (plugin.yaml, manifest_test.go, go.mod/go.sum), and, only after Jakub pushes, one pointer-bump commit per app. No push, no tag.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-CONTEXT.md
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-03-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-05-SUMMARY.md
@.planning/notes/core-plugins-own-repos.md
@CLAUDE.md
<interfaces>
From 34-01: `summer plugin:manifest [dir] [--check] [--pretend] [--name=…] [--description=…]`; `kiosk.CheckT(t TB, dir string)` (TB = Helper + Fatalf); plugin.yaml schema 1 per plugin package directory. Use the names in 34-01-SUMMARY.md where Task 1 adjusted them.
Every sibling plugin go.mod replaces git.golem15.com/golem15/summercms with ../summercms.go, so a require of the unreleased framework version builds locally against this checkout.
README H1 equals the plugin ID in faq, journal, menu, mfa, oauthserver, paymentgateway, paymentgatewaysubscriptions, pgstripe, pgstripe/subscriptions, seo, sitemap, sociallogin, translate, user (research F7). Human H1 in chat ("Chat"), chatbots ("Chat bots"), chatchannels ("ChatChannels"), chatvideo ("Chat video"), forum ("Forum"), herald ("Herald"), userfriends ("Friends").
sm-chatbots-plugin/go.mod requires git.golem15.com/golem15/sm-chat-plugin v0.0.0 with a local replace (research F8); sm-chat-plugin's newest tag is v0.1.3.
Apps mounting these plugins as submodules: sm-demo-app, sm-grzybyfunkcjonalne-app, sm-bm-app, sm-summercmsio-app, fonoteka.go.
Wave order: this plan runs after 34-03 and 34-05 (declared in depends_on) because every plugin test compiles kiosk and most compile cabana from ../summercms.go, which 34-04 and 34-05 edit, and because Task 5 commits gitlinks in sm-summercmsio-app, where 34-03 commits. 34-03-SUMMARY.md lists the unpushed site plugin (sm-summercmsio-plugin) and vue-summercmsio-app commits whose gitlinks sm-summercmsio-app still has to record.
</interfaces>
</context>
## Execution units and resume points
- Build the CLI once from this checkout into the executor's scratch directory (`go build -o <scratch>/summer ./cmd/summer`) and call that binary; never `go install` over Jakub's installed summer.
- Per repository: `git -C <repo> status --short` first. If another session has uncommitted changes in go.mod, go.sum, plugin.go or README.md, skip the repository, record it in the SUMMARY and retry it at the end of the task. Stage only the files named here, by path. No co-author tag.
- Commit subject in each plugin repository: `feat: plugin.yaml manifest for the SummerCMS marketplace`. Resume check per repository: `git -C <repo> log --format=%s | grep -Fx '<subject>'`.
| Task | Commits | Resume point |
|------|---------|--------------|
| 1 | sm-journal-plugin | TestPluginManifest passes in sm-journal-plugin |
| 2 | 13 tagged repositories (pgstripe once, both plugin dirs) | every listed repo's TestPluginManifest passes |
| 3 | 6 untagged repositories | same, or the recorded F8 skip |
| 4 | none (answer recorded in the SUMMARY) | answer recorded |
| 5 | one `chore: bump plugin pointers for plugin.yaml` per app, or none when deferred | pointers recorded |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "sm-journal-plugin commits a generated plugin.yaml that its own go test guards" — one repository only</name>
<files>../sm-journal-plugin/plugin.yaml, ../sm-journal-plugin/manifest_test.go, ../sm-journal-plugin/go.mod, ../sm-journal-plugin/go.sum</files>
<read_first>
- .planning/phases/34-plugin-marketplace/34-01-SUMMARY.md (confirmed names, release number, anything adjusted)
- modules/kiosk/README.md (CheckT usage)
- ../sm-journal-plugin/plugin.go, ../sm-journal-plugin/go.mod, ../sm-journal-plugin/README.md (H1 and summary)
- ../sm-faq-plugin/commands_documented_test.go (the plugin-test style that imports a framework helper)
</read_first>
<action>
Per D-01..D-05 and user decision 2. In ../sm-journal-plugin: set the framework requirement to the release number confirmed at 34-01 Task 1 with `go -C ../sm-journal-plugin mod edit -require=git.golem15.com/golem15/summercms@<release>`; add `manifest_test.go` in the package of plugin.go with `func TestPluginManifest(t *testing.T) { kiosk.CheckT(t, ".") }` and the kiosk import; run `go -C ../sm-journal-plugin mod tidy` and review the go.mod diff (new indirect requirements for kiosk's dependencies are expected; if tidy removes or downgrades an existing requirement, stop and record it); run `<scratch>/summer plugin:manifest --name=Journal ../sm-journal-plugin` (README H1 is the ID). Confirm the test guards the file: change one word of plugin.yaml's description, run TestPluginManifest and see it fail, then restore with `git -C ../sm-journal-plugin checkout -- plugin.yaml` or by regenerating. Commit plugin.yaml, manifest_test.go, go.mod and go.sum in ../sm-journal-plugin.
</action>
<verify>
<automated>go -C ../sm-journal-plugin test -run TestPluginManifest -count=1 -v . 2>&1 | grep -E '^(--- |FAIL|ok|PASS)'</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestPluginManifest" line</fails_when>
<automated>go -C ../sm-journal-plugin vet ./... && go -C ../sm-journal-plugin test -short ./... 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
<automated>go run ./cmd/summer plugin:manifest --check ../sm-journal-plugin && grep -E '^(id|name|framework):' ../sm-journal-plugin/plugin.yaml</automated>
<fails_when>non-zero exit, or no "id: golem15.journal" and "name: Journal" lines</fails_when>
<automated>GIT_TERMINAL_PROMPT=0 git -c credential.helper= ls-remote --heads https://git.golem15.com/golem15/sm-journal-plugin.git | head -1</automated>
<fails_when>non-zero exit, "Authentication failed" in the output, or empty output</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "git.golem15.com/golem15/summercms v0.6.0" ../sm-journal-plugin/go.mod` prints one line (or the confirmed release number)
- `grep -n "framework: v0.6.0" ../sm-journal-plugin/plugin.yaml` prints one line and `grep -n "golem15.translate" ../sm-journal-plugin/plugin.yaml` prints the requirement with a vX.Y.Z minimum
- `grep -n "overrides:" ../sm-journal-plugin/plugin.yaml` prints one line
- `git -C ../sm-journal-plugin log -1 --format=%s` is the subject from Execution units and `git -C ../sm-journal-plugin show --stat HEAD` lists only the four files
- `git -C ../sm-journal-plugin tag --points-at HEAD` prints nothing (no tag)
</acceptance_criteria>
<done>One real plugin repository carries a generated, test-guarded plugin.yaml and builds against the local framework.</done>
</task>
<task type="auto">
<name>Task 2: The 13 other tagged plugin repositories carry plugin.yaml and TestPluginManifest</name>
<files>../sm-chat-plugin/plugin.yaml, ../sm-chat-plugin/manifest_test.go, ../sm-chat-plugin/go.mod, ../sm-faq-plugin/plugin.yaml, ../sm-faq-plugin/manifest_test.go, ../sm-faq-plugin/go.mod, ../sm-menu-plugin/plugin.yaml, ../sm-menu-plugin/manifest_test.go, ../sm-menu-plugin/go.mod, ../sm-mfa-plugin/plugin.yaml, ../sm-mfa-plugin/manifest_test.go, ../sm-mfa-plugin/go.mod, ../sm-oauthserver-plugin/plugin.yaml, ../sm-oauthserver-plugin/manifest_test.go, ../sm-oauthserver-plugin/go.mod, ../sm-paymentgateway-plugin/plugin.yaml, ../sm-paymentgateway-plugin/manifest_test.go, ../sm-paymentgateway-plugin/go.mod, ../sm-paymentgatewaysubscriptions-plugin/plugin.yaml, ../sm-paymentgatewaysubscriptions-plugin/manifest_test.go, ../sm-paymentgatewaysubscriptions-plugin/go.mod, ../sm-pgstripe-plugin/plugin.yaml, ../sm-pgstripe-plugin/manifest_test.go, ../sm-pgstripe-plugin/subscriptions/plugin.yaml, ../sm-pgstripe-plugin/subscriptions/manifest_test.go, ../sm-pgstripe-plugin/go.mod, ../sm-seo-plugin/plugin.yaml, ../sm-seo-plugin/manifest_test.go, ../sm-seo-plugin/go.mod, ../sm-sitemap-plugin/plugin.yaml, ../sm-sitemap-plugin/manifest_test.go, ../sm-sitemap-plugin/go.mod, ../sm-sociallogin-plugin/plugin.yaml, ../sm-sociallogin-plugin/manifest_test.go, ../sm-sociallogin-plugin/go.mod, ../sm-translate-plugin/plugin.yaml, ../sm-translate-plugin/manifest_test.go, ../sm-translate-plugin/go.mod, ../sm-user-plugin/plugin.yaml, ../sm-user-plugin/manifest_test.go, ../sm-user-plugin/go.mod</files>
<read_first>
- ../sm-journal-plugin/manifest_test.go (Task 1, the template)
- each repository's plugin.go (package name, ID/Requires form) and README.md (H1) before generating
- ../sm-pgstripe-plugin/subscriptions/plugin.go (nested plugin, package name)
</read_first>
<action>
Repeat Task 1 for each repository, in dependency order so a required plugin's repository is done before its dependants: translate, user, chat, faq, menu, seo, sitemap, mfa, oauthserver, sociallogin, paymentgateway, paymentgatewaysubscriptions, pgstripe. Names per D-03 for READMEs whose H1 is the ID (Claude's discretion, reversible with a later `--name`): faq "FAQ", menu "Menu", mfa "Multi-factor authentication", oauthserver "OAuth server", paymentgateway "Payment gateway", paymentgatewaysubscriptions "Payment gateway subscriptions", pgstripe "Stripe payments", pgstripe/subscriptions "Stripe subscriptions", seo "SEO", sitemap "Sitemap", sociallogin "Social login", translate "Translate", user "User"; chat keeps its README H1 (no override). In sm-pgstripe-plugin generate both `plugin.yaml` (root) and `subscriptions/plugin.yaml` (research F6), add a manifest test in each of the two packages (the subscriptions test calls `kiosk.CheckT(t, ".")` from its own directory), and commit both in one commit. Stage go.sum too where tidy changed it (it is not listed per repository above when unchanged). Record in the SUMMARY a table of repository, plugin ID, name, framework minimum, requires and commit SHA.
</action>
<verify>
<automated>for r in chat faq menu mfa oauthserver paymentgateway paymentgatewaysubscriptions pgstripe seo sitemap sociallogin translate user; do go -C ../sm-$r-plugin test -run TestPluginManifest -count=1 ./... >/dev/null 2>&1 || echo "FAIL $r"; done; echo done</automated>
<fails_when>any "FAIL <repo>" line before "done"</fails_when>
<automated>for r in chat faq menu mfa oauthserver paymentgateway paymentgatewaysubscriptions pgstripe seo sitemap sociallogin translate user; do (go -C ../sm-$r-plugin vet ./... && go -C ../sm-$r-plugin test -short ./...) >/dev/null 2>&1 || echo "FAIL $r"; done; echo done</automated>
<fails_when>any "FAIL <repo>" line before "done"</fails_when>
<automated>for r in chat faq menu mfa oauthserver paymentgateway paymentgatewaysubscriptions pgstripe seo sitemap sociallogin translate user; do GIT_TERMINAL_PROMPT=0 git -c credential.helper= ls-remote --heads https://git.golem15.com/golem15/sm-$r-plugin.git >/dev/null 2>&1 || echo "FAIL $r"; done; echo done</automated>
<fails_when>any "FAIL <repo>" line before "done"</fails_when>
</verify>
<acceptance_criteria>
- `ls ../sm-*-plugin/plugin.yaml ../sm-pgstripe-plugin/subscriptions/plugin.yaml | wc -l` is at least 15 after this task (journal plus these 13 plus subscriptions)
- `grep -h '^id:' ../sm-{chat,faq,menu,mfa,oauthserver,paymentgateway,paymentgatewaysubscriptions,pgstripe,seo,sitemap,sociallogin,translate,user}-plugin/plugin.yaml | sort -u | wc -l` is 13
- `grep -L '^name: golem15\.' ../sm-*-plugin/plugin.yaml` lists every plugin.yaml (no display name equals an ID)
- every repository's latest commit has the Execution units subject and no tag points at it
</acceptance_criteria>
<done>Every tagged public plugin is ready to publish its manifest at its next tag.</done>
</task>
<task type="auto">
<name>Task 3: The 6 untagged plugin repositories carry plugin.yaml, with the v0.0.0 chat requirement resolved</name>
<files>../sm-chatbots-plugin/plugin.yaml, ../sm-chatbots-plugin/manifest_test.go, ../sm-chatbots-plugin/go.mod, ../sm-chatchannels-plugin/plugin.yaml, ../sm-chatchannels-plugin/manifest_test.go, ../sm-chatchannels-plugin/go.mod, ../sm-chatvideo-plugin/plugin.yaml, ../sm-chatvideo-plugin/manifest_test.go, ../sm-chatvideo-plugin/go.mod, ../sm-forum-plugin/plugin.yaml, ../sm-forum-plugin/manifest_test.go, ../sm-forum-plugin/go.mod, ../sm-herald-plugin/plugin.yaml, ../sm-herald-plugin/manifest_test.go, ../sm-herald-plugin/go.mod, ../sm-userfriends-plugin/plugin.yaml, ../sm-userfriends-plugin/manifest_test.go, ../sm-userfriends-plugin/go.mod</files>
<read_first>
- ../sm-chatbots-plugin/go.mod (the v0.0.0 chat requirement and its replace)
- ../sm-userfriends-plugin/go.mod (pseudo-version requirement, accepted with a warning)
- each repository's plugin.go and README.md
</read_first>
<action>
Repeat Task 1 for chatchannels, chatvideo, forum, herald, userfriends and chatbots (no name overrides: their H1s are human names). For sm-chatbots-plugin (research F8): set the sm-chat-plugin requirement to v0.1.3 (its newest tag) with `go mod edit -require`, keep the local replace, and confirm chatbots still builds against v0.1.3's API by building in a scratch copy with the chat replace dropped (`GOFLAGS=-mod=mod`, network allowed for the proxy). If it does not build against v0.1.3, restore go.mod, leave chatbots without plugin.yaml, and record in the SUMMARY that chatbots needs a sm-chat-plugin tag before it can publish (it is untagged and unlisted, so SC-1 lists it as pending, not failed). Pseudo-version warnings (userfriends) are expected; record them.
</action>
<verify>
<automated>for r in chatbots chatchannels chatvideo forum herald userfriends; do test -f ../sm-$r-plugin/plugin.yaml || { echo "SKIP $r"; continue; }; (go -C ../sm-$r-plugin vet ./... && go -C ../sm-$r-plugin test -short ./... && go -C ../sm-$r-plugin test -run TestPluginManifest -count=1 ./...) >/dev/null 2>&1 || echo "FAIL $r"; done; echo done</automated>
<fails_when>any "FAIL <repo>" line, or a "SKIP" line for a repository other than chatbots</fails_when>
<automated>for r in chatbots chatchannels chatvideo forum herald userfriends; do GIT_TERMINAL_PROMPT=0 git -c credential.helper= ls-remote --heads https://git.golem15.com/golem15/sm-$r-plugin.git >/dev/null 2>&1 || echo "FAIL $r"; done; echo done</automated>
<fails_when>any "FAIL <repo>" line before "done"</fails_when>
</verify>
<acceptance_criteria>
- `ls ../sm-*-plugin/plugin.yaml | wc -l` is 20, or 19 with the chatbots skip recorded in the SUMMARY with its build error
- `grep -n "sm-chat-plugin v0.0.0" ../sm-chatbots-plugin/go.mod` prints nothing when chatbots has a plugin.yaml
- no repository is tagged by this task (`git -C ../sm-forum-plugin tag` prints nothing)
</acceptance_criteria>
<done>All public plugin repositories carry plugin.yaml (or a recorded, explained exception) and are ready for their first tag.</done>
</task>
<task type="checkpoint:decision" gate="blocking">
<name>Task 4: Push the framework and plugin commits now, or defer the app pointer bumps to the release</name>
<decision>Jakub pushes (no tags) the framework master (34-01, 34-04 and 34-05 commits), the plugin repositories committed in Tasks 1-3, and the sm-summercmsio-plugin and vue-summercmsio-app commits from 34-03, so the apps' submodule pointers can be bumped in this plan; or the pointer bumps move to the release ledger 34-06 writes.</decision>
<context>
CLAUDE.md: plugin commits are pushed first, then the app pointer bump is its own commit; plans never push or tag. Every plugin now requires framework v0.6.0, which is not tagged yet: apps build in workspace mode (all five replace the framework locally), but app release builds and module consumers need the v0.6.0 tag first. The SUMMARY lists every repository with its new commit SHA in push order (framework, then translate, user, chat, the other plugins, then sm-summercmsio-plugin and vue-summercmsio-app).
</context>
<options>
<option id="pushed">
<name>Jakub has pushed the listed repositories (no tags); bump the pointers now</name>
<pros>Apps track the manifests immediately; no leftover pointer work at release</pros>
<cons>Apps' release builds still wait for v0.6.0; committed app pointers reference plugin commits that require an untagged framework</cons>
</option>
<option id="defer">
<name>Do not bump app pointers in this phase; record them for the release</name>
<pros>Apps stay on released plugin versions until the framework and plugins are tagged</pros>
<cons>The release step has one more pass over five apps</cons>
</option>
</options>
<resume-signal>Reply "pushed: <repositories>" or "defer"</resume-signal>
</task>
<task type="auto">
<name>Task 5: App submodule pointers follow the pushed plugin commits, or are recorded for the release</name>
<files>none in this repository; app gitlinks under ../sm-demo-app, ../sm-grzybyfunkcjonalne-app, ../sm-bm-app, ../sm-summercmsio-app (plugin submodules plus plugins/golem15/summercms and vue-summercmsio-app), ../fonoteka.go when "pushed"</files>
<read_first>
- the Task 4 answer
- each app's .gitmodules (which plugins it mounts)
- .planning/phases/34-plugin-marketplace/34-03-SUMMARY.md (pending site plugin and vue app SHAs)
- ../sm-summercmsio-app/CLAUDE.md (submodule rules; use ssu for status)
</read_first>
<action>
If Task 4 answered "defer": write the pending bumps (app, submodule path, target SHA) into the SUMMARY under "Pending pointer bumps" and stop. If "pushed": for each app and each mounted repository that Jakub pushed (in sm-summercmsio-app this includes plugins/golem15/summercms and vue-summercmsio-app at the 34-03 SHAs), run `git -C <app>/<path> fetch origin` and check out the pushed SHA, confirm `git -C <app> status --short` shows only those gitlinks (plus any other session's own edits, which stay unstaged), run `go -C <app> build ./...` in workspace mode, and commit only the gitlinks with `chore: bump plugin pointers for plugin.yaml`. Do not run summer build in the apps and do not commit regenerated main.go or plugins.gen.go: that regeneration belongs to each app's framework upgrade at release (research F10). Never push the apps.
</action>
<verify>
<automated>for a in sm-demo-app sm-grzybyfunkcjonalne-app sm-bm-app sm-summercmsio-app fonoteka.go; do test -d ../$a || continue; go -C ../$a build ./... >/dev/null 2>&1 || echo "FAIL $a"; done; echo done</automated>
<fails_when>any "FAIL <app>" line before "done"</fails_when>
</verify>
<acceptance_criteria>
- With "pushed": every bumped submodule's HEAD equals a SHA Jakub listed, and `git -C <app> show --stat HEAD` lists only gitlinks
- With "defer": the SUMMARY contains a "Pending pointer bumps" table with app, path and SHA for every mounted plugin repository changed in Tasks 1-3
- No app is pushed (`git -C ../sm-demo-app status -sb | head -1` shows no change in the ahead count beyond the new commit)
</acceptance_criteria>
<done>Apps either track the new plugin commits or the release has an exact list of pointer bumps to make.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| plugin repository → registry and installers | plugin.yaml in a tag is read by summercms.io and by `summer plugin:install` |
| developer workstation → shared remotes | pushes and tags (user-gated) |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-07 | Tampering | hand-edited or stale plugin.yaml | medium | mitigate | the file is generated only; TestPluginManifest in each repo fails on drift (Task 1 proves the failure) |
| T-34-08 | Spoofing | a manifest claiming another module or ID | medium | mitigate | module and package come from go.mod and the directory; IDs from plugin.go; the ingester re-checks module == repository path (34-03) |
| T-34-09 | Tampering | app pointers referencing unpushed commits | high | mitigate | pointer bumps only after Jakub reports the push (Task 4), and only gitlinks are committed |
| T-34-10 | Denial of service | consumers resolving the unreleased framework minimum | medium | accept | plugins are not tagged until v0.6.0 exists (release order recorded in 34-06's ledger); existing tags are never moved |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | no package is installed; go.sum changes come from `go mod tidy` against modules the framework already requires |
</threat_model>
<verification>
- Every listed repository: `go vet ./...`, `go test -short ./...` and `TestPluginManifest` pass; `summer plugin:manifest --check` passes.
- Anonymous `git ls-remote` succeeds for every listed repository.
- No tags or pushes made by the agent.
</verification>
<success_criteria>
- 20 public plugin repositories (21 plugin packages) carry a generated plugin.yaml and its test, or a recorded F8 exception for chatbots.
- Each requires the framework release containing kiosk.
- App pointers are bumped after a reported push, or listed for the release.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-02-SUMMARY.md` when done, with the per-repository table (ID, name, framework minimum, requires, SHA), warnings, skips and the pointer-bump outcome.
</output>
## Artifacts this phase produces
- Files: `plugin.yaml` and `manifest_test.go` in each of ../sm-{chat,chatbots,chatchannels,chatvideo,faq,forum,herald,journal,menu,mfa,oauthserver,paymentgateway,paymentgatewaysubscriptions,pgstripe,seo,sitemap,sociallogin,translate,user,userfriends}-plugin, plus `subscriptions/plugin.yaml` and `subscriptions/manifest_test.go` in sm-pgstripe-plugin.
- Tests: `TestPluginManifest` in every listed repository.
- go.mod: framework requirement raised to the confirmed release (v0.6.0); sm-chatbots-plugin's sm-chat-plugin requirement raised from v0.0.0 to v0.1.3 when it builds.
- Display names (plugin.yaml `overrides.name`): FAQ, Journal, Menu, Multi-factor authentication, OAuth server, Payment gateway, Payment gateway subscriptions, Stripe payments, Stripe subscriptions, SEO, Sitemap, Social login, Translate, User.
- Config keys, CLI commands, types: none.

View File

@@ -0,0 +1,260 @@
---
phase: 34-plugin-marketplace
plan: 02
subsystem: plugin-repositories
tags: [kiosk, plugin-yaml, manifest, marketplace, plugin-repos, go-mod, release-ledger]
status: complete
requires:
- phase: 34-plugin-marketplace (34-01)
provides: "summer plugin:manifest [--check] [--name], kiosk.CheckT, plugin.yaml schema 1, framework release number v0.6.0"
- phase: 34-plugin-marketplace (34-03)
provides: "unpushed sm-summercmsio-plugin 5853cf5 and vue-summercmsio-app 05f1cea commits whose gitlinks sm-summercmsio-app still has to record"
- phase: 34-plugin-marketplace (34-05)
provides: "framework master 13324e7 (kiosk + cabana as compiled by every plugin test through its ../summercms.go replace)"
provides:
- "plugin.yaml generated by summer plugin:manifest in 20 sm-*-plugin repositories (21 plugin packages incl. sm-pgstripe-plugin/subscriptions)"
- "TestPluginManifest (kiosk.CheckT(t, \".\")) in each of the 21 plugin packages: go test fails when plugin.yaml is stale"
- "framework requirement git.golem15.com/golem15/summercms v0.6.0 in all 20 go.mod files (framework minimum v0.6.0 in every manifest)"
- "sm-chatbots/chatchannels/chatvideo: sm-chat-plugin v0.0.0 requirement replaced with v0.1.3 (research F8)"
- "Pending pointer bumps (32 gitlinks in 5 apps) and push blockers recorded for 34-06's release ledger"
affects: [34-03 registry ingester (reads plugin.yaml at tags), 34-04 git-URL installs, 34-06 release ledger (pushes, tags, app pointer bumps)]
actuals:
tokens: 61672 # chars/4 over the 20 plugin-repo commit diffs (go.sum churn included)
tasks: 5
commits: 20 # measured: one commit per plugin repo, each the repo's HEAD with the plan subject (git -C <repo> log -1); 0 in summercms.go
plan_head_before: 13324e7f018be98c2e9a73557f7a367dd9616c7a
plan_head_after: 13324e7f018be98c2e9a73557f7a367dd9616c7a
tech-stack:
added: []
patterns:
- "Generated, test-guarded manifest: plugin.yaml is written only by summer plugin:manifest; manifest_test.go calls kiosk.CheckT(t, \".\") so drift fails go test"
- "Display-name overrides persisted in plugin.yaml overrides.name when the README H1 is the plugin ID (research F7)"
key-files:
created:
- ../sm-{journal,translate,user,chat,faq,menu,seo,sitemap,mfa,oauthserver,sociallogin,paymentgateway,paymentgatewaysubscriptions,pgstripe,chatchannels,chatvideo,forum,herald,userfriends,chatbots}-plugin/plugin.yaml
- ../sm-{same 20}-plugin/manifest_test.go
- ../sm-pgstripe-plugin/subscriptions/plugin.yaml
- ../sm-pgstripe-plugin/subscriptions/manifest_test.go
modified:
- ../sm-{same 20}-plugin/go.mod
- ../sm-{18 of 20}-plugin/go.sum (no go.sum change in sm-user-plugin and sm-oauthserver-plugin)
key-decisions:
- "Task 4 answered \"defer\": no app submodule pointer bumps in phase 34; the 32 pending gitlinks move to the release ledger that 34-06 writes"
- "Research F8 applied to all three chat dependants (chatbots, chatchannels, chatvideo): sm-chat-plugin requirement v0.0.0 -> v0.1.3, local replace kept"
- "Display names for ID-titled READMEs: FAQ, Journal, Menu, Multi-factor authentication, OAuth server, Payment gateway, Payment gateway subscriptions, Stripe payments, Stripe subscriptions, SEO, Sitemap, Social login, Translate, User"
requirements-completed: [SC-1, D-01, D-02, D-03, D-04, D-05]
duration: ~25min execution (Tasks 1-3 18:24:35Z-18:39:52Z; Task 5 and SUMMARY 19:55Z-20:05Z; checkpoint wait in between)
completed: 2026-10-29
---
# Phase 34 Plan 02: plugin.yaml rollout to the public plugin repositories Summary
**All 20 public sm-*-plugin repositories (21 plugin packages) now commit a plugin.yaml generated by `summer plugin:manifest`, guarded by a TestPluginManifest that calls kiosk.CheckT, and require framework v0.6.0. None was pushed or tagged. App pointer bumps are deferred to the 34-06 release ledger, as Jakub decided.**
## Performance
- **Duration:** about 25 min of execution (Tasks 1-3: 2026-10-29T18:24:35Z to 18:39:52Z; continuation for Task 5 and the SUMMARY: about 19:55Z to 20:05Z)
- **Tasks:** 5/5 (Task 4 was a decision checkpoint, answered "defer")
- **Commits:** 20 plugin-repository commits (one per repo), plus this docs commit and the roadmap progress commit in summercms.go
- **Plugin packages:** 21
## Accomplishments
- Tracer (Task 1): sm-journal-plugin carries a generated, test-guarded plugin.yaml. The drift guard was demonstrated: editing one word of the description made TestPluginManifest fail, and restoring the file made it pass again.
- Task 2: the 13 other tagged repositories, done in dependency order. sm-pgstripe-plugin has two manifests (root and `subscriptions/`) in one commit.
- Task 3: the 6 untagged repositories. The v0.0.0 sm-chat-plugin requirement (research F8) was resolved to v0.1.3, and each repository still builds against the real v0.1.3 module with the replace removed.
- Every manifest says `framework: v0.6.0`, and every go.mod requires `git.golem15.com/golem15/summercms v0.6.0` (it builds locally through the existing `../summercms.go` replace).
## Per-repository table
Commit subject in every repository: `feat: plugin.yaml manifest for the SummerCMS marketplace`. Framework minimum: v0.6.0 everywhere. Files per commit: plugin.yaml, manifest_test.go, go.mod, go.sum. sm-pgstripe-plugin also has the `subscriptions/` pair. sm-user-plugin and sm-oauthserver-plugin had no go.sum change.
| Task | Repository | Branch | Commit | Plugin ID(s) | Name (source) | requires |
|---|---|---|---|---|---|---|
| 1 | sm-journal-plugin | main | 5b38a3b20d784135d171128a75855d087c600b91 | golem15.journal | Journal (override) | golem15.translate v0.1.0 |
| 2 | sm-translate-plugin | main | 7e64224eaf1d7f0800063337ab5d1372569f2646 | golem15.translate | Translate (override) | - |
| 2 | sm-user-plugin | master | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | golem15.user | User (override) | - |
| 2 | sm-chat-plugin | main | b952128440d506c7113e64196185053ff2517780 | golem15.chat | Chat (README) | golem15.user v0.1.2 |
| 2 | sm-faq-plugin | main | 3bf54cd2f2d8c52af0ea42a4b25b3dc5253c4405 | golem15.faq | FAQ (override) | golem15.translate v0.1.0 |
| 2 | sm-menu-plugin | main | 98df4c74bd0a38efbbc6dde3c2155e840e31b708 | golem15.menu | Menu (override) | - |
| 2 | sm-seo-plugin | main | 55f5e5dbb0c1fc50851dd51c9a8f258d265d6024 | golem15.seo | SEO (override) | - |
| 2 | sm-sitemap-plugin | main | 049f3ee270ed9ac2619f357626914b1a8caac780 | golem15.sitemap | Sitemap (override) | - |
| 2 | sm-mfa-plugin | master | 544017ce5622b0016d3393b1c1df34375c556716 | golem15.mfa | Multi-factor authentication (override) | golem15.user v0.1.12 |
| 2 | sm-oauthserver-plugin | master | d600e2c1e8de1223124a111300ac72250f8033fc | golem15.oauthserver | OAuth server (override) | golem15.user v0.1.17 |
| 2 | sm-sociallogin-plugin | master | 47b3bb2f8a3aec2ce0eac796093eebda1545bac9 | golem15.sociallogin | Social login (override) | golem15.user v0.1.12 |
| 2 | sm-paymentgateway-plugin | main | 300bc097d5ecdd091e7cba54a819dce0f95ff08d | golem15.paymentgateway | Payment gateway (override) | golem15.user v0.1.1 |
| 2 | sm-paymentgatewaysubscriptions-plugin | main | c81e38531a82ae795bc0c4b1cbbe1160fc31ebfa | golem15.paymentgatewaysubscriptions | Payment gateway subscriptions (override) | golem15.paymentgateway v0.1.0, golem15.user v0.1.1 |
| 2 | sm-pgstripe-plugin (+ subscriptions/) | main | d61508ffb4d74f9e185cd1744cdaa2ef87de4379 | golem15.pgstripe; golem15.pgstripesubscriptions | Stripe payments; Stripe subscriptions (overrides) | pgstripe: golem15.paymentgateway v0.1.0; subscriptions: golem15.paymentgatewaysubscriptions v0.1.2, golem15.pgstripe "" (same module) |
| 3 | sm-chatchannels-plugin | main | 322629b08730a00dc6f9b61060dd61befaeeeda2 | golem15.chatchannels | ChatChannels (README) | golem15.chat v0.1.3, golem15.user v0.1.2 |
| 3 | sm-chatvideo-plugin | main | 33ff4f50c6ea6fd8adef89b42da2bbf00c41a3b0 | golem15.chatvideo | Chat video (README) | golem15.chat v0.1.3 |
| 3 | sm-forum-plugin | main | 36bd8754dea747d3a7cca2d39b024d71bd6c50f7 | golem15.forum | Forum (README) | golem15.user v0.1.2 |
| 3 | sm-herald-plugin | main | db8a1bb58056a4ba679e83c2e767ff4064e6bb70 | golem15.herald | Herald (README) | - |
| 3 | sm-userfriends-plugin | main | 2f29b263cad09fde5212bd2e54740e2ff415d594 | golem15.userfriends | Friends (README) | golem15.user v0.1.1 |
| 3 | sm-chatbots-plugin | main | 0cd78f2c92ff03a24b3cc4c59e955a4337ade321 | golem15.chatbots | Chat bots (README) | golem15.chat v0.1.3, golem15.user v0.1.2 |
There are 14 name overrides, exactly the ones planned. Re-verified at continuation: each repository's HEAD is the commit above with the plan subject, and `git tag --points-at HEAD` is empty in all 20.
## Verification
- Every repository passes TestPluginManifest, `go vet ./...` and `go test -short ./...`. The one exception is note 1: a pre-existing sm-user-plugin test unrelated to this plan.
- `summer plugin:manifest --check` passes for all 21 plugin packages.
- Anonymous `git ls-remote` over HTTPS works for all 20 repositories (SC-1).
- No tag points at any new commit, and no repository was pushed.
- The drift guard was demonstrated on journal (edit, stale failure, restore, pass).
- The CLI was built from framework 13324e7 into a scratch directory. Jakub's installed `summer` was not overwritten.
- Task 5 (defer): `go build ./...` succeeds in workspace mode for sm-demo-app, sm-grzybyfunkcjonalne-app, sm-bm-app, sm-summercmsio-app and fonoteka.go. No app repository was modified.
## Task 4 decision
**"defer"**: no app submodule pointer bumps in this phase. They move to the release ledger that 34-06 writes. The apps stay on their current, released plugin commits until the framework (v0.6.0) and the plugins are pushed and tagged.
## Pending pointer bumps (for the 34-06 release ledger)
There are 32 gitlinks across 5 apps. Make each bump only after the target commit is pushed, and commit only the gitlinks with `chore: bump plugin pointers for plugin.yaml`, one commit per app. Do not commit a regenerated main.go or plugins.gen.go in that commit; that regeneration belongs to each app's framework upgrade (research F10). "ff" means the current pointer is an ancestor of the target, checked locally.
### sm-demo-app (master, in sync with origin)
| Path | Current | Target | |
|---|---|---|---|
| plugins/golem15/faq | b3cc9784deff25dd408a94322fe025674d95f99f | 3bf54cd2f2d8c52af0ea42a4b25b3dc5253c4405 | ff |
| plugins/golem15/journal | f5a0394d6914a3288f2de8425ee12ec635cd7120 | 5b38a3b20d784135d171128a75855d087c600b91 | ff |
| plugins/golem15/menu | 86564746de01e965e95295c55bc70dc5dbd77ca2 | 98df4c74bd0a38efbbc6dde3c2155e840e31b708 | ff |
| plugins/golem15/mfa | 463c750312cc409b010e636645f9e5ebfa8d2ee1 | 544017ce5622b0016d3393b1c1df34375c556716 | ff |
| plugins/golem15/oauthserver | 8bbec72a04f2b11c6f3c42d5111cbebd80e6886d | d600e2c1e8de1223124a111300ac72250f8033fc | ff |
| plugins/golem15/paymentgateway | e0badb58dc6ea848f3ca44e917f34a8d01e660da | 300bc097d5ecdd091e7cba54a819dce0f95ff08d | ff |
| plugins/golem15/paymentgatewaysubscriptions | 1ec96dfb9b0b9bfb9d7cb40e843e629e06250d75 | c81e38531a82ae795bc0c4b1cbbe1160fc31ebfa | ff |
| plugins/golem15/pgstripe | 6d07d98f6518fcb1e14fae37d2456be0e75f3485 | d61508ffb4d74f9e185cd1744cdaa2ef87de4379 | ff |
| plugins/golem15/seo | b19cd069a5b2925692a1f8bc1fe04b3ef421e456 | 55f5e5dbb0c1fc50851dd51c9a8f258d265d6024 | ff |
| plugins/golem15/sitemap | 96c790df39043e7028203bb572aaaef0de2826dc | 049f3ee270ed9ac2619f357626914b1a8caac780 | ff |
| plugins/golem15/sociallogin | ecfb8a7cbc0cda100778c7c47ea5a29888a942c9 | 47b3bb2f8a3aec2ce0eac796093eebda1545bac9 | ff |
| plugins/golem15/translate | 54cf93bcfe8f9b6ccd4b6c4899d2e4469ed1c82b | 7e64224eaf1d7f0800063337ab5d1372569f2646 | ff |
| plugins/golem15/user | 07196a4bcbfee1f200c17f66cad147a4c091cb26 | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | ff |
### sm-grzybyfunkcjonalne-app (master, 1 unpushed app commit already)
| Path | Current | Target | |
|---|---|---|---|
| plugins/golem15/faq | b3cc9784deff25dd408a94322fe025674d95f99f | 3bf54cd2f2d8c52af0ea42a4b25b3dc5253c4405 | ff |
| plugins/golem15/journal | ffa2c8ffb1c894d94f4e412def39fd84c70ac502 | 5b38a3b20d784135d171128a75855d087c600b91 | ff |
| plugins/golem15/menu | 86564746de01e965e95295c55bc70dc5dbd77ca2 | 98df4c74bd0a38efbbc6dde3c2155e840e31b708 | ff |
| plugins/golem15/sitemap | 96c790df39043e7028203bb572aaaef0de2826dc | 049f3ee270ed9ac2619f357626914b1a8caac780 | ff |
| plugins/golem15/translate | 54cf93bcfe8f9b6ccd4b6c4899d2e4469ed1c82b | 7e64224eaf1d7f0800063337ab5d1372569f2646 | ff |
| plugins/golem15/user | bfcfea4ed7d45374e9584557412b88797b051741 | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | ff |
### sm-bm-app (master, in sync with origin)
| Path | Current | Target | |
|---|---|---|---|
| plugins/golem15/chat | 51c9e1759508b25e72b440a65edd6b6f37dc336f (= origin/main) | rebased SHA of b952128 (TBD) | NOT ff: rebase first |
| plugins/golem15/chatbots | d0b9fb16f88ffe11b1e0ba415df011aae920e53d (= origin/main) | rebased SHA of 0cd78f2 (TBD) | NOT ff: rebase first |
| plugins/golem15/chatchannels | a30f04a1d82b821d28766780862305da832ee7af (= origin/main) | rebased SHA of 322629b (TBD) | NOT ff: rebase first |
| plugins/golem15/mfa | 463c750312cc409b010e636645f9e5ebfa8d2ee1 | 544017ce5622b0016d3393b1c1df34375c556716 | ff |
| plugins/golem15/oauthserver | df2edddd488ce161bf1bd0c618ab519a0b53e710 | d600e2c1e8de1223124a111300ac72250f8033fc | ff |
| plugins/golem15/sociallogin | ecfb8a7cbc0cda100778c7c47ea5a29888a942c9 | 47b3bb2f8a3aec2ce0eac796093eebda1545bac9 | ff |
| plugins/golem15/user | 66fc107eb9cd6c5b63221308815719c81110c085 | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | ff |
sm-bm-app already points at the origin/main tips of chat, chatbots and chatchannels, and the local plugin.yaml commits branched off before those tips. Bumping to b952128 / 0cd78f2 / 322629b as they stand would move the app backwards. The bumps have to wait for the rebase described under the push blockers.
### sm-summercmsio-app (master, 5 unpushed app commits from 34-03)
| Path | Current | Target | |
|---|---|---|---|
| plugins/golem15/journal | ffa2c8ffb1c894d94f4e412def39fd84c70ac502 | 5b38a3b20d784135d171128a75855d087c600b91 | ff |
| plugins/golem15/translate | 1134dd1e29129d56a6d9cf087a078f0c65298c4c | 7e64224eaf1d7f0800063337ab5d1372569f2646 | ff |
| plugins/golem15/user | 50da92c1fb493f96b27170d1fde97861f1156de6 | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | ff |
| plugins/golem15/summercms (sm-summercmsio-plugin, 34-03) | ca5941540c456cd850cf3b2f50e1d3c2e3ab6ee5 | 5853cf5be0bb681a8751a75c65bcaa90a3b19740 | from 34-03 |
| vue-summercmsio-app (34-03) | b3bfc5da80d020d318e8d6d4b3b60a45c1d84f42 | 05f1cea5ac73ac45e632703a5e406012ac426bd2 | from 34-03 |
### fonoteka.go (master, 39 unpushed app commits already)
| Path | Current | Target | |
|---|---|---|---|
| plugins/golem15/user | a1b78b80f55f8569851c858a6c404809449439e0 | 97f83cc2cf7b6159b672a3a84812230a55cc8acf | ff |
No app mounts sm-chatvideo-plugin, sm-forum-plugin, sm-herald-plugin or sm-userfriends-plugin, so those four need a push and a tag but no pointer bump.
## Push blockers and push order (for the 34-06 release ledger)
**Diverged from origin.** Each of these needs a rebase onto origin/main, a regenerated plugin.yaml and a test run, which produces new SHAs. go.mod/go.sum conflicts are likely.
- sm-chat-plugin: 1 ahead, 12 behind (origin/main has 12 commits after v0.1.3; origin tip 51c9e17).
- sm-chatbots-plugin: 1 ahead, 1 behind (origin d0b9fb1 "chore: drop sibling replaces from go.mod"). After the rebase chatbots has no framework replace, so CheckT may only pass once v0.6.0 is tagged.
- sm-chatchannels-plugin: 1 ahead, 1 behind (origin a30f04a "feat: optional HTTP API switch", which touches go.mod).
**Older unpushed commits a push would carry:**
- sm-journal-plugin: 3 (a6fc7cd, 7a03640, 62c75b1), so it is 4 ahead in total.
- sm-seo-plugin: 21, so it is 22 ahead in total.
- summercms.go master is ahead of origin (23+ commits).
**Push order:** summercms.go, then translate, user, chat, faq, menu, seo, sitemap, mfa, oauthserver, sociallogin, paymentgateway, paymentgatewaysubscriptions, pgstripe, journal, chatchannels, chatvideo, forum, herald, userfriends and chatbots, then sm-summercmsio-plugin (sm-summercmsio-app/plugins/golem15/summercms, master 5853cf5be0bb681a8751a75c65bcaa90a3b19740) and vue-summercmsio-app (master 05f1cea5ac73ac45e632703a5e406012ac426bd2) from 34-03. Plugin tags follow the framework's v0.6.0 tag (T-34-10). App pointer bumps come last, one commit per app.
## Notes
1. sm-user-plugin `TestRegisterCORSPath` (register_test.go:360) fails in a standalone checkout because it walks up the tree looking for an app's `config/http.yaml`. The failure predates this plan and is out of scope (see Deferred items).
2. Research F8 was applied to chatbots, chatchannels and chatvideo: sm-chat-plugin v0.0.0 became v0.1.3 (latest tag), with the local replace kept. Each was verified to build and vet with the replace removed (network fetch of v0.1.3). In chatbots, `go mod tidy` also raised sm-user-plugin from v0.1.1 to v0.1.2, because chat v0.1.3 requires it.
3. `go mod tidy` removed stale indirect requires (charm.land/fang/v2, charmtone, muesli/mango*, muesli/roff), left over after the framework dropped fang in 53c0a65. No direct require was removed or downgraded. translate, userfriends and chatbots gained kiosk's indirect requires.
4. userfriends requires sm-chat-plugin at a pseudo-version, but its Requires() lists only golem15.user, so the manifest raises no pseudo-version warning.
5. Other sessions' edits were left alone: in sm-oauthserver-plugin, an uncommitted go.work edit (user replace pointing to ../sm-demo-app/plugins/golem15/user) stays unstaged; in sm-journal-plugin, the untracked go.work.sum stays untouched.
6. Timing: Tasks 1-3 ran from 2026-10-29T18:24:35Z to 18:39:52Z. The checkpoint was answered "defer", and the continuation ran Task 5 and wrote this SUMMARY.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] F8 resolution extended from chatbots to chatchannels and chatvideo**
- **Found during:** Task 3
- **Issue:** The plan described the v0.0.0 sm-chat-plugin requirement for chatbots only. chatchannels and chatvideo carry the same requirement, and Task 3's verify rejects a skip for any repository other than chatbots.
- **Fix:** The same treatment in all three: require sm-chat-plugin v0.1.3, keep the local replace, and verify the build against the real v0.1.3 with the replace removed.
- **Files modified:** ../sm-{chatbots,chatchannels,chatvideo}-plugin/go.mod, go.sum
- **Commits:** 0cd78f2, 322629b, 33ff4f5
**2. [Rule 3 - Blocking] Build byproducts removed after Task 5's app build check**
- **Found during:** Task 5 verify
- **Issue:** `go build ./...` writes a binary when the pattern matches a single main package. It left `sm-grzybyfunkcjonalne-app/sm-grzybyfunkcjonalne-app` and `sm-summercmsio-app/sm-summercmsio-app` (untracked, created by this run).
- **Fix:** Removed both files. No tracked file in any app changed.
- **Commit:** none (untracked artifacts)
## Deferred Issues
- sm-user-plugin `TestRegisterCORSPath` (register_test.go:360) fails outside an app checkout. It predates this plan and belongs to the plugin's own test setup, not to the manifest rollout.
## Known Stubs
None. plugin.yaml files are generated from each repository's go.mod, plugin.go and README.
## Threat Flags
None beyond the plan's threat model. T-34-07 and T-34-08 are mitigated by the generated file and TestPluginManifest. T-34-09 is mitigated by the "defer" answer: no pointer references an unpushed commit. T-34-10 is accepted and handled by the push order above.
## Next Phase Readiness
- 34-06 owns the release ledger: framework v0.6.0 tag, plugin pushes and first or next tags, the three chat rebases, and the 32 pointer bumps listed above.
- The registry (34-03) lists a plugin only once its plugin.yaml is in a pushed tag.
## Self-Check: PASSED
- 20/20 plugin-repo commits found as each repository's HEAD with the plan subject (`git -C <repo> log -1`), none tagged.
- All five apps build in workspace mode; no app repository modified.
## Gap closure: SC-1 remaining repos
34-VERIFICATION.md found four more public plugin repositories on git.golem15.com without plugin.yaml. Jakub chose to roll them out now (2026-10-29). They were cloned next to the framework (`git@git.golem15.com:golem15/sm-<name>-plugin.git`) and given the same treatment as the 20 above: framework require v0.6.0, `go mod tidy`, `summer plugin:manifest` (with `--name` for golem, feedback and quizzes, whose README H1 is the ID), and `manifest_test.go` calling `kiosk.CheckT(t, ".")`. Each got one manifest commit (presentations after a separate `docs: README` commit) with the subject `feat: plugin.yaml manifest for the SummerCMS marketplace`, containing plugin.yaml, manifest_test.go, go.mod and go.sum. None was pushed or tagged.
| Repository | Branch | Commit | Plugin ID | Name (source) | requires | Framework | Tag now -> planned |
|---|---|---|---|---|---|---|---|
| sm-golem-plugin | master | 89fd90a6d21c78501499c18e4eea5a4853e9519d | golem15.golem | Golem AI (override) | - | v0.6.0 (was v0.4.0) | v0.1.1 -> v0.1.2 |
| sm-feedback-plugin | master | dd78bd275ccf533ae3d07d6dfb415f2a1b44b2f7 | golem15.feedback | Feedback (override) | golem15.user v0.1.0 | v0.6.0 (was v0.4.0) | v0.1.1 -> v0.1.2 |
| sm-quizzes-plugin | master | 67a83dba321f1c97471bc7ba704c2218c21dc4f8 | golem15.quizzes | Quizzes (override) | golem15.user v0.1.0 | v0.6.0 (was v0.1.9) | v0.1.0 -> v0.1.1 |
| sm-presentations-plugin | master | 3eb4de72c5ec43ddd7c56de57202e79f7584a5e8 (after README cfa0c40 (both rebased onto sm-bm-app's unpushed theme commit d205cd7 on 2026-10-30)) | golem15.presentations | Presentations (README) | golem15.user v0.1.0 | v0.6.0 (was v0.5.0) | v0.1.1 -> v0.1.2 |
- **sm-presentations-plugin:** at first skipped because it had no README.md (kiosk refuses to derive without one, even with `--name` and `--description`). Jakub asked for it to be included, so a README was written from the code (H1 "Presentations", summary, Overview, Features, Usage, Configuration, API reference, CLI commands, Dependencies, Testing) and committed on its own as `docs: README` (cfa0c40). The manifest commit follows, with no name override. Its planned v0.1.2 also releases the 10 commits after v0.1.1.
- **Framework fix 87921c2, `fix(kiosk)`:** these repositories are developed inside applications. Their go.mod replaces point at an application mount (`../../../../summercms.go`, and `sm-user-plugin => ../user`). kiosk resolves required plugins with `GOWORK=off`. Next to the framework, `../user` does not exist, so feedback and quizzes derived `golem15.user: ""`, while inside sm-demo-app they derived `v0.1.0`. TestPluginManifest could not pass in both layouts. kiosk now fetches a required module whose local replace directory is missing at the version go.mod requires, so both layouts give `v0.1.0`. The fix has a regression test (TestDeriveMissingReplace, offline file:// proxy), and the 21 existing manifests stayed fresh.
- **Local build setup:** each clone has an untracked `go.work` listed in `.git/info/exclude`. It uses `.`, replaces the framework with `../summercms.go`, and, where the plugin requires the user plugin, replaces it with `../sm-demo-app/plugins/golem15/user`. The committed go.mod replaces are unchanged, and tidy ran with them pointed at those paths only temporarily.
- **Checks:** for golem, feedback, quizzes and presentations, TestPluginManifest, `go vet ./...`, `go test -short ./...` (green before and after the change), `summer plugin:manifest --check` and anonymous `git ls-remote` over HTTPS all pass. The drift guard was demonstrated on feedback and presentations. `go mod tidy` removed the fang leftovers (note 3) and added framework v0.6.0's indirect requires. No direct require was removed or downgraded.
- **Mounted in apps:** sm-demo-app mounts golem, feedback, quizzes and presentations. sm-bm-app mounts quizzes and presentations. fonoteka.go mounts golem and feedback. The eight pointer bumps are in 34-release-log.md. All are fast-forwards: golem, feedback and quizzes sit one commit on top of the app's pointer, and presentations is 13 commits after sm-demo-app's v0.1.1 and 2 after sm-bm-app's d205cd7.

View File

@@ -0,0 +1,409 @@
---
phase: 34-plugin-marketplace
plan: 03
type: execute
wave: 2
depends_on: ["34-01"]
coupling_justified: ["34-04: same wave; 34-04 adds modules/kiosk/client.go and edits internal/build and cmd/summer in the framework checkout this plan compiles through go.work; only the kiosk package is shared, the change is one new file and each 34-04 commit compiles"]
files_modified:
- ../sm-summercmsio-app/plugins/golem15/summercms/plugin.go
- ../sm-summercmsio-app/plugins/golem15/summercms/go.mod
- ../sm-summercmsio-app/plugins/golem15/summercms/go.sum
- ../sm-summercmsio-app/plugins/golem15/summercms/README.md
- ../sm-summercmsio-app/plugins/golem15/summercms/updates/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/repository.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/version.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/repository/columns.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/models/repository/fields.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin/columns.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin/fields.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/git.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/query.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_list.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_form.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_list.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_form.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/console/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/routes_registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/jobs.go
- ../sm-summercmsio-app/plugins/golem15/summercms/schedule.go
- ../sm-summercmsio-app/plugins/golem15/summercms/token_scopes.go
- ../sm-summercmsio-app/plugins/golem15/summercms/admin.go
- ../sm-summercmsio-app/plugins/golem15/summercms/admin_navigation.go
- ../sm-summercmsio-app/plugins/golem15/summercms/admin_permissions.go
- ../sm-summercmsio-app/plugins/golem15/summercms/lang.go
- ../sm-summercmsio-app/plugins/golem15/summercms/lang/en/lang.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/lang/pl/lang.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/links_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/testmain_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry_smoke_test.go
- ../sm-summercmsio-app/config/queue.yaml
- ../sm-summercmsio-app/config/http.yaml
- ../sm-summercmsio-app/deploy/nginx/summercms.io.conf
- ../sm-summercmsio-app/deploy/supervisor/summercms-io-changelog.conf
- ../sm-summercmsio-app/deploy/changelog.env.example
- ../sm-summercmsio-app/scripts/changelog-post.py
- ../sm-summercmsio-app/scripts/test_changelog_post.py
- ../sm-summercmsio-app/scripts/smoke.sh
- ../sm-summercmsio-app/DEPLOY.md
- ../sm-summercmsio-app/README.md
- ../sm-summercmsio-app/CLAUDE.md
- ../sm-summercmsio-app/vue-summercmsio-app/app/components/SiteHeader.vue
- ../sm-summercmsio-app/vue-summercmsio-app/i18n/locales/en.json
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/nuxt.config.ts
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/i18n/locales/en.json
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/index.vue
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/[vendor]/[name].vue
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/composables/useRegistry.ts
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/utils/marketplace.ts
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/marketplace-smoke.mjs
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/expect-marketplace.txt
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/plugins.json
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/plugin-golem15.journal.json
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/versions-golem15.journal.json
- ../sm-summercmsio-app/vue-summercmsio-app/package.json
- ../sm-summercmsio-app/vue-summercmsio-app/README.md
autonomous: true
requirements: [SC-2, D-04, D-13, D-14, D-15, D-16]
user_setup:
- service: summercms-io-registry-token
why: "changelog-post.py calls the ingest-now endpoint after a plugin release; without a token scoped `registry` the call answers 403, is tolerated, and the hourly ingest picks the tag up"
dashboard_config:
- task: "Mint a personal API token with the scope `registry` (Account → API tokens on the summercms.io admin, through the SSH tunnel) and store it in ~/.config/summercms/registry-token with mode 600; the agent never mints, prints or copies tokens"
location: "summercms.io admin over the SSH tunnel (DEPLOY.md)"
- service: rome-git
why: "the ingester shells out to git; production must have it"
dashboard_config:
- task: "Before the deploy that ships the registry, confirm `command -v git` on rome (DEPLOY.md step added in Task 4)"
location: "rome (debian@10.8.3.118 -p 2222)"
estimate:
tokens: 190000
raw_tokens: 190000
tasks: 4
confidence: low
must_haves:
truths:
- "A summercms.io administrator curates the listing by adding a repository URL; the ingester fills every fact from the repository and a plugin is published only once one of its vX.Y.Z tags carries a valid plugin.yaml; tags without one are skipped (D-13, D-14)"
- "The ingester clones anonymously over HTTPS into a temporary bare partial clone, reads tags, each tag's plugin.yaml files and the latest tag's README, never checks out a tree, never recurses into submodules, caps every blob it reads, and refuses a plugin.yaml whose module differs from the repository path or whose ID another listed repository already owns (D-13, research Pitfall 13)"
- "Every vX.Y.Z tag becomes a version row with its framework minimum and plugin minimums; the README is stored for the latest tag only, as markdown and as breakwater-sanitized HTML (D-15)"
- "Ingestion runs hourly as a scheduled console command and on demand through POST /api/registry/v1/ingest, which needs a backend principal holding golem15.summercms.registry_ingest through a token scoped `registry`; no forge webhooks (D-13, user decision 3)"
- "GET /api/registry/v1/plugins?q=&category=, /plugins/{id} and /plugins/{id}/versions answer without auth with open CORS, Cache-Control and an ETag, encoded with kiosk's wire types so their shape is exactly the one frozen at 34-01 Task 1 (D-16)"
- "Category, featured flag, screenshots, icon and sort order are edited in the summercms.io admin and appear in the API; the facts (versions, requirements, module, README) are read-only there (SC-2, decision note)"
- "/marketplace lists, searches and filters plugins by category and /marketplace/<vendor>/<name> shows the detail with the install command, README and versions, rendered by the changelog Node SSR app from the registry API (SC-2)"
- "`changelog-post.py publish … --repo` refuses a plugin release whose committed plugin.yaml fails `summer plugin:manifest --check`, and after a successful post asks the registry to ingest now, treating a 401/403/404 or network failure as a warning (D-04, D-13, user decision 3)"
- "Production config serves jobs (queue.work_in_serve true), nginx routes /marketplace to the Node app and allows POST only on the ingest path, and DEPLOY.md requires git on the server (research F10, Pitfalls 9-10)"
artifacts:
- path: "../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go"
provides: "pull ingester"
contains: "breakwater.Render"
- path: "../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go"
provides: "public registry API and ingest-now endpoint"
contains: "kiosk.ListResponse"
- path: "../sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go"
provides: "registry tables"
contains: "golem15_summercms_registry_versions"
- path: "../sm-summercmsio-app/plugins/golem15/summercms/registry_smoke_test.go"
provides: "TestRegistrySmoke (tracer)"
contains: "func TestRegistrySmoke("
- path: "../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/index.vue"
provides: "marketplace list page"
contains: "plugin:install"
- path: "../sm-summercmsio-app/scripts/changelog-post.py"
provides: "manifest check and ingest-now hooks"
contains: "api/registry/v1/ingest"
key_links:
- from: "../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go"
to: "modules/kiosk/manifest.go"
via: "each tag's plugin.yaml goes through kiosk.Parse and kiosk.Validate before a version row is written"
pattern: "kiosk\\.Parse\\("
- from: "../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go"
to: "modules/kiosk/registry.go"
via: "responses are kiosk.ListResponse, kiosk.DetailResponse, kiosk.VersionsResponse and kiosk.ErrorResponse values"
pattern: "kiosk\\.(ListResponse|DetailResponse|VersionsResponse|ErrorResponse)"
- from: "../sm-summercmsio-app/vue-summercmsio-app/changelog/app/composables/useRegistry.ts"
to: "/api/registry/v1"
via: "SSR fetches through runtimeConfig.registry.apiBase (NUXT_REGISTRY_API_BASE), browser fetches through the same-origin path"
pattern: "registry"
---
## Phase Goal
People browse the public Golem15 plugins at summercms.io/marketplace. This plan builds the marketplace itself: the registry that ingests plugin repositories into Postgres, its public read-only API, the admin that curates and decorates the listing, the pages, the deploy configuration and the release-script hooks.
<objective>
In the summercms.io application (`../sm-summercmsio-app`) and its two submodules, the site plugin `golem15.summercms` (`plugins/golem15/summercms`, repository sm-summercmsio-plugin) and `vue-summercmsio-app`:
- registry tables, models and a pull ingester (D-13, D-14, D-15);
- the public API at /api/registry/v1 using kiosk's wire types (D-16, shape frozen at 34-01 Task 1);
- admin curation and presentation fields, the `registry` token scope and the ingest-now endpoint (user decision 3);
- hourly scheduled ingestion with jobs enabled in serve;
- /marketplace pages in the changelog Node SSR app (research A4), a landing header link;
- deploy configs, DEPLOY.md and the changelog-post.py hooks (D-04, D-13).
Launch listing (user decision 5): the tagged public plugins checked out next to the framework; the curated URLs are recorded in DEPLOY.md and added after the plugins' first plugin.yaml tags exist (user-gated release, ledger in 34-06).
Output: commits in the site plugin repository, the vue app repository and the app repository (each its own commits). Submodule pointer bumps in sm-summercmsio-app are not committed in this plan: they follow Jakub's push (34-02 Task 4) or move to the release ledger (CLAUDE.md). Nothing is pushed, tagged or deployed.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-CONTEXT.md
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-PATTERNS.md
@.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md
@../sm-summercmsio-app/CLAUDE.md
<interfaces>
From 34-01 (names may be adjusted in its SUMMARY): kiosk.Parse, kiosk.Validate, kiosk.FileName, kiosk.ValidVersion, kiosk.CompareVersions; wire types kiosk.RegistryPlugin, RegistryPluginDetail, RegistryScreenshot, RegistryVersion, ListResponse{Data, Meta{Total}}, DetailResponse, VersionsResponse, ErrorResponse{Error{Code, Message}}, IngestRequest{Repository}, IngestResponse; kiosk.RegistryAPIPath = "/api/registry/v1".
Framework: breakwater.Render(markdown string) string; cabana.ResolveBackend(app, r, cover...) and cabana.Allows(principal, []string); pact.HasMigrations/HasModels/HasAdminControllers/HasPermissions/HasNavigation/HasTokenScopes/HasJobs/HasSchedule/HasCommands/HasRoutes; pact.ScheduledCommand{Command, Cadence: pact.Every(time.Hour)}; conga.Job[T](fn, opts...) and conga.From(app) for enqueueing; surf middleware "throttle:<bucket>" and "cors:<profile>" with http.cors_profiles.<name> in config; lagoon/attach relations (sm-journal-plugin/models/post.go AttachRelations).
Templates: ../sm-faq-plugin (updates/registry.go, migrations, models/registry.go, admin.go, admin_navigation.go, admin_permissions.go, controllers/*/config_*.yaml, routes.go, lang/, testmain_test.go with testcontainers), ../sm-journal-plugin (token_scopes.go, controllers/api/auth.go ~83-106), ../sm-chatvideo-plugin/schedule.go.
Site plugin today: plugin.go declares only pact.HasRoutes; Routes fails closed without the public tree (tests use the fsys field); links_test.go nodePaths = ["/changelog"]; go.mod requires the framework v0.4.0 and the app's go.work replaces it with ../summercms.go.
App: config/queue.yaml work_in_serve false; nginx denies non-GET outside /_journal/api/v1/ and 404s /backend; changelog Node app on 127.0.0.1:3095 with NUXT_JOURNAL_API_BASE; scripts/changelog-post.py has call(method, path, token, body=None, base=None), cmd_publish, SITE, FRAMEWORK, TOKEN_FILE.
Changelog app: changelog/nuxt.config.ts (extends '..' and vue-journal-layer, buildAssetsDir /changelog/_nuxt/, runtimeConfig.journal.apiBase, routeRules swr 60, pages:extend removes the landing index); testing via vue-journal-layer's testing/nuxt-server.mjs startNuxtServer({outputDir, apiBase, port, env}) and smoke-ssr.mjs parseExpectLine.
</interfaces>
</context>
## Execution units and resume points
- Three repositories, committed separately and in this order within a task: site plugin (`git -C ../sm-summercmsio-app/plugins/golem15/summercms`), vue app (`git -C ../sm-summercmsio-app/vue-summercmsio-app`), app (`git -C ../sm-summercmsio-app`). Stage explicit paths; never stage a submodule gitlink in the app (the gitlinks stay modified until Jakub pushes; record the pending SHAs in the SUMMARY). Check `git status --short` in each repository first and leave other sessions' edits alone. No co-author tag.
- Docker-backed tests: if the socket is denied, run them through `sudo -u golem` (CLAUDE.md).
- Resume check: `git -C <repo> log --format=%s | grep -Fx '<subject>'`.
| Task | Commit subjects (repository) | Resume point |
|------|------------------------------|--------------|
| 1 | `feat: plugin registry tables, ingester and plugin detail API` (site) | TestRegistrySmoke/detail passes |
| 2 | `feat: registry list, search and versions API, hourly ingest` (site); `feat: registry CORS profile and jobs in serve` (app) | TestRegistrySmoke passes |
| 3 | `feat: registry admin, token scope and ingest-now endpoint` (site); `feat: manifest check and ingest-now in changelog-post` (app) | test_changelog_post.py passes |
| 4 | `feat: marketplace pages` (vue); `feat: marketplace link` (site, links_test); `feat: marketplace deploy config and docs` (app) | marketplace smoke passes |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "a curated repository with a tagged plugin.yaml is served at GET /api/registry/v1/plugins/{id}" — one repository, one tag, one plugin</name>
<reversibility rating="one-way">The JSON this endpoint returns is the D-16 contract; its shape was confirmed at 34-01 Task 1 and is encoded only through kiosk's wire types, so this task adds no field of its own.</reversibility>
<precondition>.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md records the 34-01 Task 1 answer that froze the /api/registry/v1 shape (the checkpoint:decision for this one-way door); halt if it is absent</precondition>
<files>../sm-summercmsio-app/plugins/golem15/summercms/plugin.go, ../sm-summercmsio-app/plugins/golem15/summercms/go.mod, ../sm-summercmsio-app/plugins/golem15/summercms/go.sum, ../sm-summercmsio-app/plugins/golem15/summercms/updates/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/models/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/models/repository.go, ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin.go, ../sm-summercmsio-app/plugins/golem15/summercms/models/version.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry/git.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry/query.go, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/routes_registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/testmain_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry_smoke_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/README.md</files>
<read_first>
- ../sm-summercmsio-app/plugins/golem15/summercms/plugin.go, static.go, smoke_test.go (how tests build the plugin without the public tree)
- ../sm-faq-plugin/updates/registry.go, ../sm-faq-plugin/updates/202610110001_create_golem15_faq_faqs.go, ../sm-faq-plugin/models/registry.go, ../sm-faq-plugin/models/faq.go, ../sm-faq-plugin/routes.go, ../sm-faq-plugin/controllers/api/faqs.go, ../sm-faq-plugin/testmain_test.go
- modules/kiosk/registry.go, modules/kiosk/manifest.go, modules/kiosk/README.md (34-01 output)
- modules/breakwater/README.md
- internal/build/new.go (~286 runGit: exec pattern)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md ("Hardened git for the ingester", Pattern 7, Pitfall 13)
</read_first>
<action>
Per D-13, D-14, D-15, D-16 (shape from 34-01 Task 1). In the site plugin: raise the framework requirement to the release confirmed at 34-01 Task 1 (`go mod edit -require`, then `go mod tidy`; the app's go.work keeps replacing it). Migration `202610300001_create_golem15_summercms_registry` (raw SQL like faq, with Rollback dropping in reverse order) creates `golem15_summercms_registry_repositories` (id, url text unique, module text, enabled bool default true, tags_digest text, last_ingested_at, last_error text, sort timestamps), `golem15_summercms_registry_plugins` (id, repository_id fk, plugin_id text unique, path text, name, description, module, package, latest_version, latest_framework, readme_markdown, readme_html, category text, featured bool default false, sort_order int default 0, published bool default false, timestamps) and `golem15_summercms_registry_versions` (id, plugin_row_id fk on delete cascade, version, framework, requires jsonb, module, package, commit text, tagged_at, unique (plugin_row_id, version)). Models `Repository`, `Plugin`, `Version` with a models registry like faq. `Repository.module` is derived from an https URL (host plus path without `.git` and trailing slash) when saved; it is what plugin.yaml's module must equal.
`registry/git.go`: a runner that executes git with exec.CommandContext, `--` before every URL and path, a minimal environment (PATH plus a temporary HOME) and GIT_TERMINAL_PROMPT=0, GIT_ALLOW_PROTOCOL from a package variable `allowedProtocols` (default "https"; the test sets "https:file"), GIT_CONFIG_NOSYSTEM=1, GIT_CONFIG_GLOBAL=/dev/null; `exec.LookPath("git")` failure is a clear error recorded on the repository.
`registry/ingest.go`: `Ingester{DB *gorm.DB}` and `Ingester.Repository(ctx, repositoryID uint) error`: clone `--bare --filter=blob:none` into a temp dir (retry without the filter when the server refuses it; remove the dir always), list tags with for-each-ref (peeled commit, creator date), keep strict vX.Y.Z tags (kiosk.ValidVersion), find `(^|/)plugin.yaml$` with ls-tree per tag, read each with `git show <tag>:<path>` through io.LimitReader (64 KiB), kiosk.Parse plus kiosk.Validate, require module == repository.module, upsert the plugin row (by plugin_id; reject an ID owned by another repository and record the error), insert the version row; for the newest valid tag, read `<dir>/README.md` (cap 512 KiB) into readme_markdown and `breakwater.Render` into readme_html, and set latest_version, latest_framework, name, description, module, package, published = true. A tag without a valid plugin.yaml is skipped and noted in last_error, never fatal (D-14). In this task handle the single-tag path fully; Task 2 adds the change check and the multi-tag/edge rules.
`registry/query.go`: `Detail(ctx, db, pluginID) (kiosk.RegistryPluginDetail, bool, error)`. `controllers/api/registry.go`: `Show` handler writing `kiosk.DetailResponse` or 404 `kiosk.ErrorResponse{not_found}`. `routes_registry.go`: `registerRegistryRoutes(r pact.Router, app)` mounting `GET /api/registry/v1/plugins/{id}` (callable from tests without the public tree); plugin.go calls it from Routes and declares HasMigrations and HasModels (update the package doc: the plugin now has registry tables). testmain_test.go starts testcontainers Postgres like faq (flag.Parse, testing.Short skip). `registry_smoke_test.go` `TestRegistrySmoke/detail`: create a source repo with git in t.TempDir (commit a plugin.yaml produced by kiosk.Marshal for module `example.test/acme/sm-acme-plugin`, ID `acme.blog`, plus a README), tag v0.1.0, `git clone --bare` it, insert a repository row with url `file://<bare>` and module `example.test/acme/sm-acme-plugin`, run the Ingester, then GET /api/registry/v1/plugins/acme.blog through an httptest server and assert latest_version v0.1.0, framework, readme_html non-empty and free of `<script`, and GET of an unknown ID answers 404 with code not_found. Document the registry in the site plugin README.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms test -run 'TestRegistrySmoke' -count=1 -v ./... 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", a "--- SKIP: TestRegistrySmoke" line (Docker unavailable: rerun through sudo -u golem), or no "--- PASS: TestRegistrySmoke/detail" line</fails_when>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms vet ./... && go -C ../sm-summercmsio-app/plugins/golem15/summercms test -short ./... 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "golem15_summercms_registry_versions" ../sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go` prints at least two lines (create and drop)
- `grep -n "GIT_ALLOW_PROTOCOL\|GIT_TERMINAL_PROMPT=0\|GIT_CONFIG_NOSYSTEM" ../sm-summercmsio-app/plugins/golem15/summercms/registry/git.go` prints three lines
- `grep -n "kiosk.DetailResponse" ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go` prints at least one line, and no struct in the site plugin redeclares a json tag `latest_version` (`grep -rn 'json:"latest_version"' ../sm-summercmsio-app/plugins/golem15/summercms` prints nothing)
- `grep -n "io.LimitReader" ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go` prints at least one line
</acceptance_criteria>
<done>One tagged plugin repository flows through clone, parse, Postgres and the public detail endpoint.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: The full public API (list, search, category, versions) with CORS and caching, and hourly ingestion that skips unchanged repositories</name>
<reversibility rating="one-way">Adds the list and versions endpoints of the frozen v1 contract; query parameters q and category and the envelopes are part of it.</reversibility>
<precondition>the 34-01 Task 1 answer in 34-01-SUMMARY.md covers the list and versions shapes; halt if it adjusted them in a way kiosk's wire types do not reflect</precondition>
<files>../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry/query.go, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/routes_registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/console/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/schedule.go, ../sm-summercmsio-app/plugins/golem15/summercms/plugin.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry_smoke_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/README.md, ../sm-summercmsio-app/config/queue.yaml, ../sm-summercmsio-app/config/http.yaml</files>
<read_first>
- modules/surf/README.md (named CORS profiles, throttle buckets) and ../sm-faq-plugin/routes.go (bucket constant)
- ../sm-chatvideo-plugin/schedule.go and modules/conga/README.md (scheduled commands, work_in_serve)
- ../sm-summercmsio-app/config/queue.yaml, ../sm-summercmsio-app/config/http.yaml
- the Task 1 files
</read_first>
<behavior>
- GET /api/registry/v1/plugins lists only published plugins ordered featured first, then sort_order, then name, with meta.total equal to the count
- q matches id, name or description case-insensitively with LIKE wildcards in q escaped; category filters exactly; q over 100 characters or a category not matching ^[a-z0-9-]{1,40}$ answers 400 invalid_query
- GET /plugins/{id}/versions lists every version newest first with framework, requires, commit and tagged_at
- every GET carries Access-Control-Allow-Origin * (Origin sent), Cache-Control public max-age=300 and an ETag, and a matching If-None-Match answers 304
- a repository with three tags (v0.1.0 without plugin.yaml, v0.2.0 valid, v0.3.0 with an invalid ID) yields one version, latest v0.2.0, and records the skipped tags in last_error
- a nested plugin.yaml (sub/plugin.yaml) yields a second plugin with its own package
- a plugin.yaml whose module differs from the repository's module is rejected; an ID already owned by another repository is rejected on the newer repository
- a second ingest with unchanged ls-remote tags does not clone (tags_digest unchanged); a new tag triggers a clone
</behavior>
<action>
Per D-13..D-16. Add `List(ctx, db, q, category)` and `Versions(ctx, db, pluginID)` to registry/query.go returning kiosk wire types; `List`, `Versions` handlers; mount the group `/api/registry/v1` with `surf.Use("throttle:registry-api", "cors:registry")`, GET only, setting Cache-Control and a strong ETag computed from the response bytes (304 on If-None-Match). Add the `registry` profile under `http.cors_profiles` in ../sm-summercmsio-app/config/http.yaml (origins *, methods GET and HEAD, no credentials) and the matching profile in the test config. Ingest rules: compute a digest of `git ls-remote --tags -- <url>` output first and skip the clone when it equals tags_digest; process every strict tag; nested plugin.yaml files; module and ID rules from the behavior list; ingestion of one repository never aborts the others. Add `IngestAll(ctx)` over enabled repositories. Console command `summercms:registry-ingest [url]` (all enabled repositories, or the one matching url; prints one line per repository with versions added or the error) in console/registry.go with full bonfire docs; `Schedule()` returning `{Command: "summercms:registry-ingest", Cadence: pact.Every(time.Hour)}` in schedule.go, with HasSchedule and HasCommands asserted in plugin.go. Set `work_in_serve: true` in ../sm-summercmsio-app/config/queue.yaml and replace its comment (the site now runs the hourly registry ingest). Write the behavior subtests (`list`, `search`, `versions`, `headers`, `tags`, `nested`, `identity`, `unchanged`) in TestRegistrySmoke first, then implement. Document the API, the command and the schedule in the site plugin README. Commit as listed in Execution units.
</action>
<verify>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms test -run 'TestRegistrySmoke' -count=1 -v ./... 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -30</automated>
<fails_when>a "FAIL" line, "no tests to run", a "--- SKIP: TestRegistrySmoke" line, or no "--- PASS: TestRegistrySmoke/unchanged" line</fails_when>
<automated>go -C ../sm-summercmsio-app vet ./... && go -C ../sm-summercmsio-app test ./... 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "work_in_serve: true" ../sm-summercmsio-app/config/queue.yaml` prints one line
- `grep -n "registry:" ../sm-summercmsio-app/config/http.yaml` prints the CORS profile
- `grep -n "pact.Every(time.Hour)" ../sm-summercmsio-app/plugins/golem15/summercms/schedule.go` prints one line
- `grep -n "summercms:registry-ingest" ../sm-summercmsio-app/plugins/golem15/summercms/console/registry.go` prints at least one line
- every TestRegistrySmoke subtest listed in the behavior block passes
</acceptance_criteria>
<done>The registry API serves list, search, category, detail and versions publicly and stays fresh through an hourly ingest that only clones when tags change.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: Admin curation and presentation fields, the registry token scope and ingest-now, and the release-script hooks</name>
<files>../sm-summercmsio-app/plugins/golem15/summercms/admin.go, ../sm-summercmsio-app/plugins/golem15/summercms/admin_navigation.go, ../sm-summercmsio-app/plugins/golem15/summercms/admin_permissions.go, ../sm-summercmsio-app/plugins/golem15/summercms/token_scopes.go, ../sm-summercmsio-app/plugins/golem15/summercms/jobs.go, ../sm-summercmsio-app/plugins/golem15/summercms/lang.go, ../sm-summercmsio-app/plugins/golem15/summercms/lang/en/lang.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/lang/pl/lang.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories.go, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_list.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_form.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins.go, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_list.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_form.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/models/repository/columns.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/models/repository/fields.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin/columns.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin/fields.yaml, ../sm-summercmsio-app/plugins/golem15/summercms/models/plugin.go, ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/routes_registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/console/registry.go, ../sm-summercmsio-app/plugins/golem15/summercms/plugin.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry_smoke_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/README.md, ../sm-summercmsio-app/scripts/changelog-post.py, ../sm-summercmsio-app/scripts/test_changelog_post.py</files>
<read_first>
- ../sm-faq-plugin/admin.go, admin_navigation.go, admin_permissions.go, controllers/faqs.go, controllers/faqs/config_*.yaml, models/faq/*.yaml, lang/en/lang.yaml
- ../sm-journal-plugin/token_scopes.go, ../sm-journal-plugin/controllers/api/auth.go (~83-106), ../sm-journal-plugin/models/post.go (AttachRelations for icon and screenshots)
- modules/conga/README.md (Job, enqueue through conga.From(app))
- ../sm-summercmsio-app/scripts/changelog-post.py (cmd_publish ~262-300, call ~204, read_token ~236, is_framework ~103) and scripts/test_changelog_post.py
- ../sm-summercmsio-app/DEPLOY.md ("Posting to the changelog")
</read_first>
<behavior>
- POST /api/registry/v1/ingest without credentials answers 401; with a token lacking the `registry` scope or the permission answers 403; with a token scoped `registry` for a curated repository answers 202 with kiosk.IngestResponse and enqueues one ingest job; for an uncurated repository answers 404
- an https URL saved in the repositories admin form gets its module derived; a non-https URL or one with credentials, a query or a fragment is a validation error
- presentation fields (category from a fixed list, featured, sort_order, icon, screenshots with captions) saved in the admin appear in GET /plugins and /plugins/{id} as category, featured, icon_url and screenshots
- changelog-post.py: https_remote converts git@host:path.git and ssh://git@host/path.git to https://host/path.git; manifest_dirs finds the root and nested plugin.yaml directories; ingest outcome 202 is success and 401, 403, 404 and a network error are warnings that do not fail publish
</behavior>
<action>
Per D-13, D-14 and user decision 3. Site plugin: permissions `golem15.summercms.registry` (admin screens) and `golem15.summercms.registry_ingest` (endpoint), tab label from lang, roles granted none (superusers pass); navigation main item "Marketplace" with side items Repositories and Plugins; admin controllers `golem15.summercms.repositories` (list url, enabled, last_ingested_at, last_error; form url and enabled only) and `golem15.summercms.plugins` (list plugin_id, name, latest_version, category, featured, published; form: presentation fields editable — category dropdown with content, users, commerce, communication, seo, tools; featured switch; sort_order number; icon attachOne and screenshots attachMany with captions via lagoon/attach — and the facts shown read-only); `Plugin.AttachRelations` for icon and screenshots; query.go fills icon_url and screenshots from the attachments' public URLs. Token scope `registry` in token_scopes.go (Permissions `golem15.summercms.*`, Methods POST). Ingest job `conga.Job[IngestArgs]` in jobs.go (HasJobs) running Ingester.Repository; POST /api/registry/v1/ingest in its own group with `throttle:registry-ingest` and no public CORS, authorized with cabana.ResolveBackend plus cabana.Allows for `golem15.summercms.registry_ingest`, body kiosk.IngestRequest normalized like the admin form, curated and enabled repository required, enqueue through conga.From(app), answer 202 kiosk.IngestResponse. Console `summercms:registry-add <url>...` (same validation as the form) in console/registry.go. Lang strings en and pl. Write the endpoint and admin-save subtests (`ingest_auth`, `curation`, `presentation`) in TestRegistrySmoke first.
App script: add `REGISTRY_API` (env SUMMERCMS_REGISTRY_API, default SITE + "/api/registry/v1"), `REGISTRY_TOKEN_FILE` (~/.config/summercms/registry-token, falling back to the journal token), pure helpers `https_remote(url)`, `manifest_dirs(paths)`, `ingest_outcome(status)`; in cmd_publish for a plugin repository (not is_framework()): before posting, require HEAD to be exactly the tag (`git describe --exact-match`) and a clean worktree, list the repository's plugin.yaml files with `git ls-files`, refuse when none exists (hint: summer plugin:manifest) and run `summer plugin:manifest --check <dir>` for each (summer from PATH, else `go -C FRAMEWORK run ./cmd/summer`), refusing on failure; after a successful post call `call("POST", "/ingest", token, body, base=REGISTRY_API)` with the https remote and print a warning instead of failing on 401/403/404 or a network error ("the hourly ingest will pick it up"). The script never prints a token. Add unittest cases for the three helpers in scripts/test_changelog_post.py. Update the site plugin README (admin, scope, endpoint) and the "Posting to the changelog" part of DEPLOY.md is done in Task 4. Commit as listed in Execution units.
</action>
<verify>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms test -run 'TestRegistrySmoke/(ingest_auth|curation|presentation)' -count=1 -v ./... 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestRegistrySmoke/ingest_auth" line</fails_when>
<automated>cd ../sm-summercmsio-app && python3 -B scripts/test_changelog_post.py 2>&1 | tail -4</automated>
<fails_when>non-zero exit, or a "FAILED" or "Error" line in the summary</fails_when>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms vet ./... && go -C ../sm-summercmsio-app/plugins/golem15/summercms test -short ./... 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n 'Name: *"registry"' ../sm-summercmsio-app/plugins/golem15/summercms/token_scopes.go` prints one line
- `grep -n "golem15.summercms.registry_ingest" ../sm-summercmsio-app/plugins/golem15/summercms/admin_permissions.go ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go` prints at least two lines
- `grep -n "def https_remote\|def manifest_dirs\|def ingest_outcome" ../sm-summercmsio-app/scripts/changelog-post.py` prints three lines
- `grep -n "plugin:manifest" ../sm-summercmsio-app/scripts/changelog-post.py` prints at least one line
- `grep -n "print(.*token" ../sm-summercmsio-app/scripts/changelog-post.py` prints nothing new compared with the file before this task
</acceptance_criteria>
<done>Jakub curates and decorates the listing in the admin, a plugin release checks its manifest before posting and asks the registry to ingest at once, and a missing scope only delays ingestion to the next hour.</done>
</task>
<task type="auto">
<name>Task 4: /marketplace pages in the changelog SSR app, the landing link, deploy configuration and docs</name>
<files>../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/index.vue, ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/[vendor]/[name].vue, ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/composables/useRegistry.ts, ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/utils/marketplace.ts, ../sm-summercmsio-app/vue-summercmsio-app/changelog/nuxt.config.ts, ../sm-summercmsio-app/vue-summercmsio-app/changelog/i18n/locales/en.json, ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/marketplace-smoke.mjs, ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/expect-marketplace.txt, ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/plugins.json, ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/plugin-golem15.journal.json, ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/fixtures/registry/versions-golem15.journal.json, ../sm-summercmsio-app/vue-summercmsio-app/package.json, ../sm-summercmsio-app/vue-summercmsio-app/app/components/SiteHeader.vue, ../sm-summercmsio-app/vue-summercmsio-app/i18n/locales/en.json, ../sm-summercmsio-app/vue-summercmsio-app/README.md, ../sm-summercmsio-app/plugins/golem15/summercms/links_test.go, ../sm-summercmsio-app/deploy/nginx/summercms.io.conf, ../sm-summercmsio-app/deploy/supervisor/summercms-io-changelog.conf, ../sm-summercmsio-app/deploy/changelog.env.example, ../sm-summercmsio-app/scripts/smoke.sh, ../sm-summercmsio-app/DEPLOY.md, ../sm-summercmsio-app/README.md, ../sm-summercmsio-app/CLAUDE.md</files>
<read_first>
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/nuxt.config.ts (whole file), changelog/app/pages/changelog/plugins.vue and index.vue, changelog/app/components/ChangelogIndex.vue, changelog/app/utils/streams.ts
- ../sm-summercmsio-app/vue-summercmsio-app/node_modules/vue-journal-layer/testing/nuxt-server.mjs and smoke-ssr.mjs (startNuxtServer, parseExpectLine, X-Forwarded-For forwarding), and the layer's API client and HTML sanitizer used for post bodies
- ../sm-summercmsio-app/vue-summercmsio-app/app/components/SiteHeader.vue (current prop, changelog links)
- ../sm-summercmsio-app/plugins/golem15/summercms/links_test.go (nodePaths)
- ../sm-summercmsio-app/deploy/nginx/summercms.io.conf (the /changelog locations to mirror), deploy/supervisor/summercms-io-changelog.conf, scripts/check-deploy.sh, scripts/smoke.sh
- ../sm-summercmsio-app/DEPLOY.md, README.md, CLAUDE.md (cross-repo contracts)
</read_first>
<action>
Pages (layout and visuals are Claude's discretion per CONTEXT; follow the landing look through SiteHeader/SiteFooter and the changelog CSS):
- `useRegistry.ts`: server-side requests use `runtimeConfig.registry.apiBase` (`NUXT_REGISTRY_API_BASE`, default `${api}/api/registry/v1` like the journal base) and forward the visitor's X-Forwarded-For; browser requests use the same-origin path `/api/registry/v1`; add a nitro devProxy entry for `/api/registry`. Decode with TypeScript types mirroring kiosk's JSON field names.
- `utils/marketplace.ts`: `pluginPath(id)` (`/marketplace/<vendor>/<name>`), `idFromRoute(vendor, name)`, `installCommand(id)` (`summer plugin:install <id>`), validation of vendor/name segments (lower-case letters and digits).
- `pages/marketplace/index.vue`: list with a search box bound to `?q=`, category links bound to `?category=`, cards with icon, name, description, latest version and a featured mark; empty state; SEO title and description.
- `pages/marketplace/[vendor]/[name].vue`: name, description, install command with a copy button (clipboard with a fallback, as on the landing's terminal card), README HTML passed through the layer's sanitizer before v-html, screenshots, versions table (version, framework minimum, requires, date), repository link; unknown plugin → 404 page.
- nuxt.config.ts: runtimeConfig.registry.apiBase, routeRules `/marketplace` and `/marketplace/**` with swr 300; keep buildAssetsDir and the pages:extend hook working for the new pages.
- `testing/marketplace-smoke.mjs` plus `expect-marketplace.txt` and three fixture JSON files: start a node:http registry fixture serving the fixtures under /api/registry/v1 (404 envelope otherwise, recording X-Forwarded-For), start the built server with startNuxtServer and env NUXT_REGISTRY_API_BASE, check each line with parseExpectLine (list 200 contains Journal, ?q=journal, ?category=content, detail 200 contains `summer plugin:install golem15.journal`, unknown plugin 404, a README script tag absent), and require that a fixture request carried the visitor address. Script `"test:marketplace": "node changelog/testing/marketplace-smoke.mjs"` in package.json.
- SiteHeader.vue: a Marketplace link (plain anchor to /marketplace, `current === 'marketplace'` active) and its landing string in i18n/locales/en.json; add "/marketplace" to nodePaths in links_test.go.
App deploy: nginx `location = /marketplace` and `location ^~ /marketplace/` proxied to 127.0.0.1:3095 with GET/HEAD only like /changelog; `location = /api/registry/v1/ingest` proxied to 127.0.0.1:8095 with `limit_except POST { deny all; }`; supervisor env `NUXT_REGISTRY_API_BASE="http://127.0.0.1:8095/api/registry/v1"` and the same in changelog.env.example; scripts/smoke.sh additionally checks that GET /api/registry/v1/plugins answers 200 with a `data` array and that the changelog process answers /marketplace. DEPLOY.md: git required on rome (`command -v git` check), migrate creates the registry tables, `work_in_serve` now true, adding the launch repositories (the tagged sibling plugins: chat, faq, journal, menu, mfa, oauthserver, paymentgateway, paymentgatewaysubscriptions, pgstripe, seo, sitemap, sociallogin, translate, user — https URLs on git.golem15.com) through the admin over the SSH tunnel or `summercms:registry-add`, the registry token (scope `registry`, file ~/.config/summercms/registry-token; Jakub mints it), and the publish flow's new manifest check and ingest-now step. README.md and CLAUDE.md: the /marketplace prefix belongs to the Node app, the registry API and its shape are a contract with released summer binaries.
Commit as listed in Execution units (vue, then site links_test, then app).
</action>
<verify>
<automated>cd ../sm-summercmsio-app/vue-summercmsio-app && pnpm build:changelog >/dev/null 2>&1 && pnpm test:marketplace 2>&1 | tail -8</automated>
<fails_when>non-zero exit, or a line reporting a failed expectation, or no line reporting all checks passed</fails_when>
<automated>cd ../sm-summercmsio-app/vue-summercmsio-app && pnpm test:changelog 2>&1 | tail -4 && pnpm test 2>&1 | tail -4</automated>
<fails_when>non-zero exit or a "not ok" line</fails_when>
<automated>cd ../sm-summercmsio-app && scripts/check-deploy.sh 2>&1 | tail -4</automated>
<fails_when>non-zero exit or an nginx "emerg" line</fails_when>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms test -short -run 'TestLanding|TestRoutes' ./... 2>&1 | tail -3</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n '"/marketplace"' ../sm-summercmsio-app/plugins/golem15/summercms/links_test.go` prints one line
- `grep -n "location ^~ /marketplace/\|location = /api/registry/v1/ingest" ../sm-summercmsio-app/deploy/nginx/summercms.io.conf` prints two lines
- `grep -n "NUXT_REGISTRY_API_BASE" ../sm-summercmsio-app/deploy/supervisor/summercms-io-changelog.conf` prints one line
- `grep -n "command -v git" ../sm-summercmsio-app/DEPLOY.md` prints at least one line, and DEPLOY.md names the fourteen launch repositories
- `grep -n "test:marketplace" ../sm-summercmsio-app/vue-summercmsio-app/package.json` prints one line
</acceptance_criteria>
<done>summercms.io/marketplace renders list, search, category and detail pages from the registry, the landing links to it, and the deploy is described and validated.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| public internet → GET /api/registry/v1 | anonymous, cross-origin readers |
| release script (token) → POST /api/registry/v1/ingest | authenticated, scoped |
| curated git repository → ingester | repository content controlled by the plugin's maintainers |
| ingested README → marketplace HTML | third-party markdown rendered on summercms.io |
| summercms.io admin → presentation fields and repository URLs | trusted administrators behind the SSH tunnel |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-11 | Elevation of privilege | git invocation with repository URLs | high | mitigate | exec without shell, `--` before URLs, GIT_ALLOW_PROTOCOL=https (file only in tests), no system/global git config, no prompt; https-only URLs validated at curation |
| T-34-12 | Denial of service | malicious repository content | high | mitigate | bare partial clone, no checkout/submodules/hooks, io.LimitReader caps (64 KiB plugin.yaml, 512 KiB README), per-command context timeouts, temp dir always removed |
| T-34-13 | Tampering (XSS) | README rendered on /marketplace | high | mitigate | breakwater.Render at ingest (raw HTML stripped, http/https/mailto links only, nofollow) and the layer's sanitizer again before v-html; smoke asserts no script tag |
| T-34-14 | Spoofing | repository claiming another plugin's ID or module | high | mitigate | admin-curated repositories only; module must equal the repository path; ID owned by the first-listed repository; TestRegistrySmoke/identity |
| T-34-15 | Elevation of privilege | POST /api/registry/v1/ingest | high | mitigate | cabana.ResolveBackend plus golem15.summercms.registry_ingest via the `registry` token scope (POST only); unknown repositories 404 (no listing creation); nginx allows POST only on that exact path |
| T-34-16 | Denial of service | ingest-now flooding | medium | mitigate | throttle:registry-ingest bucket, one queued job per repository, ls-remote digest check before cloning |
| T-34-17 | Information disclosure | open CORS on the registry API | low | mitigate | only public listing data; GET/HEAD only; no credentials; no admin fields (last_error, enabled) in the API |
| T-34-18 | Denial of service | public API abuse | medium | mitigate | throttle:registry-api, Cache-Control plus ETag/304, q length cap and category regex, LIKE wildcards escaped |
| T-34-19 | Information disclosure | release script token handling | medium | mitigate | token read from a mode-600 file, never printed; the agent never mints or copies tokens; failures report status only |
| T-34-20 | Tampering | stale manifest in a published tag | medium | mitigate | changelog-post.py refuses unless HEAD is the tag, the tree is clean and `summer plugin:manifest --check` passes for every plugin.yaml |
| T-34-21 | Denial of service | jobs never run in production | medium | mitigate | queue.work_in_serve true; DEPLOY.md checks git and the schedule; smoke checks the API |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | no package is added (Go modules already required; no new npm dependency) |
</threat_model>
<verification>
- Site plugin: `go vet ./...`, `go test -short ./...`, and `go test -run TestRegistrySmoke ./...` with Docker.
- App: `go vet ./... && go test ./...`, `python3 -B scripts/test_changelog_post.py`, `scripts/check-deploy.sh`.
- Vue: `pnpm build:changelog`, `pnpm test:changelog`, `pnpm test:marketplace`, `pnpm test`.
- Manual (34-VALIDATION.md): production ingest after deploy and the visual check of /marketplace.
</verification>
<success_criteria>
- The registry ingests curated repositories hourly and on demand and serves the frozen v1 API.
- /marketplace renders list, search, category and detail pages.
- Presentation fields are edited in the admin.
- The release script checks manifests and triggers ingestion; nothing pushed, tagged or deployed.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-03-SUMMARY.md` when done, including the pending submodule SHAs (site plugin, vue app) for the release ledger.
</output>
## Artifacts this phase produces
- Tables: `golem15_summercms_registry_repositories`, `golem15_summercms_registry_plugins`, `golem15_summercms_registry_versions` (migration `202610300001_create_golem15_summercms_registry`).
- Site plugin Go: models `Repository`, `Plugin`, `Version`; package `registry` with `Ingester`, `Ingester.Repository`, `Ingester.IngestAll` (or `IngestAll`), `List`, `Detail`, `Versions`, `allowedProtocols`; handlers in `controllers/api/registry.go`; `registerRegistryRoutes`; `IngestArgs` job.
- Endpoints: `GET /api/registry/v1/plugins`, `GET /api/registry/v1/plugins/{id}`, `GET /api/registry/v1/plugins/{id}/versions`, `POST /api/registry/v1/ingest`.
- Admin controllers: `golem15.summercms.repositories`, `golem15.summercms.plugins`; navigation "Marketplace".
- Permissions: `golem15.summercms.registry`, `golem15.summercms.registry_ingest`. Token scope: `registry`.
- Console commands: `summercms:registry-ingest [url]`, `summercms:registry-add <url>...`; schedule hourly.
- Throttle buckets: `registry-api`, `registry-ingest`. CORS profile: `http.cors_profiles.registry`.
- Config: `queue.work_in_serve: true`; env `NUXT_REGISTRY_API_BASE`, `SUMMERCMS_REGISTRY_API`; token file `~/.config/summercms/registry-token`.
- Script helpers: `https_remote`, `manifest_dirs`, `ingest_outcome`, `REGISTRY_API`, `REGISTRY_TOKEN_FILE`.
- Pages: `/marketplace`, `/marketplace/<vendor>/<name>`; composable `useRegistry`; utils `pluginPath`, `idFromRoute`, `installCommand`; script `test:marketplace`.
- Tests: `TestRegistrySmoke` (subtests detail, list, search, versions, headers, tags, nested, identity, unchanged, ingest_auth, curation, presentation), marketplace SSR smoke, changelog-post unittest cases.

View File

@@ -0,0 +1,298 @@
---
phase: 34-plugin-marketplace
plan: 03
subsystem: registry
tags: [registry, kiosk, ingester, git, marketplace, nuxt-ssr, cabana-admin, token-scope, river, nginx, changelog-post]
requires:
- phase: 34-plugin-marketplace (34-01)
provides: "kiosk.Parse/Validate/Marshal, ValidVersion/CompareVersions, registry v1 wire types (ListResponse, DetailResponse, VersionsResponse, ErrorResponse, IngestRequest/IngestResponse/IngestResult, RegistryError* codes, RegistryAPIPath), summer plugin:manifest --check"
provides:
- "Site plugin golem15.summercms: registry tables, models Repository/Plugin/Version, pull ingester (registry.Ingester.Repository, IngestAll), public API GET /api/registry/v1/plugins, /plugins/{id}, /plugins/{id}/versions"
- "POST /api/registry/v1/ingest (token scope registry, permission golem15.summercms.registry_ingest, unique River job registry.IngestArgs)"
- "Marketplace admin: Repositories and Plugins screens, permissions golem15.summercms.registry and registry_ingest"
- "Console summercms:registry-ingest [url] [--force] (scheduled hourly) and summercms:registry-add <url>..."
- "/marketplace and /marketplace/<vendor>/<name> in the changelog Node SSR app (useRegistry, utils/marketplace.ts), header and footer links"
- "changelog-post.py: plugin manifest check before posting, ingest-now after posting (https_remote, manifest_dirs, ingest_outcome)"
- "Deploy: nginx /marketplace and ingest locations, NUXT_REGISTRY_API_BASE, queue.work_in_serve true, cors profile registry, upload limit 4 MiB, DEPLOY.md marketplace release"
affects: [34-04 install CLI (consumes /api/registry/v1), 34-05 admin Plugins screen (consumes the API), 34-06 tests and release ledger, sm-summercmsio-app deploy]
actuals:
tokens: 59000
tasks: 4
commits: 10
plan_head_before: 69c1fea766bdde7fd38d73967a1dff70d69f21d5
plan_head_after: 69c1fea766bdde7fd38d73967a1dff70d69f21d5
repo_heads:
sm-summercmsio-plugin: { before: ca5941540c456cd850cf3b2f50e1d3c2e3ab6ee5, after: 5853cf5be0bb681a8751a75c65bcaa90a3b19740, commits: 4 }
vue-summercmsio-app: { before: b3bfc5da80d020d318e8d6d4b3b60a45c1d84f42, after: 05f1cea5ac73ac45e632703a5e406012ac426bd2, commits: 1 }
sm-summercmsio-app: { before: b688a80e6b4f59fda13bf01e7bfabc0ebd6884f6, after: 97c0c08, commits: 5 }
tech-stack:
added: []
patterns:
- "Hardened git via exec: no shell, -- before URLs, throwaway HOME, GIT_ALLOW_PROTOCOL allow-list, no system/global config, capped reads through readLimited"
- "Cheap change detection: digest of ls-remote strict tags + peeled commits, compared with the stored tags_digest before cloning"
- "Per-repository pg_advisory_xact_lock around one write transaction"
- "River unique job by args (JobArgsWithInsertOpts) for idempotent ingest-now"
- "Public JSON with strong ETag from the body bytes, 304 on If-None-Match, Cache-Control public max-age=300"
- "Facts on the cabana preview screen (context: preview), presentation fields on the update form, Fillable restricted to presentation"
key-files:
created:
- ../sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/models/{registry,repository,plugin,version}.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/{git,ingest,query}.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/controllers/{repositories,plugins}.go (+ config_list/config_form YAML)
- ../sm-summercmsio-app/plugins/golem15/summercms/models/{repository,plugin}/{columns,fields}.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/console/registry.go
- ../sm-summercmsio-app/plugins/golem15/summercms/{routes_registry,schedule,jobs,token_scopes,admin,admin_navigation,admin_permissions,lang}.go
- ../sm-summercmsio-app/plugins/golem15/summercms/lang/{en,pl}/lang.yaml
- ../sm-summercmsio-app/plugins/golem15/summercms/{testmain_test,registry_smoke_test}.go
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/index.vue
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/[vendor]/[name].vue
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/composables/useRegistry.ts
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/utils/marketplace.ts
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/testing/{marketplace-smoke.mjs,expect-marketplace.txt,fixtures/registry/*.json}
- ../sm-summercmsio-app/vue-summercmsio-app/tests/marketplace.test.ts
modified:
- ../sm-summercmsio-app/plugins/golem15/summercms/{plugin.go,go.mod,go.sum,README.md,routes_test.go,links_test.go}
- ../sm-summercmsio-app/vue-summercmsio-app/{package.json,README.md,nuxt.config.ts,app/components/SiteHeader.vue,app/components/SiteFooter.vue,i18n/locales/en.json}
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/{nuxt.config.ts,i18n/locales/en.json,app/layouts/default.vue,app/error.vue}
- ../sm-summercmsio-app/{config/queue.yaml,config/http.yaml,go.mod,deploy/nginx/summercms.io.conf,deploy/supervisor/summercms-io-changelog.conf,deploy/changelog.env.example,scripts/changelog-post.py,scripts/test_changelog_post.py,scripts/smoke.sh,DEPLOY.md,README.md,CLAUDE.md}
key-decisions:
- "Registry API bodies are only kiosk wire types; updated_at is the latest tag's date (falls back to the row's update time); errors carry no-cache so a fresh listing is never hidden behind a cached 404"
- "Ingester.Repository returns (Result, error) instead of error, so the console and IngestAll can report versions added, unchanged and notes; Ingester.Force re-reads unchanged repositories (summercms:registry-ingest --force)"
- "Identity at ingest: module must equal the repository's module, package must equal module + directory, the first repository listing an ID owns it; a plugin no tag publishes any more is unpublished"
- "Ingest-now answers 400 invalid_request for a non-https URL and 401/403 with codes unauthenticated/forbidden (outside kiosk's two public codes; the endpoint is authenticated and only changelog-post.py calls it)"
- "Repeated ingest-now requests keep one queued job: IngestArgs implements River InsertOpts with UniqueOpts ByArgs over available/pending/running/retryable/scheduled"
- "The registry token scope declares GET, HEAD and POST: the framework requires GET in every scope (the plan said POST only)"
- "App go.mod now requires summercms v0.6.0 like the site plugin: the workspace already resolved v0.6.0, so the landing version check failed in scripts/build.sh dev without it"
- "Marketplace pages keep only the sanitized README HTML in the payload (no markdown source) and use plain GET forms and anchors, so they work without JavaScript"
patterns-established:
- "Site-plugin registry as the producer of the kiosk v1 contract; the Nuxt pages and the summer CLI consume it"
requirements-completed: [SC-2, D-04, D-13, D-14, D-15, D-16]
coverage:
- id: D1
description: "A curated repository with a tagged plugin.yaml is cloned (hardened git, bare partial clone), parsed through kiosk and served at GET /api/registry/v1/plugins/{id} with a breakwater-sanitized README"
requirement: D-13
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/detail"
status: pass
human_judgment: false
- id: D2
description: "List, search (escaped, capped), category filter and versions newest first, with open CORS, Cache-Control, ETag and 304"
requirement: D-16
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/list,search,versions,headers"
status: pass
human_judgment: false
- id: D3
description: "Every vX.Y.Z tag is a version row; tags without a valid plugin.yaml are skipped and noted; nested plugin.yaml files; module and ID identity rules"
requirement: D-14
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/tags,nested,identity"
status: pass
human_judgment: false
- id: D4
description: "Hourly scheduled ingest that skips the clone when the ls-remote tag digest is unchanged; IngestAll survives a failing repository"
requirement: D-15
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/unchanged"
status: pass
human_judgment: false
- id: D5
description: "Ingest-now endpoint: 401 anonymous, 403 wrong scope or missing permission, 202 with one unique queued job, 404 uncurated or disabled, 400 non-https"
requirement: D-13
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/ingest_auth"
status: pass
human_judgment: false
- id: D6
description: "Admin curation (URL rules, derived module, duplicates, registry-add command) and presentation fields (category, featured, sort order, icon, screenshots) appear in the API; facts read-only"
requirement: SC-2
verification:
- kind: integration
ref: "plugins/golem15/summercms/registry_smoke_test.go#TestRegistrySmoke/curation,presentation"
status: pass
human_judgment: false
- id: D7
description: "changelog-post.py refuses a plugin release that is not exactly the tag, is dirty or has a stale plugin.yaml, and asks the registry to ingest after posting (401/403/404/network are warnings)"
requirement: D-04
verification:
- kind: unit
ref: "python3 -B scripts/test_changelog_post.py (HttpsRemoteTest, ManifestDirsTest, IngestOutcomeTest, RegistrySettingsTest)"
status: pass
- kind: other
ref: "check_plugin_release on a fixture repo from modules/kiosk/testdata/literal: passes at v0.1.0, refuses a drifted plugin.yaml at v0.1.1"
status: pass
human_judgment: false
- id: D8
description: "/marketplace list, search, category and detail pages rendered by the changelog Node SSR app from the registry API"
requirement: SC-2
verification:
- kind: automated_ui
ref: "pnpm test:marketplace (changelog/testing/marketplace-smoke.mjs, 30 checks)"
status: pass
- kind: unit
ref: "pnpm test (tests/marketplace.test.ts)"
status: pass
- kind: integration
ref: "scripts/build.sh dev && scripts/smoke.sh (registry API on the real binary, /marketplace on Node against it)"
status: pass
human_judgment: true
rationale: "Layout and visuals of the marketplace pages are Claude's discretion per CONTEXT; the visual check of /marketplace is a manual item in 34-VALIDATION.md"
- id: D9
description: "Deploy: nginx locations, supervisor env, jobs in serve, CORS profile, DEPLOY.md marketplace release; production ingest after deploy"
verification:
- kind: other
ref: "scripts/check-deploy.sh"
status: pass
human_judgment: true
rationale: "Production ingest of the launch repositories happens only after the user-gated deploy (nothing was deployed)"
duration: 51min
completed: 2026-10-29
status: complete
---
# Phase 34 Plan 03: summercms.io plugin registry and /marketplace Summary
**The site plugin ingests curated plugin repositories over hardened anonymous git into Postgres and serves them through the frozen kiosk v1 API at /api/registry/v1. It adds an admin for curation and presentation, a `registry`-scoped ingest-now endpoint and an hourly schedule. The changelog Node SSR app renders /marketplace from that API, and changelog-post.py checks plugin manifests before posting and asks the registry to ingest afterwards.**
## Performance
- **Duration:** about 51 min
- **Started:** 2026-10-29T16:17:50Z
- **Completed:** 2026-10-29T17:09:20Z
- **Tasks:** 4 of 4
- **Files modified:** 70 across three repositories (38 site plugin, 20 vue app, 12 app)
## Accomplishments
- **Registry tables and ingester.** The three registry tables come from migration `202610300001_create_golem15_summercms_registry`. `registry.Ingester` makes a bare partial clone (`--filter=blob:none`, retried without the filter), lists strict tags with peeled commits and reads each tag's `plugin.yaml` files (64 KiB cap, `kiosk.Parse`/`Validate`). It checks identity: the module must equal the repository's module, the package must match its directory, and the first repository owns an ID. It reads the newest tag's README (512 KiB cap, `breakwater.Render`) and writes everything in one transaction under a per-repository advisory lock.
- **Public API.** `GET /plugins`, `/plugins/{id}` and `/plugins/{id}/versions` return only kiosk wire types. Every response has open CORS through the `registry` profile, `throttle:registry-api` (300/min per IP), `Cache-Control: public, max-age=300` and a strong ETag with 304. `q` is escaped and capped at 100 characters, and `category` is checked against `^[a-z0-9-]{1,40}$`.
- **Change detection.** An `ls-remote` tag digest skips the clone when the tags have not changed. `IngestAll` keeps going when one repository fails. `summercms:registry-ingest [url] [--force]` runs hourly through `pact.HasSchedule`, and the app now sets `queue.work_in_serve: true` so the worker runs.
- **Admin.** A Marketplace main item has two screens. Repositories edits the URL and the enabled switch, with the same rules as `summercms:registry-add`. Plugins shows the facts read-only on the preview screen and lets you edit category, featured, sort order, icon and screenshots with captions. The icon and screenshots reach the API as absolute URLs on `app.url`.
- **Ingest now.** `POST /api/registry/v1/ingest` needs a backend principal holding `golem15.summercms.registry_ingest` (a token scoped `registry`). It only queues repositories that are curated and enabled, and keeps one unique River job per repository.
- **Marketplace pages.** `/marketplace` is a list with a GET search form and category links. `/marketplace/<vendor>/<name>` shows the install command with a copy button, the README (sanitized again), screenshots and a versions table. The header and footer link to the marketplace, the layout and error page know about it, and the landing prerender ignores `/marketplace`.
- **Release script.** `changelog-post.py publish --repo` requires that HEAD is the tag, the worktree is clean, and `summer plugin:manifest --check` passes for every committed `plugin.yaml`. After posting it sends `POST /ingest` with the registry token, and a refusal is only a warning.
- **Deploy.** nginx sends `/marketplace` to Node and allows POST only on the ingest path. The supervisor program gets `NUXT_REGISTRY_API_BASE`. `smoke.sh` now checks the registry and the marketplace. DEPLOY.md has a "Plugin marketplace" section with git on rome, the fourteen launch repositories and the registry token.
## Task Commits
**sm-summercmsio-plugin** (`plugins/golem15/summercms`, branch master):
1. Task 1: `242d641` feat: plugin registry tables, ingester and plugin detail API
2. Task 2: `f6a5949` feat: registry list, search and versions API, hourly ingest
3. Task 3: `08e04de` feat: registry admin, token scope and ingest-now endpoint
4. Task 4: `5853cf5` feat: marketplace link
**vue-summercmsio-app** (branch master):
5. Task 4: `05f1cea` feat: marketplace pages
**sm-summercmsio-app** (branch master):
6. Task 2: `458a4f1` feat: registry CORS profile and jobs in serve
7. Task 3: `06593c3` feat: manifest check and ingest-now in changelog-post
8. Task 3: `0707fdc` feat: upload limit for the marketplace admin (deviation 3)
9. Task 4: `fd8fe3b` feat: marketplace deploy config and docs
10. Task 4: `97c0c08` chore: require summercms v0.6.0 (deviation 4)
**Plan metadata:** the summercms.go docs commit containing this SUMMARY.
**Pending submodule pointers (release ledger, not committed in the app; gitlinks left modified):**
- `plugins/golem15/summercms` → `5853cf5be0bb681a8751a75c65bcaa90a3b19740` (recorded in the app: `ca59415`)
- `vue-summercmsio-app` → `05f1cea5ac73ac45e632703a5e406012ac426bd2` (recorded in the app: `b3bfc5d`)
Nothing was pushed, tagged or deployed.
## Files Created/Modified
- Site plugin: the `updates/`, `models/`, `registry/`, `controllers/`, `console/` and `lang/` packages and files listed in key-files; `plugin.go` (Register/Boot keep the app, migrations, models); `routes_registry.go` (API groups and throttle buckets); `schedule.go`, `jobs.go`, `token_scopes.go` and the `admin*.go` files; tests `testmain_test.go` (testcontainers Postgres) and `registry_smoke_test.go` (12 subtests); `routes_test.go` and `links_test.go` adjusted; README "Plugin registry" section.
- vue app: the marketplace pages, `useRegistry.ts`, `utils/marketplace.ts`, the SSR smoke and fixtures, `tests/marketplace.test.ts`; config, header, footer, layout, error page and strings.
- App: `config/http.yaml` (cors profile, upload limit), `config/queue.yaml`, `go.mod`, the deploy files, `scripts/changelog-post.py` and its tests, `scripts/smoke.sh`, DEPLOY.md, README.md, CLAUDE.md.
## Decisions Made
See key-decisions in the frontmatter. In addition:
- `Repository.BeforeSave` derives the module only from an https URL. The admin form, `registry-add` and the ingest endpoint all validate through `models.CheckRepository`. Test fixtures insert `file://` repositories with an explicit module. `registry.SetAllowedProtocolsForTest` (exported, test-only) widens the protocol allow-list to `https:file`.
- The plugin rows have no create and no delete in the admin; the ingester alone creates and withdraws them. Removing a repository cascades to its plugins.
- Categories: `content`, `users`, `commerce`, `communication`, `seo`, `tools`. They are checked in `FormBeforeUpdate` and are a contract with `utils/marketplace.ts`.
- The USER-SETUP content stays in this SUMMARY ("User Setup Required" below) instead of a separate `34-USER-SETUP.md`, so this plan does not collide with sibling plans of the same wave.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Site tests needed config once the plugin has a CORS profile and admin screens**
- **Found during:** Tasks 2 and 3
- **Issue:** `cors:registry` and the admin made `surf.Assemble(backpack.New(nil), …)` fail to boot in routes_test/links_test (unknown CORS profile, empty admin JWT secret, upload limit). `/backend` is now the admin's, not the site 404.
- **Fix:** A `siteApp(t)` helper supplies body limits, the CORS profile and a JWT secret. The route-pattern test allows surf's OPTIONS preflight routes and the admin's own routes. TestPluginIdentity now asserts that the plugin has admin controllers, and the `/backend` expectation became `GET /backend/api/v1/auth/me` 401.
- **Commits:** f6a5949, 08e04de
**2. [Rule 1 - Bug] cabana requires `Rules()` on every editable model**
- **Found during:** Task 3 (every Plugins show/update answered an opaque 500)
- **Fix:** Added `models.Plugin.Rules()`. The cause was traced with a `go build -overlay` print in cabana's error writer; the framework was not modified.
- **Commit:** 08e04de
**3. [Rule 3 - Blocking] App upload limit too small for the admin's image fields**
- **Issue:** cabana refuses to boot when `maxFilesize` plus multipart framing exceeds `http.body_limits.upload_bytes` (1 MiB in production config).
- **Fix:** `upload_bytes: 4194304` in config/http.yaml. Without it the binary would not start.
- **Commit:** 0707fdc (separate app commit)
**4. [Rule 3 - Blocking] App go.mod framework requirement**
- **Issue:** The site plugin requires v0.6.0, so the workspace resolves v0.6.0, while the app's go.mod said v0.5.0. As a result `scripts/build.sh dev` failed `TestLandingVersion` (the page showed 0.6, go.mod said 0.5).
- **Fix:** `go mod edit -require=…summercms@v0.6.0` only. A full `go mod tidy` would also have dropped indirect requirements based on the framework working tree, so it was not committed.
- **Commit:** 97c0c08
**5. [Rule 2 - Missing critical] Extra protections and files beyond the plan's list**
- Package path must equal module + directory at ingest. More than 20 plugin.yaml files per tag are not read. A plugin no longer published by any tag is unpublished. The ingest body is capped at 4 KiB, and nginx sets `client_max_body_size 8k` on the ingest path.
- The detail page payload carries only sanitized README HTML; `readme_markdown` is dropped.
- Extra files: `tests/marketplace.test.ts`, `SiteFooter.vue` (Marketplace link; the header link hides below 480px), the landing `nuxt.config.ts` (prerender/linkChecker ignore `/marketplace`; `nuxt generate` failed without it), the changelog `layouts/default.vue` and `error.vue` (active menu entry, marketplace 404 text).
**6. [Plan text vs framework] Token scope methods**
- The plan said Methods POST. cabana's scope validation requires GET, so the scope declares GET, HEAD and POST.
**7. [Plan text vs layer] parseExpectLine**
- `smoke-ssr.mjs` runs its `main()` when imported, so `marketplace-smoke.mjs` repeats its expectation parser (same grammar) instead of importing it.
**8. [Process] TDD**
- Tasks 2 and 3 wrote their subtests first and saw assertion-level RED: 404s from missing routes, and 405s from the admin/ingest routes. Stubs were added only so the code compiled. `msd_run check tdd-red-evidence` parses TAP/Surefire output, not `go test -v`, so the RED evidence is recorded here rather than machine-checked. One commit per task per repository, following the plan's Execution units table.
**Total deviations:** 8 (1 Rule 1, 3 Rule 3, 1 Rule 2, 3 plan/process notes). **Impact:** no change to the v1 contract. The extra commits are needed for boot and for the build.
## Issues Encountered
- `grep -n "location ^~ /marketplace/\|location = /api/registry/v1/ingest"` (the plan's acceptance command) prints only the second line under GNU grep because of how it parses `^~` inside the alternation. `grep -nF -e … -e …` prints both lines (143 and 162). The file is correct.
- `scripts/build.sh dev` regenerates `main.go` and `plugins.gen.go` (34-01's PluginInfo/FrameworkVersion). They were restored to the committed versions, and regenerating them belongs to the release bump.
## User Setup Required
Before the deploy that ships the registry (nothing was deployed):
1. **Release ledger:** push `sm-summercmsio-plugin` (`5853cf5`) and `vue-summercmsio-app` (`05f1cea`), then commit the two gitlink bumps in sm-summercmsio-app. Tag framework `v0.6.0` (34-06) so the release build finds it. Regenerate and commit `main.go`/`plugins.gen.go` with that bump.
2. **git on rome:** run `ssh rome 'command -v git && git --version'` (DEPLOY.md "Plugin marketplace", step 2).
3. **Reinstall nginx and the changelog supervisor file** from the repository, then run `migrate` (registry and queue tables). `work_in_serve` is now true.
4. **Registry token (only you mint it):** `admin:token:create <you> --name registry --scope registry`, stored in `~/.config/summercms/registry-token` (mode 600). Until then the ingest-now call gets 403, which is only a warning, and the hourly run picks the tag up.
5. **Curate the fourteen launch repositories** (DEPLOY.md lists them) once their first `plugin.yaml` tags exist (34-02, user-gated), with `summercms:registry-add …` then `summercms:registry-ingest`, or in the admin over the tunnel.
6. **Manual checks (34-VALIDATION.md):** run a production ingest after the deploy and look over /marketplace visually.
## Next Phase Readiness
- 34-04 (install CLI) and 34-05 (admin Plugins screen) can call `GET /api/registry/v1/...` locally by running the app (`scripts/build.sh dev`, then `bin/summercms-io serve`) with a curated `file://` or https repository.
- The registry answers with exactly the kiosk wire types, so any change to the v1 shape must start in `modules/kiosk/registry.go` and stay additive.
## Self-Check: PASSED
- Key files exist: registry/ingest.go (contains `breakwater.Render`, `kiosk.Parse(`, `io.LimitReader`), controllers/api/registry.go (`kiosk.ListResponse`, `kiosk.DetailResponse`), the migration (`golem15_summercms_registry_versions` in create and drop), registry_smoke_test.go (`func TestRegistrySmoke(`), pages/marketplace/index.vue (`plugin:install`), changelog-post.py (`api/registry/v1/ingest`).
- Commits found: site 242d641, f6a5949, 08e04de, 5853cf5; vue 05f1cea; app 458a4f1, 06593c3, 0707fdc, fd8fe3b, 97c0c08.
- Verification: TestRegistrySmoke 12/12 PASS (Docker); site `go vet` and `go test -short` ok; app `go vet` and `go test` ok; `test_changelog_post.py` OK (36 tests); `check-deploy.sh` ok; `pnpm test:marketplace` ok (30 checks); `pnpm test:changelog` ok (77 checks); `pnpm test` 77 pass; `scripts/build.sh dev` and `scripts/smoke.sh` ok; framework `go vet ./...` and `go test -short ./...` green.
- Acceptance greps: every Task 1-4 criterion passes. Two notes: the GIT_* grep prints exactly 3 lines, and the nginx alternation grep is explained under Issues Encountered.

View File

@@ -0,0 +1,309 @@
---
phase: 34-plugin-marketplace
plan: 04
type: execute
wave: 2
depends_on: ["34-01"]
coupling_justified: ["34-03: same wave; 34-04 adds the new file modules/kiosk/client.go and edits internal/build and cmd/summer, while 34-03 compiles only the kiosk package from this checkout (through its go.work replace); the addition is one new file and every 34-04 commit compiles, so either order gives a correct result"]
files_modified:
- modules/kiosk/client.go
- modules/kiosk/README.md
- internal/build/install.go
- internal/build/source.go
- internal/build/update.go
- internal/build/manifest.go
- internal/build/scaffold.go
- internal/build/install_smoke_test.go
- internal/build/fixtures_test.go
- cmd/summer/main.go
- docs/plugins/marketplace.md
- docs/console/scaffolding.md
- docs/architecture/go-modules-and-workspaces.md
- .planning/research/questions.md
autonomous: true
requirements: [SC-3, D-08, D-09, D-10, D-11, D-12, D-18]
estimate:
tokens: 160000
raw_tokens: 160000
tasks: 4
confidence: low
must_haves:
truths:
- "`summer plugin:install golem15.<name>` asks the registry for the plugin's versions, picks the newest tag whose framework minimum the app's effective framework version satisfies, installs it as a Go module with `go get`, and registers it in summer.yaml; `@vX.Y.Z` pins a version; when only tags needing a newer framework exist it fails and names the framework version to move to, without bumping the framework (D-08, SC-3)"
- "Missing required plugins are resolved transitively against the registry, the full list of additions (id@version and mode) is printed and confirmed; `--yes` skips the prompt, a non-interactive run without `--yes` is an error naming `--yes`, and an installed dependency older than its minimum is an error naming `summer plugin:update <id>` (D-09, research F4)"
- "`--source` installs the plugin and its dependencies as git submodules under plugins/<vendor>/<name> at the chosen tag, registered like plugin:add with the tag as the require version, plus go.work replace overrides for every local replace in the plugin's go.mod so the app builds (D-09, research F2)"
- "`summer plugin:install <git-url>` never sends the plugin's repository to the registry: it clones over https or ssh, reads plugin.yaml at the newest tag whose framework minimum is satisfied, installs a submodule only, and resolves the plugin's required IDs through the registry; `--offline` makes no registry call and then requires those dependencies to be installed already (D-11, D-12)"
- "`summer plugin:update [id]` moves module installs to the newest compatible tag with `go get` and checks submodule installs out at the newest compatible tag; without an ID it updates every plugin it can resolve and reports the ones it skipped (D-10)"
- "The CLI reads `plugins.registry_url` from the app's config (default https://summercms.io, `SUMMER_PLUGINS__REGISTRY_URL` overrides, an explicitly empty value disables registry calls) and calls the registry through kiosk.Client over fetchguard with a timeout, a size cap and no redirects (D-18)"
- "Editing summer.yaml keeps its comments and blank lines (plugin:add and plugin:install both append entries in place; user decision 5)"
- "`--source` or a git URL in an app directory that is not a git repository refuses with a message saying a submodule needs a git repository (user decision 5)"
- "Registry-provided module paths, repository URLs and versions are validated before any go or git call (strict vX.Y.Z, no leading \"-\", https repository URLs)"
artifacts:
- path: "modules/kiosk/client.go"
provides: "registry HTTP client and plugins.registry_url"
contains: "func RegistryURL("
- path: "internal/build/install.go"
provides: "resolution and module installs"
contains: "func PlanInstall("
- path: "internal/build/source.go"
provides: "submodule and git-URL installs, go.work overrides"
contains: "work\", \"edit\""
- path: "internal/build/update.go"
provides: "plugin:update"
contains: "func Update("
- path: "internal/build/install_smoke_test.go"
provides: "TestInstallSmoke (tracer)"
contains: "func TestInstallSmoke("
key_links:
- from: "cmd/summer/main.go"
to: "internal/build/install.go"
via: "plugin:install builds InstallOptions and calls build.PlanInstall then build.ApplyInstall"
pattern: "build\\.(PlanInstall|ApplyInstall)\\("
- from: "internal/build/install.go"
to: "modules/kiosk/client.go"
via: "versions come from kiosk.Client.Versions and the choice from kiosk.NewestCompatible against build.EffectiveFramework"
pattern: "NewestCompatible"
---
## Phase Goal
People add a marketplace plugin to their application with a single command, `summer plugin:install <id>`, and install private plugins from a git URL without contacting summercms.io. This plan builds that command and its companion `summer plugin:update`.
<objective>
Add `summer plugin:install <id[@version]|git-url> [--source] [--yes] [--offline]` and `summer plugin:update [id] [--yes] [--offline]` (D-08..D-12), the registry client and the `plugins.registry_url` setting in kiosk (D-18), comment-preserving summer.yaml edits, and go.work overrides for submodule installs (research F2). Close the `--module` research question as "not in v1" (D-11).
Purpose: SC-3; the same client and setting serve the admin screen in 34-05.
Output: commits in this repository (code with its docs; the research-question update as a separate planning-docs commit). Nothing pushed or tagged.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-CONTEXT.md
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-PATTERNS.md
@.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md
@.planning/notes/2026-10-29-plugin-marketplace.md
@CLAUDE.md
<interfaces>
From 34-01 (names as adjusted in its SUMMARY): kiosk wire types and RegistryAPIPath; kiosk.Parse, kiosk.Validate, kiosk.ValidVersion, kiosk.CompareVersions, kiosk.Satisfies, kiosk.NewestCompatible, kiosk.ReadIdentity; build.EffectiveFramework(ctx, appDir) (string, error) where a non-nil error with a version is a warning.
internal/build: AddPlugin(ctx, startDir, pluginDir) (unchanged signature; v0.0.0 require stays its default), editAppModule(ctx, appDir, pluginDir, modPath), ensureGoWork, runGoWorkUse, findGoWork, applyGoWork, runGo, underRoot, findAppDir/FindAppDir, LoadManifest, SaveManifest (rewrites the file and drops comments), validateModulePath, ValidatePluginID; internal/build/new.go runGit (~286).
modules/fetchguard: NewClient(Policy{Mode: TrustedMode, MaxBytes, Timeout}, cfg *compass.Config); Client.Get(ctx, url, header) (*Result, error); WithTransport(ctx, rt) test seam. modules/compass: Open(Options{Dir, Env}) loads config/<file>.yaml plus SUMMER_<FILE>__<KEY> env; Config.Has(path), Config.String(path).
modules/bonfire: Interactive(out) bool; Output.Confirm(question, def) (bool, error); the auto-confirming helper in helpers.go returns true off a terminal and must not be used here (research F4); FlagBool(in, name); Input.Argument(name).
Verified Go behaviour (research F5): `go get mod@v` works inside a go.work workspace and edits the app module; `go list -m -json` resolves module-cache dirs; a go.work replace overrides a workspace module's own replace of the same path (F2); `git submodule add <url> <path>` adopts an existing clone and `git submodule absorbgitdirs` moves its .git.
</interfaces>
</context>
## Execution units and resume points
- Run `git status --short internal/build cmd/summer modules/kiosk docs` before each task; stop if another session has uncommitted edits in these files. Stage explicit paths. No co-author tag.
- Resume check: `git log --format=%s | grep -Fx '<subject>'`.
| Task | Commit subject | Resume point |
|------|----------------|--------------|
| 1 | `feat(build): summer plugin:install for registry plugins as Go modules` | TestInstallSmoke/module passes |
| 2 | `feat(build): plugin:install resolves requirements, pins and prompts` | TestInstallSmoke/deps passes |
| 3 | `feat(build): plugin:install --source and git URLs as submodules` | TestInstallSmoke/source passes |
| 4 | `feat(build): summer plugin:update`; `docs(34): close the --module question for v1` | TestInstallSmoke/update passes |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "summer plugin:install acme.blog --yes adds a registry plugin to an app as a Go module" — one plugin, no dependencies, module mode only</name>
<reversibility rating="costly">`plugins.registry_url` becomes a key in apps' config files and in released binaries; renaming it later needs a fallback read of the old key.</reversibility>
<files>modules/kiosk/client.go, modules/kiosk/README.md, internal/build/install.go, internal/build/manifest.go, internal/build/scaffold.go, internal/build/install_smoke_test.go, internal/build/fixtures_test.go, cmd/summer/main.go, docs/plugins/marketplace.md, docs/console/scaffolding.md</files>
<read_first>
- modules/kiosk/registry.go, modules/kiosk/version.go, internal/build/plugindirs.go (34-01 output)
- modules/fetchguard/client.go (NewClient, Get, WithTransport) and modules/fetchguard/README.md (TrustedMode rules)
- modules/compass/config.go (Open, Has, String)
- internal/build/scaffold.go (AddPlugin, editAppModule, ensureGoWork, runGo, applyGoWork) and internal/build/manifest.go (LoadManifest, SaveManifest)
- internal/build/build_test.go (TestMakeAndAddPluginOnHelloCopy: the hello-copy app with an absolute framework replace)
- cmd/summer/main.go (addPluginCommand) and cmd/summer/commands_documented_test.go
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (Pattern 4, F3, F5, Pitfalls 4-5, the Validation Architecture row on the file:// GOPROXY)
</read_first>
<action>
Per D-08 (single plugin, newest compatible) and D-18. kiosk `client.go`: `DefaultRegistryURL = "https://summercms.io"`, `RegistryURL(cfg *compass.Config) string` (default when the key is absent, the configured value otherwise, "" meaning disabled), `ErrRegistryDisabled`, `ErrNotFound`, `Client` with `NewClient(baseURL string, cfg *compass.Config) (*Client, error)` over `fetchguard.NewClient(fetchguard.Policy{Mode: fetchguard.TrustedMode, MaxBytes: 4 MiB, Timeout: 10s}, cfg)` (base URL must be http or https without user info; no redirects are followed, so it must be the final origin), and methods `List(ctx, q, category string) (ListResponse, error)`, `Plugin(ctx, id string) (RegistryPluginDetail, error)`, `Versions(ctx, id string) ([]RegistryVersion, error)` decoding kiosk's wire types (404 → ErrNotFound, other non-2xx → error with the registry's error code).
internal/build `install.go`: `InstallOptions{StartDir, Arg string; Source, Yes, Offline bool; Registry Registry; Interactive bool; Confirm func(summary string) (bool, error); Out io.Writer}` where `Registry` is the interface of the three client methods (tests pass a fake or an httptest-backed client); `InstallPlan{AppDir, Framework string; Steps []InstallStep}`; `InstallStep{ID, Version, Module, Package, Repository, Mode string}`; `PlanInstall(ctx, opts) (*InstallPlan, error)` and `ApplyInstall(ctx, plan *InstallPlan, out io.Writer) error`. In this task: parse `<id>`, fetch versions, filter with kiosk.NewestCompatible against build.EffectiveFramework (print its warning), validate the chosen module (validateModulePath) and version (kiosk.ValidVersion) before exec, apply with one `go get <module>@<version>` run in the app dir with applyGoWork, then append `{id, package}` to summer.yaml. Replace SaveManifest use in AddPlugin with a new comment-preserving `appendManifestPlugins(path string, plugins []Plugin) error` that inserts entries after the last item of the `plugins:` block at the existing indentation (or appends a block), re-parses the result with LoadManifest and restores the original bytes on any error. An ID already in summer.yaml is an error suggesting `summer plugin:update <id>`. Finish with "Installed … ; run summer build" (do not run go mod tidy: research Pitfall 5).
cmd/summer: `pluginInstallCommand()` registered after plugin:manifest: Name `plugin:install`, Description, Long (argument forms, modes, framework rule, prompt and --yes, --offline, plugins.registry_url), Examples, Arg `plugin` (required: `vendor.name[@vX.Y.Z]` or a git URL), Flags `source`, `yes`, `offline` (Bare, read with bonfire.FlagBool). It opens the app's config with compass.Open(Options{Dir: <app>/config}), builds the client from kiosk.RegistryURL, sets Interactive from bonfire.Interactive(out) and Confirm from out.Confirm. Prompt rule (research F4): with --yes no prompt; otherwise interactive → Confirm(summary, false); non-interactive → an error naming `--yes`.
`fixtures_test.go`: helpers `writeProxyModule(t, proxyDir, modPath, version string, files map[string]string)` building `@v/list`, `.info`, `.mod` and `.zip` with archive/zip (zip entries prefixed `<module>@<version>/`), `fakeRegistry(t, plugins)` serving kiosk JSON through httptest, and `helloCopy(t)` reusing the TestMakeAndAddPluginOnHelloCopy setup. `install_smoke_test.go` `TestInstallSmoke/module` (skipped under -short): registry lists acme.blog with v0.1.0 (framework v0.5.0) and v0.2.0 (framework v9.0.0); the go subprocesses run with GOPROXY=`file://<fixture>,file://<real GOMODCACHE>/cache/download`, GOMODCACHE=t.TempDir(), GOSUMDB=off, GOFLAGS=-modcacherw (offline; record the exact env that worked in the SUMMARY); after PlanInstall plus ApplyInstall with Yes, assert go.mod requires the fixture module at v0.1.0, summer.yaml lists acme.blog and still has a comment planted before the install, and build.App builds the app. A second subtest asserts a pin to v0.2.0 fails naming v9.0.0.
Docs in the same commit: client and RegistryURL in modules/kiosk/README.md; "Installing plugins" and the `plugins.registry_url` key in docs/plugins/marketplace.md; a `plugin:install` row in docs/console/scaffolding.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./internal/build -run 'TestInstallSmoke/module' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestInstallSmoke/module" line</fails_when>
<automated>go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree' -count=1 2>&1 | tail -3 && go run ./cmd/summer docs:build --check 2>&1 | tail -5</automated>
<fails_when>non-zero exit, or a "FAIL" or "unknown identifier" line</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n 'DefaultRegistryURL = "https://summercms.io"' modules/kiosk/client.go` prints one line
- `grep -n '"plugin:install"' cmd/summer/main.go` prints one line
- `grep -n "bonfire.Interactive" cmd/summer/main.go` prints at least one line, and `grep -n "ConfirmProceed" cmd/summer/main.go internal/build/install.go` shows no call inside the plugin:install code path
- `grep -n "appendManifestPlugins" internal/build/scaffold.go internal/build/install.go` prints at least two lines
- `grep -n "plugins.registry_url" docs/plugins/marketplace.md` prints at least one line
</acceptance_criteria>
<done>A registry plugin installs into an app as a Go module with one command and the app builds.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Requirements, pins, prompts and offline rules for registry installs</name>
<files>internal/build/install.go, internal/build/install_smoke_test.go, internal/build/fixtures_test.go, cmd/summer/main.go, docs/plugins/marketplace.md</files>
<read_first>
- internal/build/install.go and install_smoke_test.go (Task 1)
- modules/kiosk/version.go (Satisfies, NewestCompatible)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (Pattern 4 closure rules)
</read_first>
<behavior>
- installing a plugin that requires golem15.translate v0.1.0 when translate is absent plans two steps, dependency first, each the newest compatible version that also satisfies the minimum, and one go get installs both
- a dependency already in summer.yaml whose installed version is below the minimum is an error naming `summer plugin:update golem15.translate`
- a dependency cycle in registry data terminates and is reported, it does not loop
- `name@v0.1.0` installs exactly that version when compatible; an unknown version is an error listing the available ones
- an unknown ID answers "not in the registry" with the registry URL used
- with Yes false and Interactive false the plan is printed and PlanInstall's caller gets an error containing "--yes"; with Interactive true and Confirm returning false nothing is changed
- with Offline true or an empty plugins.registry_url, an ID install is an error that says so and mentions git URL installs
- a registry entry whose module starts with "-" or whose version is not vX.Y.Z is refused before any exec
</behavior>
<action>
Per D-08 and D-09. Extend PlanInstall with the transitive closure over RegistryVersion.Requires (for each missing ID: newest version satisfying both the framework and the minimum; installed IDs: compare the installed version — module version from go.mod, or `git describe` base through kiosk.BaseVersion for local plugins — with the minimum), cycle detection, pins, the not-found and disabled cases, and validation of every registry string before ApplyInstall runs anything. Render the confirmation summary as one line per step (`id@version (module|submodule)`), printed before the prompt. ApplyInstall runs a single `go get` with every module@version so MVS sees the whole set, then appends all summer.yaml entries in dependency order. Write the behavior subtests (`deps`, `installed_old`, `cycle`, `pin`, `unknown`, `prompt`, `offline`, `invalid`) first; they use the fake registry and, where nothing is applied, run under -short. Document the requirement rules and the prompt in docs/plugins/marketplace.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./internal/build -run 'TestInstallSmoke' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -30</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestInstallSmoke/deps" or "--- PASS: TestInstallSmoke/prompt" line</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- every behavior subtest named in the action exists and passes
- `grep -n "summer plugin:update" internal/build/install.go` prints at least one line (the installed-too-old hint)
- `grep -n -- "--yes" internal/build/install.go cmd/summer/main.go` prints at least one line in an error message
</acceptance_criteria>
<done>Registry installs bring their missing requirements, refuse incompatible ones with the version to move to, and never proceed without a confirmation or --yes.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: --source and git-URL installs as git submodules with go.work overrides</name>
<files>internal/build/source.go, internal/build/install.go, internal/build/scaffold.go, internal/build/install_smoke_test.go, internal/build/fixtures_test.go, cmd/summer/main.go, docs/plugins/marketplace.md, docs/architecture/go-modules-and-workspaces.md</files>
<read_first>
- internal/build/install.go (Tasks 1-2), internal/build/scaffold.go (editAppModule, ensureGoWork, runGoWorkUse)
- internal/build/new.go (~286 runGit)
- ../sm-demo-app/go.work (hand-written replace overrides for submodule plugins) — read only
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (F2, Pattern 4, "CLI git" code example, Security Domain)
</read_first>
<behavior>
- `--source` for an ID clones the registry's repository at the chosen tag into plugins/<vendor>/<name>, adds it as a submodule (`.gitmodules` lists the path, `git submodule status` shows the tag), registers it with require <module>@<tag> plus a local replace and a go.work use, and the app builds although the plugin's go.mod replaces the framework with ../summercms.go (go.work replace override)
- dependencies of a `--source` install are installed as submodules too
- a git URL install reads plugin.yaml at the newest tag whose framework minimum is satisfied, falls back to the default branch head with a warning when no tag qualifies, never calls the registry for the plugin itself (the fake registry records no request for its ID), and resolves its required IDs through the registry
- a git URL install with --offline and a required ID not in summer.yaml fails naming the ID; with it installed it succeeds without any registry request
- an app directory that is not a git repository refuses --source and git URLs with a message about submodules
- URLs starting with "-", ext:: or file:: forms and file:// (outside tests) are refused; https, ssh:// and scp-like user@host:path are accepted
</behavior>
<action>
Per D-09, D-11, D-12, user decision 5 and research F2. `source.go`: git runner for the CLI that keeps the user's git config (credential helpers, insteadOf), sets `GIT_ALLOW_PROTOCOL` from a package variable `cliGitProtocols` (default "https:ssh"; tests set "https:ssh:file"), sets GIT_TERMINAL_PROMPT=0 when not interactive, and puts `--` before URLs and paths. Git URL detection and validation (`isGitURL`, `validateGitURL`). Target directory: plugins/<vendor>/<name> from the ID in the repository root's plugin.yaml (a repository without one uses its name stripped of `sm-` and `-plugin`); a nested plugin's package directory lives inside it and the module root is what go.work uses. Flow: clone into a temp directory under plugins/, pick the tag (git URL: `git tag` plus `git show <tag>:<path>/plugin.yaml` with kiosk.Parse and the framework rule; ID: the registry's chosen version and repository URL, validated as https), check it out, move it to the target, `git submodule add -- <url> <path>` (adopts the clone) and `git submodule absorbgitdirs -- <path>`, then register through an internal variant of AddPlugin that takes the require version (editAppModule gains a version parameter; plugin:add keeps v0.0.0), and add go.work replace overrides: for every replace in the plugin's go.mod (`go mod edit -json`) whose path the go.work does not already replace, add `go work edit -replace=<path>=<target>` where target is the app's own local replace of that path when present, the workspace directory of that module when it is another installed submodule, otherwise `<path>@<version the app's go.mod requires>`. Non-git app: refuse before cloning. Wire `--source` and git URLs into PlanInstall/ApplyInstall (steps carry Mode submodule) and the CLI. Fixture repositories in tests are created with git init in t.TempDir and addressed with file:// URLs. Write the behavior subtests (`source`, `source_deps`, `giturl`, `giturl_offline`, `nogit`, `urls`) first. Document submodule installs, git URLs and the go.work overrides in docs/plugins/marketplace.md and docs/architecture/go-modules-and-workspaces.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./internal/build -run 'TestInstallSmoke/(source|source_deps|giturl|giturl_offline|nogit|urls)' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestInstallSmoke/source" line</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "absorbgitdirs" internal/build/source.go` prints one line
- `grep -n '"https:ssh"' internal/build/source.go` prints one line
- `grep -n "go work edit\|\"work\", \"edit\"" internal/build/source.go` prints at least one line
- `go run ./cmd/summer plugin:add --help` output is unchanged in meaning, and TestMakeAndAddPluginOnHelloCopy still passes (plugin:add keeps require v0.0.0)
</acceptance_criteria>
<done>Plugins install from source or from any git URL the user can reach, as submodules that build inside the app's workspace.</done>
</task>
<task type="auto" tdd="true">
<name>Task 4: summer plugin:update [id] for module and submodule installs, and the --module question closed</name>
<files>internal/build/update.go, internal/build/install_smoke_test.go, cmd/summer/main.go, docs/plugins/marketplace.md, docs/console/scaffolding.md, .planning/research/questions.md</files>
<read_first>
- internal/build/install.go and internal/build/source.go (Tasks 1-3)
- internal/build/plugindirs.go (34-01: per-plugin source and version)
- .planning/research/questions.md (the --module entry)
</read_first>
<behavior>
- a module install at v0.1.0 updates to v0.1.1 when the registry adds it (compatible), and stays when the only newer version needs a newer framework, reporting that version and the framework it needs
- a submodule install checks out the newest compatible tag and its go.mod require follows the tag; the framework pin in go.work is refreshed when the app's framework requirement changed
- `plugin:update` without an ID updates every resolvable plugin, lists in-app plugins and unlisted plugins as skipped, and exits zero unless a resolvable update failed
- the update plan is printed and needs confirmation or --yes exactly like install
</behavior>
<action>
Per D-10 (no-ID semantics are Claude's discretion: skip and report what cannot be resolved; fail only when a resolvable update fails). `update.go`: `UpdateOptions{StartDir, ID string; Yes, Offline, Interactive bool; Registry Registry; Confirm func(string) (bool, error); Out io.Writer}` and `Update(ctx, opts) error`: resolve each summer.yaml plugin's source and version with the 34-01 resolver; module plugins → newest compatible registry version above the installed one → one `go get` for all; submodule plugins → `git -C <dir> fetch --tags`, newest compatible tag (registry for listed IDs, the submodule's own tags and plugin.yaml for git-URL plugins), `git -C <dir> checkout <tag>`, `go mod edit -require=<module>@<tag>`, then refresh go.work overrides; --offline restricts to submodules and their own tags. CLI `pluginUpdateCommand()`: Name `plugin:update`, full docs, optional Arg `plugin`, Flags `yes`, `offline`. Write the behavior subtests (`update`, `update_submodule`, `update_all`, `update_prompt`) first. Docs: "Updating plugins" in docs/plugins/marketplace.md and a `plugin:update` row in docs/console/scaffolding.md (same commit). Then, as a separate planning-docs commit, mark the `--module` question in .planning/research/questions.md answered: not in v1, git URLs install as submodules only (D-11), deferred until submodule-only proves limiting.
</action>
<verify>
<automated>go test ./internal/build -run 'TestInstallSmoke/update' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestInstallSmoke/update" line</fails_when>
<automated>go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree' -count=1 2>&1 | tail -3 && go run ./cmd/summer docs:build --check 2>&1 | tail -5</automated>
<fails_when>non-zero exit, or a "FAIL" or "unknown identifier" line</fails_when>
<automated>go vet ./... && go test ./internal/build ./cmd/summer ./modules/kiosk 2>&1 | tail -5</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n '"plugin:update"' cmd/summer/main.go` prints one line
- `grep -n "func Update(ctx context.Context, opts UpdateOptions) error" internal/build/update.go` prints one line
- `grep -n -i "not in v1" .planning/research/questions.md` prints a line in the --module entry
- docs/console/scaffolding.md names plugin:install and plugin:update
</acceptance_criteria>
<done>The admin's "update available" badge has a matching command, and the --module question is closed for v1.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| registry JSON → CLI → go/git | module paths, versions and repository URLs from summercms.io (or a configured registry) |
| user-supplied git URL → git | private or third-party repositories |
| third-party plugin code → app binary | compiled in after confirmation |
| CLI → app directory | summer.yaml, go.mod, go.work, .gitmodules, plugins/ |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-22 | Elevation of privilege | registry strings passed to go get / git clone | high | mitigate | validateModulePath, kiosk.ValidVersion, https-only repository URLs, exec without shell, `--` before URLs and paths; TestInstallSmoke/invalid and /urls |
| T-34-23 | Elevation of privilege | ext:: or file:: transports via a git URL | high | mitigate | GIT_ALLOW_PROTOCOL=https:ssh (file only in tests), URL validator refuses leading "-" and transport prefixes |
| T-34-24 | Tampering | malicious plugin code compiled into the app | high | accept | inherent to compiled plugins; mitigated by printing every addition and requiring confirmation or --yes (D-09); sumdb verification stays on for module installs (GONOSUMDB is never set) |
| T-34-25 | Tampering | writes outside the app root | medium | mitigate | targets derived from validated IDs under plugins/, underRoot checks before clone, move and registration |
| T-34-26 | Denial of service | slow or hostile registry | medium | mitigate | fetchguard client with timeout, 4 MiB cap and no redirects; clear error and --offline for git URLs |
| T-34-27 | Spoofing | registry pointing at a different module than it lists | medium | mitigate | the ingester ties module to repository (34-03); the CLI re-reads plugin.yaml from the checkout for submodule installs and refuses an ID mismatch |
| T-34-28 | Tampering | summer.yaml damaged by an edit | low | mitigate | appendManifestPlugins re-parses and restores the original bytes on error |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | the CLI installs Go modules chosen by the user; no package is added to the framework |
</threat_model>
<verification>
- `go vet ./... && go test -short ./...` green after every commit; `go test ./internal/build -run TestInstallSmoke` (non-short) green.
- TestCommandsDocumented, TestDocsTree and `summer docs:build --check` pass.
</verification>
<success_criteria>
- plugin:install covers ID (module), ID --source and git URL; plugin:update covers modules and submodules.
- Requirement checks, prompts and --offline behave per D-08..D-12.
- No push or tag.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-04-SUMMARY.md` when done, including the go env that made the offline module-install test work.
</output>
## Artifacts this phase produces
- Types: `kiosk.Client`, `build.InstallOptions`, `build.InstallPlan`, `build.InstallStep`, `build.Registry`, `build.UpdateOptions`.
- Functions: `kiosk.NewClient`, `kiosk.RegistryURL`, `kiosk.Client.List`, `kiosk.Client.Plugin`, `kiosk.Client.Versions`, `build.PlanInstall`, `build.ApplyInstall`, `build.Update`; internal `appendManifestPlugins`, `isGitURL`, `validateGitURL`.
- Constants and variables: `kiosk.DefaultRegistryURL`, `kiosk.ErrRegistryDisabled`, `kiosk.ErrNotFound`, `cliGitProtocols`.
- CLI: `summer plugin:install <id[@vX.Y.Z]|git-url>` with `--source`, `--yes`, `--offline`; `summer plugin:update [id]` with `--yes`, `--offline`.
- Config key: `plugins.registry_url` (file config/plugins.yaml, env `SUMMER_PLUGINS__REGISTRY_URL`; default https://summercms.io; empty disables).
- Tests: `TestInstallSmoke` (module, deps, installed_old, cycle, pin, unknown, prompt, offline, invalid, source, source_deps, giturl, giturl_offline, nogit, urls, update, update_submodule, update_all, update_prompt); helpers `writeProxyModule`, `fakeRegistry`, `helloCopy`.
- Planning: `.planning/research/questions.md` --module entry answered (not in v1).

View File

@@ -0,0 +1,255 @@
---
phase: 34-plugin-marketplace
plan: 04
subsystem: plugins
tags: [kiosk, fetchguard, plugin-install, plugin-update, go-get, git-submodule, go-work, registry-client]
requires:
- phase: 34-plugin-marketplace (34-01)
provides: "kiosk wire types and version rules (RegistryAPIPath, RegistryVersion, ValidVersion, CompareVersions, BaseVersion, Satisfies, NewestCompatible), kiosk.Parse, kiosk.ReadIdentity, build.EffectiveFramework"
- phase: 34-plugin-marketplace (34-03)
provides: "the registry server at /api/registry/v1 on summercms.io"
provides:
- "kiosk.Client (List, Plugin, Versions, BaseURL) over fetchguard TrustedMode, 4 MiB, 10 s, no redirects; kiosk.NewClient, kiosk.RegistryURL, kiosk.DefaultRegistryURL, kiosk.ErrRegistryDisabled, kiosk.ErrNotFound; config key plugins.registry_url"
- "build.PlanInstall / build.ApplyInstall with InstallOptions, InstallPlan, InstallStep, Registry, ErrCancelled, ModeModule, ModeSubmodule"
- "build.Update with UpdateOptions"
- "summer plugin:install <id[@vX.Y.Z]|git-url> [--source] [--yes] [--offline]; summer plugin:update [id] [--yes] [--offline]"
- "comment-preserving summer.yaml appends (appendManifestPlugins) used by plugin:add and plugin:install"
- "go.work replace overrides for submodule plugins (refreshWorkOverrides)"
affects: [34-05 admin Plugins screen (kiosk.Client, plugins.registry_url), 34-06 tests and release ledger, every app that installs plugins]
actuals:
tokens: 39000
tasks: 4
commits: 5
plan_head_before: e7eda88ddd8ffb5f5626bc6af4a7c5aa765e1e75
plan_head_after: 96a7012ece88c0e0a095b84b7d1b3c4ee31f8898
tech-stack:
added: []
patterns:
- "Plan, print, confirm, apply: PlanInstall/Update resolve and print everything before any change; --yes or an interactive yes is required (never bonfire.ConfirmProceed)"
- "Every registry string is validated before exec: strict vX.Y.Z, plain module paths, package inside module, https repository URLs; git runs with GIT_ALLOW_PROTOCOL and -- before URLs and paths"
- "Offline Go module tests: file:// GOPROXY fixture tree built with archive/zip, chained to the developer's module download cache, with a throwaway GOMODCACHE"
key-files:
created:
- modules/kiosk/client.go
- internal/build/install.go
- internal/build/source.go
- internal/build/update.go
- internal/build/install_smoke_test.go
- internal/build/fixtures_test.go
modified:
- internal/build/manifest.go
- internal/build/scaffold.go
- cmd/summer/main.go
- modules/kiosk/README.md
- docs/plugins/marketplace.md
- docs/console/scaffolding.md
- docs/architecture/go-modules-and-workspaces.md
- .planning/research/questions.md
key-decisions:
- "A workspace module that another workspace module's go.mod replaces gets a versioned go.work replace (M@<required version> => dir): Go refuses a whole-path replace of a workspace module, and any go.work replace of the path resolves the conflict (verified in scratch)"
- "go.work overrides are computed over every go.work use module's go.mod, not only the newly installed plugin, so a plugin installed earlier that replaces the new one is covered; replaces the user wrote in go.work are left alone; self-pins (M => M@v) follow the app's go.mod require"
- "plugin:update reads each plugin's source and version from go.mod/go.work and git describe (installedSource), offline, instead of the go list resolver, which needs every module's sources downloaded"
- "A git URL install with no fitting release tag takes the default branch head with a warning and requires v0.0.0 in go.mod, as plugin:add does"
- "plugin:update without an ID applies what resolved, reports the rest under 'Not updated', and fails only when a resolved update could not be carried out"
- "--module for git URLs is not in v1 (D-11); the research question is closed"
patterns-established:
- "Commands that change an application's plugins print every change as id@version (mode) and need --yes off a terminal"
- "Install and update tests use fakeRegistry (httptest + the real kiosk.Client), writeProxyModule and pluginRepo fixtures, and never touch the network"
requirements-completed: [SC-3, D-08, D-09, D-10, D-11, D-12, D-18]
coverage:
- id: D1
description: "summer plugin:install <id> installs the newest compatible registry release as a Go module with go get, appends summer.yaml in place (comments kept) and the app builds; a pin needing a newer framework fails naming it"
requirement: SC-3
verification:
- kind: integration
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/module"
status: pass
- kind: unit
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/module_pin_framework,append_manifest"
status: pass
human_judgment: false
- id: D2
description: "Transitive requirements, installed-too-old error naming summer plugin:update, cycle report, pins, unknown IDs, prompt and --yes rule, --offline/disabled registry, refusal of invalid registry strings"
requirement: D-09
verification:
- kind: unit
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/deps,installed_old,cycle,pin,unknown,prompt,offline,invalid"
status: pass
human_judgment: false
- id: D3
description: "--source and git URL installs as git submodules at the chosen tag, registered with the tag as the go.mod require, with go.work overrides so the app builds although the plugin replaces the framework with ../summercms.go; non-git apps refused; URL validation"
requirement: D-12
verification:
- kind: integration
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/source,source_deps,giturl,giturl_offline"
status: pass
- kind: unit
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/nogit,urls"
status: pass
human_judgment: false
- id: D4
description: "summer plugin:update for module and submodule installs, all-plugins mode with skipped/failed reporting, go.work pin refresh, prompt rule"
requirement: D-10
verification:
- kind: integration
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/update,update_submodule,update_all,update_prompt"
status: pass
human_judgment: false
- id: D5
description: "kiosk.Client and plugins.registry_url (default, override, empty disables), fetchguard limits, 404 as ErrNotFound naming the registry"
requirement: D-18
verification:
- kind: unit
ref: "internal/build/install_smoke_test.go#TestInstallSmoke/registry_client,unknown,offline"
status: pass
human_judgment: false
- id: D6
description: "CLI commands and docs: plugin:install and plugin:update documented, kiosk README, marketplace, scaffolding and go-modules pages; --module question closed"
requirement: D-11
verification:
- kind: other
ref: "go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'; go run ./cmd/summer docs:build --check"
status: pass
human_judgment: true
rationale: "Docs and help wording are a reviewer's call; the checker only proves identifiers, command names, links and snippets"
- id: D7
description: "Interactive prompt on a real terminal and installs against the live summercms.io registry and real plugin repositories over https/ssh"
verification: []
human_judgment: true
rationale: "Tests run non-interactively against httptest and file:// fixtures; a real terminal prompt, credentials and the deployed registry need a person"
duration: 34min
completed: 2026-10-29
status: complete
---
# Phase 34 Plan 04: plugin:install and plugin:update Summary
**`summer plugin:install` adds registry plugins as Go modules (newest release the app's effective framework allows, with their requirements, after a printed plan and a confirmation or `--yes`), installs from source or any git URL as git submodules with the go.work overrides that make them build, and `summer plugin:update` moves module and submodule installs to their newest compatible release; all registry calls go through the new `kiosk.Client` and the `plugins.registry_url` setting.**
## Performance
- **Duration:** about 34 min
- **Started:** 2026-10-29T17:12:51Z
- **Completed:** 2026-10-29T17:46:30Z
- **Tasks:** 4 (Task 1 tracer, then three expansion tasks)
- **Files modified:** 14 (6 created, 8 modified)
## Accomplishments
- **Registry client (D-18).** `kiosk.Client` (`List`, `Plugin`, `Versions`) over a `fetchguard` client in trusted mode with a 4 MiB cap, a 10 s timeout and no redirects. `kiosk.RegistryURL` reads `plugins.registry_url` (default `https://summercms.io`, `SUMMER_PLUGINS__REGISTRY_URL` overrides, empty disables). A 404 wraps `kiosk.ErrNotFound` and names the ID and the registry origin; a redirect is an error asking for the final origin.
- **Module installs (D-08).** `build.PlanInstall` parses `id[@vX.Y.Z]`, asks the registry, picks the newest release the effective framework satisfies (or the pin), and fails with the framework version to move to when only newer-framework releases exist. `build.ApplyInstall` runs one `go get -- mod@v ...` and appends summer.yaml in place. It does not run `go mod tidy` (Pitfall 5).
- **Requirements, pins and prompts (D-09).** Requirements resolve transitively, dependencies first, each at the newest compatible release at or above its minimum. Plugins sharing a module share one release. An installed requirement below its minimum is an error naming `summer plugin:update <id>`. Cycles are reported. The plan is printed as `id@version (mode)`; `--yes` skips the prompt, a non-interactive run without it is an error naming `--yes`, and a declined prompt changes nothing (`build.ErrCancelled`).
- **Submodule installs (D-09, D-11, D-12, research F2).** `--source` clones each registry repository (https only) at the chosen tag. A git URL (https, ssh, `user@host:path`) is cloned with the user's own git setup and never sent to the registry. The command reads `plugin.yaml` at the newest tag whose framework minimum fits, or falls back to the default branch head with a warning. Each plugin is moved to `plugins/<vendor>/<name>`, then `git submodule add` and `absorbgitdirs` run, and the plugin is registered with the tag as its go.mod require (plugin:add keeps `v0.0.0`). The checkout's `plugin.yaml` must match the listed ID and module. `refreshWorkOverrides` adds the go.work replaces the plugins' development-layout `go.mod` replaces need. A non-git app is refused before cloning.
- **plugin:update (D-10).** Module installs move with one `go get`. Submodules fetch tags, are checked out at the release tag and require it in go.mod. Unlisted submodules (git URL installs) use their own tags and `plugin.yaml`. Without an ID, every resolvable plugin is updated and the rest are reported. A newer release that needs a newer framework is named.
- **summer.yaml edits keep comments** (user decision 5). `appendManifestPlugins` inserts after the last item of the `plugins:` block at its indentation, re-parses, and restores the original bytes on any error. `plugin:add` uses it too.
- `--module` research question closed as "not in v1" (D-11).
## Task Commits
1. **Task 1: plugin:install for registry plugins as Go modules (tracer)**: `9b23e87` (feat). Tracer gate: interactive, `end-of-phase`, automated-only verify, re-run green, expanded.
2. **Task 2: requirements, pins, prompts and offline rules**: `a462bf1` (feat)
3. **Task 3: --source and git URLs as submodules with go.work overrides**: `8093587` (feat)
4. **Task 4: summer plugin:update**: `d024ab4` (feat); **--module question closed**: `96a7012` (docs, planning)
**Plan metadata:** the docs commit containing this SUMMARY.
## Offline module-install test environment (as requested by the plan)
`TestInstallSmoke/module`, `deps` and `update` ran with:
- `GOPROXY=file://<fixture proxy>,file://<go env GOMODCACHE>/cache/download`
- `GOMODCACHE=<t.TempDir()>`
- `GOSUMDB=off`, `GOTOOLCHAIN=local`, with `GONOSUMDB`, `GOPRIVATE` and `GONOPROXY` empty
- `GOFLAGS=-modcacherw` set in the test env. summer's go runner (`applyGoWorkFile`) drops `GOFLAGS`, and for an app without go.work it sets `GOWORK=off GOFLAGS=-mod=mod`. A test cleanup therefore makes the fresh module cache writable before the temp dir is removed.
The fixture proxy tree has `@v/list`, `.info`, `.mod` and `.zip` files, with zip entries prefixed `<module>@<version>/`. No network was used. `module` takes about 28 s, mostly because the fresh module cache extracts every dependency before `summer build` links the app. The submodule tests run with `GOPROXY=off`.
## Files Created/Modified
- `modules/kiosk/client.go`: registry client and `plugins.registry_url`
- `internal/build/install.go`: `PlanInstall`, `ApplyInstall`, resolution, validation, prompt rule, `installedVersion`
- `internal/build/source.go`: CLI git runner (`cliGitProtocols`), `isGitURL`, `validateGitURL`, `validateRepositoryURL`, clone, tag and `plugin.yaml` selection, `applySubmodule`, `refreshWorkOverrides`
- `internal/build/update.go`: `Update`, `installedSource`
- `internal/build/manifest.go`: `appendManifestPlugins`, `insertManifestPlugins`
- `internal/build/scaffold.go`: `AddPlugin` appends in place; `editAppModule` takes the require version
- `internal/build/install_smoke_test.go`, `internal/build/fixtures_test.go`: TestInstallSmoke (module, module_pin_framework, deps, installed_old, cycle, pin, unknown, prompt, offline, invalid, source, source_deps, giturl, giturl_offline, nogit, urls, update, update_submodule, update_all, update_prompt, append_manifest, registry_client) and the helpers writeProxyModule, fakeRegistry, helloCopy, pluginRepo, gitApp
- `cmd/summer/main.go`: `plugin:install`, `plugin:update`, `registryFor`
- Docs: `modules/kiosk/README.md` (client, Configuration, CLI rows), `docs/plugins/marketplace.md` (Installing plugins, Required plugins, Confirmation, Installing from source, Installing from a git URL, Updating plugins, The registry setting), `docs/console/scaffolding.md` (two rows), `docs/architecture/go-modules-and-workspaces.md` (Plugins installed as submodules)
- `.planning/research/questions.md`: the `--module` entry answered
## Decisions Made
See `key-decisions` in the frontmatter. In short: versioned go.work replaces for workspace modules, overrides computed across all workspace modules, offline source detection for update, a default-branch-head fallback that requires `v0.0.0`, and lenient update-all semantics (apply what resolved, report the rest).
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Workspace modules need a versioned go.work replace**
- **Found during:** Task 3
- **Issue:** The plan's F2 rule replaces a module that is another installed submodule with "the workspace directory of that module". Go rejects that: "workspace module X is replaced at all versions in the go.work file". Without some go.work replace, it reports "conflicting replacements" instead.
- **Fix:** `refreshWorkOverrides` writes `replace M <required version> => ./plugins/...` for workspace modules. This was verified in a scratch workspace, where any go.work replace of the path resolves the conflict, even when MVS selects another version.
- **Files modified:** internal/build/source.go
- **Commit:** 8093587
**2. [Rule 2 - Missing critical] Overrides cover all workspace modules, not just the new plugin**
- **Found during:** Task 3
- **Issue:** A submodule installed earlier whose go.mod replaces the newly installed module breaks the build the same way.
- **Fix:** Every go.work `use` module's go.mod is scanned (except the app's). The function is idempotent, and replaces already in go.work are never touched.
- **Commit:** 8093587
**3. [Rule 2 - Missing critical] Extra URL hardening**
- Git URLs carrying a password, and registry repository URLs carrying any user info, are refused, so credentials never land in `.gitmodules`. `file://` registry repositories are accepted only when `cliGitProtocols` includes `file` (the tests). A target directory that already exists is refused while planning (registry `--source`) or before cloning (git URL).
- **Commits:** 8093587
**4. [Rule 3 - Blocking] The docs checker refuses names of commands that do not exist yet**
- Tasks 1-3 could not name `summer plugin:update` in docs (`docs:build --check`: "plugin:update is not a summer or application command"). Those sentences were reworded and then restored in Task 4. Because of that, Task 4 also touched `modules/kiosk/README.md` and `docs/architecture/go-modules-and-workspaces.md`, which are not in its file list. The install error message names `summer plugin:update` from Task 2 on, as the acceptance criteria require.
- **Commit:** d024ab4
**5. [Plan adjustment] Source and version detection for update**
- The plan says to use "the 34-01 resolver" (go list). `installedSource` reads go.mod, go.work and `git describe` instead, applying the D-07 rules: module version, base tag for a plugin that is its own repository, nothing for an in-app plugin. It needs no downloads, and the installed-version check in plugin:install uses it too.
- **Commit:** d024ab4
**6. [Plan adjustment] Extra exported names**
- `build.ErrCancelled`, `build.ModeModule`, `build.ModeSubmodule` and `kiosk.Client.BaseURL` are not in the plan's artifact list. They give the CLI a declined-prompt path and give 34-05 the registry origin. `kiosk.Client.BaseURL` is documented in the kiosk README.
**7. [Plan adjustment] Update reports newer incompatible releases next to an update**
- `acme.translate v0.1.0 -> v0.1.1 (submodule); v0.2.0 needs framework v9.0.0`, so the admin badge and the CLI tell the same story.
**8. [Process] TDD order**
- Task 2: the behavior subtests were written first and failed on their assertions (deps, installed_old, cycle, prompt and invalid) before the implementation. Task 4: the subtests were written first and failed to compile on the missing `Update`/`UpdateOptions`. Task 3: the implementation came before its subtests. As a substitute RED check, `refreshWorkOverrides` was disabled and `source`/`source_deps` were run against it; both failed on the go.work assertions, and the code was then restored. Each task is one commit, as the plan's Execution units table requires, so there are no separate `test(...)` commits.
---
**Total deviations:** 8 (1 Rule 1, 2 Rule 2, 1 Rule 3, 3 plan adjustments, 1 process note). **Impact:** no contract change. All planned names exist, `plugin:add` behaviour is unchanged (TestMakeAndAddPluginOnHelloCopy passes), and the overrides follow verified Go behaviour.
## Issues Encountered
- `gofmt -l cmd/summer` lists pre-existing alignment differences in `cmd/summer/main.go` (`Args: makeArtifactArgs()` lines), `runtime.go` and `runtime_test.go`, plus `modules/kiosk/manifest_smoke_test.go`. This plan did not introduce them (scope boundary). The new code is gofmt-clean.
- A plugin repository that has only nested plugins and no root `plugin.yaml` or `plugin.go` cannot be installed from a git URL; the command reports this. Registry `--source` installs of nested plugins do work: the checkout directory is named after the root plugin, or after the repository name without `sm-` and `-plugin`.
## User Setup Required
None. `plugins.registry_url` defaults to https://summercms.io.
## Next Phase Readiness
- 34-05 (admin Plugins screen) can build its registry client with `kiosk.NewClient(kiosk.RegistryURL(app.Config), app.Config)`, treat `kiosk.ErrRegistryDisabled` as "hide the Marketplace tab", and compute "update available" with the same rule as `plugin:update` (`kiosk.NewestCompatible` above the installed version).
- 34-06: TestInstallSmoke is the install/update coverage. The non-short subtests take about 45 s, most of it in `module`.
- Real-world check still open (D7): run `summer plugin:install golem15.<name>` against the deployed registry, and run a git URL install over SSH, on a terminal.
## Self-Check: PASSED
- Key files exist: modules/kiosk/client.go (`DefaultRegistryURL = "https://summercms.io"`, `func RegistryURL(`), internal/build/install.go (`func PlanInstall(`, `NewestCompatible`), internal/build/source.go (`"work", "edit"`, `absorbgitdirs`, `"https:ssh"`), internal/build/update.go (`func Update(ctx context.Context, opts UpdateOptions) error`) and internal/build/install_smoke_test.go (`func TestInstallSmoke(`).
- Commits 9b23e87, a462bf1, 8093587, d024ab4 and 96a7012 are in history; `git rev-list --count e7eda88..HEAD` = 5 before this docs commit.
- `go vet ./...`, `go test -short ./...`, `go test ./internal/build ./cmd/summer ./modules/kiosk` (non-short, all TestInstallSmoke subtests), `cd examples/hello && go test ./...`, `go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'` and `summer docs:build --check` all pass.
- Acceptance criteria of Tasks 1-4 were re-run and pass. `cmd/summer/main.go` and `internal/build/install.go` do not call `ConfirmProceed`, and `grep -i "not in v1" .planning/research/questions.md` hits the `--module` entry.

View File

@@ -0,0 +1,275 @@
---
phase: 34-plugin-marketplace
plan: 05
type: execute
wave: 3
depends_on: ["34-01", "34-04"]
files_modified:
- modules/cabana/plugins.go
- modules/cabana/http.go
- modules/cabana/backend_screens.go
- modules/cabana/navigation.go
- modules/cabana/admin_openapi.go
- modules/cabana/phase09_contract_test.go
- modules/cabana/security_coverage_test.go
- modules/cabana/plugins_smoke_test.go
- modules/cabana/README.md
- modules/phrasebook/backend/lang/en/lang.yaml
- modules/phrasebook/backend/lang/pl/lang.yaml
- admin/openapi/admin.json
- admin/src/api/schema.d.ts
- admin/src/views/PluginsView.vue
- admin/src/app/router.ts
- admin/src/state/useSettings.ts
- admin/tests/views/PluginsView.test.ts
- modules/boardwalk/dist
- docs/backend/users-and-permissions.md
- docs/backend/admin-spa.md
- docs/plugins/marketplace.md
autonomous: true
requirements: [SC-4, D-06, D-07, D-17, D-18, D-19]
estimate:
tokens: 140000
raw_tokens: 140000
tasks: 3
confidence: low
must_haves:
truths:
- "The admin has a read-only Plugins screen at /system/plugins, linked from Settings → System, visible to administrators holding the new permission backend.view_plugins; superusers have it without any grant (D-19)"
- "The Installed tab lists every activated plugin with the name, description, version and source baked by summer build (ID only for a plugin without plugin.yaml) and, for plugins listed in the registry, whether an update compatible with the built framework version exists, with the matching `summer plugin:update <id>` command (D-06, D-07, D-17, SC-4)"
- "The SPA calls only cabana: GET /plugins and GET /plugins/marketplace are swag-annotated cabana endpoints that call the registry server-side with a timeout and a short in-process cache and compute update availability in Go; no CSP or CORS change in the admin (D-17)"
- "The Marketplace tab searches the registry by text and category and shows `summer plugin:install <id>` with a copy button; there is no install button (SC-4, decision note)"
- "An empty plugins.registry_url hides the Marketplace tab and the update badges while the Installed tab still works; a registry that is down or slow leaves the Installed tab rendering with a registry-unavailable notice (D-18)"
- "admin/openapi/admin.json and admin/src/api/schema.d.ts are regenerated from the annotations, the contract inventories list the new routes, and modules/boardwalk/dist is rebuilt and passes scripts/check-admin-dist.sh"
artifacts:
- path: "modules/cabana/plugins.go"
provides: "Plugins screen endpoints, registry cache, update computation"
contains: "PermissionViewPlugins"
- path: "admin/src/views/PluginsView.vue"
provides: "Installed and Marketplace tabs"
contains: "plugin:install"
- path: "modules/cabana/plugins_smoke_test.go"
provides: "TestPluginsScreenSmoke (tracer)"
contains: "func TestPluginsScreenSmoke("
- path: "admin/tests/views/PluginsView.test.ts"
provides: "PluginsView smoke spec"
contains: "PluginsView"
key_links:
- from: "modules/cabana/plugins.go"
to: "modules/party/info.go"
via: "the Installed handler reads app.Lookup[party.Installed]() (falls back to party.Activated IDs for an app built before 34-01)"
pattern: "party\\.Installed"
- from: "modules/cabana/plugins.go"
to: "modules/kiosk/client.go"
via: "registry calls through kiosk.Client built from kiosk.RegistryURL(app config), update rule through kiosk.NewestCompatible and kiosk.BaseVersion"
pattern: "kiosk\\.(NewClient|RegistryURL|NewestCompatible|BaseVersion)"
- from: "admin/src/views/PluginsView.vue"
to: "modules/cabana/plugins.go"
via: "typed api client calls GET /plugins and GET /plugins/marketplace only"
pattern: "/plugins"
---
## Phase Goal
The admin SPA gains a read-only Plugins screen listing installed plugins with versions and available updates and searching the marketplace, which shows the install command with a copy button. This plan builds that screen on top of the metadata summer build bakes (34-01) and the registry client (34-04).
<objective>
Add cabana endpoints GET /plugins and GET /plugins/marketplace with the permission backend.view_plugins (D-17, D-19), a Settings → System entry that opens a custom SPA route, and PluginsView with Installed and Marketplace tabs; regenerate the OpenAPI document and the SPA types, update the contract inventories, rebuild and commit the embedded dist.
Purpose: SC-4.
Output: commits in this repository (code with its docs; the rebuilt dist in its own commit). Nothing pushed or tagged.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-CONTEXT.md
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-PATTERNS.md
@.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-04-SUMMARY.md
@.planning/notes/2026-10-07-embedded-admin-release-gate.md
@CLAUDE.md
<interfaces>
From 34-01: party.Info{ID, Module, Package, Name, Description, Version, Source}, party.Installed{Framework, Plugins} published by the generated main; kiosk.BaseVersion, kiosk.CompareVersions, kiosk.NewestCompatible, kiosk wire types. From 34-04: kiosk.Client (List, Plugin, Versions), kiosk.NewClient(baseURL, cfg), kiosk.RegistryURL(cfg) ("" = disabled), kiosk.ErrNotFound.
modules/cabana: routes in http.go inside `r.GroupRaw(api, []string{"backend", "locale.from-principal"}, …)` (~316-339, next to `g.Get("/settings", s.settingsList)`); handler pattern settingsList (~560) with bouncer.User and WriteData/WriteError; permissions in backend_screens.go (PermissionManageUsers = "backend.manage_users", Permissions() with Tab "backend::lang.permissions.tab_system"); SettingsEntry in navigation.go (~23-35) and Registry.Metadata builds the permission-filtered settings list; cabana.Allows(principal, []string); swag blocks in admin_openapi.go (~469-479 AdminSettingsList); TestPhase09ContractInventory (phase09_contract_test.go) and TestPhase09PermissionMatrix/TestPhase09SecurityCoverage (security_coverage_test.go ~55, ~184) list every route and handler.
admin: router.ts routes (/settings, /account, then /:vendor/:plugin/:controller); useSettings.ts settingsPath(entry) (~30-39); typed api client admin/src/api/client.ts; reka-ui 2.9.10 (Tabs primitives); copy pattern in admin/src/components/account/ApiTokenCreateDialog.vue (~255-268); tests in admin/tests/views/*.test.ts with admin/tests/helpers.ts.
Strings: modules/phrasebook/backend/lang/{en,pl}/lang.yaml (permissions block ~548 en, ~584 pl).
Other sessions often edit cabana: check `git status --short modules/cabana admin` and `git log -3 -- modules/cabana` before each task.
</interfaces>
</context>
## Execution units and resume points
- Before each task: `git status --short modules/cabana admin modules/phrasebook modules/boardwalk docs/backend`; stop if another session has uncommitted edits in files this task touches. Stage explicit paths. No co-author tag.
- Resume check: `git log --format=%s | grep -Fx '<subject>'`.
| Task | Commit subject | Resume point |
|------|----------------|--------------|
| 1 | `feat(cabana): read-only Plugins screen with installed plugins` | TestPluginsScreenSmoke/installed and the PluginsView spec pass |
| 2 | `feat(cabana): plugin updates and marketplace search on the Plugins screen` | TestPluginsScreenSmoke passes |
| 3 | `build(admin): rebuild the embedded admin for the Plugins screen` | check-admin-dist.sh passes |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "an administrator with backend.view_plugins opens Settings → Plugins and sees the installed plugins with their versions" — Installed tab only, no registry</name>
<files>modules/cabana/plugins.go, modules/cabana/http.go, modules/cabana/backend_screens.go, modules/cabana/navigation.go, modules/cabana/admin_openapi.go, modules/cabana/phase09_contract_test.go, modules/cabana/security_coverage_test.go, modules/cabana/plugins_smoke_test.go, modules/cabana/README.md, modules/phrasebook/backend/lang/en/lang.yaml, modules/phrasebook/backend/lang/pl/lang.yaml, admin/openapi/admin.json, admin/src/api/schema.d.ts, admin/src/views/PluginsView.vue, admin/src/app/router.ts, admin/src/state/useSettings.ts, admin/tests/views/PluginsView.test.ts, docs/backend/users-and-permissions.md, docs/backend/admin-spa.md, docs/plugins/marketplace.md</files>
<read_first>
- modules/cabana/http.go (~300-345 routes, ~560 settingsList), modules/cabana/backend_screens.go, modules/cabana/navigation.go (SettingsEntry, Registry.Metadata)
- modules/cabana/admin_openapi.go (~469-479) and scripts/check-admin-openapi.sh
- modules/cabana/phase09_contract_test.go and modules/cabana/security_coverage_test.go (route and handler lists)
- modules/party/info.go (34-01)
- admin/src/app/router.ts, admin/src/state/useSettings.ts, admin/src/views/SettingsIndexView.vue, admin/src/views/AccountView.vue (a shell view to copy), admin/tests/views/SettingsFormView.test.ts and admin/tests/helpers.ts
- docs/backend/users-and-permissions.md, docs/backend/admin-spa.md
</read_first>
<action>
Per D-06, D-07, D-17 and D-19. cabana: `PermissionViewPlugins = "backend.view_plugins"` declared in backendScreens.Permissions() with Tab tab_system and Label `backend::lang.permissions.view_plugins` (no role grants; superusers pass every check). `SettingsEntry` gains `Path string json:"path,omitempty"` (additive); Registry.Metadata appends cabana's own entry (code `plugins`, category system, label and description from lang, Path `/system/plugins`) only when the principal is allowed backend.view_plugins. `plugins.go`: types `PluginsOverview{Framework string; Registry RegistryState; Plugins []InstalledPlugin}`, `RegistryState{Enabled bool; Status string}` (status `ok`, `disabled`, `unavailable`), `InstalledPlugin{ID, Name, Description, Version, Source, Module, Package string; Listed bool; Latest, LatestFramework string; UpdateAvailable bool; UpdateCommand string}` with lower camel JSON tags matching the existing admin API style; handler `pluginsInstalled` (401 without a backend principal, 403 via WriteError when not allowed backend.view_plugins) reading `app.Lookup[party.Installed]()` and falling back to `app.Lookup[party.Activated]()` IDs for an app built before 34-01; Framework from party.Installed, else bonfire.BuildVersion().Framework. In this task Registry is reported as configured or `disabled` only (kiosk.RegistryURL of the app config) and no registry call is made. Route `g.Get("/plugins", s.pluginsInstalled)` in the backend group. swag block `AdminPluginsInstalled` (@Router /plugins [get], Envelope[PluginsOverview], 401, 403); run `scripts/check-admin-openapi.sh` to regenerate admin/openapi/admin.json and admin/src/api/schema.d.ts; add the route and handler to the contract inventories. Lang keys en and pl: permission label, settings entry label and description, screen strings (title, tabs, columns, source names, empty state).
SPA: route `{ path: '/system/plugins', name: 'plugins', component: PluginsView, meta: { shell: true } }` before the `/:vendor/:plugin/:controller` routes; `settingsPath` returns `entry.path` first when set; `PluginsView.vue` uses reka-ui Tabs with the Installed tab (name or ID, description, version, source) loaded through the typed api client from GET /plugins, and the Marketplace tab present but filled in Task 2. All text through the existing translation helper; render registry text as text, never HTML.
Tests first: `TestPluginsScreenSmoke/installed` (an app with party.Installed published: superuser 200 with every plugin and its version; an administrator without the permission 403; with it 200; settings list contains the plugins entry with path only for allowed principals; an app without party.Installed lists Activated IDs) and `admin/tests/views/PluginsView.test.ts` (renders the Installed rows from a mocked /plugins response). Docs in the same commit: permission in docs/backend/users-and-permissions.md, the screen in docs/backend/admin-spa.md and an "Admin Plugins screen" section in docs/plugins/marketplace.md, new identifiers in modules/cabana/README.md. Do not rebuild the dist here (Task 3). Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./modules/cabana -run 'TestPluginsScreenSmoke|TestPhase09ContractInventory|TestPhase09PermissionMatrix|TestPhase09SecurityCoverage' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestPluginsScreenSmoke/installed" line</fails_when>
<automated>scripts/check-admin-openapi.sh --check</automated>
<fails_when>non-zero exit (committed OpenAPI or schema.d.ts differs from the generated one)</fails_when>
<automated>npm --prefix admin run test -- PluginsView 2>&1 | tail -6 && npm --prefix admin run typecheck 2>&1 | tail -3</automated>
<fails_when>non-zero exit, a "FAIL" line, or "No test files found"</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n 'PermissionViewPlugins = "backend.view_plugins"' modules/cabana/backend_screens.go modules/cabana/plugins.go` prints one line
- `grep -n 'g.Get("/plugins", s.pluginsInstalled)' modules/cabana/http.go` prints one line
- `grep -n "@Router /plugins \[get\]" modules/cabana/admin_openapi.go` prints one line; `grep -n '"/plugins"' admin/openapi/admin.json` prints at least one line
- `grep -n "/system/plugins" admin/src/app/router.ts` prints one line and `grep -n "entry.path" admin/src/state/useSettings.ts` prints at least one line
- `grep -n "view_plugins" modules/phrasebook/backend/lang/en/lang.yaml modules/phrasebook/backend/lang/pl/lang.yaml` prints two lines
</acceptance_criteria>
<done>An allowed administrator reaches the Plugins screen from Settings and sees every installed plugin with its version and source.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Update badges and marketplace search through cabana, degraded when the registry is down or disabled</name>
<files>modules/cabana/plugins.go, modules/cabana/http.go, modules/cabana/admin_openapi.go, modules/cabana/phase09_contract_test.go, modules/cabana/security_coverage_test.go, modules/cabana/plugins_smoke_test.go, modules/cabana/README.md, modules/phrasebook/backend/lang/en/lang.yaml, modules/phrasebook/backend/lang/pl/lang.yaml, admin/openapi/admin.json, admin/src/api/schema.d.ts, admin/src/views/PluginsView.vue, admin/tests/views/PluginsView.test.ts, docs/plugins/marketplace.md</files>
<read_first>
- modules/cabana/plugins.go (Task 1)
- modules/kiosk/client.go, modules/kiosk/version.go (34-01, 34-04)
- modules/fetchguard/client.go (WithTransport) for the fake registry in tests
- admin/src/components/account/ApiTokenCreateDialog.vue (~255-268 clipboard with fallback)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (Pattern 5: timeouts, cache, concurrency, update rule)
</read_first>
<behavior>
- an installed module plugin at v0.1.0 with registry versions v0.1.1 (framework satisfied) and v0.2.0 (newer framework) reports Latest v0.1.1, UpdateAvailable true and UpdateCommand `summer plugin:update <id>`
- a submodule plugin at "v0.1.1-3-gabc1234" compares by its base v0.1.1 and reports no update when v0.1.1 is the newest compatible version
- a plugin the registry does not list has Listed false and no update fields; a local plugin (empty version) gets no registry call
- with the registry timing out or answering 500, GET /plugins answers 200 with Registry.Status unavailable and the installed list intact, and GET /plugins/marketplace answers 200 with status unavailable and no results
- with plugins.registry_url set to "", Registry.Enabled is false, no request leaves the process, and the SPA hides the Marketplace tab and the badges
- GET /plugins/marketplace?q=journal&category=content forwards both parameters, marks installed plugins and plugins whose framework minimum the built framework does not satisfy, and returns InstallCommand `summer plugin:install <id>`; q longer than 100 characters or an invalid category answers 400
- a second identical request within the cache window makes no registry request
- the copy button writes the command to the clipboard and shows a copied state; when the clipboard API is missing it shows the fallback state
</behavior>
<action>
Per D-17 and D-18. In plugins.go: a registry dependency behind an unexported interface (List, Versions) built lazily from kiosk.NewClient(kiosk.RegistryURL(app config)) with a 4-second per-call timeout; an in-process TTL cache (marketplace queries 5 minutes, per-ID versions 15 minutes, failures cached 1 minute) guarded by a mutex; per-installed-plugin version lookups with at most 4 in flight. Update rule (research Pattern 5): latest = kiosk.NewestCompatible(versions, framework); base = kiosk.BaseVersion(installed version); UpdateAvailable = base != "" and latest is newer by kiosk.CompareVersions; LatestFramework names the framework a newer incompatible version needs. Types `MarketplacePlugin{ID, Name, Description, Category string; Featured bool; IconURL, LatestVersion, LatestFramework string; Installed, Compatible bool; InstallCommand string}`; handler `pluginsMarketplace` with the same auth and permission, q/category validation as the registry's, `g.Get("/plugins/marketplace", s.pluginsMarketplace)`; errors from the registry never surface as non-200 (status in the payload meta and the RegistryState). swag block `AdminPluginsMarketplace`; regenerate with scripts/check-admin-openapi.sh; add the route to the inventories. SPA: Installed rows show an update badge with the copyable update command; the Marketplace tab (hidden when Registry.Enabled is false) has a debounced search box and a category select, result cards with name, description, version, an Installed or Needs framework vX marker and the install command with a copy button using the ApiTokenCreateDialog clipboard pattern; a notice when the registry is unavailable; no install button anywhere. Lang strings en and pl. Write the behavior subtests (`updates`, `describe_base`, `unlisted`, `unavailable`, `disabled`, `marketplace`, `cache`) in TestPluginsScreenSmoke using a fake registry, and the copy and hidden-tab cases in PluginsView.test.ts, first. Document update and marketplace behaviour in docs/plugins/marketplace.md and modules/cabana/README.md. Commit as listed in Execution units.
</action>
<verify>
<automated>go test ./modules/cabana -run 'TestPluginsScreenSmoke|TestPhase09' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -30</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestPluginsScreenSmoke/updates" or "--- PASS: TestPluginsScreenSmoke/unavailable" line</fails_when>
<automated>scripts/check-admin-openapi.sh --check</automated>
<fails_when>non-zero exit</fails_when>
<automated>npm --prefix admin run test -- PluginsView 2>&1 | tail -6 && npm --prefix admin run typecheck 2>&1 | tail -3</automated>
<fails_when>non-zero exit, a "FAIL" line, or "No test files found"</fails_when>
<automated>go vet ./... && go test -short ./...</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n 'g.Get("/plugins/marketplace", s.pluginsMarketplace)' modules/cabana/http.go` prints one line
- `grep -n "kiosk.NewestCompatible\|kiosk.BaseVersion" modules/cabana/plugins.go` prints at least two lines
- `grep -n "navigator.clipboard" admin/src/views/PluginsView.vue` prints at least one line
- `grep -rn "summercms.io" admin/src` prints nothing (the SPA never calls the registry; D-17)
- every behavior subtest named in the action passes
</acceptance_criteria>
<done>Administrators see which plugins can be updated and search the marketplace from the admin, and nothing breaks when the registry is off or down.</done>
</task>
<task type="auto">
<name>Task 3: Rebuild and commit the embedded admin, and pass the admin gates</name>
<files>modules/boardwalk/dist</files>
<read_first>
- .planning/notes/2026-10-07-embedded-admin-release-gate.md
- scripts/check-admin-dist.sh
- modules/boardwalk/README.md
</read_first>
<action>
Run `npm --prefix admin ci` only if node_modules is missing, then `npm --prefix admin run build`, which writes modules/boardwalk/dist. Stage the whole modules/boardwalk/dist directory by path (it contains only build output) and commit it alone with the subject from Execution units. Run the browser tests for the new view if the admin has a browser suite covering views (`npm --prefix admin run test:browser`); a failing unrelated browser test is recorded, not fixed here.
</action>
<verify>
<automated>scripts/check-admin-dist.sh 2>&1 | tail -3</automated>
<fails_when>non-zero exit, or output reporting that the committed dist differs from a fresh build</fails_when>
<automated>go test ./modules/boardwalk -count=1 2>&1 | tail -3 && npm --prefix admin run test 2>&1 | tail -4</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `git show --stat <the Task 3 commit sha>` lists only paths under modules/boardwalk/dist
- scripts/check-admin-dist.sh exits 0 on a clean tree
</acceptance_criteria>
<done>The embedded admin in the binary carries the Plugins screen and the release gate for admin changes passes.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| browser (admin SPA) → cabana /plugins endpoints | authenticated administrators |
| cabana → registry | outbound call to an operator-configured URL |
| registry JSON → admin UI | third-party text shown to administrators |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-29 | Elevation of privilege | GET /plugins, GET /plugins/marketplace | medium | mitigate | backend guard plus cabana.Allows backend.view_plugins (403 otherwise); permission matrix and security coverage inventories include both routes |
| T-34-30 | Information disclosure | installed plugin list | low | mitigate | only administrators with the permission see versions and modules; no filesystem paths in party.Info (34-01) |
| T-34-31 | Denial of service | registry slow or down | medium | mitigate | 4 s timeout, TTL cache including failure caching, at most 4 concurrent lookups, degraded 200 responses (TestPluginsScreenSmoke/unavailable) |
| T-34-32 | Tampering (XSS) | registry names and descriptions in the SPA | medium | mitigate | rendered as text through Vue interpolation, no v-html; README HTML is not shown in the admin |
| T-34-33 | Server-side request forgery | plugins.registry_url | low | accept | operator-configured trusted setting (fetchguard TrustedMode by design), no redirects followed, size-capped; administrators cannot change it from the admin |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | no package is added (reka-ui and the build toolchain are already dependencies) |
</threat_model>
<verification>
- `go vet ./... && go test -short ./...`; `go test ./modules/cabana -run 'TestPluginsScreenSmoke|TestPhase09'`.
- `scripts/check-admin-openapi.sh --check`, `npm --prefix admin run test`, `npm --prefix admin run typecheck`, `scripts/check-admin-dist.sh`.
- `go test ./cmd/summer -run TestDocsTree` and `go run ./cmd/summer docs:build --check`.
</verification>
<success_criteria>
- The Plugins screen shows installed plugins with versions and updates and searches the marketplace with copyable install commands.
- Registry disabled or down never breaks the Installed tab.
- OpenAPI, SPA types and the embedded dist are regenerated and committed; no push or tag.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-05-SUMMARY.md` when done.
</output>
## Artifacts this phase produces
- Constants: `cabana.PermissionViewPlugins` (`backend.view_plugins`).
- Types: `cabana.PluginsOverview`, `cabana.RegistryState`, `cabana.InstalledPlugin`, `cabana.MarketplacePlugin`.
- Struct fields: `cabana.SettingsEntry.Path` (JSON `path`).
- Endpoints (admin API prefix): `GET /plugins`, `GET /plugins/marketplace?q=&category=`; swag operations `AdminPluginsInstalled`, `AdminPluginsMarketplace`.
- Handlers: `pluginsInstalled`, `pluginsMarketplace`.
- SPA: route `/system/plugins` (name `plugins`), `admin/src/views/PluginsView.vue`, `settingsPath` honours `entry.path`.
- Lang keys: `backend::lang.permissions.view_plugins` plus the Plugins screen strings (en, pl).
- Tests: `TestPluginsScreenSmoke` (installed, updates, describe_base, unlisted, unavailable, disabled, marketplace, cache), `admin/tests/views/PluginsView.test.ts`.
- Generated: admin/openapi/admin.json, admin/src/api/schema.d.ts, modules/boardwalk/dist.
- Config keys: reads `plugins.registry_url` (added in 34-04).

View File

@@ -0,0 +1,253 @@
---
phase: 34-plugin-marketplace
plan: 05
subsystem: admin
tags: [cabana, boardwalk, kiosk, reka-ui, plugins-screen, registry-cache, openapi]
requires:
- phase: 34-plugin-marketplace (34-01)
provides: "party.Info, party.Installed, party.Describe; kiosk version rules (BaseVersion, CompareVersions, NewestCompatible, Satisfies) and registry wire types"
- phase: 34-plugin-marketplace (34-04)
provides: "kiosk.Client (List, Versions), kiosk.NewClient, kiosk.RegistryURL, kiosk.ErrNotFound, plugins.registry_url"
provides:
- "cabana.PermissionViewPlugins (backend.view_plugins), declared by the admin's own screens with no role grant"
- "GET /plugins (cabana.PluginsOverview, cabana.InstalledPlugin, cabana.RegistryState) and GET /plugins/marketplace (cabana.MarketplaceResponse, cabana.MarketplacePlugin, cabana.MarketplaceMeta), swag operations AdminPluginsInstalled and AdminPluginsMarketplace"
- "cabana.SettingsEntry.Path (JSON path, omitempty): Settings → System → Plugins links the SPA route /system/plugins"
- "Server-side registry cache: 4 s per call, at most 4 concurrent version lookups, searches 5 min, releases 15 min, failures 1 min"
- "SPA: /system/plugins route, PluginsView (Installed and Marketplace tabs), settingsPath honours entry.path, settingsEntryForPath for the shell"
- "Rebuilt modules/boardwalk/dist"
affects: [34-06 tests and release ledger, every app's admin (new Settings → System entry for superusers)]
actuals:
tokens: 29000
tasks: 3
commits: 3
plan_head_before: 0418900122a1cba8952ec40a8f8294fc615eb6a8
plan_head_after: 678eac4637c26f4d57dfdaa8348fbd41e26f6616
tech-stack:
added: []
patterns:
- "A settings entry of the admin's own can open an SPA route (SettingsEntry.Path) instead of an admin controller; plugin entries are unchanged"
- "Registry calls from cabana run on context.WithoutCancel(request) plus a timeout, so a closed tab never caches a failure, and fetchguard.WithTransport-style context values still reach the client"
- "Degraded 200 answers: a registry failure is a status in the payload (registry.status unavailable), never a non-200"
key-files:
created:
- modules/cabana/plugins.go
- modules/cabana/plugins_smoke_test.go
- admin/src/views/PluginsView.vue
- admin/tests/views/PluginsView.test.ts
modified:
- modules/cabana/http.go
- modules/cabana/navigation.go
- modules/cabana/backend_screens.go
- modules/cabana/admin_openapi.go
- modules/cabana/security_coverage_test.go
- modules/cabana/token_routes_test.go
- modules/cabana/openapi_conformance_test.go
- modules/cabana/README.md
- modules/phrasebook/backend/lang/en/lang.yaml
- modules/phrasebook/backend/lang/pl/lang.yaml
- admin/openapi/admin.json
- admin/src/api/schema.d.ts
- admin/src/api/types.ts
- admin/src/app/router.ts
- admin/src/app/pageTitle.ts
- admin/src/state/useSettings.ts
- admin/src/components/shell/AppShell.vue
- admin/src/components/shell/Breadcrumbs.vue
- admin/src/components/shell/PluginRail.vue
- admin/tests/fixtures/lang.json
- modules/boardwalk/dist
- docs/backend/users-and-permissions.md
- docs/backend/admin-spa.md
- docs/plugins/marketplace.md
key-decisions:
- "The Plugins settings entry is added by Registry.Metadata only when the registry declares backend.view_plugins (the admin's own screens are compiled), no plugin already uses the settings code plugins, and the principal is allowed; a plugin's own plugins setting therefore never breaks"
- "The registry catalog is built once by cabana.Activate (service.catalog); a service assembled without Activate (tests) gets a fresh uncached catalog per call, because service is copied by value in existing tests and cannot hold a sync.Once"
- "Update rule is plugin:update's: NewestCompatible(versions, framework) above BaseVersion(installed); latestFramework names the minimum of the newest release when it is newer than both the compatible latest and the installed base"
- "A 404 for one plugin's versions is an answer (listed false, cached 15 min), not a registry failure"
- "Marketplace entries whose ID does not match the plugin ID shape are dropped, and only https icon URLs are passed through, since the ID ends up in a shell command the administrator copies"
- "Marketplace categories (for the filter) come from the cached unfiltered registry list and are sent in meta.categories"
- "Registry JSON fields in the admin API use lower camel case (updateAvailable, latestFramework, iconUrl, installCommand), as the plan asked"
patterns-established:
- "Admin screens of the framework that are not admin controllers: SPA route plus SettingsEntry.Path, shell helpers settingsEntryForPath"
requirements-completed: [SC-4, D-06, D-07, D-17, D-18, D-19]
coverage:
- id: D1
description: "GET /plugins lists installed plugins from party.Installed (party.Activated IDs for older builds) for superusers and holders of backend.view_plugins; 401/403 otherwise; Settings → System → Plugins entry with path only for allowed principals"
requirement: D-19
verification:
- kind: unit
ref: "modules/cabana/plugins_smoke_test.go#TestPluginsScreenSmoke/installed"
status: pass
- kind: unit
ref: "modules/cabana/security_coverage_test.go#TestPhase09PermissionMatrix (denied plugins-installed, plugins-marketplace)"
status: pass
human_judgment: false
- id: D2
description: "Update availability computed in Go with plugin:update's rule; describe versions compare by base tag; unlisted and local plugins get no badge"
requirement: D-07
verification:
- kind: unit
ref: "modules/cabana/plugins_smoke_test.go#TestPluginsScreenSmoke/updates,describe_base,unlisted"
status: pass
human_judgment: false
- id: D3
description: "Registry down, slow or disabled never breaks the Installed tab; disabled sends no request; cache windows hold"
requirement: D-18
verification:
- kind: unit
ref: "modules/cabana/plugins_smoke_test.go#TestPluginsScreenSmoke/unavailable,disabled,cache"
status: pass
human_judgment: false
- id: D4
description: "Marketplace search through cabana forwards q and category, validates them like the registry (400 invalid_query), marks installed and incompatible plugins and returns the install command"
requirement: SC-4
verification:
- kind: unit
ref: "modules/cabana/plugins_smoke_test.go#TestPluginsScreenSmoke/marketplace"
status: pass
human_judgment: false
- id: D5
description: "OpenAPI and SPA types regenerated; contract, token-class and conformance inventories include both routes"
requirement: D-17
verification:
- kind: other
ref: "scripts/check-admin-openapi.sh --check"
status: pass
- kind: unit
ref: "modules/cabana#TestPhase09ContractInventory, TestTokenRouteGates, TestPhase10ConformanceInventory"
status: pass
- kind: integration
ref: "modules/cabana/openapi_conformance_test.go#TestPhase10OpenAPIConformance/GET_/plugins, GET_/plugins/marketplace (Postgres)"
status: pass
human_judgment: false
- id: D6
description: "PluginsView: Installed rows, update badges with copyable update command, Marketplace tab (debounced search, category select, cards with markers and copyable install command, no install button), hidden tab and badges when disabled, unavailable notice, clipboard fallback"
requirement: SC-4
verification:
- kind: unit
ref: "admin/tests/views/PluginsView.test.ts (9 tests)"
status: pass
human_judgment: false
- id: D7
description: "Embedded admin rebuilt and committed; dist gate passes"
verification:
- kind: other
ref: "scripts/check-admin-dist.sh; go test ./modules/boardwalk"
status: pass
human_judgment: false
- id: D8
description: "Visual layout of the Plugins screen (table, badges, marketplace cards) in light and dark themes, and a real search against the deployed registry"
verification: []
human_judgment: true
rationale: "Styling and the live summercms.io registry answer are not covered by jsdom tests; needs a look in a browser on a built app"
duration: 28min
completed: 2026-10-29
status: complete
---
# Phase 34 Plan 05: Admin Plugins screen Summary
**Settings → System → Plugins (backend.view_plugins) lists the installed plugins with versions and sources, marks updates computed server-side with plugin:update's rule, and searches the registry through cabana with copyable `summer plugin:install` / `summer plugin:update` commands, cached and degrading to a notice when the registry is down or disabled.**
## Performance
- **Duration:** about 28 min of execution (started 2026-10-29T17:54:17Z, completed 2026-10-29T18:21:42Z)
- **Tasks:** 3
- **Files modified:** 33 (4 created, plus the rebuilt dist)
## Accomplishments
- `cabana.PermissionViewPlugins` (`backend.view_plugins`) on the System tab of the permission editor, granted to no role; superusers pass.
- `GET /plugins` and `GET /plugins/marketplace` in the backend group, swag-annotated, in every route inventory (permission matrix, contract, token classes, Postgres conformance).
- `cabana.SettingsEntry.Path`: the Plugins entry opens `/system/plugins`; the SPA's settings index, settings panel, rail highlight, breadcrumbs and page title handle it.
- Registry catalog in cabana: lazy `kiosk.Client` from `plugins.registry_url`, 4 s per call on a detached context, at most 4 version lookups at once, TTL cache with failure caching, 404 treated as "not listed".
- PluginsView with reka-ui Tabs: Installed (name or ID, description, version, source, update badge, command copy) and Marketplace (debounced search, category select, cards with Installed / Needs framework markers and the install command). No install button anywhere, all server text rendered as text.
- `modules/boardwalk/dist` rebuilt in its own commit; `scripts/check-admin-dist.sh` passes.
## Task Commits
1. **Task 1: read-only Plugins screen with installed plugins (tracer)**: `c4b1ac4` (feat)
2. **Task 2: plugin updates and marketplace search**: `7e8a193` (feat)
3. **Task 3: rebuild the embedded admin**: `678eac4` (build)
**Plan metadata:** the docs commit containing this SUMMARY.
## Tracer feedback gate
Task 1's `<verify>` was re-run end to end after its commit (TestPluginsScreenSmoke/installed, the Phase 09 inventories, `check-admin-openapi.sh --check`, the PluginsView spec, typecheck, `go vet ./...`, `go test -short ./...`, and the full Docker cabana suite). All passed before Task 2 expanded the slice.
## Decisions Made
See `key-decisions` in the frontmatter.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Two more route inventories**
- **Found during:** Task 1
- **Issue:** `TestTokenRouteGates` (token_routes_test.go) and `TestPhase10ConformanceInventory` / `TestPhase10OpenAPIConformance` (openapi_conformance_test.go) also list every admin route and failed on GET /plugins.
- **Fix:** Both routes classified `allows_protect` (they check `cabana.Allows`, so a scoped token passes when its scope covers the code); conformance cases for both routes. The conformance admin gets `backend.view_plugins` in its own permissions and the conformance app sets `plugins.registry_url: ""`, so the Postgres test never calls a real registry.
- **Commits:** c4b1ac4, 7e8a193
**2. [Rule 2 - Missing critical] Shell integration of a path-based settings entry**
- **Found during:** Task 1
- **Issue:** The settings panel, rail highlight, breadcrumbs and page title only knew singleton forms and controller links; on `/system/plugins` the admin would lose its Settings context.
- **Fix:** `settingsEntryForPath` in useSettings.ts, used by AppShell.vue, PluginRail.vue; Breadcrumbs.vue and pageTitle.ts name the screen.
- **Files modified:** admin/src/state/useSettings.ts, admin/src/components/shell/{AppShell,Breadcrumbs,PluginRail}.vue, admin/src/app/pageTitle.ts
- **Commit:** c4b1ac4
**3. [Rule 2 - Missing critical] Command and icon hardening**
- **Found during:** Task 2
- **Issue:** Registry IDs are third-party text that ends up in a command an administrator pastes into a shell.
- **Fix:** Marketplace entries (and update lookups) only for IDs matching `^[a-z][a-z0-9]*\.[a-z][a-z0-9]*$`; only absolute https icon URLs are passed through, rendered with `referrerpolicy="no-referrer"`.
- **Commit:** 7e8a193
**4. [Rule 3 - Blocking] sync.Once in service breaks go vet**
- **Found during:** Task 2
- **Issue:** Existing tests copy `service` by value (copylocks).
- **Fix:** `cabana.Activate` builds the catalog (`service.catalog`); without it a fresh uncached catalog is used per call.
- **Commit:** 7e8a193
**5. [Plan adjustment] Names and files beyond the plan's lists**
- Extra exported names: `cabana.MarketplaceResponse`, `cabana.MarketplaceMeta` (the marketplace answer with registry state, total and categories, following the `FieldTypesResponse` pattern), `cabana.AdminPluginsMarketplace` is as planned.
- Extra files: `admin/src/api/types.ts` (type aliases), `admin/tests/fixtures/lang.json` (hand-kept Polish fixture), the shell files above, token_routes_test.go and openapi_conformance_test.go.
- No `view_plugins_comment` permission-editor comment: the acceptance criterion expects exactly one `view_plugins` line per lang file, so the comment line used by the other two admin permissions was left out.
**6. [Process] TDD order**
- Task 2's Go behavior subtests were written first and failed to compile on the missing `MarketplaceResponse`, `pluginsMarketplace` and `pluginCatalog` (RED), then the implementation made all eight pass. The SPA specs for Task 2 were written after the view and passed on the first run. One commit per task, as the Execution units table requires.
---
**Total deviations:** 6 (2 Rule 2, 2 Rule 3, 1 plan adjustment, 1 process note). **Impact:** no contract change outside the plan; existing settings entries and plugins are untouched (`path` is omitted from their JSON).
## Issues Encountered
- One `go test -short ./...` run failed in `internal/build` on a missing Go build-cache file (`open ~/.cache/go-build/...: no such file or directory`), most likely another session trimming the shared cache; the immediate rerun passed with no change.
- `gofmt -l modules/cabana` lists pre-existing test files (account_tokens_test.go, field_trigger_smoke_test.go, token_postgres_smoke_test.go, token_routes_test.go, token_scopes_test.go); the new code is gofmt-clean. Left untouched (scope boundary).
- `npm --prefix admin run test:browser` passes (2 files); it has no view coverage, so it does not exercise the new screen.
## User Setup Required
None. Grant `backend.view_plugins` to a role or administrator to give non-superusers the screen.
## Next Phase Readiness
- 34-06 can add unit coverage on top of TestPluginsScreenSmoke and PluginsView.test.ts.
- Open for human review (coverage D8): the screen's look in both themes and a live search against the deployed summercms.io registry.
## Self-Check: PASSED
- Files exist: modules/cabana/plugins.go, modules/cabana/plugins_smoke_test.go, admin/src/views/PluginsView.vue, admin/tests/views/PluginsView.test.ts.
- Commits c4b1ac4, 7e8a193, 678eac4 are in history; `git rev-list --count 0418900..HEAD` = 3 before this docs commit; `git show --stat 678eac4` lists only modules/boardwalk/dist paths.
- `go vet ./...`, `go test -short ./...`, `go test ./modules/cabana` (Docker), `go test ./modules/boardwalk`, `summer docs:build --check`, `go test ./cmd/summer -run 'TestDocsTree|TestCommandsDocumented'`, `npm --prefix admin run test` (1614 tests), `typecheck`, `test:browser`, `scripts/check-admin-openapi.sh --check` and `scripts/check-admin-dist.sh` pass.
- Acceptance greps of Tasks 1-3 re-run: permission constant, both routes, swag router, `/system/plugins`, `entry.path`, two `view_plugins` lines, `kiosk.NewestCompatible`/`kiosk.BaseVersion`, `navigator.clipboard`, no `summercms.io` in admin/src.

View File

@@ -0,0 +1,329 @@
---
phase: 34-plugin-marketplace
plan: 06
type: execute
wave: 5
depends_on: ["34-01", "34-02", "34-03", "34-04", "34-05"]
files_modified:
- scripts/check-phase34.sh
- modules/kiosk/manifest_test.go
- modules/kiosk/identity_test.go
- modules/kiosk/derive_test.go
- modules/kiosk/version_test.go
- modules/kiosk/client_test.go
- modules/kiosk/example_test.go
- modules/party/info_test.go
- internal/build/plugindirs_test.go
- internal/build/install_test.go
- internal/build/manifest_append_test.go
- cmd/summer/plugin_commands_test.go
- modules/cabana/plugins_test.go
- admin/tests/views/PluginsView.test.ts
- admin/tests/state/useSettings.test.ts
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/query_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry_api_test.go
- ../sm-summercmsio-app/scripts/test_changelog_post.py
- ../sm-summercmsio-app/vue-summercmsio-app/tests/marketplace.test.ts
- .planning/phases/34-plugin-marketplace/34-release-log.md
- .planning/phases/34-plugin-marketplace/34-VALIDATION.md
autonomous: true
requirements: [SC-5, SC-1, SC-2, SC-3, SC-4, D-02, D-03, D-04, D-05, D-07, D-08, D-09, D-10, D-12, D-13, D-14, D-15, D-16, D-17, D-18, D-19]
estimate:
tokens: 180000
raw_tokens: 180000
tasks: 5
confidence: low
must_haves:
truths:
- "scripts/check-phase34.sh runs every Phase 34 check across the framework, the plugin repositories and the summercms.io repositories by stage, fails closed on a missing repository or a missing required test, and its self-test detects every planted failure (SC-5, Wave 0 of 34-VALIDATION.md)"
- "The new framework code has unit tests: plugin.yaml derivation for literal, same-package, cross-package and other-module constants and their error messages, README extraction and overrides, check/stale detection, validation, version rules including git describe bases and pseudo-version minimums, the registry client, party.Describe, plugin directory and version resolution, effective framework version, install resolution, prompts and offline rules, summer.yaml comment preservation, and the cabana Plugins endpoints (SC-5; D-02..D-05, D-07..D-10, D-12, D-17..D-19)"
- "The summercms.io code has unit tests: ingest rules (tags, nested manifests, module and ID identity, digest skip, caps), API shapes, query validation and caching headers, the ingest endpoint's auth, the release script's new helpers and refusals, and the marketplace page utilities (SC-5; D-13..D-16)"
- "Unit tests never write into a sibling repository or the developer's module cache: fixtures live in t.TempDir() and module downloads use a temporary GOMODCACHE"
- "34-release-log.md lists, in release order, what v0.6.0 of the framework carries, every plugin, site plugin, vue app and app commit waiting for push or tag, the pending submodule pointer bumps, the app regenerations of main.go and plugins.gen.go, the summercms.io deploy steps and the changelog posts; nothing is pushed, tagged or deployed by this plan (memory: tag only at phase completion, on the default branch)"
- "34-VALIDATION.md's per-task verification map is filled for every task of plans 34-01..34-06 and its Wave 0 items are checked"
artifacts:
- path: "scripts/check-phase34.sh"
provides: "phase gate (tracer)"
contains: "--self-test"
- path: "modules/kiosk/identity_test.go"
provides: "ID reader unit tests"
contains: "func TestReadIdentity"
- path: "internal/build/install_test.go"
provides: "resolution unit tests"
contains: "func TestResolveInstall"
- path: "modules/cabana/plugins_test.go"
provides: "Plugins endpoint unit tests"
contains: "func TestPluginsEndpoints"
- path: ".planning/phases/34-plugin-marketplace/34-release-log.md"
provides: "release ledger"
contains: "v0.6.0"
key_links:
- from: "scripts/check-phase34.sh"
to: "every Phase 34 test"
via: "stages run the tests by required name and fail when a name is missing from the go test -json output"
pattern: "TestManifestSmoke|TestInstallSmoke|TestPluginsScreenSmoke|TestRegistrySmoke"
---
## Phase Goal
People browse the marketplace, install plugins with one command and see them in the admin. This last plan proves the phase with unit tests across every repository it touched (project rule: unit tests are the last plan) and writes down the user-gated release.
<objective>
- `scripts/check-phase34.sh` (Wave 0): the phase gate over all repositories, by stage.
- Unit tests for kiosk, party, internal/build, cmd/summer, cabana, the admin view, the summercms.io site plugin, the release script and the marketplace utilities (SC-5).
- `34-release-log.md`: the release order and every pending push, tag, pointer bump, regeneration, deploy step and changelog post for Jakub.
- `34-VALIDATION.md`: per-task map and Wave 0 filled.
Output: test commits in each repository (framework, site plugin, app, vue app), the gate script commit, and one planning-docs commit. Nothing pushed, tagged or deployed.
</objective>
<execution_context>
@~/.claude/msd-core/workflows/execute-plan.md
@~/.claude/msd-core/templates/summary.md
</execution_context>
<context>
@.planning/phases/34-plugin-marketplace/34-RESEARCH.md
@.planning/phases/34-plugin-marketplace/34-VALIDATION.md
@.planning/phases/34-plugin-marketplace/34-01-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-02-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-03-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-04-SUMMARY.md
@.planning/phases/34-plugin-marketplace/34-05-SUMMARY.md
@CLAUDE.md
<interfaces>
Smoke tests already in place (plans 01-05): TestManifestSmoke and TestPluginInfoSmoke and TestAddPluginConstID (framework), TestPluginManifest (every plugin repository), TestRegistrySmoke (site plugin, Docker), marketplace SSR smoke (`pnpm test:marketplace`), TestInstallSmoke (framework, non-short subtests apply installs), TestPluginsScreenSmoke and admin/tests/views/PluginsView.test.ts.
Gate template: scripts/check-phase32.sh (stage engine: usage, detect_go, go_named required-name checks over go test -json, run_* stages, run_self_test planting, marker and additive stages via scripts/apisurface against a tag, missing-repository failure).
Framework tag base: v0.5.3 (newest tag before this phase). Consuming application names the framework must not contain: grzyby, fonoteka, plytarium, summercmsio, sm-demo-app, sm-bm-app (summercms.io, the framework's own site and default registry, is allowed).
Docker-backed tests skip under -short; run them through `sudo -u golem` if the socket is denied.
</interfaces>
</context>
## Execution units and resume points
- Each task commits per repository, staging explicit paths; test-only commits use `test:` subjects. Check `git status --short` in each repository first and leave other sessions' edits alone. No co-author tag.
- Resume check: `git -C <repo> log --format=%s | grep -Fx '<subject>'`.
| Task | Commit subjects (repository) | Resume point |
|------|------------------------------|--------------|
| 1 | `test: phase 34 gate script` (framework) | `--self-test` passes |
| 2 | `test(kiosk): manifest, identity, version and client unit tests`; `test(build): plugin dirs, install resolution and summer.yaml edits`; `test(summer): plugin command prompts` (framework) | --go stage passes |
| 3 | `test(cabana): Plugins screen endpoints`; `test(admin): PluginsView and settings paths` (framework) | --admin stage passes |
| 4 | `test: registry ingest, queries and API` (site); `test: changelog-post manifest and ingest helpers` (app); `test: marketplace utilities` (vue) | --site stage passes |
| 5 | `docs(34): release ledger and validation map` (framework, planning docs) | ledger committed |
<tasks>
<task type="tracer">
<name>Task 1: End-to-end "one command runs every Phase 34 check across all repositories" — the gate script over the existing smoke tests</name>
<files>scripts/check-phase34.sh</files>
<read_first>
- scripts/check-phase32.sh (whole file: stage engine, go_named, self-test planting, marker, additive, missing-repository failure)
- scripts/apisurface/main.go
- .planning/phases/34-plugin-marketplace/34-VALIDATION.md and the five plan SUMMARYs (test names and commands that worked)
</read_first>
<action>
Create `scripts/check-phase34.sh` from check-phase32.sh's engine, labelled Phase 34, with stages (each a flag; `--all` runs them in this order; no argument prints usage listing every flag and exits 2):
- `--self-test`: plants a failing go test name, a missing required test name, a marker hit in a scratch repository, an additive removal and a missing repository, and requires each to be detected.
- `--go`: `go vet ./...`, `go test -short ./...`, plus required names TestManifestSmoke, TestPluginInfoSmoke, TestAddPluginConstID, TestPluginsScreenSmoke and the unit tests Task 2 and 3 add (the list is a variable GO_TESTS extended by later tasks); `cd examples/hello && go test ./...`.
- `--docker`: Docker host only (NOT RUN otherwise, which fails under --all unless PHASE34_ALLOW_NO_DOCKER=1): `go test ./...` in the framework including TestInstallSmoke's non-short subtests, and the site plugin's TestRegistrySmoke.
- `--plugins`: for each of the 20 sibling sm-*-plugin repositories: `go vet ./...`, `go test -short ./...`, TestPluginManifest by required name, and `summer plugin:manifest --check` (built from this checkout into a temp dir) for each plugin.yaml directory; sm-chatbots-plugin may be listed in PHASE34_PENDING_MANIFESTS when 34-02 recorded the F8 skip.
- `--site`: in ../sm-summercmsio-app: site plugin `go vet` and `go test -short`, app `go vet ./... && go test ./...`, `python3 -B scripts/test_changelog_post.py`, `scripts/check-deploy.sh` when nginx is available, and in vue-summercmsio-app `pnpm test`, `pnpm build:changelog`, `pnpm test:changelog`, `pnpm test:marketplace`.
- `--admin`: `npm --prefix admin run test`, `npm --prefix admin run typecheck`, `scripts/check-admin-openapi.sh --check`, `scripts/check-admin-dist.sh`.
- `--docs`: TestDocsTree, TestCommandsDocumented and `go run ./cmd/summer docs:build --check`.
- `--marker`: the lines this phase added since v0.5.3 to non-test Go files, READMEs and docs under modules/, cmd/, internal/ and docs/ name no consuming application (word list in interfaces).
- `--additive`: apisurface of every framework package changed since v0.5.3 shows no removed or changed exported element (kiosk is new; party, cabana and fetchguard-users only gain elements).
A stage whose repository or directory is missing fails with `missing <path>`. Commit as listed in Execution units.
</action>
<verify>
<automated>bash scripts/check-phase34.sh --self-test</automated>
<fails_when>non-zero exit, or a planted case reported as undetected</fails_when>
<automated>bash scripts/check-phase34.sh --go --docs --marker --additive</automated>
<fails_when>non-zero exit, or a "FAIL", "missing " or marker hit line</fails_when>
<automated>bash scripts/check-phase34.sh --plugins --admin</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `bash scripts/check-phase34.sh; echo $?` prints a usage naming --self-test, --go, --docker, --plugins, --site, --admin, --docs, --marker, --additive, --all and exits 2
- `grep -c "missing " scripts/check-phase34.sh` is at least 1
- `grep -n "TestPluginManifest" scripts/check-phase34.sh` prints at least one line
</acceptance_criteria>
<done>The phase has one gate that exercises every repository through the smoke tests plans 01-05 left behind.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Unit tests for kiosk, party, internal/build and the plugin commands</name>
<files>modules/kiosk/manifest_test.go, modules/kiosk/identity_test.go, modules/kiosk/derive_test.go, modules/kiosk/version_test.go, modules/kiosk/client_test.go, modules/kiosk/example_test.go, modules/party/info_test.go, internal/build/plugindirs_test.go, internal/build/install_test.go, internal/build/manifest_append_test.go, cmd/summer/plugin_commands_test.go, scripts/check-phase34.sh</files>
<read_first>
- modules/kiosk/*.go and their smoke tests; modules/party/info.go; internal/build/{plugindirs,install,source,update,manifest,scaffold}.go; cmd/summer/main.go (plugin:* commands)
- .planning/phases/34-plugin-marketplace/34-RESEARCH.md (Validation Architecture rows for SC-1, SC-3, D-06/07)
- cmd/summer/main_test.go (how commands are run with bonfire.Call or a test root)
</read_first>
<behavior>
- TestReadIdentity: table of fixtures (literal, same-file const, const in another file, chained const, cross-package same module, named import alias, other module via replace, Requires nil/empty/mixed literals and consts) and refusals (function call, var, concatenation, missing ID method, two ID methods returning different values) with the function named in each error
- TestDerive: README H1/summary extraction (inline code, links and emphasis flattened to text, multi-line paragraph collapsed), missing README or H1 errors, H1 == ID needs --name, override set/keep/clear, framework missing or v0.0.0 errors, soft dependency empty minimum, same-module dependency empty minimum, pseudo-version warning
- TestManifestFormat: Marshal is byte-stable and ordered, requires sorted, Parse round-trips, unknown field and newer schema refused, Validate table (ID, module, package, versions)
- TestCheck: missing, stale (first differing line in the message), fresh; CheckT calls Fatalf exactly once on stale and never on fresh (fake TB)
- TestVersions: ValidVersion, CompareVersions, BaseVersion, Satisfies (including pseudo-version minimums), NewestCompatible edge cases (empty list, all incompatible, unsorted input)
- TestRegistryClient: List/Plugin/Versions decode, query escaping, 404 → ErrNotFound, 500 with error envelope → error carrying the code, oversized body refused, redirect not followed, disabled URL → ErrRegistryDisabled
- TestDescribe (party): Describe publishes Installed; nil app error; a second Describe replaces the first
- TestPluginDirs and TestEffectiveFramework: go list JSON fixtures parsed into module/submodule/local sources; describe only for a dir that is its own repository top level; no dirty suffix; framework replaced in go.mod vs go.work vs not replaced; git missing falls back with a warning
- TestResolveInstall: newest compatible, pin, pin incompatible names the framework, no compatible version names the minimum framework, transitive closure order, dependency minimum above newest compatible errors, installed-too-old hint, cycle, offline and disabled refusals, invalid registry strings refused
- TestAppendManifestPlugins: comments and blank lines preserved, indentation matched, missing plugins block appended, invalid result restores the original bytes
- TestPluginCommands (cmd/summer): plugin:install without --yes off a terminal errors naming --yes; --offline ID install errors; plugin:manifest --check exit status and output on missing and stale files; --check with --name refused
</behavior>
<action>
Write the tests listed in the behavior block in the files named (unit level: fixtures in t.TempDir(), fake registries through httptest or fetchguard.WithTransport, go list output as JSON fixtures where running go is not the point; tests that need git or go skip when the binary is missing). Add a runnable `Example` for kiosk.Marshal and kiosk.NewestCompatible in example_test.go with Output comments (docs examples stay runnable). Fix any defect the tests expose in the production code in the same commit as the test that found it, and note it in the SUMMARY. Add the new test names to GO_TESTS in scripts/check-phase34.sh. Commit as listed in Execution units.
</action>
<verify>
<automated>go test -short ./modules/kiosk ./modules/party ./internal/build ./cmd/summer -count=1 2>&1 | tail -6</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
<automated>go test -short ./modules/kiosk ./internal/build -run 'TestReadIdentity|TestDerive|TestManifestFormat|TestCheck|TestVersions|TestRegistryClient|TestPluginDirs|TestEffectiveFramework|TestResolveInstall|TestAppendManifestPlugins' -count=1 -v 2>&1 | grep -c '^--- PASS'</automated>
<fails_when>a count below 10, or non-zero exit</fails_when>
<automated>bash scripts/check-phase34.sh --go</automated>
<fails_when>non-zero exit or a "FAIL" or "missing" line</fails_when>
</verify>
<acceptance_criteria>
- every test function named in the behavior block exists (`grep -rn "func TestReadIdentity\|func TestResolveInstall\|func TestAppendManifestPlugins\|func TestPluginCommands" modules internal cmd` prints at least four lines)
- `go test -cover ./modules/kiosk` reports coverage of at least 70%
- `git -C ../sm-mfa-plugin status --short` shows no change made by the tests
</acceptance_criteria>
<done>The framework side of the marketplace is covered by fast unit tests that pin every rule the decisions set.</done>
</task>
<task type="auto" tdd="true">
<name>Task 3: Unit tests for the cabana Plugins endpoints and the admin view</name>
<files>modules/cabana/plugins_test.go, admin/tests/views/PluginsView.test.ts, admin/tests/state/useSettings.test.ts, scripts/check-phase34.sh</files>
<read_first>
- modules/cabana/plugins.go and plugins_smoke_test.go (34-05)
- admin/src/views/PluginsView.vue, admin/src/state/useSettings.ts, admin/tests/helpers.ts
</read_first>
<behavior>
- TestPluginsEndpoints: unauthenticated 401, no permission 403, permission 200, superuser 200; settings entry present only when allowed and carrying path /system/plugins; update rule table (exact tag, describe base, local, unlisted, newer incompatible only, registry error); cache hit and expiry (injected clock); concurrency bound of 4 (fake registry counting in-flight calls); marketplace query validation and installed/compatible flags; disabled registry makes no call
- PluginsView: both tabs render; Marketplace tab hidden when registry is disabled; search debounce sends one request; category select filters; copy writes the exact command and shows the copied state; clipboard missing shows the fallback; registry unavailable notice; update badge with the update command; names fall back to IDs
- useSettings.settingsPath prefers entry.path, then controller, then the singleton form
</behavior>
<action>
Write the tests in the behavior block; inject the clock and the registry through the unexported seams 34-05 created (add a minimal seam if missing, without changing exported API). Add the Go test name to GO_TESTS and the vitest files to the --admin stage. Commit as listed in Execution units.
</action>
<verify>
<automated>go test -short ./modules/cabana -run 'TestPluginsEndpoints|TestPluginsScreenSmoke' -count=1 -v 2>&1 | grep -E '^(--- |FAIL|ok|PASS)' | tail -20</automated>
<fails_when>a "FAIL" line, "no tests to run", or no "--- PASS: TestPluginsEndpoints" line</fails_when>
<automated>npm --prefix admin run test -- PluginsView useSettings 2>&1 | tail -6</automated>
<fails_when>non-zero exit, a "FAIL" line, or "No test files found"</fails_when>
<automated>bash scripts/check-phase34.sh --admin</automated>
<fails_when>non-zero exit or a "FAIL" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "func TestPluginsEndpoints" modules/cabana/plugins_test.go` prints one line
- `grep -c "it(\|test(" admin/tests/views/PluginsView.test.ts` is at least 9
- `bash scripts/check-phase34.sh --additive` passes after this task's commit (any seam added for the tests is unexported)
</acceptance_criteria>
<done>The admin side of the marketplace is covered by Go and vitest unit tests.</done>
</task>
<task type="auto" tdd="true">
<name>Task 4: Unit tests for the summercms.io registry, the release script and the marketplace utilities</name>
<files>../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry/query_test.go, ../sm-summercmsio-app/plugins/golem15/summercms/registry_api_test.go, ../sm-summercmsio-app/scripts/test_changelog_post.py, ../sm-summercmsio-app/vue-summercmsio-app/tests/marketplace.test.ts, scripts/check-phase34.sh</files>
<read_first>
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/*.go, controllers/api/registry.go, registry_smoke_test.go, testmain_test.go (34-03)
- ../sm-summercmsio-app/scripts/changelog-post.py and scripts/test_changelog_post.py
- ../sm-summercmsio-app/vue-summercmsio-app/changelog/app/utils/marketplace.ts and tests/changelog.test.ts (node --test style)
</read_first>
<behavior>
- ingest (unit, no Docker where possible): repository URL normalization and module derivation (https only; credentials, query, fragment refused), strict tag filter, plugin.yaml path filter, tags digest stability, blob caps enforced, module mismatch and ID ownership decisions, skipped-tag notes in last_error, git missing error, allowedProtocols default https
- queries and API (Docker where they need Postgres): LIKE escaping of % and _, ordering, category regex, ETag stable for equal bodies and 304 on match, 404 and 400 envelopes, versions newest first, icon_url and screenshots URLs, no admin-only fields in any response
- ingest endpoint: 401, 403 (no scope, wrong permission), 404 uncurated, 202 queued once for two rapid calls on the same repository
- changelog-post.py: refusal when HEAD is not the tag, when the tree is dirty, when no plugin.yaml is tracked, when the manifest check fails (check runner stubbed); framework releases skip both; ingest call skipped on dry runs and its 401/403/404/network outcomes are warnings
- marketplace utilities: pluginPath and idFromRoute round-trip, invalid segments refused, installCommand exact text
</behavior>
<action>
Write the tests in the behavior block (site plugin tests reuse testmain_test.go's container and skip under -short where they need Postgres; Python tests stub subprocess and network calls the way the existing tests stub `call`; the vue test imports the utilities with node --test like the existing tests). Fix defects found in the same repository's commit and record them in the SUMMARY. Wire the new tests into the --site stage by required name. Commit per repository as listed in Execution units; do not commit submodule gitlinks in sm-summercmsio-app.
</action>
<verify>
<automated>go -C ../sm-summercmsio-app/plugins/golem15/summercms test -count=1 ./... 2>&1 | tail -6</automated>
<fails_when>non-zero exit, a "FAIL" line, or "--- SKIP" for the registry tests on a Docker host</fails_when>
<automated>cd ../sm-summercmsio-app && python3 -B scripts/test_changelog_post.py 2>&1 | tail -4 && cd vue-summercmsio-app && pnpm test 2>&1 | tail -4</automated>
<fails_when>non-zero exit, a "FAILED" line, or a "not ok" line</fails_when>
<automated>bash scripts/check-phase34.sh --site</automated>
<fails_when>non-zero exit, or a "FAIL" or "missing" line</fails_when>
</verify>
<acceptance_criteria>
- `grep -n "func Test" ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest_test.go` prints at least three lines
- `grep -c "def test_" ../sm-summercmsio-app/scripts/test_changelog_post.py` grew by at least six compared with 34-03's version
- `grep -n "installCommand" ../sm-summercmsio-app/vue-summercmsio-app/tests/marketplace.test.ts` prints at least one line
</acceptance_criteria>
<done>The registry, its API, the release hooks and the marketplace utilities are unit-tested in their own repositories.</done>
</task>
<task type="auto">
<name>Task 5: Release ledger for Jakub and the filled validation map</name>
<files>.planning/phases/34-plugin-marketplace/34-release-log.md, .planning/phases/34-plugin-marketplace/34-VALIDATION.md</files>
<read_first>
- the five plan SUMMARYs (commit SHAs, pending pointer bumps, skips, test names)
- .planning/phases/32-seo-foundation/32-06-release-log.md (ledger format)
- ../sm-summercmsio-app/DEPLOY.md (deploy and changelog posting) and CLAUDE.md (changelog post rules)
- .planning/phases/34-plugin-marketplace/34-VALIDATION.md
</read_first>
<action>
Write `34-release-log.md` with sections: "Planned contents" (framework v0.6.0: the commits of 34-01, 34-04, 34-05, 34-06 by subject and SHA; each plugin repository's new commit and its proposed next tag, a minor or patch bump chosen from its own log since its last tag; sm-summercmsio-plugin and vue-summercmsio-app commits); "Release order" (push framework master, tag v0.6.0 on master, changelog post; for each plugin in dependency order: verify `summer plugin:manifest --check`, tag, push, changelog post through `changelog-post.py publish … --repo`, which now checks the manifest and triggers ingestion; then sm-summercmsio-plugin and vue-summercmsio-app pushes; then each app: framework `go get` to v0.6.0, plugin pointer bumps as separate commits after each plugin push, `summer build` to regenerate main.go and plugins.gen.go committed separately (research F10), release build); "summercms.io deploy" (git on rome, migrate, work_in_serve, nginx and supervisor configs, `check-deploy.sh`, add the fourteen launch repositories, mint the `registry` token, first ingest, curl the API, visual check of /marketplace); "Rules" (never move a tag: proxy and sumdb cache it forever, research Pitfall 7; tags only on the default branch; every tag gets its changelog post the same day); and an empty "Executed steps" table. Fill 34-VALIDATION.md's per-task verification map with one row per task of plans 34-01..34-06 (task ID written as 34-0N-TM, for example 34-03-T2; plan, wave, requirement or decision, threat ref, test type, automated command, file exists, status) and tick the Wave 0 items; leave `nyquist_compliant` and `status` to /msd-validate-phase. Commit both as one planning-docs commit with the subject from Execution units.
</action>
<verify>
<automated>grep -c "^| 34-0" .planning/phases/34-plugin-marketplace/34-VALIDATION.md</automated>
<fails_when>a count below 26 (one row per task of the six plans: 5+5+4+4+3+5), or non-zero exit</fails_when>
<automated>grep -n "v0.6.0\|Release order\|Executed steps\|never move" .planning/phases/34-plugin-marketplace/34-release-log.md</automated>
<fails_when>non-zero exit, or fewer than four matching lines</fails_when>
</verify>
<acceptance_criteria>
- 34-release-log.md names every repository listed in the SUMMARYs with a pending action, and the fourteen launch repositories
- 34-VALIDATION.md has no remaining "_filled by the planner/executor" placeholder row
- no tag or push was made (`git tag --points-at HEAD` prints nothing)
</acceptance_criteria>
<done>Jakub has an exact, ordered release list, and the validation map reflects every task's automated check.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| gate script → sibling repositories | runs tests and read-only checks in other repositories |
| tests → developer environment | module cache, sibling checkouts, Docker |
## STRIDE Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|-----------|----------|-----------|----------|-------------|-----------------|
| T-34-34 | Tampering | tests writing into sibling repositories or the module cache | medium | mitigate | fixtures in t.TempDir(), temporary GOMODCACHE for downloads, acceptance check that sibling worktrees stay clean |
| T-34-35 | Repudiation | a gate that passes because a test silently did not run | medium | mitigate | required test names checked in go test -json output; Docker stages report NOT RUN and fail under --all unless explicitly allowed; self-test plants each failure |
| T-34-36 | Information disclosure | release ledger | low | mitigate | the ledger names repositories, SHAs and steps only; no tokens, hosts' secrets or token file contents |
| T-34-SC | Tampering | npm/pip/cargo installs | high | accept | no package is added |
</threat_model>
<verification>
- `bash scripts/check-phase34.sh --all` passes on a Docker host (or with PHASE34_ALLOW_NO_DOCKER=1 and the Docker stage run separately through sudo -u golem).
- Every repository touched by the phase has its tests green.
</verification>
<success_criteria>
- Unit tests cover the rules of D-02..D-19 in every repository (SC-5).
- The gate script and the release ledger exist; VALIDATION's map is filled.
- No push, tag or deploy.
</success_criteria>
<output>
Create `.planning/phases/34-plugin-marketplace/34-06-SUMMARY.md` when done.
</output>
## Artifacts this phase produces
- Script: `scripts/check-phase34.sh` with `--self-test`, `--go`, `--docker`, `--plugins`, `--site`, `--admin`, `--docs`, `--marker`, `--additive`, `--all`; env `PHASE34_ALLOW_NO_DOCKER`, `PHASE34_PENDING_MANIFESTS`.
- Tests: `TestReadIdentity`, `TestDerive`, `TestManifestFormat`, `TestCheck`, `TestVersions`, `TestRegistryClient`, `TestDescribe`, `TestPluginDirs`, `TestEffectiveFramework`, `TestResolveInstall`, `TestAppendManifestPlugins`, `TestPluginCommands`, `TestPluginsEndpoints`, PluginsView and useSettings vitest specs, site plugin registry unit tests, changelog-post unittest cases, `tests/marketplace.test.ts`; runnable examples for `kiosk.Marshal` and `kiosk.NewestCompatible`.
- Files: `.planning/phases/34-plugin-marketplace/34-release-log.md`; filled `34-VALIDATION.md` map.
- Config keys, CLI commands, exported types: none new.

View File

@@ -0,0 +1,202 @@
---
phase: 34-plugin-marketplace
plan: 06
subsystem: testing
tags: [phase-gate, unit-tests, kiosk, install, cabana, admin, registry, changelog-post, marketplace, release-ledger]
status: complete
requires:
- phase: 34-plugin-marketplace (34-01..34-05)
provides: "kiosk, party.Describe, plugin:manifest/install/update, cabana Plugins endpoints and PluginsView, the summercms.io registry, release script hooks and /marketplace pages, the smoke tests and the 34-02 push blockers and pending pointer bumps"
provides:
- "scripts/check-phase34.sh: --self-test, --go, --docker, --plugins, --site, --admin, --docs, --marker, --additive, --all (PHASE34_ALLOW_NO_DOCKER, PHASE34_PENDING_MANIFESTS, PHASE34_PLUGIN_SKIP)"
- "Unit tests: TestReadIdentity, TestDerive, TestManifestFormat, TestCheck, TestVersions, TestRegistryClient, ExampleMarshal, ExampleNewestCompatible, TestDescribe, TestPluginDirs (kiosk and build), TestEffectiveFramework, TestResolveInstall, TestAppendManifestPlugins, TestPluginCommands, TestPluginsEndpoints, PluginsView and useSettings specs"
- "summercms.io unit tests: registry ingest/query/git-runner/URL rules, TestRegistryAPIShapes and TestRegistryIngestEndpoint (Postgres), 14 new changelog-post cases, marketplace utility cases"
- "34-release-log.md: release order, plugin tag table, pointer bumps, deploy, v0.6.0 tag message draft"
- "34-VALIDATION.md: 26-row per-task map, Wave 0 ticked"
affects: [phase 34 verification, the v0.6.0 release, every plugin tag of the release]
actuals:
tokens: 52900 # chars/4 over the diffs of this plan's commits in all four repositories
tasks: 5
commits: 7 # framework, measured: git rev-list --count b5f1ed2..HEAD before the docs commit
plan_head_before: b5f1ed202a94759aecdd36babe80c180cad960ff
plan_head_after: dfc6127
repo_heads:
sm-summercmsio-plugin: { before: 5853cf5, after: c52e721, commits: 1 }
sm-summercmsio-app: { before: 97c0c08, after: 352314a, commits: 1 }
vue-summercmsio-app: { before: 05f1cea, after: 8267c55, commits: 1 }
tech-stack:
added: []
patterns:
- "Phase gate per stage with required test names checked in go test -json, TAP and unittest output; a Docker stage that is NOT RUN fails --all unless explicitly allowed"
- "In-memory registries (build.Registry, cabana pluginRegistry) and an injected clock for cache and concurrency tests"
- "Contract tests that read the sibling Go source (categories, query limit) from the TypeScript side"
key-files:
created:
- scripts/check-phase34.sh
- modules/kiosk/manifest_test.go
- modules/kiosk/identity_test.go
- modules/kiosk/derive_test.go
- modules/kiosk/version_test.go
- modules/kiosk/client_test.go
- modules/kiosk/example_test.go
- modules/party/info_test.go
- internal/build/plugindirs_test.go
- internal/build/install_test.go
- internal/build/manifest_append_test.go
- cmd/summer/plugin_commands_test.go
- modules/cabana/plugins_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/ingest_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry/query_test.go
- ../sm-summercmsio-app/plugins/golem15/summercms/registry_api_test.go
- .planning/phases/34-plugin-marketplace/34-release-log.md
modified:
- internal/build/plugindirs.go
- internal/build/manifest.go
- modules/cabana/plugins.go
- admin/tests/views/PluginsView.test.ts
- admin/tests/state/useSettings.test.ts
- ../sm-summercmsio-app/scripts/changelog-post.py
- ../sm-summercmsio-app/scripts/test_changelog_post.py
- ../sm-summercmsio-app/vue-summercmsio-app/tests/marketplace.test.ts
- .planning/phases/34-plugin-marketplace/34-VALIDATION.md
key-decisions:
- "Plugin tags of the release (Jakub, via the coordinator): every plugin with a 34-02 plugin.yaml commit plus sm-summercmsio-plugin gets the next patch tag (v0.1.0 when untagged); no /changelog/plugins posts for them, the framework v0.6.0 post and tag message list the bumps"
- "The v0.6.0 tag message is drafted in 34-release-log.md (longer than usual, user-facing, with a 'Plugins released alongside' section)"
- "Tests pin documented behaviour where the plan text differed: Parse ignores unknown fields (forward compatibility, its doc comment), party.Describe publishes once per app (backpack refuses a duplicate), ReadIdentity prefers plugin.go's ID() over another type's (34-01 decision)"
- "sm-user-plugin's pre-existing TestRegisterCORSPath failure is skipped in --plugins through PHASE34_PLUGIN_SKIP (default) and printed on every run"
patterns-established:
- "Each phase gate names its required tests per repository and fails closed on a missing repository"
requirements-completed: [SC-5, SC-1, SC-2, SC-3, SC-4, D-02, D-03, D-04, D-05, D-07, D-08, D-09, D-10, D-12, D-13, D-14, D-15, D-16, D-17, D-18, D-19]
duration: ~40min
completed: 2026-10-29
---
# Phase 34 Plan 06: Phase gate, unit tests and release ledger Summary
**One gate script now runs every Phase 34 check across the framework, the 20 plugin repositories and the summercms.io repositories. Unit tests cover kiosk, install resolution, the Plugins endpoints and screen, the registry and the release script, and they found and fixed four defects. 34-release-log.md gives Jakub the exact v0.6.0 release: tag order, one new tag per plugin, the pointer bumps, the deploy and a drafted tag message. Nothing was pushed or tagged.**
## Performance
- **Duration:** about 40 min (2026-10-29T20:03:29Z to about 20:45Z)
- **Tasks:** 5/5
- **Commits:** 7 framework code/test commits, 1 in each of sm-summercmsio-plugin, sm-summercmsio-app and vue-summercmsio-app, plus the planning-docs commit(s)
## Accomplishments
- **Gate (Task 1, tracer):** `scripts/check-phase34.sh` reuses check-phase32's engine and adds TAP (node --test) and unittest detectors. The self-test plants each failure (failing, skipped and missing tests, a marker hit, an additive removal, a missing repository, a Docker daemon that does not answer) and requires that each one is detected. The `--plugins` stage builds `summer` from this checkout into a temporary directory and runs `plugin:manifest --check` for all 21 plugin packages.
- **Framework unit tests (Task 2):** kiosk coverage is 90.2%. TestResolveInstall runs against an in-memory registry and needs no Go build. TestPluginDirs decodes `go list` JSON fixtures. TestPluginCommands drives the CLI through `bonfire.Execute` and checks the exit status. The runnable examples cover Marshal and NewestCompatible. Every fixture lives in `t.TempDir()`, and `git -C ../sm-mfa-plugin status` is unchanged.
- **Admin side (Task 3):** TestPluginsEndpoints covers access, the update-rule table, cache hit and expiry on an injected clock, failure caching, at most 4 lookups in flight, the call timeout, marketplace validation and a disabled registry. The PluginsView spec grew to 15 tests and the useSettings spec to 12.
- **summercms.io (Task 4):** registry unit tests run without Docker: strict and peeled tags, digest equality between ls-remote and the clone, nested manifests, identity and duplicate refusals, blob and manifest caps, the https-only git runner and the URL rules. Postgres tests cover the API shapes and the ingest endpoint. The changelog-post tests went from 36 to 50. The marketplace tests went from 7 to 13 and include a contract check against the Go categories and the query limit.
- **Ledger (Task 5):** 34-release-log.md follows the coordinator's two instructions: every plugin gets a new tag with no plugin changelog posts, and the v0.6.0 tag message is drafted with a "Plugins released alongside" section. 34-VALIDATION.md has 26 task rows and Wave 0 is ticked.
## Task Commits
**summercms.go (master):**
1. Task 1: `b93a6de` test: phase 34 gate script
2. Task 2: `9109e5b` test(kiosk): manifest, identity, version and client unit tests
3. Task 2: `7de774b` test(build): plugin dirs, install resolution and summer.yaml edits
4. Task 2: `a231309` test(summer): plugin command prompts
5. Task 3: `df2ba57` test(cabana): Plugins screen endpoints
6. Task 3: `bad273b` test(admin): PluginsView and settings paths
7. Task 4: `dfc6127` test: phase 34 gate requires the summercms.io unit tests
8. Task 5: `docs(34): release ledger and validation map` (planning docs)
**sm-summercmsio-plugin (master):** `c52e721` test: registry ingest, queries and API
**sm-summercmsio-app (master):** `352314a` test: changelog-post manifest and ingest helpers (the gitlinks of the two submodules stay modified and uncommitted, as instructed)
**vue-summercmsio-app (master):** `8267c55` test: marketplace utilities
## Verification
- `bash scripts/check-phase34.sh --self-test`: passes (34 planted cases).
- `--go --docs --marker --additive`: pass. The marker stage finds no consuming application named since v0.5.3. In the additive stage cabana gains 43 lines and party 15, kiosk is new, and nothing is removed.
- `--plugins --admin`: pass. 20 repositories and 21 manifests are fresh; vitest reports 1614 tests before Task 3; typecheck, openapi and dist all pass.
- `--admin --additive` after Task 3: pass.
- `--site`: pass. The site plugin's vet, short tests and required tests; the app's vet and test; the unittest suite; check-deploy; and pnpm test, build:changelog, test:changelog and test:marketplace.
- `--docker`: pass. The framework's full `go test ./...` (Docker), the non-short TestInstallSmoke, and in the site plugin TestRegistrySmoke, TestRegistryAPIShapes and TestRegistryIngestEndpoint (Postgres).
- Framework `go vet ./...` and `go test -short ./...` are green, as is `cd examples/hello && go test ./...`.
- No tag and no push: `git tag --points-at HEAD` is empty in every repository touched.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] An in-app plugin package was reported as a submodule**
- **Found during:** Task 2 (TestPluginDirs)
- **Issue:** A plugin package of the application's own module (no go.mod of its own) resolved its module root to the application directory. That directory is the top of the application's git repository, so `summer build` baked `Source: submodule` with the application's `git describe` as the plugin version.
- **Fix:** `pluginVersion` treats the application directory as in-app (`party.SourceLocal`).
- **Files:** internal/build/plugindirs.go
- **Commit:** 7de774b
**2. [Rule 1 - Bug] summer.yaml items written as `- id:` broke the in-place append**
- **Found during:** Task 2 (TestAppendManifestPlugins)
- **Issue:** The inserted items always used `- id:`, so with wider spacing after the dash the `module:` key landed at the wrong column. The edit then failed to parse back and was refused, so plugin:add and plugin:install could not append.
- **Fix:** The spacing after the dash is kept, as are a dash alone on its line and the existing indentation.
- **Files:** internal/build/manifest.go
- **Commit:** 7de774b
**3. [Rule 1 - Bug] Marketplace categories included categories of dropped entries**
- **Found during:** Task 3 (TestPluginsEndpoints)
- **Issue:** A registry entry whose ID is outside the plugin ID shape is not offered on the screen, but its category still appeared in the category select.
- **Fix:** `categoriesOf` counts only entries with a valid ID.
- **Files:** modules/cabana/plugins.go
- **Commit:** df2ba57
**4. [Rule 1 - Bug] changelog-post.py left the notes and token files open**
- **Found during:** Task 4. The unittest run reported ResourceWarnings.
- **Fix:** Both files are read with `with open(...)`.
- **Files:** ../sm-summercmsio-app/scripts/changelog-post.py
- **Commit:** 352314a
**5. [Rule 3 - Blocking] A pre-existing sm-user-plugin test fails standalone**
- **Found during:** Task 1 (--plugins)
- **Issue:** `TestRegisterCORSPath` looks for an application's config/http.yaml. This was noted in 34-02 and is out of scope.
- **Fix:** `PHASE34_PLUGIN_SKIP` defaults to `sm-user-plugin:TestRegisterCORSPath`. The skip applies only to that repository's `go test -short` and is printed on every run; `PHASE34_PLUGIN_SKIP=` disables it.
- **Commit:** b93a6de
**6. [Rule 2 - Missing critical] Extra gate commit and extra tests**
- `dfc6127` wires the summercms.io tests into the gate. The plan's Task 4 lists commits only in the summercms.io repositories, but the gate script lives in the framework.
- Additional tests beyond the behavior lists: TestPackagePath, TestPluginDirs and TestLastElem (kiosk), TestAskToProceed, TestGitRunner, TestIngestHelpers and TestQueryRules.
### Plan text vs code (tests pin the documented behaviour)
- **Parse:** The plan said "unknown field refused", but `kiosk.Parse` documents that unknown fields are ignored so older summer binaries can read newer schema-1 files. Only a newer schema is refused, and the tests pin that.
- **party.Describe:** The plan said "a second Describe replaces the first". In fact `backpack.Publish` refuses a duplicate, so a second Describe returns an error and the first value stays published. The generated main calls Describe once.
- **ReadIdentity:** The plan said "two ID methods returning different values" should be refused. 34-01 deliberately prefers plugin.go's `ID()`, along with the `Requires()` on the same receiver, so an `ID()` on a model in the same package is ignored. The test pins that.
- **changelog-post "dry runs":** `publish` has no dry-run mode. The tests instead pin that a refused manifest check stops before the post, that a failed post never asks for an ingest, and that a framework release skips both.
### Process
- TDD: the unit tests were written against existing code. RED was seen where they exposed defects 1-3 (TestPluginDirs failed on the in-app source, TestAppendManifestPlugins on the four-space layout, TestPluginsEndpoints on the categories), and each fix went into the commit with the test that found it. The other tests passed on their first or second run, after test-side fixes.
## Issues Encountered
- `gofmt -l modules/kiosk` still lists the pre-existing `manifest_smoke_test.go` (noted in 34-04). It was left alone.
- Repositories with uncommitted state from other sessions were left as found: summercms.go `.planning/STATE.md`, `state.json`, `G15OFFICE.md` and `.msd/`; the sm-summercmsio-app gitlinks; the sm-oauthserver-plugin go.work; the sm-journal-plugin go.work.sum.
## User Setup Required
None for this plan. The release itself is Jakub's, step by step, in 34-release-log.md.
## Known Stubs
None.
## Next Phase Readiness
- `/msd-verify-work` and `/msd-validate-phase` can run `bash scripts/check-phase34.sh --all` on this Docker host.
- The release waits for Jakub: framework v0.6.0, 20 plugin tags, sm-summercmsio-plugin v0.1.0, three rebases, 32 pointer bumps and the deploy.
## Self-Check: PASSED
- Files exist: scripts/check-phase34.sh, the seven kiosk/party test files, the four build/cmd test files, modules/cabana/plugins_test.go, the three site plugin test files, 34-release-log.md, the filled 34-VALIDATION.md (26 rows, no placeholder row).
- Commits found: b93a6de, 9109e5b, 7de774b, a231309, df2ba57, bad273b, dfc6127 (framework); c52e721 (sm-summercmsio-plugin); 352314a (sm-summercmsio-app); 8267c55 (vue-summercmsio-app).
- Every gate stage passed on this host: self-test, go, docs, marker, additive, plugins, admin, site, docker.
- No tag points at HEAD in any repository touched; nothing was pushed.

View File

@@ -0,0 +1,124 @@
# Phase 34: Plugin marketplace - Context
**Gathered:** 2026-10-29
**Status:** Ready for planning
<domain>
## Phase Boundary
People browse the public Golem15 plugins at summercms.io/marketplace and add one to an application with `summer plugin:install <id>`; the same command installs private plugins from a git URL. Each public `sm-*-plugin` repo carries a generated `plugin.yaml`; summercms.io ingests manifests, READMEs and tags into a registry with a public read-only API; the admin SPA gains a read-only Plugins screen (Installed + Marketplace tabs). v1 has no paid plugins, no developer registration, no themes and no installs from the admin panel (all settled in `.planning/notes/2026-10-29-plugin-marketplace.md`).
Discussion added one capability to the roadmap text: `summer plugin:update`, so the admin's "update available" badge has a matching command (D-10).
</domain>
<decisions>
## Implementation Decisions
### Manifest: plugin.yaml is generated, never hand-edited
- **D-01:** `plugin.yaml` is generated by a new command `summer plugin:manifest` run in a plugin repo. `plugin.go` stays as it is (no change to `party.Plugin`, no breaking change to core plugins).
- **D-02:** Every field is derived from the repo: `id` and `requires` from `plugin.go` (AST: the literals returned by `ID()` / `Requires()`), module path from `go.mod`, minimum framework version and minimum required-plugin versions from `go.mod`'s `require` lines, `name` and `description` from the README's H1 and its one-sentence summary (the standard module README structure). A plugin whose `ID()`/`Requires()` are not literal returns is an error that names the function.
- **D-03:** Optional `--name="…"` / `--description="…"` override the README-derived text. Overrides persist in `plugin.yaml` and survive regeneration until changed or cleared (exact storage is planner's choice, e.g. an `overrides:` block).
- **D-04:** `summer plugin:manifest --check` fails when the committed `plugin.yaml` is stale. It runs in each plugin repo's tests (a pact/test helper or `go test`-runnable check) and in the tag/changelog step (`scripts/changelog-post.py publish … --repo`). `plugin.yaml` is committed. — **Reversibility:** costly — the format is read by the registry ingester, `plugin:install` for git URLs, and every public plugin repo; changing it means regenerating all repos and migrating the ingester.
- **D-05:** Version constraints are Go-style minimums: `framework: v0.4.0`, `requires: {golem15.translate: v0.2.0}`. No semver ranges (Go's minimal version selection; a major bump changes the module path).
### Runtime metadata for the Installed tab
- **D-06:** `summer build` reads each plugin's `plugin.yaml` and bakes name and description into `plugins.gen.go`. Plugins without a `plugin.yaml` show only their ID.
- **D-07:** Version: module installs use the version from `go.mod`/build info; submodule or local-`replace` plugins get `git describe --tags` run in the plugin directory at build time (e.g. `v0.3.1-4-gabc123`), also baked into `plugins.gen.go`.
### Install resolution
- **D-08:** `summer plugin:install golem15.journal` picks the newest tag whose minimum framework version the app's `go.mod` already satisfies; `golem15.journal@v0.3.0` pins. If only tags needing a newer framework exist, it fails and names the framework version to move to (it does not bump the framework silently).
- **D-09:** Missing required plugins are resolved transitively, the full list of additions is printed, and the user confirms; `--yes` skips the prompt and non-interactive runs require `--yes`. Dependencies install in the same mode as the requested plugin (module, or submodule under `--source`).
- **D-10:** `summer plugin:update [id]` is in scope: module installs move to the newest compatible tag (`go get`), submodule installs are checked out at the newest compatible tag. Without an ID it updates all plugins it can resolve.
- **D-11:** Git-URL installs are submodule-only in v1; no `--module`. Close the open question in `.planning/research/questions.md` as "not in v1". — **Reversibility:** reversible — adding `--module` later is additive.
- **D-12:** A git-URL plugin's own repo is never sent to summercms.io, but its required plugin IDs (e.g. `golem15.translate`) are resolved through the registry like any ID install. `--offline` disables registry calls and then requires the dependencies to be installed already.
- Both modes finish with the same registration `plugin:add` does (`summer.yaml`, `go.mod`, `go.work` where applicable), and module-installed plugins must work with the build steps that currently inspect plugin directories (`internal/build/leaf.go`, `internal/build/registry.go`) — resolve their directory from the module cache.
### Registry ingestion and API (summercms.io, `golem15.summercms` site plugin)
- **D-13:** Pull ingester: given a repo URL it clones anonymously, reads tags, each tag's `plugin.yaml`, and the README. It runs as a River periodic job (around hourly) and on an authenticated "ingest now" endpoint that `changelog-post.py publish --repo` calls. No forge webhooks.
- **D-14:** The listing is admin-curated: a summercms.io admin adds a repo URL; the ingester fills the facts. A plugin is published only once it has a tag with a valid `plugin.yaml`; tags without one are skipped.
- **D-15:** Every `vX.Y.Z` tag is stored as a version row with that tag's framework and plugin minimums (needed by D-08). README is stored for the latest tag only.
- **D-16:** Public read-only JSON API, no auth, open CORS, cache headers: `GET /api/registry/v1/plugins?q=&category=` (list/search), `GET /api/registry/v1/plugins/{id}` (detail incl. README as markdown and rendered HTML), `GET /api/registry/v1/plugins/{id}/versions`. Consumed by the Nuxt marketplace pages, the CLI and cabana. — **Reversibility:** one-way — once released `summer` binaries call `/api/registry/v1`, its shape cannot change without a v2 path.
- Presentation fields (category, featured, screenshots, icon, sort order) are edited in the summercms.io admin (from the decision note).
### Admin Plugins screen
- **D-17:** The SPA talks only to its own backend: cabana gets swag-annotated admin endpoints that call the registry with a timeout and short cache, and compute "update available" in Go against installed versions. No CSP/CORS change in the admin.
- **D-18:** Config key `plugins.registry_url` (default `https://summercms.io`); empty disables registry calls, which hides the Marketplace tab and update badges while Installed still works. The CLI reads the same setting (allows a staging or self-hosted registry). Exact key name is planner's choice if it clashes with existing config.
- **D-19:** New permission (a `system.plugins.view`-style key in cabana's permission set), granted to superusers by default.
### Claude's Discretion
- Marketplace page layout and visuals on `vue-summercmsio-app` (list, search, category, detail); `/msd-ui-phase 34` can produce a UI contract if wanted.
- Storage of D-03 overrides inside `plugin.yaml`.
- Registry DB schema, ingester error handling, cache durations, periodic interval.
- Whether older tags (before `plugin.yaml` existed) get backfilled; default per D-14 is to skip them.
- Exact CLI output/prompt wording and the semantics of `plugin:update` with no ID when some plugins can't be resolved.
</decisions>
<canonical_refs>
## Canonical References
**Downstream agents MUST read these before planning or implementing.**
### Marketplace decisions
- `.planning/notes/2026-10-29-plugin-marketplace.md` — v1 scope, listing data split, install-mode table, read-only admin screen, out-of-scope list
- `.planning/research/questions.md` — "Is `--module` for git-URL installs worth supporting?" (answered by D-11: not in v1)
- `.planning/ROADMAP.md` § Phase 34 — goal, repos, success criteria
### Plugins and repos
- `.planning/notes/core-plugins-own-repos.md` — `sm-*-plugin` repos, module path = repo path, submodules at `plugins/<vendor>/<name>`, commit plugin first then pointer bump
- `.planning/notes/why-go-not-scala.md` and `.planning/research/FEATURES.md` (anti-features) — no runtime plugin loading
- `.planning/research/STACK.md` — decided dependency set (YAML via `goccy/go-yaml`; any new dependency, e.g. a markdown renderer or git library, needs a note)
### Release flow
- `../sm-summercmsio-app/DEPLOY.md` § "Posting to the changelog" and `../sm-summercmsio-app/scripts/changelog-post.py` — plugin tag step that D-04 and D-13 hook into
- `.planning/notes/2026-10-07-embedded-admin-release-gate.md` — rebuild and commit `modules/boardwalk/dist` when `admin/` changes
</canonical_refs>
<code_context>
## Existing Code Insights
### Reusable Assets
- `cmd/summer/main.go` `addPluginCommand()` and `internal/build.AddPlugin` — the registration step both install modes end with.
- `internal/build/manifest.go` — `Manifest`, `LoadManifest`/`SaveManifest`, `ValidatePluginID`, `validateModulePath`: reuse for `summer.yaml` edits and ID validation in `plugin.yaml`.
- `internal/build/build.go` `generatePluginsGen` — where D-06/D-07 metadata gets baked in.
- `modules/party` `Activated` — the installed list cabana's Installed tab reads.
- `conga` (River periodic jobs) — the ingester schedule on summercms.io.
- `scripts/check-admin-openapi.sh` — swag → `admin/openapi/admin.json` → `admin/src/api/schema.d.ts` for the new cabana endpoints.
### Established Patterns
- `party.Plugin` is only `ID()`, `Requires()`, `Register`, `Boot`; plugin metadata does not exist at runtime today, hence D-06.
- `plugin:add` assumes a local directory + `replace`; module installs (no `replace`) are new and must satisfy `leaf.go`/`registry.go` directory inspection.
- Commands are `bonfire.Command` with Long text, Examples and Args/Flags; docs checker (`summer docs:build --check`) verifies command names in docs.
- New admin screens follow the cabana admin API + boardwalk SPA split; the dist is committed.
### Integration Points
- `../sm-summercmsio-app/plugins/golem15/summercms` — currently routes/static only (docs, `/new`, `/update`, site tree); gains models, migrations, admin (presentation fields, repo list), registry API routes and the ingester job.
- `../sm-summercmsio-app/vue-summercmsio-app` — marketplace pages consuming D-16.
- Every public `../sm-*-plugin` repo — commit generated `plugin.yaml` plus the `--check` test (plugin commits first, app pointer bumps separately).
</code_context>
<specifics>
## Specific Ideas
- The user wanted hand-editable text despite generation, hence `--name` / `--description` overrides on `plugin:manifest`.
- Modelled on octobercms.com/marketplace for browsing; install is CLI only.
</specifics>
<deferred>
## Deferred Ideas
- `--module` for git-URL (private) installs. Revisit if submodule-only proves limiting.
- Already out of scope per the decision note: paid plugins, licensing, developer accounts, third-party submissions, themes, installing from the admin panel.
### Reviewed Todos (not folded)
- 17 todos matched on keywords only (e.g. gate scripts naming apps, OIDC parity, MFA findings, menu plugin port). None concern the marketplace; none folded.
</deferred>
---
*Phase: 34-plugin-marketplace*

View File

@@ -0,0 +1,81 @@
# Phase 34: Plugin marketplace - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-10-29
**Phase:** 34-plugin-marketplace
**Areas discussed:** plugin.yaml vs plugin.go, Install resolution, Registry ingestion & API, Admin ↔ registry link
---
## plugin.yaml vs plugin.go
| Option | Description | Selected |
|--------|-------------|----------|
| Both stay, build checks | plugin.go unchanged; build/validator fail on mismatch | |
| plugin.go reads plugin.yaml | embed and derive ID()/Requires(); edits every plugin.go | |
| Generate plugin.yaml | command writes it from plugin.go plus extra fields | ✓ |
**Field sources:** derive everything from the repo (plugin.go AST, go.mod, README H1 + summary). **Notes:** user asked for optional `--name` / `--description` overrides for hand-edited text.
**When generated:** `summer plugin:manifest` + `--check` before tagging (selected) vs generated only at ingestion.
| Runtime meta | Selected |
|---|---|
| Baked into plugins.gen.go by summer build | ✓ |
| Optional pact Details() capability | |
| Local version | Selected |
|---|---|
| git describe at build | ✓ |
| Show "local" | |
| version field in plugin.yaml | |
| Constraint format | Selected |
|---|---|
| Go-style minimum | ✓ |
| Semver ranges | |
---
## Install resolution
| Question | Options | Selected |
|---|---|---|
| Version pick | Newest compatible + @ pins / Always latest tag | Newest compatible + @ pins |
| Missing deps | Install transitively after listing / Fail with command | Install transitively after listing |
| Update command | plugin:update in scope / Defer | plugin:update in scope |
| `--module` for git URLs | Let research decide / No, submodule only / Yes with diagnostics | No, submodule only |
| Git-URL plugin's public deps | Registry for IDs only / Never contact, fail / From go.mod alone | Registry for IDs only |
---
## Registry ingestion & API
| Question | Options | Selected |
|---|---|---|
| Trigger | Pull job + changelog step / Forge webhook / changelog-post.py push only | Pull job + changelog step |
| Listing | Admin-curated repo list / Auto-discover sm-*-plugin | Admin-curated repo list |
| Versions | Every tag + its plugin.yaml / Latest only | Every tag + its plugin.yaml |
| API shape | Small read-only JSON / Static index.json | Small read-only JSON |
---
## Admin ↔ registry link
| Question | Options | Selected |
|---|---|---|
| Path | Server-side via cabana / Browser calls summercms.io | Server-side via cabana |
| Opt-out | Config key, on by default / Always on | Config key, on by default |
| Permission | New permission, superuser default / Any admin | New permission, superuser default |
---
## Claude's Discretion
- Marketplace page layout; override storage in plugin.yaml; registry schema, cache durations, ingest interval; backfilling older tags; CLI wording.
## Deferred Ideas
- `--module` for git-URL installs.

View File

@@ -0,0 +1,349 @@
# Phase 34: Plugin marketplace - Pattern Map
**Mapped:** 2026-10-29
**Files analyzed:** 24 (grouped by plan)
**Analogs found:** 22 / 24
Paths are relative to `summercms.go/` unless prefixed with `../` (sibling repos under the meta repo). All analogs are git-tracked sources (no `.msd/` mirrors).
## File Classification
| New/Modified File | Plan | Role | Data Flow | Closest Analog | Match |
|---|---|---|---|---|---|
| `modules/<beach-name>/manifest.go` (plugin.yaml types, Parse/Validate/Marshal) | 01 | model/utility | transform | `internal/build/manifest.go` (`Manifest`, `LoadManifest`/`SaveManifest`, `ValidatePluginID`) | exact |
| `modules/<beach-name>/resolve_ast.go` (const-resolving ID/Requires) | 01 | utility | transform (AST) | `internal/build/scaffold.go:360-392` `pluginIDFromGo` | exact (extend) |
| `modules/<beach-name>/derive.go` (go.mod via `go mod edit -json`, README via goldmark) | 01 | utility | file-I/O | `internal/build/scaffold.go` `runGo`/`applyGoWork` (l.632); goldmark use in `modules/breakwater` / `internal/docsite` | role-match |
| `modules/<beach-name>/check.go` (`Check`, `CheckT(t, dir)` test helper) | 01 | test helper | file-I/O | `../sm-faq-plugin/commands_documented_test.go` (bonfire.CheckDocs helper used by plugin tests) | role-match |
| `modules/<beach-name>/client.go` (registry HTTP client) | 01/04/05 | service | request-response | `modules/fetchguard/client.go:40` `NewClient` | role-match |
| `modules/<beach-name>/version.go` (strict vX.Y.Z compare) | 01 | utility | transform | none | no analog |
| `modules/<beach-name>/README.md` + root `README.md` row | 01 | docs | - | any `modules/*/README.md` (e.g. `modules/fetchguard/README.md`) | exact |
| `internal/build/scaffold.go` (`pluginIDFromGo` -> shared resolver; `AddPlugin` require-version option) | 01/04 | utility | file-I/O | itself (l.144, l.360, l.394-406) | modify |
| `internal/build/build.go` `generatePluginsGen`/`generateMain` (PluginInfo, FrameworkVersion) | 01 | codegen | transform | itself l.145-163, l.125 | modify |
| `internal/build/plugindirs.go` (go list -json, git describe) | 01 | utility | file-I/O (exec) | `internal/build/new.go:286` `runGit`; `scaffold.go:452` `runGoWorkUse` | role-match |
| `modules/party` Info type + Describe/lookup | 01 | provider | request-response (registry in app) | `party.Activate` (called from generated main, build.go:125) | role-match |
| `cmd/summer/main.go` `plugin:manifest` command | 01 | controller (CLI) | file-I/O | `cmd/summer/main.go:381-415` `addPluginCommand` | exact |
| `../sm-*-plugin/plugin.yaml` + `manifest_test.go` per repo | 02 | config + test | file-I/O | `../sm-faq-plugin/commands_documented_test.go` | role-match |
| `../sm-summercmsio-app/plugins/golem15/summercms/updates/*.go` (registry tables) | 03 | migration | CRUD | `../sm-faq-plugin/updates/registry.go`, `202610110001_create_golem15_faq_faqs.go` | exact |
| `.../summercms/models/*` + admin controllers YAML | 03 | model/controller | CRUD | `../sm-faq-plugin/models/`, `controllers/faqs/`, `admin.go`, `admin_navigation.go` | exact |
| `.../summercms/admin_permissions.go` | 03 | config | - | `../sm-faq-plugin/admin_permissions.go` | exact |
| `.../summercms/token_scopes.go` (`registry` scope) | 03 | config | - | `../sm-journal-plugin/token_scopes.go` | exact |
| `.../summercms/controllers/api/registry.go` (public GET + ingest POST) | 03 | controller | request-response | `../sm-faq-plugin/routes.go` + `controllers/api`; auth: `../sm-journal-plugin/controllers/api/auth.go:83-106` | exact |
| `.../summercms/console/registry_ingest.go` + `schedule.go` | 03 | command/job | batch (scheduled) | `../sm-chatvideo-plugin/schedule.go` | exact |
| `.../summercms/plugin.go` (gains capabilities) | 03 | provider | - | itself (routes-only today) + `../sm-faq-plugin/plugin.go` | modify |
| `../sm-summercmsio-app/scripts/changelog-post.py` (`--check` + ingest-now) | 03 | script | request-response | itself `cmd_publish` l.262-300 | modify |
| `../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/*.vue` | 03 | component | request-response (SSR) | `.../changelog/app/pages/changelog/plugins.vue`, `index.vue` | role-match |
| `cmd/summer/main.go` `plugin:install`, `plugin:update` + `internal/build/install.go` | 04 | controller (CLI) + service | file-I/O + request-response | `addPluginCommand` + `build.AddPlugin` | role-match |
| `modules/cabana/plugins.go`, `http.go` routes, `admin_openapi.go`, `backend_screens.go` permission | 05 | controller | request-response | `modules/cabana/http.go:560` `settingsList`; `admin_openapi.go:469-479`; `backend_screens.go:16-25,80-87` | exact |
| `admin/src/views/PluginsView.vue`, `router.ts`, `useSettings.ts` | 05 | component | request-response | `admin/src/app/router.ts:70-74`; `useSettings.ts:30-39`; `ApiTokenCreateDialog.vue:255-268` | role-match |
| Unit tests (plan 06) | 06 | test | - | `internal/build/*_test.go`, `modules/cabana/phase09_contract_test.go` | role-match |
## Pattern Assignments
### Plan 01 — const-resolving reader (`resolve_ast.go`)
**Analog:** `internal/build/scaffold.go` lines 360-392 (current, literal-only; to be replaced by a call into the shared resolver):
```go
func pluginIDFromGo(path string) (string, error) {
fset := token.NewFileSet()
file, err := parser.ParseFile(fset, path, nil, 0)
...
ast.Inspect(file, func(n ast.Node) bool {
fn, ok := n.(*ast.FuncDecl)
if !ok || fn.Name == nil || fn.Name.Name != "ID" || fn.Recv == nil || fn.Body == nil {
return true
}
for _, stmt := range fn.Body.List {
ret, ok := stmt.(*ast.ReturnStmt)
if !ok || len(ret.Results) != 1 { continue }
lit, ok := ret.Results[0].(*ast.BasicLit)
if !ok || lit.Kind != token.STRING { continue }
...
if id == "" {
return "", fmt.Errorf("build: %s does not return a plugin id", path)
}
```
Extend per RESEARCH Pattern 2: switch on `*ast.BasicLit` / `*ast.Ident` (package-level const in any non-test `.go` file of the dir) / `*ast.SelectorExpr` (same-module dir or `go list -m -json` Dir). Locked: same-package and cross-package constants, never execute code. Error must name the function (`ID()`/`Requires()`). Test fixtures: `sm-mfa-plugin` (same-file const), `sm-paymentgateway-plugin/plugin.go:47` (cross-pkg), `sm-pgstripe-plugin/subscriptions/plugin.go:83-85` (cross-module Requires).
### Plan 01 — `summer plugin:manifest` command
**Analog:** `cmd/summer/main.go` lines 381-415:
```go
func addPluginCommand() bonfire.Command {
return bonfire.Command{
Name: "plugin:add",
Description: "Register a local plugin module in the app manifest and workspace",
Long: `Adds a plugin that already exists on disk ...`,
Examples: []bonfire.Example{
{Command: "plugin:add plugins/acme/blog", Description: "Register the plugin in plugins/acme/blog"},
},
Args: []bonfire.Arg{{Name: "dir", Description: "Local plugin directory", Required: true}},
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
pluginDir, ok := in.Argument("dir")
...
dir, err := os.Getwd()
if err := build.AddPlugin(ctx, dir, pluginDir); err != nil { return err }
out.Success("Added " + pluginDir + " to summer.yaml, go.mod and go.work; run summer build")
return nil
},
}
}
```
Every new command (`plugin:manifest`, `plugin:install`, `plugin:update`) needs Description, Long, Examples and described Args/Flags (`TestCommandsDocumented`), and a mention in `docs/console/scaffolding.md` (docs checker). Thin Run, logic in `internal/build` or the new module.
### Plan 01 — metadata baking in `generatePluginsGen`
**Analog:** `internal/build/build.go` lines 145-163:
```go
func generatePluginsGen(m Manifest) ([]byte, error) {
var b strings.Builder
b.WriteString("// Code generated by summer build. DO NOT EDIT.\n\n")
...
b.WriteString("// PluginIDs is the ordered plugin list from summer.yaml.\n")
b.WriteString("var PluginIDs = []string{\n")
for _, p := range m.Plugins {
fmt.Fprintf(&b, "\t%s,\n", strconv.Quote(p.ID))
}
b.WriteString("}\n")
return formatSource([]byte(b.String()))
}
```
Add `var PluginInfo = []party.Info{...}` and `const FrameworkVersion` the same way (strconv.Quote every string, then `formatSource`; output written through `writeIfChanged`). Generated main (line 125, `plugins, err := party.Activate(app, PluginIDs)`) gains one `party.Describe(...)` line before it. The signature must take resolved metadata (a new param or struct) so failure of `go list` degrades to ID-only and never fails the build.
### Plan 01 — exec helpers (`plugindirs.go`, `derive.go`)
**Analogs:** `internal/build/new.go:286` `func runGit(ctx, dir, args...) ([]byte, error)`; `internal/build/scaffold.go:452` `runGoWorkUse`, `:632` `applyGoWork(cmd *exec.Cmd, dir string)`, and `editAppModule` (l.394-406):
```go
if err := runGo(ctx, appDir, "mod", "edit", "-require="+modPath+"@v0.0.0"); err != nil { return err }
...
if err := runGo(ctx, appDir, "mod", "edit", "-replace="+modPath+"="+rel); err != nil { return err }
return ensureToolchain(filepath.Join(appDir, "go.mod"))
```
Use `go list -e -json=...` with `applyGoWork(cmd, appDir)`; `go mod edit -json` for go.mod parsing (do not extend `parseGoMod`). `editAppModule` needs a version parameter for `--source` installs (plan 04) while `plugin:add` keeps `v0.0.0`.
### Plan 01 — registry client (`client.go`)
**Analog:** `modules/fetchguard/client.go:40` `func NewClient(policy Policy, cfg *compass.Config) (*Client, error)`; use `Policy{Mode: fetchguard.TrustedMode, MaxBytes: ...}`; tests use its `WithTransport` seam. No redirects, so `plugins.registry_url` must be the final origin.
### Plan 02 — per-repo `plugin.yaml` + check test
**Analog:** `../sm-faq-plugin/commands_documented_test.go`:
```go
package faq
import (
"testing"
"git.golem15.com/golem15/summercms/modules/bonfire"
)
func TestCommandsDocumented(t *testing.T) {
commands := (&Plugin{}).Commands()
...
for _, problem := range bonfire.CheckDocs(commands) {
t.Logf("%s", problem)
}
}
```
New `manifest_test.go`: `func TestPluginManifest(t *testing.T) { <module>.CheckT(t, ".") }` (fails, not logs). For `sm-pgstripe-plugin` add one for `subscriptions/` too (plugin.yaml per plugin package dir). Repos with H1 == ID need `--name` (F7). Commit in plugin repo first, pointer bump in apps separately.
### Plan 03 — summercms.io site plugin
**Migrations** — `../sm-faq-plugin/updates/registry.go` (Register/All verbatim) and `202610110001_create_golem15_faq_faqs.go`:
```go
var createFAQs = []*gormigrate.Migration{
{
ID: "202610110001_create_golem15_faq_faqs",
Migrate: func(tx *gorm.DB) error {
for _, stmt := range []string{
`CREATE TABLE golem15_faq_faqs ( id SERIAL PRIMARY KEY, ... created_at TIMESTAMPTZ NULL, updated_at TIMESTAMPTZ NULL )`,
`CREATE INDEX ... ON golem15_faq_faqs (slug, locale_id)`,
} {
if err := tx.Exec(stmt).Error; err != nil { return err }
}
return nil
},
Rollback: func(tx *gorm.DB) error { return tx.Exec(`DROP TABLE IF EXISTS golem15_faq_faqs`).Error },
},
}
func init() { Register(createFAQs...) }
```
Tables `golem15_summercms_registry_plugins`, `golem15_summercms_registry_versions`, IDs `2026103000NN_create_golem15_summercms_registry_*`.
**Permissions** — `../sm-faq-plugin/admin_permissions.go`:
```go
func (*Plugin) Permissions() []pact.Permission {
return []pact.Permission{{
Code: controllers.PermissionFAQs,
Tab: "golem15.faq::lang.plugin.name",
Label: "golem15.faq::lang.permissions.faqs",
Roles: []string{"developer", "publisher"},
}}
}
var _ pact.HasPermissions = (*Plugin)(nil)
```
Codes `golem15.summercms.registry` (admin) and `golem15.summercms.registry_ingest`.
**Token scope** — `../sm-journal-plugin/token_scopes.go`:
```go
var _ pact.HasTokenScopes = (*Plugin)(nil)
func (p *Plugin) TokenScopes() []pact.TokenScope {
return []pact.TokenScope{{
Name: "journal", Label: "golem15.journal::lang.scopes.journal",
Description: "golem15.journal::lang.scopes.journal_description",
Permissions: []string{"golem15.journal.*"}, Methods: all,
}, ...}
}
```
New scope `Name: "registry"`, `Permissions: []string{"golem15.summercms.*"}`, `Methods: []string{"POST"}` (locked decision).
**Ingest auth** — `../sm-journal-plugin/controllers/api/auth.go` lines 83-106:
```go
func requireBackendPrincipal(app *backpack.App, w http.ResponseWriter, r *http.Request) (*http.Request, *bouncer.Principal, bool) {
out, pr, err := cabana.ResolveBackend(app, r, journalCover)
if err != nil || pr == nil { resolveError(w, err); return r, nil, false }
return out, pr, true
}
func requireAccessPosts(w http.ResponseWriter, pr *bouncer.Principal) bool {
if !cabana.Allows(pr, []string{permAccessPosts}) {
writeAPIError(w, http.StatusForbidden, errInsufficientPerms); return false
}
return true
}
```
**Public routes** — `../sm-faq-plugin/routes.go`:
```go
const BucketPublicAPI = "faq-public-api"
func (p *Plugin) Routes(r pact.Router) error {
r.Group("/_faq/api/v1", surf.Use("throttle:"+BucketPublicAPI), func(g pact.Router) {
g.Get("/faqs/{slug}", apicontrollers.Show(p.app))
})
return nil
}
```
Use `r.Group("/api/registry/v1", surf.Use("throttle:registry-api", "cors:registry"), ...)`, plus `Cache-Control`; ingest POST in a separate group without public CORS. Add `http.cors_profiles.registry` in `../sm-summercmsio-app/config/http.yaml`.
**Schedule** — `../sm-chatvideo-plugin/schedule.go`:
```go
func (p *Plugin) Schedule() []pact.ScheduledCommand {
return []pact.ScheduledCommand{
{Command: console.ReconcileSessionsName, Cadence: pact.Every(5 * time.Minute)},
}
}
```
-> `{Command: console.RegistryIngestName, Cadence: pact.Every(time.Hour)}`; set `queue.work_in_serve: true` in `config/queue.yaml` (F10).
**Plugin shell** — `../sm-summercmsio-app/plugins/golem15/summercms/plugin.go` currently declares only `pact.HasRoutes`; `Register`/`Boot` return nil and the package doc says "declares no admin controllers, so ... no /backend route exists" — update doc comment, add `var _ pact.HasMigrations/HasModels/HasAdminControllers/HasPermissions/HasTokenScopes/HasSchedule/HasCommands = (*Plugin)(nil)` like faq. Add `/marketplace` to `nodePaths` in `links_test.go:45`.
**changelog-post.py** — `cmd_publish` l.262-300 already validates tag on origin, then GETs/POSTs via `call(method, path, token)`. Insert (a) before posting, when `kind == "plugins"`: run `summer plugin:manifest --check` in `--repo`; (b) after a successful post: `call("POST", <ingest-now URL>, token)` — note `call` targets the Journal API base, so add a sibling helper for `/api/registry/v1/ingest`. Extend `test_changelog_post.py`.
**Marketplace pages** — `../sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/changelog/plugins.vue`:
```vue
<script setup lang="ts">
definePageMeta({ key: (route) => route.fullPath })
</script>
<template>
<ChangelogIndex stream="plugins" />
</template>
```
Same Node SSR app; new `pages/marketplace/index.vue` and `[id].vue` with a component like `ChangelogIndex`; runtimeConfig registry base mirrors `NUXT_JOURNAL_API_BASE` (supervisor conf); nginx `/marketplace` -> :3095 as for `/changelog`.
### Plan 04 — `plugin:install` / `plugin:update`
**Analog:** `addPluginCommand` (above) + `build.AddPlugin` (`internal/build/scaffold.go:144`). Prompt: do NOT use `bonfire.ConfirmProceed` (`modules/bonfire/helpers.go:144-149` returns true off a terminal). Use:
```go
if !yes {
if !bonfire.Interactive(out) { return fmt.Errorf("plugin:install: non-interactive run needs --yes") }
ok, err := out.Confirm(question, false)
...
}
```
Validate registry-provided module paths with `validateModulePath` (`internal/build/manifest.go:270-292`) and versions with `^v\d+\.\d+\.\d+$` before `go get`. go.work overrides via `go work edit -replace=` (F2), invoked like `runGoWorkUse`.
### Plan 05 — cabana Plugins endpoints
**Handler analog:** `modules/cabana/http.go:560-568`:
```go
func (s *service) settingsList(w http.ResponseWriter, r *http.Request) {
principal, ok := bouncer.User(r.Context())
if !ok || principal == nil || !principal.Backend {
WriteError(w, http.StatusUnauthorized, "unauthenticated", msgUnauthenticated)
return
}
...
WriteData(w, http.StatusOK, settings, map[string]any{"locale": ...})
}
```
Add permission check for the new key (403 via `WriteError`). Routes go into the `r.GroupRaw(api, []string{"backend", "locale.from-principal"}, ...)` block at `http.go:316-339`: `g.Get("/plugins", s.pluginsInstalled)`, `g.Get("/plugins/marketplace", s.pluginsMarketplace)`.
**Permission analog:** `modules/cabana/backend_screens.go:16-25, 80-87`:
```go
PermissionManageUsers = "backend.manage_users"
...
func (*backendScreens) Permissions() []pact.Permission {
return []pact.Permission{
{Code: PermissionManageUsers, Tab: "backend::lang.permissions.tab_system", Label: "backend::lang.permissions.manage_users"},
...
```
Add `PermissionViewPlugins = "backend.view_plugins"` (no Roles; superusers pass all checks). Strings in `modules/phrasebook/backend/lang/{en,pl}/lang.yaml`.
**swag analog:** `modules/cabana/admin_openapi.go:469-479`:
```go
// AdminSettingsList documents GET /settings.
//
// @Summary List admin settings
// @Tags admin
// @Produce json
// @Security BackendBearer
// @Success 200 {object} Envelope[[]SettingsEntry]
// @Failure 401 {object} ErrorEnvelope
// @Failure 403 {object} ErrorEnvelope
// @Router /settings [get]
```
Then `scripts/check-admin-openapi.sh`; update `phase09_contract_test.go` / `security_coverage_test.go` inventories. Check for in-flight cabana edits from other sessions first.
### Plan 05 — boardwalk view
- Router (`admin/src/app/router.ts:70-74`): `{ path: '/settings', name: 'settings', component: SettingsIndexView, meta: { shell: true } }` — add `{ path: '/system/plugins', name: 'plugins', component: PluginsView, meta: { shell: true } }` before the `/:vendor/:plugin/:controller` routes.
- Settings link (`admin/src/state/useSettings.ts:30-39`): `settingsPath(entry)` returns `controllerPath(entry.controller)` or `/settings/<code>`; add a leading `if (entry.path) return entry.path` with an additive `Path` field on `cabana.SettingsEntry` (`modules/cabana/navigation.go:23-35`).
- Copy button (`admin/src/components/account/ApiTokenCreateDialog.vue:255-268`):
```ts
try {
if (!navigator.clipboard?.writeText) { throw new Error('clipboard unavailable') }
await navigator.clipboard.writeText(value)
markCopied()
} catch {
copyFailed.value = true
...
}
```
- Tabs via `reka-ui`; data via typed `api` client only. Rebuild and commit `modules/boardwalk/dist`, run `scripts/check-admin-dist.sh`.
## Shared Patterns
### CLI command shape
**Source:** `cmd/summer/main.go:381-415`. **Apply to:** plugin:manifest, plugin:install, plugin:update. Full docs fields; Run delegates to a package function; `out.Success(...)` at the end.
### Shelling out to go/git
**Source:** `internal/build/new.go:286` `runGit`, `scaffold.go` `runGo` + `applyGoWork` (l.632). **Apply to:** plugindirs, derive, install, ingester (ingester adds hardened env: `GIT_TERMINAL_PROMPT=0`, `GIT_ALLOW_PROTOCOL=https`, args after `--`).
### YAML
`goccy/go-yaml` only (as `internal/build/manifest.go`); struct field order = output order.
### Plugin capability assertions
`var _ pact.HasX = (*Plugin)(nil)` next to each capability method (faq, journal files above).
### Error envelopes
cabana: `WriteError(w, status, code, msg)` / `WriteData(w, status, data, meta)`. Site plugin public API: `{"data":..., "meta":...}` / `{"error":{...}}` per RESEARCH registry shape.
## No Analog Found
| File | Role | Data Flow | Reason |
|---|---|---|---|
| `modules/<beach-name>/version.go` | utility | transform | No semver comparer in tree; write a strict `vX.Y.Z` comparer (~20 lines), strip `-N-gHASH` from git describe |
| ingester core (`classes/ingest/*.go` on site plugin) | service | batch (git clone/ls-tree) | No git-cloning service exists; follow RESEARCH "Hardened git for the ingester" and use `breakwater.Render` for README HTML |
## Metadata
**Analog search scope:** `summercms.go/{cmd,internal/build,modules/{cabana,bonfire,fetchguard,party},admin/src}`, `../sm-faq-plugin`, `../sm-journal-plugin`, `../sm-chatvideo-plugin`, `../sm-summercmsio-app/{plugins/golem15/summercms,scripts,vue-summercmsio-app/changelog}`
**Files scanned:** ~35
**Pattern extraction date:** 2026-10-29

View File

@@ -0,0 +1,708 @@
# Phase 34: Plugin marketplace - Research
**Researched:** 2026-10-29
**Domain:** Go module/workspace mechanics for compiled plugins, git-based registry ingestion, a public JSON registry API, cabana/boardwalk admin screen, Nuxt SSR pages
**Confidence:** HIGH for everything grounded in the code and the local probes below; MEDIUM for proposed shapes (registry JSON, DB schema, module name), which are design recommendations, not facts.
<user_constraints>
## User Constraints (from CONTEXT.md)
### Locked Decisions
#### Manifest: plugin.yaml is generated, never hand-edited
- **D-01:** `plugin.yaml` is generated by a new command `summer plugin:manifest` run in a plugin repo. `plugin.go` stays as it is (no change to `party.Plugin`, no breaking change to core plugins).
- **D-02:** Every field is derived from the repo: `id` and `requires` from `plugin.go` (AST: the literals returned by `ID()` / `Requires()`), module path from `go.mod`, minimum framework version and minimum required-plugin versions from `go.mod`'s `require` lines, `name` and `description` from the README's H1 and its one-sentence summary (the standard module README structure). A plugin whose `ID()`/`Requires()` are not literal returns is an error that names the function.
- **D-03:** Optional `--name="…"` / `--description="…"` override the README-derived text. Overrides persist in `plugin.yaml` and survive regeneration until changed or cleared (exact storage is planner's choice, e.g. an `overrides:` block).
- **D-04:** `summer plugin:manifest --check` fails when the committed `plugin.yaml` is stale. It runs in each plugin repo's tests (a pact/test helper or `go test`-runnable check) and in the tag/changelog step (`scripts/changelog-post.py publish … --repo`). `plugin.yaml` is committed. — **Reversibility:** costly — the format is read by the registry ingester, `plugin:install` for git URLs, and every public plugin repo; changing it means regenerating all repos and migrating the ingester.
- **D-05:** Version constraints are Go-style minimums: `framework: v0.4.0`, `requires: {golem15.translate: v0.2.0}`. No semver ranges (Go's minimal version selection; a major bump changes the module path).
#### Runtime metadata for the Installed tab
- **D-06:** `summer build` reads each plugin's `plugin.yaml` and bakes name and description into `plugins.gen.go`. Plugins without a `plugin.yaml` show only their ID.
- **D-07:** Version: module installs use the version from `go.mod`/build info; submodule or local-`replace` plugins get `git describe --tags` run in the plugin directory at build time (e.g. `v0.3.1-4-gabc123`), also baked into `plugins.gen.go`.
#### Install resolution
- **D-08:** `summer plugin:install golem15.journal` picks the newest tag whose minimum framework version the app's `go.mod` already satisfies; `golem15.journal@v0.3.0` pins. If only tags needing a newer framework exist, it fails and names the framework version to move to (it does not bump the framework silently).
- **D-09:** Missing required plugins are resolved transitively, the full list of additions is printed, and the user confirms; `--yes` skips the prompt and non-interactive runs require `--yes`. Dependencies install in the same mode as the requested plugin (module, or submodule under `--source`).
- **D-10:** `summer plugin:update [id]` is in scope: module installs move to the newest compatible tag (`go get`), submodule installs are checked out at the newest compatible tag. Without an ID it updates all plugins it can resolve.
- **D-11:** Git-URL installs are submodule-only in v1; no `--module`. Close the open question in `.planning/research/questions.md` as "not in v1". — **Reversibility:** reversible — adding `--module` later is additive.
- **D-12:** A git-URL plugin's own repo is never sent to summercms.io, but its required plugin IDs (e.g. `golem15.translate`) are resolved through the registry like any ID install. `--offline` disables registry calls and then requires the dependencies to be installed already.
- Both modes finish with the same registration `plugin:add` does (`summer.yaml`, `go.mod`, `go.work` where applicable), and module-installed plugins must work with the build steps that currently inspect plugin directories (`internal/build/leaf.go`, `internal/build/registry.go`) — resolve their directory from the module cache.
#### Registry ingestion and API (summercms.io, `golem15.summercms` site plugin)
- **D-13:** Pull ingester: given a repo URL it clones anonymously, reads tags, each tag's `plugin.yaml`, and the README. It runs as a River periodic job (around hourly) and on an authenticated "ingest now" endpoint that `changelog-post.py publish --repo` calls. No forge webhooks.
- **D-14:** The listing is admin-curated: a summercms.io admin adds a repo URL; the ingester fills the facts. A plugin is published only once it has a tag with a valid `plugin.yaml`; tags without one are skipped.
- **D-15:** Every `vX.Y.Z` tag is stored as a version row with that tag's framework and plugin minimums (needed by D-08). README is stored for the latest tag only.
- **D-16:** Public read-only JSON API, no auth, open CORS, cache headers: `GET /api/registry/v1/plugins?q=&category=` (list/search), `GET /api/registry/v1/plugins/{id}` (detail incl. README as markdown and rendered HTML), `GET /api/registry/v1/plugins/{id}/versions`. Consumed by the Nuxt marketplace pages, the CLI and cabana. — **Reversibility:** one-way — once released `summer` binaries call `/api/registry/v1`, its shape cannot change without a v2 path.
- Presentation fields (category, featured, screenshots, icon, sort order) are edited in the summercms.io admin (from the decision note).
#### Admin Plugins screen
- **D-17:** The SPA talks only to its own backend: cabana gets swag-annotated admin endpoints that call the registry with a timeout and short cache, and compute "update available" in Go against installed versions. No CSP/CORS change in the admin.
- **D-18:** Config key `plugins.registry_url` (default `https://summercms.io`); empty disables registry calls, which hides the Marketplace tab and update badges while Installed still works. The CLI reads the same setting (allows a staging or self-hosted registry). Exact key name is planner's choice if it clashes with existing config.
- **D-19:** New permission (a `system.plugins.view`-style key in cabana's permission set), granted to superusers by default.
### Claude's Discretion
- Marketplace page layout and visuals on `vue-summercmsio-app` (list, search, category, detail); `/msd-ui-phase 34` can produce a UI contract if wanted.
- Storage of D-03 overrides inside `plugin.yaml`.
- Registry DB schema, ingester error handling, cache durations, periodic interval.
- Whether older tags (before `plugin.yaml` existed) get backfilled; default per D-14 is to skip them.
- Exact CLI output/prompt wording and the semantics of `plugin:update` with no ID when some plugins can't be resolved.
### Deferred Ideas (OUT OF SCOPE)
- `--module` for git-URL (private) installs. Revisit if submodule-only proves limiting.
- Already out of scope per the decision note: paid plugins, licensing, developer accounts, third-party submissions, themes, installing from the admin panel.
- Reviewed Todos (not folded): 17 todos matched on keywords only (e.g. gate scripts naming apps, OIDC parity, MFA findings, menu plugin port). None concern the marketplace; none folded.
</user_constraints>
<phase_requirements>
## Phase Requirements
The roadmap lists "Requirements: TBD" and no requirement IDs were provided. The five success criteria are the acceptance surface; this table maps them so the planner can treat them as SC-1..SC-5.
| ID | Description | Research Support |
|----|-------------|------------------|
| SC-1 | Every public `sm-*-plugin` repo carries a framework-validated `plugin.yaml`; anonymous fetch works | §Manifest generation, §Finding F1 (13 plugins return a const, not a literal), §Plugin repo survey, anonymous `git ls-remote` probe |
| SC-2 | summercms.io ingests manifest/README/versions on tag, serves the registry API, renders /marketplace; presentation fields in admin | §Ingester, §Registry API shape, §summercms.io layout, §Marketplace pages |
| SC-3 | `plugin:install <id>` (module; `--source` submodule) and `plugin:install <git-url>` (submodule), with requirement checks and `plugin:add`-style registration | §Install resolution, §Findings F2–F5 (go.work replace, effective framework version, `ConfirmProceed`) |
| SC-4 | Admin Plugins screen: Installed (versions, updates) + Marketplace (search, copy command) | §Admin screen, §Runtime metadata (D-06/D-07) |
| SC-5 | Unit tests in the last plan | §Validation Architecture |
</phase_requirements>
## Project Constraints (from CLAUDE.md)
From `summercms.go/CLAUDE.md`, `../CLAUDE.md` and `~/.claude/CLAUDE.md` (same authority as locked decisions):
- **No new dependency** without a research doc or a phase/decision note naming it (`.planning/research/STACK.md` is the decided set). This research recommends **zero new Go or npm dependencies** (see Standard Stack).
- YAML is parsed with `goccy/go-yaml`, never `gopkg.in/yaml.v3`.
- Standard library first.
- Framework code never names a consuming application (READMEs, docs, examples use `acme`/`blog`). The registry default URL `https://summercms.io` is the framework's own site, not a consuming app, but **code comments and docs must not name `sm-summercmsio-app`**.
- A new framework module gets a beach-themed name, a README in the standard structure (H1, one-sentence summary, import line, `**Name:**`, Overview, Features, Usage, API reference, optional Configuration/CLI, Dependencies, Testing) and a row in the root `README.md` table.
- A change to a module's exported API, config keys, CLI commands or dependencies updates that module's README and the affected `docs/` pages **in the same commit**. Every identifier in docs must exist (`summer docs:build --check`, `go test ./cmd/summer -run TestDocsTree`). New commands must pass `TestCommandsDocumented` (description, long help, examples, described args/flags).
- Core plugins (user, blog/journal, pages, payment, …) are used by many apps: **no breaking changes** unless asked. Plugin contracts (routes, payloads, tables, migration IDs, config keys) stay stable.
- Plugin repos: commit and push the plugin first, then the app's submodule pointer bump as a separate commit. Never stage files inside a submodule from the app repo.
- Lean planning: few, large plans; present plan count + one-line scopes and wait for confirmation; **unit tests are the last plan**; earlier plans may carry smoke tests.
- State updates through `msd_run query state.*` handlers; g15office sync comment when the phase advances.
- No co-author tags; one logical change per commit; planning docs and code in separate commits; stage files by explicit path (other sessions work concurrently, often in cabana — check for in-flight edits before touching it).
- Don't push, tag or deploy without the user's go-ahead. Release tags only at phase completion, on the default branch (memory). Every pushed framework tag gets a /changelog post; plugin tags get /changelog/plugins posts.
- Admin changes: rebuild `modules/boardwalk/dist`, commit it, pass `scripts/check-admin-dist.sh` before any tag (`.planning/notes/2026-10-07-embedded-admin-release-gate.md`).
- Keep `go vet ./...` and `go test ./...` green at every commit. Docker-backed tests skip under `-short`; a `TestMain` starting containers must call `flag.Parse()` and check `testing.Short()`.
## Summary
The phase spans four repo groups, and most of its risk is in the Go module and workspace mechanics, not in the UI. Probes against the real repos and Go 1.27.2 turned up five facts the planner must design around. They are not visible from CONTEXT.md:
1. **13 of 22 plugins return a constant, not a literal, from `ID()`**, and two (`sm-pgstripe-plugin/subscriptions`, `sm-paymentgateway-plugin`) use cross-package constants. The existing `pluginIDFromGo` already fails on them (`plugin:add` cannot register `golem15.mfa` today; reproduced). D-02's "literal returns" needs a narrow, static constant resolver. Otherwise most public plugins cannot get a `plugin.yaml` without editing `plugin.go`.
2. **A `--source` (submodule) install breaks the app's build**: every public plugin's committed `go.mod` carries `replace git.golem15.com/golem15/summercms => ../summercms.go`, and workspace modules' replaces apply. Reproduced; fixed by a `go.work`-level `replace` (verified).
3. **Apps created by `summer new` require the framework at `v0.0.0`** with a local replace, so "the version the app's go.mod satisfies" (D-08) must be the *effective* framework version: the newest tag reachable in the replaced checkout.
4. `bonfire.ConfirmProceed` returns **true** when not interactive, the opposite of D-09; `plugin:install` must not use it.
5. Module installs work out of the box: `go get` succeeds in workspace mode, non-main-module replaces are ignored, and proxy.golang.org already serves the public plugins. `go list -json` resolves every plugin's directory (workspace, replace or module cache) in one call, so `leaf.go`/`registry.go` need no change and the D-06/D-07 metadata step has one resolver.
On summercms.io, the site plugin today is routes-only. It gains models, migrations, admin, a scheduled ingest command, a public API with a CORS profile, and an authenticated ingest endpoint. Production nginx denies non-GET outside `/_journal/api/v1/` and 404s `/backend`, and `queue.work_in_serve` is `false`, so the deploy configs change too. The marketplace pages fit the existing changelog Node SSR app (same prefix-routing pattern) better than the static `nuxt generate` landing.
**Primary recommendation:** put the plugin.yaml spec (parse, validate, generate, check, const-resolving ID/Requires reader) and the registry HTTP client in one new public framework module. The CLI, the build, cabana, plugin repo tests and the summercms.io ingester then share one implementation. Use `go list -json`, `go mod edit -json`, `go get`, `go work edit` and `git` through `os/exec`, as the framework already does, and add no new dependencies.
## Architectural Responsibility Map
| Capability | Primary Tier | Secondary Tier | Rationale |
|------------|-------------|----------------|-----------|
| `plugin.yaml` generation/check | Dev CLI (`summer`, framework public module) | Plugin repo `go test` | Derived from plugin source; must run inside plugin repos and the publish script |
| Metadata baking (D-06/D-07) | Build tool (`internal/build`) | Runtime (`party`/cabana read it) | Only build time sees plugin dirs and git; runtime only reads baked values |
| Registry data (plugins, versions, presentation) | API/Backend (summercms.io site plugin, Postgres) | — | Single source of truth for CLI, cabana, Nuxt |
| Ingestion (clone, parse tags) | Backend job (conga scheduled command) | Backend HTTP (ingest-now endpoint) | Long-running, network-bound, must not run in browser or CLI |
| Install/update resolution | Dev CLI | Registry API (read) | Mutates app files and go.mod/go.work/submodules: local only |
| "Update available" computation | API/Backend (cabana, Go) | — | D-17: SPA talks only to its own backend |
| Plugins screen UI | Browser (boardwalk SPA) | — | Read-only view + clipboard |
| Marketplace pages | Frontend Server (Nuxt SSR, changelog Node app) | API (registry) | SEO-indexable, fresh data without rebuilding the embedded landing |
| README → HTML | API/Backend (ingester, `breakwater.Render`) | — | Sanitize once at write time; Nuxt renders stored HTML |
## Standard Stack
No new dependency is needed. Everything below is already in the framework `go.mod`, in the decided set, or a standard tool already shelled out to.
### Core (existing, reused)
| Component | Version | Purpose | Source of truth |
|-----------|---------|---------|-----------------|
| Go toolchain | 1.27 (`go 1.27.0` / `toolchain go1.27.0` lines; local go1.27.2) | `go list -json`, `go mod edit -json`, `go get`, `go work edit` via `os/exec` | `[VERIFIED: internal/build/scaffold.go:57-59]` `goVersionLine = "go 1.27.0"`, `toolchainLine = "toolchain go1.27.0"` |
| `go/ast`, `go/parser`, `go/token` | stdlib | Const-resolving `ID()`/`Requires()` reader | already used in `internal/build/scaffold.go`, `registry.go`, `leaf.go` |
| `github.com/goccy/go-yaml` | v1.19.2 | Parse and marshal `plugin.yaml` (struct field order = output order) | `[VERIFIED: go.mod]` |
| `github.com/yuin/goldmark` | v1.8.6 | README AST walk: H1 text and first paragraph for name/description | `[VERIFIED: go.mod]`; already used by `internal/docsite`, `modules/breakwater` |
| `modules/breakwater` (`breakwater.Render`) | in-tree | README markdown → sanitized HTML on summercms.io (GFM, raw HTML stripped, `http/https/mailto` links only, nofollow) | `[VERIFIED: modules/breakwater/breakwater.go:90]` |
| `modules/fetchguard` (`fetchguard.NewClient`, `TrustedMode`) | in-tree | Registry HTTP client with size cap, timeout, no redirects; `WithTransport` test seam | `[VERIFIED: modules/fetchguard/client.go:40, policy.go:23-30]` |
| `modules/compass` | in-tree | CLI reads `plugins.registry_url` from the app's `config/` + `SUMMER_` env | `[VERIFIED: modules/compass/README.md]` |
| `modules/conga` + `pact.HasSchedule` | in-tree (River v0.47.0) | Hourly ingest as a scheduled console command | `[VERIFIED: modules/pact/capabilities.go:166-176]` |
| `git` CLI | 2.56.0 locally; server: unverified | Ingester clone/tag reads; submodule installs; `git describe` | shelled out already in `internal/build/new.go:286` (`runGit`) |
| swag | v1.16.6 via `go run` | cabana annotations → `admin/openapi/admin.json` → `schema.d.ts` | `[VERIFIED: scripts/check-admin-openapi.sh]` |
### Alternatives Considered
| Instead of | Could Use | Tradeoff / why not |
|------------|-----------|--------------------|
| `go mod edit -json` for go.mod parsing | `golang.org/x/mod/modfile` | Not a dependency today (`go mod why -m golang.org/x/mod`: "main module does not need module golang.org/x/mod"); would need a decision note. `go mod edit -json` gives `Module.Path` and `Require[].Path/Version` (verified) with no dependency. |
| Strict `vX.Y.Z` comparer (≈20 lines) | `golang.org/x/mod/semver` | Registry versions are strict `vX.Y.Z` (D-15), so a strict comparer is enough. Never feed `git describe` output (`v0.3.1-4-gabc`) into a semver comparer: semver reads it as a pre-release that sorts **before** `v0.3.1`. |
| shell `git` in the ingester | `go-git` | New large dependency + decision note. Shell git is the framework's existing pattern; harden it with env (see Security). |
| Forge HTTP API (raw files, tags) | — | Ties ingestion to one forge; D-13 locks "clones anonymously". |
| Third Nuxt app for /marketplace | Extend the changelog SSR app | A third app means another supervisor program, port and nginx block. Reusing the changelog app adds one nginx prefix and reuses its fetch/swr/purge setup. Planner's discretion. |
**Installation:** none (no packages added).
## Package Legitimacy Audit
This phase installs **no external packages** (Go or npm). The audit is not applicable.
**Packages removed due to [SLOP] verdict:** none
**Packages flagged as suspicious [SUS]:** none
## Key Findings (verified in this session)
### F1. Most plugins return a constant from `ID()`; the current reader fails on them
`[VERIFIED: internal/build/scaffold.go:360-392]` `pluginIDFromGo` accepts only `*ast.BasicLit` of kind `token.STRING` in a `return` inside `func (…) ID()`. Probe (copy of that function run against real files):
```
sm-mfa-plugin/plugin.go => build: sm-mfa-plugin/plugin.go does not return a plugin id
sm-journal-plugin/plugin.go => golem15.journal <nil>
```
Survey of `ID()`/`Requires()` in all sibling plugins:
- Literal ID: faq, journal, menu, seo, sitemap, translate, user, summercms site plugin.
- `return PluginID` with a same-file `const PluginID = "golem15.<name>"` (`[VERIFIED: grep of plugin.go files]`): chatbots, chatchannels, chat, chatvideo, forum, herald, mfa, oauthserver, paymentgatewaysubscriptions, pgstripe, sociallogin, userfriends.
- Cross-package: `sm-paymentgateway-plugin/plugin.go:47` `const PluginID = payments.PluginID` (→ `payments/service.go:23` `const PluginID = "golem15.paymentgateway"`); `sm-pgstripe-plugin/subscriptions/plugin.go:83-85` `return []string{pgstripe.PluginID, pgsub.PluginID}` (one same-module package, one **other module**).
- `Requires()` are literal string slices or `nil` everywhere else.
**Consequence:** D-02's strict "literal returns" would make 13 plugins fail `plugin:manifest`, and `plugin:add`/git-URL install (which "registers like plugin:add") already fails for them.
**Recommendation (needs a quick user OK, since D-02 is locked):** a static resolver that still never runs code. It accepts (a) a string literal, (b) an identifier naming a package-level `const` whose value resolves recursively, in any non-test `.go` file of the same package directory, (c) `pkg.Ident` where `pkg`'s import path is in the same module (directory derived from module path) or in a required module (directory from `go list -m -json <module>` `.Dir`). Anything else (function call, var, concatenation with non-consts) is the D-02 error naming the function. Use the same resolver for `pluginIDFromGo` so `plugin:add` and `make:*` start working for const-ID plugins (a fix, not a behaviour break). The alternative, rewriting 13 `plugin.go` files to literal returns, touches core plugins and duplicates the exported `PluginID` constants.
### F2. `--source` (submodule) installs break the build unless go.work overrides plugin replaces
All public plugin repos commit `replace git.golem15.com/golem15/summercms => ../summercms.go` (`[VERIFIED: grep "replace" sm-*-plugin/go.mod]`, e.g. `sm-menu-plugin/go.mod:176`). Several also replace sibling plugins (`sm-pgstripe-plugin/go.mod:184-186`, `sm-chatbots-plugin/go.mod:150-152`). In workspace mode these replaces apply. Probe: app + `go.work use ./plugins/golem15/menu` (clone of v0.1.1):
```
plugins/golem15/menu/plugin.go:17:2: git.golem15.com/golem15/summercms@v0.4.0 (replaced by ./plugins/golem15/summercms.go): reading plugins/golem15/summercms.go/go.mod: ... no such file or directory
```
After `go work edit -replace=git.golem15.com/golem15/summercms=git.golem15.com/golem15/summercms@v0.4.0`, `go build` succeeded (rc=0). A go.work replace overrides module replaces of the same path. The demo app already does this by hand (`sm-demo-app/go.work`: `replace git.golem15.com/golem15/summercms => ../summercms.go` plus three plugin replaces with the comment "pgstripe, pgsub, presentations, quizzes and feedback replace these three modules with paths that only exist in their own development layouts").
**Rule for the installer:** after adding a submodule plugin to go.work, read its go.mod replaces (`go mod edit -json` → `Replace[]`). For every replaced module path `M` that the workspace does not already replace in go.work, add a go.work replace: to the app's own local replace target when the app's go.mod replaces `M` (framework dev layout), to the workspace dir of `M` when `M` is another installed submodule plugin, otherwise to `M@<version the app's go.mod requires>`. Whenever the app's framework requirement changes (`plugin:update`, update script), this pin must be refreshed. Document it as a pitfall.
### F3. The "app framework version" must be the effective one
`[VERIFIED: internal/build/stubs/new.tmpl:7,9]` `require {{.Framework}} v0.0.0` and `replace {{.Framework}} => {{.Replace}}`. A `summer new` app satisfies no `framework: vX` minimum by its go.mod line. Other apps require real tags (`sm-demo-app/go.mod:23` `git.golem15.com/golem15/summercms v0.5.1`) but may still replace locally.
**Algorithm:** `effectiveFramework(app)`. If the app's go.mod (or go.work) replaces the framework with a local directory, run `git -C <dir> describe --tags --abbrev=0 --match 'v[0-9]*'`. That is the newest tag reachable from the checkout's HEAD, so HEAD has at least its features. If that fails (no git, no tags), fall back to the go.mod require version and warn. Otherwise use the go.mod `require` version. Bake the same value into `plugins.gen.go` so cabana compares updates against what was actually built. At runtime `bonfire.BuildVersion().Framework` reports the go.mod require (`v0.0.0` for such apps) `[VERIFIED: modules/bonfire/version.go:31-51]`.
### F4. `ConfirmProceed` auto-confirms off a terminal
`[VERIFIED: modules/bonfire/helpers.go:144-149]`: "Off a terminal, with -n or -q and in bonfire.Call it returns true without asking". D-09 requires the opposite. Use `bonfire.Interactive(out)` (`helpers.go:58`): interactive means `out.Confirm(question, false)`; non-interactive without `--yes` returns an error with a hint naming `--yes`.
### F5. Module installs and directory resolution work with stock Go
- `go get git.golem15.com/golem15/sm-menu-plugin@v0.1.1` inside a go.work workspace succeeded and edited the cwd module's go.mod (`sm-menu-plugin v0.1.1 // indirect`, `summercms v0.4.0 // indirect`). The plugin's own `replace … => ../summercms.go` was ignored, as expected for a non-main module.
- `GOPROXY=https://proxy.golang.org,direct` (local default) and `https://proxy.golang.org/git.golem15.com/golem15/sm-menu-plugin/@v/list` returned `v0.1.0 v0.1.1`. The public proxy and sum.golang.org already serve these modules, so users need no GOPRIVATE setup for public plugins.
- `go list -e -json=ImportPath,Dir,Module <import paths…>` in `sm-demo-app` (0.37 s for 3 plugins) returned `Dir` and `Module{Path,Version,Replace,Main,Dir}` for a workspace module (`Main: true`), a go.work-replaced module (`Version: v0.1.13`, `Replace.Dir`) and the nested package `…/sm-pgstripe-plugin/subscriptions` (`Dir` = the subdirectory, `Module.Dir` = repo root). `go list -m -json` of a cached module gives `Dir: /home/jin/go/pkg/mod/git.golem15.com/golem15/sm-menu-plugin@v0.1.1`.
- `[VERIFIED: internal/build/leaf.go:22-49]` `checkModelsLeaf` skips plugins whose dir is not found via `localModuleDir`/`defaultPluginDir` or is outside the app root. Module-cache plugins are skipped silently, which is correct: the leaf rule is a plugin-author check. **No change is needed in leaf.go.** `registry.go` (`refreshRegistry`) runs only from `make:*` on local plugins; it must never write into the module cache (read-only files).
- **Conclusion:** use one helper, `resolvePluginDirs(appDir, manifest)` → `go list -e -json` over all `summer.yaml` import paths (with `applyGoWork`). The metadata step (D-06/D-07) uses it. The helper must tolerate failures (warn, ID-only metadata) so `summer build` never fails because of metadata.
### F6. summer.yaml `module:` is an import path, and one repo can hold two plugins
`[VERIFIED: sm-demo-app/summer.yaml]` `- id: golem15.pgstripesubscriptions` / `module: git.golem15.com/golem15/sm-pgstripe-plugin/subscriptions` (no `subscriptions/go.mod`). The `sm-pgstripe-plugin` repo ships two plugins. **plugin.yaml must be per plugin package directory**, not per repo: `subscriptions/plugin.yaml` next to `subscriptions/plugin.go`. Each file carries the go.mod module path (what `go get` takes) and the package import path (what `summer.yaml` lists). The ingester finds them with `git ls-tree -r --name-only <tag>` filtered to `(^|/)plugin.yaml$`. Requires within the same module carry no separate minimum, because they ship in the same release.
### F7. README H1 is the plugin ID in 13 repos
`[VERIFIED: head of each README.md]` H1 is `# golem15.<name>` in faq, journal, menu, mfa, oauthserver, paymentgateway, paymentgatewaysubscriptions, pgstripe, seo, sitemap, sociallogin, translate, user (and `pgstripe/subscriptions/README.md`). It is a human name in chatbots ("Chat bots"), chatchannels, chat, chatvideo, forum, herald, userfriends ("Friends"). The second paragraph is one sentence in all of them.
**Recommendation:** when H1 equals the ID, `plugin:manifest` fails with a hint to pass `--name="…"` (persisted per D-03), rather than publishing "golem15.journal" as a display name or inventing a title-case transform. Rollout then needs one `--name` per such repo.
### F8. Go.mod requirements that cannot be installed as modules
`sm-chatbots-plugin/go.mod:6` requires `git.golem15.com/golem15/sm-chat-plugin v0.0.0` (with a local replace). A consumer `go get` would fail on `v0.0.0`. `sm-userfriends-plugin/go.mod:6` uses a pseudo-version (fetchable). `plugin:manifest` should report a plugin requirement at `v0.0.0` as an error ("not a released version"), and the ingester should reject such tags as invalid (D-14). Pseudo-versions: allow, with a warning.
### F9. Untagged and private repos
Anonymous `git ls-remote https://git.golem15.com/golem15/<repo>.git` (this session) succeeded for every sibling plugin repo plus quizzes, presentations, golem and feedback. `sm-summercmsio-plugin` is private, which is fine: it is a site plugin, not listed. Tag counts on origin: chatbots 0, chatchannels 0, chatvideo 0, forum 0, herald 0, userfriends 0, seo 1, quizzes 1, others 2–6. Untagged repos are not published until tagged (D-14). The go-get meta is served: `<meta name="go-import" content="git.golem15.com/golem15/sm-user-plugin git https://git.golem15.com/golem15/sm-user-plugin.git">`.
### F10. summercms.io deploy constraints
- `[VERIFIED: sm-summercmsio-app/deploy/nginx/summercms.io.conf]` `location ^~ /backend { return 404; }`, and `limit_except GET HEAD { deny all; }` on `/`, `/changelog`, `/changelog/`. POST is allowed only under `location ^~ /_journal/api/v1/`. The ingest-now endpoint needs its own nginx location; the summercms.io admin (presentation fields) is reached through the existing SSH tunnel, like `changelog-post.py backfill`.
- `[VERIFIED: sm-summercmsio-app/config/queue.yaml]` `work_in_serve: false` ("The site has no jobs, so serve does not start a worker"). The hourly scheduled ingest never runs unless this becomes `true`, or a separate `queue:work` supervisor program is added.
- `[VERIFIED: sm-summercmsio-app/deploy/supervisor/summercms-io-changelog.conf]` changelog Node SSR on `NITRO_PORT="3095"`, `NUXT_JOURNAL_API_BASE="http://127.0.0.1:8095/_journal/api/v1"`.
- `[VERIFIED: sm-summercmsio-app/plugins/golem15/summercms/links_test.go:45]` `var nodePaths = []string{"/changelog"}`. A landing link to `/marketplace` must be added there, or `TestLandingLinks` will try to resolve it through the binary.
- Release builds fail on drift of committed `main.go`/`plugins.gen.go` (`sm-summercmsio-app/scripts/build.sh:160`, `sm-demo-app/scripts/build.sh:82`). The D-06/D-07 changes regenerate both files in every app, so each app needs one regeneration commit after upgrading.
## Architecture Patterns
### System Architecture Diagram
```
plugin repo (sm-x-plugin) summercms.io (Go binary + Postgres) Nuxt SSR (changelog app, :3095)
───────────────────────── ───────────────────────────────────── ───────────────────────────────
plugin.go, go.mod, README.md admin (SSH tunnel): add repo URL, presentation ─┐
│ summer plugin:manifest │ │
▼ ▼ │
plugin.yaml (committed) ── tag vX.Y.Z ──► [ingest] hourly scheduled cmd ◄── POST /api/registry/v1/ingest (g15_ token, scope registry)
│ go test: --check │ git ls-remote (changed?) → bare partial clone ▲
│ │ per vX.Y.Z tag: ls-tree → plugin.yaml(s) → validate │ changelog-post.py publish --repo
│ │ latest tag: README → breakwater.Render │ (after plugin:manifest --check)
│ ▼
│ registry tables (plugins, versions, presentation, attachments)
│ │
│ ▼
│ GET /api/registry/v1/plugins[?q,category] | /{id} | /{id}/versions (CORS *, Cache-Control)
│ │ │ │
│ ▼ ▼ ▼
│ summer CLI (dev machine) cabana (app backend) /marketplace pages (SSR, swr)
│ plugin:install / update GET /plugins (installed + updates)
│ │ GET /plugins/marketplace?q=
│ ▼ │
│ ┌──── ID ──► resolve newest compatible ───┐ ▼
│ │ (effective framework, deps) │ boardwalk SPA: Plugins screen
│ ▼ ▼ (Installed | Marketplace, copy command)
│ module: go get mod@v --source / git URL: clone → submodule add
│ │ → go.work use + go.work replace overrides
│ └──────────────► summer.yaml + go.mod (+ go.work) ◄─┘
│ │
└────────── module cache / submodule ─────┤ summer build: go list -json → plugin dirs
│ read plugin.yaml, git describe → plugins.gen.go PluginInfo
▼
app binary: party publishes PluginInfo → cabana Installed tab
```
### Recommended Project Structure (new/changed files)
```
summercms.go/
├── modules/<new-module>/ # NEW public module (name: beach-themed, e.g. "kiosk" — planner's choice)
│ ├── manifest.go # plugin.yaml types, Parse, Validate, Marshal (goccy), schema version
│ ├── derive.go # Derive(dir): go.mod via `go mod edit -json`, README via goldmark, ID/Requires resolver
│ ├── resolve_ast.go # const-resolving ID()/Requires() reader (F1)
│ ├── check.go # Check(dir) -> stale diff; CheckT(t, dir) helper for plugin repo tests
│ ├── client.go # registry client over fetchguard (List, Get, Versions), JSON types
│ ├── version.go # strict vX.Y.Z compare, git-describe base-tag parsing
│ └── README.md
├── internal/build/
│ ├── build.go # generatePluginsGen + generateMain: PluginInfo, effective framework version
│ ├── plugindirs.go # NEW: go list -json resolver (F5), git describe (D-07)
│ ├── install.go # NEW: InstallModule, InstallSource, InstallGitURL, Update; go.work overrides (F2)
│ ├── scaffold.go # AddPlugin gains a require-version option; pluginIDFromGo -> shared resolver
│ └── manifest.go # unchanged API (SaveManifest drops summer.yaml comments — see Pitfalls)
├── cmd/summer/main.go # plugin:manifest, plugin:install, plugin:update commands
├── modules/party/ # Info type + publish/lookup of baked metadata (additive)
├── modules/cabana/ # plugins.go (handlers), admin_openapi.go annotations, permission + settings entry
├── modules/phrasebook/backend/lang/{en,pl}/lang.yaml # strings for screen + permission
├── admin/src/views/PluginsView.vue, admin/src/app/router.ts, admin/src/state/useSettings.ts
├── admin/openapi/admin.json, admin/src/api/schema.d.ts (generated), modules/boardwalk/dist (rebuilt)
└── docs/… # console/scaffolding.md, architecture/go-modules-and-workspaces.md, a new plugins/marketplace page
sm-summercmsio-app/
├── plugins/golem15/summercms/ # site plugin (submodule sm-summercmsio-plugin)
│ ├── models/, updates/, controllers/ (admin YAML), console/ (registry:ingest), classes/ingest/, controllers/api/registry.go
│ └── token_scopes.go, admin_permissions.go, lang/
├── config/queue.yaml (work_in_serve), config/http.yaml (cors_profiles.registry), config/plugins.yaml (optional)
├── deploy/nginx/summercms.io.conf (/marketplace → :3095, POST ingest), deploy/supervisor (if separate worker)
├── scripts/changelog-post.py (+ test_changelog_post.py)
└── vue-summercmsio-app/changelog/app/pages/marketplace/… (+ nuxt.config routeRules, runtimeConfig.registry)
```
### Pattern 1: plugin.yaml format (recommendation; D-04 makes it costly to change)
Include a schema version from day one, so the ingester and old `summer` binaries can branch later. Keep the generated text and the overrides separate.
```yaml
# Generated by summer plugin:manifest. Do not edit; rerun the command.
schema: 1
id: golem15.journal
module: git.golem15.com/golem15/sm-journal-plugin
package: git.golem15.com/golem15/sm-journal-plugin # import path summer.yaml lists; differs for nested plugins (…/subscriptions)
name: Journal
description: The compiled journal plugin for SummerCMS applications: translatable posts and categories, tags, a settings singleton, and the tables a host migrate creates for a blog.
framework: v0.5.1 # go.mod require of git.golem15.com/golem15/summercms
requires:
golem15.translate: v0.1.0 # Requires() IDs, minimum from go.mod require of that plugin's module
overrides: # D-03: persisted --name/--description; absent when unused
name: Journal
```
- `[ASSUMED]` field names (`schema`, `package`, `overrides`) are recommendations; the D-02/D-05 fields (`id`, module, `name`, `description`, `framework`, `requires`) come from CONTEXT.
- Values in the example: `framework: v0.5.1` and `golem15.translate: v0.1.0` are quoted from `[VERIFIED: sm-journal-plugin/go.mod:6,8]` (`git.golem15.com/golem15/sm-translate-plugin v0.1.0`, `git.golem15.com/golem15/summercms v0.5.1`). The ID and Requires come from `[VERIFIED: sm-journal-plugin/plugin.go:44,46]` (`return "golem15.journal"`, `return []string{"golem15.translate"}`). The description is the README's second paragraph. Note that `name: Journal` is a `--name` override, because that README's H1 is `# golem15.journal` (F7).
- Emit with `goccy/go-yaml` `Marshal` of an ordered struct (deterministic) plus the header comment. `--check` regenerates and compares bytes.
- A requirement ID whose module is not in go.mod (soft dependency) gets an empty minimum (`""` = any). The ID→module mapping comes from resolving each required module's directory (`go list -m -json`) and reading its plugin ID with the F1 resolver.
### Pattern 2: Const-resolving ID reader (F1)
```go
// Source: pattern derived from internal/build/scaffold.go:360-392 (pluginIDFromGo), extended.
// resolveString evaluates expr to a string constant without running code.
func (r *resolver) resolveString(pkgDir string, file *ast.File, expr ast.Expr) (string, error) {
switch e := expr.(type) {
case *ast.BasicLit: // "golem15.journal"
if e.Kind != token.STRING { return "", errNotConst }
return strconv.Unquote(e.Value)
case *ast.Ident: // PluginID -> package-level const in pkgDir
return r.packageConst(pkgDir, e.Name)
case *ast.SelectorExpr: // payments.PluginID, pgsub.PluginID
imp := importPathFor(file, e.X) // from file.Imports, honouring named imports
dir, err := r.dirForImport(imp) // same module: module root + suffix; else `go list -m -json` Dir
if err != nil { return "", err }
return r.packageConst(dir, e.Sel.Name)
}
return "", errNotConst // D-02 error names the function: "plugin.go: ID() must return a string literal or constant"
}
```
`Requires()` accepts `nil`, or a `*ast.CompositeLit` of `[]string` whose elements each go through `resolveString`.
### Pattern 3: Plugin directory resolution (F5) and metadata baking (D-06/D-07)
```go
// go list -e -json=ImportPath,Dir,Module,Error <every summer.yaml module> in appDir, with applyGoWork(cmd, appDir).
type listedPkg struct {
ImportPath string
Dir string
Module *struct {
Path, Version, Dir string
Main bool
Replace *struct{ Path, Dir, Version string }
}
}
```
Per plugin:
- `plugin.yaml` is read from `Dir`; it is optional.
- Version: if `Module.Main` (workspace module) or `Module.Replace` has a local `Dir`, run `git -C <Module.Dir> describe --tags --match 'v[0-9]*'` only when `git -C <Module.Dir> rev-parse --show-toplevel` equals `Module.Dir` (its own repo or submodule). Otherwise it is an in-app plugin with no version. Without `--dirty` (see Pitfall 6). Else (module cache): `Module.Version`.
- Source: `module` | `submodule` | `local`.
Generated additions to `plugins.gen.go` (and one line in `generateMain`). The type lives in `party`; adding it is additive:
```go
// PluginInfo is the plugin metadata summer build read from plugin.yaml and git.
var PluginInfo = []party.Info{
{ID: "golem15.journal", Module: "git.golem15.com/golem15/sm-journal-plugin", Name: "…", Description: "…", Version: "v0.2.5", Source: "module"},
}
// FrameworkVersion is the effective framework version the build used (F3).
const FrameworkVersion = "v0.5.3"
```
`[VERIFIED: internal/build/build.go:125]` the generated main calls `party.Activate(app, PluginIDs)`; add a publish of the info (e.g. `party.Describe(app, PluginInfo, FrameworkVersion)`) before it. `[ASSUMED]` names `party.Info`/`party.Describe`.
### Pattern 4: Install resolution (D-08/D-09/D-12)
```
install(arg, flags):
app := FindAppDir; m := LoadManifest; fw := effectiveFramework(app) // F3
if arg is git URL (https://, ssh://, scp-like user@host:path; never starting with "-"):
tmp := git clone -- <url> plugins/.summer-install-<rand> // GIT_ALLOW_PROTOCOL=https:ssh
pick tag: newest vX.Y.Z whose `git show <tag>:<path>/plugin.yaml` framework <= fw; else default-branch HEAD with a warning
checkout tag; read plugin.yaml(s); validate; target := plugins/<vendor>/<name>; rename tmp -> target
deps := plugin.yaml requires (resolved via registry unless --offline; --offline: must already be in summer.yaml)
else (ID[@vX.Y.Z]):
if registry disabled or --offline: error with hint
versions := GET /plugins/{id}/versions; choose pinned or newest with framework <= fw
none compatible: error "golem15.x vA.B.C needs framework >= vF; update the framework (current vE)"
deps := chosen.requires
closure: for each dep not in summer.yaml -> choose newest compatible with framework AND >= dep minimum;
dep already installed -> check installed version >= minimum, else error naming `summer plugin:update <dep>`
print additions (id@version, mode); if !--yes: Interactive? Confirm : error "non-interactive run needs --yes" (F4)
apply:
module mode: one `go get mod1@v1 mod2@v2 …` (applyGoWork; MVS sees the full set), then append summer.yaml entries
source mode: per plugin: git clone/checkout tag -> `git submodule add <url> <path>` (adopts the clone) ->
`git submodule absorbgitdirs` -> AddPlugin-equivalent with require version = tag -> go.work replace overrides (F2)
finish: print "run summer build"
```
- `git submodule add` adopts an existing clone ("Adding existing repo at 'plugins/golem15/menu' to the index"). `git submodule absorbgitdirs` then moved `.git` into `.git/modules/…`, and `git submodule status` shows `86564746… plugins/golem15/menu (v0.1.1)` (verified in scratch).
- Not a git repo (`summer new --no-git`): `git submodule add` fails. Use a plain clone and a warning, or error with a hint; planner's choice.
- `AddPlugin` today writes `-require=<mod>@v0.0.0` and a go.mod `replace` (`[VERIFIED: internal/build/scaffold.go:394-406]`). For registry `--source` installs, pass the real tag as the require version, so a `GOWORK=off` release build (`sm-demo-app/scripts/build.sh` uses `GOWORK=off … go build`) and pin checks match. Keep `plugin:add`'s `v0.0.0` default unchanged.
- `plugin:update [id]`: modules use `go get mod@newest-compatible`; submodules use `git -C dir fetch --tags`, `git checkout <tag>` and `go mod edit -require=mod@tag`. Without an ID: every summer.yaml plugin that resolves (registry ID, or a git-URL submodule via its own remote's tags). Report the skipped ones and exit 0 unless one that resolved failed (discretion).
### Pattern 5: cabana Plugins endpoints (D-17/D-19)
- Routes inside the existing `r.GroupRaw(api, []string{"backend", "locale.from-principal"}, …)` block (`[VERIFIED: modules/cabana/http.go:316-339]`): `g.Get("/plugins", s.pluginsInstalled)` and `g.Get("/plugins/marketplace", s.pluginsMarketplace)`. Both are two-segment literal paths, so they do not collide with `/{vendor}/{plugin}/{controller}` (three segments) or `/settings/{code}`.
- Permission: existing framework permissions use the `backend.*` namespace: `[VERIFIED: modules/cabana/backend_screens.go:18,21]` `PermissionManageUsers = "backend.manage_users"`, `PermissionManageRoles = "backend.manage_roles"`, declared with `Tab: "backend::lang.permissions.tab_system"` (`backend_screens.go:84-85`), no `Roles`. Recommend `backend.view_plugins` (D-19 allows the exact key) declared in `backendScreens.Permissions()`. Superusers pass every check (`modules/cabana/permissions_test.go:31` superuser case allows `a.b.c`), so "granted to superusers by default" needs no code.
- Settings link: `pact.SettingsItem` link entries only target an admin **controller** (`[VERIFIED: modules/pact/capabilities.go:881-898]`), and the SPA maps `entry.controller` to a list route (`admin/src/state/useSettings.ts:34-39`). A custom view needs an additive field, e.g. `Path string` on `cabana.SettingsEntry` (`modules/cabana/navigation.go:23-35`) set by cabana's own entry, with the SPA's `settingsPath` preferring `entry.path`. Do not add it to `pact` unless plugins need it.
- Registry calls: `fetchguard.NewClient(fetchguard.Policy{Mode: fetchguard.TrustedMode, MaxBytes: …}, app.Config)` (no redirects, so `plugins.registry_url` must be the final origin). Timeout of about 3–5 s, in-process TTL cache (list/search about 5 min, per-ID versions about 15 min), concurrency limit of about 4 for per-installed-plugin version lookups. Registry errors give HTTP 200 with `registry: {status: "unavailable"}` so the Installed tab still renders.
- Update rule: `latest := newest version with framework <= FrameworkVersion`; compare it with the installed base tag (strip `-N-gHASH` from `git describe`); `update_available = latest > base`.
- swag annotations in `admin_openapi.go`, then `scripts/check-admin-openapi.sh`; update `TestPhase09PermissionMatrix`/`TestPhase09ContractInventory` (`modules/cabana/phase09_contract_test.go`, `security_coverage_test.go`), which fail when routes and annotations diverge.
### Pattern 6: boardwalk view
- New route in `admin/src/app/router.ts`, e.g. `{ path: '/system/plugins', name: 'plugins', component: PluginsView, meta: { shell: true } }`, placed before the `/:vendor/:plugin/:controller` patterns. A two-segment path cannot collide with them anyway.
- Tabs: `reka-ui` is already a dependency (`admin/package.json` `"reka-ui": "2.9.10"`), so use its Tabs primitives. The copy button uses the existing pattern in `admin/src/components/account/ApiTokenCreateDialog.vue:260-263` (`navigator.clipboard.writeText`, with a fallback when `navigator.clipboard` is missing).
- Data through the typed `api` client (`admin/src/api/client.ts`) only. Render registry text as text; do not render README HTML in the admin in v1.
- Strings in `modules/phrasebook/backend/lang/{en,pl}/lang.yaml`. Then `npm --prefix admin run build`, commit `modules/boardwalk/dist`, `scripts/check-admin-dist.sh`.
### Pattern 7: summercms.io registry (site plugin `golem15.summercms`)
- Follow `sm-faq-plugin` as the template: `updates/registry.go` `Register`/`All`, raw-SQL `CREATE TABLE` migrations with IDs like `202610110001_create_golem15_faq_faqs`, `pact.HasMigrations`/`HasModels`/`HasAdminControllers`/`HasPermissions`/`HasNavigation`, embedded admin YAML (`[VERIFIED: sm-faq-plugin/updates/*.go, admin*.go]`). Tables: `golem15_summercms_registry_plugins`, `golem15_summercms_registry_versions` (schema is discretion, see below).
- Ingest auth mirrors the Journal API: `cabana.ResolveBackend(app, r, "golem15.summercms.*")` + `cabana.Allows(pr, []string{"golem15.summercms.registry_ingest"})` (`[VERIFIED: sm-journal-plugin/controllers/api/auth.go:83-104]`), plus a `pact.HasTokenScopes` scope (`sm-journal-plugin/token_scopes.go` pattern) such as `registry`, with `Permissions: []string{"golem15.summercms.*"}` and `Methods: ["POST"]`.
- Scheduled ingest: a console command `summercms:registry-ingest [id]` + `Schedule() []pact.ScheduledCommand{{Command: "summercms:registry-ingest", Cadence: pact.Every(time.Hour)}}` (README example shape `[VERIFIED: modules/conga/README.md:119-125]`). Requires `queue.work_in_serve: true` (F10).
- Public API: `r.Group("/api/registry/v1", surf.Use("throttle:<bucket>", "cors:registry"), …)` with a `http.cors_profiles.registry` profile (`allowed_origins: ['*']`, GET/HEAD, no credentials) per `[VERIFIED: modules/surf/README.md:31]` named CORS profiles. Set `Cache-Control: public, max-age=300` (discretion) and an ETag. The site plugin's `GET /` catch-all is less specific, so `/api/registry/v1/…` wins.
### Proposed registry API shape (D-16 is one-way: decide carefully)
`[ASSUMED]`: this is a design proposal for user/planner sign-off, not an existing contract.
```jsonc
// GET /api/registry/v1/plugins?q=journal&category=content
{ "data": [ { "id": "golem15.journal", "name": "Journal", "description": "…", "module": "git.golem15.com/golem15/sm-journal-plugin",
"package": "git.golem15.com/golem15/sm-journal-plugin", "repository": "https://git.golem15.com/golem15/sm-journal-plugin.git",
"category": "content", "featured": true, "icon_url": "https://summercms.io/storage/uploads/…",
"latest_version": "v0.2.5", "latest_framework": "v0.5.1", "updated_at": "2026-10-29T10:00:00Z" } ],
"meta": { "total": 1 } }
// GET /api/registry/v1/plugins/{id} -> { "data": { …list fields, "readme_markdown": "…", "readme_html": "…", "screenshots": [{"url","caption"}] } }
// GET /api/registry/v1/plugins/{id}/versions -> { "data": [ { "version": "v0.2.5", "framework": "v0.5.1",
// "requires": { "golem15.translate": "v0.1.0" }, "module": "…", "package": "…", "tagged_at": "…" } ] } // newest first
```
Forward-compatibility rules: always use an envelope object (`data`, `meta`); clients ignore unknown fields; only additive changes within v1; 404 → `{"error": {...}}` for unknown IDs. Per-version `module`/`package` let a later major version change the module path (`/v2`).
### Anti-Patterns to Avoid
- **Running plugin code to read its ID** (`go run` a probe that blank-imports the plugin): it executes init() of untrusted code and contradicts D-02's static intent.
- **Writing into the module cache** (e.g. `refreshRegistry` on a cached plugin): the files are read-only and shared.
- **`bonfire.ConfirmProceed` for the install prompt** (F4).
- **Comparing `git describe` strings with semver**: a pre-release sorts below its base tag.
- **Calling the registry from the SPA directly**: violates D-17 and CSP.
- **Prerendering /marketplace into the embedded landing**: new plugins would need a binary release to appear.
- **Calling `go get` with registry-provided strings without validation**: validate the module path (`validateModulePath`, which rejects a leading `-`, `[VERIFIED: internal/build/manifest.go:270-292]`) and the version (`^v\d+\.\d+\.\d+$`) first.
## Don't Hand-Roll
| Problem | Don't Build | Use Instead | Why |
|---------|-------------|-------------|-----|
| go.mod parsing (requires, replaces) | Extending the line scanner `parseGoMod` (`scaffold.go:494-535`) to handle `require (` blocks | `go mod edit -json` | Verified structured output; handles every go.mod syntax form |
| Locating plugin source dirs | Guessing `plugins/<vendor>/<name>` or `$GOMODCACHE/<path>@<ver>` (case-encoding of uppercase letters!) | `go list -e -json` / `go list -m -json` | Handles workspace, replace, nested packages, module-cache path escaping |
| Adding go.work entries | Text edits of go.work | `go work use` (already `runGoWorkUse`), `go work edit -replace=` | Verified override behaviour |
| Markdown → HTML for READMEs | goldmark + a custom policy | `breakwater.Render` | Existing decided policy (GFM, safe, nofollow) |
| Outbound HTTP to the registry | `http.DefaultClient` | `fetchguard.Client` (TrustedMode) | Size caps, timeouts, no redirects, test transport seam |
| Submodule plumbing | Hand-writing `.gitmodules` | `git submodule add` + `absorbgitdirs` | Verified adoption of an existing clone |
| YAML writing | `fmt` with manual quoting (descriptions contain `:` and backticks) | `goccy/go-yaml` `Marshal` | Correct quoting; deterministic field order |
| Rate limiting/CORS on the public API | Custom middleware | `throttle:` + `cors:<profile>` surf middleware | Built-in and tested |
**Key insight:** every hard part (module resolution, MVS, workspace overrides, quoting, sanitizing) already exists either in the Go toolchain or in a framework module. The phase is integration work. Custom parsers in this area break on the first unusual go.mod or README.
## Common Pitfalls
### Pitfall 1: const IDs (F1)
**What goes wrong:** `plugin:manifest` and git-URL installs fail for 13 public plugins.
**How to avoid:** the static const resolver, shared with `pluginIDFromGo`.
**Warning signs:** "does not return a plugin id" on `sm-mfa-plugin`.
### Pitfall 2: submodule installs inherit dev replaces (F2)
**What goes wrong:** `go build` fails with "replaced by ./plugins/golem15/summercms.go … no such file".
**How to avoid:** go.work replace overrides for every local replace in an installed submodule's go.mod; refresh the framework pin when the framework requirement moves.
### Pitfall 3: `v0.0.0` framework requirement in `summer new` apps (F3)
**What goes wrong:** every install reports "needs a newer framework", or the version check silently passes against a meaningless number.
**How to avoid:** `effectiveFramework` via `git describe --abbrev=0` of the replaced checkout. Bake it for cabana.
### Pitfall 4: summer.yaml comments are lost
`[VERIFIED: internal/build/manifest.go:146-181]` `SaveManifest` rewrites the file from `module`, `binary`, `plugins`, `build.tags`. `sm-demo-app/summer.yaml` and `sm-bm-app/summer.yaml` carry comments ("# summercms_mcp links the MCP endpoint …") that `plugin:add`/`plugin:install` would delete. Either append plugin entries with a comment-preserving edit (goccy AST, or text insertion after the last `plugins:` item), or document it. Prefer preserving: the CLI is meant for real apps.
### Pitfall 5: `go get` marks new plugins `// indirect`
Until `plugins.gen.go` imports them, the go.mod entry is `// indirect` (verified). It is harmless for builds. `plugin:install` could run `summer build` (regenerates imports) and then `go mod tidy`, or just tell the user to run `summer build`. Do not run `go mod tidy` before plugins.gen.go imports the module: tidy would remove it.
### Pitfall 6: `git describe` churn in committed `plugins.gen.go`
Apps commit `plugins.gen.go`, and release builds refuse drift (F10). Baking `git describe` output changes the file whenever a plugin submodule moves. That is acceptable because submodule bumps are commits that should include the regenerated file. Never use `--dirty`: an uncommitted change inside a submodule would make `summer build` rewrite a tracked file and break release builds. Give an in-app plugin (not its own repo) an empty version, not the app's describe.
### Pitfall 7: proxy/sumdb immutability
proxy.golang.org caches every fetched version forever. A moved or retagged plugin tag gives users a checksum mismatch. Plugin tags must never be moved. Add this to the release docs.
### Pitfall 8: framework-version inflation from the `--check` test helper
If plugin repos import a new framework helper in `go test`, their go.mod must require the framework release that contains it. By D-02 that becomes their `framework:` minimum (Go's MVS would enforce it anyway). See Open Question 2.
### Pitfall 9: summercms.io jobs never run
`queue.work_in_serve: false` (F10). Without flipping it, or adding a `queue:work` supervisor program, the hourly ingest does nothing in production while every local test passes.
### Pitfall 10: nginx blocks the ingest POST and the admin
Add `location = /api/registry/v1/ingest { limit_except POST { deny all; } proxy_pass http://127.0.0.1:8095; … }`. Keep the presentation admin behind the SSH tunnel. `scripts/check-deploy.sh` validates nginx/supervisor syntax.
### Pitfall 11: CORS preflight
nginx `limit_except GET HEAD` denies OPTIONS. Simple GETs without custom headers need no preflight; keep the registry API GET-only and header-free for browsers.
### Pitfall 12: concurrent sessions in cabana and internal/build
Phases 20 and 32.1 are in flight. Check `git status`/`git log -- modules/cabana` before editing, and stage explicit paths.
### Pitfall 13: ingestion trusts plugin.yaml identity
A repo could claim another plugin's ID or a module path that is not its own. At ingest: (a) ID unique across listed repos (first-listed wins; conflict is an error on the newer listing); (b) `module` must equal the repo URL's host+path without `.git` (core-plugins rule: module path = repo path), so `go get <module>` fetches the same code the listing shows.
## Code Examples
### Hardened git for the ingester (stdlib exec)
```go
// Source: env semantics from https://git-scm.com/docs/git (GIT_ALLOW_PROTOCOL, GIT_TERMINAL_PROMPT,
// GIT_CONFIG_NOSYSTEM, GIT_CONFIG_GLOBAL), pattern of internal/build/new.go runGit.
func gitCmd(ctx context.Context, dir string, args ...string) *exec.Cmd {
cmd := exec.CommandContext(ctx, "git", args...)
cmd.Dir = dir
cmd.Env = append(minimalEnv(), // PATH, HOME=<tmp>, no inherited GIT_*
"GIT_TERMINAL_PROMPT=0",
"GIT_ALLOW_PROTOCOL=https", // ingester: https only (tests may add "file")
"GIT_CONFIG_NOSYSTEM=1",
"GIT_CONFIG_GLOBAL=/dev/null",
)
return cmd
}
// clone: git clone --bare --filter=blob:none --no-tags? (keep tags) -- <url> <tmp> (fallback without --filter if the server refuses)
// tags: git for-each-ref --format=%(refname:short)%09%(objectname)%09%(creatordate:iso-strict) refs/tags
// files: git ls-tree -r --name-only <tag> ; git show <tag>:<path>/plugin.yaml ; git show <latest>:<path>/README.md
// cheap change check before cloning: git ls-remote --tags -- <url>
```
Never check out the tree, never `--recurse-submodules`, cap blob sizes read (`io.LimitReader`), and remove the temp dir. Always put `--` before URLs and paths.
### CLI git (user's own credentials, private SSH allowed)
Same pattern but keep the user's global config (credential helpers, `insteadOf`), set `GIT_TERMINAL_PROMPT=0` only when not interactive, and `GIT_ALLOW_PROTOCOL=https:ssh` (test seam for `file`).
### Effective framework version (F3)
```go
// app go.mod: go mod edit -json -> Require[] (summercms version), Replace[] (local dir?)
if dir := localFrameworkReplace(app); dir != "" {
out, err := exec.CommandContext(ctx, "git", "-C", dir, "describe", "--tags", "--abbrev=0", "--match", "v[0-9]*").Output()
if err == nil { return strings.TrimSpace(string(out)), nil }
}
return requireVersion(app, "git.golem15.com/golem15/summercms"), nil
```
### changelog-post.py hook (D-04, D-13)
- Before posting a plugin release: require that `git -C REPO describe --exact-match HEAD` equals the tag and the worktree is clean, then run `summer plugin:manifest --check <dir>`, using `summer` from PATH or else `go -C FRAMEWORK run ./cmd/summer plugin:manifest --check <abs REPO dir>` (so the command needs an optional `[dir]` argument). Do the same for nested plugin dirs (any `plugin.yaml` in the repo).
- After a successful publish: `POST {SITE}/api/registry/v1/ingest` with `{"repository": <origin https URL>}` and the same token. A 403 (token lacks the new scope) or a network failure prints a warning ("the hourly ingest will pick it up") and does not fail the publish. Unit-test the new pure helpers in `scripts/test_changelog_post.py` (stdlib unittest; `call` is replaced with a failing stub there).
## State of the Art
| Old Approach | Current Approach | When Changed | Impact |
|--------------|------------------|--------------|--------|
| Plugins only as local dirs + `replace` (`plugin:add`) | Plugins as plain Go module requires, resolved by `go list` | This phase | Build steps must stop assuming `plugins/<vendor>/<name>` exists |
| `go get` refused in workspace mode (old Go) | `go get` works in workspace mode, edits cwd module | Verified on Go 1.27.2 | No `GOWORK=off` dance needed for module installs |
| README H1 = plugin ID (13 repos) | Human name via `--name` override | This phase | One-time `--name` per repo during rollout |
**Deprecated/outdated:** the `.planning/notes/core-plugins-own-repos.md` statement that plugin go.mod replaces the framework with `../../../../summercms.go` is outdated. The repos use `../summercms.go` (sibling layout) `[VERIFIED: sm-*-plugin/go.mod]`.
## Plan Decomposition (recommendation for the planner)
Repo/dependency order, tracer-first, few large plans, tests last (project rule):
1. **Manifest foundation + build metadata (summercms.go):** the new public module (plugin.yaml types, const-resolving reader, derive from go.mod/README, marshal, check, test helper), `summer plugin:manifest [--check] [--name] [--description] [dir]`, `pluginIDFromGo` switched to the resolver, `go list` plugin-dir resolver, D-06/D-07 baking + effective framework version, `party.Info`. Module README, root table row, docs. Smoke: generate plugin.yaml for journal (literal), mfa (const) and pgstripe/subscriptions (cross-module const).
2. **Plugin repo rollout (each public `sm-*-plugin`):** generate and commit `plugin.yaml` (`--name` where H1 = ID), add the check test, fix `v0.0.0` plugin requirements where they block (F8), app pointer bumps as separate commits. Tags remain **user-gated**, and the framework tag that contains the helper must exist before plugin tags whose go.mod requires it (Open Question 2). This plan is mostly mechanical; it could be merged into plan 1 if the user prefers fewer plans.
3. **Registry on summercms.io (sm-summercmsio-app, site plugin, vue app):** models/migrations, admin (repos + presentation, attachments), ingester service + scheduled command + ingest endpoint + token scope, public API (CORS profile, cache), config (`work_in_serve`, CORS profile), nginx/supervisor, `/marketplace` pages in the changelog SSR app, landing header link + `nodePaths`, changelog-post.py hooks. Smoke: ingest a local fixture repo, `curl` the API.
4. **Install/update CLI (summercms.go):** registry client usage, `plugin:install` (ID module / `--source` / git URL), `plugin:update`, `plugins.registry_url` config read, `--yes`/`--offline`, go.work overrides (F2), summer.yaml comment preservation, docs. Smoke against an `httptest` registry.
5. **Admin Plugins screen (summercms.go):** cabana endpoints + permission + settings link + swag/openapi regen + contract tests update + PluginsView (tabs, copy) + lang + dist rebuild + gate.
6. **Unit tests (all repos):** see the Validation Architecture.
Plans 4 and 5 both depend only on plan 1 and the API shape (fixtures), not on plan 3 being deployed. They can follow plan 1 in either order; plan 5 touches cabana, where other sessions are active.
## Assumptions Log
| # | Claim | Section | Risk if Wrong |
|---|-------|---------|---------------|
| A1 | Extending D-02 to resolve package-level and cross-package string constants is acceptable to the user | F1, Pattern 2 | If refused, 13 core plugins need `plugin.go` edits (literal returns) |
| A2 | plugin.yaml field names `schema`, `package`, `overrides` and one file per plugin package dir | Pattern 1, F6 | Format is costly to change after rollout (D-04) |
| A3 | Registry JSON shape in "Proposed registry API shape" | Pattern 7 | One-way after release (D-16) |
| A4 | Marketplace pages live in the existing changelog Node SSR app, URL `/marketplace/<vendor>/<name>` | Architecture, Alternatives | A separate app/URL scheme changes nginx and supervisor work |
| A5 | `git` is installed on the production server (rome) for the ingester | Environment | Ingest fails in production; needs install or a go-git decision note |
| A6 | Permission key `backend.view_plugins` and SPA path `/system/plugins` | Pattern 5/6 | Cosmetic; D-19 left the exact key open |
| A7 | Ingest endpoint uses a new token scope (`registry`); the publish token may lack it, so ingest-now is best-effort | Pattern 7, changelog hook | User must mint a token with the new scope for instant ingestion (never done by the agent) |
| A8 | `party.Info` / `party.Describe` names and placement in `party` | Pattern 3 | Naming only |
| A9 | Which repos are "public plugins" to list (quizzes, presentations, golem, feedback exist publicly but have no sibling checkout; six chat-family repos are untagged) | F9 | Wrong listing scope |
| A10 | Proposed new module name (e.g. `kiosk`) | Structure | Naming only |
## Open Questions (RESOLVED)
All six were answered by the user during /msd-plan-phase 34 on 2026-10-29.
1. **Constant IDs vs D-02's "literal returns" (A1).**
- What we know: 13/22 plugins return `PluginID`; two use cross-package constants; `plugin:add` already fails on them.
- **RESOLVED:** follow constants (same-package and cross-package); `plugin:add` uses the same resolver. No `plugin.go` edits.
2. **How the plugin repos' `--check` runs in `go test` without inflating framework minimums.**
- Options: (a) import a framework helper. Each plugin's go.mod then requires the release containing it, which becomes its `framework:` minimum (likely the phase's release tag), and plugin tags wait for that framework tag. (b) The test shells out to `summer` from PATH or `go run git.golem15.com/golem15/summercms/cmd/summer@<pinned>` (the framework go.mod has no replace, so `go run pkg@version` works) and skips under `-short` or when unavailable. No go.mod change, but weaker and network-bound.
- **RESOLVED:** (a) framework test helper; plugins require the phase's framework release and their tags wait for it.
3. **Which repos are listed at launch (A9)**, and whether untagged repos get a first tag in this phase (tags are user-gated).
- **RESOLVED:** only tagged public plugins checked out next to the framework; no new tags in this phase.
4. **Ingest token scope (A7)**: new `registry` scope (user mints a token), or accept the existing `journal`-scoped token for the ingest endpoint (lower friction, scope semantics blur).
- **RESOLVED:** new `registry` scope; the user mints the token, ingest-now is best-effort until then.
5. **`summer.yaml` comment preservation**: implement now (recommended) or document the loss.
- **RESOLVED:** preserve comments.
6. **plugin:install in a non-git app directory** (`summer new --no-git`) with `--source`: clone without a submodule, or refuse.
- **RESOLVED:** refuse with a clear message.
## Environment Availability
| Dependency | Required By | Available | Version | Fallback |
|------------|------------|-----------|---------|----------|
| Go toolchain | everything Go; `go list/get/mod edit/work edit` | ✓ | go1.27.2 | — |
| git | submodule installs, `git describe`, ingester, tests with fixture repos | ✓ (local) | 2.56.0 | — |
| git on rome (production) | ingester | unknown | — | install git, or a go-git decision note (A5) |
| Network to git.golem15.com, proxy.golang.org | install integration checks, rollout | ✓ | anonymous HTTPS verified | `GOPROXY=file://` fixture for tests |
| Docker | testcontainers Postgres (registry DB tests, cabana tests) | ✓ (`docker ps` ok in this session) | client 29.9.1 | `sudo -u golem` if the socket is denied; `-short` skips |
| Node / npm | admin SPA build/tests | ✓ | node v24.22.0, npm 12.2.1 | — |
| pnpm | vue-summercmsio-app | ✓ | 12.14.0 | — |
| Python 3 | changelog-post.py tests | ✓ | 3.14.8 | — |
| swag | openapi gate | ✓ via `go run …@v1.16.6` (network) | v1.16.6 | — |
**Missing dependencies with no fallback:** none locally. Production `git` is unverified (A5): plan a deploy-time check (`command -v git` in DEPLOY.md / smoke) and fail ingestion with a clear error if `exec.LookPath("git")` fails.
## Validation Architecture
### Test Framework
| Property | Value |
|----------|-------|
| Framework | Go `testing` (+ testcontainers-go v0.44.0 for Postgres); Vitest 3.2.7 (+ browser mode) for admin; `node --test` for vue-summercmsio-app; stdlib `unittest` for scripts |
| Config file | none for Go; `admin/vitest.config.ts`, `admin/vitest.browser.config.ts` |
| Quick run command | `go test -short ./internal/build ./cmd/summer ./modules/<new-module> ./modules/party ./modules/cabana` |
| Full suite command | `go vet ./... && go test ./... && npm --prefix admin run test && npm --prefix admin run typecheck && scripts/check-admin-openapi.sh --check && scripts/check-admin-dist.sh && summer docs:build --check` |
### Phase Requirements → Test Map
| Req | Behavior | Test Type | Automated Command | File Exists? |
|-----|----------|-----------|-------------------|-------------|
| SC-1 | Derive: literal, same-pkg const, cross-pkg const (same module + other module), non-const → error naming function | unit (temp dirs, `go mod edit -json`; fixture module tree) | `go test -short ./modules/<new> -run TestDerive` | ❌ Wave 0 |
| SC-1 | README H1/summary extraction; H1 == ID → `--name` hint; overrides persist across regeneration | unit | `go test -short ./modules/<new> -run TestReadme` | ❌ |
| SC-1 | `--check` detects stale file; byte-stable output | unit | `go test -short ./modules/<new> -run TestCheck` | ❌ |
| SC-1 | Validate rejects bad ID, bad module, `v0.0.0` plugin requirement, unknown schema | unit | `go test -short ./modules/<new> -run TestValidate` | ❌ |
| SC-1 | `plugin:add` registers a const-ID plugin (regression for F1) | unit (temp app copy, like `TestMakeAndAddPluginOnHelloCopy`) | `go test -short ./internal/build -run TestAddPluginConstID` | ❌ |
| SC-1 | Each plugin repo's own check | plugin repo test | `go -C ../sm-<name>-plugin test -run TestPluginManifest ./...` | ❌ per repo |
| D-06/07 | plugins.gen.go includes PluginInfo/FrameworkVersion; go list resolution for workspace/replace/module-cache/nested; git describe only when own repo; no `--dirty` | unit (golden strings) + fixture git repo | `go test -short ./internal/build -run 'TestGeneratePluginInfo|TestPluginDirs|TestDescribe'` | ❌ |
| SC-2 | Ingester: fixture bare repo (git init, tags with/without plugin.yaml, nested plugin) via `file://` (test-only protocol) → version rows, latest README, skips invalid tags, module/repo mismatch rejected, ID conflict rejected | integration (Docker Postgres) | `go -C ../sm-summercmsio-app/plugins/golem15/summercms test -run TestIngest ./...` | ❌ |
| SC-2 | Registry API: list/search/category/detail/versions shapes, CORS header, Cache-Control, 404 envelope | integration (httptest + Postgres) | `… test -run TestRegistryAPI ./...` | ❌ |
| SC-2 | Ingest endpoint: 401 without token, 403 wrong scope, 200 with scope | integration | `… test -run TestIngestEndpoint ./...` | ❌ |
| SC-2 | changelog-post.py: ingest call + check invocation helpers, 403 tolerated | unit | `python3 -B scripts/test_changelog_post.py` | ✅ (extend) |
| SC-2 | Marketplace pages render from fixture API | Node SSR smoke | `pnpm --dir vue-summercmsio-app test` (+ new marketplace fixture check) | ❌ |
| SC-2 | Landing `/marketplace` link is a node path | unit (gated build) | `SUMMERCMS_REQUIRE_BUILD=1 go -C plugins/golem15/summercms test -run TestLandingLinks ./...` | ✅ (extend `nodePaths`) |
| SC-3 | Resolution: newest compatible, pin, no compatible → names framework, transitive closure, installed-too-old dep, cycle guard | unit (pure, fake registry) | `go test -short ./internal/build -run TestResolveInstall` | ❌ |
| SC-3 | Effective framework version: require vs local replace + describe | unit (fixture git repo) | `go test -short ./internal/build -run TestEffectiveFramework` | ❌ |
| SC-3 | Module install end-to-end: `GOPROXY=file://` fixture proxy (stdlib `archive/zip` builds `@v/list,.info,.mod,.zip`), with `GOPROXY=file://<dir> GOSUMDB=off GOFLAGS=-modcacherw GOMODCACHE=<t.TempDir()>` set only in the test env `[ASSUMED: exact env set to confirm while writing the test]` | integration (no network) | `go test ./internal/build -run TestInstallModule` | ❌ |
| SC-3 | `--source`/git-URL install: fixture repo via `file://`, submodule added, go.work use + replace override, `go build` passes | integration | `go test ./internal/build -run TestInstallSource` | ❌ |
| SC-3 | Non-interactive without `--yes` errors; `--offline` with missing deps errors | unit (bonfire.Call root) | `go test -short ./cmd/summer -run TestPluginInstallPrompts` | ❌ |
| SC-3 | Commands documented | existing gate | `go test ./cmd/summer -run 'TestCommandsDocumented|TestDocsTree'` | ✅ |
| SC-4 | Installed endpoint: metadata, versions, update flag (describe base vs registry), registry down → still 200 | unit (fake registry via `fetchguard.WithTransport`) | `go test -short ./modules/cabana -run TestPluginsEndpoints` | ❌ |
| SC-4 | Permission matrix + contract inventory include new routes | existing tests | `go test -short ./modules/cabana -run 'TestPhase09PermissionMatrix|TestPhase09ContractInventory'` | ✅ (update) |
| SC-4 | PluginsView: tabs, search, copy button (clipboard stub), hidden Marketplace when registry disabled | vitest | `npm --prefix admin run test -- PluginsView` | ❌ |
| SC-4 | OpenAPI and dist gates | scripts | `scripts/check-admin-openapi.sh --check && scripts/check-admin-dist.sh` | ✅ |
### Sampling Rate
- **Per task commit:** `go vet ./... && go test -short <touched packages>` (+ `npm --prefix admin run test` for SPA tasks)
- **Per wave merge:** `go test ./...` (Docker) in summercms.go; site plugin `go test ./...`; admin gates
- **Phase gate:** full suite green in all touched repos, plus a `scripts/check-phase34.sh` (convention: `scripts/check-phaseN.sh`) before `/msd-verify-work`
### Wave 0 Gaps
- [ ] `modules/<new>/…_test.go`: derive/readme/check/validate, client (fetchguard transport fake)
- [ ] `internal/build/install_test.go`, `plugindirs_test.go`: fixture helpers to create a git repo with tags and a `file://` GOPROXY tree (stdlib only)
- [ ] site plugin `TestMain` with testcontainers (must call `flag.Parse()` and honour `testing.Short()`)
- [ ] `admin/tests/…PluginsView` spec
- [ ] `scripts/check-phase34.sh`
## Security Domain
`security_enforcement` is not set in `.planning/config.json`, so it is enabled by default.
### Applicable ASVS Categories
| ASVS Category | Applies | Standard Control |
|---------------|---------|-----------------|
| V2 Authentication | yes (ingest endpoint) | `cabana.ResolveBackend` (backend JWT or `g15_` personal token) |
| V3 Session Management | no new sessions | existing admin cookie session for cabana endpoints |
| V4 Access Control | yes | `backend.view_plugins` (or chosen key) on cabana endpoints; `golem15.summercms.registry_ingest` + token scope on ingest; admin-only repo curation |
| V5 Input Validation | yes | plugin.yaml schema validation (ID regex, `validateModulePath`, strict `vX.Y.Z`), git URL validation (scheme allow-list, no leading `-`), query params (`q` length cap, category slug regex), registry JSON validated by the CLI before any exec |
| V6 Cryptography | no new crypto | sumdb verification of module installs stays on (do not set GONOSUMDB for public plugins) |
| V10 Malicious code | partially | installing a plugin compiles third-party code into the binary. This is inherent and out of scope, but the CLI prints exactly what it will add and requires confirmation (D-09) |
| V12 Files and Resources | yes | ingester: temp dirs, bare clones, no checkout/hooks/submodules, size caps; CLI never writes outside the app root (`underRoot`) |
| V14 Configuration | yes | `plugins.registry_url` operator-trusted (TrustedMode), https by default, no redirects |
### Known Threat Patterns
| Pattern | STRIDE | Standard Mitigation |
|---------|--------|---------------------|
| Option/argument injection via repo URL or module/version strings into `git`/`go` | Tampering/Elevation | exec without shell, `--` before positional args, validators rejecting leading `-`, strict version regex |
| `ext::`/`file::` transport abuse via an attacker-supplied git URL | Elevation | `GIT_ALLOW_PROTOCOL=https:ssh` (CLI) / `https` (ingester) `[CITED: git-scm.com/docs/git]` |
| Malicious repo content during ingest (huge blobs, symlinks, hooks) | DoS/Tampering | bare partial clone, read only via `git show`/`ls-tree`, `io.LimitReader`, timeouts, no checkout |
| README XSS on the marketplace | Tampering | `breakwater.Render` at ingest (strips raw HTML, http/https/mailto only, nofollow); Nuxt renders only stored sanitized HTML |
| Registry poisoning (repo claims another ID or another module) | Spoofing | admin-curated listing; ID uniqueness; module path must equal repo path (Pitfall 13) |
| Registry outage or slowness breaking the admin or CLI | DoS | cabana timeouts + cache + degraded 200; CLI clear error, `--offline` for git-URL installs |
| Ingest endpoint abuse (forced clones) | DoS | token + permission, throttle bucket, per-repo single-flight, `ls-remote` change check before cloning |
| Supply chain: moved tags | Tampering | sumdb catches mismatch; never move tags (Pitfall 7); submodule installs pin the commit in the parent repo |
| Open CORS leaking private data | Information disclosure | registry API serves only public data, no credentials, GET only |
## Sources
### Primary (HIGH confidence)
- Codebase files read this session: `internal/build/{manifest,build,leaf,registry,scaffold,artifact}.go`, `cmd/summer/main.go`, `cmd/summer/commands_documented_test.go`, `modules/bonfire/{version,helpers}.go`, `modules/party/registry.go`, `modules/cabana/{backend_screens,navigation,http,admin_openapi}.go`, `modules/pact/capabilities.go`, `modules/fetchguard/{client,policy}.go`, `modules/breakwater/breakwater.go`, `modules/seaglass/seaglass.go`, `modules/compass/README.md`, `modules/conga/README.md`, `admin/src/app/router.ts`, `admin/src/views/{AccountView,SettingsIndexView}.vue`, `admin/src/api/client.ts`, `admin/package.json`, `scripts/check-admin-{openapi,dist}.sh`, `internal/build/stubs/new.tmpl`
- Sibling repos: all `sm-*-plugin/{plugin.go,go.mod,README.md}`, `sm-faq-plugin` structure, `sm-journal-plugin/{routes.go,controllers/api/auth.go,token_scopes.go}`, `sm-pgstripe-plugin/subscriptions`, `sm-demo-app/{summer.yaml,go.work,scripts/build.sh}`, `sm-summercmsio-app/{CLAUDE.md,summer.yaml,config/queue.yaml,deploy/nginx,deploy/supervisor,scripts/changelog-post.py,scripts/build.sh}`, site plugin `plugin.go`/`static.go`/`links_test.go`, `vue-summercmsio-app/{package.json,nuxt.config.ts,changelog/nuxt.config.ts}`
- Probes this session: `pluginIDFromGo` on mfa/journal; `go get` in workspace; `go list -json` in sm-demo-app; `go list -m -json` module cache Dir; proxy.golang.org `@v/list`; `go.work` replace override; `git submodule add` adoption + `absorbgitdirs`; anonymous `git ls-remote` for 23 repos; go-get meta tag; `go mod edit -json`; `go mod why -m golang.org/x/mod`
### Secondary (MEDIUM confidence)
- https://git-scm.com/docs/git: environment variables `GIT_ALLOW_PROTOCOL`, `GIT_TERMINAL_PROMPT`, `GIT_CONFIG_NOSYSTEM`, `GIT_CONFIG_GLOBAL` (fetched this session)
### Tertiary (LOW confidence)
- None used for decisions. The proposed API shape, schema and names are marked `[ASSUMED]`.
## Metadata
**Confidence breakdown:**
- Standard stack: HIGH. All components exist in-tree; no additions.
- Go module/workspace mechanics (F2, F3, F5): HIGH. Reproduced locally on Go 1.27.2.
- Plugin repo survey (F1, F6–F9): HIGH. Read every repo this session.
- Architecture/API shape/schema: MEDIUM. These are design recommendations needing sign-off (A2, A3).
- Pitfalls: HIGH for the code-grounded ones; MEDIUM for production (rome git, A5).
**Research date:** 2026-10-29
**Valid until:** 2026-11-28 (stable toolchain; re-check plugin repo tags and the go.mod replace layouts before rollout)

View File

@@ -0,0 +1,157 @@
---
phase: 34-plugin-marketplace
fixed_at: 2026-10-29T22:45:00Z
review_path: .planning/phases/34-plugin-marketplace/34-REVIEW.md
iteration: 1
findings_in_scope: 13
fixed: 13
skipped: 0
status: all_fixed
---
# Phase 34: Code Review Fix Report
**Fixed at:** 2026-10-29T22:45:00Z
**Source review:** .planning/phases/34-plugin-marketplace/34-REVIEW.md
**Iteration:** 1
**Scope:** Critical + Warning (CR-01, CR-02, WR-01..WR-11). Info findings IN-01..IN-09 were not in scope.
**Summary:**
- Findings in scope: 13
- Fixed: 13 (CR-01, CR-02 and WR-10 change version or compatibility logic: fixed, requires human verification)
- Skipped: 0
Repositories:
- framework: `summercms.go` (branch master)
- site plugin: `sm-summercmsio-app/plugins/golem15/summercms` (repo `sm-summercmsio-plugin`, branch master)
- app: `sm-summercmsio-app` (branch master; only `scripts/changelog-post.py` and its test were staged, the two submodule gitlinks were left uncommitted)
Nothing was pushed, tagged or rebased.
## Fixed Issues
### CR-01: `plugin:update` downgrades module installs pinned at a pseudo-version
**Status:** fixed: requires human verification (version ordering logic)
**Repo:** summercms.go
**Commit:** 6055148
**Files modified:** `modules/kiosk/version.go`, `modules/kiosk/version_test.go`, `modules/kiosk/README.md`, `internal/build/update.go`, `internal/build/install.go`, `internal/build/install_test.go`, `modules/cabana/plugins.go`, `modules/cabana/plugins_test.go`, `modules/cabana/README.md`, `docs/plugins/marketplace.md`
**Applied fix:** New exported `kiosk.Newer(release, installed)` and `kiosk.Comparable(installed)`. A release, a `git describe` string (base tag) and a Go pseudo-version are compared in Go's version order. A pseudo-version counts as newer than the tag it builds on, so `v0.4.1-0.<ts>-<hash>` gets `v0.4.1` and later and never `v0.4.0`. `installedSource` keeps the go.mod version instead of blanking a pseudo-version. `plugin:update` uses `kiosk.Newer` in `pick` and refuses a module whose version `kiosk.Comparable` rejects (`vX.0.0-<ts>-<hash>`, a pre-release); the note names `go get <module>@<tag>`. The requirement checks (`installedVersion`, `checkRequires`) still see `""` for a pseudo-version, as before. The cabana badge (`applyUpdate`) uses the same `kiosk.Newer` rule. Regression tests: `TestUpdatePseudoVersion` (fails without the fix), `TestVersions/Newer`, and new cases in the cabana "update rule" table.
### CR-02: `plugin:install` silently moves already-installed plugins that share a Go module
**Status:** fixed: requires human verification (resolution logic)
**Repo:** summercms.go
**Commit:** 9b72439
**Files modified:** `internal/build/install.go`, `internal/build/source.go`, `internal/build/install_test.go`, `internal/build/install_smoke_test.go`, `docs/plugins/marketplace.md`
**Applied fix:** `PlanInstall` records every module in summer.yaml (`installedModules`, from `installedSource`). In `choose`, a release in such a module is eligible only at the version the application has. The step is marked `existing`, so `ApplyInstall` runs no `go get` and no clone for it and only appends the summer.yaml entry. This holds with `--source` too, whichever way the module is installed. A submodule checkout must contain the package. When no release matches, or the version is not a release (pseudo-version, untagged checkout, local directory), the install fails with a `plugin:update <installed id>` hint. A git URL whose repository is already a submodule (matched against `.gitmodules` before cloning), or whose module is already installed, is refused. Tests: `TestInstallSharedModule` (unit) and `TestInstallSmoke/source_shared_module` (fixture repos: no second submodule, no clone, git URL refused before cloning).
### WR-01: Generated `main.go`/`plugins.gen.go` require framework >= v0.6.0 with no guard
**Repo:** summercms.go
**Commit:** 07673e4
**Files modified:** `internal/build/build.go`, `internal/build/plugindirs.go`, `internal/build/plugindirs_test.go`, `docs/architecture/go-modules-and-workspaces.md`
**Applied fix:** I chose a static check over comparing versions. A local checkout reports the previous tag until it is tagged, so a version compare can be wrong. `resolveBuildMeta` resolves the framework's `party` package with the same `go list` the metadata step uses (it honours go.mod replaces and go.work) and parses it for `func Describe` and `type Info`. If either is missing, `buildMeta.Legacy` is set: `main.go` is written without the `party.Describe` call, `plugins.gen.go` byte-for-byte as before v0.6.0 (imports and `PluginIDs` only), and a warning names v0.6.0. If the package cannot be resolved, the current sources are generated. I verified this by hand: `examples/hello` with go.mod and the plugins' go.mod replacing the framework with a `git archive v0.5.3` export builds with the new `summer build`. Test: `TestLegacyFramework` (old party package → legacy sources and the exact old plugins.gen.go; new party package → Describe; failing go list → current sources).
### WR-02: Install and update are not atomic; a failure leaves the app half-modified
**Repo:** summercms.go
**Commit:** 9977e31
**Files modified:** `internal/build/rollback.go` (new), `internal/build/install.go`, `internal/build/source.go`, `internal/build/update.go`, `internal/build/install_smoke_test.go`, `docs/plugins/marketplace.md`
**Applied fix:** `snapshotApp` records go.mod, go.sum, go.work, go.work.sum, summer.yaml and .gitmodules, plus the index entry of .gitmodules, before `ApplyInstall` and `updater.apply` change anything. On failure, `undo` restores those files. It also removes each submodule added in the run (index entry via `update-index --force-remove`, the `submodule.<path>` config section, the absorbed `.git/modules/<path>` and the checkout), and checks moved submodules out at their previous branch or commit. `applySubmodule` registers the target for cleanup right after the rename. Anything the rollback cannot undo is appended to the error with the command that finishes the job. Test: `TestInstallSmoke/rollback`. It covers install (a submodule added, then a failing `go get`: files, git status and `.git/modules` restored, and the next install succeeds) and update (a submodule moved to v0.1.1, then a failing `go get`: back at v0.1.0, go.mod restored).
### WR-03: Credentials in a user-supplied https git URL end up in `.gitmodules` and output
**Repo:** summercms.go
**Commit:** 2f3eba0
**Files modified:** `internal/build/source.go`, `internal/build/install_smoke_test.go`, `docs/plugins/marketplace.md`
**Applied fix:** `validateGitURL` refuses any user info in an `https://` URL; the error points to a credential helper. ssh and scp-like users are still accepted. A password is still refused in any URL. The refusal happens before the "Cloning" line is printed. Test: new refusals in `TestInstallSmoke/urls` (`https://ghp_token@...`, `https://oauth2@...`, `ssh://git:secret@...`).
### WR-04: changelog-post sends the journal token to the registry endpoint
**Repo:** sm-summercmsio-app
**Commit:** 72bce11
**Files modified:** `scripts/changelog-post.py`, `scripts/test_changelog_post.py`
**Applied fix:** The journal-token fallback is removed. `registry_credential()` reads only `~/.config/summercms/registry-token`. Without that token, `request_ingest()` sends no request and warns that the hourly ingest will pick the tag up. The module docstring now says the journal token never goes to the registry. Tests: `test_without_a_registry_token_nothing_is_sent` (missing and empty file), plus the updated accepted and file-mode tests.
**Follow-up (not done here):** the user asked that only the script and its test be staged, so these app docs were left unchanged and still describe the old fallback: `README.md` (line 66, "else the journal token"), `DEPLOY.md` (lines 129 and 404) and `CLAUDE.md` (line 78, phrasing is still accurate). They need a docs commit in sm-summercmsio-app.
### WR-05: The `registry` token scope covers all of `golem15.summercms.*`, not just ingest
**Repo:** sm-summercmsio-plugin (site plugin submodule)
**Commit:** e82d627
**Files modified:** `token_scopes.go`, `controllers/api/registry.go`, `lang/en/lang.yaml`, `lang/pl/lang.yaml`, `registry_api_test.go`, `registry_smoke_test.go`, `README.md`
**Applied fix:** The scope's permissions are now `controllers.PermissionRegistryIngest` only, and the ingest endpoint's `ingestCover` is that permission. Scopes are resolved by name on every request, so existing `registry` tokens narrow without being minted again. An administrator without the ingest permission is no longer offered the scope (the mint answers 422); the tests were adapted to that. Regression: a superuser's registry token gets 403 on `GET`/`POST /backend/api/v1/golem15/summercms/repositories`. A token whose owner later loses the permission still gets 403 on ingest. The scope description strings say the token allows nothing else.
### WR-06: The admin Plugins screen's search cache grows without bound
**Repo:** summercms.go
**Commit:** 7b19303
**Files modified:** `modules/cabana/plugins.go`, `modules/cabana/plugins_test.go`, `modules/cabana/README.md`, `docs/plugins/marketplace.md`
**Applied fix:** `storeList` caps `pluginCatalog.lists` at `marketplaceCacheSize` (256). When a new key arrives and the cache is full, it drops the expired searches first, then the entries that expire soonest. Test: "search cache is bounded" (306 distinct searches leave 256, the oldest is gone, the newest is still a hit, an expired cache shrinks to the new entry).
### WR-07: Disabling a repository does not withdraw its plugins from the public registry
**Repo:** sm-summercmsio-plugin
**Commit:** 8a2f0fa
**Files modified:** `registry/query.go`, `registry_api_test.go`, `lang/en/lang.yaml`, `lang/pl/lang.yaml`, `README.md`
**Applied fix:** A shared `public()` scope (published, and `repository_id IN (enabled repositories)`, as a subquery so joined columns stay unambiguous) is applied in `List`, `Versions` and `Detail`. Disabling a repository removes its plugins from the list, the detail and the versions at once. Enabling it again brings them back with their presentation intact. The `enabled_comment` strings (en and pl) and the README describe this kill switch. Test: `TestRegistryAPIShapes/disabled_repository_withdraws_its_plugins` (Docker).
### WR-08: A transient ingest failure leaves a stale `last_error` forever
**Repo:** sm-summercmsio-plugin
**Commit:** a50c47c
**Files modified:** `registry/ingest.go`, `registry_smoke_test.go`, `README.md`
**Applied fix:** `recordError` now also clears `tags_digest`. The next run therefore reads the repository in full and `store` replaces `last_error` with that read's notes, or an empty string. Clearing the error on the unchanged path would also have wiped the skipped-tag notes; this way they survive without a new column. Test: an extension of `TestRegistrySmoke/unchanged`. An unreachable URL sets the error and clears the digest; restoring the URL triggers a full read that clears the error; the run after that is unchanged again.
### WR-09: The hourly `IngestAll` runs inside one 300 s job and starves later repositories
**Repo:** sm-summercmsio-plugin
**Commit:** 0b3fbf4
**Files modified:** `console/registry.go`, `schedule.go`, `registry_smoke_test.go`, `README.md`
**Applied fix:** `summercms:registry-ingest --queue` queues one `registry.IngestArgs` job per enabled repository, or for the one named, and prints `queued` for each. The job is unique per repository while it waits or runs, so repeats do not double up. A disabled repository and `--queue --force` are refused. The hourly schedule now runs the command with `--queue`, so each repository has its own job deadline and retries, and ingest-now jobs wait for at most one repository. Run by hand without the flag, the command still ingests directly as before. Test: `TestRegistrySmoke/scheduled_queue` (schedule args, 2 jobs for 2 enabled repositories, still 2 after repeats, refusals).
### WR-10: Plugins screen and `plugin:install` disagree on compatibility for unknown or dev framework versions
**Status:** fixed: requires human verification (compatibility semantics)
**Repo:** summercms.go
**Commits:** 754ab54, 75a0dea (smoke test expectation)
**Files modified:** `modules/cabana/plugins.go`, `modules/cabana/plugins_test.go`, `modules/cabana/plugins_smoke_test.go`, `modules/cabana/README.md`, `docs/plugins/marketplace.md`
**Applied fix:** The JSON shape is unchanged, so the SPA and the OpenAPI schema stay as they are (`check-admin-openapi.sh --check` passes). When the built framework version is not a release (devel, empty, a hash), `Compatible` is true, so no marker is shown, and the Installed tab gets no `LatestFramework` note. When the newest release is too new, `olderCompatible` looks up the plugin's releases (cached, four at a time). It marks the plugin compatible if `kiosk.NewestCompatible` finds an older release that fits, which is the one `plugin:install` would pick. The 75a0dea commit updates the existing Plugins screen smoke test, whose fixture has exactly that case. Test: "marketplace compatibility".
### WR-11: `plugin:add` now fails on summer.yaml files with an inline `plugins:` list (regression)
**Repo:** summercms.go
**Commit:** e6b3aa2
**Files modified:** `internal/build/manifest.go`, `internal/build/scaffold.go`, `internal/build/install.go`, `internal/build/manifest_append_test.go`, `internal/build/install_smoke_test.go`, `docs/console/scaffolding.md`, `docs/plugins/marketplace.md`
**Applied fix:** `insertManifestPlugins` finds the end of an inline flow list, on one line or several, skipping quotes and comments. It replaces those lines with a block list of the existing items plus the new ones and keeps every other line and comment. A list it cannot edit in place (a tagged `!!seq [...]`, say) falls back to the old full `SaveManifest` rewrite. `appendManifestPlugins` then reports `rewrote`, and `plugin:add` and `plugin:install` print a note that comments were not kept. The edit is still parsed back and verified, and the original bytes are restored on mismatch. Tests: new inline cases in `TestAppendManifestPlugins` (single line with a trailing comment, multi-line with comments, fallback rewrite). The old "inline refused" expectations were replaced.
## Verification
All checks ran in the main checkouts; `workflow.use_worktrees` is false, so no isolated worktree was created.
summercms.go:
- `go vet ./...`: pass
- `go test -short ./...`: pass (the first run failed on `TestPluginsScreenSmoke/marketplace`, whose expectation predated WR-10; 75a0dea fixed it, then the suite passed)
- `go test ./internal/build` without `-short` (fixture repos, module proxy): pass
- `cd examples/hello && go test ./...`: pass
- `go run ./cmd/summer docs:build --check`: no problems found
- `scripts/check-admin-openapi.sh --check`: pass. `admin/` was not changed, so neither `npm --prefix admin run test` nor a dist rebuild was needed; the gate's admin stage still ran vitest (1622 passed), typecheck and `check-admin-dist.sh` (dist matches a fresh build)
- Manual WR-01 check: hello against a `git archive v0.5.3` framework export builds with the new `summer build` (legacy sources plus the warning)
Site plugin (sm-summercmsio-plugin):
- `go vet ./... && go test -short ./...`: pass
- `go test ./...` with Docker (testcontainers Postgres): pass
sm-summercmsio-app:
- `go vet ./... && go test ./...`: pass
- `python3 -m pytest -q scripts/test_changelog_post.py`: 51 passed. `python3 -B -m unittest discover -s scripts -p 'test_*.py'`: 51 OK. A `scripts/__pycache__` left by pytest was removed.
`scripts/check-phase34.sh --all` with Docker available: **Phase 34 gate passed**. Stages self-test, go, plugins (20 repositories), site (including pnpm test, build:changelog, test:changelog and test:marketplace), admin, docs, marker, additive (cabana +43 lines, party +15, kiosk new) and docker (framework `go test ./...`, `TestInstallSmoke`, and the site plugin's `TestRegistrySmoke`, `TestRegistryAPIShapes` and `TestRegistryIngestEndpoint`) all PASS.
Not committed, as instructed: the app's two submodule gitlinks (`plugins/golem15/summercms` now points at the new site-plugin commits; `vue-summercmsio-app`). Other sessions' edits (`.planning/STATE.md`, `state.json`, `G15OFFICE.md`, `.msd/`, other phases' `.gitkeep`) were not touched.
---
_Fixed: 2026-10-29T22:45:00Z_
_Fixer: Claude (msd-code-fixer)_
_Iteration: 1_

View File

@@ -0,0 +1,328 @@
---
phase: 34-plugin-marketplace
reviewed: 2026-10-29T12:00:00Z
depth: standard
files_reviewed: 81
files_reviewed_list:
- admin/src/api/types.ts
- admin/src/app/pageTitle.ts
- admin/src/app/router.ts
- admin/src/components/shell/AppShell.vue
- admin/src/components/shell/Breadcrumbs.vue
- admin/src/components/shell/PluginRail.vue
- admin/src/state/useSettings.ts
- admin/src/views/PluginsView.vue
- cmd/summer/main.go
- examples/hello/main.go
- examples/hello/plugins.gen.go
- internal/build/build.go
- internal/build/install.go
- internal/build/manifest.go
- internal/build/new.go
- internal/build/plugindirs.go
- internal/build/scaffold.go
- internal/build/source.go
- internal/build/update.go
- modules/cabana/admin_openapi.go
- modules/cabana/backend_screens.go
- modules/cabana/http.go
- modules/cabana/navigation.go
- modules/cabana/plugins.go
- modules/kiosk/check.go
- modules/kiosk/client.go
- modules/kiosk/derive.go
- modules/kiosk/identity.go
- modules/kiosk/kiosk.go
- modules/kiosk/manifest.go
- modules/kiosk/registry.go
- modules/kiosk/version.go
- modules/party/info.go
- modules/phrasebook/backend/lang/en/lang.yaml
- modules/phrasebook/backend/lang/pl/lang.yaml
- scripts/check-phase34.sh
- sm-summercmsio-app/plugins/golem15/summercms/admin.go
- sm-summercmsio-app/plugins/golem15/summercms/admin_navigation.go
- sm-summercmsio-app/plugins/golem15/summercms/admin_permissions.go
- sm-summercmsio-app/plugins/golem15/summercms/console/registry.go
- sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go
- sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins.go
- sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_form.yaml
- sm-summercmsio-app/plugins/golem15/summercms/controllers/plugins/config_list.yaml
- sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories.go
- sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_form.yaml
- sm-summercmsio-app/plugins/golem15/summercms/controllers/repositories/config_list.yaml
- sm-summercmsio-app/plugins/golem15/summercms/go.mod
- sm-summercmsio-app/plugins/golem15/summercms/jobs.go
- sm-summercmsio-app/plugins/golem15/summercms/lang.go
- sm-summercmsio-app/plugins/golem15/summercms/models/plugin.go
- sm-summercmsio-app/plugins/golem15/summercms/models/plugin/columns.yaml
- sm-summercmsio-app/plugins/golem15/summercms/models/plugin/fields.yaml
- sm-summercmsio-app/plugins/golem15/summercms/models/registry.go
- sm-summercmsio-app/plugins/golem15/summercms/models/repository.go
- sm-summercmsio-app/plugins/golem15/summercms/models/repository/columns.yaml
- sm-summercmsio-app/plugins/golem15/summercms/models/repository/fields.yaml
- sm-summercmsio-app/plugins/golem15/summercms/models/version.go
- sm-summercmsio-app/plugins/golem15/summercms/plugin.go
- sm-summercmsio-app/plugins/golem15/summercms/registry/git.go
- sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go
- sm-summercmsio-app/plugins/golem15/summercms/registry/query.go
- sm-summercmsio-app/plugins/golem15/summercms/routes_registry.go
- sm-summercmsio-app/plugins/golem15/summercms/schedule.go
- sm-summercmsio-app/plugins/golem15/summercms/token_scopes.go
- sm-summercmsio-app/plugins/golem15/summercms/updates/202610300001_create_golem15_summercms_registry.go
- sm-summercmsio-app/plugins/golem15/summercms/updates/registry.go
- sm-summercmsio-app/vue-summercmsio-app/app/components/SiteFooter.vue
- sm-summercmsio-app/vue-summercmsio-app/app/components/SiteHeader.vue
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/composables/useRegistry.ts
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/error.vue
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/layouts/default.vue
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/[vendor]/[name].vue
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/index.vue
- sm-summercmsio-app/vue-summercmsio-app/changelog/app/utils/marketplace.ts
- sm-summercmsio-app/vue-summercmsio-app/changelog/nuxt.config.ts
- sm-summercmsio-app/vue-summercmsio-app/nuxt.config.ts
- sm-summercmsio-app/scripts/changelog-post.py
- sm-summercmsio-app/config/http.yaml
- sm-summercmsio-app/config/queue.yaml
- sm-summercmsio-app/deploy/nginx/summercms.io.conf
findings:
critical: 2
warning: 11
info: 9
total: 22
status: issues_found
---
# Phase 34: Code Review Report
**Reviewed:** 2026-10-29T12:00:00Z
**Depth:** standard
**Files Reviewed:** 81
**Status:** issues_found
## Summary
Scope: the kiosk module (plugin.yaml, static identity reader, registry client and version rules), `summer plugin:manifest/install/update`, `summer build` metadata generation (`party.Describe`, `PluginInfo`), the cabana Plugins screen and SPA, the summercms.io registry (ingester, public API, ingest-now, admin), the Nuxt `/marketplace` pages and the deploy/config changes. Diff bases were framework `824e3d5..HEAD`, site plugin `ca59415..HEAD` and vue app `b3bfc5d..HEAD`.
The hardening is mostly sound. Every git and go exec uses an argv with no shell and puts `--` before URLs and paths. Registry strings go through strict version, module path and https checks before they reach exec, and plugin IDs are regex-checked before they become paths or shell commands. The ingester runs git with a throwaway HOME, no system or global config and an https-only `GIT_ALLOW_PROTOCOL`, and caps every read. The README HTML is sanitized twice before `v-html`. Admin requests to the registry are bounded, cached and permission-gated. The registry uses parameterized queries with escaped LIKE wildcards. No SQL injection, command injection, path traversal or XSS was found.
The main problems are in the version logic of the install and update CLI:
- `plugin:update` can downgrade a plugin installed at a pseudo-version (CR-01).
- `plugin:install` can silently move an already-installed plugin that shares a Go module with the plugin being added (CR-02).
Other findings:
- **Compatibility:** generated code breaks apps pinned to an older framework (WR-01).
- **Robustness:** partial installs are not rolled back (WR-02); an unbounded admin cache (WR-06); the hourly ingest can be starved by the job timeout (WR-09).
- **Credential handling:** tokens in URLs end up in `.gitmodules` (WR-03); the journal token is sent to the registry endpoint (WR-04).
- **Least privilege:** the `registry` token scope is broader than ingest needs (WR-05).
- **Registry moderation:** disabling a repository does not withdraw its plugins (WR-07); a stale `last_error` sticks after a transient failure (WR-08).
No structural (fallow) findings were provided for this run.
## Critical Issues
### CR-01: `plugin:update` downgrades module installs pinned at a pseudo-version
**File:** `internal/build/update.go:118-123`, `internal/build/update.go:286-301`, `internal/build/update.go:311-342`
**Issue:** `installedSource` throws away any go.mod require that is not a strict `vX.Y.Z` (`if !kiosk.ValidVersion(src.Version) { src.Version = "" }`). `pick` then treats `""` as `v0.0.0`, so every registry release counts as "newer". Take an app that requires a plugin at a commit after its last tag, for example `M v0.4.1-0.20261001120000-abcdef123456` (commonly from `go get M@main`). `plugin:update` picks `v0.4.0` and runs `go get M@v0.4.0`, which is a **downgrade** that drops the commits the app depends on. The plan line prints `default branch head -> v0.4.0 (module)`, which does not read as a downgrade, and with `--yes` (the documented non-interactive mode) it runs unseen. The cabana Plugins screen gives the same install no update badge (`BaseVersion` of a pseudo-version is `""`), so the comment "the rule is summer plugin:update's" (`modules/cabana/plugins.go:325-329`) is also false.
**Fix:** Keep the pseudo-version and compare against the release it builds on. Never offer a release at or below that base:
```go
// installedSource, module branch
if src.Dir == "" {
src.Kind = ModeModule
src.Pseudo = src.Version // keep for reporting
if !kiosk.ValidVersion(src.Version) {
src.Version = pseudoFloor(src.Version) // vX.Y.(Z-1) for vX.Y.Z-0.<ts>-<hash>, "" when unknown
}
return src, nil
}
// planModule: refuse to guess when the installed version is unknown
if src.Version == "" && src.Pseudo != "" {
u.note(p.ID, "installed at "+src.Pseudo+", a commit, not a release; pin a release with plugin:update after `go get "+src.Module+"@<tag>`")
return
}
```
Add a regression test in `install_smoke_test.go#update` with a pseudo-version require.
### CR-02: `plugin:install` silently moves already-installed plugins that share a Go module
**File:** `internal/build/install.go:395-406`, `internal/build/install.go:571-612`, `internal/build/install.go:310-341`
**Issue:** `moduleVersion` holds only modules chosen *in this plan*. If the plugin being installed (or one of its requirements) lives in a module the app already requires for another plugin, `choose` still picks the newest compatible release of that module. One example is a second plugin package inside `sm-pgstripe-plugin`, where the app has the main plugin at v0.2.0. `ApplyInstall` then runs `go get M@v0.3.0`, which upgrades the plugin the app already has. The plan prints only the new plugin (`acme.sub@v0.3.0 (module)`). This contradicts the guarantee the code states twice ("plugin:install does not move plugins the application already has", `install.go:337`; "plugin:install never moves the framework"). It can also break the existing plugin's own requirements, which are never re-checked. In `--source` mode it gets worse: the same repository is cloned and added a second time as a submodule under another directory, so go.work ends up with one module path in two `use` directories and the workspace stops loading.
**Fix:** Seed `moduleVersion` from the app's go.mod and go.work before resolving, and pin plugins of an already-required module to the installed version (or fail with a hint to run `plugin:update`):
```go
// PlanInstall, after EffectiveFramework
for _, p := range m.Plugins {
if src, err := installedSource(ctx, appDir, p.Module); err == nil && src.Module != "" {
if src.Kind == ModeSubmodule {
in.installedDirs[src.Module] = src.Dir // reuse, never clone again
}
in.moduleVersion[src.Module] = src.Version // "" means: refuse, cannot pin
}
}
// choose(): when want, ok := in.moduleVersion[v.Module]; ok && want == "" -> error naming plugin:update
```
For a submodule module that is already installed, register the new package from the existing checkout instead of calling `applySubmodule`.
## Warnings
### WR-01: Generated `main.go`/`plugins.gen.go` require framework >= v0.6.0 with no guard (breaks apps on older framework)
**File:** `internal/build/build.go:131`, `internal/build/build.go:159-188`
**Issue:** `summer build` now always emits `party.Describe(app, PluginInfo, FrameworkVersion)` and `[]party.Info{...}`. An application whose go.mod requires the framework at v0.5.x (no local replace) and that is built with a `summer` installed from this tree fails to compile (`undefined: party.Describe`, `undefined: party.Info`). Before, the same build succeeded. `resolveBuildMeta` already computes the effective framework but never uses it to gate the new generated code. That is a breaking change for consumer apps that bump the CLI before the framework, against the project's no-breaking-changes rule.
**Fix:** Generate the Describe call and the `PluginInfo` declarations only when the resolved framework package provides them. Check for the identifier statically, for example by running `go list -f '{{.Dir}}' git.golem15.com/golem15/summercms/modules/party` and scanning `info.go`. Do not compare version tags: `git describe --abbrev=0` reports v0.5.3 for an untagged v0.6.0 checkout. Otherwise fail early with a hint to bump the framework.
### WR-02: Install and update are not atomic; a failure leaves the app half-modified
**File:** `internal/build/source.go:422-451`, `internal/build/install.go:588-615`, `internal/build/update.go:488-509`
**Issue:**
- In `applySubmodule`, once `os.Rename(dir, target)` succeeds the checkout is no longer in `plan.temps`. A failure in `git submodule add`, `absorbgitdirs`, `editAppModule` or `ensureGoWork` leaves `plugins/<vendor>/<name>` behind, and go.mod may already be edited.
- In `ApplyInstall`, submodules are added before `go get`. A failing `go get` leaves the added submodules without summer.yaml entries.
- The next `plugin:install` then refuses ("already exists; remove it or register it with plugin:add").
- `updater.apply` checks submodules out and edits go.mod one by one. A failure mid-loop leaves some plugins moved and others not, and `refreshWorkOverrides` is skipped.
**Fix:** Snapshot go.mod, go.sum, go.work and summer.yaml before applying, and on error restore them. Also remove moved checkouts and run `git submodule deinit -f`/`git rm --cached` for submodules added in this run, or at least print the exact cleanup commands. In `applySubmodule`, register the target directory for cleanup right after the rename.
### WR-03: Credentials in a user-supplied https git URL end up in `.gitmodules` and output
**File:** `internal/build/source.go:117-119`, `internal/build/source.go:233`, `internal/build/source.go:430`
**Issue:** `validateGitURL` only rejects a URL with a *password*. GitHub, GitLab and Gitea all accept a token as the user part (`https://ghp_xxx@github.com/acme/plugin.git`). Such a URL passes, is printed (`Cloning %s`) and is written by `git submodule add` into `.gitmodules`, which is committed and pushed with the application.
**Fix:** For user-supplied URLs, refuse `u.User != nil` on `https://` (keep it for `ssh://git@...` and scp-like forms, where the user is not a secret):
```go
if scheme == "https" && u.User != nil {
return fmt.Errorf("git URL must not carry user info; use a git credential helper")
}
```
### WR-04: changelog-post sends the journal token to the registry endpoint
**File:** `sm-summercmsio-app/scripts/changelog-post.py` (`registry_credential`, `request_ingest`, `cmd_publish`)
**Issue:** Without `~/.config/summercms/registry-token`, `request_ingest(token)` posts the **journal** write token to `SUMMERCMS_REGISTRY_API` (overridable by env), even though the docstring says this "the registry answers with 403". The credential goes to an endpoint that is known to reject it, and if `SUMMERCMS_REGISTRY_API` points anywhere else (staging or a typo), the journal token leaks to that host. This goes against the project rule to never copy the journal token anywhere.
**Fix:** Drop the fallback: when no registry token exists, skip the ingest request with a warning ("no registry token; the hourly ingest will pick it up"):
```python
cred = read_secret_file(REGISTRY_TOKEN_FILE)
if not cred:
print("changelog-post: warning: no registry token; the hourly ingest will pick it up", file=sys.stderr)
return
```
### WR-05: The `registry` token scope covers all of `golem15.summercms.*`, not just ingest
**File:** `sm-summercmsio-app/plugins/golem15/summercms/token_scopes.go:12-19`, `sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go:30`
**Issue:** The release script's token scope allows `GET/HEAD/POST` on every `golem15.summercms.*` permission within the owner's rights (`methodFilterScopes` in cabana matches by pattern). The owner is normally a superuser, so the token can POST to the admin API controllers guarded by `golem15.summercms.registry`, for example to create curated repositories. That is a supply-chain lever over the public marketplace, and more than the one ingest call the token exists for. nginx refusing `/backend` limits this to tunnel access, but it is still broader than least privilege.
**Fix:** Scope it to the ingest permission only, and cover the same code in `Ingest`:
```go
Permissions: []string{"golem15.summercms.registry_ingest"},
// controllers/api/registry.go
const ingestCover = "golem15.summercms.registry_ingest"
```
### WR-06: The admin Plugins screen's search cache grows without bound
**File:** `modules/cabana/plugins.go:228-253`
**Issue:** `pluginCatalog.lists` is keyed by every distinct `q` (up to 100 runes) and `category`. Expired entries are never deleted, only overwritten on the same key. Each entry keeps a full `kiosk.ListResponse` (up to 4 MiB), and failures are cached too. Any principal with `backend.view_plugins` can grow process memory without limit by searching distinct strings, and so can a debounced search box used over a long session.
**Fix:** Bound the map. Drop expired entries on insert and cap the size (for example 256 keys, oldest out), or cache only the unfiltered list and filter locally.
### WR-07: Disabling a repository does not withdraw its plugins from the public registry
**File:** `sm-summercmsio-app/plugins/golem15/summercms/registry/query.go:45`, `:85`, `:133-134`; `sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go:116-118`
**Issue:** `List`, `Versions` and `Detail` filter only on `plugins.published`. When an administrator disables a repository (for example because it was compromised), `Repository()` returns early, so `published` never changes. The plugins stay listed and installable through `summer plugin:install`. The admin has no other unpublish control (`published` is preview-only and plugin delete is forbidden), so the only kill switch is deleting the repository, which also loses category, featured flag, icon and screenshots. The lang string documents this ("their plugins stay as they are"), but it leaves the marketplace with no way to pull a bad plugin quickly.
**Fix:** Join on the repository in the public queries:
```go
query := db.WithContext(ctx).Preload("Repository").
Joins("JOIN golem15_summercms_registry_repositories r ON r.id = golem15_summercms_registry_plugins.repository_id AND r.enabled").
Where("golem15_summercms_registry_plugins.published = ?", true)
```
Apply the same join in `Versions` and `Detail`. Alternatively, unpublish the repository's plugins in `FormBeforeUpdate` when `enabled` turns false.
### WR-08: A transient ingest failure leaves a stale `last_error` forever
**File:** `sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go:136-141`
**Issue:** `recordError` writes `last_error` but leaves `tags_digest` alone. On the next successful run the digest still matches, so the "unchanged" path updates only `last_ingested_at`/`updated_at`. The old error (for example a network timeout) stays in the admin's Repositories list until the tags change, and administrators see a failure that no longer exists.
**Fix:** Clear the error on the unchanged path:
```go
Updates(map[string]any{"last_ingested_at": now, "updated_at": now, "last_error": ""})
```
If notes from the last full read should survive, store them in a separate column.
### WR-09: The hourly `IngestAll` runs inside one 300 s job and starves later repositories
**File:** `sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go:165-182`, `sm-summercmsio-app/plugins/golem15/summercms/schedule.go:20-24`, `sm-summercmsio-app/config/queue.yaml` (`job_timeout: 300`)
**Issue:** The scheduled command runs as a conga job with a 300 s deadline. `IngestAll` processes repositories sequentially in id order. Each one can take up to 30 s (ls-remote), plus 180 s (clone, retried once on failure: up to 360 s), plus 30 s per tag operation. One slow or hanging repository uses up the deadline, so every later repository gets `ctx.Err()` and is reported failed. This repeats every hour in the same order, so the tail of the list is never ingested. `queues.default: 1` also blocks ingest-now jobs behind it.
**Fix:** Enqueue one `IngestArgs` job per enabled repository from the scheduled command (each gets its own deadline and retry), or give `IngestAll` per-repository budgets and rotate the start index.
### WR-10: Plugins screen and `plugin:install` disagree on compatibility for unknown or dev framework versions
**File:** `modules/cabana/plugins.go:435-447`, `modules/cabana/plugins.go:487-495`
**Issue:** `frameworkRelease` returns the raw string when it is not a release, for example `""` from an app built by `summer new`, `(devel)` from `bonfire.BuildVersion`, or a pseudo-version. `kiosk.Satisfies` is then false for every plugin with a framework minimum. The marketplace marks *every* plugin "needs framework vX" and `Latest` stays empty, while `plugin:install` (which uses `EffectiveFramework`) would install them fine. `Compatible` also checks only the newest release, so a plugin with an older compatible release is still shown as incompatible even though `plugin:install` would pick that release.
**Fix:** Return a tri-state (unknown, compatible, incompatible) and omit the marker when the framework is unknown. Compute `Compatible` from `NewestCompatible` over the versions (cached), or rename the field `latestCompatible`.
### WR-11: `plugin:add` now fails on summer.yaml files with an inline `plugins:` list (regression)
**File:** `internal/build/scaffold.go:207`, `internal/build/manifest.go:255-260`
**Issue:** `AddPlugin` switched from `SaveManifest` (full rewrite, any YAML shape) to `appendManifestPlugins`, which refuses a flow-style list (`plugins: [{id: a, module: b}]`) with "write it as a block list". A summer.yaml that `plugin:add` used to handle now errors, which breaks an existing CLI command's behavior.
**Fix:** When `insertManifestPlugins` reports an inline list, fall back to the previous `SaveManifest(manifestPath, m)` with a notice that comments were not preserved.
## Info
### IN-01: Ingest-now accepts a cookie/JWT admin session without a CSRF guard
**File:** `sm-summercmsio-app/plugins/golem15/summercms/controllers/api/registry.go:126-149`
**Issue:** The endpoint decodes any body as JSON regardless of `Content-Type`, so a cross-site `text/plain` form can produce a valid body if a session credential is ambient. The impact is limited to queuing an ingest of an already-curated repository (and nginx refuses `/backend` sessions), but requiring `Content-Type: application/json` costs nothing.
**Fix:** Reject requests whose `Content-Type` is not `application/json`.
### IN-02: The registry client accepts plain `http://` registries
**File:** `modules/kiosk/client.go:74-76`
**Issue:** The registry answer decides which module path `go get` fetches. Over `http://`, an on-path attacker can substitute any module and code runs at build time. The default is https, but nothing warns when an operator sets `http://`.
**Fix:** Allow `http://` only for loopback hosts, or print a warning in `registryFor`/`newPluginCatalog`.
### IN-03: The nested `kiosk.Validate` after `kiosk.Parse` is redundant
**File:** `sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go:275-278`
**Issue:** `Parse` already calls `Validate`. The second call adds nothing.
**Fix:** Remove it.
### IN-04: Plugin ID ownership is first-come and never released
**File:** `sm-summercmsio-app/plugins/golem15/summercms/registry/ingest.go:439-451`
**Issue:** A repository that once published an ID keeps it after it stops publishing it (the row is only unpublished). Any other curated repository that publishes the ID later is refused until an administrator deletes the original repository. A curated repository can also squat an unrelated vendor's ID, because IDs are not tied to the module or vendor.
**Fix:** Release the ID when the owning row is unpublished, and consider requiring the ID vendor to match an allow-list per repository.
### IN-05: The Nitro SWR route cache on `/marketplace` is keyed by query string
**File:** `sm-summercmsio-app/vue-summercmsio-app/changelog/nuxt.config.ts` (`routeRules['/marketplace']`)
**Issue:** Every distinct `?q=` becomes a cache entry for 300 s. With in-memory cache storage, random queries grow the Node process's memory, limited only by the per-IP API throttle on cache misses.
**Fix:** Cache only `/marketplace` without a query (and the detail pages), or configure a bounded cache storage.
### IN-06: The detail page trusts the registry for the repository link's scheme
**File:** `sm-summercmsio-app/vue-summercmsio-app/changelog/app/pages/marketplace/[vendor]/[name].vue:135`
**Issue:** `:href="plugin.repository.replace(/\.git$/, '')"` does no scheme check. The server canonicalizes URLs to https today, but `Repository.BeforeSave` keeps non-https URLs unchanged (as the tests rely on), so a `javascript:` value written directly to the database would become a clickable link.
**Fix:** Render the link only when `plugin.repository.startsWith('https://')`.
### IN-07: The marketplace icon is loaded from third-party URLs in the admin
**File:** `admin/src/views/PluginsView.vue:371-378`
**Issue:** Each Marketplace tab view makes the administrator's browser fetch registry-provided icon URLs (any https host), and every Plugins screen view sends the installed plugin IDs to summercms.io by default. `referrerpolicy="no-referrer"` helps, but the default registry is opt-out.
**Fix:** Document the outbound calls in the admin-spa docs, or proxy icons through cabana.
### IN-08: `GET /plugins` and `GET /plugins/marketplace` use different envelopes
**File:** `modules/cabana/plugins.go:395`, `modules/cabana/plugins.go:421-456`
**Issue:** The installed list is wrapped (`WriteData` → `{data: ...}`), while the marketplace answers `MarketplaceResponse` raw via `writeJSON`. It is documented in OpenAPI, but inconsistent for SPA clients.
**Fix:** Pick one shape for new admin endpoints.
### IN-09: The committed `examples/hello/plugins.gen.go` bakes `FrameworkVersion = "v0.5.3"` on a v0.6.0 tree
**File:** `examples/hello/plugins.gen.go:29`
**Issue:** `EffectiveFramework` uses `git describe --abbrev=0`, so the generated constant names the previous tag until v0.6.0 is tagged and the file is regenerated. It shows up as drift in the committed example. Related: the site plugin's `go.mod` requires `summercms v0.6.0`, which does not exist as a tag yet; a standalone `go mod download` fails until it is tagged.
**Fix:** Regenerate the example after tagging v0.6.0 (add it to the release ledger), and tag the framework before pushing the site plugin's go.mod bump.
---
_Reviewed: 2026-10-29T12:00:00Z_
_Reviewer: Claude (msd-code-reviewer)_
_Depth: standard_

View File

@@ -0,0 +1,130 @@
---
phase: "34"
slug: "plugin-marketplace"
status: verified
# threats_open = count of OPEN threats at or above workflow.security_block_on severity (the blocking gate)
threats_open: 0
asvs_level: 1
created: "2026-11-05"
---
# Phase 34 — Security
> Per-phase security contract: threat register, accepted risks, and audit trail. Evidence roots: FW = `summercms.go` (master 7b8d205), SITE = `../sm-summercmsio-app/plugins/golem15/summercms` (v0.1.0, 0b3fbf4), APP = `../sm-summercmsio-app`, VUE = `../sm-summercmsio-app/vue-summercmsio-app`. T-34-SC is declared in all six plans and counted once (37 unique threats).
---
## Trust Boundaries
| Boundary | Description | Data Crossing |
|----------|-------------|---------------|
| plugin source → kiosk reader | plugin.go, go.mod and README.md of any directory the CLI is pointed at | Go source, module metadata (high) |
| CLI args → go/git subprocesses | dir and module paths reach `go mod edit`, `go list`, `git describe` | paths, module paths (high) |
| plugin.yaml (module cache / submodule) → summer build | third-party text baked into generated Go source | manifest strings (high) |
| plugin repository → registry and installers | plugin.yaml in a tag is read by summercms.io and `summer plugin:install` | manifest (high) |
| curated git repository → ingester | repository content controlled by plugin maintainers | git objects, README, manifests (high) |
| ingested README → marketplace HTML | third-party markdown rendered on summercms.io | HTML (high) |
| public internet → GET /api/registry/v1 | anonymous, cross-origin readers | listing JSON (low) |
| release script (token) → POST /api/registry/v1/ingest | authenticated, scoped | API token, repo id (high) |
| summercms.io admin → presentation fields and repository URLs | trusted administrators behind the SSH tunnel | URLs, text (medium) |
| registry JSON → CLI → go/git | module paths, versions and repository URLs from a registry | install plan (high) |
| user-supplied git URL → git | private or third-party repositories | URL (high) |
| third-party plugin code → app binary | compiled in after confirmation | Go code (high) |
| CLI → app directory | summer.yaml, go.mod, go.work, .gitmodules, plugins/ | app files (medium) |
| browser (admin SPA) → cabana /plugins endpoints | authenticated administrators | installed list, registry data (medium) |
| cabana → registry | outbound call to an operator-configured URL | registry JSON (medium) |
| registry JSON → admin UI | third-party text shown to administrators | names, descriptions, icons (medium) |
| developer workstation → shared remotes | pushes and tags (user-gated) | commits, tags (medium) |
| tests → developer environment / gate script → sibling repositories | module cache, sibling checkouts, Docker; read-only checks in other repos | test state (low) |
---
## Threat Register
| Threat ID | Category | Component | Severity | Disposition | Mitigation | Status |
|-----------|----------|-----------|----------|-------------|------------|--------|
| T-34-01 | Elevation of privilege | kiosk.ReadIdentity | high | mitigate | FW/modules/kiosk/identity.go:229 AST-only `parser.ParseFile`; `str()` :157-189 accepts constants only; only `go list -m`/`mod download`/`mod edit` run. Test manifest_smoke_test.go:172 | closed |
| T-34-02 | Tampering | exec of go/git with paths/modules | high | mitigate | no shell (derive.go:193-212, plugindirs.go:64,292,335); `--` before positionals (identity.go:443,487; plugindirs.go:63); leading "-" refused (build/manifest.go:497-503, kiosk/manifest.go:145-150) | closed |
| T-34-03 | Tampering | plugin.yaml text in plugins.gen.go | high | mitigate | `strconv.Quote` on every string (build.go:175-251), `format.Source` :254-259; malformed manifest ignored with warning (plugindirs.go:216-236). Test plugininfo_smoke_test.go:142 | closed |
| T-34-04 | Information disclosure | plugins.gen.go | low | mitigate | party.Info has no Dir (party/info.go:26-34) | closed |
| T-34-05 | Denial of service | summer build | medium | mitigate | resolveBuildMeta never fails, ID-only fallback with warning (plugindirs.go:94-109,183-186; build.go:39-42) | closed |
| T-34-06 | Repudiation | stale plugin.yaml | medium | mitigate | kiosk/check.go:77-91 `bytes.Equal` → StaleError, CheckT :107; `--check` at cmd/summer/main.go:474-478 | closed |
| T-34-SC | Tampering | npm/pip/cargo installs (all plans) | high | accept | AR-34-01 | closed |
| T-34-07 | Tampering | hand-edited/stale plugin.yaml | medium | mitigate | plugin.yaml + manifest_test.go calling `kiosk.CheckT` in all 25 plugin repos and sm-pgstripe-plugin/subscriptions | closed |
| T-34-08 | Spoofing | manifest claiming another module/ID | medium | mitigate | module from go.mod, package from dir, ID from plugin.go (derive.go:75-103); ingester re-checks (SITE/registry/ingest.go:283,315-327) | closed |
| T-34-09 | Tampering | app pointers to unpushed commits | high | mitigate | bump commits are gitlinks only (sm-demo-app 5ec5941, APP 668a773); every target SHA on origin default branch with its release tag | closed |
| T-34-10 | Denial of service | consumers resolving unreleased framework minimum | medium | accept | AR-34-02 | closed |
| T-34-11 | Elevation of privilege | ingester git with repo URLs | high | mitigate | SITE/registry/git.go: no shell :87, `GIT_ALLOW_PROTOCOL=https` :21,:75, no system/global config :76-77, no prompt, throwaway HOME; `--` before URLs (ingest.go:191,229,233); https-without-credentials enforced at every write path (models/repository.go:88-136) | closed |
| T-34-12 | Denial of service | malicious repo content | high | mitigate | bare `--filter=blob:none` clone (ingest.go:229); 64 KiB / 512 KiB read caps via LimitReader; per-command timeouts (git.go:85); `RemoveAll(tmp)`; ≤20 manifests per tag | closed |
| T-34-13 | Tampering (XSS) | README on /marketplace | high | mitigate | `breakwater.Render` + Purify at ingest (ingest.go:478; breakwater.go:90-99); page re-sanitizes before v-html and drops markdown (VUE/…/[name].vue:8,24-35,152); smoke asserts `notcontains=alert(` | closed |
| T-34-14 | Spoofing | repo claiming another plugin's ID/module | high | mitigate | curated repos only; identity check ingest.go:315-327; first-listed owner under advisory lock (:428,:449) + UNIQUE plugin_id index. Test registry_smoke_test.go:562 | closed |
| T-34-15 | Elevation of privilege | POST /api/registry/v1/ingest | high | mitigate | `cabana.ResolveBackend` + `Allows(PermissionIngest)` (SITE/controllers/api/registry.go:132-144); uncurated → 404; scope narrowed (token_scopes.go:22); nginx POST-only, 8k body (APP/deploy/nginx/summercms.io.conf:162-177); 4 KiB body cap | closed |
| T-34-16 | Denial of service | ingest-now flooding | medium | mitigate | `throttle:registry-ingest` 10/min (routes_registry.go:37,60-67); unique job by args (ingest.go:569); ls-remote digest before clone | closed |
| T-34-17 | Information disclosure | open CORS on registry API | low | mitigate | `*` origins, GET/HEAD, no credentials (APP/config/http.yaml:16-21); surf refuses credentials with `*` (cors.go:50-51); wire type has no last_error/enabled | closed |
| T-34-18 | Denial of service | public API abuse | medium | mitigate | `throttle:registry-api` 300/min; Cache-Control/ETag/304 (registry.go:208-231); q ≤100, category regex, escaped LIKE (registry/query.go:24-57) | closed |
| T-34-19 | Information disclosure | release script token | medium | mitigate | `read_secret_file` refuses group/world-readable file, never prints (APP/scripts/changelog-post.py:320-328); no journal-token fallback (:338-343); failures report status only | closed |
| T-34-20 | Tampering | stale manifest in published tag | medium | mitigate | `check_plugin_release` (changelog-post.py:354-380): HEAD exactly the tag, clean tree, `plugin:manifest --check`; called before posting (:428) | closed |
| T-34-21 | Denial of service | jobs never run in prod | medium | mitigate | `work_in_serve: true` (APP/config/queue.yaml:5); hourly `--queue` schedule; DEPLOY.md:89,93 checks; smoke.sh:243-249 | closed |
| T-34-22 | Elevation of privilege | registry strings → go get / git clone | high | mitigate | validateStep: `kiosk.ValidVersion`, validateModulePath, package within module (install.go:576-604), called in plan/apply/update/source; https-only no-userinfo repo URLs (source.go:135-152); `go get --`, git `--`; no shell | closed |
| T-34-23 | Elevation of privilege | ext::/file:: via git URL | high | mitigate | `cliGitProtocols = "https:ssh"` (source.go:26) forced in runCLIGit (:46-53); validateGitURL refuses leading "-", `::`, control chars, other schemes, credentials (:83-131) | closed |
| T-34-24 | Tampering | malicious plugin code compiled in | high | accept | AR-34-03 | closed |
| T-34-25 | Tampering | writes outside app root | medium | mitigate | ValidatePluginID / repoNameRe + `underRoot` before move and `submodule add` (source.go:386-474; scaffold.go:581-590) | closed |
| T-34-26 | Denial of service | slow/hostile registry | medium | mitigate | fetchguard TrustedMode, 4 MiB, 10 s (kiosk/client.go:28-29,84-88); no redirects (fetchguard/fetch.go:112); `--offline` | closed |
| T-34-27 | Spoofing | registry pointing at a different module | medium | mitigate | ingester ties module to repo; CLI re-reads plugin.yaml and go.mod from checkout and refuses mismatch (source.go:445-457) | closed |
| T-34-28 | Tampering | summer.yaml damaged by edit | low | mitigate | appendManifestPlugins re-parses and restores original on mismatch (build/manifest.go:206-252) | closed |
| T-34-29 | Elevation of privilege | GET /plugins, /plugins/marketplace | medium | mitigate | backend group (cabana/http.go:345-346); `pluginsPrincipal` 401/403 on `PermissionViewPlugins` (plugins.go:400-438); in security_coverage_test.go:56-57,312-313 | closed |
| T-34-30 | Information disclosure | installed plugin list | low | mitigate | gated by pluginsPrincipal; party.Info has no path | closed |
| T-34-31 | Denial of service | registry slow/down (admin) | medium | mitigate | cabana/plugins.go:132-140 4 s timeout, TTL cache (5m/15m, 1m failures), 4 concurrent, 256 cap; failure answers 200 `unavailable` | closed |
| T-34-32 | Tampering (XSS) | registry text in SPA | medium | mitigate | PluginsView.vue has no v-html, text interpolation only; icons https-only with `referrerpolicy="no-referrer"`; ID regex (plugins.go:147,472,536) | closed |
| T-34-33 | Server-side request forgery | plugins.registry_url | low | accept | AR-34-04 | closed |
| T-34-34 | Tampering | tests writing into siblings/module cache | medium | mitigate | `t.TempDir()` throughout; temp GOMODCACHE (fixtures_test.go:118-122; derive_test.go:283); no `../sm-*` paths in tests | closed |
| T-34-35 | Repudiation | gate passing on silently skipped tests | medium | mitigate | scripts/check-phase34.sh go test -json detector with required names (:142-300); Docker-not-run fails `--all` (:49-51); self-test plants each failure (:416-504) | closed |
| T-34-36 | Information disclosure | release ledger | low | mitigate | 34-release-log.md contains no token values, secrets or Bearer strings | closed |
*Status: open · closed · open — below high threshold (non-blocking)*
*Severity: critical > high > medium > low — only open threats at or above workflow.security_block_on count toward threats_open*
*Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
---
## Accepted Risks Log
| Risk ID | Threat Ref | Rationale | Accepted By | Date |
|---------|------------|-----------|-------------|------|
| AR-34-01 | T-34-SC | No package is installed or added: Go modules already required, no new npm dependency, reka-ui already a dependency. Confirmed: FW go.mod/go.sum/admin package files unchanged v0.5.3→v0.6.0; SITE's new requires are all in FW v0.6.0. | 34-01..06 PLAN | 2026-11-05 |
| AR-34-02 | T-34-10 | Plugins are not tagged until v0.6.0 exists (release order in 34-06's ledger); existing tags are never moved. Confirmed by tag timestamps (framework v0.6.0 before every plugin tag). | 34-02 PLAN | 2026-11-05 |
| AR-34-03 | T-34-24 | Inherent to compiled plugins; every addition is printed and needs confirmation or `--yes` (D-09); sumdb verification stays on (GONOSUMDB/GOSUMDB/GOPRIVATE/GOINSECURE never set in non-test code). | 34-04 PLAN | 2026-11-05 |
| AR-34-04 | T-34-33 | `plugins.registry_url` is an operator-configured trusted setting (fetchguard TrustedMode by design), no redirects, size-capped; administrators cannot change it from the admin. | 34-05 PLAN | 2026-11-05 |
*Accepted risks do not resurface in future audit runs.*
---
## Informational (review Info items, not in the register, non-blocking)
34-REVIEW-FIX covered CR and WR findings only. These remain in the code:
- IN-01 (near T-34-15): the ingest endpoint does not require `Content-Type: application/json` (SITE/controllers/api/registry.go:145-149).
- IN-02 (near T-34-22/26/33): `kiosk.NewClient` accepts `http://` registries without a warning (FW/modules/kiosk/client.go:74-76).
- IN-04 (near T-34-14): plugin ID ownership goes to the first repo and is never released.
- IN-06 (near T-34-13): the marketplace detail page binds `:href` from `plugin.repository` without a scheme check (VUE/changelog/app/pages/marketplace/[vendor]/[name].vue:135); every write path canonicalizes to https, so exploiting it needs a direct database write.
- IN-05, IN-07: the Nitro SWR cache is keyed by query string; the admin loads marketplace icons from third-party hosts.
---
## Security Audit Trail
| Audit Date | Threats Total | Closed | Open | Run By |
|------------|---------------|--------|------|--------|
| 2026-11-05 | 37 | 37 | 0 | msd-security-auditor (ASVS L1, block_on high) |
---
## Sign-Off
- [x] All threats have a disposition (mitigate / accept / transfer)
- [x] Accepted risks documented in Accepted Risks Log
- [x] `threats_open: 0` confirmed
- [x] `status: verified` set in frontmatter
**Approval:** verified 2026-11-05

View File

@@ -0,0 +1,48 @@
---
status: testing
phase: 34-plugin-marketplace
source: [34-VERIFICATION.md]
started: 2026-10-30T11:40:44.406Z
updated: 2026-10-30T11:40:44.406Z
---
## Current Test
number: 1
name: After the user-gated deploy, open https://summercms.io/marketplace: list, a search, a category link and a plugin detail page, in light and dark themes
expected: |
Plugins from the registry with install command, README and versions; search and category filter work; layout matches the summercms.io look
awaiting: user response
## Tests
### 1. After the user-gated deploy, open https://summercms.io/marketplace: list, a search, a category link and a plugin detail page, in light and dark themes
expected: Plugins from the registry with install command, README and versions; search and category filter work; layout matches the summercms.io look
result: [pending]
### 2. Production ingest on rome: registry-add the launch URLs, run summercms:registry-ingest, curl /api/registry/v1/plugins (CORS, 401 on POST ingest, 403 on POST plugins)
expected: Each repository ingested from its new plugin.yaml tag; API answers as in the release log step 7
result: [pending]
### 3. Admin Settings -> System -> Plugins in an application built against the live registry, light and dark themes: Installed tab (versions, sources, update badge with copy) and Marketplace tab (search, category, install command with copy, no install button)
expected: Screen renders, copy puts the exact summer command on the clipboard, registry-down notice when the registry is unreachable
result: [pending]
### 4. Run `summer plugin:install golem15.faq` on a scratch application on a real terminal, then `--source`, then a private plugin by ssh/https git URL, then `summer plugin:update`
expected: Plan printed as id@version (mode), interactive confirmation prompt, module/submodule installed and registered in summer.yaml/go.mod/go.work; git URL never contacts the registry for its own repo
result: [pending]
### 5. Review the version/compatibility semantics of the code-review fixes CR-01 (kiosk.Newer/Comparable, pseudo-version installs never downgraded), CR-02 (plugins sharing an installed module pinned at its version) and WR-10 (marketplace compatible marker matches plugin:install for dev/unknown framework versions)
expected: Rules match the intended policy; regression tests TestUpdatePseudoVersion, TestInstallSharedModule and cabana 'marketplace compatibility' pass (they do)
result: [pending]
## Summary
total: 5
passed: 0
issues: 0
pending: 5
skipped: 0
blocked: 0
## Gaps

View File

@@ -0,0 +1,106 @@
---
phase: "34"
slug: "plugin-marketplace"
# status lifecycle: draft (seeded by plan-phase) → validated (set by validate-phase §6)
# audit-milestone §5.5 distinguishes NOT-VALIDATED (draft) from PARTIAL (validated + nyquist_compliant: false) (#2117)
status: draft
nyquist_compliant: false
wave_0_complete: true
created: "2026-10-29"
---
# Phase 34 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | go test (+ testcontainers Postgres); Vitest for admin; node --test for vue-summercmsio-app; unittest for scripts |
| **Config file** | none for Go; admin/vitest.config.ts |
| **Quick run command** | `go vet ./... && go test -short ./internal/build ./cmd/summer ./modules/party ./modules/cabana` |
| **Full suite command** | `go test ./... && npm --prefix admin run test && scripts/check-admin-openapi.sh --check && scripts/check-admin-dist.sh && summer docs:build --check` |
| **Estimated runtime** | ~180 seconds |
---
## Sampling Rate
- **After every task commit:** Run the quick run command
- **After every plan wave:** Run the full suite command (per repo touched)
- **Before `/msd-verify-work`:** Full suite must be green
- **Max feedback latency:** 60 seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------|
| 34-01-T1 | 34-01 | 1 | SC-1, D-16 | - | Format, API shape, names and v0.6.0 confirmed before code | decision | n/a (answered as-planned) | n/a | ✅ green |
| 34-01-T2 | 34-01 | 1 | D-01, D-04 | T-34-01 | plugin.yaml generated from sources, never run | unit | `go test -short ./modules/kiosk -run 'TestManifestSmoke\|TestManifestFormat\|TestCheck'` | ✅ | ✅ green |
| 34-01-T3 | 34-01 | 1 | D-02, D-03, D-05 | T-34-02 | Const IDs read statically; non-const refused naming ID()/Requires() | unit | `go test -short ./modules/kiosk -run 'TestReadIdentity\|TestDerive\|TestPluginManifest'`; `./internal/build -run TestAddPluginConstID` | ✅ | ✅ green |
| 34-01-T4 | 34-01 | 1 | D-16 | T-34-04 | Strict vX.Y.Z rules; unknown JSON fields ignored | unit | `go test -short ./modules/kiosk -run 'TestVersions\|TestManifestSmoke/registry'` | ✅ | ✅ green |
| 34-01-T5 | 34-01 | 1 | SC-4, D-06, D-07 | T-34-03, T-34-05, T-34-06 | No filesystem path in PluginInfo; metadata failure never breaks a build | unit | `go test -short ./internal/build -run 'TestPluginInfoSmoke\|TestPluginDirs\|TestEffectiveFramework'`; `./modules/party -run TestDescribe` | ✅ | ✅ green |
| 34-02-T1 | 34-02 | 4 | SC-1, D-01, D-04 | T-34-07 | Drift guard fails go test on a stale plugin.yaml | integration | `bash scripts/check-phase34.sh --plugins` (sm-journal-plugin TestPluginManifest) | ✅ | ✅ green |
| 34-02-T2 | 34-02 | 4 | SC-1, D-01..D-05 | T-34-07, T-34-08 | 13 tagged repos: generated manifest, CheckT guard | integration | `bash scripts/check-phase34.sh --plugins` | ✅ | ✅ green |
| 34-02-T3 | 34-02 | 4 | SC-1, D-05 | T-34-08 | 6 untagged repos; no v0.0.0 plugin requirement | integration | `bash scripts/check-phase34.sh --plugins` | ✅ | ✅ green |
| 34-02-T4 | 34-02 | 4 | - | T-34-10 | Push/bump decision (answered defer) | decision | n/a (deferred to 34-release-log.md) | n/a | ✅ green |
| 34-02-T5 | 34-02 | 4 | - | T-34-09 | No pointer references an unpushed commit | manual | n/a (ledger: 34-release-log.md step 5) | n/a | ✅ green |
| 34-03-T1 | 34-03 | 2 | SC-2, D-13 | T-34-11, T-34-12, T-34-13 | Hardened anonymous https git, capped reads, sanitized README | integration | `go -C ../sm-summercmsio-app/plugins/golem15/summercms test ./... -run 'TestRegistrySmoke\|TestIngestTags\|TestIngestManifests\|TestGitRunner'` | ✅ | ✅ green |
| 34-03-T2 | 34-03 | 2 | D-14, D-15, D-16 | T-34-16, T-34-17, T-34-18 | Escaped search, capped query, ETag/304, digest skip | integration | `bash scripts/check-phase34.sh --site` and `--docker` (TestRegistryAPIShapes, TestQueryRules) | ✅ | ✅ green |
| 34-03-T3 | 34-03 | 2 | D-04, D-13 | T-34-14, T-34-15, T-34-19, T-34-20 | Ingest-now needs scope + permission, never creates a listing; release script refuses dirty/stale trees | integration | `go -C …/summercms test -run TestRegistryIngestEndpoint`; `python3 -B scripts/test_changelog_post.py` | ✅ | ✅ green |
| 34-03-T4 | 34-03 | 2 | SC-2 | T-34-21 | /marketplace renders registry text as text | automated_ui | `pnpm test && pnpm test:marketplace` (vue-summercmsio-app); `scripts/check-deploy.sh` | ✅ | ✅ green |
| 34-04-T1 | 34-04 | 2 | SC-3, D-08 | T-34-22 | Install picks newest compatible release; no go mod tidy | integration | `go test ./internal/build -run TestInstallSmoke/module` (`--docker` stage) | ✅ | ✅ green |
| 34-04-T2 | 34-04 | 2 | D-09, D-18 | T-34-23, T-34-24, T-34-25 | Registry strings validated before exec; --yes off a terminal; offline makes no call | unit | `go test -short ./internal/build -run 'TestResolveInstall\|TestAskToProceed'`; `./cmd/summer -run TestPluginCommands` | ✅ | ✅ green |
| 34-04-T3 | 34-04 | 2 | D-11, D-12 | T-34-26, T-34-27 | Git URLs validated, no credentials in .gitmodules, protocol allow-list | integration | `go test ./internal/build -run 'TestInstallSmoke/(source\|giturl\|urls\|nogit)'` | ✅ | ✅ green |
| 34-04-T4 | 34-04 | 2 | D-10 | T-34-28 | Update never moves the framework; comments in summer.yaml kept | integration | `go test ./internal/build -run 'TestInstallSmoke/update\|TestAppendManifestPlugins'` | ✅ | ✅ green |
| 34-05-T1 | 34-05 | 3 | D-19, D-06 | T-34-29, T-34-30 | 401/403 without backend.view_plugins; entry only for allowed principals | unit | `go test -short ./modules/cabana -run 'TestPluginsScreenSmoke\|TestPluginsEndpoints'` | ✅ | ✅ green |
| 34-05-T2 | 34-05 | 3 | SC-4, D-07, D-17, D-18 | T-34-31, T-34-32 | Cached, bounded registry calls; IDs and icons sanitized; degraded 200 | unit | `go test -short ./modules/cabana -run TestPluginsEndpoints`; `npm --prefix admin run test -- PluginsView useSettings` | ✅ | ✅ green |
| 34-05-T3 | 34-05 | 3 | D-17 | T-34-33 | Committed dist matches a fresh build | other | `bash scripts/check-phase34.sh --admin` (check-admin-openapi --check, check-admin-dist) | ✅ | ✅ green |
| 34-06-T1 | 34-06 | 5 | SC-5 | T-34-35 | Gate fails on a skipped, missing or failing test and on a missing repository | other | `bash scripts/check-phase34.sh --self-test` | ✅ | ✅ green |
| 34-06-T2 | 34-06 | 5 | SC-5, D-02..D-05, D-07..D-10, D-12, D-18 | T-34-34 | Fixtures in t.TempDir(), no writes to sibling repos | unit | `bash scripts/check-phase34.sh --go` | ✅ | ✅ green |
| 34-06-T3 | 34-06 | 5 | SC-5, D-17, D-19 | - | Unexported seams only (additive) | unit | `bash scripts/check-phase34.sh --admin --additive` | ✅ | ✅ green |
| 34-06-T4 | 34-06 | 5 | SC-5, D-13..D-16 | T-34-34 | Release script and registry tests never touch the network | unit | `bash scripts/check-phase34.sh --site` | ✅ | ✅ green |
| 34-06-T5 | 34-06 | 5 | - | T-34-36 | Ledger names repos, SHAs and steps only; no secrets | manual | `grep -n 'v0.6.0\|Release order\|Executed steps\|never move' 34-release-log.md` | ✅ | ✅ green |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
- [x] manifest module tests: derive / README / check / validate (`modules/kiosk/*_test.go`)
- [x] `internal/build` fixture helpers: git repo with tags, `file://` GOPROXY tree (stdlib only) (`internal/build/fixtures_test.go`, 34-04)
- [x] site plugin `TestMain` with testcontainers (`flag.Parse()` + `testing.Short()`) (`testmain_test.go`, 34-03)
- [x] admin PluginsView vitest spec (`admin/tests/views/PluginsView.test.ts`)
- [x] `scripts/check-phase34.sh`
*If none: "Existing infrastructure covers all phase requirements."*
---
## Manual-Only Verifications
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Production ingest on summercms.io (git present on server, hourly job runs) | SC-2 | Needs the deployed host | Deploy, add a repo in the admin, wait for/trigger ingest, `curl /api/registry/v1/plugins` |
| Marketplace pages look right | SC-2 | Visual | Open /marketplace list, search, category and a detail page |
*If none: "All phase behaviors have automated verification."*
---
## Validation Sign-Off
- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 60s
- [ ] `nyquist_compliant: true` set in frontmatter
**Approval:** pending

View File

@@ -0,0 +1,193 @@
---
phase: 34-plugin-marketplace
verified: 2026-10-30T11:38:52Z
status: human_needed
score: 52/52 must-haves verified
covered_files: [".planning/phases/34-plugin-marketplace/34-01-PLAN.md", ".planning/phases/34-plugin-marketplace/34-01-SUMMARY.md", ".planning/phases/34-plugin-marketplace/34-02-PLAN.md", ".planning/phases/34-plugin-marketplace/34-02-SUMMARY.md", ".planning/phases/34-plugin-marketplace/34-03-PLAN.md", ".planning/phases/34-plugin-marketplace/34-03-SUMMARY.md", ".planning/phases/34-plugin-marketplace/34-04-PLAN.md", ".planning/phases/34-plugin-marketplace/34-04-SUMMARY.md", ".planning/phases/34-plugin-marketplace/34-05-PLAN.md", ".planning/phases/34-plugin-marketplace/34-05-SUMMARY.md", ".planning/phases/34-plugin-marketplace/34-06-PLAN.md", ".planning/phases/34-plugin-marketplace/34-06-SUMMARY.md", "README.md", "admin/src/api/schema.d.ts", "admin/src/api/types.ts", "admin/src/app/pageTitle.ts", "admin/src/app/router.ts", "admin/src/components/shell/AppShell.vue", "admin/src/components/shell/Breadcrumbs.vue", "admin/src/components/shell/PluginRail.vue", "admin/src/state/useSettings.ts", "admin/src/views/PluginsView.vue", "cmd/summer/main.go", "cmd/summer/plugin_commands_test.go", "docs/architecture/go-modules-and-workspaces.md", "docs/architecture/introduction.md", "docs/backend/admin-spa.md", "docs/backend/users-and-permissions.md", "docs/console/scaffolding.md", "docs/plugins/marketplace.md", "internal/build/build.go", "internal/build/build_test.go", "internal/build/fixtures_test.go", "internal/build/install.go", "internal/build/install_smoke_test.go", "internal/build/install_test.go", "internal/build/manifest.go", "internal/build/manifest_append_test.go", "internal/build/new.go", "internal/build/plugindirs.go", "internal/build/plugindirs_test.go", "internal/build/plugininfo_smoke_test.go", "internal/build/rollback.go", "internal/build/scaffold.go", "internal/build/source.go", "internal/build/testdata/new-no-plugin/plugins.gen.go.golden", "internal/build/testdata/new/main.go.golden", "internal/build/testdata/new/plugins.gen.go.golden", "internal/build/update.go", "modules/cabana/README.md", "modules/cabana/admin_openapi.go", "modules/cabana/backend_screens.go", "modules/cabana/http.go", "modules/cabana/navigation.go", "modules/cabana/openapi_conformance_test.go", "modules/cabana/plugins.go", "modules/cabana/plugins_smoke_test.go", "modules/cabana/plugins_test.go", "modules/cabana/security_coverage_test.go", "modules/cabana/token_routes_test.go", "modules/kiosk/README.md", "modules/kiosk/check.go", "modules/kiosk/checkt_test.go", "modules/kiosk/client.go", "modules/kiosk/client_test.go", "modules/kiosk/derive.go", "modules/kiosk/derive_test.go", "modules/kiosk/example_test.go", "modules/kiosk/identity.go", "modules/kiosk/identity_test.go", "modules/kiosk/kiosk.go", "modules/kiosk/manifest.go", "modules/kiosk/manifest_smoke_test.go", "modules/kiosk/manifest_test.go", "modules/kiosk/registry.go", "modules/kiosk/testdata/consts/README.md", "modules/kiosk/testdata/consts/go.mod", "modules/kiosk/testdata/consts/ids/ids.go", "modules/kiosk/testdata/consts/nested/README.md", "modules/kiosk/testdata/consts/nested/plugin.go", "modules/kiosk/testdata/consts/plugin.go", "modules/kiosk/testdata/consts/vendor.go", "modules/kiosk/testdata/framework/go.mod", "modules/kiosk/testdata/literal/README.md", "modules/kiosk/testdata/literal/go.mod", "modules/kiosk/testdata/literal/plugin.go", "modules/kiosk/testdata/literal/plugin.yaml", "modules/kiosk/testdata/other/README.md", "modules/kiosk/testdata/other/go.mod", "modules/kiosk/testdata/other/plugin.go", "modules/kiosk/version.go", "modules/kiosk/version_test.go", "modules/party/README.md", "modules/party/info.go", "modules/party/info_test.go", "modules/phrasebook/backend/lang/en/lang.yaml", "modules/phrasebook/backend/lang/pl/lang.yaml", "scripts/check-phase34.sh"]
covered_digest: "v2:sha256:ea9e014d5303a11e95afc159507675fe76c296ac7e68c5e2fa5dcf14070988b6"
behavior_unverified: 0
overrides_applied: 0
re_verification:
previous_status: gaps_found
previous_score: 51/52
gaps_closed:
- "34-06: 34-release-log.md lists every plugin commit waiting for push or tag and the pending submodule pointer bumps. sm-presentations-plugin README and manifest rebased onto sm-bm-app's theme commit d205cd7 (cfa0c40, 3eb4de7). d205cd7, 5bcbaaf (v0.1.1, sm-demo-app pointer) and 30a47ac are ancestors of 3eb4de7, so both bumps are fast-forwards. Ledger rows 24, 206 and 207 and 34-02-SUMMARY name 3eb4de7. Plugin tree clean, vet/short tests/manifest --check pass, gate --plugins PASS over 24 repositories"
gaps_remaining: []
regressions: []
human_verification:
- test: "After the user-gated deploy, open https://summercms.io/marketplace: list, a search, a category link and a plugin detail page, in light and dark themes"
expected: "Plugins from the registry with install command, README and versions; search and category filter work; layout matches the summercms.io look"
why_human: "Visual check against the live deployed site; the code is covered by pnpm test:marketplace and the Node SSR smoke against the real binary"
- test: "Production ingest on rome: registry-add the launch URLs, run summercms:registry-ingest, curl /api/registry/v1/plugins (CORS, 401 on POST ingest, 403 on POST plugins)"
expected: "Each repository ingested from its new plugin.yaml tag; API answers as in the release log step 7"
why_human: "Needs pushed tags, git on the server and the deployed binary"
- test: "Admin Settings -> System -> Plugins in an application built against the live registry, light and dark themes: Installed tab (versions, sources, update badge with copy) and Marketplace tab (search, category, install command with copy, no install button)"
expected: "Screen renders, copy puts the exact summer command on the clipboard, registry-down notice when the registry is unreachable"
why_human: "Visual and clipboard behaviour in a real browser; vitest covers the component"
- test: "Run `summer plugin:install golem15.faq` on a scratch application on a real terminal, then `--source`, then a private plugin by ssh/https git URL, then `summer plugin:update`"
expected: "Plan printed as id@version (mode), interactive confirmation prompt, module/submodule installed and registered in summer.yaml/go.mod/go.work; git URL never contacts the registry for its own repo"
why_human: "Real terminal prompt, user git credentials and the live registry; tests use httptest and file:// fixtures"
- test: "Review the version/compatibility semantics of the code-review fixes CR-01 (kiosk.Newer/Comparable, pseudo-version installs never downgraded), CR-02 (plugins sharing an installed module pinned at its version) and WR-10 (marketplace compatible marker matches plugin:install for dev/unknown framework versions)"
expected: "Rules match the intended policy; regression tests TestUpdatePseudoVersion, TestInstallSharedModule and cabana 'marketplace compatibility' pass (they do)"
why_human: "Flagged by 34-REVIEW-FIX.md as logic changes needing a human decision on semantics"
---
# Phase 34: Plugin marketplace Verification Report
**Phase Goal:** People browse the public Golem15 plugins at summercms.io/marketplace and add one to their application with a single command, `summer plugin:install <id>`. The same command installs private plugins straight from a git URL without contacting summercms.io. The admin SPA gains a read-only Plugins screen listing installed plugins and searching the marketplace, which shows the install command with a copy button. v1 has no paid plugins, no developer registration and no installs from the admin panel.
**Verified:** 2026-10-30T11:38:52Z
**Status:** human_needed
**Re-verification:** Yes, after gap closure (previous: gaps_found, 51/52, verified 2026-10-30T11:31:46Z)
## Re-verification summary
| Item | Previous | Now | Evidence |
|------|----------|-----|----------|
| 34-06 release ledger (sm-bm-app presentations row) | ✗ PARTIAL | ✓ VERIFIED | Plugin history rebased onto d205cd7; ancestry, clean tree, tests, manifest check and gate all pass; ledger rows name 3eb4de7 (details below) |
| SC-1 (24 public plugin repos with plugin.yaml) | ✓ | ✓ (regression check) | Gate `--plugins`: `phase34 plugins passed (24 repositories)`, 25 `manifest: ... fresh` lines |
| Other 50 items | ✓ | ✓ (regression check) | No framework code changed since the previous run: the only commit after it is c739a7d (planning docs). `git diff ba39bb1..HEAD` outside `.planning` is `scripts/check-phase34.sh` (65e0cdd, presentations added to `PLUGIN_REPOS`), exercised by the gate run |
### Gap closure evidence (presentations)
| Check | Command | Result |
|-------|---------|--------|
| History | `git log --format='%h %p %s'` in `../sm-presentations-plugin` | 3eb4de7 (manifest) parent cfa0c40 (README) parent d205cd7 (sztab theme) parent 30a47ac = `origin/master`. Linear, 3 ahead, 0 behind |
| Same commit as the sm-bm-app mount | `git rev-parse d205cd7` in both | `d205cd718563b390a0dcf678e41119fa0ca90976` in both; sm-bm-app HEAD 9929195 gitlink = d205cd7, mount worktree at d205cd7 |
| (a) Fast-forward from sm-bm-app | `git merge-base --is-ancestor d205cd7 3eb4de7` | true (2 commits) |
| (a) Fast-forward from sm-demo-app | `git merge-base --is-ancestor 5bcbaaf 3eb4de7` | true; 5bcbaaf = tag v0.1.1, sm-demo-app gitlink, `v0.1.1..3eb4de7` = 13 commits, matching ledger row 24 |
| The rebase changed only the base | `git diff --stat d205cd7 3eb4de7` | README.md, go.mod, go.sum, manifest_test.go, plugin.yaml (same five files as before). d205cd7 touches only `controllers/presentations_test.go`, `lang/{en,pl}/lang.yaml`, `models/presentations/fields.yaml`, none of the manifest inputs |
| (b) Clean tree | `git status --porcelain` | empty |
| (b) Vet and short tests | `go vet ./... && go test -short -count=1 ./...` | exit 0, 7 packages ok |
| (b) Manifest | `summer plugin:manifest --check .` (scratchpad binary) | `plugin.yaml is up to date`, exit 0; `golem15.presentations`, framework v0.6.0, requires `golem15.user: v0.1.0` |
| No tag yet | `git tag --points-at HEAD` | none (tagging is in the user-gated release) |
| (c) Stale SHAs | `grep -rn 'b6247aa\|bb81f4d' .planning/phases/34-plugin-marketplace/` | only this report's history (now removed). None in the release log or SUMMARYs |
| (c) Ledger rows | `34-release-log.md` rows 24, 206, 207; 34-02-SUMMARY table | row 24: 3eb4de7, 13 commits, v0.1.1 -> v0.1.2; sm-demo-app 5bcbaaf -> v0.1.2 (3eb4de7); sm-bm-app d205cd7 (committed in 9929195) -> v0.1.2 (3eb4de7); note dated 2026-10-30 to push the plugin master; SUMMARY row names 3eb4de7 after cfa0c40. All agree with git |
| (d) Gate | `bash scripts/check-phase34.sh --plugins` | `phase34 plugins passed (24 repositories)`, exit 0, 25 fresh manifests (sm-user-plugin TestRegisterCORSPath skip, pre-existing) |
## Goal Achievement
### Roadmap Success Criteria
| # | Truth | Status | Evidence |
|---|-------|--------|----------|
| SC-1 | Every public sm-*-plugin repo carries a validated plugin.yaml and fetches anonymously | ✓ VERIFIED | Anonymous forge API (`/orgs/golem15/repos`, `/repos/search?q=sm-` and `?q=plugin`) lists 24 public golem15 `sm-*-plugin` repos; all 24 are in `PLUGIN_REPOS` and have a sibling checkout. The four gap repos each have a tracked `plugin.yaml` + `manifest_test.go` (`kiosk.CheckT(t, ".")`), `require .../summercms v0.6.0`, a clean tree and no tag at HEAD; golem, feedback and quizzes are 1 commit ahead of origin, presentations 3 (sztab theme d205cd7, README cfa0c40, manifest 3eb4de7). `check-phase34.sh --plugins` re-run this time: `phase34 plugins passed (24 repositories)`, 25 `manifest: ... fresh` lines (pgstripe nested). `git ls-remote https://git.golem15.com/golem15/<repo>.git` without credentials returned refs for all four in the previous run. See the note on `jakub/sm-bm-plugin` below |
| SC-2 | summercms.io ingests manifest/README/versions on tag, serves registry API, renders /marketplace list/search/category/detail; presentation fields edited in admin | ✓ VERIFIED (code) | Unchanged since a9237c8 (no site or vue commit in either gap closure). Live deploy is a human item |
| SC-3 | `plugin:install golem15.<name>` (module; `--source` submodule) and `plugin:install <git-url>` (submodule) register like plugin:add and check requirements | ✓ VERIFIED | Unchanged; `internal/build` and `cmd/summer` untouched since a9237c8; short suite green in the previous run, no code change since |
| SC-4 | Admin Plugins screen: installed plugins with versions and updates; Marketplace tab searches registry, install command with copy | ✓ VERIFIED | Unchanged; cabana and admin untouched since a9237c8 |
| SC-5 | New code has unit tests in the last plan | ✓ VERIFIED | Plus `TestDeriveMissingReplace` for 87921c2 |
**Note on `jakub/sm-bm-plugin`.** The anonymous search also returns `jakub/sm-bm-plugin` (public, a Go plugin with `go.mod` and `plugin.go`, no `plugin.yaml`). It sits in a personal namespace, uses vendor `jz` and is mounted only in `sm-bm-app` (`plugins/jz/bm`). The phase goal covers "the public Golem15 plugins", and the previous verifications used the same golem15-organisation scope, so it is recorded here as information, not a gap. If it is not meant to be public, making it private settles the question.
### Plan must-haves (summary)
| Plan | Truths | Status | Notes |
|------|--------|--------|-------|
| 34-01 kiosk, plugin:manifest, PluginInfo | 10 | 10 ✓ | 87921c2 changes `kiosk/identity.go` (see below); README and docs updated in the same commit; docs checker passes |
| 34-02 plugin.yaml rollout | 7 | 7 ✓ | 25 manifests in 24 repos, all fresh (gate `--plugins`, re-run) |
| 34-03 registry and /marketplace | 9 | 9 ✓ | No change |
| 34-04 plugin:install / plugin:update | 9 | 9 ✓ | No change |
| 34-05 admin Plugins screen | 6 | 6 ✓ | No change |
| 34-06 tests, gate, ledger | 6 | 6 ✓ | Gate `PLUGIN_REPOS` has 24 entries and passes; release log rows 21-24 list the four new tags (golem v0.1.2, feedback v0.1.2, quizzes v0.1.1, presentations v0.1.2 on 3eb4de7) and eight pointer bumps; all eight current pointers match the committed gitlinks and every target is a descendant of them. One prose sentence below the pointer table still carries the old counts (warning below) |
**Score:** 52/52 truths verified (5 roadmap SCs + 47 plan truths; 0 present-but-behavior-unverified)
### 87921c2: fetch a required module whose replace directory is missing
`resolver.list` (`modules/kiosk/identity.go`) now marks a `go list -m -e -json` entry as `fallback` when it has a `Dir`, no `Error` and the directory does not exist, and clears `Dir`/`GoMod` so `download` fetches it at the go.mod-required version. `minimums` downloads fallbacks in their own `go mod download` batch, after the framework-requiring candidates, and after the download skips a fallback whose go.mod does not require the framework.
- **Correctness:** `TestDeriveMissingReplace` (file:// proxy, offline) PASS: with `../user` absent, `acme.user` gets `v0.1.2`; with a version the proxy lacks, the minimum is `""` and there is one "not matched" warning.
- **Real layout:** in `sm-feedback-plugin`, with a temporary go.work that replaces only the framework (so go.mod's `replace sm-user-plugin => ../user` points at a directory that does not exist), `summer plugin:manifest --check .` prints `plugin.yaml is up to date` (`golem15.user: v0.1.0`). The manifest is the same in both layouts, as the commit claims.
- **No regression:** an existing replace directory, or a module-cache module, keeps its `Dir`, so the path is unchanged. A fallback at `v0.0.0` or without a version is dropped as before (the old code read a missing go.mod and skipped it). Gate `--plugins` reports all manifests fresh; `go test -short ./...` is green.
- **Info:** all fallbacks share one download, so one unfetchable fallback version drops the minimums of the other fallbacks too, with a warning. The commit message says "one unfetchable version does not hold up the others", which is true only of fallbacks against candidates. A standalone checkout whose sibling replace is missing now reaches the module proxy (network) in `TestPluginManifest`.
### Required Artifacts
| Artifact | Status | Details |
|----------|--------|---------|
| `modules/kiosk/{manifest,identity,check,registry,version,client}.go` | ✓ VERIFIED | identity.go +40/-9 (87921c2), substantive |
| `modules/kiosk/derive_test.go` | ✓ VERIFIED | `TestDeriveMissingReplace`, `writeProxyModule` |
| `../sm-{golem,feedback,quizzes,presentations}-plugin/{plugin.yaml,manifest_test.go}` | ✓ VERIFIED | Tracked, generated header, `framework: v0.6.0`; feedback/quizzes/presentations `requires: golem15.user: v0.1.0`; golem no requires; overrides block where `--name` was used |
| `../sm-presentations-plugin/README.md` | ✓ VERIFIED | cfa0c40 (rebased), H1 "Presentations" + summary paragraph that the manifest's name and description come from |
| `scripts/check-phase34.sh` | ✓ VERIFIED | `PLUGIN_REPOS` 24 entries |
| `34-release-log.md` | ✓ VERIFIED | Rows 21-24, eight pointer rows and the 2026-10-30 presentations note match git; one stale prose sentence (warning) |
| All other artifacts | ✓ VERIFIED | Unchanged since the previous run |
### Key Link Verification
| From | To | Via | Status |
|------|----|-----|--------|
| sm-*-plugin/manifest_test.go | kiosk/check.go | `kiosk.CheckT(t, ".")` | WIRED (24/24 repos, 25 packages) |
| kiosk `minimums` | kiosk `download` | fallback batch then `requiresFramework` | WIRED |
| check-phase34.sh `--plugins` | 24 sibling repos | `PLUGIN_REPOS`, `summer plugin:manifest --check` | WIRED |
| sm-bm-app / sm-demo-app presentations gitlinks | sm-presentations-plugin 3eb4de7 | fast-forward (ancestry) | WIRED (d205cd7 and 5bcbaaf both ancestors) |
| All other links | | | WIRED (unchanged) |
### Behavioral Spot-Checks
| Behavior | Command | Result | Status |
|----------|---------|--------|--------|
| go vet + short suite (framework) | `go vet ./... && go test -short -count=1 ./...` | exit 0 in the previous run; no framework code changed since | ✓ PASS |
| New kiosk test | `go test -short ./modules/kiosk -run TestDeriveMissingReplace -v` | PASS (previous run) | ✓ PASS |
| Fallback layout | `GOWORK=<framework-only go.work> summer plugin:manifest --check .` in sm-feedback-plugin | "plugin.yaml is up to date" | ✓ PASS |
| Anonymous fetch (4 new) | `git -c credential.helper= ls-remote https://git.golem15.com/golem15/<repo>.git` | refs returned | ✓ PASS |
| Forge scope | anonymous `/api/v1/orgs/golem15/repos`, `/repos/search?q=sm-`, `?q=plugin` | 24 public golem15 sm-*-plugin repos, all in PLUGIN_REPOS | ✓ PASS |
| Presentations plugin (this run) | `go vet ./... && go test -short -count=1 ./...`; `summer plugin:manifest --check .` | exit 0; up to date | ✓ PASS |
| Ledger pointers vs gitlinks (this run) | `git ls-tree HEAD plugins/golem15/presentations` in sm-bm-app and sm-demo-app; `merge-base --is-ancestor` | d205cd7 and 5bcbaaf, as in the ledger; both ancestors of 3eb4de7 | ✓ PASS |
### Probe Execution
| Probe | Command | Result | Status |
|-------|---------|--------|--------|
| `scripts/check-phase34.sh --plugins` | `bash scripts/check-phase34.sh --plugins` (this run) | `phase34 plugins passed (24 repositories)`, exit 0, 25 fresh manifests (sm-user-plugin TestRegisterCORSPath skip note, pre-existing) | PASS |
| `scripts/check-phase34.sh --go --docs` | same (previous run) | `PASS go`, `PASS docs`, exit 0 | PASS |
| `scripts/check-phase34.sh --self-test --marker --additive` | same (previous run) | all PASS, exit 0 | PASS |
Only `--plugins` was re-run: since the previous verification the only commit is c739a7d (planning docs) plus the plugin-repo rebase, which `--plugins` covers. The site, admin and docker stages passed in earlier runs and nothing they cover has changed.
### Requirements Coverage
| ID | Plans | Status | Evidence |
|----|-------|--------|----------|
| SC-1 | 01, 02, 06 | ✓ SATISFIED | 24/24 public golem15 plugin repos |
| SC-2..SC-5 | | ✓ SATISFIED | unchanged |
| D-01..D-19 | | ✓ SATISFIED | unchanged; D-05 (Go-style minimums) extended by 87921c2 |
No orphaned IDs.
### Anti-Patterns Found
| File | Line | Pattern | Severity | Impact |
|------|------|---------|----------|--------|
| 87921c2 files, the four new plugin files, c739a7d | - | TBD/FIXME/XXX | - | none found |
| `34-release-log.md` | 209 | stale counts: "presentations 12 commits after sm-demo-app's v0.1.1 and 2 after sm-bm-app's 30a47ac" | ⚠️ Warning | Now 13 after v0.1.1 (row 24 already says 13) and 2 after sm-bm-app's d205cd7 (3 after 30a47ac). The fast-forward claim itself is true; the table rows two lines above and the closing note are correct, so following the ledger does the right thing. The previous gap asked for this sentence to be corrected and c739a7d did not touch it |
| `34-02-SUMMARY.md` | 260 | same stale sentence ("12 commits after sm-demo-app's v0.1.1 and 2 after sm-bm-app's 30a47ac") | ⚠️ Warning | Same correction |
| `34-release-log.md` | 241 | "the three of the SC-1 gap closure" followed by four URLs | ℹ️ Info | Wording from 211be60; should say four |
| `modules/kiosk/identity.go` | minimums | fallbacks share one download batch | ℹ️ Info | one unfetchable fallback hides the others' minimums (with a warning) |
| `../sm-oauthserver-plugin/go.work` | - | tracked file modified since 2026-10-23 | ℹ️ Info | pre-existing, outside the phase |
| `../sm-demo-app/plugins/golem15/oauthserver` | - | worktree at b6a9586, committed gitlink 8bbec72 | ℹ️ Info | both are ancestors of d600e2c, so the bump is still a fast-forward |
| `../sm-bm-app/plugins/golem15/presentations` | - | mount master ahead 1 of origin (d205cd7) | ℹ️ Info | expected until `../sm-presentations-plugin` master is pushed, as the ledger note says |
### Advisory (New Scope, Unevidenced)
None.
### Human Verification Required
1. **Live /marketplace:** after the deploy, list, search, category and detail pages in light and dark themes.
2. **Production ingest:** registry-add the launch URLs, ingest, curl the API (release log step 7).
3. **Admin Plugins screen:** Installed and Marketplace tabs against the live registry, light and dark themes, copy to clipboard.
4. **Real-terminal installs:** `summer plugin:install golem15.faq`, `--source`, a private git URL over ssh/https, and `summer plugin:update` with the interactive prompt.
5. **Fix semantics:** CR-01, CR-02 and WR-10 version and compatibility rules (34-REVIEW-FIX.md flags them); their regression tests pass.
These are user-gated by design (deploy, push, tags, a real browser and terminal), so the status is human_needed rather than passed.
### Gaps Summary
No gaps remain. The release-ledger regression is closed. In `../sm-presentations-plugin` the README and manifest commits now sit on top of d205cd7, the same commit sm-bm-app points at. Both app pointers (sm-bm-app d205cd7, sm-demo-app 5bcbaaf = v0.1.1) are ancestors of 3eb4de7, so both bumps are fast-forwards and v0.1.2 carries the sztab theme. The plugin tree is clean, its tests, vet and manifest check pass, and the phase gate passes over all 24 repositories. The ledger rows and 34-02-SUMMARY name the new SHAs, and no b6247aa/bb81f4d reference is left in the phase docs.
One warning remains. The fast-forward sentence below the pointer table (release log line 209, repeated in 34-02-SUMMARY line 260) still says "12 commits after sm-demo-app's v0.1.1 and 2 after sm-bm-app's 30a47ac". It should say 13, and 2 after sm-bm-app's d205cd7. This is a two-number edit. The sentence's claim is still true and the rows are correct, so it does not block.
---
_Verified: 2026-10-30T11:38:52Z_
_Verifier: Claude (msd-verifier)_

View File

@@ -0,0 +1,373 @@
# Phase 34 release log
The user-gated release of the plugin marketplace: framework `v0.6.0`, a new tag in every public plugin repository, the summercms.io site plugin and pages, the application pointer bumps and the summercms.io deploy. Nothing in this file has been pushed, tagged or deployed; plan 34-06 only wrote it. Jakub runs the steps in order and records each one under "Executed steps".
Decisions this ledger follows:
- **Plugin tags (Jakub, 2026-10-29):** every plugin that got a `plugin.yaml` commit in this phase (the 20 `sm-*-plugin` repositories of 34-02 and the 4 of its SC-1 gap closure: golem, feedback, quizzes, presentations) and `sm-summercmsio-plugin` get a new release tag: the next patch after the newest existing tag, `v0.1.0` for a repository without one.
- **Changelog (Jakub, 2026-10-29):** only the framework `v0.6.0` tag gets a post on https://summercms.io/changelog. The plugin tags get **no** `/changelog/plugins` posts; the framework post and the tag message list the plugin bumps instead.
- **App pointer bumps:** deferred in 34-02 ("defer"); they move here and target the tagged plugin commits.
- Memory rules: tag only at phase completion after full verification, tags only on the default branch, every tag contains the earlier tags.
## Planned contents
### Framework `v0.6.0` (summercms.go, master)
Newest tag before the phase: `v0.5.3`. master is 32 commits ahead of origin/master at the time of writing (planning docs of other sessions included). Code commits of the phase:
| Plan | Commit | Subject |
|------|--------|---------|
| 34-01 | ec6a195 | feat(kiosk): plugin.yaml manifest and summer plugin:manifest |
| 34-01 | 51ec2f9 | feat(kiosk): resolve constant plugin IDs, overrides and the CheckT helper |
| 34-01 | 4916ee3 | feat(kiosk): registry v1 wire types and version rules |
| 34-01 | e8d3d72 | feat(build): bake plugin metadata and the framework version into plugins.gen.go |
| 34-04 | 9b23e87 | feat(build): summer plugin:install for registry plugins as Go modules |
| 34-04 | a462bf1 | feat(build): plugin:install resolves requirements, pins and prompts |
| 34-04 | 8093587 | feat(build): plugin:install --source and git URLs as submodules |
| 34-04 | d024ab4 | feat(build): summer plugin:update |
| 34-05 | c4b1ac4 | feat(cabana): read-only Plugins screen with installed plugins |
| 34-05 | 7e8a193 | feat(cabana): plugin updates and marketplace search on the Plugins screen |
| 34-05 | 678eac4 | build(admin): rebuild the embedded admin for the Plugins screen |
| 34-06 | b93a6de | test: phase 34 gate script |
| 34-06 | 9109e5b | test(kiosk): manifest, identity, version and client unit tests |
| 34-06 | 7de774b | test(build): plugin dirs, install resolution and summer.yaml edits (two fixes) |
| 34-06 | a231309 | test(summer): plugin command prompts |
| 34-06 | df2ba57 | test(cabana): Plugins screen endpoints (one fix) |
| 34-06 | bad273b | test(admin): PluginsView and settings paths |
| 34-06 | dfc6127 | test: phase 34 gate requires the summercms.io unit tests |
| 34 gap | 87921c2 | fix(kiosk): fetch a required plugin module whose replace directory is missing |
The admin dist was rebuilt in 678eac4 and 34-06 changed no `admin/src` file (only `admin/tests`), so no rebuild is needed before the tag; `scripts/check-admin-dist.sh` passes.
### Plugin repositories: current tag -> new tag
Each repository's new commit is the 34-02 manifest commit (`feat: plugin.yaml manifest for the SummerCMS marketplace`); every `plugin.yaml` says `framework: v0.6.0` and every `go.mod` requires `git.golem15.com/golem15/summercms v0.6.0` (with the development `replace => ../summercms.go`, which consumers ignore). Patch bumps throughout: the change is a manifest file, a test and the framework minimum.
| # | Repository | Branch | Commit to tag | Commits since the last tag | Current tag | New tag | Push blocker |
|---|------------|--------|---------------|----------------------------|-------------|---------|--------------|
| 1 | sm-translate-plugin | main | 7e64224 | 1 | v0.1.2 | **v0.1.3** | - |
| 2 | sm-user-plugin | master | 97f83cc | 1 | v0.1.18 | **v0.1.19** | - |
| 3 | sm-chat-plugin | main | rebased b952128 (new SHA) | 1 (+12 on origin) | v0.1.3 | **v0.1.4** | 1 ahead, 12 behind: rebase first |
| 4 | sm-faq-plugin | main | 3bf54cd | 1 | v0.1.1 | **v0.1.2** | - |
| 5 | sm-menu-plugin | main | 98df4c7 | 1 | v0.1.1 | **v0.1.2** | - |
| 6 | sm-seo-plugin | main | 55f5e5d | 22 (21 review fixes + manifest) | v0.1.0 | **v0.1.1** | - |
| 7 | sm-sitemap-plugin | main | 049f3ee | 1 | v0.1.1 | **v0.1.2** | - |
| 8 | sm-mfa-plugin | master | 544017c | 1 | v0.1.2 | **v0.1.3** | - |
| 9 | sm-oauthserver-plugin | master | d600e2c | 1 | v0.1.5 | **v0.1.6** | - (an uncommitted go.work edit of another session stays unstaged) |
| 10 | sm-sociallogin-plugin | master | 47b3bb2 | 1 | v0.1.5 | **v0.1.6** | - |
| 11 | sm-paymentgateway-plugin | main | 300bc09 | 1 | v0.1.1 | **v0.1.2** | - |
| 12 | sm-paymentgatewaysubscriptions-plugin | main | c81e385 | 1 | v0.1.2 | **v0.1.3** | - |
| 13 | sm-pgstripe-plugin (root and `subscriptions/`) | main | d61508f | 1 | v0.1.3 | **v0.1.4** | - |
| 14 | sm-journal-plugin | main | 5b38a3b | 4 (3 API fixes + manifest) | v0.2.5 | **v0.2.6** | - |
| 15 | sm-chatvideo-plugin | main | 33ff4f5 | 8 | none | **v0.1.0** | - |
| 16 | sm-forum-plugin | main | 36bd875 | 7 | none | **v0.1.0** | - |
| 17 | sm-herald-plugin | main | db8a1bb | 7 | none | **v0.1.0** | - |
| 18 | sm-userfriends-plugin | main | 2f29b26 | 6 | none | **v0.1.0** | - |
| 19 | sm-chatchannels-plugin | main | rebased 322629b (new SHA) | 10 | none | **v0.1.0** | 1 ahead, 1 behind (origin a30f04a touches go.mod): rebase first |
| 20 | sm-chatbots-plugin | main | rebased 0cd78f2 (new SHA) | 7 | none | **v0.1.0** | 1 ahead, 1 behind (origin d0b9fb1 drops sibling replaces): rebase first; builds only once v0.6.0 is on the remote |
| 21 | sm-golem-plugin | master | 89fd90a | 1 | v0.1.1 | **v0.1.2** | - |
| 22 | sm-feedback-plugin | master | dd78bd2 | 1 | v0.1.1 | **v0.1.2** | - |
| 23 | sm-quizzes-plugin | master | 67a83db | 1 | v0.1.0 | **v0.1.1** | - |
| 24 | sm-presentations-plugin | master | 3eb4de7 | 13 (10 unreleased feature/test commits, the sztab theme d205cd7 from sm-bm-app's mount, README, manifest) | v0.1.1 | **v0.1.2** | - |
Rows 21-24 are the SC-1 gap closure (34-02-SUMMARY, "Gap closure: SC-1 remaining repos"); fresh clones, 0 behind origin/master (golem, feedback and quizzes 1 ahead; presentations 3 ahead: the sztab theme d205cd7 from sm-bm-app's mount, `docs: README` cfa0c40, then the manifest commit 3eb4de7). Their go.mod replaces point at an application mount (`../../../../summercms.go`, `../user`); next to the framework they build through an untracked, git-excluded `go.work` (framework `../summercms.go`, user `../sm-demo-app/plugins/golem15/user`), so the `GOWORK=off go build` in step 3 does not apply to them: use `go build ./...`. Their manifests need framework commit 87921c2 (in v0.6.0). sm-presentations-plugin had no README.md, so a README was added first (cfa0c40 `docs: README`, H1 "Presentations"); its manifest needs no name override. Its v0.1.2 also carries the 10 commits since v0.1.1 (deck image, revision and deck tools over MCP, signed one-time image uploads), which sm-bm-app already runs.
Requirements inside the set (from the manifests): journal and faq need translate; chat, mfa, oauthserver, sociallogin, paymentgateway, forum and userfriends need user; chatvideo needs chat; chatchannels and chatbots need chat and user; paymentgatewaysubscriptions needs paymentgateway and user; pgstripe needs paymentgateway, and its `subscriptions/` plugin needs paymentgatewaysubscriptions; feedback, quizzes and presentations need user; golem needs none.
### summercms.io repositories
| Repository | Branch | Commits | Tag | Push |
|------------|--------|---------|-----|------|
| sm-summercmsio-plugin (`sm-summercmsio-app/plugins/golem15/summercms`) | master | 34-03: 242d641, f6a5949, 08e04de, 5853cf5; 34-06: c52e721 `test: registry ingest, queries and API` (5 ahead of origin) | none -> **v0.1.0** on c52e721 | yes |
| vue-summercmsio-app | master | 34-03: 05f1cea `feat: marketplace pages`; 34-06: 8267c55 `test: marketplace utilities` (2 ahead) | none (consumed as a submodule) | yes |
| sm-summercmsio-app | master | 34-03: 458a4f1, 06593c3, 0707fdc, fd8fe3b, 97c0c08; 34-06: 352314a `test: changelog-post manifest and ingest helpers` (6 ahead) | none | yes, after its gitlink commits |
## Release order
Run every step only after the previous one is pushed and verified. No `--force` anywhere; never move a tag.
### 1. Gate
```sh
cd summercms.go
bash scripts/check-phase34.sh --all # Docker host (sudo -u golem when the socket is denied)
```
Expected: `Phase 34 gate passed`. The `--plugins` stage skips sm-user-plugin's pre-existing `TestRegisterCORSPath` (it needs an application around it) and prints that skip.
### 2. Framework v0.6.0
```sh
cd summercms.go
git fetch origin && git status # master fast-forwards over origin/master
go vet ./... && go test -short ./...
git tag -a v0.6.0 -F <tag message below>
git push origin master
git push origin v0.6.0
git ls-remote --tags origin v0.6.0
```
Then the changelog post (the only post of this release), from `../sm-summercmsio-app`:
```sh
scripts/changelog-post.py source v0.6.0 # material for the notes
scripts/changelog-post.py publish v0.6.0 notes.md --excerpt "Plugin marketplace: plugin.yaml manifests, summer plugin:install and plugin:update, and a Plugins screen in the admin."
```
The notes reuse the tag message below (`## Highlights` / `## Added` / `## Changed`, no H1, no planning IDs), including the "Plugins released alongside" section.
### 3. Plugins, in dependency order
For each repository in the table order (translate, user, chat, faq, menu, seo, sitemap, mfa, oauthserver, sociallogin, paymentgateway, paymentgatewaysubscriptions, pgstripe, journal, chatvideo, forum, herald, userfriends, then chatchannels and chatbots, then golem, feedback, quizzes and presentations):
```sh
cd ../sm-<name>-plugin
git fetch origin && git status # ahead only, except chat/chatchannels/chatbots
GOWORK=off go build ./... && go vet ./... && go test -short ./... # TestPluginManifest included
summer plugin:manifest --check . # and `--check subscriptions` in sm-pgstripe-plugin
git tag -a <new tag> -m "<new tag>: plugin.yaml for the SummerCMS marketplace; requires SummerCMS v0.6.0"
git push origin <branch>
git push origin <new tag>
```
No `changelog-post.py publish --repo` for the plugins (no plugin posts this release). That script normally runs the manifest check and asks the registry to ingest; here the manifest check is the explicit command above, and the ingest happens in step 6.
The three rebases (34-02 push blockers), each before its tag:
- **sm-chat-plugin:** `git rebase origin/main`; resolve go.mod/go.sum (keep origin's 12 commits, require summercms v0.6.0); `summer plugin:manifest .` to regenerate plugin.yaml against the rebased sources and amend it into the manifest commit; build, vet, test; tag `v0.1.4` on the rebased commit.
- **sm-chatchannels-plugin** (after chat is tagged): `git rebase origin/main` over a30f04a (optional HTTP API switch, touches go.mod); require sm-chat-plugin `v0.1.4` if the rebased code needs it, else keep v0.1.3; regenerate plugin.yaml; build, vet, test; tag `v0.1.0`.
- **sm-chatbots-plugin** (after chat is tagged): `git rebase origin/main` over d0b9fb1 (drops sibling replaces); with no `../summercms.go` replace the build and `TestPluginManifest` resolve framework v0.6.0 from the remote, so step 2 must be done; regenerate plugin.yaml; build, vet, test; tag `v0.1.0`.
Their new SHAs replace b952128, 322629b and 0cd78f2 in the pointer bumps below.
### 4. summercms.io site plugin and pages
```sh
cd ../sm-summercmsio-app/plugins/golem15/summercms
go vet ./... && go test ./... # Docker: TestRegistrySmoke, TestRegistryAPIShapes, TestRegistryIngestEndpoint
git tag -a v0.1.0 -m "v0.1.0: plugin registry and marketplace API"
git push origin master && git push origin v0.1.0
cd ../../../vue-summercmsio-app
pnpm test && pnpm build:changelog && pnpm test:changelog && pnpm test:marketplace
git push origin master
```
### 5. Applications
Per application, in separate commits (research F10: the regenerated `main.go` and `plugins.gen.go` never ride in a pointer-bump commit):
1. `go get git.golem15.com/golem15/summercms@v0.6.0` (where go.mod pins a framework version; apps that `replace` it with `../summercms.go` still get the require raised) -> commit `chore: require SummerCMS v0.6.0`.
2. Plugin pointer bumps to the tagged commits below, `git -C plugins/golem15/<name> checkout <tag>` then stage only the gitlinks -> commit `chore: bump plugin pointers for plugin.yaml`.
3. `summer build` (regenerates `main.go` and `plugins.gen.go` with `PluginInfo` and `FrameworkVersion v0.6.0`) -> commit `chore: regenerate main.go and plugins.gen.go for SummerCMS v0.6.0`.
4. Release build per the application's DEPLOY.md, then push.
Pending gitlinks (from 34-02 and 34-03; "tag" is the tagged commit):
| Application | Path | Current | Target |
|-------------|------|---------|--------|
| sm-demo-app | plugins/golem15/faq | b3cc978 | v0.1.2 (3bf54cd) |
| sm-demo-app | plugins/golem15/journal | f5a0394 | v0.2.6 (5b38a3b) |
| sm-demo-app | plugins/golem15/menu | 8656474 | v0.1.2 (98df4c7) |
| sm-demo-app | plugins/golem15/mfa | 463c750 | v0.1.3 (544017c) |
| sm-demo-app | plugins/golem15/oauthserver | 8bbec72 | v0.1.6 (d600e2c) |
| sm-demo-app | plugins/golem15/paymentgateway | e0badb5 | v0.1.2 (300bc09) |
| sm-demo-app | plugins/golem15/paymentgatewaysubscriptions | 1ec96df | v0.1.3 (c81e385) |
| sm-demo-app | plugins/golem15/pgstripe | 6d07d98 | v0.1.4 (d61508f) |
| sm-demo-app | plugins/golem15/seo | b19cd06 | v0.1.1 (55f5e5d) |
| sm-demo-app | plugins/golem15/sitemap | 96c790d | v0.1.2 (049f3ee) |
| sm-demo-app | plugins/golem15/sociallogin | ecfb8a7 | v0.1.6 (47b3bb2) |
| sm-demo-app | plugins/golem15/translate | 54cf93b | v0.1.3 (7e64224) |
| sm-demo-app | plugins/golem15/user | 07196a4 | v0.1.19 (97f83cc) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/faq | b3cc978 | v0.1.2 (3bf54cd) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/journal | ffa2c8f | v0.2.6 (5b38a3b) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/menu | 8656474 | v0.1.2 (98df4c7) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/sitemap | 96c790d | v0.1.2 (049f3ee) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/translate | 54cf93b | v0.1.3 (7e64224) |
| sm-grzybyfunkcjonalne-app | plugins/golem15/user | bfcfea4 | v0.1.19 (97f83cc) |
| sm-bm-app | plugins/golem15/chat | 51c9e17 (= origin/main) | v0.1.4 (rebased chat) |
| sm-bm-app | plugins/golem15/chatbots | d0b9fb1 (= origin/main) | v0.1.0 (rebased chatbots) |
| sm-bm-app | plugins/golem15/chatchannels | a30f04a (= origin/main) | v0.1.0 (rebased chatchannels) |
| sm-bm-app | plugins/golem15/mfa | 463c750 | v0.1.3 (544017c) |
| sm-bm-app | plugins/golem15/oauthserver | df2eddd | v0.1.6 (d600e2c) |
| sm-bm-app | plugins/golem15/sociallogin | ecfb8a7 | v0.1.6 (47b3bb2) |
| sm-bm-app | plugins/golem15/user | 66fc107 | v0.1.19 (97f83cc) |
| sm-summercmsio-app | plugins/golem15/journal | ffa2c8f | v0.2.6 (5b38a3b) |
| sm-summercmsio-app | plugins/golem15/translate | 1134dd1 | v0.1.3 (7e64224) |
| sm-summercmsio-app | plugins/golem15/user | 50da92c | v0.1.19 (97f83cc) |
| sm-summercmsio-app | plugins/golem15/summercms | ca59415 | v0.1.0 (c52e721) |
| sm-summercmsio-app | vue-summercmsio-app | b3bfc5d | 8267c55 (pushed master) |
| fonoteka.go | plugins/golem15/user | a1b78b8 | v0.1.19 (97f83cc) |
| sm-demo-app | plugins/golem15/golem | 37748ae | v0.1.2 (89fd90a) |
| sm-demo-app | plugins/golem15/feedback | ce4b43e | v0.1.2 (dd78bd2) |
| sm-demo-app | plugins/golem15/quizzes | 362dc02 | v0.1.1 (67a83db) |
| sm-bm-app | plugins/golem15/quizzes | 362dc02 | v0.1.1 (67a83db) |
| fonoteka.go | plugins/golem15/golem | 37748ae | v0.1.2 (89fd90a) |
| fonoteka.go | plugins/golem15/feedback | ce4b43e | v0.1.2 (dd78bd2) |
| sm-demo-app | plugins/golem15/presentations | 5bcbaaf | v0.1.2 (3eb4de7) |
| sm-bm-app | plugins/golem15/presentations | d205cd7 (committed in 9929195) | v0.1.2 (3eb4de7) |
40 plugin gitlinks plus the vue app link (the last eight rows come from the SC-1 gap closure). Every non-chat bump is a fast-forward (checked in 34-02; the gap-closure targets are fast-forwards of the commit each app points at today: golem, feedback and quizzes one commit on top, presentations 13 commits after sm-demo-app's v0.1.1 and 2 after sm-bm-app's d205cd7). No application mounts chatvideo, forum, herald or userfriends: those need only their tag. sm-grzybyfunkcjonalne-app (1) and fonoteka.go (39) already carry unpushed commits of their own; sm-summercmsio-app's working tree already shows its two gitlinks modified (left uncommitted by 34-03 and 34-06 on purpose).
For sm-summercmsio-app the framework bump is already committed (97c0c08 `chore: require summercms v0.6.0`); `scripts/build.sh dev` regenerates `main.go` and `plugins.gen.go`, which 34-03 restored to the committed versions: commit the regeneration in step 3.
## summercms.io deploy
From `../sm-summercmsio-app/DEPLOY.md`, "Plugin marketplace (the release that brings it)", after step 5 for sm-summercmsio-app:
1. `scripts/check-deploy.sh` (nginx and supervisor configs).
2. git on rome: `ssh rome 'command -v git && git --version'`; install git if empty (the ingester clones over https).
3. Release build and deploy per DEPLOY.md "Release": `migrate` creates the registry tables and the River queue tables; `config/queue.yaml` sets `work_in_serve: true`, so `serve` runs the hourly `summercms:registry-ingest` and the ingest-now jobs (`sudo supervisorctl tail summercms-io` shows the worker).
4. Reinstall the nginx site file (`/marketplace` to Node, POST only on `= /api/registry/v1/ingest`, `client_max_body_size 8k` there) and the changelog supervisor program (`NUXT_REGISTRY_API_BASE`), as under "Cutover", step 3; `nginx -t` and reload.
5. Mint the registry token on rome (Jakub only; never by an agent): `sudo -u summercms ./bin/summercms-io admin:token:create <you> --name registry --scope registry --expires 365d`, stored in a password manager and `~/.config/summercms/registry-token` (mode 600). With no plugin posts this release it is not needed yet; it serves later `changelog-post.py` plugin posts.
6. Curate the fourteen launch repositories once their new tags are pushed:
```
https://git.golem15.com/golem15/sm-chat-plugin.git
https://git.golem15.com/golem15/sm-faq-plugin.git
https://git.golem15.com/golem15/sm-journal-plugin.git
https://git.golem15.com/golem15/sm-menu-plugin.git
https://git.golem15.com/golem15/sm-mfa-plugin.git
https://git.golem15.com/golem15/sm-oauthserver-plugin.git
https://git.golem15.com/golem15/sm-paymentgateway-plugin.git
https://git.golem15.com/golem15/sm-paymentgatewaysubscriptions-plugin.git
https://git.golem15.com/golem15/sm-pgstripe-plugin.git
https://git.golem15.com/golem15/sm-seo-plugin.git
https://git.golem15.com/golem15/sm-sitemap-plugin.git
https://git.golem15.com/golem15/sm-sociallogin-plugin.git
https://git.golem15.com/golem15/sm-translate-plugin.git
https://git.golem15.com/golem15/sm-user-plugin.git
```
`sudo -u summercms ./bin/summercms-io summercms:registry-add <the fourteen URLs>` then `summercms:registry-ingest` (first ingest, one line per repository). Only tags carrying a `plugin.yaml` are listed, so each repository publishes from its new tag; older tags are noted and skipped. The six repositories tagged for the first time here (chatchannels, chatvideo, forum, herald, userfriends, chatbots) can be added the same way when Jakub wants them listed, and so can the four of the SC-1 gap closure (`https://git.golem15.com/golem15/sm-golem-plugin.git`, `sm-feedback-plugin.git`, `sm-quizzes-plugin.git`, `sm-presentations-plugin.git`), which already had releases.
7. Curl the API:
```sh
curl -s https://summercms.io/api/registry/v1/plugins | head -c 300
curl -sI -H 'Origin: https://example.com' https://summercms.io/api/registry/v1/plugins
curl -sI https://summercms.io/marketplace
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://summercms.io/api/registry/v1/ingest # 401
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://summercms.io/api/registry/v1/plugins # 403
```
8. Visual check of `/marketplace` (list, search, a category, a detail page) and of an application's Settings -> System -> Plugins screen against the live registry; then a real `summer plugin:install golem15.faq` on a scratch application (34-04's open manual item).
## Framework v0.6.0: tag message (draft)
The annotated tag message; the changelog notes reuse it without the first line.
```
SummerCMS v0.6.0: plugin marketplace
Plugins now describe themselves in a generated plugin.yaml, applications
install and update them with one summer command, and the admin shows what
an application was built with. summercms.io lists the plugins in its new
marketplace.
## Highlights
- plugin.yaml: every plugin carries a manifest generated from its own
sources (ID and required plugins from plugin.go, module and version
minimums from go.mod, name and description from the README). It is
committed next to plugin.go and never edited by hand.
- summer plugin:install <vendor.name> adds a plugin from the registry: the
newest release your framework version allows, with the plugins it
requires, after printing the plan and asking (or --yes). --source and git
URLs install it as a git submodule instead.
- summer plugin:update moves one or all installed plugins to their newest
compatible release.
- The admin has a Plugins screen (Settings -> System -> Plugins): installed
plugins with versions and sources, update badges and a marketplace search,
each with the summer command to copy.
## Added
- New module kiosk: the plugin.yaml format (Manifest, Marshal, Parse,
Validate), Derive/Generate/Write/Check, CheckT for a one-line go test
guard in plugin repositories, the registry API v1 wire types, version
rules (ValidVersion, CompareVersions, BaseVersion, Satisfies,
NewestCompatible) and the registry client (kiosk.Client, NewClient,
RegistryURL).
- summer plugin:manifest [dir] with --check, --pretend, --name and
--description. Plugin IDs and requirements may be literals or constants
of the same package, another package or another module; nothing is run.
- summer plugin:install and summer plugin:update, with --yes and
--offline; plugin:install also takes vendor.name@vX.Y.Z and --source.
- summer build bakes PluginInfo (name, description, module, package,
version and source of each plugin) and FrameworkVersion into
plugins.gen.go; the generated main publishes them with party.Describe,
and party.Installed exposes them to plugins.
- Config key plugins.registry_url (default https://summercms.io;
SUMMER_PLUGINS__REGISTRY_URL overrides it; an empty value disables every
registry call).
- Permission backend.view_plugins (cabana.PermissionViewPlugins) for the
Plugins screen; superusers always have it. Admin API GET /plugins and
GET /plugins/marketplace; settings entries may open an admin route
(SettingsEntry.Path).
## Changed
- summer plugin:add reads constant plugin IDs, and plugin:add and
plugin:install append to summer.yaml in place: comments, blank lines and
the item layout stay as they were.
- Every application's main.go and plugins.gen.go change on the first
summer build with v0.6.0; commit the regeneration with the upgrade.
## Plugins released alongside
Every public plugin now ships a plugin.yaml and requires SummerCMS v0.6.0:
- sm-translate-plugin v0.1.3
- sm-user-plugin v0.1.19
- sm-chat-plugin v0.1.4
- sm-faq-plugin v0.1.2
- sm-menu-plugin v0.1.2
- sm-seo-plugin v0.1.1
- sm-sitemap-plugin v0.1.2
- sm-mfa-plugin v0.1.3
- sm-oauthserver-plugin v0.1.6
- sm-sociallogin-plugin v0.1.6
- sm-paymentgateway-plugin v0.1.2
- sm-paymentgatewaysubscriptions-plugin v0.1.3
- sm-pgstripe-plugin v0.1.4
- sm-journal-plugin v0.2.6
- sm-chatvideo-plugin v0.1.0 (first release)
- sm-forum-plugin v0.1.0 (first release)
- sm-herald-plugin v0.1.0 (first release)
- sm-userfriends-plugin v0.1.0 (first release)
- sm-chatchannels-plugin v0.1.0 (first release)
- sm-chatbots-plugin v0.1.0 (first release)
- sm-golem-plugin v0.1.2
- sm-feedback-plugin v0.1.2
- sm-quizzes-plugin v0.1.1
- sm-presentations-plugin v0.1.2
```
If a rebase or a check changes a plugin's version before tagging, update this list and the table above together.
## Rules
- **Never move a tag.** The Go module proxy and the checksum database cache a tagged version forever (research Pitfall 7); a wrong tag is fixed with the next patch, never by deleting and re-pushing.
- Tags only on the default branch (master or main of each repository); each tag must contain the earlier tags of that repository.
- The framework tag and its changelog post happen the same day. The plugin tags of this release get no posts (Jakub's decision); later plugin releases follow the normal rule (a `/changelog/plugins` post through `changelog-post.py publish --repo`).
- Push before bump: an application pointer moves only to a commit that is pushed and tagged.
- No `--force`, no `--no-verify`; tokens are minted and handled only by Jakub and never written into this file.
## Executed steps
| Step | Date | What was done | Result (SHA, tag object, URL) |
|------|------|---------------|-------------------------------|
| 1 | 2026-10-30 | `scripts/check-phase34.sh --all` | `Phase 34 gate passed` |
| 2 | 2026-10-30 | Framework master pushed, `v0.6.0` tagged (message above) and pushed; changelog post | master 76288cd, tag object c8241c8; https://summercms.io/changelog/summercms-0-6-0 (post 57) |
| 3 | 2026-10-30 | 21 plugin tags on the commits of the table (no rebase needed), pushed with their branches; no plugin posts | tags as in the table, each on its listed commit |
| 3 | 2026-10-30 | sm-chat-plugin: manifest commit rebuilt on origin/main 51c9e17 (go.mod requires v0.6.0, plugin.yaml regenerated), `v0.1.4` | db3b518 (old commit kept as branch `backup/manifest-pre-rebase`) |
| 3 | 2026-10-30 | sm-chatchannels-plugin and sm-chatbots-plugin: same on origin/main, sm-chat-plugin v0.1.3 kept, `v0.1.0` each | chatchannels 017843a, chatbots 24eadf6 (backups as above) |
| 4 | 2026-10-30 | sm-summercmsio-plugin `v0.1.0` on 0b3fbf4 (includes the review fixes after c52e721); vue-summercmsio-app master pushed | tag on 0b3fbf4; vue 8267c55 |
| 5 | 2026-10-30 | sm-summercmsio-app: pointer bumps (journal v0.2.6, translate v0.1.3, user v0.1.19, site plugin v0.1.0, vue 8267c55) 668a773, regeneration c3f2027; release build (framework v0.6.0), `smoke: ok`, pushed | master c3f2027 |
| deploy | 2026-10-30 | summercms.io on rome: migrate (registry tables), swap, new changelog supervisor program and nginx vhost, restart; `registry-add` of the fourteen launch repositories and first ingest (15 plugins: pgstripe carries two) | API 200 with CORS/cache headers, `/marketplace` 200, POST ingest 401, POST plugins 403; landing shows 0.6 |
| 5 | 2026-10-30 | sm-demo-app: go.mod requires v0.6.0 and all 17 plugin tags 2133309, pointer bumps 5ec5941, regeneration 2ea5be3, roadmap snapshot 56c1141; release build, `smoke: ok`, `check-deploy: ok`, pushed | master 56c1141 |
| deploy | 2026-10-30 | demo.summercms.io on rome: migrate (21, first release with seo, mfa, sociallogin, oauthserver mounted), seed, swap, restart, new vhost (MCP and robots.txt locations); SEO robots.txt rules written from the Nuxt `goPaths` list plus `/_seo` | `check-live: ok`, MCP metadata 200 and POST /mcp 401, robots.txt served by golem15.seo |
Not done in this run (outside the requested scope): the pointer bumps of sm-grzybyfunkcjonalne-app, sm-bm-app (including the three rebased chat plugins: chat db3b518, chatchannels 017843a, chatbots 24eadf6) and fonoteka.go, which carry unpushed work of their own and deploy separately; adding the ten other tagged repositories (chatvideo, forum, herald, userfriends, chatchannels, chatbots, golem, feedback, quizzes, presentations) to the registry; the registry token.
**Note (2026-10-30, presentations):** sm-bm-app's mount had an unpushed commit `d205cd7 feat: offer the sztab presentation theme` (gitlink committed in sm-bm-app 9929195). The README and manifest commits were rebased onto it in `../sm-presentations-plugin` (new SHAs cfa0c40, 3eb4de7), so v0.1.2 includes the theme and both app bumps are fast-forwards. Push `../sm-presentations-plugin` master (it carries d205cd7); the mount in sm-bm-app then fast-forwards to 3eb4de7.

View File

@@ -0,0 +1,18 @@
# API Coverage — SummerCMS plugin registry API v1
> Full coverage by default. Opt-outs are explicit, reasoned decisions. Phase 34 builds the registry API itself (server in 34-03, contract types in 34-01) and consumes it from the CLI (34-04), cabana (34-05), the /marketplace pages (34-03) and the release script (34-03). It also reaches two outside services through their own tools: the Go module proxy through the go command and git hosting through git.
| capability | decision | reason |
|---|---|---|
| GET /api/registry/v1/plugins with q and category (list and search) | INTEGRATE | |
| GET /api/registry/v1/plugins/{id} (detail: README, screenshots, requires) | INTEGRATE | |
| GET /api/registry/v1/plugins/{id}/versions (tags with their minimums) | INTEGRATE | |
| POST /api/registry/v1/ingest (authenticated ingest-now, token scope registry) | INTEGRATE | |
| error envelope (404 not_found, 400 invalid_query) decoded by clients | INTEGRATE | |
| Cache-Control and ETag with 304 on If-None-Match (server side) | INTEGRATE | |
| conditional requests (If-None-Match) sent by kiosk.Client and cabana | OPT-OUT | not needed yet: cabana keeps an in-process TTL cache and the CLI makes one-shot calls; adding revalidation later changes no contract |
| pagination of the plugin list (page, per_page) | OPT-OUT | not needed yet: the launch listing is fourteen plugins; adding pagination later is an additive change within v1 |
| Go module proxy (proxy.golang.org) through go get and go list -m | INTEGRATE | |
| git hosting: anonymous HTTPS (ingester), user's https or ssh (CLI) | INTEGRATE | |
| forge webhooks (push or tag events) | OPT-OUT | explicitly out of scope: D-13 chose a pull ingester plus ingest-now, no forge webhooks |
| forge HTTP APIs (raw files, tag listings) | OPT-OUT | explicitly out of scope: D-13 locks anonymous clones, which keeps ingestion independent of the forge |

View File

@@ -0,0 +1,187 @@
# Phase 35: Mail templates and layouts editor - Context
**Gathered:** 2026-11-06
**Status:** Ready for planning
<domain>
## Phase Boundary
Administrators edit the mail the application sends from the admin panel, as in WinterCMS's Mail templates screen:
- Every template registered through `pact.HasMailTemplates` (and postcard's built-in mail) is listed.
- Each template, layout and partial can get a database override, and the override can be reset to the file version.
- Admins can create custom layouts.
- A Branding page holds structured colours and a logo.
- A shared image library holds uploaded images.
- Drafts can be previewed and test-sent.
postcard renders the override when one exists and the plugin's file otherwise, so mail that already works keeps working with no change to apps or plugins.
Not in this phase: mail driver/SMTP settings screens, MailBlocker, newsletters/bulk mail, a WYSIWYG mail body.
</domain>
<decisions>
## Implementation Decisions
### Placement and permissions
- **D-01:** The screens live **inside cabana**, as an internal pseudo-plugin. This is the same pattern as Administrators/Roles in 19.6.1 (`modules/cabana/backend_screens.go`, `modules/cabana/backendscreens/`). Every app gets them with no setup. postcard stays free of admin and cabana code; cabana (or a thin glue layer) supplies postcard with the DB-backed layer through an interface postcard defines.
- **D-02:** **Navigation: a "Mail" section in Settings**, with entries for Mail templates, Mail layouts, Mail partials, Mail branding and Mail images. Links use `pact.HasSettings`, as in 19.6.1 D-02. There is no top-level nav item.
- **D-03:** **Two permission codes**, registered by the cabana pseudo-plugin:
- `system.manage_mail_templates` covers the templates list/form, template preview and test send.
- `system.manage_mail_layouts` covers layouts, partials, Branding and the image library, because these change every mail.
Neither code is granted to any role by default (as in 19.6.1 D-04). Only superusers reach the screens until someone grants a code. The image library and its insert picker must also be usable from the template form by holders of `system.manage_mail_templates`, either read/pick only or with upload too (planner's call, stated in the plan). — **Reversibility:** costly — the codes end up stored in `backend_user_roles.permissions` / `backend_users.permissions` JSON on every install that grants them.
### Editing model: templates
- **D-04:** **A template override stores subject + Markdown body + layout.**
- The body stays Markdown with Go `html/template` variables (`{{ .name }}`), the same format as the file.
- The plain-text part is still derived from the body; there is no hand-written text part.
- The layout is a dropdown over all layouts (file and custom).
- Description stays file-owned and read-only.
- **D-05:** **Locale variants stay separate templates.** `activate.htm` and `activate-en.htm` are their own rows. The list has a locale column, parsed from the suffix convention postcard already uses, plus a locale filter. There is no grouping and no new locale model.
- **D-06:** **Reset to the file version** deletes the override row, on templates, file layouts and file partials alike.
- **D-07:** **Drift notice.** When an override is saved, it stores a hash of the file content it was based on. If the plugin file later changes (for example after a plugin upgrade), the override keeps winning, but the list and the form flag "file changed since override". The form offers a way to view the current file version (a diff if cheap) and the reset button. — **Reversibility:** costly — the hash column is part of the override table schema (migration).
### Editing model: layouts, Branding, partials
- **D-08:** **Layouts use the same override model as templates.**
- Every file layout is listed: postcard's built-in default plus plugin layouts such as sm-user-plugin `layouts/user.htm` and paymentgateway `layouts/paymentgateway.htm`.
- Each file layout can get a DB override with reset.
- Admins can also **create custom layouts** that exist only in the DB. Custom layouts can be deleted (not reset); deleting one still assigned to template overrides is refused, with a count of those templates.
- "Seeded predefined layouts" means a couple of framework-shipped file layouts, for example the existing default plus one or two more such as system/minimal (the planner picks the set). They are not rows copied into the DB at boot.
- **D-09:** **Layouts are edited in a new `codeeditor` form field type**, Winter-style, with syntax highlighting for HTML/CSS/text. It is added to cabana's field registry and to the admin SPA. The layout form has tabs for the HTML wrapper, the text wrapper and the CSS/header. The field type is reusable by later phases. — **Reversibility:** costly — a published field type name in `fields.yaml` that plugins may start using.
- **D-10:** **Branding page**, as in Winter's mail brand settings.
- It is a settings page (cabana settings model) with Winter's brand colour set: body/content background, text, link, the button primary/positive/negative colours, and header/footer colours.
- It also has a **logo** upload, exposed to layouts as `{{ .logoUrl }}`.
- The colours compile into the brand CSS slot that postcard already inlines.
- **D-11:** **Precedence: Branding replaces config brandCss.** While no Branding record has been saved, `mail.brandCss` from config is used, so existing apps are unchanged. Once Branding is saved, its compiled CSS replaces `mail.brandCss`. `mail.css` is unaffected and still applied.
- **D-12:** **Mail partials are in scope, with file + DB override like templates.**
- Files live at `views/mail/partials/<name>.htm` and are named `<plugin>::mail.partials.<name>`.
- Plugins declare them through a **new additive optional pact capability**. `pact.HasMailTemplates` is not changed: core plugins must not break.
- Partials are used from template bodies and layouts through a Go template call (the planner picks the exact syntax or helper).
- A few built-in partials ship with postcard (button, panel, table).
- Admins override and reset partials; editing them needs `system.manage_mail_layouts`.
— **Reversibility:** costly — a published pact capability and naming convention that plugins implement.
### Validation and send-time safety
- **D-13:** **Saves are validated.** Saving a template, layout or partial override parses it, test-renders it with the sample vars (D-15) and runs postcard's existing safety checks (script/iframe/object/embed, inline handlers, `javascript:`/`vbscript:`/`data:` URLs, CR/LF in the subject). Failures are field validation errors.
- **D-14:** **Fallback at send.** If an override still fails to render at send time (for example a variable missing at runtime), postcard logs the failure and sends the file version, so mail delivery doesn't stop. A template with no file (impossible for templates; custom layouts only) falls back to the default layout.
### Preview and test send
- **D-15:** **Sample variables**: plugins may add optional sample values to a template file. One option is a sample section in the INI header; another is an additive capability (planner's call). Variables without a sample render as a visible placeholder such as `[name]`. Existing template files work unchanged.
- **D-16:** **Live preview of the unsaved draft.** The template, layout and partial forms render the current draft through postcard with sample vars. The HTML part is shown in a **sandboxed iframe**, and a tab shows the plain-text part. Rendering happens on the server through postcard, so preview matches real sends.
- **D-17:** **Test send to my own address only.** A button sends the current draft (with sample vars) to the signed-in admin's email through the configured driver. It needs the same permission as editing that record and is rate-limited per admin. There is no free-text recipient field.
### Images
- **D-18:** **A shared mail image library.** A "Mail images" list stores images through `lagoon/attach` on the public disk. Any template, layout or partial can use them, and the Branding logo also uses this storage.
- **D-19:** **Delivery via absolute public URLs.** `<img src>` uses the attachment's absolute public URL, built from `storage.uploads.public_url` / `app.url`. No CID inline parts; postcard's `RenderedMessage` and drivers are unchanged.
- **D-20:** **An insert button in the editors.** A picker next to the markdown editor (template bodies) and the codeeditor (layouts/partials) inserts `![alt](url)` or `<img src="url" alt="">` for a chosen library image.
### Quality gates
- **D-21:** Unit tests are the last plan (project rule). They cover:
- override precedence and reset;
- drift detection;
- fallback at send;
- save validation;
- Branding precedence over config;
- the partial capability (boot errors, namespace rule);
- the permission split;
- the test-send recipient restriction and rate limit.
The postcard and cabana READMEs and the affected `docs/` pages are updated in the same commits as API/config/permission changes. The `admin/` changes regenerate `admin/openapi/admin.json` + `schema.d.ts` (`scripts/check-admin-openapi.sh`) and rebuild the committed `modules/boardwalk/dist` (`scripts/check-admin-dist.sh`).
### Claude's Discretion
- Table names and schema (one overrides table per kind, or a shared one), as long as it is Postgres/GORM with gormigrate migrations owned by the cabana pseudo-plugin, or by postcard if the planner justifies it.
- Exact partial call syntax and the built-in partial set beyond button/panel/table.
- Which extra predefined file layouts ship (D-08).
- Whether the image picker on the template form needs `manage_mail_layouts` for uploads (D-03 note).
- How postcard learns about overrides: a lookup interface checked per send, or a cache invalidated on save. It must be correct with several app instances, so per-send lookup or explicit invalidation, never a stale boot-time snapshot.
- How the SPA codeeditor is built (the library choice needs a STACK.md/decision note per the dependency rule).
- The plan split (lean planning: present the count before writing PLAN.md files).
</decisions>
<canonical_refs>
## Canonical References
**Downstream agents MUST read these before planning or implementing.**
### Mail layer
- `modules/postcard/README.md` covers the current template/layout format, catalog, drivers, safety checks and config keys (`mail.css`, `mail.brandCss`).
- `modules/postcard/templates.go` and `modules/postcard/mailer.go` hold `Catalog.Register`, `Mailer.Send`, `Activate` and `BootPlugin`, which are the integration point for the override layer.
- `modules/postcard/assets/default.htm` is the built-in default layout (header `==` text `==` HTML).
- `modules/pact/capabilities.go` §`HasMailTemplates` (around line 1271) must stay unchanged; partials and samples go in new additive capabilities.
### Admin patterns
- `.planning/phases/19.6.1-backend-administrators-screen/19.6.1-CONTEXT.md` covers the cabana internal pseudo-plugin, permission codes registered by cabana, Settings placement via `pact.HasSettings`, and no default role grant.
- `modules/cabana/backend_screens.go` and `modules/cabana/backendscreens/` hold the internal pseudo-plugin and the YAML controllers to mirror.
- `modules/cabana/settings.go` holds the settings model pattern for the Branding page.
- `modules/cabana/field_markdown.go`, `modules/cabana/field_file.go` and `modules/cabana/field_type.go` are where the new `codeeditor` field and the image picker hook in.
- `admin/src/components/form/fields/` holds the SPA field widgets (MarkdownField, FileuploadField); the new CodeEditorField goes here.
- `.planning/notes/2026-10-07-embedded-admin-release-gate.md` is the dist rebuild gate for `admin/` changes.
### Storage and URLs
- `modules/lagoon/attach/bucket.go` provides `PublicURLBase` (`storage.uploads.public_url`) for absolute image URLs.
- `.planning/research/STACK.md` holds the decided dependency set; a code-editor JS library must be added here or in a decision note.
### Reference implementation (WinterCMS)
- `../examples/golem15-wintercms-starter` covers Winter's System → Mail templates/layouts/partials/brand settings (`modules/system/models/MailTemplate.php`, `MailLayout.php`, `MailPartial.php`, `MailBrandSetting.php`) for field sets and behaviour parity.
### Existing mail consumers (must keep working unchanged)
- `../sm-user-plugin/views/mail/` (including `layouts/user.htm` and the locale variants) and `../sm-paymentgateway-plugin/views/mail/` (including `layouts/paymentgateway.htm`).
</canonical_refs>
<code_context>
## Existing Code Insights
### Reusable Assets
- `postcard.Catalog` already parses the INI header + `==` file format and resolves layout aliases. Overrides should reuse the same parser so DB content and files share one format.
- postcard's safety checker (rendered-HTML rejection, header CR/LF) is reused for save validation (D-13) and preview.
- The cabana internal pseudo-plugin (19.6.1) has permission registration, Settings links and YAML controllers.
- The cabana settings model plus `settings_secret.go` patterns cover the Branding page.
- `lagoon/attach` handles uploads, public disk storage and `PublicURLBase`.
- The SPA's `PreviewView.vue` and `FormView.vue` are where the preview pane and test-send action go.
### Established Patterns
- Plugins can only register names in their own namespace (`<plugin>::mail.*`). Partials follow the same rule.
- Boot errors for missing files, duplicates and unknown aliases. The new partial capability fails the same way.
- Postgres only, GORM + per-plugin gormigrate migrations; YAML via `goccy/go-yaml`.
- Standard library first; any new dependency (code editor in the SPA) needs a research/decision note.
- A docs checker enforces that README/docs identifiers exist.
### Integration Points
- postcard's render path (`Mailer.Send`) consults an override source before the file catalog, with fallback per D-14.
- `postcard.Activate` / brand CSS resolution consults the Branding record (D-11).
- The cabana field registry plus the SPA `FieldRenderer.vue` gain `codeeditor`.
- `pact` gets an additive capability for partials (and possibly sample vars).
</code_context>
<specifics>
## Specific Ideas
- The user explicitly wants **both** Winter's structured Branding page (colours, logo) **and** codeeditor-based layouts, "as WinterCMS kind of has it".
- Winter parity is the guide for field sets (brand colours, template/layout/partial forms) and for keeping `system.manage_mail_templates` as the code name.
</specifics>
<deferred>
## Deferred Ideas
- Hand-written plain-text template parts (Winter's `content_text`), not needed now.
- A WYSIWYG/rich-editor mail body.
- CID-embedded inline images (only absolute URLs in v1).
- Test send to an arbitrary address.
- Mail driver/SMTP configuration screen in the admin.
### Reviewed Todos (not folded)
- **Port MailBlocker and the block-mail checkbox** (`.planning/todos/pending/mailblocker-with-mailing.md`): kept separate. It is a send-path feature owned by sm-user-plugin (MailBlocker table, check before send, `block_mail` checkbox) and stays a todo for later mail work.
</deferred>
---
*Phase: 35-mail-templates-and-layouts-editor*
*Context gathered: 2026-11-06*

View File

@@ -0,0 +1,91 @@
# Phase 35: Mail templates and layouts editor - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-11-06
**Phase:** 35-mail-templates-and-layouts-editor
**Areas discussed:** Placement & permissions, Editing model, Preview & test send, Images
---
## Todo cross-reference
| Option | Description | Selected |
|--------|-------------|----------|
| Keep it separate | MailBlocker stays a todo for the later mail work | ✓ |
| Fold it in | Widens the scope to sm-user-plugin and the send path | |
## Placement & permissions
| Option | Description | Selected |
|--------|-------------|----------|
| Inside cabana | Internal pseudo-plugin, the 19.6.1 pattern | ✓ |
| A new sm-mail-plugin | Opt-in plugin repo | |
| Inside postcard | postcard would depend on cabana | |
| Option | Description | Selected |
|--------|-------------|----------|
| Settings → Mail section | Winter-like, through pact.HasSettings | ✓ |
| Settings → System section | Next to Administrators/Roles | |
| Top-level nav item | | |
| Option | Description | Selected |
|--------|-------------|----------|
| One code | system.manage_mail_templates | |
| Two codes | templates + layouts | ✓ |
| Option | Description | Selected |
|--------|-------------|----------|
| system.manage_mail_templates + system.manage_mail_layouts | Winter-compatible | ✓ |
| mail.manage_templates + mail.manage_layouts | New namespace | |
## Editing model
| Option | Description | Selected |
|--------|-------------|----------|
| Subject + Markdown body + layout | Same as the file format | ✓ |
| Also a hand-written plain-text part | | |
| HTML body (rich editor) | | |
**Layout editing:** the options were a codeeditor field, a plain textarea, or structured fields. **User's choice (free text):** "I wonder if we could have both 3 and 1. WinterCMS kind of has it - it has 'Branding' section with structured fields for colors etc and codeeditor-based layouts." This became a Branding page plus codeeditor layouts.
| Option | Description | Selected |
|--------|-------------|----------|
| Defer partials | | |
| Include partials, file + DB | | ✓ |
| Question | Options | Selected |
|----------|---------|----------|
| Branding contents | Winter colours + logo / colours only / + free CSS | Winter colours + logo |
| Branding vs config | Branding replaces brandCss once saved / config wins / concatenate | Branding replaces once saved |
| Partials shape | Same pattern as templates / built-in only | Same pattern as templates |
| Branding & partials perms | Under manage_mail_layouts / own branding code | Under manage_mail_layouts |
| Plugin file layouts | Same override model / imported to DB at boot | Same override model |
| Drift after file change | Override wins + notice / silently | Override wins + notice |
| Locale variants | Own rows + locale column / grouped tabs | Own rows + locale column |
| Validation | On save + fallback at send / save only, strict at send | On save + fallback at send |
## Preview & test send
| Question | Options | Selected |
|----------|---------|----------|
| Preview | Live draft in a sandboxed iframe + text tab / saved only | Live draft in a sandboxed iframe |
| Sample vars | Optional file samples + placeholders / placeholders only / admin JSON | Optional file samples + placeholders |
| Test send | Own address / any address / none | Own address |
## Images
| Question | Options | Selected |
|----------|---------|----------|
| Storage | Shared mail image library / per-record attachments | Shared library |
| Delivery | Absolute public URLs / inline CID / per-image toggle | Absolute URLs |
| Placing | Insert button in the editor / copy URL | Insert button |
## Claude's Discretion
- Schema layout, partial call syntax, extra predefined layouts, the image picker permission detail, the override lookup/caching mechanism (must be multi-instance safe), the SPA code-editor library (needs a decision note), the plan split.
## Deferred Ideas
- Plain-text template parts, a WYSIWYG body, CID images, test send to any address, a mail driver settings screen.

Some files were not shown because too many files have changed in this diff Show More