Technical Debt — Image Pipeline Reliability Gaps

By Engineering Team•September 22, 2026•4 min read
Metadata Details
System Media Access & Asynchronous Image Transcoding Pipeline
Document ID TD-2026-IMG-001
Author Engineering Team
Status Open

This document tracks known implementation gaps in the image processing pipeline as first-class, ongoing debt items — not as a passing “not implemented” note inside the architecture or requirements docs. SR-001 and the architecture doc link here rather than restating the gap detail, so the requirement text itself doesn’t quietly read as an already-met guarantee.


TD-01 — No bounded retry policy or dead-letter queue on the pipeline’s Pub/Sub subscriptions

  • Status: Open
  • Severity: Medium — no data loss (the raw upload stays in the Staging Bucket independent of processing outcome, per NFR-05), but a poison message is never quarantined.
  • Affected component: content-processor’s Pub/Sub subscriptions
  • Evidence: development/firebase/functions/init/init-pubsub.js — the product-image-uploads, product-image-processed, and product-image-removed topic/subscription entries carry no retryPolicy, maxDeliveryAttempts, or dead-letter topic. The migration pipeline’s subscriptions in the same file already configure a bounded maxDeliveryAttempts: 15 plus a DLQ topic — this pipeline doesn’t follow that established pattern.
  • Impact: A single malformed or unprocessable event (a corrupt image, a transform content-processor can’t complete) redelivers indefinitely instead of landing in a DLQ after a fixed number of attempts, consuming processing capacity forever rather than being quarantined for manual inspection.
  • Remediation direction: Mirror the migration pipeline’s pattern — add maxDeliveryAttempts and a dead-letter topic for all three subscriptions in init-pubsub.js.
  • Related requirement: SR-001 NFR-05

TD-02 — No production CDN cache policy; only a local dev stand-in exists

  • Status: Open
  • Severity: Medium — doesn’t affect correctness, but SR-001’s ≥95% cache-hit-ratio NFR has nothing backing it in production.
  • Affected component: CDN edge / Cloud CDN
  • Evidence: development/cdn-edge/squid.conf:53 configures a refresh_pattern for image file extensions backed by a 64MB in-memory cache (squid.conf:47) — a local Squid proxy standing in for Cloud CDN. development/cdn-edge/CLAUDE.md’s own Signature Scheme section states production Cloud CDN URL signing is unimplemented and is separate follow-up work.
  • Impact: The dev Squid cache is not a substitute for a production Cloud CDN cache policy; cache-hit-ratio behavior in production is currently unverified and unconfigured.
  • Remediation direction: Configure a production Cloud CDN cache policy (signed-URL caching, TTL, invalidation on re-processing) matching or exceeding the dev Squid stand-in’s behavior, then validate the ≥95% target against real traffic.
  • Related requirement: SR-001 NFR-04

TD-03 — Mobile resolves all presigned image URLs upfront; no scroll-triggered pagination

  • Status: Open
  • Severity: Low-Medium — no correctness issue, but a product detail screen with many gallery images front-loads presigned-URL requests and bandwidth for images the user may never scroll to.
  • Affected component: ui-application (Flutter) — lib/core/services/media_service.dart
  • Evidence: resolveDownloadUrls(List<String> rawPaths) is called once per screen/section load with the full path list — see product_controller.dart, shop_controller.dart, cart_controller.dart. No scroll-triggered prefetch-ahead or ScrollController/loadMore-driven resolution exists in lib/features/dashboard/shop/products (confirmed via repo-wide search — no matches for prefetch/precache/loadMore/onScroll in those paths).
  • Impact: Every image URL for a screen is resolved immediately on load rather than incrementally as the gallery scrolls — unnecessary upfront request volume and signed-URL issuance for images that may never be viewed.
  • Remediation direction: Resolve presigned URLs incrementally as the gallery scrolls (paginate resolveDownloadUrls calls, or prefetch one screen-width ahead) instead of one upfront batch call per screen load.
  • Related requirement: SR-001 FR-11

TD-04 — No lifecycle/retention policy on the Staging Bucket

  • Status: Open
  • Severity: Low — no correctness or data-loss risk, but raw uploads accumulate indefinitely, growing storage cost and surface area over time.
  • Affected component: Staging Bucket (GCS)
  • Evidence: development/firebase/functions/init/init-storage.js only calls bucket.exists()/creates the bucket — no lifecycle or expiration rule is configured. No .tf files exist anywhere in the repo (find . -iname "*.tf" returns nothing), so no Terraform-managed lifecycle rule exists either. No deletion/cleanup logic was found in content-processor, media-access-service, or firebase-function for staging objects after processing completes.
  • Impact: Every raw upload — including abandoned uploads that never get validated, and uploads already transcoded and no longer needed in staging — stays in the bucket forever, growing storage cost unbounded.
  • Remediation direction: Configure a GCS lifecycle rule (age-based deletion, e.g. 24–48h after upload) on the Staging Bucket, or have content-processor explicitly delete the staging object once transcoding succeeds and all derived variants are persisted.
  • Related requirement: SR-001 NFR-08