Data + Policy

Ownership & visibility rules

Single reference for structural parents, link semantics, and the visibility ceiling before wiring Supabase RLS.

  • Keep structural parent/child rules consistent when adding presets
  • Document when to use owns[] vs references[] vs belongs_to
  • Clarify the visibility ceiling (child ≤ parent) for policy work

Structural

Section hierarchy

Sections can own other sections, sessions, resources, assignments, and discussions.

  • Use structural.allowedChildren to limit what the UI shows beneath a given section.
  • Week/Module sections default to allowedChildren = ["section","session","resource","assignment","discussion"].
  • Workshop-day preset narrows children to ["session","resource","discussion"].

Session parents

Sessions prefer a Section parent but fall back to auto-generated “Unassigned” when missing.

  • seed -> sessionParents map takes precedence.
  • When pulling from Supabase/Convex, structural.parentId stores the slug-level alias; dbId stays in meta.dbId.

Assignment placement

Assignments must belong to a Section; studio sessions hang under the same Section for calendar parity.

  • Assignments carry due dates, not sessions.
  • Studio sessions optionally inherit section visibility ceiling.

Links

Hard ownership vs references

Use structural.parentId for true containment; use linking references for citations/mentions.

  • Example: Resource belongs to Week 5 (structural.parentId=week5) but can reference Session IDs under linking.references.
  • Discussion attaches_to Section/Session/Assignment via structural parent.

Collections vs Sections

Collections are loose bundles; they reference any node without changing the structural tree.

  • Use for playlists, prep packs, resource dumps.
  • Preset builder will eventually emit join maps for collections separately from section ownership.

Visibility

Ceiling enforced top-down

A child may tighten but never widen its parent’s visibility.

  • Section visibility is the ceiling. Sessions/resources/discussions default to inherit unless explicitly narrower.
  • Field intel resources inherit members-level by default, even if Section is public.

Inherited metadata

Set access.inheritsFrom to the parent slug to make tracing easier in Supabase + Convex snapshots.

  • Supabase provider remaps db UUIDs back to slugs using meta.slug so inheritsFrom remains human-readable.

Discussion privacy

Discussions copy Section visibility unless tied to an Assignment (then it mirrors assignment visibility).

  • In future, we can add secret threads by setting access.visibility='private' regardless of parent.