Meddy files 5 source e22757f

Meddy circular recognition photos

Owner-tested feedback changes the shared recognition image to circular aspect-fill presentation.

At a glance

  • One shared view change covers 24/32/48-point thumbnails and 160/220-point editor, detail and dose images, plus routine medication call sites.

  • Aspect-fill preserves proportions and crops only the displayed view. Existing stored JPEG data, importer, thumbnail cache and profile ownership remain unchanged.

  • Names, accessibility labels/identifier and Add/Replace/Remove/Save/Cancel behavior remain intact.

Verdict

Ready to push

Four source reviews found no blockers. Both targeted dark/light photo UI journeys, strict SwiftLint and whitespace passed. All 12 native captures were viewed to confirm circular images and readable names/controls. No broad suite, merge or installation ran.

Review findings

1 raised · 1 fixed · 0 skipped

Jump to findings →

Tests

Pass rate: 100% (2 of 2)

New tests: 0

Diff coverage: n/a

Jump to tests →

Three-level explanation

Medication photos now appear round everywhere they already appeared. The circle shows a centered part of the photo; the saved image stays intact. Photo editing works as before.

MedicationPhotoView changes scaledToFit to scaledToFill and uses Circle for its background and clipping shape. All callers retain their existing sizes and layout. The unreadable-image fallback also uses the circular background. No separate renderers or data transforms were added.

A fixed-size Circle anchors an aspect-filled photo overlay; circle clipping preserves the image ratio and masks only its display. The same circle covers fallback content. Apple’s accessibilityRepresentation exposes the intended circle geometry with the existing loaded/unavailable label, image trait and identifier, avoiding SwiftUI’s oversized aspect-fill accessibility frame. Existing bounded thumbnail decoding and cache remain byte-identical; only the final SwiftUI display is cropped. Accessibility labels/identifier and parent care labels remain untouched. Native UI checks exercise existing profile isolation and photo draft transactions in both appearances; pixel review independently confirms shape and composition.

Completeness assessment

All shared iPhone call sites receive circles. Today, PRN, library, detail, editor and dose screenshots were reviewed in both appearances. Routine photo call sites are covered by shared-component source review, without a separate routine photo screenshot claim. Real photos, personal stores, CloudKit and device installation were not exercised.

Important changes — detailed

Use one circular presentation throughout

Meddy/Meddy/Features/MedicationPhoto.swift

Why it matters. Apply the owner’s preference consistently without duplicating photo rendering or changing storage.

What to look at. MedicationPhotoView.body

Takeaway. Keep visual cropping in the shared view and preserve original image bytes.
Rationale. Owner tested the restored images and explicitly requested round images.

Key decisions

Display-only center crop

Aspect-fill and circle clipping avoid distortion; no persistent photo crop or importer/cache change is needed.

Expose the circular image to accessibility

The photo is noninteractive. A bounded accessibility representation preserves its image role/name and matches the visible circle, while the loaded aspect-filled buffer remains a visual overlay.

Review findings

SeverityAreaFindingResolution
minorCircular photo accessibility boundsThree earlier two-appearance attempts reported the uncropped80:60image width293.3pt for a220ptcircle and failed unchanged frame assertions.A bounded circular accessibility representation preserves the existing label, image trait and identifier. Both unchanged journeys now pass; earlierfailed receipts remain separate and are not counted as accepted. The detail screenshot was moved before its unchanged frame assertion to retain direct diagnostics.

Tests

Source: local run at 2026-10-08T22:15:27.238917+00:00 · snapshot 299076a6a032b06a3cdd1ac4d1d7fc3419b53023

Baseline: none

Execution: passed · JUnit: 1 file · Coverage: none · Baseline: absent

Coverage scope: as the project configures it

Totals: 2 passed · 0 failed · 0 skipped · 0 errored · 0 flaky

New and removed tests

Derived by declaration name, from the diff (no baseline run).

No new or removed test declarations.

Blast radius

Files that import a changed file on the left, changed files in the centre, files a changed file imports on the right. Snapshot working-tree against base 100e77b01ea794ed8b35c59445bc56f6ade5f4e0.

