Skip to content

Events: three formats only; sponsored is a flag, not a format - #487

Merged
alexeygrigorev merged 6 commits into
mainfrom
feat/three-event-formats
Nov 21, 2026
Merged

alexeygrigorev merged 6 commits into
mainfrom
feat/three-event-formats

Conversation

@alexeygrigorev

@alexeygrigorev alexeygrigorev commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What

DataOps runs events in exactly three formats — workshop, webinar, podcast — each served by one canonical Git-authored Template. This PR makes the platform reject deviations instead of storing them (Alexey, 2026-11-21: «У нас есть формат воркшопа, вебинара и подкаста. Ничего там отдельно для спонсоров не должно быть», «Надо будет сделать чтобы платформа в принципе не позволяла это делать»).

Enforcement (API, CLI and portal all go through the same paths)

  • Templates: a custom Template cannot claim an event format — neither exactly (workshop) nor as a variant slug (aishl-workshop, sponsored-webinar). Blocked at create, at edit, and in the cron path (no Card instantiation from such a Template; an automation-failure notification explains why).
  • Cards: event Cards are created only from the canonical format Template their Template type or [Workshop]-style title tag claims. Everything else is rejected with a 422 naming the canonical alternative. The card PUT route cannot swap templateId.
  • Documents: an event Card carries only its format's document templates (workshop; webinar; podcast, podcast-episode-brief, podcast-run-sheet, podcast-guest-research). Creating a document from another template, or switching one to it, is rejected with a visible error. Saves reject content keys outside the document template's schema; the switch path carries only fields the next template defines and still refuses to drop filled values.
  • Sponsored is a flag, not a format (UPDATE: «Ну мы можем и должны добавить и флаг sponsored но формат самого документа не меняется»): explicit sponsored boolean on event Cards, settable via API (POST/PUT /api/cards), CLI (dataops cards create/update --sponsored true|false) and a portal toggle on the Card. It changes no Template, document or validation. A sponsored and a non-sponsored card of the same format get identical doc templates and identical validation (covered by tests).

Newsletter untouched (UPDATE 2: «У нас ещё есть рассылка ее не трогаем»)

Newsletter cards, documents, templates and forms keep their existing behavior; the policy does not gate or flag them. Covered by tests.

Read-only audit (existing data is NOT migrated — Orin cleans up)

GET /api/cards/format-audit (admin) and dataops cards format-audit scan every Card, Template and sponsor document and report what deviates: variant Templates, Cards instantiated from them, documents whose template does not belong to their Card's format. Reports only; never repairs. Git-authored compound Templates (lightning-lesson-podcast) are distinct products, not deviations.

Docs

  • docs/three-event-formats.md (public repo) — the policy and the audit.
  • dataops-knowledge SOPs updated (workshop brief, AISHL workshop, podcast brief) to the canonical-template + sponsored-flag flow.

Tests

New backend/tests/api-event-formats.test.ts (29 tests): template claims, card creation gates, per-format document gates, deviating content saves, sponsored flag parity, newsletter untouched, audit findings. Fixture files seeding event-format Templates now seed the canonical git-origin shape production has. Full backend suite run sequentially locally: 240/244 files green; the remainder re-verified individually (CI runs the full suite on this exact head). CLI suite: 629 pass. Frontend work-detail suite: 75 pass.

…ormat

DataOps runs events only as workshop, webinar and podcast, each served by
its one canonical Git-authored Template. The platform now rejects deviations
instead of storing them:

- Custom Templates cannot claim an event format, exactly or as a variant
  slug (aishl-workshop, sponsored-webinar), at create or edit time, and the
  cron path refuses to instantiate Cards from one.
- Event Cards are created only from the canonical format Template their
  type or [Workshop]-style title tag claims; anything else fails with an
  error naming the canonical alternative.
- An event Card carries only its format's document templates (workshop;
  webinar; podcast/podcast-episode-brief/podcast-run-sheet/
  podcast-guest-research). Creating or template-switching a document
  outside the owning Card's format is rejected with a visible 422.
- Document saves reject content keys that are not fields of their
  template's schema; the template-switch path carries only fields the next
  template defines and still refuses to drop filled values.

Sponsorship is an explicit boolean 'sponsored' flag on event Cards,
settable through the API, CLI (--sponsored) and a portal toggle on the
Card. It changes no Template, document or validation.

Newsletter cards and their documents stay untouched by the policy.

Enforcement lives in backend/src/cards/eventFormats.ts; fixtures that
seeded event-variant Templates now seed the canonical Git-origin shape
they mirror in production.
GET /api/cards/format-audit (admin) and 'dataops cards format-audit'
(--json) scan every Card, Template and sponsor document and report what
deviates from the three-formats policy: custom variant Templates, Cards
instantiated from them, documents whose template does not belong to their
Card's format, and documents pointing at missing Cards. The audit reports
only — it never repairs; existing deviations are cleaned up by hand.

Git-authored compound Templates (lightning-lesson-podcast) are distinct
products, not deviations. Newsletter stays out of scope.

docs/three-event-formats.md records the policy; the CLI guide mentions the
audit and the sponsored flag.
@alexeygrigorev
alexeygrigorev force-pushed the feat/three-event-formats branch from 60f399f to 9a694d6 Compare November 21, 2026 06:39
…-origin shape

The three-formats gate rejects Cards from a Custom Template claiming an
event format, so the synthetic webinar fixture now carries a sourcePath
like card-documents and brief-inline-images, mirroring production's
Git-authored webinar Template.
Both tests share one server and episodes release strictly in number
order, so S25E8 two weeks after S25E9 hit release_order_violation (it was
already flaky on main, passing only on a fresh-server retry).
The sponsored toggle can wrap the summary row; the trigger then sat at
the start of the second line and its end-aligned menu hung past the Card
panel, where the modal backdrop took the Delete card click.
POST /api/templates?dryRun=true answered 200 for a sponsored-webinar
definition that the real create rejects with 422. Both now share
assertNoEventFormatClaim, so a dry run never approves a forbidden format.
@alexeygrigorev
alexeygrigorev merged commit 5c53b54 into main Nov 21, 2026
5 checks passed
@alexeygrigorev
alexeygrigorev deleted the feat/three-event-formats branch November 21, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant