Fase 2 stap A: write-through van de Hero naar de bibliotheek (schakelaar uit), per-slide uitsnede en set in de bibliotheek
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,3 +76,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
|
||||
| 45 | **Media screen details** (Bryan, 2026-11-17): bulk bar keeps its height; the whole tile selects; smaller tiles; 0 days in the clean-up; no time-basis choice. | The bar is an invisible placeholder of the same height (h-9) while nothing is selected. A click on a tile selects it (shift for a range); links, buttons and the box itself do their own thing. One more tile per row at every width. The clean-up slider goes from 0: 0 days means every photo that is not in use right now qualifies at the next clean-up (preview and confirmation unchanged, with a note at 0). The period always counts from the last use (assumption 29); there was no separate checkbox for the time basis in the clean-up (the only checkbox is "Alleen ongebruikte foto's", a filter, which stays because it protects photos in use), so nothing was removed. | If Bryan meant "Alleen ongebruikte foto's": removing it would put photos in use in the clean-up (counted from their upload date). | `BulkActionBar`, `PhotoSelectionList`, `CleanupDialog`, `CleanupSelection.MinDays` |
|
||||
| 46 | **Phase 2 is built in three switchable steps; the Hero tables stay the truth until phase 3** (2026-11-17, design on `feature/media-library-phase2`). | A write-through to the library tables (`Media:Library:DualWrite`), a nullable crop and set per slide (additive; null = today's behaviour and addresses), and a read switch with a compare mode (`Media:Library:ReadFromLibrary`). All switches off by default, test only, rollback by switching off. Details and back-up/rollback plan: `inception/application-design/phase2-design.md`. | Replace the Hero tables in one go: cannot be rolled back by a switch. | `phase2-design.md` |
|
||||
| 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` |
|
||||
|
||||
@@ -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) is built on this branch (backend, frontend, tests); steps A and 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): 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.
|
||||
|
||||
## What Bryan wants
|
||||
|
||||
@@ -93,3 +93,10 @@ Switches are set through the existing deploy workflow input path (the same way a
|
||||
|
||||
- Test data is no longer assumed to be rebuildable: there is a recorded restore point (above). The Hero tables stay authoritative until phase 3; "reads and writes through the library" is reached in steps A and C behind switches, not by replacing the tables in one go (a one-go replacement cannot be rolled back by a switch).
|
||||
- The crop per slide lives in the slide (nullable) in the Hero until phase 3 and is mirrored to `MediaUses.Crops`; moving the authority to `MediaUses` is part of phase 3.
|
||||
|
||||
## Step A as built (2026-11-17)
|
||||
|
||||
- `IMediaLibrarySync` (Core; default `NoMediaLibrarySync`) is called by the Hero after every saved change: upload (also the same photo again), focus of a photo, focus and reset of a slide, trash, restore, purge, delete, saving the hero, the renderer finishing a set (photo or slide) and the clean-up. The Media module replaces it with `MediaLibrarySync`, which runs the verified copier for the `hero` module only, one at a time, **only when `Media__Library__DualWrite=true`**, and never throws (a failure is logged; the next change or the start-up copy repairs it). The Hero's own tables are never touched by it.
|
||||
- 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.
|
||||
|
||||
Reference in New Issue
Block a user