Files
slp-modular-cms/aidlc-docs/features/media-library/assumptions-and-open-questions.md
T
SluijsensandClaude Sonnet 5.5 7e2e6a430f
Continuous Integration / config-sls (pull_request) Successful in 7s
Continuous Integration / config-asf (pull_request) Successful in 7s
Continuous Integration / changes (pull_request) Successful in 26s
Continuous Integration / compile-sites (pull_request) Successful in 1m50s
Continuous Integration / backend-build (pull_request) Successful in 1m53s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m53s
Continuous Integration / frontend-prepare (pull_request) Successful in 2m18s
Continuous Integration / frontend-build (pull_request) Successful in 56s
Continuous Integration / frontend-lint (pull_request) Successful in 2m20s
Continuous Integration / frontend-test (pull_request) Successful in 2m31s
Continuous Integration / backend-test (pull_request) Successful in 3m7s
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
Mediabibliotheek fase A: read-only gebruikscontract, Hero-provider, opruimselectie en selectiecomponenten
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 13:47:10 +01:00

9.7 KiB

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? 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? 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. 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? 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? 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? 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? 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. 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. 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. 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? 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)? 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). 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? 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? 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. 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". 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. 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. 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). Asked of the ASF session through SLS-Main (2026-11-17); until then the design only names "tiles with a fixed set of ratios per page". Each answer only adds use definitions. Application design section 4