diff --git a/.planning/phases/38-extensible-journal-embed-providers/38-03-SUMMARY.md b/.planning/phases/38-extensible-journal-embed-providers/38-03-SUMMARY.md new file mode 100644 index 00000000..d5126459 --- /dev/null +++ b/.planning/phases/38-extensible-journal-embed-providers/38-03-SUMMARY.md @@ -0,0 +1,66 @@ +--- +phase: 38-extensible-journal-embed-providers +plan: 03 +subsystem: tests-docs-gate +tags: [journal, embeds, tests, race, vitest, hydration, docs, gate] +requires: ["38-01", "38-02"] +provides: + - "Go `-race` unit test suite in `sm-journal-plugin/classes/embed_registry_test.go`" + - "Blog Editor Vitest suite for dynamic embed providers, adaptive dialog, fallback round-trip, and preview in `sm-journal-plugin/tests/blogeditor/embed.test.ts`" + - "`vue-journal-layer` `node --test` suites for registry, prototype-pollution protection, pair-aware sanitizer, SSR expansion, and lazy `IntersectionObserver` hydration (`tests/embeds.test.ts`, `tests/embedHydration.test.ts`)" + - "Updated neutral README documentation in both `sm-journal-plugin` and `vue-journal-layer`" + - "Fail-closed cross-repo verification gate `scripts/check-phase38.sh` and `38-VALIDATION.md`" +affects: + - "../sm-journal-plugin" + - "../vue-journal-layer" + - "summercms.go" +key-files: + created: + - "../sm-journal-plugin/classes/embed_registry_test.go" + - "../vue-journal-layer/tests/embedHydration.test.ts" + - "scripts/check-phase38.sh" + - ".planning/phases/38-extensible-journal-embed-providers/38-VALIDATION.md" + modified: + - "../sm-journal-plugin/tests/blogeditor/embed.test.ts" + - "../sm-journal-plugin/README.md" + - "../vue-journal-layer/app/utils/embedRegistry.ts" + - "../vue-journal-layer/tests/embeds.test.ts" + - "../vue-journal-layer/README.md" +key-decisions: + - "Extended existing `../sm-journal-plugin/tests/blogeditor/embed.test.ts` (matching `vite.config.ts` `include: ['tests/**/*.test.ts']`) instead of creating a test file under `assets/src/`." + - "Kept `editor-corpus.json` byte-identical across `sm-journal-plugin` (`tests/blogeditor/fixtures/editor-corpus.json`) and `vue-journal-layer` (`tests/fixtures/editor-corpus.json`), verified by `cmp -s` in Stage 3 of `scripts/check-phase38.sh`." + - "Added `RESERVED_PROVIDER_KEYS` (`constructor`, `prototype`) rejection in `vue-journal-layer/app/utils/embedRegistry.ts` (`normalizeProvider`) so prototype-property keys cannot even be registered." +duration: 10m +completed: 2026-11-28 +--- + +# Phase 38 Plan 03: Unit Tests, Corpus Parity, READMEs & Phase Gate Summary + +Completed full Go (`-race`), Vitest, and `node --test` coverage across `sm-journal-plugin` and `vue-journal-layer`, updated both repositories' READMEs with neutral examples, added the fail-closed `scripts/check-phase38.sh` gate, and recorded the Nyquist validation matrix in `38-VALIDATION.md`. + +## Commits + +- **`sm-journal-plugin` `3fc656d`** — `test(embeds): add Go race tests, Blog Editor Vitest suite, and README docs` + - Created `classes/embed_registry_test.go` covering default `youtube`, Go registration, YAML `golem15.journal.embed_providers` boot merge, fail-loud invalid key/regex/mode errors, pair-aware `(data-embed, data-id)` enforcement, `data-aspect`/`data-height` CSS-injection rejection, UGC fallback ``/`
` preservation + XSS stripping, `blogRequestOptions.embedProviders`, and concurrent `-race` registry isolation. + - Extended `tests/blogeditor/embed.test.ts` covering `resolveEmbedProviders`, adaptive `#embedForm` (single URL input for `youtube`-only vs provider selector + ID + Media Library `MEDIA_PICK_EVENT`/`MEDIA_PICK_RESULT_EVENT` fallback picker + caption + aspect/height), TipTap `Embed` round-trip with fallback markup, and `previewBody` cards. + - Updated `README.md` with neutral `viz`/`acme` examples documenting YAML config, Go `EmbedRegistry` API, pair-aware sanitization, fallback preservation, and dynamic Blog Editor `embedProviders`. +- **`vue-journal-layer` `47de196`** — `test(embeds): add registry, pair-aware sanitizer, hydration tests, and README docs` + - Added `RESERVED_PROVIDER_KEYS` (`constructor`, `prototype`) rejection in `app/utils/embedRegistry.ts`. + - Extended `tests/embeds.test.ts` covering dual registration helpers, prototype-pollution rejection, pair-aware `sanitizeJournalHtml`/`isSafeJournalHtml`/`gateJournalHtml`, SSR fallback preservation + CLS inline styles, and `youtube` override. + - Created `tests/embedHydration.test.ts` testing `hydrateEmbedFigure` and `useJournalEmbedHydration` with lightweight DOM, `IntersectionObserver`, and `matchMedia` doubles (deferred hydration until intersection, measured-height CLS `minHeight` reservation, reactive `prefers-reduced-motion`, Vue async `component` with `appContext` inheritance + unmount cleanup, plain DOM `mount` + cleanup, and error resilience leaving SSR fallback DOM intact). + - Updated `README.md` § "Embeds" with neutral `viz`/`acme` examples documenting `app.config.ts` and Nuxt plugin registration, sanitizer parity, SSR fallback, CLS reservation, lazy hydration, `prefers-reduced-motion`, and CSP `script-src 'self'` compliance. +- **`summercms.go` `1e5777d0`** — `chore(phase38): add Phase 38 cross-repo verification gate script` + - Added executable `scripts/check-phase38.sh` running all 5 verification stages. +- **`summercms.go` (planning docs commit)** — `38-VALIDATION.md` and `38-03-SUMMARY.md` committed separately from code per `CLAUDE.md`. + +## Verification Results (`bash scripts/check-phase38.sh`) + +- **Stage 1 (`sm-journal-plugin` Go):** `go vet ./... && go test -race -short ./...` — PASS (all 6 test packages green under `-race`). +- **Stage 2 (`sm-journal-plugin` Blog Editor):** `npm run build && npm run test && bash scripts/check-dist.sh` — PASS (10 test files, 264/264 Vitest tests; `assets/dist/blogeditor.{js,css}` up to date). +- **Stage 3 (Corpus parity):** `cmp -s ../sm-journal-plugin/tests/blogeditor/fixtures/editor-corpus.json ../vue-journal-layer/tests/fixtures/editor-corpus.json` — PASS (byte-identical). +- **Stage 4 (`vue-journal-layer`):** `pnpm test` (211/211 `node --test` tests), `pnpm build:playground` (clean SSR build), `pnpm smoke:ssr` (89 + 2 + 2 + 2 + 2 = 97 checks) — PASS. +- **Stage 5 (`summercms.go` docs):** `go test ./cmd/summer -run TestDocsTree` — PASS. + +## Release Ordering Guardrail + +Per `AGENTS.md` / `CLAUDE.md` rule 5, zero git release tags, tag pushes, downstream consumer `go.mod`/submodule/`package.json` bumps, or changelog posts were executed. Phase 38 is ready for `/msd-code-review 38` and goal-backward verification (`38-VERIFICATION.md`). diff --git a/.planning/phases/38-extensible-journal-embed-providers/38-VALIDATION.md b/.planning/phases/38-extensible-journal-embed-providers/38-VALIDATION.md new file mode 100644 index 00000000..bbb95688 --- /dev/null +++ b/.planning/phases/38-extensible-journal-embed-providers/38-VALIDATION.md @@ -0,0 +1,37 @@ +--- +phase: 38-extensible-journal-embed-providers +validated: 2026-11-28 +gate_script: scripts/check-phase38.sh +status: passed +--- + +# Phase 38: Extensible Journal Embed Providers — Validation Matrix + +**Gate Command:** `bash scripts/check-phase38.sh` +**Status:** PASS (all 5 stages green, zero release tags or consumer bumps per `AGENTS.md` / `CLAUDE.md` rule 5) + +## Decision & Requirement Coverage (D-01 .. D-09) + +| Decision / Invariant | Verification Target | Automated Proof | Result | +|----------------------|---------------------|-----------------|--------| +| **D-01** Generic embed seam; `youtube` default; no app-specific viz or SVG uploads | `sm-journal-plugin` & `vue-journal-layer` | `TestEmbedRegistryDefaultAndRegistration`, `embeds.test.ts`, neutral READMEs | PASS | +| **D-02** Dual registration (`golem15.journal.embed_providers` YAML + Go `EmbedRegistry` on `backpack.App`), fail-loud boot validation | `../sm-journal-plugin/classes/embed_registry.go`, `plugin.go` | `TestEmbedRegistryDefaultAndRegistration` (YAML merge, invalid key/regex/mode errors naming provider) | PASS | +| **D-03** Pair-aware `(data-embed, data-id)` enforcement + thread-safe per-registry policy under `-race` | `../sm-journal-plugin/classes/format_html.go` | `TestEmbedRegistryPairAwareSanitizationAndFallbackXSS`, `TestEmbedRegistryConcurrentIsolationRace` (`go test -race -short ./...`) | PASS | +| **D-04** Allowed `
` attributes (`data-embed`, `data-id`, validated `data-aspect`/`data-height`; zero CSS injection) | `sm-journal-plugin` & `vue-journal-layer` | `TestEmbedRegistryPairAwareSanitizationAndFallbackXSS`, `embeds.test.ts` (CSS injection & orphan attr stripping) | PASS | +| **D-05** Static fallback ``/`
` preserved; XSS (`