Repository navigation
Events: three formats only; sponsored is a flag, not a format - #487
Merged
Merged
Conversation
…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
force-pushed
the
feat/three-event-formats
branch
from
November 21, 2026 06:39
60f399f to
9a694d6
Compare
…-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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
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).[Workshop]-style title tag claims. Everything else is rejected with a 422 naming the canonical alternative. The card PUT route cannot swaptemplateId.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.sponsoredboolean 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-auditscan 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
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.