Files
slp-modular-cms/aidlc-docs/features/media-library/assumptions-and-open-questions.md
T
SluijsensandClaude Sonnet 5.5 370bd0dfd1
Continuous Integration / config-asf (pull_request) Successful in 6s
Continuous Integration / config-sls (pull_request) Successful in 7s
Continuous Integration / changes (pull_request) Successful in 12s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m12s
Continuous Integration / compile-sites (pull_request) Successful in 2m9s
Continuous Integration / backend-build (pull_request) Successful in 2m12s
Continuous Integration / backend-test (pull_request) Successful in 2m41s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped
Productie in een keer: de start kopieert HeroImages in de bibliotheek vlak voor de drop
Een weigerende guard stopt de applicatie nu echt (ModuleStartupException wordt door de orchestrator doorgegooid).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 09:08:58 +01:00

87 lines
36 KiB
Markdown

# Assumptions and deferred questions: media-library
Kept while Bryan is away (2026-11-17): no questions to him, a most probable assumption per open question instead. Per item: the question, the assumption made, what changes if Bryan chooses differently, and where in code or design. To be put to Bryan by the SLS session; he checks and corrects later. Same form as the Hero list.
| # | Question | Assumption made | If Bryan chooses differently | Where |
|---|---|---|---|---|
| 1 | Which **uses** (places and ratios) exist? **[Confirmed by Bryan "as designed", 2026-11-17]** | Hero `wide` (3:2) and `tall` (2:3), ASF shoot-page **mosaic** tiles (a small fixed set of ratios per page, to be listed by the ASF session), **masonry** (natural ratio, no crop), **thumb** (library thumbnails, 1:1 or natural). A use is `(module, place, ratio set)`. | Other ratios only add rows to the use definitions; a free-form ratio per tile would need a ratio editor and more variants per photo. | Application design section 4 (`MediaUseDefinition`) |
| 2 | **Several formats/variants per photo**: who decides the set? **[Confirmed by Bryan "as designed", 2026-11-17]** | The **use** decides the ratios and widths (as `VariantPlanner` does for Hero); the library never cuts a fixed set per photo. Formats stay WebP and AVIF as today. | A fixed set per photo costs more disk and CPU on the Pi and cuts variants nobody uses. | `VariantPlanner`, application design section 4 |
| 3 | The **7-day automatic clean-up** of unattached Hero images until the library is built. **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | **Built (2026-11-17, safe: default unchanged)**: the setting `Media:AutoCleanupUnattached` exists, default `true` (today's behaviour); set `Media__AutoCleanupUnattached=false` per host to keep every upload. Plan: switch it off (default `false`) once the library screen and delete are accepted by Bryan. Switch it off behind a setting (`Media:AutoCleanupUnattached`, default `true` until the library screen exists, then default `false`), so nothing is lost silently once the library can show and delete photos. Retired-file removal (after a replaced set) stays: that is housekeeping of generated files, not a person's photos. | Keep it on until phase C; or switch off now (risk: unused uploads pile up with no screen to remove them). | `HeroMediaCleanup`, `MediaOptions` |
| 4 | **Rights per module**: who may see, use and delete which photos? **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | One shared library for Owner and Administrator (like Hero and Offerings). No per-module visibility yet. | Per-module visibility needs an owner field on a photo and a filter; the contract has room for it (`ModuleKey` on a use). | `[Authorize(Policy = "AdminOnly")]`, `MediaUse.Module` |
| 5 | **Public addresses**: per module (`/media/<module>/...`) or a shared path? **[Confirmed by Bryan "as designed", 2026-11-17]** | Keep `/media/{area}/{setHash}/{name}`; `area` stays the module (`hero`; a gallery would use `gallery`). The set hash still comes from the original's hash plus the crops of that **use**. A photo used in two modules is two sets (two addresses), cached separately. | A shared path would change addresses and golden files: not allowed without alignment. | `MediaPaths`, `MediaEndpoint` |
| 6 | **Usage register**: do modules report, or does the library keep it centrally? **[Confirmed by Bryan "as designed", 2026-11-17]** | Modules report: `IMediaUsageProvider` per module answers "where is this photo used" and "detach this photo" from the module's own data. Computed, never copied, so it cannot go stale. The library warns when a module has no provider. | A central register table keeps the answer fast but must be kept in step on every module save (risk of drift); can be added later as a cache. | Application design section 3, `IMediaUsageProvider` |
| 7 | **What counts as "unused"** in the clean-up? **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | A photo is unused when **no provider** reports a use. A photo used only by an inactive or unpublished slide still counts as used (it is in a slide). | Treating an inactive slide as unused would delete photos a person may want to switch on again; stricter would be safer than looser. | `MediaUsageService` |
| 8 | **Clean-up default period** and slider range. **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | Default 7 days, slider 1 to 365 days, step 1; "Only unused photos" on. The period is measured from the upload date. | Measured from last use, or another range: a one-line change in the filter. | Clean-up component, `CleanupSelection` |
| 9 | **Storage limit and warning**. **[Confirmed by Bryan "as designed", 2026-11-17]** | Limit = existing `Media:MaxTotalBytes` (2 GB, decided by Bryan, Hero assumption 12). Warning at 80 percent (amber) and at 100 percent (red, uploads refused with a clear message). Used bytes = originals plus all variants, cached 60 s. | Another threshold or limit: configuration only. | `MediaOptions`, `MediaStorageUsage` |
| 10 | **Delete of a photo that is in use**. **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | Not possible from Clean-up (those rows are not selectable); possible from the library after a second confirmation that names the uses; the module detaches it first (Hero: the slide loses its image and is unpublished until a new one is chosen, as today). | Block deleting in-use photos completely: the extra confirmation path is removed. | `IMediaUsageProvider.DetachAsync`, library screen |
| 11 | **Shared upload service**: does Hero's upload move into the library? **[Confirmed by Bryan "as designed", 2026-11-17]** | In phase A Hero keeps its own upload endpoint; the library also lists those photos. In phase B both call one upload service in Core. | Moving Hero upload earlier gives a single path sooner but touches Hero before the data model exists. | `HeroImageService`, `MediaUploadGuard` |
| 12 | **Trash delay** (deleted photos recoverable for a while)? **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | No trash in phase A: the confirmation naming the count is the safety. A 7-day trash can be added in phase B (a `DeletedAt` and the existing retired-file mechanism). | Trash from the start: reuse `HeroRetiredFile` logic generalised in Core; about 1 day extra. | `HeroRetiredFile`, application design section 5 |
| 13 | **Migration of existing `HeroImages`** (phase C). **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | Expand then contract: new `MediaAsset` and `MediaUse` tables are filled from `HeroImages` and `HeroSlides` with the **same ids, hashes and set hashes**; Hero reads the library; old columns are dropped in a later release. Needs a back-up and alignment: **not built**. | A one-step move is smaller but cannot be rolled back; or no migration at all and the library keeps reading through Hero (the provider approach) until the gallery module needs own tables. | Requirements section 9, application design section 6 |
| 14 | **Crop per use**: data per use or per photo? **[Confirmed by Bryan "as designed", 2026-11-17]** | A use owns its crop (focus x, y and zoom per ratio); the photo owns the default focus new uses start from. The set hash of a use is `SetHash(originalSha256, crops of that use)` exactly as today, so existing Hero addresses are unchanged. | Crop per photo only (today's model) cannot serve a mosaic with several tiles of the same photo. | `MediaPaths.SetHash`, `MediaUse` |
| 15 | **Selection range** with shift-click and "select all": across pages or the loaded page? **[Confirmed by Bryan "as designed", 2026-11-17]** | The loaded list (the clean-up list is loaded fully, the library list incrementally; "select all" says how many are loaded and offers "select all N" for a filtered list). | Strictly the current page: simpler, less useful for a clean-up of hundreds. | Selection component |
| 16 | **Deleting files from the store** when a photo is deleted. **[Confirmed by Bryan "as designed", 2026-11-17]** | The original and the set directories of that photo are deleted through `IMediaStore` after the database rows; a set shared with another use (same hash) is kept until no use references it. | Soft delete first (see 12). | `IMediaStore.DeleteSetAsync`, `HeroRepository.GetReferencedSetHashesAsync` |
| 17 | **Language of the screen**: nl and en like the rest of the admin. | Yes, `media.*` keys in both files; terms: "Mediabibliotheek", "Opruimen", "Alleen ongebruikte foto's". | Dutch only: remove one file. | `frontend/src/i18n/locales` |
| 18 | **Phase A built (2026-11-17, on assumptions)**: what is in the first step? | Read-only only: the usage contract (`IMediaUsageProvider`, `MediaLibraryService`, pure `CleanupSelection`), the Hero provider and the selection components in the frontend (`PhotoSelectionList`, `BulkActionBar`, selection rules). **No endpoint, no screen, no delete, no migration, no address change yet.** | Wire the screen and endpoints next (list, storage, clean-up preview) and then delete (needs a Hero delete path and Bryan's check of assumptions 3, 7 and 10). | `Core/Media/Library`, `Modules.Hero/Services/HeroMediaUsageProvider.cs`, `frontend/src/features/media` |
| 19 | The **position** of a slide in "Hero, slide 3". **[Confirmed by Bryan "as designed", 2026-11-17]** | Rank by `SortOrder` within its hero, counting slides that are switched off, 1-based; a slide that is off still counts as a use and is shown "(uit/off)". | Count only active slides, or show the slide's title instead. | `HeroMediaUsageProvider.ListUsesAsync` |
| 20 | The **thumbnail** of a Hero photo in the library. **[Confirmed by Bryan "as designed", 2026-11-17]** | The smallest published WebP variant of the current set; none yet (a grey "no preview") while the set is not cut. | Use the full-frame preview (`full-*.webp`), which shows the whole picture instead of the wide crop. | `HeroMediaUsageProvider.Thumbnail` |
| 21 | A **name** for a photo. **[Decided by Bryan, 2026-11-17, second round: see "Decisions of the second round"]** | Photos have no file name today (`HeroImage` does not store it), so the library shows a neutral label (date and size); a name field comes with the library's own tables (phase B). | Store the original file name at upload now (a small Hero migration, additive). | `PhotoItem.name`, phase B |
| 22 | **Select all** and ranges with photos that cannot be selected (in use during a clean-up). | They are skipped by "select all" and by shift-ranges; the header box shows "some" when only part is selected. | Include them but refuse at confirmation. | `PhotoSelectionList`, `selection.ts` |
| 23 | Where does Hero **list all photos** (performance)? | In memory, newest first, as the rest of the Hero repository does (a few dozen photos; the MySQL provider has limits with Guid lists). Paging comes with the screen when the count grows. | Server-side paging by `CreatedAt` (needs an index). | `HeroRepository.GetAllImagesReadOnlyAsync` |
| 24 | **Tile ratios of the ASF mosaic** (assumption 1). | **Answered by the ASF session (2026-11-17, from its code)**: the mosaic shows at most 4 tiles per shoot page, from 2 photos up (layouts for 2, 3, 4). The tile shape is fixed per page by the photo count and order, not chosen per photo: **large** (photo 1) 2x2, desktop about 1:1 (max about 656x632), phone 4:3; **wide** (photo 2 with 3 or 4 photos) 2x1, desktop about 2.2:1 (max about 656x300), phone 3:2; **small** (photos 3 and 4 with 4 photos) 1x1, about 1.04:1 (max about 312x300), phone 1:1. With 2 photos: two large side by side. All object-fit cover (a crop). Widths: large and wide up to about 656 px, small about 312 px; phone half width about 175-300, full width about 350-600; retina variants 480, 640, 960, 1280. **Masonry** (portfolio): natural ratio only, no crop (rounding below half a row of 1/40 of the column width); 1, 2 or 3 columns, column width up to about 427 px; thumb now 800 px wide with the height following the ratio, variants about 480 and 800; the lightbox uses a separate `full`. Used in the design as uses `mosaic-large`, `mosaic-wide`, `mosaic-small` (each with a focus point and a desktop and phone shape) and `masonry` (no crop). | Each answer only adds use definitions. A ratio per photo (not per tile shape) would need a ratio editor. | Application design section 4 |
| 25 | **Use definitions in code** (built 2026-11-17, pure data, nothing consumes them yet). | `MediaUseDefinition` (ratios with widths, or natural) and `GalleryUses` for the ASF needs: `mosaic-large` (`tilelarge` 1:1, `tilelargem` 4:3), `mosaic-wide` (`tilewide` 11:5, `tilewidem` 3:2), `mosaic-small` (`tilesmall` 26:25, `tilesmallm` 1:1), `masonry` (`natural`, no crop). Ratio names are letters only (2 to 10) to fit the address allow-list, so a phone shape is a name with an `m` suffix. Widths: large and wide 480, 640, 960, 1280 (retina set from the ASF answer); small 312, 480, 640; masonry 480 and 800. The set hash uses the shared `MediaPaths.SetHash` formula (a test shows it equals the Hero's). Hero's own `wide` (3:2) and `tall` (4:5, not the 2:3 the first design sketch said) stay as built in `VariantPlanner`. | Other widths or ratio values change only the definitions; the ASF `full` (lightbox) variant is not defined yet (it is the full-frame preview ratio). | `Core/Media/Library/MediaUseDefinition.cs` |
| 26 | **Choose or upload everywhere (ML-17)**: how does the Hero upload relate to the library? **[Confirmed by Bryan "as designed", 2026-11-17]** | Now the Hero keeps its own upload and table; its photos are already in the library list through the provider. When the library owns uploads (phase B) every upload creates exactly one library record (same file = same record by hash). The Hero switches to the shared picker with the phase C migration. Until then the Hero upload flow does not change. | Moving the Hero to the picker earlier (before phase B) would give a single upload path sooner but touches the Hero flow and needs the data model first. | Application design section 10 |
| 27 | **Scope of the shared picker**: single choice or several, and what does it include? **[Confirmed by Bryan "as designed", 2026-11-17]** | One photo per picker (single choice, radio group). It includes the library photos and one upload button (one file at a time); the Hero's multi-file upload and drag and drop stay on the Hero screen. The picker is pure: the module passes the list and the upload callback. | Several photos at once or drag and drop in the picker: a larger component, added when a module needs it (the gallery will probably need multiple). | `features/media/components/ImagePicker.tsx` |
| 28 | **Uploaded photo not ready yet** in the picker. **[Confirmed by Bryan "as designed", 2026-11-17]** | It is chosen at once but shows "no preview" until the background renderer has cut its set; an image without a set is not published (as in the Hero today). | Block choosing until it is ready: simpler to explain, slower to work with. | `ImagePicker`, `HeroRenderService` |
## Decisions of the second round (Bryan, 2026-11-17, via SLP Software - SLS - Main)
| # | Decision | Consequence in design and code |
|---|---|---|
| 3 | The automatic removal of unused Hero uploads is switched off once Bryan has approved the screen (PR #22). | `Media:AutoCleanupUnattached` keeps its default `true`; it becomes `false` only at or after his approval of PR #22. |
| 4 | One shared library for Owner and Administrator, no rights per module. | As designed (`AdminOnly`). |
| 7 | A photo used only by a switched-off slide counts as **used**. | As designed (`HeroMediaUsageProvider` reports it as a use with `Active = false`). |
| 8 | The clean-up period counts from the **last use**, not the upload date. | Each photo gets "unused since" (the moment it was last detached from a slide; the upload date when it was never used). Details in assumption 29. |
| 10 | Deleting a photo that is in use is possible after a **second confirmation that names the places**. | Delete refuses an in-use photo unless the request says it was confirmed twice; the module detaches it (Hero: the slides using it are removed). Assumption 30. |
| 12 | There is a **trash**: recoverable for 7 days (`DeletedAt` plus the existing retired-file mechanism). | Delete means "to the trash"; the files go 7 days later. A trash view lists them with Restore. Assumption 31. |
| 13 | The migration of `HeroImages` to the library's own tables may be built next (expand then contract, same ids, hashes and addresses). | Conditions: document a back-up and rollback plan first; roll out only to TEST, never production; tell SLS-Main before deploying to test. Assumption 32. |
| 21 | The original file name is stored at every upload from now on (additive); existing photos keep the neutral label. | `OriginalFileName` on the Hero image (additive migration); the library shows it. |
### New assumptions from these decisions
| # | Question | Assumption made | If Bryan chooses differently | Where |
|---|---|---|---|---|
| 29 | **Reference date of the clean-up** (decision 8). | For a photo that is not in use: the moment it was last detached from a slide (`LastUsedAt`), else its upload date. For a photo that is in use right now (clean-up with "Only unused photos" off): its upload date, since "last used" is "now" and nothing would ever be old enough. The period slider keeps its range (1 to 365 days, default 7). | "Last used" for a photo in use = the last save that kept it, so with the filter off only photos left alone for the whole period are offered. | `HeroImage.LastUsedAt`, `HeroService.SaveAsync`, `CleanupSelection` |
| 30 | **Detaching a used photo when it is deleted** (decision 10). | In the Hero the slides that use the photo are removed from the hero (a slide cannot exist without an image); the second confirmation names them ("Hero, slide 3"). The hero then has fewer slides and stays published as long as it has a title. | Keep the slide and mark it "image missing" until a new image is chosen: needs a nullable slide image and a changed public contract. | `HeroMediaUsageProvider.TrashAsync` |
| 31 | **Trash mechanics** (decision 12). | `DeletedAt` on the Hero image: a trashed photo is hidden from the Hero (slides, upload by hash, renderer) and shown in the library trash; Restore clears it. After 7 days the cleanup turns it into retired files (removed immediately) and removes the row. Uploading the same file again restores it. The trash period is `Media:TrashDays` (7). | Another period: the setting; no trash: delete straight to retired files. | `HeroImage.DeletedAt`, `HeroMediaCleanup`, `MediaOptions.TrashDays` |
| 32 | **Migration of `HeroImages`** (decision 13): the plan and the safeguards. | Designed in `inception/application-design/migration-plan.md` (back-up, rollback, verification, test-only rollout). The additive columns of this round (`OriginalFileName`, `DeletedAt`, `LastUsedAt`) are copied with the rest. Not run anywhere until SLS-Main has been told and agrees to the test deploy. | n/a | `migration-plan.md` |
### Status of the assumptions (2026-11-17)
- **Decided by Bryan** (second round, table above): 3, 4, 7, 8, 10, 12, 13, 21.
- **Confirmed by Bryan "as designed"**: 1, 2, 5, 6, 9, 11, 14, 15, 16, 19, 20, 26, 27, 28.
- **Still assumptions** (not put to him separately): 17 (language), 18 (what phase A contained, now overtaken), 22 (selectability), 23 (performance), 24 (ASF data), 25 (use definitions); and the older rows 18 to 25 above. Assumptions 29 to 32 follow from his decisions.
- Assumption 12 now reads: there IS a trash (decision 12), the earlier "no trash in phase A" no longer applies. Assumption 10: deleting a used photo is possible after a second confirmation (built). Assumption 21: the original file name is stored from now on (built).
| 33 | **Where the copy runs and what it copies** (built 2026-11-17). | A new module `Modules.Media` owns the tables (`MediaAssets`, `MediaUses`); modules offer their data through `IMediaMigrationSource` so the library module does not depend on the Hero. The copy is a verified mirror in one transaction behind `Media:Library:CopyOnStartup` (default false). The use of a hero slide carries both crops (`wide`, `tall`) of its photo as JSON; its set hash is the photo's current set hash. | A copy job triggered from the admin instead of start-up: easier to time, needs an endpoint and a button. | `Modules.Media/Services/MediaLibraryCopier.cs`, `HeroMediaMigrationSource` |
| 34 | **Naming**: entity `MediaAssetUse` (table `MediaUses`), because `MediaUse` already names the read model in Core. | As built. | Rename the table or the record: a small migration. | `Modules.Media/Data` |
| 35 | **Test deploy without a separate database dump** (decided on assumption by SLS-Main, 2026-11-17, Bryan away). | The Raspberry Pi test host cannot be dumped by SLS-Main; the test data can be rebuilt with the seed scripts and both database changes of the branch (`AddMediaLibraryColumns`, the empty Media tables) are additive, so the test deploy goes ahead without a dump. The copy stays OFF until Bryan agrees. | Take a dump on the Pi before the deploy (and certainly before the copy is switched on). | `migration-plan.md`, section "Test host" |
| 36 | **Choose from the library in a hero slide** (built 2026-11-17 at Bryan's request, before the migration). | Each slide has "Choose from library" next to its photo: the shared `ImagePicker` lists the library photos of the modules that can be chosen (now the hero's own photos, also those in no slide, never the trash) and a new photo can be uploaded on the spot with the hero's own upload (same checks, limits and background processing). Choosing only sets the slide's existing image id (no data model change). A photo that is already in another slide can be chosen again: it is the same photo, so its **crop is shared by the slides that use it** (the crop belongs to the photo in the hero today; a crop per slide comes with the library's own use records). | A separate crop per slide now would need the use records of phase 2 (or a copy of the photo). | `features/hero/components/LibraryPickerDialog.tsx`, `HeroPage.tsx` |
| 37 | **Removing from the trash for good** (Bryan, 2026-11-17). | `POST media-library/purge {ids}` (at most 100) or `{all:true}` (the server empties the whole trash in batches). Only photos that are in the trash and used nowhere are removed; the module checks it again and answers per photo (`purged`, `notInTrash`, `inUse`, `failed`). The original and the cut set go through `IMediaStore`; a file another photo still shares stays. The UI asks a clear confirmation that says it cannot be undone and names the number (and the size for the whole trash); "Empty the trash" is disabled when the trash is empty. No separate waiting period. | A short undo window for a purge: not built (the trash itself is the undo). | `MediaLibraryService.PurgeAsync`, `HeroImageService.PurgeAsync`, `PurgeDialog` |
| 38 | **A new crop applies at once, without saving the hero** (Bryan, 2026-11-17; replaces Hero assumption 1 of 2026-11-16, which said a focus change only takes effect when the hero is saved). | The focus dialog's Apply sends the crop at once (`PUT hero/images/{id}/focus`); the server cuts the new variants in the background and the photo switches to them when they are complete, so what is live changes only then, without another Save. The photo shows "Wordt verwerkt…", a 0-100% bar and the percentage on itself (no spinner); the upload keeps its own display. The counter "x of y processed" counts the current upload batch only. | Back to applying only on Save: restore the focus edits kept locally in `HeroPage`. | `HeroImageService.SetFocusAsync`, `HeroPage.applyFocus`, `RecutThumbnail` |
| 39 | **Crop PER USE, not per photo** (Bryan, 2026-11-17: a photo on two slides can have its own crop on each slide). | Decided, **not built yet**: it is too large and risky for the hero as it is today, because the cut sets, their set hash and the public output all hang on the photo (`HeroImage.SetHash`, `Variants`), so a crop per slide means a set per slide. The smallest safe step is built instead: a photo may be chosen for several slides, the crop is shared and the slide says so ("This photo is in more slides; the crop applies to all of them"). Design of the rest in `inception/application-design/per-use-crop.md`: it comes with phase 2 of the migration, because the library's own use records (`MediaUses.Crops`, `MediaUses.SetHash`) are where a crop per slide lives and the renderer then cuts a set per distinct crop. No public address or set hash changes until then. | An additive nullable focus on the slide (x, y, zoom) that overrides the photo's default focus, with a set per (photo, crop) and the public hero choosing the slide's set: possible without the library tables, but it rebuilds the renderer and the public mapping of the hero first; then phase 2 would have to move it again. | `HeroSlide`, `HeroImageService.RenderNextPendingAsync`, `HeroMapping` |
| 40 | **Switching the copy on at the test hosts without access to the Pi** (Bryan, 2026-11-17: the copy may run on test). | The deploy workflow has a new input `media_library_copy` (unchanged, on, off; dispatch input of the CI workflow, passed to the SLS test and ASF test deploys). A step edits ONLY the key `Media__Library__CopyOnStartup` in `<deploy_path>/shared/env` over the deploy account's SSH access (refuses any environment that is not `test`, accepts only on, off or unchanged, never prints the file), before the service restart; after the restart a step shows the journal line `Media library copy verified: N photos and M uses`. `off` removes the key again. | Set the variable by hand in `shared/env` on the Pi (needs a shell there). | `.gitea/workflows/deploy-scp.yaml`, `continuous_integration.yaml` |
| 41 | **The picker has a single and a multiple mode** (Bryan, 2026-11-17). | `ImagePicker` takes `mode="single"` (default, radio group, used by the hero slides) or `mode="multiple"` (checkboxes, several photos, several files per upload, ready for the gallery). Both use the same upload checks. | n/a | `ImagePicker.tsx` |
| 42 | **One progress pattern for upload, processing and a new crop** (Bryan, 2026-11-17, after seeing it on test). | A shared `ProcessingProgress` (text "Wordt verwerkt…", one 0-100% bar, the percentage, no spinner, no step counts) is used on every photo and for the batch. The batch bar covers upload and processing together; there are no byte counts from the upload, so a photo's percentage is staged: waiting 0, uploading 15, uploaded 30, then 30-100 from the server's processing steps. A new crop uses the full 0-100 from its steps. The counter "x van y verwerkt" stays per batch. | Real upload byte progress (needs XHR progress in the API client). | `features/media/components/ProcessingProgress.tsx`, `lib/photoProgress.ts`, `hero/components/ProcessingStatus.tsx` |
| 43 | **"Slide toevoegen" replaces the per-slide library button** (Bryan, 2026-11-17, after seeing it on test; replaces assumption 36's per-slide button). | The per-slide "Kies uit bibliotheek" is gone. The existing add button is "Slide toevoegen" and opens the shared picker: choose a library photo or upload one on the spot (it also lands in the library, ML-17); one photo makes one NEW slide. A slide's photo cannot be changed or replaced: remove the slide and add another. Dropping files on the section still adds one slide per file (same upload as before). The crop per slide stays a goal (phase 2). | Keep a per-slide change button: Bryan said no. | `HeroPage.addSlideWithPhoto`, `LibraryPickerDialog` |
| 44 | **Tiles or list in the library** (Bryan, 2026-11-17). | The library and the trash show the photos as tiles (grid of thumbnails, selectable, same usage and links) by default, with a switch Tiles / List next to the filters. The choice is remembered in the browser (`localStorage`, guarded; it falls back to tiles). The clean-up dialog keeps its list. The picker already is a grid. | Remember the choice on the server per user: needs a user-settings store. | `PhotoSelectionList` (`layout`), `lib/layoutPreference.ts`, `MediaLibraryPage` |
| 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` |
| 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` |
| 51 | **"Controle bibliotheek" panel in the library screen** (SLS-Main for Bryan, 2026-11-17). | A small panel under the storage meter, for administrators (the whole screen is admin only), asks `GET media-library/read-check` only when its button is clicked and says in plain words (nl/en) whether the library tables match each module or lists the differences, plus the state of the three switches (copy, write-through, reading off/compare/on; the response now carries `copyOnStartup` and `dualWrite`). It changes nothing. Always shown, not only on test. | Show it only when the read switch is not off: Bryan could then not check before switching. | `LibraryCheck.tsx`, `MediaLibraryController.ReadCheck`, `IMediaLibrarySwitchState` |
| 52 | **Phase 3a: the library tables hold what the hero needs to publish** (2026-11-18). | Additive migration `AddHeroPhotoColumns` of the Media module: `MediaAssets.SetHash`, `MediaAssets.Variants` (the module's own JSON), the wide/tall overrides of the photo's crop, and `MediaUses.Variants`. The copy, the write-through and the verification fill and compare them; the read check shows a difference in them. Nothing reads them to publish yet (that is 3b). | Store the variants relationally: more tables for no gain while only the hero publishes from here. | `MediaEntities`, `MediaLibraryCopier`, `HeroMediaMigrationSource` |
| 53 | **Phase 3b maps the hero's photos onto the library table, behind a switch, with HeroImages kept as a copy** (2026-11-18). | `Media__Library__HeroPhotosInLibrary` (default off, test only via the workflow input `media_library_hero_photos`). On: the hero's photo entity is the library's `MediaAssets` rows of module `hero`; `HeroImages` is mirrored after every change so the switch can go back; the application refuses to start if the library lacks a photo or its set/variants; the foreign key slide -> `HeroImages` is dropped by a reversible Hero migration. No data is deleted in 3b; dropping `HeroImages` is step 3c. | Move the data in one go and drop the old table at once: cannot be switched back. | `HeroDbContext.ConfigureStorage`, `HeroLegacyImageMirror`, `HeroPhotoStorageGuard`, migration `DropSlideImageForeignKey` |
| 54 | **3c is built on its own branch and drops `HeroImages` behind a guard** (2026-11-18). | `feature/media-library-phase3c`: the photos always live in `MediaAssets`; the switches, copier, write-through, reader, mirror, read-check endpoint and the "Controle bibliotheek" panel are gone (Bryan: keep the panel until 3b is verified, then remove it in 3c); migration `DropHeroImagesTable` is destructive and only runs when the library holds every photo (guard before the migrations), `Down` gives the empty table. Not deployed before 3b is verified on test, a fresh restore point exists and SLS-Main has been told the exact migration. `MediaUses` stays unused in the database. | Keep the migration aids for another release: more code to carry for no use. | `HeroImagesDropGuard`, `DropHeroImagesTable`, `HeroDbContext` |
| 55 | **Production gets 3c in one release: the start-up copies `HeroImages` into the library right before the drop** (2026-11-18). | `HeroImagesDropGuard.PrepareAndVerify` applies the hero's migrations up to the drop, asks the Media module (`IMediaLibrarySchema`) to migrate its tables, copies the photos into `MediaAssets` in one transaction (update differing, insert missing, never delete) and then runs the strict check; a refusal throws `ModuleStartupException`, which the module orchestrator now rethrows so the application really does not start (before, every module error was logged and ignored). `MediaUses` are not copied (nothing reads them after 3c). | Staged road on production (phase 2 with the copy, 3b switch, then 3c): more releases and a period with the switches; the copier code would have to stay on master. | `HeroImagesDropGuard`, `IMediaLibrarySchema`, `ModuleOrchestrator`, `production-rollout.md` |