Fase 2 stap C: leesschakelaar (off/compare/on) voor het bibliotheekscherm, read-check endpoint, workflow-input
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Phase 2: the Hero works through the library, and a crop per use
|
||||
|
||||
Status (2026-11-17): step B (crop per slide) and step A (write-through, switch off by default) are built on this branch; step C and phase 3 are not built. Branch `feature/media-library-phase2` (no PR until #22 is merged). Test only; every switch is OFF by default; SLS-Main is told before every test deploy; phase 3 (dropping the old tables) only after phase 2 is verified on test and never on production without a separate go from Bryan.
|
||||
Status (2026-11-17): steps B (crop per slide), A (write-through) and C (read switch) are built on this branch, switches off by default; phase 3 is not built. Branch `feature/media-library-phase2` (no PR until #22 is merged). Test only; every switch is OFF by default; SLS-Main is told before every test deploy; phase 3 (dropping the old tables) only after phase 2 is verified on test and never on production without a separate go from Bryan.
|
||||
|
||||
## What Bryan wants
|
||||
|
||||
@@ -100,3 +100,11 @@ Switches are set through the existing deploy workflow input path (the same way a
|
||||
- The slide as it is shown is what lands in the library: for a slide with its own crop the use gets the slide's set hash and crops (`MediaUses.SetHash`, `MediaUses.Crops`).
|
||||
- Switch through the deploy workflow like the copy: dispatch input `media_library_dual_write` (unchanged, on, off; test only).
|
||||
- **What Bryan can check on test with the switch on:** make any change in the Hero or the library (upload, crop a slide, save, trash, restore); then in the database `SELECT COUNT(*) FROM MediaAssets / MediaUses` equals `HeroImages` / `HeroSlides`, and for a slide with its own crop `MediaUses.SetHash` equals `HeroSlides.SetHash`. The log has no line "The write-through of hero to the media library failed". With the switch off nothing changes at all.
|
||||
|
||||
## Step C as built (2026-11-17)
|
||||
|
||||
- Switch `Media__Library__ReadFromLibrary` = `off` (default) | `compare` | `on`; deploy workflow input `media_library_read` (unchanged, off, compare, on; test only).
|
||||
- **What is read from the library tables:** what the library screen shows of the hero (photos, trash, where each photo is used): identity, size, name, dates and the uses with position and on/off. The thumbnail address still comes from the hero (the variants are not in the library tables until phase 3), and the hero's own admin and public endpoints keep reading their own tables: they need the variants. Writing (trash, restore, purge, crops) always goes to the hero's own tables, and with the write-through on, on to the library.
|
||||
- **compare:** the answer stays the hero's own, but the library tables are read too; every difference is a warning in the log (`Media library read check (hero): ...`) when the library screen is opened, and `GET media-library/read-check` (administrators) lists them for all modules in words (`matches`, `differences`), whatever the switch says, so it can be used before `on`.
|
||||
- **on:** the library tables answer; when they cannot be read the hero's own tables answer and the error is logged. `on` needs `DualWrite=on`, otherwise the library screen shows stale data.
|
||||
- **What Bryan can check on test:** (1) with `DualWrite=on` and `ReadFromLibrary=compare`, open the library screen and call `/api/v1/media-library/read-check` (or look at the log): `matches: true` for the hero means the library tables are a faithful mirror; (2) then `ReadFromLibrary=on`: the library screen looks exactly the same (same photos, trash, uses, thumbnails); change something (upload, trash, restore, crop a slide) and the screen follows; (3) switch back to `off` at any moment, nothing is lost.
|
||||
|
||||
Reference in New Issue
Block a user