Repository navigation
Description
P2 — Editorial Engine (planned; no implementation authorized yet)
Depends on: P1 Atlas PR #364, merged to main at 6b2fc20a02614246daeed51339907d37ef9a59b7.
Goal
Convert /explore from eight non-indexable preview profiles into a durable source-backed editorial publishing system, without weakening MenuMinute merchant data isolation or introducing live AdSense scripts. A verified article should be authored and reviewed in /admin/encyclopedia, published as one immutable revision, rendered by the existing Atlas pages, and be eligible for canonical/sitemap indexing.
Design/product contract
- Reuse approved warm Atlas visual system and article types:
dishes,ingredients,cuisines,terms,compare. - Editor UX: content dashboard, candidate list, section/block editor, preview (desktop/mobile), sources, media/license record, relationships, revision comparison, review queue, publish/schedule/unpublish, quality warnings, audit trail.
- Must be useful to humans first: short answer, original explanations, well-marked variations, uncertainty in origin claims, descriptive imagery, clear dietary caveats; no automatic mass SEO-page creation.
- Pilot catalogue may import as DRAFT ONLY after deduplication. No automatic publication, no assumed allergen or dietary safety, no unreviewed AI claims.
- No ads on merchant menus/checkout/admin/search; this PR does not activate AdSense.
Eight-commit proposed development PR
- Domain contracts and editorial workflow — typed content blocks, canonical slugs, aliases, locale, source evidence, immutable revision identity; strict status machine (
DRAFT → IN_REVIEW → APPROVED → PUBLISHED, plusARCHIVED) and explicit publish/unpublish preconditions. Distinguish reviewer and actor, bind approval to revision digest. - Additive PostgreSQL foundation — next available migration (currently after
0114_tiffin_foundation.sql), newfood_entries,food_revisions,food_sources,food_entry_sources,food_aliases,food_relations,food_media,food_editorial_events; approved/current published revision pointer; uniqueness and constraints. No existing merchant table modifications; RLS deny-by-default for direct app/worker access and SQL read/write gateways. - Security, authorization and publishing service — admin/2FA/step-up via existing
verifySuperAdminand privileged SQL command design; server-enforced operations, idempotent publication, audit in same transaction, compare-and-swap based on revision digest; approved revision cannot be mutated in place. Public reads project only published content through narrowly scoped read-only SQL; never expose drafts/sources with private notes. - Atlas Editorial Studio UI —
/admin/encyclopediadashboard, filters, structured editor, live desktop/mobile preview, form validation, autosave states with conflict handling, accessible review dialogs, source and image metadata. All private routes noindex and no public cache. - Research, quality and media provenance — source records with retrieved/reviewed timestamps and factual claim provenance, editorial checklists, rights/attribution/license ledger for artwork, correction requests, sensitive dietary/medical-origin caveats and blocked publish conditions.
- Candidate import and knowledge graph — import existing dish catalogue only into idempotent unpublished candidate queue, deduplicate aliases, map typed dish↔ingredient↔cuisine and comparison references; title/canonical changes preserve redirect mapping and avoid duplicate index URLs.
- Public publication, SEO and search cutover — Atlas reads published DB projection, keeps demo previews noindex; canonical metadata, Article/BreadcrumbList JSON-LD for approved material, sitemap/scheduled expiry, indexed PostgreSQL FTS with bounded fuzzy fallback, selective cache invalidation and fail-closed DB outage behavior.
/explore/searchremains noindex. Do not infer Recipe schema for articles that are not recipes. - Tests, release evidence and operational handoff — PostgreSQL RLS/admin role/step-up/rollback tests, simultaneous editor concurrency, XSS/HTML sanitization, SSR public-only projection, index eligibility, redirects, publication events, perf and Playwright mobile/dark/keyboard. ARM64 CI, fresh off-host backup and schema-compatibility/ERP coexistence gates before any production activation.
Security/operability invariants
- No direct user-controlled SQL; queries bounded, prepared, statement timeouts, rate limits.
- One immutable published version survives failed drafts, broken import, missing artwork or incomplete reviews.
- Draft/approval actions cannot be forced by merchant tenant members; 2FA and privileged step-up required for platform changes.
- No cross-tenant reads or writes; avoid introducing unrestricted global database roles to the web app.
- Migration is append-only, expand-first, compatible with old web/worker during v7 autoactivation; no destructive migration or rewritten SQL.
- Store unpublished personal editorial notes only behind admin controls; avoid exporting private remarks into SEO schemas or client payloads.
- Image and source URLs validated, but never synchronously fetched from user-provided arbitrary hosts on a public request.
- Never mark a review/approval as complete without an actual named human editorial approval.
Definition of done
- Authorized editorial user can draft, inspect sources, request review, approve an immutable revision, publish/unpublish and restore a prior approved revision.
- Unapproved revisions never enter public search, article pages, metadata, JSON-LD, CDN cache or sitemap.
- Published pages have correct canonical/redirect and audit provenance; a correction can be deployed without changing merchant operations.
- A completely empty content database preserves a safe Atlas UX and returns no misleading indexable pages.
- All acceptance checks run on the reviewed SHA, independent review is recorded and merge/deploy handled separately.
Scope boundaries and follow-ups
P2 creates the publishing platform. A subsequent P3 Verified Editorial Launch produces and human-reviews an initial 20–30 genuinely useful articles and verifies Search Console/crawl outcomes. P4 AdSense Activation handles domain approval, ads.txt, CMP consent, privacy/legal review, real ad slots, per-page exclusions and revenue/attribution dashboards. No automated monetization before those gates.
Owner/integration: @baba-dev. Shared src/db/**, src/app/sitemap.ts, public UI and admin gateway require one reserved writer; inspect concurrent branches before claiming. main must be rechecked before implementation. Status: Planned / awaits explicit proceed command.
Activity
baba-dev commentedon Nov 22, 2026
Implementation started 2026-11-22, GPT-6 session. Starting SHA:
6b2fc20a02614246daeed51339907d37ef9a59b7. Owned paths:src/modules/food-encyclopedia/**,src/app/admin/encyclopedia/**,src/app/api/admin/encyclopedia/**, scoped Atlas public routes/components,src/db/migrations/0117_food_encyclopedia_editorial.sql,src/db/schema/food-encyclopedia.ts,src/app/sitemap.ts,src/app/admin/admin-nav.tsx, feature tests and P2 docs. Dependency: open Tiffin PR #366 owns0115/0116;0117must be reconciled with the ordered journal after that branch merges, and deployment must not run out-of-order migrations. Excludes tenant/orders/billing/worker/ERP/CI packages. Scope is draft PR, not merge/deploy. No publication or AdSense activation without human review.baba-dev commentedon Nov 22, 2026
P2 implementation is open as draft PR #368, final pushed SHA
c7e24fe35b6feb9b78f79510dc81ad739916ad14. Eight planned commits plus QA, main reconciliation and pinned formatter/linter fixes. Approved-only Atlas projection, private RLS schema, editor, reviews, sources, media-rights gating, draft-only catalogue import, SEO and browser/DB tests included. Updated migration 0118 after receipt UPI 0115 on main. Tiffin #366 still proposes conflicting 0115/0116; its migration numbering/journal must be reconciled before P2 merge. CI on final SHA: https://github.com/baba-dev/menuminute/actions/runs/45055465180 (in progress). No deployment or AdSense activation. Independent database/security reviewer still required.