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:
@@ -78,3 +78,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
|
||||
| 47 | **Crop per slide (step B), built 2026-11-17.** | A slide can have its own crop (nullable columns on `HeroSlides`, migration `AddSlideCrop`, additive); null = the slide uses its photo's crop and set, so no existing address changes. The crop is edited per slide (`PUT/DELETE hero/slides/{id}/focus`, applied at once); a crop equal to the photo's shares the photo's set; equal crops share one set. A slide that is not saved yet cannot be cropped (the button says so): its crop would have no slide to belong to. The "crop is shared" hint of assumption 36 is gone. The photo's own crop stays the default and is no longer edited from the screen (the endpoint remains). | Let an unsaved slide carry its crop in the save request: more code on both sides. | `HeroSlide`, `HeroMapping.Effective`, `HeroImageService.RenderSlideAsync`, `HeroPage` |
|
||||
| 48 | **Step A (write-through) mirrors the whole module after each change** (2026-11-17). | Simplest consistent form: the same verified copier runs for the `hero` module after every saved change, one at a time, only with `Media:Library:DualWrite` on (default off); a failure never fails the Hero request. At this size (a few dozen photos) a full mirror is cheap and cannot drift from the copy. | Per-change incremental writes: more code, more ways to drift. | `IMediaLibrarySync`, `MediaLibrarySync`, `HeroImageService.SyncLibraryAsync` |
|
||||
| 49 | **Compact tiles in the clean-up and the delete confirmation** (product owner request, 2026-11-17). | `PhotoSelectionList` has a third layout `compact` (3/4/6/8 columns, square small thumbnails, name and a short usage line on one truncated line each, full name, date, size and usage in the tooltip; checkbox chip, whole-tile select, select all and the bulk bar unchanged). The clean-up dialog uses it. The "places that lose the photo" list in the second step of `DeleteDialog` is a read-only compact grid of the same kind. `PurgeDialog` shows no photo list (only a count), so it is unchanged; the library tiles and the ImagePicker are unchanged. | Long row lists again in the dialogs (much scrolling, little overview). | `PhotoSelectionList.tsx` (`layout="compact"`), `CleanupDialog.tsx`, `DeleteDialog.tsx` (`delete-places`) |
|
||||
| 50 | **Step C reads the library screen's data from the library tables, not the hero admin** (2026-11-17). | The read switch (`off`/`compare`/`on`) changes where the library screen gets photos, trash and uses; the hero's admin and public endpoints keep their own tables because they need the variants, which move in phase 3. Thumbnails come from the hero. `compare` only logs and reports (`GET media-library/read-check`); `on` falls back to the hero's tables when the library cannot be read. | Serve the hero admin from the library too: needs the variants (and cut sets) in the library tables first. | `HeroMediaUsageProvider`, `IMediaLibraryReader`, `MediaLibraryReader`, `MediaReadComparer` |
|
||||
|
||||
@@ -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