Meddy

Pre-push review: prescription URLs

Optional medication prescription links, stacked on pending backup PR #14 at ad3c099 (including main cfcebc9).

At a glance

  • Add, replace, clear or cancel the optional prescription URL in Edit.
  • Open prescription uses native SwiftUI Link; saving never fetches the destination.
  • Version 2 backups preserve the exact link; version 1 archives remain readable. Appointment sharing remains unchanged.

Verdict

Ready to push

Full serial native gate passed. Four source review lenses found no production blockers. Development test errors were corrected with assertions retained.

Review findings

3 raised · 3 fixed · 0 skipped

Jump to findings →

Tests

Pass rate: 100% (368 of 368)

New tests: 3

Diff coverage: n/a

Jump to tests →

Three-level explanation

Keep a prescription link with its medication. Edit saves or clears it, Cancel keeps the existing value, and Open prescription delegates opening to the system.

A nullable Medication string participates in existing ownership checks, three-way field merging and prescription revision changes. A shared Foundation helper validates HTTP/HTTPS URLs. Backup records copy and restore the exact string.

Optional SwiftData schema evolution is exercised by a historical synthetic store upgrade and reopen. The archive envelope advances to version 2; version 1 accepts absent URL fields and rejects mislabelled extensions. Query/fragment bytes are not normalized in stored text. Existing budgets, checksums, relation checks and scratch-store equality remain authoritative.

Important changes — detailed

Prescription editor and detail link

Meddy/Meddy/Features/PrescriptionFields.swift

Why it matters. Supports add, replace, clear and Cancel while preserving concurrent edits.

What to look at. PrescriptionDraft and PrescriptionSection

Takeaway. Extend existing field merge rules when adding optional metadata.
Rationale. Keep URL edits under the same captured owner, lifecycle and prescription revision as the other prescription fields.

Portable backup version compatibility

Meddy/Meddy/Services/Backups/BackupArchiveCodec.swift

Why it matters. Migration archives must retain the new URL and still read older files.

What to look at. Envelope.version and checkPayload

Takeaway. Version a strict archive extension explicitly rather than relying on unknown-key tolerance.
Rationale. Older apps reject version 2 explicitly, while the updated decoder continues accepting genuine version 1 archives.

Exact URL validation and storage

Meddy/Meddy/Services/PrescriptionService.swift

Why it matters. Signed URL query and fragment content must remain intact.

What to look at. PrescriptionURL.url and PrescriptionDetails

Takeaway. Validate with Foundation without rewriting the persisted string.
Rationale. Native system opening needs a complete HTTP/HTTPS URL, and validation must never fetch a prescription.

Key decisions

Stack on pending PR #14

The backup code needed for portable compatibility is not on main. Base this feature on its current head without merging it; the draft PR names that dependency.

Keep appointment summaries unchanged

The requested destination is medication detail and full portable backup. The appointment summary retains its existing omissions.

Review findings

SeverityAreaFindingResolution
minorSynthetic backup testNested #require caused a recursive macro expansion.Split the nested required values.
minorExisting unsupported-version assertionThe prior test expected newly supported version 2 to fail.Assert unsupported version 3 while retaining explicit v1/v2 compatibility coverage.
minorSynthetic editor journeyRelaunch was invalid for an in-memory store; deletion assumed an end-position caret.Use disk tests for persistence and Select All for native replacement/clear; retain exact assertions.

Tests

Source: local run at 2026-10-19T22:48:06.674343+00:00 · snapshot ad3c099a6569290ebbd9f05a3bebba5f266a5213 (dirty working tree)

Baseline: none

Execution: passed · JUnit: 3 files · Coverage: none · Baseline: absent

Coverage scope: as the project configures it

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

New and removed tests

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

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 ad3c099.

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

Per-file diffs

20 files: 10 code · 10 docs. Click to expand.

Code (10)

