M10: the seam for media, and no media
The media extension contract asks for a scene snapshot a future image or video provider could be handed: location, who is present, what they hold, what must stay true, and where in the story it sits. Building one was the milestone's obvious first task, and it was the wrong one. That snapshot has existed since M5. `narrative_state["scene"]` holds the summary, the location, the cast and the coordinate it was written at; a validated `set_scene` event writes it, every position snapshots it, and every head move restores it. It survives Undo, Redo, Retry, divergence, Save Point restore and a process restart because it is the authoritative state rather than a copy of it. So there is no scenes table here. A second scene store would have been a second answer to "where is the story now", with its own lineage rules to get wrong — and the lineage rules are the expensive part, which is the argument for reusing the ones that already work rather than against it. The Scene Packet is derived on read, and its identity is computed from the campaign and the position rather than allocated: the same position yields the same id in another process, after a restart, and after the packet is thrown away and rebuilt, with no row to keep in step. That is the part of a future media_assets table that would be expensive to retrofit, so it is fixed now even though the table is not built. One table, then: visual_profiles, the only thing the contract's scene list asks for that nothing already stored. Campaign-scoped and not per-position, because a character does not change appearance when the story forks — a reader who diverged would otherwise lose their cast, and the same descriptors would land in every per-position snapshot, measured at 245 copies of 367 bytes in a 120-turn campaign to say something that never varies. Keyed by the M5 entity key rather than a new identity namespace, and one table for characters, locations and items alike, because a location is an entity with a type and splitting them would reintroduce the genre shape M5 spent a milestone removing. What the packet leaves out is the more interesting half. Not the transcript, and not imported knowledge — none of it, not merely the sources marked hidden. The rule is what the story established at this position, not everything the narrator was told, and drawing it by class is what makes it hold for a secret nobody thought to mark. A hidden Canon source proves it, with a positive control showing the narrator did receive the sentinel the packet does not carry. Once a validated event puts the observer in the room, the observer is in the packet: that is no longer narrator-only knowledge, and a packet that hid it would be hiding the story from itself. The providers are contracts and nothing else. Protocols for image, video, audio, speech and transcription, an empty registry, no adapter, no dependency, no socket, and no media setting to point anywhere — a setting that exists can be pointed at a cloud by mistake. A future provider endpoint must be loopback, stricter than narration's trusted-LAN allowance, because a picture of a scene carries the scene with it. Transcription returns an editable draft with no commit method, so STT structurally cannot bypass the authoritative path. Nothing here can write the story. Not by convention: no module under media/ imports the code that writes state, no media event type exists in the state vocabulary, and every test in the authority suite compares the authoritative document byte for byte either side of a media operation — including one where a provider insists Alice is in a red coat in a corridor, and the campaign goes on disagreeing. One defect, found by the milestone's own tests. M10 first added a migration creating an index that create_all already builds from the column, so an upgraded database ended up with two indexes and a fresh install with one. Comparing the two schemas is what caught it; neither database examined alone would have. The migration is gone rather than renamed, and the right number of migrations for a new table whose indexes are declared on its columns is zero. Backend 1,191 passed / 14 skipped / 0 failed, 89 of them M10's. Frontend 145 passed. Lint, production build and Docker build clean. No frontend file changed: M10 adds no reader-facing surface, and ordinary play — turns, state, memory, knowledge, Undo, Redo, Retry, Save Point restore, restart — runs with no media configuration, no warning, no connection attempt and no media row written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qyn3oRd4D6pi72nKBG725B
This commit is contained in:
co-authored by
Claude Opus 5
parent
44edece67e
commit
1013c94eb1
@@ -2084,6 +2084,24 @@ Reach a scene involving multiple characters and a clear location.
|
||||
### Pass
|
||||
Application can persist a structured scene representation sufficient for future media use.
|
||||
|
||||
### Result — PASS, and it was already passing (M10, 2026-09-07)
|
||||
|
||||
The scene representation is `narrative_state["scene"]` and has existed since M5:
|
||||
`summary`, `location`, `present[]`, and the `at: {branch_id, depth}` coordinate
|
||||
that says where it was written. It is produced by the validated `set_scene`
|
||||
event, snapshotted per position in `actions.narrative_state_after`, restored on
|
||||
every head move, and carried in the v3 bundle.
|
||||
|
||||
M10 verified this with a probe rather than trusting the earlier report — a
|
||||
campaign played to a scene, diverged, undone and exported — and then built the
|
||||
normalized packet on top of it (`app/media/packet.py`,
|
||||
`GET /api/adventures/{id}/scene-packet`) instead of a second scene store.
|
||||
|
||||
Tests: `backend/tests/test_m10_media_hooks.py` (the packet's contents and
|
||||
bounds), `test_m10_lineage.py` (the scene follows the active lineage through
|
||||
Undo, Redo, Retry, divergence, Save Point restore and two genuine process
|
||||
restarts).
|
||||
|
||||
---
|
||||
|
||||
## K02 — Visual Character Profile
|
||||
@@ -2093,6 +2111,22 @@ Application can persist a structured scene representation sufficient for future
|
||||
### Pass
|
||||
Character can retain optional stable visual descriptors.
|
||||
|
||||
### Result — PASS (M10, 2026-09-07)
|
||||
|
||||
`visual_profiles`, keyed by `(adventure_id, entity_key)` — the M5 entity key, not
|
||||
a new identity namespace — with an open `descriptors` map, a `features` list and
|
||||
free `style_notes`. Read and written through
|
||||
`/api/adventures/{id}/visual-profiles[/{entity_key}]`.
|
||||
|
||||
**Optional** is tested as well as stated: the fixture leaves one character
|
||||
deliberately unprofiled, and the packet reports `visual_profile: null` for them
|
||||
rather than an empty profile, because "nobody has decided what Roger looks like"
|
||||
and "Roger looks like nothing" are different answers to a future provider.
|
||||
|
||||
**Stable** means campaign-scoped rather than per-position: a character does not
|
||||
change appearance because the story forked, so a profile survives Undo, Redo,
|
||||
divergence and Save Point restore unchanged, and travels in the bundle.
|
||||
|
||||
---
|
||||
|
||||
## K03 — Visual Location Profile
|
||||
@@ -2102,6 +2136,19 @@ Character can retain optional stable visual descriptors.
|
||||
### Pass
|
||||
Location can retain optional visual continuity descriptors.
|
||||
|
||||
### Result — PASS, through the same mechanism as K02 (M10, 2026-09-07)
|
||||
|
||||
There is no separate location table. M5's entity model is genre-neutral and a
|
||||
location is an entity with a `type`, so one `visual_profiles` table serves
|
||||
characters, locations and items alike. Splitting them would have reintroduced the
|
||||
genre shape M5 spent a milestone removing, and a `kind` column would have been a
|
||||
second copy of the entity's own type.
|
||||
|
||||
The fixture is deliberately non-fantasy — an open-plan office under flat
|
||||
fluorescent light — because the contract's examples are fantasy-shaped and a
|
||||
schema written while looking at them acquires that shape without anyone choosing
|
||||
it.
|
||||
|
||||
---
|
||||
|
||||
## K04 — Attach Media Asset to Scene
|
||||
@@ -2116,6 +2163,27 @@ A local dummy/test image can be associated with a scene/turn without altering st
|
||||
If media tables are deferred:
|
||||
- architecture/types should demonstrate equivalent extension point.
|
||||
|
||||
### Result — PASS on the deferred branch (M10, 2026-09-07)
|
||||
|
||||
Media tables are **deferred deliberately**, so this is reported against the
|
||||
acceptance text's second clause rather than its first.
|
||||
|
||||
`app/media/providers.py` defines the extension point as structural contracts:
|
||||
`MediaRequest`, `MediaResult`, `ProviderCapabilities`, `DraftTranscription`, and
|
||||
the `MediaProvider` / `SpeechProvider` / `TranscriptionProvider` protocols, with
|
||||
a registry that is empty and stays empty. A test registers a dummy provider,
|
||||
builds a scene packet, generates a fake PNG carrying the packet's `scene_id` as
|
||||
provenance, and confirms the story model is byte-for-byte unchanged — which is
|
||||
the equivalence the clause asks for.
|
||||
|
||||
`media_jobs` and `media_assets` were not built because a queue with no producer
|
||||
and no consumer would be speculative architecture, shaped by a provider nobody
|
||||
has chosen; M6 declined the same thing (`derived_status`: "not a job queue").
|
||||
The part that would be expensive to retrofit is guaranteed now: the scene
|
||||
identity a future asset must reference is *derived* from campaign and position
|
||||
(`c<adventure>:b<branch>:<start>-<end>`), so it is stable across processes and
|
||||
restarts without a row to keep in step.
|
||||
|
||||
---
|
||||
|
||||
## K05 — Generate Local Image
|
||||
|
||||
Reference in New Issue
Block a user