addedmodifieddeletedrenamedunchangedcollapsed package group or +N more⚑N test files with an edge to the node

Per-file diffs

5 files: 2 code · 3 docs. Click to expand.

Code (2)

Meddy/Meddy/Features/MedicationPhoto.swift Modified
diff --git a/Meddy/Meddy/Features/MedicationPhoto.swift b/Meddy/Meddy/Features/MedicationPhoto.swiftindex 61c8c7e..c9d3e0b 100644--- a/Meddy/Meddy/Features/MedicationPhoto.swift+++ b/Meddy/Meddy/Features/MedicationPhoto.swift@@ -89,19 +89,23 @@ struct MedicationPhotoView: View {   var size: CGFloat = 48   var body: some View {     if let data {-      Group {-        if let image = MedicationPhotoCache.image(data, side: size > 100 ? 768 : 144) {-          Image(uiImage: image).resizable().scaledToFit()-            .accessibilityLabel("Recognition photo for \(name)")-        } else {-          Image(systemName: "photo.badge.exclamationmark").accessibilityLabel(-            "Recognition photo unavailable for \(name)")+      let image = MedicationPhotoCache.image(data, side: size > 100 ? 768 : 144)+      Circle().fill(.quaternary)+        .frame(width: size, height: size)+        .overlay {+          if let image {+            Image(uiImage: image).resizable().scaledToFill()+          } else {+            Image(systemName: "photo.badge.exclamationmark")+          }         }+      .clipShape(Circle())+      .accessibilityRepresentation {+        Circle().frame(width: size, height: size)+          .accessibilityLabel(image == nil ? "Recognition photo unavailable for \(name)" : "Recognition photo for \(name)")+          .accessibilityAddTraits(.isImage)+          .accessibilityIdentifier("medicationRecognitionPhoto")       }-      .frame(width: size, height: size).background(-        .quaternary, in: RoundedRectangle(cornerRadius: 8)-      )-      .accessibilityIdentifier("medicationRecognitionPhoto")     }   } }
Meddy/MeddyUITests/MeddyPhotoUITests.swift Modified
diff --git a/Meddy/MeddyUITests/MeddyPhotoUITests.swift b/Meddy/MeddyUITests/MeddyPhotoUITests.swiftindex 67996e9..3283d06 100644--- a/Meddy/MeddyUITests/MeddyPhotoUITests.swift+++ b/Meddy/MeddyUITests/MeddyPhotoUITests.swift@@ -40,9 +40,9 @@ final class MeddyPhotoUITests: XCTestCase {     row.tap()     let photo = app.descendants(matching: .any)["medicationRecognitionPhoto"].firstMatch     XCTAssertTrue(photo.waitForExistence(timeout: 5))+    capture("detail-photo-" + appearance, app: app)     XCTAssertEqual(photo.frame.width, 220, accuracy: 1)     XCTAssertTrue(photo.isHittable)-    capture("detail-photo-" + appearance, app: app)     app.buttons["Change recognition photo"].tap()     reveal(app.buttons["Replace photo"], app: app)     XCTAssertTrue(app.buttons["Replace photo"].waitForExistence(timeout: 5))

Docs (3)

CHANGELOG.md Modified
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 40538d3..27bfcdb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,7 @@ ## Unreleased  ### Changed+- Present medication recognition images consistently as circles, using a display-only aspect-fill crop without changing stored photos or photo controls. - Recreate the Meddy redesign in native SwiftUI with dark/light lavender tokens, purpose cards, focused Today actions, searchable medication lists, routine progress, grouped editors and avatar-based profiles. Preserve existing care history, frozen sessions, explicit timer continuation and dose-limit semantics without a schema migration. - Restore medication recognition photos throughout the redesigned iPhone care screens, bring the detail image and Add/Replace/Remove editor controls forward, and retain existing photo storage and Save/Cancel behavior.
docs/meddy-design.md Modified
diff --git a/docs/meddy-design.md b/docs/meddy-design.mdindex f6091b5..2d3f7ef 100644--- a/docs/meddy-design.md+++ b/docs/meddy-design.md@@ -1607,7 +1607,7 @@ User-authorized autonomous feature (Idea/feature `48A4C35A-BB73-4375-9B7D-0AAEB9 - Import supported image data up to **20 MiB**, downsample using ImageIO with orientation applied, and re-encode pixels as **JPEG**, at most **1024 pixels** on the longest edge and **350 KiB** stored. Try quality 0.82, 0.65 and 0.5, then smaller 768/512-pixel bounds if needed; fail visibly if the limit still cannot be met. Animated/Live images use a still first frame. Do not retain the original, source EXIF/GPS or asset identifier. Transparent areas are composited onto white in sRGB; animation is not retained. ImageIO-generated color-space/pixel-dimension tags are allowed, but source EXIF/GPS is removed. - Keep the resulting optional `recognitionPhotoData` on the existing Medication SwiftData model, in the same app-private local store and configured private CloudKit integration. This additive nullable field requires no new account, entitlement or signing changes. Isolated tests never touch live CloudKit. Actual sync/provisioning acceptance remains unverified; no schema publication or portal action is part of this feature. - Add/replace/remove in the medication editor operate on an unsaved draft. Save writes the photo and other valid medication/schedule changes in the existing single transaction. Cancel or a failed save leaves persisted data intact; failed import keeps the previous draft and reports a retryable error. Disable Save during import. Ignore late results from an obsolete or removed selection. Re-selecting the same asset can retry. A photo whose draft value is unchanged does not overwrite a newer model value when other fields are saved.-- Show an aspect-preserving thumbnail in iPhone medication lists/Today, routine medication selection and ordered medication steps. Show a larger image in medication details and detailed logging. Missing/unreadable image data falls back without preventing name-based recognition or recording. A bounded thumbnail cache uses at most 64 entries and approximately 12 MiB cost; it does not create extra persistent photo files.+- Show circular aspect-fill recognition images in iPhone medication lists/Today, routine medication selection and ordered medication steps, with larger circles in medication details, the photo editor and detailed logging. Preserve the image ratio without distortion; center crop only the displayed view. Stored JPEG bytes and import/cache behavior remain unchanged. Missing/unreadable image data falls back without preventing name-based recognition or recording. A bounded thumbnail cache uses at most 64 entries and approximately 12 MiB cost; it does not create extra persistent photo files. - Archiving retains the current photo. Replacement/removal updates only the medication's current photo and never changes medication ID, administrations, dose snapshots, routine plans, history or timestamps. Historical actions do not embed photos; the shown image is the current recognition image. Persistent app storage retains only the current image; the bounded volatile thumbnail cache can hold recent thumbnails until eviction. framework/cloud histories and backups may retain older bytes, so removal is not a guarantee of immediate erasure from backups. - This bounded first implementation displays photos on **iPhone**. Photos are excluded from WatchConnectivity DTOs/outbox, reminders and Markdown consultation exports. No physical Watch work or phone installation is implied. @@ -1705,3 +1705,5 @@ Owner feedback on missing photos restores the existing §23 recognition surfaces The owner approved optional medication prescription date (“prescribed at”), free-form doctor/clinic (“prescribed by”), user-entered supply-duration days and repeats remaining. The [approved plan](meddy-prescription-details-plan.md) defines validation, UI, correction and export. Civil dates retain their entered day across time zones. Supply duration is metadata, not an inferred course, remaining stock, countdown or dose rule. Blank means not recorded; zero repeats is an explicit value. A manual −1 repeat action on medication detail stops at zero and offers a revision-guarded latest Undo; direct editing/clearing remains available.  All medication modes support these fields, captured to the canonical medication/profile. A profile switch cannot redirect Save/decrement/Undo; owner archive/restore invalidates stale actions. Untouched prescription fields preserve newer values, while conflicting changed fields require reconciliation. Include recorded prescription fields in the existing selected-profile Markdown summary, reusing text escaping. No prescription history ledger, automatic refill scheduling, stock tracking, clinical warning, Watch prescription action or change to real care events is added.++Owner-tested feedback after PR #4 requests round recognition images. The shared `MedicationPhotoView` now fills a circular mask at each existing size, consistently covering thumbnails, detail/dose/editor previews and routine medication images. This is a display-only crop; names, accessibility labels, photo controls and original stored image data remain intact.
docs/meddy-implementation-plan.md Modified
diff --git a/docs/meddy-implementation-plan.md b/docs/meddy-implementation-plan.mdindex 60c852b..b1541e3 100644--- a/docs/meddy-implementation-plan.md+++ b/docs/meddy-implementation-plan.md@@ -332,3 +332,7 @@ Simulator compilation, **26 focused domain tests across four suites** (nine pres Domain checkpoint: `1b59fee`; final UI checkpoint: `6f4fba4`, differing only in a UI test locator. Later documentation does not change tested production source. Scoped local review found missing medication archive/reactivate revision invalidation; the narrow fix and dedicated regression pass. Earlier UI failures involved virtualized controls, keyboard collection/focus/field positioning and native menu-label hit testing. Explicit form targeting and bounded positioning/visible coordinate targeting corrected the tests without removing their saved-value assertions. Failed receipts remain preserved separately.  The fixture predates profile/wake additions; exact installed-store and live CloudKit acceptance are not claimed. Existing simulator publication/accessibility and baseline photo actor-isolation warnings remain. No unrelated full UI run, Watch runtime test, live data operation, phone install, signing/account change, publication or Transit write occurred. Build groups are drained; heavy lane released. These statements describe the focused-verification checkpoint; the subsequent phone installation and current publication approval are recorded in the prescription plan. Pending ticket intent remains local until Transit cleanup.++## Circular recognition-photo presentation++Following owner-tested feedback, the shared `MedicationPhotoView` uses aspect-fill inside a circular mask at the existing 24/32/48/160/220-point sizes. Its circular background also covers the unreadable-photo fallback. This applies to all current iPhone call sites, including Today/library, detail, photo editor, detailed dose logging and routine medication selection/steps. There is no stored image crop, model/import/cache change, new permission, photo-control change or Watch deployment. Both existing targeted dark/light photo UI journeys passed at clean `299076a`, command exit 0 in 176.033 seconds. They retain every profile/draft/Save/Cancel/220-point detail/160-point dose assertion. All 12 native captures were viewed: Today/PRN, library, detail, editor and dose logging in each appearance; circle edges and centered aspect-fill are visible, with readable names and reachable photo controls. Routine call sites use the same shared component and were source-reviewed; no separate routine-photo screenshot acceptance is claimed. Three earlier two-appearance attempts failed because SwiftUI exposed the uncropped 80:60 image buffer’s 293.3-point width for a 220-point circle. The final component uses Apple’s [accessibility representation API](https://developer.apple.com/documentation/swiftui/view/accessibilityrepresentation%28representation%3A%29) to expose the actual circular size, existing loaded/unavailable name, image trait and identifier; source review confirms that this is appropriate for the noninteractive photo. The existing detail capture moved before its unchanged frame assertion to retain direct diagnostics. Earlier failed runs remain recorded separately, and none counts as acceptance. Strict SwiftLint passed 111 files with zero violations; whitespace passed. Four source-review perspectives and the accessibility follow-up are clean. Stored data/import/cache and ownership source are unchanged. No broad suite, real-photo/store operation, signing/account change, merge, physical Watch work or installation ran. Assigned simulators were restored to Shutdown, owned groups drained and the heavy lane released.

Things to double-check

Actual screenshot review

Viewed 12 retained native images: Today, PRN, library, detail, editor and dose logging in light/dark. Circular edges are visible; names and controls remain readable; photo editor controls retain their existing position. Original rectangular/letterboxed presentation is intentionally superseded by owner feedback.

Verification scope

The owner requested targeted UI verification for this small visual change. Existing two-appearance tests passed with exit 0 on clean 299076a. Later changes are documentation only. Strict SwiftLint passed 111 files with zero violations. No broad UI rerun, domain suite, device install, signing setting or physical Watch deployment changed.