Meddy/Meddy/Features/PrescriptionFields.swift Modified
diff --git a/Meddy/Meddy/Features/PrescriptionFields.swift b/Meddy/Meddy/Features/PrescriptionFields.swiftindex c606316..a634ca7 100644--- a/Meddy/Meddy/Features/PrescriptionFields.swift+++ b/Meddy/Meddy/Features/PrescriptionFields.swift@@ -4,6 +4,7 @@ import SwiftUI @MainActor @Observable final class PrescriptionDraft {   var hasDate: Bool   var date: Date+  var prescriptionURL: String   var prescriber: String   var days: String   var repeats: String@@ -16,6 +17,7 @@ import SwiftUI     hasDate = original.prescribedOn != nil     date = original.prescribedOn.flatMap(PrescriptionDate.date) ?? PrescriptionDate.today     prescriber = original.prescribedBy ?? ""+    prescriptionURL = original.prescriptionURL ?? ""     days = original.supplyDurationDays.map(String.init) ?? ""     repeats = original.repeatsLeft.map(String.init) ?? ""     capture = medication.flatMap { item in@@ -30,9 +32,11 @@ import SwiftUI       return value     }     let text = prescriber.trimmingCharacters(in: .whitespacesAndNewlines)+    let url = prescriptionURL.trimmingCharacters(in: .whitespacesAndNewlines)     let result = try PrescriptionDetails(       prescribedOn: hasDate ? PrescriptionDate.string(date) : nil,       prescribedBy: text.isEmpty ? nil : text,+      prescriptionURL: url.isEmpty ? nil : url,       supplyDurationDays: number(days, error: .invalidDays),       repeatsLeft: number(repeats, error: .invalidRepeats))     try result.validate()@@ -58,11 +62,13 @@ import SwiftUI     let result = try PrescriptionDetails(       prescribedOn: merge(original.prescribedOn, entered.prescribedOn, current.prescribedOn),       prescribedBy: merge(original.prescribedBy, entered.prescribedBy, current.prescribedBy),+      prescriptionURL: merge(original.prescriptionURL, entered.prescriptionURL, current.prescriptionURL),       supplyDurationDays: merge(original.supplyDurationDays, entered.supplyDurationDays, current.supplyDurationDays),       repeatsLeft: merge(original.repeatsLeft, entered.repeatsLeft, current.repeatsLeft))     guard result != current else { return }     medication.prescribedOn = result.prescribedOn     medication.prescribedBy = result.prescribedBy+    medication.prescriptionURL = result.prescriptionURL     medication.supplyDurationDays = result.supplyDurationDays     medication.repeatsLeft = result.repeatsLeft     medication.prescriptionRevision = UUID()@@ -83,6 +89,9 @@ struct PrescriptionFields: View {       }       TextField("Prescribed by (doctor or clinic)", text: $draft.prescriber)         .accessibilityIdentifier("prescriptionPrescriber")+      TextField("Prescription URL", text: $draft.prescriptionURL)+        .keyboardType(.URL).textInputAutocapitalization(.never).autocorrectionDisabled()+        .accessibilityIdentifier("prescriptionURL")       TextField("Supply lasts (days)", text: $draft.days).keyboardType(.numberPad)         .accessibilityIdentifier("prescriptionDays")       TextField("Repeats left", text: $draft.repeats).keyboardType(.numberPad)@@ -109,6 +118,10 @@ struct PrescriptionSection: View {               timeZone: PrescriptionDate.calendar.timeZone)))         }         if let prescriber = details.prescribedBy { LabeledContent("Prescribed by", value: prescriber) }+        if let url = details.prescriptionURL.flatMap(PrescriptionURL.url) {+          Link("Open prescription", destination: url)+            .accessibilityIdentifier("openPrescriptionURL")+        }         if let days = details.supplyDurationDays { LabeledContent("Supply lasts", value: "\(days) days") }         if let repeats = details.repeatsLeft {           LabeledContent("Repeats left", value: String(repeats)).accessibilityIdentifier("repeatsLeftValue")
Meddy/Meddy/Models/Models.swift Modified
diff --git a/Meddy/Meddy/Models/Models.swift b/Meddy/Meddy/Models/Models.swiftindex fc8f7eb..2831517 100644--- a/Meddy/Meddy/Models/Models.swift+++ b/Meddy/Meddy/Models/Models.swift@@ -40,6 +40,7 @@ final class Medication {   var classificationRaw: String?   var prescribedOn: String?   var prescribedBy: String?+  var prescriptionURL: String?   var supplyDurationDays: Int?   var repeatsLeft: Int?   var prescriptionRevision: UUID?
Meddy/Meddy/Services/Backups/BackupArchiveCodec.swift Modified
diff --git a/Meddy/Meddy/Services/Backups/BackupArchiveCodec.swift b/Meddy/Meddy/Services/Backups/BackupArchiveCodec.swiftindex 62473ed..dad852f 100644--- a/Meddy/Meddy/Services/Backups/BackupArchiveCodec.swift+++ b/Meddy/Meddy/Services/Backups/BackupArchiveCodec.swift@@ -4,7 +4,7 @@ import Foundation nonisolated enum PhoneBackupCodec {   private struct Envelope: Codable {     var format = "meddy-phone-backup"-    var version = 1+    var version = 2     var payloadByteCount: Int     var payloadSHA256: String     var payload: Data@@ -43,13 +43,13 @@ nonisolated enum PhoneBackupCodec {     var count = 0     try shape.check(value, limits: envelopeLimits, dataBytes: &count)     let envelope = try JSONDecoder().decode(Envelope.self, from: data)-    guard envelope.format == "meddy-phone-backup", envelope.version == 1 else {+    guard envelope.format == "meddy-phone-backup", [1, 2].contains(envelope.version) else {       throw ArchiveError.unsupportedVersion     }     guard envelope.payloadByteCount == envelope.payload.count,       envelope.payload.count <= limits.payloadBytes,       envelope.payloadSHA256 == digest(envelope.payload) else { throw ArchiveError.damagedArchive }-    try checkPayload(envelope.payload, limits: limits)+    try checkPayload(envelope.payload, limits: limits, version: envelope.version)     let decoder = JSONDecoder()     decoder.dateDecodingStrategy = .deferredToDate     let payload = try decoder.decode(PhoneBackupPayload.self, from: envelope.payload)@@ -67,7 +67,7 @@ nonisolated enum PhoneBackupCodec {     SHA256.hash(data: data).map { String(format: "%02x", $0) }.joined()   } -  private static func checkPayload(_ data: Data, limits: BackupLimits) throws {+  private static func checkPayload(_ data: Data, limits: BackupLimits, version: Int = 2) throws {     var parser = BackupJSONParser(data, limits: limits)     let value = try parser.parse()     let shape = BackupJSONShape.object([@@ -81,5 +81,11 @@ nonisolated enum PhoneBackupCodec {     ])     var count = 0     try shape.check(value, limits: limits, dataBytes: &count)+    if version == 1,+      let payload = value as? [String: Any], let records = payload["records"] as? [String: Any],+      let medications = records["medications"] as? [[String: Any]],+      medications.contains(where: { $0.keys.contains("prescriptionURL") }) {+      throw ArchiveError.invalidSchema+    }   } }
Meddy/Meddy/Services/Backups/BackupRecordsMedication.swift Modified
diff --git a/Meddy/Meddy/Services/Backups/BackupRecordsMedication.swift b/Meddy/Meddy/Services/Backups/BackupRecordsMedication.swiftindex 3c8b1ed..ed03a78 100644--- a/Meddy/Meddy/Services/Backups/BackupRecordsMedication.swift+++ b/Meddy/Meddy/Services/Backups/BackupRecordsMedication.swift@@ -14,6 +14,7 @@ nonisolated struct BackupMedication: Codable, Equatable, Sendable, BackupRecordV   var recognitionPhotoData: Data?   var prescribedOn: String?   var prescribedBy: String?+  var prescriptionURL: String?   var supplyDurationDays: Int?   var repeatsLeft: Int?   var prescriptionRevision: UUID?@@ -53,6 +54,7 @@ nonisolated struct BackupMedication: Codable, Equatable, Sendable, BackupRecordV     recognitionPhotoData = value.recognitionPhotoData     prescribedOn = value.prescribedOn     prescribedBy = value.prescribedBy+    prescriptionURL = value.prescriptionURL     supplyDurationDays = value.supplyDurationDays     repeatsLeft = value.repeatsLeft     prescriptionRevision = value.prescriptionRevision@@ -93,6 +95,7 @@ nonisolated struct BackupMedication: Codable, Equatable, Sendable, BackupRecordV     value.recognitionPhotoData = recognitionPhotoData     value.prescribedOn = prescribedOn     value.prescribedBy = prescribedBy+    value.prescriptionURL = prescriptionURL     value.supplyDurationDays = supplyDurationDays     value.repeatsLeft = repeatsLeft     value.prescriptionRevision = prescriptionRevision@@ -131,6 +134,7 @@ nonisolated struct BackupMedication: Codable, Equatable, Sendable, BackupRecordV     "recognitionPhotoData": .optional(.data),     "prescribedOn": .optional(.text),     "prescribedBy": .optional(.text),+    "prescriptionURL": .optional(.text),     "supplyDurationDays": .optional(.integer),     "repeatsLeft": .optional(.integer),     "prescriptionRevision": .optional(.uuid),
Meddy/Meddy/Services/Backups/BackupRecordsNested.swift Modified
diff --git a/Meddy/Meddy/Services/Backups/BackupRecordsNested.swift b/Meddy/Meddy/Services/Backups/BackupRecordsNested.swiftindex 4b02b6f..cede04e 100644--- a/Meddy/Meddy/Services/Backups/BackupRecordsNested.swift+++ b/Meddy/Meddy/Services/Backups/BackupRecordsNested.swift@@ -3,6 +3,10 @@ import Foundation nonisolated extension BackupRecords {   func validateNestedRecords(limits: BackupLimits = .standard) throws {     for row in medications {+      if let url = row.prescriptionURL, PrescriptionURL.url(url) == nil {+        throw BackupValidationIssue.record(row, code: "BK-URL-01", field: "prescription URL",+          reason: "The saved prescription URL must be a complete HTTP or HTTPS URL.")+      }       if let data = row.asNeededDoseLimitsData {         let value: AsNeededDoseLimits = try nested(data, shape: .asNeededDoseLimits, limits: limits)         guard (value.maximumAmount == nil) == (value.windowSeconds == nil) else {
Meddy/Meddy/Services/PrescriptionService.swift Modified
diff --git a/Meddy/Meddy/Services/PrescriptionService.swift b/Meddy/Meddy/Services/PrescriptionService.swiftindex 52d836c..f3fe14c 100644--- a/Meddy/Meddy/Services/PrescriptionService.swift+++ b/Meddy/Meddy/Services/PrescriptionService.swift@@ -2,9 +2,10 @@ import Foundation import SwiftData  nonisolated enum PrescriptionError: LocalizedError {-  case invalidDate, invalidDays, invalidRepeats, changed+  case invalidDate, invalidDays, invalidRepeats, invalidURL, changed   var errorDescription: String? {     switch self {+    case .invalidURL: "Enter a complete prescription URL starting with https:// or http://."     case .invalidDate: "Enter a valid prescription date."     case .invalidDays: "Supply duration must be a positive whole number of days."     case .invalidRepeats: "Repeats left must be a whole number of zero or more."@@ -16,12 +17,17 @@ nonisolated enum PrescriptionError: LocalizedError { nonisolated struct PrescriptionDetails: Equatable, Sendable {   var prescribedOn: String?   var prescribedBy: String?+  var prescriptionURL: String?   var supplyDurationDays: Int?   var repeatsLeft: Int?   var isEmpty: Bool {     prescribedOn == nil && prescribedBy == nil && supplyDurationDays == nil && repeatsLeft == nil+      && prescriptionURL == nil   }   func validate() throws {+    if let prescriptionURL, PrescriptionURL.url(prescriptionURL) == nil {+      throw PrescriptionError.invalidURL+    }     if let prescribedOn, PrescriptionDate.date(prescribedOn) == nil {       throw PrescriptionError.invalidDate     }@@ -30,6 +36,17 @@ nonisolated struct PrescriptionDetails: Equatable, Sendable {   } } +/// Validate without normalizing the saved text or contacting the destination.+nonisolated enum PrescriptionURL {+  static func url(_ value: String) -> URL? {+    guard !value.isEmpty, !value.contains(where: { $0.isWhitespace || $0.isNewline }),+      let url = URL(string: value, encodingInvalidCharacters: false),+      let scheme = url.scheme?.lowercased(), ["https", "http"].contains(scheme),+      let host = url.host, !host.isEmpty else { return nil }+    return url+  }+}+ nonisolated enum PrescriptionDate {   static var calendar: Calendar {     var value = Calendar(identifier: .gregorian)@@ -76,6 +93,7 @@ nonisolated enum PrescriptionDate {   static func details(_ medication: Medication) -> PrescriptionDetails {     .init(       prescribedOn: medication.prescribedOn, prescribedBy: medication.prescribedBy,+      prescriptionURL: medication.prescriptionURL,       supplyDurationDays: medication.supplyDurationDays, repeatsLeft: medication.repeatsLeft)   }   func capture(_ medication: Medication) throws -> PrescriptionCapture {
Meddy/MeddyTests/BackupArchiveFixtures.swift Modified
diff --git a/Meddy/MeddyTests/BackupArchiveFixtures.swift b/Meddy/MeddyTests/BackupArchiveFixtures.swiftindex f312289..e806de3 100644--- a/Meddy/MeddyTests/BackupArchiveFixtures.swift+++ b/Meddy/MeddyTests/BackupArchiveFixtures.swift@@ -154,6 +154,7 @@ import SwiftData     value.recognitionPhotoData = try syntheticJPEG()     value.prescribedOn = "Synthetic date text"     value.prescribedBy = "Synthetic prescriber"+    value.prescriptionURL = "https://example.com/prescription?token=a%2Fb&x=1#document"     value.supplyDurationDays = 12     value.repeatsLeft = 2     value.prescriptionRevision = UUID()
Meddy/MeddyTests/MeddyBackupArchiveTests.swift Modified
diff --git a/Meddy/MeddyTests/MeddyBackupArchiveTests.swift b/Meddy/MeddyTests/MeddyBackupArchiveTests.swiftindex b5863f0..f4569c0 100644--- a/Meddy/MeddyTests/MeddyBackupArchiveTests.swift+++ b/Meddy/MeddyTests/MeddyBackupArchiveTests.swift@@ -15,6 +15,29 @@ import Testing     #expect(decoded.reminders == payload.reminders)   } +  @Test func prescriptionURLUsesVersionTwoAndLegacyVersionOneStillDecodes() throws {+    var payload = try BackupArchiveFixtures.payload()+    let legacy = try unvalidatedArchive(payload)+    let envelope = try #require(JSONSerialization.jsonObject(with: legacy) as? [String: Any])+    let encodedPayload = try #require(envelope["payload"] as? String)+    let bytes = try #require(Data(base64Encoded: encodedPayload))+    let text = try #require(String(data: bytes, encoding: .utf8))+    #expect(!text.contains("prescriptionURL"))+    #expect(try PhoneBackupCodec.decode(seal(bytes, version: 1)) == payload)+    #expect(try PhoneBackupCodec.decode(seal(bytes, version: 1)).records.medications[0].prescriptionURL == nil)+    payload.records.medications[0].prescriptionURL = "https://example.com/rx?token=a%2Fb&x=1#document"+    let archive = try PhoneBackupCodec.encode(payload)+    let versionTwo = try #require(JSONSerialization.jsonObject(with: archive) as? [String: Any])+    #expect(versionTwo["version"] as? Int == 2)+    #expect(try PhoneBackupCodec.decode(archive) == payload)+    let newBytes = try JSONEncoder().encode(payload)+    #expect(throws: (any Error).self) { try PhoneBackupCodec.decode(seal(newBytes, version: 1)) }+    #expect(throws: (any Error).self) { try PhoneBackupCodec.decode(seal(newBytes, version: 3)) }+    payload.records.medications[0].prescriptionURL = "file:///synthetic"+    #expect(throws: (any Error).self) { try PhoneBackupCodec.encode(payload) }+    #expect(throws: (any Error).self) { try PhoneBackupCodec.decode(unvalidatedArchive(payload)) }+  }+   @Test func damagedArchiveFailsBeforeDestinationMutation() throws {     let payload = try BackupArchiveFixtures.payload()     var archive = try PhoneBackupCodec.encode(payload)@@ -64,6 +87,7 @@ import Testing     let medicine = try #require(decoded.records.medications.first { $0.recognitionPhotoData != nil })     #expect(medicine.classificationRaw == "supplement")     #expect(medicine.prescriptionRevision != nil)+    #expect(medicine.prescriptionURL == "https://example.com/prescription?token=a%2Fb&x=1#document")     #expect(medicine.fixedTimesData == Data(" [480, 720] \n".utf8))     #expect(decoded.records.routineRuns.contains { $0.restoreOriginalExecutionData != nil })     #expect(decoded.records.routineRuns.contains { $0.parentRoutineRunID != nil })@@ -214,10 +238,10 @@ import Testing     return try seal(encoder.encode(payload))   } -  private func seal(_ payload: Data) throws -> Data {+  private func seal(_ payload: Data, version: Int = 2) throws -> Data {     let hash = SHA256.hash(data: payload).map { String(format: "%02x", $0) }.joined()     return try JSONSerialization.data(withJSONObject: [-      "format": "meddy-phone-backup", "version": 1, "payloadByteCount": payload.count,+      "format": "meddy-phone-backup", "version": version, "payloadByteCount": payload.count,       "payloadSHA256": hash, "payload": payload.base64EncodedString()     ], options: .sortedKeys)   }@@ -252,7 +276,7 @@ import Testing     let archive = try PhoneBackupCodec.encode(payload)     let object = try #require(JSONSerialization.jsonObject(with: archive) as? [String: Any])     for (key, value): (String, Any) in [-      ("version", 2), ("payloadSHA256", String(repeating: "0", count: 64)),+      ("version", 3), ("payloadSHA256", String(repeating: "0", count: 64)),       ("payloadByteCount", 0), ("payload", "!invalid-base64!")     ] {       var bad = object
Meddy/MeddyTests/MeddyPrescriptionTests.swift Modified
diff --git a/Meddy/MeddyTests/MeddyPrescriptionTests.swift b/Meddy/MeddyTests/MeddyPrescriptionTests.swiftindex d06e9a3..40c359a 100644--- a/Meddy/MeddyTests/MeddyPrescriptionTests.swift+++ b/Meddy/MeddyTests/MeddyPrescriptionTests.swift@@ -14,6 +14,7 @@ import Testing     draft.hasDate = true     draft.date = try #require(PrescriptionDate.date("2026-10-08"))     draft.prescriber = "  Synthetic doctor / clinic  "+    draft.prescriptionURL = "  https://example.com/prescription?token=a%2Fb&v=1#document  "     draft.days = "30"     draft.repeats = repeats     try EditorTransaction.save(context: context) { try draft.apply(to: item, context: context) }@@ -25,6 +26,7 @@ import Testing     let generation = item.scheduleGenerationID     try set(item, context: store.mainContext, repeats: "0")     #expect(item.prescribedOn == "2026-10-08" && item.prescribedBy == "Synthetic doctor / clinic")+    #expect(item.prescriptionURL == "https://example.com/prescription?token=a%2Fb&v=1#document")     #expect(item.supplyDurationDays == 30 && item.repeatsLeft == 0)     #expect(item.scheduleGenerationID == generation && !item.remindersEnabled)     #expect(try store.mainContext.fetchCount(FetchDescriptor<Administration>()) == 0)@@ -58,6 +60,7 @@ import Testing     let cleared = PrescriptionDraft(medication: item)     cleared.hasDate = false     cleared.prescriber = "  "+    cleared.prescriptionURL = "  "     cleared.days = ""     cleared.repeats = ""     try EditorTransaction.save(context: context) { try cleared.apply(to: item, context: context) }@@ -83,6 +86,44 @@ import Testing     #expect(reloaded.name == "Synthetic medicine")   } ++  @Test func urlValidationAndConcurrentEditsPreserveExactLinkAndRepeatAccounting() throws {+    let (store, item) = try setup()+    let context = store.mainContext+    let stale = PrescriptionDraft(medication: item)+    let current = PrescriptionDraft(medication: item)+    current.prescriptionURL = "https://example.com/new?token=a%2Fb&x=1#document"+    #expect(PrescriptionURL.url(current.prescriptionURL)?.absoluteString == current.prescriptionURL)+    try EditorTransaction.save(context: context) { try current.apply(to: item, context: context) }+    let revision = item.prescriptionRevision+    stale.prescriber = "Synthetic clinic"+    try EditorTransaction.save(context: context) { try stale.apply(to: item, context: context) }+    #expect(item.prescriptionURL == current.prescriptionURL)+    #expect(item.prescriptionRevision != revision)+    stale.prescriptionURL = "https://example.com/conflict"+    #expect(throws: PrescriptionError.self) { try stale.apply(to: item, context: context) }+    #expect(item.prescriptionURL == current.prescriptionURL)+    let draft = PrescriptionDraft(medication: item)+    for invalid in ["example.com", "https://", "file:///synthetic", "javascript:alert(1)",+                    "https://example.com/a b", "https://example.com/%ZZ"] {+      draft.prescriptionURL = invalid+      #expect(throws: PrescriptionError.self) { try draft.value() }+    }+    draft.prescriptionURL = " http://example.com/synthetic "+    #expect(try draft.value().prescriptionURL == "http://example.com/synthetic")+    draft.prescriptionURL = ""+    try EditorTransaction.save(context: context) { try draft.apply(to: item, context: context) }+    #expect(item.prescriptionURL == nil && item.prescribedBy == "Synthetic clinic")+    #expect(try context.fetchCount(FetchDescriptor<Administration>()) == 0)+    try set(item, context: context)+    let service = PrescriptionService(context: context)+    let undo = try service.decrement(service.capture(item))+    let edit = PrescriptionDraft(medication: item)+    edit.prescriptionURL = "https://example.com/replacement"+    try EditorTransaction.save(context: context) { try edit.apply(to: item, context: context) }+    #expect(throws: PrescriptionError.self) { try service.undo(undo) }+    #expect(item.repeatsLeft == 2)+  }   @Test func decrementZeroFloorUndoAndRepeatedOrStaleActionsAreGuarded() throws {     let (store, item) = try setup()     let context = store.mainContext@@ -187,6 +228,7 @@ import Testing     let item = try #require(try context.fetch(FetchDescriptor<Medication>()).first)     #expect(item.id.uuidString == "9B4A0A43-D3B0-4A90-9674-4CF7F6C02502")     #expect(PrescriptionService.details(item).isEmpty && item.prescriptionRevision == nil)+    #expect(item.prescriptionURL == nil)     #expect(item.defaultDoseAmount == 2 && item.recognitionPhotoData == Data([1, 2, 3, 4]))     #expect(item.fixedTimesData == Data([9, 8, 7]))     let event = try #require(try context.fetch(FetchDescriptor<Administration>()).first)@@ -215,6 +257,7 @@ import Testing     #expect(export.markdown.contains("**Prescribed by:** \\# clinic \\<script\\>"))     #expect(export.markdown.contains("**Supply lasts (days):** 30"))     #expect(!export.markdown.contains("**Repeats left:**"))+    #expect(!export.markdown.contains("example.com"))     let empty = MedicationPresentation.consultationExport([me], profileID: ProfileIdentity.me)     #expect(!empty.markdown.contains("Prescribed") && !empty.markdown.contains("Repeats left"))   }
Meddy/MeddyUITests/MeddyPrescriptionUITests.swift Modified
diff --git a/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift b/Meddy/MeddyUITests/MeddyPrescriptionUITests.swiftindex 5c2aea2..8a49ad2 100644--- a/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift+++ b/Meddy/MeddyUITests/MeddyPrescriptionUITests.swift@@ -103,6 +103,65 @@ import XCTest     XCTAssertFalse(app.alerts.firstMatch.exists)   } +  func testPrescriptionURLSaveCancelEditAndClear() {+    executionTimeAllowance = 180+    continueAfterFailure = false+    let app = XCUIApplication()+    app.launchEnvironment["MEDDY_TESTING"] = "1"+    app.launch()+    XCTAssertTrue(app.tabBars.buttons["Medications"].waitForExistence(timeout: 10))+    app.tabBars.buttons["Medications"].tap()+    app.buttons["Add medication"].tap()+    let name = app.textFields["Name"]+    XCTAssertTrue(name.waitForExistence(timeout: 3))+    name.tap()+    name.typeText("Synthetic URL medicine")+    func revealURL() -> XCUIElement {+      let field = app.textFields["prescriptionURL"]+      for _ in 0..<12 {+        if field.exists && field.isHittable { return field }+        scroll(false, app: app)+      }+      XCTAssertTrue(field.exists && field.isHittable)+      return field+    }+    let original = "https://example.com/synthetic?token=a%2Fb#document"+    let field = revealURL()+    field.tap()+    field.typeText(original)+    app.buttons["Save"].tap()+    app.buttons["Synthetic URL medicine"].tap()+    let link = app.links["openPrescriptionURL"]+    for _ in 0..<8 where !link.isHittable { scroll(false, app: app) }+    XCTAssertTrue(link.exists)+    app.buttons["Edit"].tap()+    let reopened = revealURL()+    XCTAssertEqual(reopened.value as? String, original)+    reopened.tap()+    reopened.typeText("cancelled")+    app.buttons["Cancel"].tap()+    app.buttons["Edit"].tap()+    let retained = revealURL()+    XCTAssertEqual(retained.value as? String, original)+    retained.tap()+    retained.press(forDuration: 1.1)+    XCTAssertTrue(app.menuItems["Select All"].waitForExistence(timeout: 2))+    app.menuItems["Select All"].tap()+    let replacement = "https://example.com/replacement"+    retained.typeText(replacement)+    app.buttons["Save"].tap()+    app.buttons["Edit"].tap()+    let changed = revealURL()+    XCTAssertEqual(changed.value as? String, replacement)+    changed.tap()+    changed.press(forDuration: 1.1)+    XCTAssertTrue(app.menuItems["Select All"].waitForExistence(timeout: 2))+    app.menuItems["Select All"].tap()+    changed.typeText(XCUIKeyboardKey.delete.rawValue)+    app.buttons["Save"].tap()+    XCTAssertFalse(app.links["openPrescriptionURL"].exists)+  }+   private func checkAppointmentRepeats(_ count: Int?, app: XCUIApplication) {     app.navigationBars["Synthetic prescription"].buttons.element(boundBy: 0).tap()     let share = app.buttons["Share for appointment"]

Docs (10)

CHANGELOG.md Modified
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ad1a97a..24ac356 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,6 +27,7 @@ - T2413: Keep notification snoozes at their chosen 15-minute deadline, cancel queued originals, suppress elapsed replay and await background scheduling completion.  ### Added+- Optional prescription URL in the medication editor with a native Open prescription link, editable/clearable storage and portable version-2 backups that continue reading version 1. - T2460: Add small and medium all-profile next-medication widget source, protected 24-hour display snapshots, discreet mode and passive validated navigation; extension and app/test compilation, 27 widget domain tests and both widget UI journeys pass; the full serial regression gate passes (251 phone domain, 14 Watch domain and 23 UI tests). - T2453: Optional Over the counter / Prescription medication type in the normal editor and read-only detail, with existing entries unset and no prescription inference or scheduling changes. - T2471: Export an unencrypted portable phone backup through Files and restore validated profiles, care history, routines and photos into an empty destination, with interrupted-import recovery and explicit timer continuation.
docs/meddy-design.md Modified
diff --git a/docs/meddy-design.md b/docs/meddy-design.mdindex 3acb4bf..dfa71a1 100644--- a/docs/meddy-design.md+++ b/docs/meddy-design.md@@ -1728,3 +1728,8 @@ A synchronous display/limit read may build one complete ownership index and reus Profiles → More → Backup & restore exports an unencrypted JSON archive of all local phone profiles, care definitions, recorded history/tombstones, routines/checkpoints, stored recognition photos and semantic reminder state. Files chooses the destination and source. The [portable backup spec](../specs/portable-backup-restore/design.md) defines the versioned schema, integrity/resource checks and exact timestamp/byte preservation; appointment Markdown sharing remains a separate summary.  Import accepts only an empty local destination, allowing its unchanged generated Me placeholder. It never merges or replaces existing care. A single care/receipt save plus retained input journal makes interrupted import recoverable before care controls become available. Restored unfinished sessions remain paused/interrupted with original execution information retained; explicit continuation uses this phone. There is no passphrase, remote synchronization check or additional-device migration workflow. The archive is the phone's snapshot, not a claim about unseen cloud data. Accounts, entitlements and physical installations are outside this feature.+++## 33. Optional prescription URL (2026-10-20)++Medication prescriptions also support an optional user-entered HTTP/HTTPS URL. The normal editor adds, replaces or clears it; the detail Prescription section offers a native Open prescription link. Saving trims surrounding whitespace and retains the URL query and fragment exactly. No destination is fetched until the user activates the link. The field shares existing prescription ownership, concurrent-edit and revision checks. Appointment summaries do not include the URL. Portable backup version 2 preserves it; supported version 1 archives restore with an unset URL. See `specs/prescription-url/`.
docs/meddy-implementation-plan.md Modified
diff --git a/docs/meddy-implementation-plan.md b/docs/meddy-implementation-plan.mdindex 075c34d..c967adc 100644--- a/docs/meddy-implementation-plan.md+++ b/docs/meddy-implementation-plan.md@@ -385,3 +385,12 @@ The owner approved requirements and design and authorized task creation followed Four source-review lenses completed and findings were incorporated. Final phone domain verification passed 272 tests, including a 100,708,355-byte synthetic archive round trip in 15.49 seconds and a complete ten-entity disk restore/reopen. Watch passed 14 tests; the complete UI bundle passed all 23 cases after the documented case-specific prescription allowance and stale routine gesture target were corrected. Strict SwiftLint reports zero violations. All assertions and enabled bounded timeouts remain; only optional verbose diagnostic collection was disabled for the successful full UI invocation. Earlier failed receipts and exact native paths remain in the feature's implementation document. These are synthetic local results, not actual-data migration, account changes or physical-device acceptance.  T-2471 widget integration: rebased portable backup/restore onto merged PR13 (`cfcebc93`). Durable recovery invalidates widget snapshots; completed restore republishes from the preserved main context. Fresh serial publication gate passed widget build, phone 311, Watch 14 and full UI 27, with zero failures/skips and strict lint clean. Detailed receipts and fixture coverage limits are in `specs/portable-backup-restore/implementation.md`.+++## Prescription URL — implementation (2026-10-20)++Optional `Medication.prescriptionURL` is edited in the existing Prescription fields and opened from detail through SwiftUI Link. The editor validates complete HTTP/HTTPS URLs, trims outer whitespace and preserves the remaining text. Save/clear follow existing per-field merges and revision rotation. The nullable field preserves older records, and appointment sharing remains unchanged. Backup version 2 adds the optional URL, validates it and preserves its exact text through restore; version 1 without that key remains readable. This branch is stacked on pending backup PR #14 at `ad3c099`, containing main `cfcebc9`; no dependency merge is performed.++Added synthetic URL validation/conflict/revision checks, historical-store write/reopen coverage, exact complete-backup/disk round trips and a compact editor Save/Cancel/replace/clear journey without opening the URL. Native verification and publication receipts are recorded by the parent after execution; this paragraph does not claim their result. Strict lint and whitespace passed at the implementation checkpoint.++Prescription URL verification: full serial `make pre-push` passed with 325 phone domain tests, 14 Watch tests and 29 UI cases, zero failures/skips. Widget build, strict lint (188 files, zero violations) and whitespace passed. Synthetic historical-store and archive disk reopen preserve the URL; the native URL Save/Cancel/replace/clear case passed in 46.379 seconds. Four source review lenses found no production blockers. Corrected development test failures and native receipts are recorded in [verification](../specs/prescription-url/verification.md). No live-data operation, URL activation, physical installation, account change or merge.
specs/portable-backup-restore/design.md Modified
diff --git a/specs/portable-backup-restore/design.md b/specs/portable-backup-restore/design.mdindex 8aafabe..e31d08f 100644--- a/specs/portable-backup-restore/design.md+++ b/specs/portable-backup-restore/design.md@@ -11,7 +11,7 @@ Place portable values/codec/validation under `Services/Backups/`; the screen and | Component | Contract | | --- | --- | | `PhoneBackupService.capture(context:reminderState:)` | On MainActor, with no suspension during capture, fetch every care row and the semantic reminder snapshot, copy to immutable DTOs and sample the export clock. No visibility/active/history filtering. Fail if unsaved editor changes exist. Release the brief capture hold before encoding or presenting Files. |-| `PhoneBackupCodec.encode/validate` | Off the UI actor, enforce limits, produce/consume the exact version-1 byte contract and verify a written file by reopening it. Export and import use the same validator and limits. |+| `PhoneBackupCodec.encode/validate` | Off the UI actor, enforce limits, produce version-2 archives and consume supported version-1/version-2 byte contracts and verify a written file by reopening it. Export and import use the same validator and limits. | | `PhoneBackupImporter.preview(url:)` | Hold security-scoped access only while copying a bounded regular file into an operation-owned private directory. Decode and stage a no-CloudKit scratch store; close/reopen and compare archival values. Production preparation moves file/codec work off MainActor; scratch insertion/capture yields every 128 rows so model isolation is preserved without holding the care permit. Preview is immutable and keyed by the private copy's hash, not the original URL. | | `PhoneBackupImporter.apply(preview:)` | Acquire the local restore gate, recheck emptiness and preview bytes, stage a recovery journal, write records and receipt in one save, finish reminder state, then release normal use. Never call CRUD services that perform nested saves or effects. | | `BackupRecovery` | Runs before normal bootstrap/UI/services. A pending journal plus its transactional receipt determines whether to retry the record save or finish auxiliary installation. No deletion of existing care and no automatic empty-store fallback. |@@ -34,12 +34,12 @@ Place portable values/codec/validation under `Services/Backups/`; the screen and File name `meddy-backup-<UTC timestamp>.json`, system content type `public.json`. FileDialog and optional ShareLink use the same already-verified document. A canceled dialog never means “saved”.  ```text-EnvelopeV1 {-  format: "meddy-phone-backup", version: 1,+EnvelopeV2 {+  format: "meddy-phone-backup", version: 2,   payloadByteCount: Int, payloadSHA256: lower-case hex,-  payload: base64(exact UTF-8 PayloadV1 JSON bytes)+  payload: base64(exact UTF-8 PayloadV2 JSON bytes) }-PayloadV1 {+PayloadV2 {   archiveID: UUID, capturedAt: Double, producerVersion: String,   capturedClock: { wall: Double, monotonic: Double, continuityID: String },   records: { careProfiles, purposes, medications, administrations,@@ -51,7 +51,7 @@ PayloadV1 {  Each record has an explicit typed DTO matching the named stored fields in [field-inventory.md](field-inventory.md). Dates are finite IEEE-754 seconds since Foundation's 2001 reference date, preserving the native stored Double exactly; UUIDs use canonical strings; Data uses base64. Preserve optional null versus value, raw enum strings and exact stored binary bytes. Relationships use typed UUID foreign keys plus optional inverse-ID lists; validate agreement where lists are present, then wire both directions after inserting all rows. An absent inverse list and an empty inverse list are equivalent for SwiftData relationship semantics, not a reason to invent or omit rows. Arrays export in UUID order; step position retains its own value. The import receipt described below is operational bookkeeping, not exported care. -JSON decoding rejects duplicate object keys, unknown fields, missing required fields, invalid types and trailing bytes before DTO decoding; it does not rely on JSONDecoder's unknown-key tolerance. Version 1 is the only accepted archive version. Frozen/configuration Data retains its original bytes; known nested formats have explicit validators rather than re-encoding on import. Nil optional data and the existing permitted empty-data sentinels remain valid. Do not invoke modern editor constraints against historical values.+JSON decoding rejects duplicate object keys, unknown fields, missing required fields, invalid types and trailing bytes before DTO decoding; it does not rely on JSONDecoder's unknown-key tolerance. Versions 1 and 2 are accepted; version 1 omits prescriptionURL, while version 2 adds that optional key. Frozen/configuration Data retains its original bytes; known nested formats have explicit validators rather than re-encoding on import. Nil optional data and the existing permitted empty-data sentinels remain valid. Do not invoke modern editor constraints against historical values.  Shared limits: 128 MiB archive bytes, 80 MiB decoded payload, 32 MiB aggregate decoded Data, 100,000 care rows, 1 MiB per text field, 32 JSON container levels (also applied to JSON inside Data), and 1,000,000 lexical nodes. Object members and string/primitive tokens are bounded during scanning before materialization; base64 fields have a separate encoded-size allowance. Existing photo rules remain ≤350 KiB and ≤1024 px JPEG. Check encoded/decoded budgets before allocating their larger representation. An over-limit source fails export visibly; an over-limit input fails preview without mutation. SHA-256 covers the exact payload bytes, detects accidental changes and provides no authenticity claim. Counts shown in preview are computed from validated records, not trusted metadata. @@ -64,7 +64,7 @@ Shared limits: 128 MiB archive bytes, 80 MiB decoded payload, 32 MiB aggregate d  ### Nested Data contract -All dates, including nested data, retain the existing Foundation reference-date encoding. Version-1 archive validation reuses those value types and pure domain helpers, adding only graph/shape checks; it does not call mutating services. The archive version pins their supported shapes, including the existing optional StepProgress fields that default when absent. Unknown nested variants reject import rather than defaulting away content.+All dates, including nested data, retain the existing Foundation reference-date encoding. Supported archive validation reuses those value types and pure domain helpers, adding only graph/shape checks; it does not call mutating services. The archive version pins their supported shapes, including the existing optional StepProgress fields that default when absent. Unknown nested variants reject import rather than defaulting away content.  | Field | Null/empty handling | Decoder and structural checks | | --- | --- | --- |@@ -140,3 +140,8 @@ Risk: the 128 MiB personal archive budget may incur excessive peak memory | Veri ## Platform references  Apple documents the [system file importer and scoped URL lifetime](https://developer.apple.com/documentation/swiftui/view/fileimporter(ispresented:allowedcontenttypes:allowsmultipleselection:oncompletion:)), [FileDocument](https://developer.apple.com/documentation/swiftui/filedocument), [ModelContext.save](https://developer.apple.com/documentation/swiftdata/modelcontext/save()) and [SHA256](https://developer.apple.com/documentation/cryptokit/sha256). Those APIs provide primitives; the synthetic save/relaunch tests establish this app's recovery contract. No context7 tool was available; Apple documentation and current source/SDK patterns were used.+++### Prescription URL compatibility extension (2026-10-20)++The additive optional Medication `prescriptionURL` field is emitted in envelope version 2. Version 2 uses the same integrity, limits, validation and restore machinery. The decoder also accepts original version 1 archives, whose medications have no URL key; omitted fields become nil. A URL key in a version 1 archive is rejected rather than silently widening that pinned contract. Older apps reject version 2, preserving an explicit upgrade boundary instead of discarding the URL. Complete HTTP/HTTPS links retain their exact stored text and remain excluded from appointment sharing. The version-2 wire description above is the current writing contract; the original version-1 contract differs only by omitting this field.
specs/portable-backup-restore/field-inventory.md Modified
diff --git a/specs/portable-backup-restore/field-inventory.md b/specs/portable-backup-restore/field-inventory.mdindex b4d2ea1..5d6c8a7 100644--- a/specs/portable-backup-restore/field-inventory.md+++ b/specs/portable-backup-restore/field-inventory.md@@ -45,6 +45,7 @@ Source: `Meddy/Meddy/Models/Models.swift` - `recognitionPhotoData`: `Data?` - `prescribedOn`: `String?` - `prescribedBy`: `String?`+- `prescriptionURL`: `String?` (version 2; version 1 omits this field) - `supplyDurationDays`: `Int?` - `repeatsLeft`: `Int?` - `prescriptionRevision`: `UUID?`@@ -240,7 +241,7 @@ This is a source inventory, not the final interchange schema. Design must specif | PR13 widget control/display JSON | Derived; regenerate using destination App Group without copying old paths. System-owned per-widget discreet intent configuration requires reconfiguration. | | Permissions, pairing, CloudKit synchronization metadata, entitlements, credentials | Excluded system state; establish through normal platform flows. | -Medication.classificationRaw originated in PR12 and is present in the merged widget baseline (`cfcebc93`). Its optional raw string is captured, validated and restored without normalization, including unknown future values. The integrated inventory covers all 166 stored fields across ten care models.+Medication.classificationRaw originated in PR12 and is present in the merged widget baseline (`cfcebc93`). Its optional raw string is captured, validated and restored without normalization, including unknown future values. The integrated inventory covers all 167 stored fields across ten care models.  ## Planned additive implementation fields 
specs/prescription-url/design.md Added
diff --git a/specs/prescription-url/design.md b/specs/prescription-url/design.mdnew file mode 100644index 0000000..e09ed94--- /dev/null+++ b/specs/prescription-url/design.md@@ -0,0 +1,9 @@+# Prescription URL design++Small additive change stacked on pending backup PR #14, `ad3c099`, which contains main `cfcebc9`. The dependency is retained without merging it.++Add nullable String `Medication.prescriptionURL`; SwiftData can add the optional attribute to older stores without custom migration. Extend PrescriptionDetails and PrescriptionDraft with the value, sharing the existing three-way field merge and revision rotation. Keep URL syntax checking in a small Foundation helper reused by the editor, native SwiftUI Link and backup validation. The helper accepts only HTTP/HTTPS and does not fetch or normalize stored text. The native URL keyboard disables capitalization and autocorrection. A URL-only prescription renders its detail section.++BackupMedication copies/restores the optional text and recognizes its optional JSON key. Envelope version 2 identifies the extended contract so older apps reject it explicitly. The decoder still accepts version 1, rejects the URL key in version 1, and rejects unknown versions. Archive validation checks URL syntax with record/field diagnostics without including the link in errors. Stored values round-trip exactly.++Synthetic coverage: editor URL-only/defaults/validation/conflicts/clear/revision handling; existing historical disk fixture migration and reopen; exact complete-archive restore/reopen; old-version missing-key import and version mismatch rejection; separate native editor Save/Cancel/replace/clear journey with no link activation. Parent owns native test execution, pre-push review, changelog and publication.
specs/prescription-url/implementation.md Added
diff --git a/specs/prescription-url/implementation.md b/specs/prescription-url/implementation.mdnew file mode 100644index 0000000..27584f7--- /dev/null+++ b/specs/prescription-url/implementation.md@@ -0,0 +1,17 @@+# Prescription URL implementation++## Beginner++Medication prescriptions can keep a web link alongside their other details. Add or replace it in Edit, leave the field blank to clear it, or Cancel to retain the saved value. Detail offers Open prescription for the saved link. Saving does not load the webpage.++## Intermediate++Medication gains a nullable prescriptionURL string. PrescriptionDraft trims outer whitespace and validates complete HTTP/HTTPS URLs with the shared PrescriptionURL helper. Native SwiftUI Link delegates opening to the system. The URL participates in the existing field-by-field merge: untouched drafts retain newer saved values, conflicting changes reject Save, and successful changes rotate the prescription revision. Appointment summaries retain their existing omissions.++## Expert++The optional SwiftData attribute uses the existing additive migration path. Synthetic historical-store tests verify nil on upgrade, preservation of prior scalars/binary data and URL write/reopen. BackupMedication captures, inserts and compares the exact string; no query or fragment normalization occurs. Version 2 identifies the extended archive contract. The decoder accepts version 1 with the absent key, rejects URL-bearing payloads mislabelled version 1 and rejects unknown versions. Existing resource limits and integrity checks remain in force. Invalid URL diagnostics contain a fixed field/reason rather than the destination text.++## Completeness assessment++All requested behavior is implemented in source, with synthetic domain, disk migration, backup and UI coverage. Native execution results and the publication receipt are recorded in verification.md. The branch intentionally depends on pending backup PR #14 (ad3c099), which includes main cfcebc9. No account changes, installation, merge or live-data operation is part of this feature.
specs/prescription-url/requirements.md Added
diff --git a/specs/prescription-url/requirements.md b/specs/prescription-url/requirements.mdnew file mode 100644index 0000000..34386e7--- /dev/null+++ b/specs/prescription-url/requirements.md@@ -0,0 +1,10 @@+# Prescription URL++The owner requested an optional URL on medication prescriptions to keep the prescription with its medication.++1. All medication modes offer a Prescription URL field in the native prescription editor. Blank leaves it unset; Save supports adding, replacing and clearing; Cancel retains the saved value.+2. Accept complete HTTP/HTTPS links, trim surrounding whitespace, and preserve the remaining URL text, including query and fragment. Invalid input reports an editor error. Medication detail offers Open prescription only for a valid saved link, through the system URL action, without automatic loading.+3. Existing records retain their fields with a nil URL. URL edits follow existing ownership, lifecycle, concurrent-field merge and prescription revision rules and do not change doses, schedules or repeat counts.+4. Portable backup preserves the exact URL through validation, restore and disk reopen. New archives use version 2; version 1 remains readable with no URL. Appointment sharing does not add the link.++No prescription download, preview, account/permission changes, installation or real-data tests are included.
specs/prescription-url/tasks.md Added
diff --git a/specs/prescription-url/tasks.md b/specs/prescription-url/tasks.mdnew file mode 100644index 0000000..4be3715--- /dev/null+++ b/specs/prescription-url/tasks.md@@ -0,0 +1,16 @@+---+references:+    - requirements.md+    - design.md+---+# Prescription URL tasks++## Implementation++- [x] 1. Add optional URL persistence, validated native editing and detail link with existing merge/revision rules.++- [x] 2. Preserve exact links in versioned portable archives and retain version 1 compatibility.++- [x] 3. Add synthetic domain, migration/disk, backup and editor UI coverage; update feature documentation.++- [-] 4. Run required native gates, review and prepare the feature PR with the PR14 dependency recorded.
specs/prescription-url/verification.md Added
diff --git a/specs/prescription-url/verification.md b/specs/prescription-url/verification.mdnew file mode 100644index 0000000..d439b76--- /dev/null+++ b/specs/prescription-url/verification.md@@ -0,0 +1,26 @@+# Verification++Base: feature/prescription-url starts at ad3c099, the open backup PR #14 head, which includes main cfcebc9. No PR was merged.++## Development results++- Strict lint: 188 Swift files, zero violations. Whitespace checks passed.+- Initial focused invocation failed compilation due to a nested Swift Testing #require in the new archive test. Split the expression into separate required values.+- First full phone domain run executed 325 tests in 50 suites with one obsolete expectation: version 2 was treated as unsupported. The new version-1/version-2 compatibility test passed. Updated the unsupported version mutation to 3. Original receipt retained at build/results/test-domain.MbiUgN/Results.xcresult.+- Source review corrected the new UI journey's attempted relaunch: the isolated UI store is intentionally in memory. Disk persistence remains tested by the historical fixture and full archive disk round-trip.+- Reuse, quality, efficiency and requirements/documentation review agents reported no production blockers. Parent review confirmed native Link use, no appointment-share expansion and preserved query/fragment storage.++## Final serial gate++`make pre-push` with the assigned Meddy phone and Watch simulator IDs:++- Strict lint: 188 files, zero violations; whitespace passed.+- Unsigned widget build: passed (`build/results/build-widgets.diezJJ`).+- Phone domain: 325 tests, 50 suites; zero failures/skips (`build/results/test-domain.d2pp2i/Results.xcresult`).+- Watch domain: 14 tests, two suites; zero failures/skips (`build/results/test-watch.ValzDP/Results.xcresult`).+- Full phone UI: 29 cases; zero failures/skips, including the URL journey in 46.379 seconds (`build/results/test-ui-all.i3LUnz/Results.xcresult`).+- Complete make pre-push command exited 0. Assigned phone/Watch simulators were confirmed already Shutdown after the run; no owned build/diagnostic process remained.++The focused new UI case initially failed because the test's tapped caret position left a suffix during deletion. It confirmed the native Link exists. The test now uses Select All for replacement/clearing and retains exact equality. That failed receipt remains at `build/results/test-ui.tqwFP3/Results.xcresult`. Owned failure-diagnostic collectors were stopped after retaining assertion outcomes; native commands finished failed and are not counted as passes. Existing background-publication warnings remain visible.++Publication receipt pending. No real prescription URLs or health data were accessed. No URL was activated, no physical-device install or merge ran and account/signing/entitlements are unchanged. Transit is unavailable in this execution environment (no exposed tool or CLI); no ticket was created.

Things to double-check

Native evidence

Final synthetic phone, Watch and UI receipts are included. Earlier failed receipts remain recorded in verification.md. No live-data, URL activation, install, signing/account change or merge occurred. No line-coverage claim.