diff --git a/.gitignore b/.gitignore index 7475f3c..20574b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ # Xcode build/ +# Local build copies. They carried a signed app with an embedded.mobileprovision, +# so they must never reach a commit. +build-dev +build-final DerivedData/ xcuserdata/ *.xcuserstate @@ -15,6 +19,10 @@ FitCheck/Info.plist # Agent workspace — briefs, plans and scratch files for a run, never staged. .opencode/ +# The demo wardrobe is local-only: 39 garments with their PNGs, restored from +# docs/demo-assets.md. A -seedDemo launch without it warns instead of crashing. +Mocks/ + # Swift Package Manager .build/ .swiftpm/ diff --git a/.gitleaks.toml b/.gitleaks.toml index 2cb58e1..17a5858 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -5,9 +5,29 @@ title = "FitCheck gitleaks config" [extend] useDefault = true +[[rules]] +# An Apple team ID is the account identifier that signing is tied to, and it +# must come from FITCHECK_TEAM_ID at build time, never from a tracked file. +id = "apple-team-id" +description = "Apple Developer Team ID" +regex = '''(?i)(?:TeamIdentifier|DEVELOPMENT_TEAM|PROVISIONING_TEAM|team-identifier)(?:[ \t]*["']?[ \t]*[=:>][ \t]*["']?[A-Z0-9]{10}\b|\s*\s*\s*[A-Z0-9]{10}\b)''' +keywords = ["teamidentifier", "development_team", "provisioning_team", "team-identifier"] +tags = ["apple", "identity"] + +[[rules]] +# A provisioning profile carries the team ID, the device UDIDs and the +# entitlements; it is signed output for one machine and never committed. +id = "apple-provisioning-profile" +description = "Apple provisioning profile" +regex = '''(?i)(?:[ \t]*(?:ProvisionedDevices|TeamIdentifier)[ \t]*|BEGIN[ \t]+PROVISIONING[ \t]+PROFILE|ProvisioningProfile:[ \t]*[A-Za-z0-9._-]+)''' +keywords = ["provisioneddevices", "teamidentifier", "provisioning profile"] +tags = ["apple", "identity"] + [allowlist] description = "Global allowlist" paths = [ '''(?i)\.lock$''', '''(?i)package-lock\.json$''', ] +# The ten-X placeholder in the docs is not a team ID. +regexes = ['''X{10}'''] diff --git a/AGENTS.md b/AGENTS.md index 91614c7..727f6a4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,7 +103,7 @@ Simulator names are version-specific and go stale — `xcodebuild` prints the va 3. **`WeatherKitProvider`** — compiled and deliberately unwired. A free provisioning profile cannot carry the WeatherKit entitlement, so it can neither run nor be tested. Removed by the release flip: the entitlement in `project.yml`, WeatherKit enabled on the App ID, and `WeatherProviderKind.active` moved to `.weatherKit`. 4. **Apple Intelligence paths** — `OutfitGenerator.generate` past the empty-closet guard, `ModelUnavailability.current` (which reads the device's own answer), and in `GarmentClassifier` only Vision and the live inference. Neither CI nor the Simulator carries model assets, and faking the model is forbidden: the product promises to say the model is unavailable, not to guess. The classifier's **prompt builder is not on this list**: `GarmentClassifier.instructions(language:)`, `vocabulary` and `prompt(for:)` are pure — no session, no device, no image; the evidence they render is a `GarmentEvidence` value — and [`ClassifierPromptTests`](FitCheckTests/LocalizationPromptTests.swift) covers them, which is why the file reads 45.98% instead of 0%. The cut-out `Attachment` on iOS 27 is inside the live inference, so it is on the list with the model call it belongs to. Removed when the suite runs on a device that has Apple Intelligence. 5. **Defensive branches unreachable by construction** — `OpenMeteoProvider`'s `components.url` guard (the base URL is hardcoded and valid), the `@unknown default` arms, and `UserSettings.reminderDate`'s nil-coalescing on a valid hour and minute. They exist for the day the input changes; no input reaches them today. Removed when an input can actually produce one, at which point its test arrives with it. - 6. **Process wiring** — `FitCheckApp`'s container creation and seeding, the store opener it builds and hands to the scene along with the deleter behind `Start over`, and `UserDefaults.forCurrentRun`'s UI-testing branch. They need a launched app, which makes them the UI tests' business rather than the unit target's: the wiring and the deleter in `FitCheckApp` only run inside a launched app, and a store that fails to open cannot be produced from the unit target. `-failFirstStoreOpen` is what closes that gap: on a `-uiTesting` launch it makes the first open throw and every later one succeed, so [`RecoveryUITests.testUnreadableStoreRecoversThroughStartOver`](FitCheckUITests/RecoveryUITests.swift) can reach the recovery screen, tap through `Start over`, land on the empty closet, and then relaunch without the argument to prove the failure is one-shot and a normal launch unaffected — which is also the test the [`StoreRecoveryView`](FitCheck/Features/Recovery/StoreRecoveryView.swift) allowlist reason names. `StoreOpener`'s own decision is not here — it takes its opener and deleter as closures precisely so it is unit-tested — and `StoreRecoveryView` is a view body, under entry 1. + 6. **Process wiring** — `FitCheckApp`'s container creation and seeding, the store opener it builds and hands to the scene along with the deleter behind `Start over`, and `UserDefaults.forCurrentRun`'s UI-testing branch. They need a launched app, which makes them the UI tests' business rather than the unit target's: the wiring and the deleter in `FitCheckApp` only run inside a launched app, and a store that fails to open cannot be produced from the unit target. `-failFirstStoreOpen` is what closes that gap: on a `-uiTesting` launch it makes the first open throw and every later one succeed, so [`RecoveryUITests.testUnreadableStoreRecoversThroughStartOver`](FitCheckUITests/RecoveryUITests.swift) can reach the recovery screen, tap through `Start over`, land on the empty closet, and then relaunch without the argument to prove the failure is one-shot and a normal launch unaffected — which is also the test the [`StoreRecoveryView`](FitCheck/Features/Recovery/StoreRecoveryView.swift) allowlist reason names. `StoreOpener`'s own decision is not here — it takes its opener and deleter as closures precisely so it is unit-tested — and `StoreRecoveryView` is a view body, under entry 1. `DemoCloset` is here for the same reason: its `-seedDemo` seeding and its `Bundle.main` lookups only run inside a launched app, and the folder it reads is local-only, so the unit target has neither the launch path nor the files the lookups ask for. 7. **`AppState` (99.13%, 227/229)** — `generate` is covered through the injected `OutfitGenerating`: the four outcomes, the exclusion set, cancellation, the deleted-garment guard and the toast dismissal are all driven by a stub. The two lines still uncovered are line 290 (`ToastMessage.id`) and line 315 (`Confirmation.id`), the compiler-generated `UUID()` default initialisers, which xccov reports as unexecuted although both types are constructed in covered tests — an instrumentation gap, not untested behaviour. Kept because those lines cannot be covered from the unit target; removed when the instrumentation reports them, or when the ids stop being `UUID()` properties. 8. **Vision's foreground instances** — in `GarmentSegmenter` the request itself, the per-instance masks it returns and the selection that reads them: `VNGenerateForegroundInstanceMaskRequest` answers only against a real image on the Vision stack, and the unit target carries neither, so the request and the instance selection cannot be unit-tested. It is not the whole file: the matte refinement and the compositing are [`CutoutMatte`](FitCheck/Services/CutoutMatte.swift), which knows nothing of Vision or SwiftData and takes bytes in and bytes out — its erosion, feather, transparent margin, soft alpha range and largest-instance comparison by non-zero area are tested on synthetic masks — and the colour measurement, `colourShares(in:limit:)`, is bytes in and hex-plus-share out, testable on a rendered image. That is the same split as the classifier's prompt builder. Removed when the suite runs where the request can answer. 9. **Photo policy adapters** — `SystemPhotoSafety` and `VisionPhotoSafety` in [`PhotoSafety`](FitCheck/Services/PhotoSafety.swift): the first answers only when the system's own Sensitive Content Analysis runs, which the unit target cannot produce and which is inert without the paid-account entitlement ([`docs/photo-policy.md`](docs/photo-policy.md) §5); the second reads a Vision taxonomy that carries no nudity or gore identifier to match. The rule they feed is not on this list: `PhotoVerdict` and the `PhotoIntake` decision above the adapters are pure and expected at 100% through a fake `PhotoSafetyChecking`. Removed per adapter only by pulling logic out of it and behind a fakeable seam — never by faking the framework to chase the number. @@ -131,7 +131,9 @@ Because the container is declared once on the `WindowGroup`, feature views get t xcrun simctl launch booted com.mxo01.FitCheck -uiTesting -seedDemo ``` -It is data, not code: [`DemoCloset`](FitCheck/App/DemoCloset.swift) only knows how to decode it, so adding a garment means dropping a PNG in and adding an entry to the JSON. The folder is a *folder reference* in `project.yml`, which is what keeps the subdirectory structure alive inside the bundle for `Bundle.main.url(forResource:subdirectory:)` to find. +The folder is **not tracked**: it is local-only, restored from [`docs/demo-assets.md`](docs/demo-assets.md), and a `-seedDemo` launch without it warns instead of crashing. + +It is data, not code: [`DemoCloset`](FitCheck/App/DemoCloset.swift) only knows how to decode it, so adding a garment means dropping a PNG in and adding an entry to the JSON. A `postBuildScripts` phase in `project.yml` copies the folder into the bundle when it is present — keeping the subdirectory structure alive for `Bundle.main.url(forResource:subdirectory:)` to find — and removes any stale copy when it is not, so a tree without `Mocks/` still builds. Not to be confused with `-seedCloset`, the five-garment fixture the UI tests assert against down to the item count. diff --git a/FitCheck/App/DemoCloset.swift b/FitCheck/App/DemoCloset.swift index e8ad63d..3e71c41 100644 --- a/FitCheck/App/DemoCloset.swift +++ b/FitCheck/App/DemoCloset.swift @@ -21,10 +21,34 @@ import SwiftData /// move because the screenshots want a fuller closet. enum DemoCloset { + /// What a seeding pass did, so the caller can tell an empty demo closet + /// from an absent one. Silence was the old answer, and it read as a bug in + /// the screenshot run rather than as a folder that never reached the bundle. + enum Outcome: Equatable { + case seeded(garments: Int) + /// `Mocks/` is not in this build — the folder is local-only. + case assetsUnavailable + } + /// Where the folder reference lands inside the app bundle. private static let folder = "Mocks" private static let garmentsFolder = "Mocks/Garments" + /// Whether the demo wardrobe reached the bundle at all. The folder is + /// local-only, so a tree without it builds and runs — it just has no + /// closet to seed, and this is how a caller finds that out before asking. + static var isBundled: Bool { + catalogueURL != nil + } + + /// The catalogue's own location, resolved once so `isBundled` and the + /// loader cannot disagree about what "present" means. + private static var catalogueURL: URL? { + Bundle.main.url( + forResource: "closet", withExtension: "json", subdirectory: folder + ) + } + /// The shape of `Mocks/closet.json`. /// /// `ClothingCategory` and `Warmth` are `Codable` over their own raw @@ -63,8 +87,9 @@ enum DemoCloset { } } - static func seed(into context: ModelContext) { - guard let catalogue else { return } + @discardableResult + static func seed(into context: ModelContext) -> Outcome { + guard let catalogue else { return .assetsUnavailable } var inserted: [String: ClothingItem] = [:] @@ -103,21 +128,21 @@ enum DemoCloset { } try? context.save() + + return .seeded(garments: catalogue.garments.count) } private static var catalogue: Catalogue? { - guard let url = Bundle.main.url( - forResource: "closet", withExtension: "json", subdirectory: folder - ) else { - assertionFailure("\(folder)/closet.json is missing from the bundle") - return nil - } + // Absent is not a failure: the folder is local-only, and `isBundled` + // is what the screen reads to say so. + guard let url = catalogueURL else { return nil } do { return try JSONDecoder().decode(Catalogue.self, from: Data(contentsOf: url)) } catch { // Loud in debug, silent in release: a malformed catalogue should - // stop whoever is editing it, not the person running the app. + // stop whoever is editing it, not the person running the app. The + // assertion stays — the file is there, so this is a defect. assertionFailure("\(folder)/closet.json could not be read: \(error)") return nil } diff --git a/FitCheck/App/FitCheckApp.swift b/FitCheck/App/FitCheckApp.swift index 71f2baa..e682a40 100644 --- a/FitCheck/App/FitCheckApp.swift +++ b/FitCheck/App/FitCheckApp.swift @@ -152,6 +152,9 @@ struct FitCheckApp: App { // second round of screenshots used to stack another closet on top of // the first. if isEmpty(container), Self.shouldSeedDemo { + // The outcome is not acted on here: the scene's content reads + // `DemoCloset.isBundled` itself and warns on screen when the folder + // is missing, which is the only thing a caller could do with it. DemoCloset.seed(into: ModelContext(container)) } else if isEmpty(container), Self.shouldSeedCloset { let context = ModelContext(container) diff --git a/FitCheck/App/RootView.swift b/FitCheck/App/RootView.swift index fcf8c5c..2c2df1e 100644 --- a/FitCheck/App/RootView.swift +++ b/FitCheck/App/RootView.swift @@ -264,6 +264,20 @@ private struct AppContent: View { } .environment(\.theme, theme) .animation(.snappy(duration: 0.28), value: app.isSelecting) + // `Mocks/` is local-only data, so a `-seedDemo` launch on a tree + // without it comes up on an empty closet that looks like a broken + // screenshot run. Say why, once, and name the folder to restore. + .task { + guard !FitCheckApp.isUnitTestHost, + FitCheckApp.shouldSeedDemo, + !DemoCloset.isBundled + else { return } + app.showToast( + .warning, + "Demo closet unavailable", + "Mocks/ is not bundled - restore it with docs/demo-assets.md." + ) + } } /// Selected tabs take the filled symbol, the rest the outlined one. diff --git a/FitCheckTests/LocalizationPromptTests.swift b/FitCheckTests/LocalizationPromptTests.swift index f23aea8..5aba946 100644 --- a/FitCheckTests/LocalizationPromptTests.swift +++ b/FitCheckTests/LocalizationPromptTests.swift @@ -979,6 +979,15 @@ struct ClassifierPromptTests { ), ] + /// Whether `Mocks/` reached the test host's bundle. The folder is + /// local-only, so the reviewed-seasons test is skipped rather than failed + /// on a tree that does not carry it. + private static var answerKeyIsBundled: Bool { + Bundle.main.url( + forResource: "closet", withExtension: "json", subdirectory: "Mocks" + ) != nil + } + /// Read through `Bundle.main` because the unit target is hosted by the app: /// `Mocks` is a folder reference in the app bundle, and the key is only ever /// there. A missing bundle is reported as a missing bundle rather than @@ -993,6 +1002,7 @@ struct ClassifierPromptTests { @Test( "The reviewed answer key seasons jewellery, belts and sunglasses as the issue settled", + .enabled(if: Self.answerKeyIsBundled), arguments: Self.reviewedSeasons ) func answerKeyCarriesTheReviewedSeasons(reading: AnswerKeyReading) throws { diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6bb2bc5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +All rights reserved. + +Copyright (c) 2026 Mario Di Modica + +This repository is published so it can be read. It is not open source and no licence is granted: no part of it — source code, documentation, design or other content — may be copied, modified, merged, published, distributed, sublicensed, sold or otherwise used without the copyright holder's prior written permission. + +Third-party assets keep their own licences. The demo garment photographs, when restored locally, come from Unsplash and remain under the Unsplash licence; every dependency remains under the terms it ships with. + +The software is provided "as is", without warranty of any kind, express or implied. diff --git a/Mocks/Garments/demo-bead-necklace.png b/Mocks/Garments/demo-bead-necklace.png deleted file mode 100644 index 453e376..0000000 Binary files a/Mocks/Garments/demo-bead-necklace.png and /dev/null differ diff --git a/Mocks/Garments/demo-beanie.png b/Mocks/Garments/demo-beanie.png deleted file mode 100644 index b1c3229..0000000 Binary files a/Mocks/Garments/demo-beanie.png and /dev/null differ diff --git a/Mocks/Garments/demo-black-jeans.png b/Mocks/Garments/demo-black-jeans.png deleted file mode 100644 index 9e82885..0000000 Binary files a/Mocks/Garments/demo-black-jeans.png and /dev/null differ diff --git a/Mocks/Garments/demo-blanket-scarf.png b/Mocks/Garments/demo-blanket-scarf.png deleted file mode 100644 index a4b6713..0000000 Binary files a/Mocks/Garments/demo-blanket-scarf.png and /dev/null differ diff --git a/Mocks/Garments/demo-blazer.png b/Mocks/Garments/demo-blazer.png deleted file mode 100644 index 919ea80..0000000 Binary files a/Mocks/Garments/demo-blazer.png and /dev/null differ diff --git a/Mocks/Garments/demo-blue-jeans.png b/Mocks/Garments/demo-blue-jeans.png deleted file mode 100644 index 9dd731d..0000000 Binary files a/Mocks/Garments/demo-blue-jeans.png and /dev/null differ diff --git a/Mocks/Garments/demo-brown-glasses.png b/Mocks/Garments/demo-brown-glasses.png deleted file mode 100644 index 0651dd3..0000000 Binary files a/Mocks/Garments/demo-brown-glasses.png and /dev/null differ diff --git a/Mocks/Garments/demo-bucket-hat.png b/Mocks/Garments/demo-bucket-hat.png deleted file mode 100644 index c17a220..0000000 Binary files a/Mocks/Garments/demo-bucket-hat.png and /dev/null differ diff --git a/Mocks/Garments/demo-cap.png b/Mocks/Garments/demo-cap.png deleted file mode 100644 index fcc9258..0000000 Binary files a/Mocks/Garments/demo-cap.png and /dev/null differ diff --git a/Mocks/Garments/demo-cotton-tee.png b/Mocks/Garments/demo-cotton-tee.png deleted file mode 100644 index 62c4193..0000000 Binary files a/Mocks/Garments/demo-cotton-tee.png and /dev/null differ diff --git a/Mocks/Garments/demo-court-sneakers.png b/Mocks/Garments/demo-court-sneakers.png deleted file mode 100644 index 366ac5d..0000000 Binary files a/Mocks/Garments/demo-court-sneakers.png and /dev/null differ diff --git a/Mocks/Garments/demo-denim-jacket.png b/Mocks/Garments/demo-denim-jacket.png deleted file mode 100644 index 048120c..0000000 Binary files a/Mocks/Garments/demo-denim-jacket.png and /dev/null differ diff --git a/Mocks/Garments/demo-drop-earrings.png b/Mocks/Garments/demo-drop-earrings.png deleted file mode 100644 index 4f2937c..0000000 Binary files a/Mocks/Garments/demo-drop-earrings.png and /dev/null differ diff --git a/Mocks/Garments/demo-field-jacket.png b/Mocks/Garments/demo-field-jacket.png deleted file mode 100644 index dc145fd..0000000 Binary files a/Mocks/Garments/demo-field-jacket.png and /dev/null differ diff --git a/Mocks/Garments/demo-fringed-scarf.png b/Mocks/Garments/demo-fringed-scarf.png deleted file mode 100644 index 509fe2e..0000000 Binary files a/Mocks/Garments/demo-fringed-scarf.png and /dev/null differ diff --git a/Mocks/Garments/demo-grey-trousers.png b/Mocks/Garments/demo-grey-trousers.png deleted file mode 100644 index a18172f..0000000 Binary files a/Mocks/Garments/demo-grey-trousers.png and /dev/null differ diff --git a/Mocks/Garments/demo-hoodie.png b/Mocks/Garments/demo-hoodie.png deleted file mode 100644 index fb5a1cf..0000000 Binary files a/Mocks/Garments/demo-hoodie.png and /dev/null differ diff --git a/Mocks/Garments/demo-knit-sweater.png b/Mocks/Garments/demo-knit-sweater.png deleted file mode 100644 index d4b0351..0000000 Binary files a/Mocks/Garments/demo-knit-sweater.png and /dev/null differ diff --git a/Mocks/Garments/demo-leather-belt.png b/Mocks/Garments/demo-leather-belt.png deleted file mode 100644 index 349e189..0000000 Binary files a/Mocks/Garments/demo-leather-belt.png and /dev/null differ diff --git a/Mocks/Garments/demo-leather-brogues.png b/Mocks/Garments/demo-leather-brogues.png deleted file mode 100644 index 887e429..0000000 Binary files a/Mocks/Garments/demo-leather-brogues.png and /dev/null differ diff --git a/Mocks/Garments/demo-leather-jacket.png b/Mocks/Garments/demo-leather-jacket.png deleted file mode 100644 index 14bbdc6..0000000 Binary files a/Mocks/Garments/demo-leather-jacket.png and /dev/null differ diff --git a/Mocks/Garments/demo-navy-belt.png b/Mocks/Garments/demo-navy-belt.png deleted file mode 100644 index 5661221..0000000 Binary files a/Mocks/Garments/demo-navy-belt.png and /dev/null differ diff --git a/Mocks/Garments/demo-patterned-socks.png b/Mocks/Garments/demo-patterned-socks.png deleted file mode 100644 index 4b380eb..0000000 Binary files a/Mocks/Garments/demo-patterned-socks.png and /dev/null differ diff --git a/Mocks/Garments/demo-pearl-necklace.png b/Mocks/Garments/demo-pearl-necklace.png deleted file mode 100644 index b921b21..0000000 Binary files a/Mocks/Garments/demo-pearl-necklace.png and /dev/null differ diff --git a/Mocks/Garments/demo-relaxed-jeans.png b/Mocks/Garments/demo-relaxed-jeans.png deleted file mode 100644 index 6d72b0e..0000000 Binary files a/Mocks/Garments/demo-relaxed-jeans.png and /dev/null differ diff --git a/Mocks/Garments/demo-ribbed-socks.png b/Mocks/Garments/demo-ribbed-socks.png deleted file mode 100644 index cec4683..0000000 Binary files a/Mocks/Garments/demo-ribbed-socks.png and /dev/null differ diff --git a/Mocks/Garments/demo-round-glasses.png b/Mocks/Garments/demo-round-glasses.png deleted file mode 100644 index 2e0fb7b..0000000 Binary files a/Mocks/Garments/demo-round-glasses.png and /dev/null differ diff --git a/Mocks/Garments/demo-running-sneakers.png b/Mocks/Garments/demo-running-sneakers.png deleted file mode 100644 index c549b19..0000000 Binary files a/Mocks/Garments/demo-running-sneakers.png and /dev/null differ diff --git a/Mocks/Garments/demo-silk-scarf.png b/Mocks/Garments/demo-silk-scarf.png deleted file mode 100644 index d2f951c..0000000 Binary files a/Mocks/Garments/demo-silk-scarf.png and /dev/null differ diff --git a/Mocks/Garments/demo-silver-rings.png b/Mocks/Garments/demo-silver-rings.png deleted file mode 100644 index 6a6ce98..0000000 Binary files a/Mocks/Garments/demo-silver-rings.png and /dev/null differ diff --git a/Mocks/Garments/demo-sport-glasses.png b/Mocks/Garments/demo-sport-glasses.png deleted file mode 100644 index ac95a92..0000000 Binary files a/Mocks/Garments/demo-sport-glasses.png and /dev/null differ diff --git a/Mocks/Garments/demo-striped-socks.png b/Mocks/Garments/demo-striped-socks.png deleted file mode 100644 index 3a2300e..0000000 Binary files a/Mocks/Garments/demo-striped-socks.png and /dev/null differ diff --git a/Mocks/Garments/demo-suede-belt.png b/Mocks/Garments/demo-suede-belt.png deleted file mode 100644 index d27a0ab..0000000 Binary files a/Mocks/Garments/demo-suede-belt.png and /dev/null differ diff --git a/Mocks/Garments/demo-suede-trainers.png b/Mocks/Garments/demo-suede-trainers.png deleted file mode 100644 index 4e1348c..0000000 Binary files a/Mocks/Garments/demo-suede-trainers.png and /dev/null differ diff --git a/Mocks/Garments/demo-wayfarers.png b/Mocks/Garments/demo-wayfarers.png deleted file mode 100644 index 2c81f1b..0000000 Binary files a/Mocks/Garments/demo-wayfarers.png and /dev/null differ diff --git a/Mocks/Garments/demo-white-tee.png b/Mocks/Garments/demo-white-tee.png deleted file mode 100644 index 8abe382..0000000 Binary files a/Mocks/Garments/demo-white-tee.png and /dev/null differ diff --git a/Mocks/Garments/demo-wool-scarf.png b/Mocks/Garments/demo-wool-scarf.png deleted file mode 100644 index 87422ee..0000000 Binary files a/Mocks/Garments/demo-wool-scarf.png and /dev/null differ diff --git a/Mocks/Garments/demo-wool-socks.png b/Mocks/Garments/demo-wool-socks.png deleted file mode 100644 index 7fd97ff..0000000 Binary files a/Mocks/Garments/demo-wool-socks.png and /dev/null differ diff --git a/Mocks/Garments/demo-woven-belt.png b/Mocks/Garments/demo-woven-belt.png deleted file mode 100644 index 2c0efe0..0000000 Binary files a/Mocks/Garments/demo-woven-belt.png and /dev/null differ diff --git a/Mocks/README.md b/Mocks/README.md deleted file mode 100644 index 423adf1..0000000 --- a/Mocks/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Mocks - -A wardrobe of test garments, used only when the app is launched with -`-seedDemo`: - -```bash -xcrun simctl launch booted com.mxo01.FitCheck -uiTesting -seedDemo -``` - -Nothing here is read on a normal launch, and none of it is user data — it -exists so screenshots and renders have a full closet to show. - -- `closet.json` — the catalogue: 39 garments across all ten categories, plus - three saved looks that reference garments by name. -- `Garments/` — one transparent PNG per garment, 400px, named by the - catalogue's `asset` field. - -The folder is added to the app target as a folder reference, so its structure -survives into the bundle and `Bundle.main.url(forResource:subdirectory:)` can -find it. Adding a garment means dropping a PNG in `Garments/` and adding an -entry to `closet.json` — no recompiling anything by hand, no Swift to edit. - -## Where the photographs come from - -Unsplash, whose licence allows free use including commercially. That is why -they are here and a retailer's product shots are not: those would carry -someone else's copyright into whatever the render is used for. Unsplash+ -(`plus.unsplash.com`) images are excluded — that tier is a paid licence. - -Each photo was cut out with `VNGenerateForegroundInstanceMaskRequest`, the -same Vision request [`GarmentSegmenter`](../FitCheck/Services/GarmentSegmenter.swift) -runs on a real capture, so a seeded garment is indistinguishable from a -photographed one downstream. diff --git a/Mocks/closet.json b/Mocks/closet.json deleted file mode 100644 index 0b70af0..0000000 --- a/Mocks/closet.json +++ /dev/null @@ -1,520 +0,0 @@ -{ - "garments": [ - { - "asset": "demo-white-tee", - "name": "Relaxed Cotton T-Shirt", - "category": "Tops", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Upper body", - "role": "Essential", - "colours": "White", - "wornCount": 12, - "lastWornDaysAgo": 3 - }, - { - "asset": "demo-cotton-tee", - "name": "Crew Neck T-Shirt", - "category": "Tops", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Upper body", - "role": "Essential", - "colours": "White", - "wornCount": 23, - "lastWornDaysAgo": 2 - }, - { - "asset": "demo-knit-sweater", - "name": "Merino Crew Sweater", - "category": "Tops", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Upper body", - "role": "Essential", - "colours": "Rust", - "wornCount": 7, - "lastWornDaysAgo": 9 - }, - { - "asset": "demo-hoodie", - "name": "Heavyweight Hoodie", - "category": "Tops", - "warmth": "Mid layer", - "season": "Autumn", - "bodyArea": "Upper body", - "role": "Essential", - "colours": "Black", - "wornCount": 15, - "lastWornDaysAgo": 5 - }, - { - "asset": "demo-blue-jeans", - "name": "Slim Fit Jeans", - "category": "Bottoms", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Lower body", - "role": "Essential", - "colours": "Indigo", - "wornCount": 18, - "lastWornDaysAgo": 4 - }, - { - "asset": "demo-black-jeans", - "name": "Straight Fit Jeans", - "category": "Bottoms", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Lower body", - "role": "Essential", - "colours": "Washed black", - "wornCount": 9, - "lastWornDaysAgo": 6 - }, - { - "asset": "demo-relaxed-jeans", - "name": "Relaxed Jeans", - "category": "Bottoms", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Lower body", - "role": "Essential", - "colours": "Black", - "wornCount": 4, - "lastWornDaysAgo": 12 - }, - { - "asset": "demo-grey-trousers", - "name": "Pleated Trousers", - "category": "Bottoms", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Lower body", - "role": "Essential", - "colours": "Grey", - "wornCount": 6, - "lastWornDaysAgo": 8 - }, - { - "asset": "demo-court-sneakers", - "name": "Court Sneakers", - "category": "Shoes", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Feet", - "role": "Essential", - "colours": "Ice blue", - "wornCount": 15, - "lastWornDaysAgo": 5 - }, - { - "asset": "demo-running-sneakers", - "name": "Running Sneakers", - "category": "Shoes", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Feet", - "role": "Essential", - "colours": "White, Orange", - "wornCount": 31, - "lastWornDaysAgo": 2 - }, - { - "asset": "demo-suede-trainers", - "name": "Suede Trainers", - "category": "Shoes", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Feet", - "role": "Essential", - "colours": "Grey", - "wornCount": 6, - "lastWornDaysAgo": 13 - }, - { - "asset": "demo-leather-brogues", - "name": "Leather Brogues", - "category": "Shoes", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Feet", - "role": "Essential", - "colours": "Burgundy", - "wornCount": 3, - "lastWornDaysAgo": 22 - }, - { - "asset": "demo-leather-jacket", - "name": "Leather Biker Jacket", - "category": "Outerwear", - "warmth": "Mid layer", - "season": "Autumn", - "bodyArea": "Upper body", - "role": "Layer", - "colours": "Black", - "wornCount": 8, - "lastWornDaysAgo": 7 - }, - { - "asset": "demo-field-jacket", - "name": "Cotton Field Jacket", - "category": "Outerwear", - "warmth": "Mid layer", - "season": "Autumn", - "bodyArea": "Upper body", - "role": "Layer", - "colours": "Olive", - "wornCount": 4, - "lastWornDaysAgo": 19 - }, - { - "asset": "demo-denim-jacket", - "name": "Denim Jacket", - "category": "Outerwear", - "warmth": "Mid layer", - "season": "Autumn", - "bodyArea": "Upper body", - "role": "Layer", - "colours": "Washed blue", - "wornCount": 11, - "lastWornDaysAgo": 6 - }, - { - "asset": "demo-blazer", - "name": "Linen Blazer", - "category": "Outerwear", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Upper body", - "role": "Layer", - "colours": "Off-white", - "wornCount": 2, - "lastWornDaysAgo": 30 - }, - { - "asset": "demo-beanie", - "name": "Cable Knit Beanie", - "category": "Hats", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Head", - "role": "Accessory", - "colours": "Mustard", - "wornCount": 9, - "lastWornDaysAgo": 11 - }, - { - "asset": "demo-cap", - "name": "Cotton Cap", - "category": "Hats", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Head", - "role": "Accessory", - "colours": "Yellow", - "wornCount": 5, - "lastWornDaysAgo": 16 - }, - { - "asset": "demo-bucket-hat", - "name": "Bucket Hat", - "category": "Hats", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Head", - "role": "Accessory", - "colours": "Sand", - "wornCount": 2, - "lastWornDaysAgo": 40 - }, - { - "asset": "demo-silk-scarf", - "name": "Silk Scarf", - "category": "Scarves", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Lilac", - "wornCount": 3, - "lastWornDaysAgo": 24 - }, - { - "asset": "demo-wool-scarf", - "name": "Striped Wool Scarf", - "category": "Scarves", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Red, Black", - "wornCount": 14, - "lastWornDaysAgo": 8 - }, - { - "asset": "demo-fringed-scarf", - "name": "Fringed Scarf", - "category": "Scarves", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Burgundy", - "wornCount": 6, - "lastWornDaysAgo": 15 - }, - { - "asset": "demo-blanket-scarf", - "name": "Blanket Scarf", - "category": "Scarves", - "warmth": "Heavy", - "season": "Winter", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Red, Navy", - "wornCount": 4, - "lastWornDaysAgo": 21 - }, - { - "asset": "demo-wayfarers", - "name": "Wayfarer Sunglasses", - "category": "Glasses", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Eyes", - "role": "Accessory", - "colours": "Black", - "wornCount": 21, - "lastWornDaysAgo": 3 - }, - { - "asset": "demo-round-glasses", - "name": "Round Sunglasses", - "category": "Glasses", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Eyes", - "role": "Accessory", - "colours": "Tortoise", - "wornCount": 7, - "lastWornDaysAgo": 14 - }, - { - "asset": "demo-sport-glasses", - "name": "Sport Sunglasses", - "category": "Glasses", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Eyes", - "role": "Accessory", - "colours": "Black", - "wornCount": 12, - "lastWornDaysAgo": 9 - }, - { - "asset": "demo-brown-glasses", - "name": "Brown Lens Sunglasses", - "category": "Glasses", - "warmth": "Light", - "season": "Summer", - "bodyArea": "Eyes", - "role": "Accessory", - "colours": "Brown", - "wornCount": 5, - "lastWornDaysAgo": 18 - }, - { - "asset": "demo-drop-earrings", - "name": "Drop Earrings", - "category": "Jewellery", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Head", - "role": "Accessory", - "colours": "Gold, Blue", - "wornCount": 6, - "lastWornDaysAgo": 12 - }, - { - "asset": "demo-silver-rings", - "name": "Stacking Rings", - "category": "Jewellery", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Hands", - "role": "Accessory", - "colours": "Silver", - "wornCount": 18, - "lastWornDaysAgo": 4 - }, - { - "asset": "demo-pearl-necklace", - "name": "Pearl Necklace", - "category": "Jewellery", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Pearl", - "wornCount": 3, - "lastWornDaysAgo": 26 - }, - { - "asset": "demo-bead-necklace", - "name": "Beaded Necklace", - "category": "Jewellery", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Neck", - "role": "Accessory", - "colours": "Coral", - "wornCount": 4, - "lastWornDaysAgo": 17 - }, - { - "asset": "demo-leather-belt", - "name": "Leather Belt", - "category": "Belts", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Waist", - "role": "Accessory", - "colours": "Dark brown", - "wornCount": 19, - "lastWornDaysAgo": 3 - }, - { - "asset": "demo-woven-belt", - "name": "Woven Belt", - "category": "Belts", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Waist", - "role": "Accessory", - "colours": "Brown", - "wornCount": 8, - "lastWornDaysAgo": 10 - }, - { - "asset": "demo-suede-belt", - "name": "Suede Belt", - "category": "Belts", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Waist", - "role": "Accessory", - "colours": "Tan", - "wornCount": 5, - "lastWornDaysAgo": 20 - }, - { - "asset": "demo-navy-belt", - "name": "Navy Belt", - "category": "Belts", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Waist", - "role": "Accessory", - "colours": "Navy", - "wornCount": 7, - "lastWornDaysAgo": 13 - }, - { - "asset": "demo-ribbed-socks", - "name": "Ribbed Socks", - "category": "Socks", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Feet", - "role": "Accessory", - "colours": "Mustard", - "wornCount": 11, - "lastWornDaysAgo": 5 - }, - { - "asset": "demo-patterned-socks", - "name": "Patterned Socks", - "category": "Socks", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Feet", - "role": "Accessory", - "colours": "Fair Isle", - "wornCount": 6, - "lastWornDaysAgo": 12 - }, - { - "asset": "demo-striped-socks", - "name": "Striped Socks", - "category": "Socks", - "warmth": "Light", - "season": "Year-round", - "bodyArea": "Feet", - "role": "Accessory", - "colours": "Multicolour", - "wornCount": 9, - "lastWornDaysAgo": 7 - }, - { - "asset": "demo-wool-socks", - "name": "Wool Socks", - "category": "Socks", - "warmth": "Warm", - "season": "Autumn", - "bodyArea": "Feet", - "role": "Accessory", - "colours": "Grey", - "wornCount": 13, - "lastWornDaysAgo": 6 - } - ], - "outfits": [ - { - "name": "Office Monday", - "garments": [ - "Crew Neck T-Shirt", - "Pleated Trousers", - "Leather Brogues", - "Leather Belt" - ], - "weather": "16°C overcast" - }, - { - "name": "Cold Commute", - "garments": [ - "Merino Crew Sweater", - "Slim Fit Jeans", - "Suede Trainers", - "Leather Biker Jacket", - "Striped Wool Scarf" - ], - "weather": "8°C clear" - }, - { - "name": "Full Kit", - "garments": [ - "Crew Neck T-Shirt", - "Merino Crew Sweater", - "Cotton Field Jacket", - "Pleated Trousers", - "Court Sneakers", - "Cotton Cap", - "Wayfarer Sunglasses", - "Leather Belt", - "Pearl Necklace" - ], - "weather": "13°C clear" - }, - { - "name": "Saturday Errands", - "garments": [ - "Heavyweight Hoodie", - "Relaxed Jeans", - "Court Sneakers", - "Cotton Cap" - ], - "weather": "19°C clear" - } - ] -} diff --git a/README.md b/README.md index b1384a9..9ccb196 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ English and Italian ship. **Settings › Language** offers *System*, *English* a Which languages Apple Intelligence can reply in is the system's list, not the app's. When the resolved language is not on it, the interface stays localised, the model answers in English, and the result screen says so instead of presenting an English look as if it were Italian. -Demo content in [`Mocks/`](Mocks/README.md) stays English: it is data, not copy. +Demo content in `Mocks/` stays English: it is data, not copy. The folder is not committed — [`docs/demo-assets.md`](docs/demo-assets.md) describes it and how to restore it. --- @@ -174,7 +174,7 @@ Two things behave differently there, and both look like bugs the first time: xcrun simctl launch booted com.mxo01.FitCheck -uiTesting -seedDemo ``` -Fills the closet from [`Mocks/`](Mocks/README.md) — 39 garments across every category — for screenshots and renders. Read only under that flag. +The 39-garment wardrobe used for screenshots is **not committed** — the photographs are Unsplash stock, so they stay on the machine that has them. [`docs/demo-assets.md`](docs/demo-assets.md) says what the folder holds and how to restore it. With `Mocks/` restored, a `-seedDemo` launch fills the closet. Read only under that flag; without the folder the launch still succeeds and says the demo closet is unavailable. --- @@ -191,7 +191,7 @@ A free Apple ID installs Fit Check on your own iPhone: no paid Apple Developer P open FitCheck.xcodeproj ``` - Select the `FitCheck` target › **Signing & Capabilities** › tick **Automatically manage signing** › set **Team** to your personal team, the entry that reads *"Your Name (Personal Team)"*. That is the whole signing setup: Xcode registers the App ID and mints the development certificate on the first run, and `com.mxo01.FitCheck` is usually still free to claim. If Xcode answers *"the app identifier cannot be registered"*, it is taken — choose another in [`project.yml`](project.yml) under the `FitCheck` target's `settings` and regenerate: + Select the `FitCheck` target › **Signing & Capabilities** › tick **Automatically manage signing** › set **Team** to your personal team, the entry that reads *"Your Name (Personal Team)"*. That is the whole signing setup: Xcode registers the App ID and mints the development certificate on the first run, and `com.mxo01.FitCheck` is the author's own registered identifier, so it is already taken — choose your own in [`project.yml`](project.yml) under the `FitCheck` target's `settings` and regenerate (Xcode says *"the app identifier cannot be registered"* when it is not free): ```yaml PRODUCT_BUNDLE_IDENTIFIER: com.yourname.FitCheck @@ -213,7 +213,7 @@ A free Apple ID installs Fit Check on your own iPhone: no paid Apple Developer P 5. **The permissions, in the order they appear.** Location is asked for at launch — "Fit Check uses your location to suggest outfits based on the local weather" — and is optional: refuse it and the app assumes a mild day, says so in the composer and the conditions sheet, and still styles. Allowed, the conditions sheet names the place it read. Camera is asked for the first time you open the capture sheet. The photo library picker runs out of process, so no library-wide alert appears. -6. **Demo closet (optional).** The 39-garment wardrobe in [`Mocks/`](Mocks/README.md) is read only under `-seedDemo`. In Xcode, **Product › Scheme › Edit Scheme › Run › Arguments** and add `-seedDemo`, then run. It seeds only into an empty store, so a second launch adds nothing; delete the app to seed again. A scheme edited by hand is lost on the next `xcodegen generate`, because the project it lives in is regenerated. `-seedCloset` is a different flag: the five-garment fixture with one saved look that the UI tests assert against. +6. **Demo closet (optional).** The 39-garment wardrobe in `Mocks/` (not committed — [`docs/demo-assets.md`](docs/demo-assets.md)) is read only under `-seedDemo`. In Xcode, **Product › Scheme › Edit Scheme › Run › Arguments** and add `-seedDemo`, then run. It seeds only into an empty store, so a second launch adds nothing; delete the app to seed again. A scheme edited by hand is lost on the next `xcodegen generate`, because the project it lives in is regenerated. `-seedCloset` is a different flag: the five-garment fixture with one saved look that the UI tests assert against. 7. **Seven days, then reinstall.** A free profile expires seven days after it is signed. The app then stops opening — not a crash, and nothing is lost. Reconnect the phone and press ⌘R again: the profile is renewed and the app opens with its closet, looks and settings intact, because reinstalling over the same bundle identifier keeps the local store. Changing the bundle identifier is a different app and starts empty. One free Apple ID can keep three side-loaded apps on a device at a time; a fourth means deleting one first. Photos, garments, looks and every decision stay on the phone: the only traffic out is the forecast — a coordinate rounded to two decimals to Open-Meteo — and the MapKit lookup that names the place. @@ -238,7 +238,7 @@ xcodebuild -project FitCheck.xcodeproj -scheme FitCheck \ test -only-testing:FitCheckTests ``` -`.github/workflows/ci.yml` runs the same command on a macOS runner for every pull request, prints the coverage report, then runs [`scripts/coverage_gate.py`](./scripts/coverage_gate.py), which requires **100% line coverage on every Swift file under `FitCheck/` that the pull request touches.** A file that cannot reach the standard from the unit target is named in [`scripts/coverage-allowlist.txt`](./scripts/coverage-allowlist.txt) with its reason, one path per line; anything missing from that list has no excuse, and [AGENTS.md](./AGENTS.md#testing) documents the entries and why each one exists. On a push to `main` the gate does not run: the merge that landed there already ran it. A documentation-only pull request (markdown files, [`docs/`](./docs)) starts no CI run — the secret scan is the only job it triggers — because there is no Swift to measure and nothing for the simulator to prove, while a change under [`scripts/`](./scripts) still runs the gate. `ClosetExporter` is still checked by reading the archive it produces back, and `Features/` is exercised by the UI tests. +`.github/workflows/ci.yml` runs the same unit-test command on a macOS runner for every pull request that touches Swift: a `ubuntu-latest` job runs the Dynamic Type check first and the macOS job waits on it, and the simulator is resolved from the runner's device list. The run prints the coverage report and then runs [`scripts/coverage_gate.py`](./scripts/coverage_gate.py), which requires **100% line coverage on every Swift file under `FitCheck/` that the pull request touches.** A file that cannot reach the standard from the unit target is named in [`scripts/coverage-allowlist.txt`](./scripts/coverage-allowlist.txt) with its reason, one path per line; anything missing from that list has no excuse, and [AGENTS.md](./AGENTS.md#testing) documents the entries and why each one exists. On a push to `main` the gate does not run: the merge that landed there already ran it. A documentation-only pull request (markdown files, [`docs/`](./docs)) starts no CI run — the secret scan is the only job it triggers — because there is no Swift to measure and nothing for the simulator to prove, while a change under [`scripts/`](./scripts) still runs the gate. `ClosetExporter` is still checked by reading the archive it produces back, and `Features/` is exercised by the UI tests. Text scales with the system setting through `@ScaledMetric`, so [`scripts/check_dynamic_type.py`](./scripts/check_dynamic_type.py) fails any `.system(size:)` — or raw `UIFont.systemFont(ofSize:)` — added under `FitCheck/` whose size is a literal or arithmetic rooted in one instead of a `@ScaledMetric` property declared in the same file; the only way past it is a reason on that same line (`// dynamic-type-ok: `), for decoration or a measuring artefact that has no text to scale. A reason sits on the line it excuses rather than in a per-file allowlist, so a screen cannot be exempted quietly — each fixed size has to argue for itself. The check runs in its own `ubuntu-latest` job that the macOS job waits on, so a fixed text size fails the pull request before any simulator work starts. At the default text size the layout is unchanged: a `@ScaledMetric` starts at the value it replaced, so it is the larger settings that grow, not the baseline design. @@ -256,3 +256,9 @@ This repo uses [gitleaks](https://github.com/gitleaks/gitleaks) to catch API key * **CI check:** the scan also runs automatically via the [gitleaks GitHub Action](.github/workflows/gitleaks.yml) on every pull request and on every push to `main` — one scan per change — so secrets are caught even if the local hook is skipped. Config lives in [`.gitleaks.toml`](.gitleaks.toml); add allowlist entries there for confirmed false positives. + +--- + +### 📄 Licence + +All rights reserved — the source is publicly readable and is **not** licensed for reuse, modification or redistribution. See [`LICENSE`](LICENSE). The demo photographs, restored locally and never committed, stay under Unsplash's licence; third-party code and assets keep the licences they ship with. diff --git a/docs/demo-assets.md b/docs/demo-assets.md new file mode 100644 index 0000000..fdcb107 --- /dev/null +++ b/docs/demo-assets.md @@ -0,0 +1,109 @@ +# Demo assets + +`Mocks/` is the demo wardrobe Fit Check seeds when it is launched with `-seedDemo`. It is **not committed** to the repository: it holds photographs, not code, and the folder exists only on a machine where someone has rebuilt it. This document says what the folder holds, what the record cannot recover, and how to reconstruct it. + +```bash +xcrun simctl launch booted com.mxo01.FitCheck -uiTesting -seedDemo +``` + +Nothing here is read on a normal launch, and none of it is user data: it exists so screenshots, renders and the classifier benchmark have a full closet to work with. A `-seedDemo` launch without the folder still succeeds — it says the demo closet is unavailable instead of failing. + +## What the folder holds + +- `closet.json` — the catalogue: 39 garments across all ten categories, plus four saved looks that reference garments by name. +- `Garments/` — one transparent PNG per garment, named by the catalogue's `asset` field, 400 px on its long side. + +A `postBuildScripts` phase in `project.yml` copies the folder into the app bundle when it is present, so its structure survives and `Bundle.main.url(forResource:subdirectory:)` can find it; when the folder is absent the same phase removes any stale copy and the launch reports the demo closet as unavailable. + +## Why it is not committed + +The photographs are Unsplash stock. Unsplash's licence permits free use including commercially, which covers the screenshots and renders this project makes — but it does not make the photographs ours to redistribute, so the repository carries none of them and the licence they arrive under stays theirs. That is also why a retailer's product shot is not a substitute: it would carry someone else's copyright into whatever the render is used for. Unsplash+ (`plus.unsplash.com`) is out of scope entirely — that tier is a paid licence, and none of these assets come from it. + +## What the record does not contain + +No per-file Unsplash photo id, URL, collection or photographer attribution was ever recorded for these 39 assets. `closet.json` has no source field, no commit message names a photo, and the PNGs carry nothing beyond their pixels — width, height, colour profile and alpha, with no EXIF left over from the download or the cut-out. A credit line per row therefore cannot be printed here, and inventing one would be worse than the gap: a restored folder is the same 39 garments described below, not a byte-identical copy of the photographs the original screenshots were taken with. + +## The catalogue + +The table was generated from `Mocks/closet.json` rather than retyped, so it cannot drift from the catalogue the app seeds from. The columns are the fields that file carries; the four looks follow it. + +| Asset | Garment | Category | Warmth | Season | Body area | Role | Colours | Worn | Last worn (days ago) | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| `demo-white-tee` | Relaxed Cotton T-Shirt | Tops | Light | Summer | Upper body | Essential | White | 12 | 3 | +| `demo-cotton-tee` | Crew Neck T-Shirt | Tops | Light | Summer | Upper body | Essential | White | 23 | 2 | +| `demo-knit-sweater` | Merino Crew Sweater | Tops | Warm | Autumn | Upper body | Essential | Rust | 7 | 9 | +| `demo-hoodie` | Heavyweight Hoodie | Tops | Mid layer | Autumn | Upper body | Essential | Black | 15 | 5 | +| `demo-blue-jeans` | Slim Fit Jeans | Bottoms | Light | Year-round | Lower body | Essential | Indigo | 18 | 4 | +| `demo-black-jeans` | Straight Fit Jeans | Bottoms | Light | Year-round | Lower body | Essential | Washed black | 9 | 6 | +| `demo-relaxed-jeans` | Relaxed Jeans | Bottoms | Light | Year-round | Lower body | Essential | Black | 4 | 12 | +| `demo-grey-trousers` | Pleated Trousers | Bottoms | Light | Year-round | Lower body | Essential | Grey | 6 | 8 | +| `demo-court-sneakers` | Court Sneakers | Shoes | Light | Year-round | Feet | Essential | Ice blue | 15 | 5 | +| `demo-running-sneakers` | Running Sneakers | Shoes | Light | Year-round | Feet | Essential | White, Orange | 31 | 2 | +| `demo-suede-trainers` | Suede Trainers | Shoes | Light | Year-round | Feet | Essential | Grey | 6 | 13 | +| `demo-leather-brogues` | Leather Brogues | Shoes | Light | Year-round | Feet | Essential | Burgundy | 3 | 22 | +| `demo-leather-jacket` | Leather Biker Jacket | Outerwear | Mid layer | Autumn | Upper body | Layer | Black | 8 | 7 | +| `demo-field-jacket` | Cotton Field Jacket | Outerwear | Mid layer | Autumn | Upper body | Layer | Olive | 4 | 19 | +| `demo-denim-jacket` | Denim Jacket | Outerwear | Mid layer | Autumn | Upper body | Layer | Washed blue | 11 | 6 | +| `demo-blazer` | Linen Blazer | Outerwear | Light | Summer | Upper body | Layer | Off-white | 2 | 30 | +| `demo-beanie` | Cable Knit Beanie | Hats | Warm | Autumn | Head | Accessory | Mustard | 9 | 11 | +| `demo-cap` | Cotton Cap | Hats | Light | Summer | Head | Accessory | Yellow | 5 | 16 | +| `demo-bucket-hat` | Bucket Hat | Hats | Light | Summer | Head | Accessory | Sand | 2 | 40 | +| `demo-silk-scarf` | Silk Scarf | Scarves | Light | Summer | Neck | Accessory | Lilac | 3 | 24 | +| `demo-wool-scarf` | Striped Wool Scarf | Scarves | Warm | Autumn | Neck | Accessory | Red, Black | 14 | 8 | +| `demo-fringed-scarf` | Fringed Scarf | Scarves | Warm | Autumn | Neck | Accessory | Burgundy | 6 | 15 | +| `demo-blanket-scarf` | Blanket Scarf | Scarves | Heavy | Winter | Neck | Accessory | Red, Navy | 4 | 21 | +| `demo-wayfarers` | Wayfarer Sunglasses | Glasses | Light | Summer | Eyes | Accessory | Black | 21 | 3 | +| `demo-round-glasses` | Round Sunglasses | Glasses | Light | Summer | Eyes | Accessory | Tortoise | 7 | 14 | +| `demo-sport-glasses` | Sport Sunglasses | Glasses | Light | Summer | Eyes | Accessory | Black | 12 | 9 | +| `demo-brown-glasses` | Brown Lens Sunglasses | Glasses | Light | Summer | Eyes | Accessory | Brown | 5 | 18 | +| `demo-drop-earrings` | Drop Earrings | Jewellery | Light | Year-round | Head | Accessory | Gold, Blue | 6 | 12 | +| `demo-silver-rings` | Stacking Rings | Jewellery | Light | Year-round | Hands | Accessory | Silver | 18 | 4 | +| `demo-pearl-necklace` | Pearl Necklace | Jewellery | Light | Year-round | Neck | Accessory | Pearl | 3 | 26 | +| `demo-bead-necklace` | Beaded Necklace | Jewellery | Light | Year-round | Neck | Accessory | Coral | 4 | 17 | +| `demo-leather-belt` | Leather Belt | Belts | Light | Year-round | Waist | Accessory | Dark brown | 19 | 3 | +| `demo-woven-belt` | Woven Belt | Belts | Light | Year-round | Waist | Accessory | Brown | 8 | 10 | +| `demo-suede-belt` | Suede Belt | Belts | Light | Year-round | Waist | Accessory | Tan | 5 | 20 | +| `demo-navy-belt` | Navy Belt | Belts | Light | Year-round | Waist | Accessory | Navy | 7 | 13 | +| `demo-ribbed-socks` | Ribbed Socks | Socks | Warm | Autumn | Feet | Accessory | Mustard | 11 | 5 | +| `demo-patterned-socks` | Patterned Socks | Socks | Warm | Autumn | Feet | Accessory | Fair Isle | 6 | 12 | +| `demo-striped-socks` | Striped Socks | Socks | Light | Year-round | Feet | Accessory | Multicolour | 9 | 7 | +| `demo-wool-socks` | Wool Socks | Socks | Warm | Autumn | Feet | Accessory | Grey | 13 | 6 | + +## The four saved looks + +| Look | Weather | Garments | +| --- | --- | --- | +| Office Monday | 16°C overcast | Crew Neck T-Shirt, Pleated Trousers, Leather Brogues, Leather Belt | +| Cold Commute | 8°C clear | Merino Crew Sweater, Slim Fit Jeans, Suede Trainers, Leather Biker Jacket, Striped Wool Scarf | +| Full Kit | 13°C clear | Crew Neck T-Shirt, Merino Crew Sweater, Cotton Field Jacket, Pleated Trousers, Court Sneakers, Cotton Cap, Wayfarer Sunglasses, Leather Belt, Pearl Necklace | +| Saturday Errands | 19°C clear | Heavyweight Hoodie, Relaxed Jeans, Court Sneakers, Cotton Cap | + +## Rebuilding the folder + +This table plus the cut-out steps below is what rebuilds `Mocks/`: one row per garment, one PNG per row, then the JSON that ties them together. The catalogue is also the classifier benchmark's answer key — a Debug build launched with `-classifierBenchmark` classifies all 39 PNGs against these names, categories, warmth, colours and body areas, and scores the model against them — so a row is not decoration. [`README.md`](../README.md) describes that run and the CSV it produces. + +1. **Create the folder.** `Mocks/` and everything below it is gitignored, and must stay that way. + + ```bash + mkdir -p Mocks/Garments + ``` + +2. **Fetch one photo per row, from Unsplash Free only.** Search Unsplash for the row's garment name and category — "pleated trousers", "wayfarer sunglasses", "ribbed socks" — and take the photo from its Unsplash Free page, never from `plus.unsplash.com` or an Unsplash+ result. A garment alone on a plain, uncluttered background cuts out cleanest. + +3. **Cut it out with the app's own request.** `VNGenerateForegroundInstanceMaskRequest`, the same Vision request [`GarmentSegmenter`](../FitCheck/Services/GarmentSegmenter.swift) runs on a real capture, so a seeded garment is indistinguishable from a photographed one downstream. + +4. **Export the cut-out.** A PNG cut to the garment itself, transparent background, 400 px on its long side, named `.png` after the row's `asset` field and dropped in `Mocks/Garments/`. + +5. **Rebuild `closet.json`.** One object per row, with the fields and values above. `asset` must match the PNG's filename, and each saved look references garments by `name`, so both have to be reproduced exactly or the look points at nothing. + +6. **Rebuild the app** — `⌘R` in Xcode, or the `xcodebuild` command below. The build copies the restored folder into the bundle, so no project change is needed: + + ```bash + xcodebuild -project FitCheck.xcodeproj -scheme FitCheck -destination 'generic/platform=iOS Simulator' build + ``` + +7. **Launch with the flag.** The closet fills on an empty store only — a second `-seedDemo` launch adds nothing, so delete the app to seed again: + + ```bash + xcrun simctl launch booted com.mxo01.FitCheck -uiTesting -seedDemo + ``` diff --git a/project.yml b/project.yml index 9574060..4b38009 100644 --- a/project.yml +++ b/project.yml @@ -30,11 +30,6 @@ targets: deploymentTarget: "26.0" sources: - path: FitCheck - # A folder reference, not a group: the loader asks for - # `Mocks/Garments/.png` by subdirectory, which only works if the - # structure survives into the bundle. Read solely under `-seedDemo`. - - path: Mocks - type: folder info: path: FitCheck/Info.plist properties: @@ -72,6 +67,18 @@ targets: # without the repository should still produce a runnable app, and a missing # value must read as missing instead of looking like an empty commit. postBuildScripts: + # `Mocks/` is local-only data, not source. A source reference fails the + # copy phase when the folder is absent, so the build copies it when it is + # there and clears any stale copy when it is not, keeping + # `Mocks/Garments/.png` readable at the same bundle path. + - name: Bundle the local demo wardrobe + basedOnDependencyAnalysis: false + script: | + dest="$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/Mocks" + rm -rf "$dest" + if [ -d "$SRCROOT/Mocks" ]; then + ditto "$SRCROOT/Mocks" "$dest" + fi - name: Stamp build attribution basedOnDependencyAnalysis: false # Declared as an input so the phase cannot start before the bundle's diff --git a/scripts/coverage-allowlist.txt b/scripts/coverage-allowlist.txt index 6d3ed92..30f02d0 100644 --- a/scripts/coverage-allowlist.txt +++ b/scripts/coverage-allowlist.txt @@ -15,6 +15,7 @@ # allowlisted, and the suite is green. FitCheck/App/AppState.swift 99.13% (227/229): the two uncovered lines are 290 (ToastMessage.id) and 315 (Confirmation.id), the compiler-generated UUID() default initialisers, which xccov reports unexecuted although both types are built in covered tests — an instrumentation gap, not untested behaviour; the OutfitGenerating seam's four outcomes are covered through a stub +FitCheck/App/DemoCloset.swift the -seedDemo seeding and its Bundle.main lookups only run inside a launched app, and the folder it reads is local-only, so the unit target has neither the launch path nor the files FitCheck/App/FitCheckApp.swift process wiring: container creation and the store opener and deleter need a launched app FitCheck/App/RootView.swift SwiftUI view body: the tab shell is only reachable from the UI tests FitCheck/DesignSystem/GarmentViews.swift SwiftUI view body: only reachable from the UI tests, the uncovered remainder is layout