Show a positive remaining count on the appointment screen and exported Markdown.
Share for appointment displays Repeats left: x only for positive counts.
The shared Markdown export omits zero and unset counts while preserving other prescription metadata.
Stored zero, detail display, decrement/Undo, profile filtering and repeat accounting are unchanged. No warning is added.
Ready to push
Four source review perspectives found no blockers. 17 focused native domain test declarations and 1 affected UI journey passed, plus strict lint and whitespace. No installation or merge.
The appointment list now tells you how many repeats are left when the count is above zero. The same rule applies to the shared document.
Positive repeat information is available for your appointment without rows for zero or unrecorded counts.
This controls what is shown. It does not alter the stored count or use up a repeat.
CurrentMedicationsView adds a conditional Text row after the schedule. ConsultationMarkdown adds the same positive-count condition around its existing prescription row. Both keep their existing active-medication and selected-profile filtering.
Two simple rendering guards are clearer than adding a new abstraction. Existing prescription services and persistence are untouched. Focused tests exercise export omission, input preservation and positive/zero rendered rows.
The nullable canonical repeatsLeft field remains unchanged; nil and zero retain distinct stored meanings. Each presentation boundary emits the field only after optional binding and a >0 check. No mutation, accounting callback or derived persistence is introduced, and export formatting retains UTF-8 and escaping.
The parameterized export test covers nil, 0, 1 and 3. Existing owner-isolation and prescriber escaping checks now assert zero omission. The prescription UI journey visits appointment sharing with two repeats and again after decrementing to zero, then continues its existing Edit/Cancel/profile isolation checks.
Both requested appointment surfaces are implemented. Focused domain and rendered UI checks pass; no claim is made about a full suite, live personal data, CloudKit or deployment.
Meddy/Meddy/Features/TodayRoutineSections.swift
Why it matters. Expose the owner-requested count while omitting zero/unset.
What to look at. CurrentMedicationsView
Meddy/Meddy/Features/ConsultationMarkdown.swift
Why it matters. The screen and document agree on which repeat values are shown.
What to look at. ConsultationMarkdown.make
Meddy/MeddyUITests/MeddyPrescriptionUITests.swift
Why it matters. The existing workflow reaches zero through real decrement actions and verifies the appointment row disappears.
What to look at. checkAppointmentRepeats
Zero remains valid stored/detail metadata and decrement/Undo retains its behavior. The appointment screen and shared Markdown alone use the positive guard.
The system ShareLink remains explicit and no document is sent automatically.
Source: local run at 2026-10-09T11:27:53.716189+00:00 · snapshot 004d26d8eecc6ab3fa23cd83e24e6129902ab1ee
Baseline: none
Execution: passed · JUnit: 2 files · Coverage: none · Baseline: absent
Coverage scope: as the project configures it
Totals: 18 passed · 0 failed · 0 skipped · 0 errored · 0 flaky
Derived by declaration name, from the diff (no baseline run).
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 84e528375f586471c6e76d60ed947e731803016c.
9 files: 5 code · 4 docs. Click to expand.
diff --git a/Meddy/Meddy/Features/ConsultationMarkdown.swift b/Meddy/Meddy/Features/ConsultationMarkdown.swiftindex ca5cf13..b9ec3e6 100644--- a/Meddy/Meddy/Features/ConsultationMarkdown.swift+++ b/Meddy/Meddy/Features/ConsultationMarkdown.swift@@ -66,7 +66,9 @@ nonisolated enum ConsultationMarkdown { if let date = prescription.prescribedOn { lines.append("- **Prescribed on:** \(inline(date))") } if let prescriber = prescription.prescribedBy { lines.append("- **Prescribed by:** \(inline(prescriber))") } if let days = prescription.supplyDurationDays { lines.append("- **Supply lasts (days):** \(days)") }- if let repeats = prescription.repeatsLeft { lines.append("- **Repeats left:** \(repeats)") }+ if let repeats = prescription.repeatsLeft, repeats > 0 {+ lines.append("- **Repeats left:** \(repeats)")+ } } lines.append("") }
diff --git a/Meddy/Meddy/Features/TodayRoutineSections.swift b/Meddy/Meddy/Features/TodayRoutineSections.swiftindex 7caca5f..aabb3ac 100644--- a/Meddy/Meddy/Features/TodayRoutineSections.swift+++ b/Meddy/Meddy/Features/TodayRoutineSections.swift@@ -183,6 +183,9 @@ struct CurrentMedicationsView: View { } Text(MedicationPresentation.scheduleLabel(item, routines: routines)).foregroundStyle( .secondary)+ if let repeats = item.repeatsLeft, repeats > 0 {+ Text("Repeats left: \(repeats)")+ } } } }
diff --git a/Meddy/MeddyTests/MeddyMarkdownExportTests.swift b/Meddy/MeddyTests/MeddyMarkdownExportTests.swiftindex 3b96bee..6a73d3c 100644--- a/Meddy/MeddyTests/MeddyMarkdownExportTests.swift+++ b/Meddy/MeddyTests/MeddyMarkdownExportTests.swift@@ -10,6 +10,19 @@ import UniformTypeIdentifiers struct MeddyMarkdownExportTests { private let preparedAt = Date(timeIntervalSince1970: 1_767_660_000) private let utc = TimeZone(secondsFromGMT: 0)!+ @Test(arguments: [nil, 0, 1, 3] as [Int?])+ func appointmentExportIncludesOnlyPositiveRemainingRepeats(_ repeats: Int?) {+ var medication = entry("Synthetic appointment medicine")+ medication.prescription = PrescriptionDetails(repeatsLeft: repeats)+ let export = ConsultationMarkdown.make([medication], preparedAt: preparedAt, timeZone: utc)+ if let repeats, repeats > 0 {+ #expect(export.markdown.contains("- **Repeats left:** \(repeats)\n"))+ } else {+ #expect(!export.markdown.contains("Repeats left"))+ }+ #expect(String(data: export.data, encoding: .utf8) == export.markdown)+ #expect(medication.prescription?.repeatsLeft == repeats)+ } private func entry( _ name: String, purpose: String = "Ungrouped", id: UUID = UUID(), dose: String? = nil, method: String = "", requirements: String = "", schedule: String = "As needed"
diff --git a/Meddy/MeddyTests/MeddyPrescriptionTests.swift b/Meddy/MeddyTests/MeddyPrescriptionTests.swiftindex c4b6ccd..d06e9a3 100644--- a/Meddy/MeddyTests/MeddyPrescriptionTests.swift+++ b/Meddy/MeddyTests/MeddyPrescriptionTests.swift@@ -201,7 +201,7 @@ import Testing #expect(try reopened.mainContext.fetch(FetchDescriptor<Administration>()).first?.isDeleted == true) } - @Test func exportIncludesOnlySelectedOwnerEscapesPrescriberAndRetainsZero() throws {+ @Test func exportIncludesOnlySelectedOwnerEscapesPrescriberAndOmitsZeroRepeats() throws { let (store, me) = try setup() let context = store.mainContext let profile = try ProfileService(context: context).create(displayName: "Synthetic dependant")@@ -214,7 +214,7 @@ import Testing #expect(export.markdown.contains("**Prescribed on:** 2026\\-10\\-08")) #expect(export.markdown.contains("**Prescribed by:** \\# clinic \\<script\\>")) #expect(export.markdown.contains("**Supply lasts (days):** 30"))- #expect(export.markdown.contains("**Repeats left:** 0"))+ #expect(!export.markdown.contains("**Repeats left:**")) let empty = MedicationPresentation.consultationExport([me], profileID: ProfileIdentity.me) #expect(!empty.markdown.contains("Prescribed") && !empty.markdown.contains("Repeats left")) }
diff --git a/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift b/Meddy/MeddyUITests/MeddyPrescriptionUITests.swiftindex ac2c290..39a896e 100644--- a/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift+++ b/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift@@ -50,6 +50,7 @@ import XCTest fill("prescriptionRepeats", "2") app.buttons["Save"].tap() app.buttons["Synthetic prescription"].tap()+ checkAppointmentRepeats(2, app: app) let lower = app.buttons["lowerRepeats"] reveal(lower) let clinic = app.descendants(matching: .any).matching(NSPredicate(@@ -66,6 +67,7 @@ import XCTest lower.tap() lower.tap() XCTAssertFalse(lower.isEnabled)+ checkAppointmentRepeats(nil, app: app) app.buttons["Edit"].tap() let repeats = app.textFields["prescriptionRepeats"] reveal(repeats)@@ -97,6 +99,21 @@ import XCTest XCTAssertFalse(app.alerts.firstMatch.exists) } + private func checkAppointmentRepeats(_ count: Int?, app: XCUIApplication) {+ app.navigationBars["Synthetic prescription"].buttons.element(boundBy: 0).tap()+ let share = app.buttons["Share for appointment"]+ XCTAssertTrue(share.waitForExistence(timeout: 3))+ share.tap()+ XCTAssertTrue(app.navigationBars["Current Medications"].waitForExistence(timeout: 3))+ if let count {+ XCTAssertTrue(app.staticTexts["Repeats left: \(count)"].exists)+ } else {+ XCTAssertEqual(app.staticTexts.matching(NSPredicate(format: "label BEGINSWITH %@", "Repeats left:")).count, 0)+ }+ app.navigationBars["Current Medications"].buttons.element(boundBy: 0).tap()+ app.buttons["Synthetic prescription"].tap()+ }+ private func scroll(_ down: Bool, app: XCUIApplication) { let form = app.descendants(matching: .any)["medicationEditorForm"].firstMatch if form.exists {
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9c56d3a..48f0fef 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,7 @@ ## Unreleased ### Changed+- Show “Repeats left: x” in Share for appointment and its Markdown output only when the remaining count is positive; omit zero and unset counts without changing repeat accounting. - 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.
diff --git a/docs/meddy-design.md b/docs/meddy-design.mdindex 206e4b6..42cd534 100644--- a/docs/meddy-design.md+++ b/docs/meddy-design.md@@ -1706,6 +1706,6 @@ 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.+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. Share for appointment and its Markdown output show `Repeats left: x` only when the remaining count is positive; omit zero/unset while retaining the stored zero and existing detail/decrement/Undo behavior. 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.
diff --git a/docs/meddy-implementation-plan.md b/docs/meddy-implementation-plan.mdindex d7f3f4a..fc288d5 100644--- a/docs/meddy-implementation-plan.md+++ b/docs/meddy-implementation-plan.md@@ -1,5 +1,11 @@ # Meddy — Implementation task plan +## Appointment remaining repeats++Show `Repeats left: x` on Share for appointment only when the remaining count is positive, with the same omission rule in the shared Markdown output. Zero and unset counts are omitted from these two appointment surfaces. Stored values, medication detail, decrement/Undo, profile filtering and other prescription metadata remain unchanged. No warning, signing/account change, migration, installation or automatic sharing is added. Affected export/prescription tests and the existing prescription UI journey cover positive/zero/unset output and unchanged repeat accounting.++Focused verification at clean `004d26d`: all 17 native declarations across Markdown export and prescription suites passed, including nil/0/1/3 parameter variants; the prescription UI journey passed with positive and zero appointment rows plus its existing decrement/Undo/Cancel/profile checks. Strict lint passed 113 files with zero violations; whitespace passed. Native receipts have exit 0, no failed or skipped cases. Four source reviews found no blockers. Assigned simulators restored and owned groups drained; heavy lane released to Halo. No broad suite, install or merge ran. Transit MCP is unavailable in this execution environment; parent handles the separately authorized Meddy tracker ticket.+ **Status:** Phone and companion source implemented and tested in isolation; live CloudKit and physical Watch acceptance remain unverified/deferred. ## Phone timer interaction feedback
diff --git a/docs/meddy-prescription-details-plan.md b/docs/meddy-prescription-details-plan.mdindex 4523e81..c0ca4da 100644--- a/docs/meddy-prescription-details-plan.md+++ b/docs/meddy-prescription-details-plan.md@@ -44,7 +44,7 @@ This uses the app's current synchronization model, not a cross-device refill led ## Consultation export -Extend the existing profile-scoped Markdown consultation summary with labelled **Prescribed on**, **Prescribed by**, **Supply lasts (days)** and **Repeats left** rows. Include only recorded values, including an explicit zero repeat count. Export the civil date as ISO `YYYY-MM-DD`; reuse existing user-text escaping. Preserve profile filtering and the user's explicit system-share action. No automatic sending, prescription history, private notes or photo export is added.+Extend the existing profile-scoped Markdown consultation summary with labelled **Prescribed on**, **Prescribed by**, **Supply lasts (days)** and **Repeats left** rows. Include recorded prescription metadata; show **Repeats left** only when the count is greater than zero. Share for appointment also shows `Repeats left: x` for positive counts and omits zero/unset. Zero remains an explicit stored/detail value; this is a presentation change with no decrement/Undo accounting change or added warning. Export the civil date as ISO `YYYY-MM-DD`; reuse existing user-text escaping. Preserve profile filtering and the user's explicit system-share action. No automatic sending, prescription history, private notes or photo export is added. ## Implementation sequence after approval
17 native declarations across Markdown export and prescription suites plus 1 existing prescription UI journey passed at clean 004d26d. Parameter variants are retained in native results and counted once per declaration by xcresult summary. Strict SwiftLint passed 113 files with zero violations. No broad suite or device install ran.
Fresh explicit authorization covers a Transit ticket for the app/project Meddy. Transit MCP is not exposed in this environment; no uncertain write or permission reconfiguration was attempted. Parent routes tracking separately.