metadata_catalog #3

Merged
arne merged 19 commits from metadata_catalog into main 2026-06-22 15:29:59 +02:00
Owner
No description provided.
Zero-dependency entity types following ADR-0003 catalog domain model:
Show -> Season -> Work -> Edition -> (Master | Episode -> Rendition).
Includes EncodingProfile (versioned, per ADR-0005) and Feed.

UUIDv4 generation via crypto/rand (stdlib only, per ADR-0002).
Domain errors: ErrNotFound, ErrDuplicateGUID, ErrImmutableField.
Defines the catalog.Store interface behind which concrete backends
plug in, per ADR-0009 (storage behind Go interfaces) and ADR-0002
(isolated domain core).

Covers all 9 entities: Show, Season, Work, Edition, Episode, Master,
EncodingProfile, Rendition, Feed. Includes lookup methods (by slug,
by GUID, by content hash, by name+version, by idempotency key).
Implements the catalog.Store interface on modernc.org/sqlite (pure Go,
no cgo, CGO_ENABLED=0 preserved). Features:

- 9 tables with foreign keys, unique constraints, and cascading deletes
  - GUID uniqueness on episodes (write-once per ADR-0004)
  - Content hash uniqueness on masters (immutable, per ADR-0006)
  - (episode, master, profile) uniqueness on renditions (idempotency, ADR-0005)
  - (name, version) uniqueness on encoding profiles (ADR-0005)
- In-memory :memory: mode for tests
- Time stored as RFC3339Nano with SQLite datetime fallback
- Full test suite: 16 tests covering CRUD, uniqueness, and entity tree chain
Adds -db flag (default kokosbananas.db) to open the catalog SQLite
store alongside the existing preview lab file store. The catalog DB
is available but not yet consumed by web handlers — this is the
infrastructure seam for future phases (admin CRUD, pipeline, feeds).

Also updates README to list the new internal/catalog packages.
Adds docs/CATALOG.md documenting all 7 core domain entities
(Show/Season/Work/Edition/Master/Episode/Rendition) with:

- Purpose descriptions from the domain model
- Field-level table (Go type, JSON key, description, example value)
- Populated JSON example per entity
- Tree-walk JSON showing a complete Show -> Rendition chain
- Appendix entries for EncodingProfile and Feed

Uses realistic values from the Norwegian kids' audio context
(e.g. 'Kokosbananas', 'Første sesong', 'Den magiske skogen').
Adds Person and Credit entities to the catalog domain model.
Person is a reusable identity (name, bio, image, links).
Credit attaches a Person to Show, Work, or Edition with a role
(producer, host, narrator, voice-actor, writer, etc.).

Character names deferred. Feed projection described but not
implemented.

Status: Proposed.
Person is a reusable identity (name, slug, bio, image, links).
Credit is a join entity attaching a Person to Show, Work, or Edition
with a role and sort order. Exactly one of show_id/work_id/edition_id
is set per row (enforced by CHECK constraint).

Per ADR-0013.
Adds CreatePerson/GetPerson/FindPersonBySlug/ListPersons/UpdatePerson/
DeletePerson and AddCredit/GetCredit/RemoveCredit/ListCredits to the
catalog.Store interface.
Adds persons and credits tables to the schema with:
- persons: UNIQUE slug, bio/image/links fields
- credits: CHECK constraint ensuring exactly one FK (show/work/edition)
  is set per row, ON DELETE CASCADE from persons
- PRAGMA foreign_keys = ON at connection time so cascades work

Tests cover: full CRUD for persons, show/work/edition level credits,
CHECK constraint enforcement, cascade on person delete, listing with
various filter combinations.
Updates docs/CATALOG.md with:
- Updated tree diagram showing Person -> Credit -> Show/Work/Edition
- Full Person and Credit entity sections after Rendition
- Cross-reference notes on Show, Work, Edition sections
- Persons and credits arrays in the tree-walk JSON example

Promotes ADR-0013 from Proposed to Accepted.
Voice actors and sound designer attach to Edition, not Work.
Only writer attaches to Work (as creator of the underlying work).
Voice-actor is now an Edition-level role per ADR-0013; use
writer (the only Work-level role) in the Work-level test.
Human-friendly descriptions of the catalog data model in nynorsk
(katalog_nn.md) and English (catalog_en.md). Covers all entities,
credit role mappings, and rendition profiles — no IDs, timestamps,
foreign keys, or type information.
oystein force-pushed metadata_catalog from 6b60577ae9 to be181577d9 2026-06-22 13:46:17 +02:00 Compare
Update title tag, brand link, and footer text across all pages
via the shared head/foot partials.
New route and handler serving a human-friendly overview of
the catalog data model (entities, fields, tree walk, credits).
Link added to the topbar nav between Oversikt and Lydlab.
Amber in-progress dot replaces the green live dot; Lydlab
demoted to plain item. Katalog phase marked as under arbeid.
Addresses the PR review findings:

Brand consistency (#1):
- Complete the Kokosbananas -> Golten Stories rename across all user-facing
  text (docs, customer overviews, CATALOG examples, design mocks, deploy
  description, code comments, test fixtures). Lowercase identifiers (Go module,
  import paths, kokosbananas.db / .service / .css filenames) are intentionally
  left for a separate infra change.

Design-system consistency (#2):
- Move the inline <style> blocks out of landing.html and katalog.html into
  style.css; add .is-inprogress as a real timeline state and scope the generic
  .dot to .tree .dot to avoid collisions.

Landing timeline (#3):
- Lydlab is shipped, so mark it is-done (was rendering as a hollow
  "not-started" dot); keep Katalog as is-inprogress.

Catalog backend:
- Set foreign_keys/busy_timeout via the DSN so FK enforcement applies to every
  pooled connection, not just the first (it was connection-scoped + only safe
  because of SetMaxOpenConns(1)).
- Wire the previously-dead ErrDuplicateGUID sentinel through wrapErr and assert
  it in TestDuplicateEpisodeGUID; remove the unused ErrImmutableField (no
  enforcement path exists yet).

Verified: build/vet/test green (CGO_ENABLED=0); live / and /katalog render with
externalized CSS and the Golten Stories brand.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
arne merged commit 91d6dc868a into main 2026-06-22 15:29:59 +02:00
arne deleted branch metadata_catalog 2026-06-22 15:29:59 +02:00
arne referenced this pull request from a commit 2026-06-22 15:30:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tjue/kokosbananas!3
No description provided.