From 7c94be57437ecdc9cadeb95bc4c26a25040163a9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 17 Jun 2026 22:53:32 +0300 Subject: pn0 decouple stats from album internals Stats reached directly into album-module internals: the private global ALBUM_VIEW_PAGE_BY_PHOTO and the EXIF cache reader cached_photo_identify_output. Introduce a clean boundary, behaviour and generated HTML byte-identical. - Promote the EXIF identify cache primitive (cached_photo_identify_output plus its private helpers photo_cache_signature and print_cached_photo_identify_output) out of album-metadata.source.sh into a new shared src/lib/metadata-cache.source.sh, sourced before both album and stats (right after metadata-label in LIB_SOURCES). It is a low-level metadata primitive used by both consumers, so it no longer belongs to album internals. Signature/behaviour unchanged. - Add album_view_page_for_photo accessor in album-render.source.sh as the documented public API; keep ALBUM_VIEW_PAGE_BY_PHOTO as the album's private backing store. stats-filter-album.source.sh now calls the accessor instead of indexing the global, so a change to album page naming/caching stays contained in the album module. - Add test_album_stats_decoupling_boundary asserting the accessor returns the backing-store value and that the assembled bin/shuriken keeps the cache primitive in the shared module and no longer indexes the global from the stats filter section. Existing stats/album tests unchanged. Verified: 3-image fixture (STATS_PAGE=yes, fixed seed) diff -r of stashed original vs new build is byte-identical across all 47 dist files (only the inherent generated_at timestamp normalized). just test, just shellcheck, just check-generated and git diff --check all pass. Co-Authored-By: Claude Opus 4.8 --- src/lib/stats-aggregate.source.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/stats-aggregate.source.sh') diff --git a/src/lib/stats-aggregate.source.sh b/src/lib/stats-aggregate.source.sh index af047c2..6b30f62 100644 --- a/src/lib/stats-aggregate.source.sh +++ b/src/lib/stats-aggregate.source.sh @@ -660,7 +660,8 @@ accumulate_photo_stats() { } # Iterate the album's incoming photos, read each one's cached identify output via -# album.source.sh's cache helper, and aggregate it into the STATS_* globals. +# the shared metadata-cache.source.sh primitive (task pn0), and aggregate it into +# the STATS_* globals. # This is the entry point the render tasks call before reading the counters. collect_photo_exif_stats() { local photo -- cgit v1.2.3