Ship the Share fonts and the design system's strings inside FjordDesignSystem (GRD-486) #4

Merged
stephen merged 4 commits from stephen/grd-486-fonts-strings into main 2026-11-19 03:33:56 +00:00
Owner

GRD-486. The design system no longer needs its host to supply the Share font or its own strings.

  • Fonts. The four Share files (Carrois Type Design, SIL OFL; the licence text ships beside them in Fonts/OFL.txt) live in FjordDesignSystem. FjordFonts.register() registers them with CoreText for the process the first time the theme builds a font (FontFamily.regularFontName and boldFontName call it), so no UIAppFonts entry and no copy of the files in the app, and an app extension gets them too. A host that still lists them gets alreadyRegistered, which is ignored. Theme.Typography.fontFamily = .system still selects the system font.
  • Strings. Resources/Localizable.xcstrings: 22 keys in the 11 shipped languages, copied from fjord-ios's catalog with their translations and comments (error alert defaults, "Loading", the stale-data sentences, "Cached data", "Refresh", "now", the appearance and accent names, "Fjord"). They resolve in the module bundle: Text(..., bundle: .module), String(localized:bundle:), and LocalizedStringResource for the appearance and accent names. Package.swift gets defaultLocalization: "en" and the resources. A LocalizedStringKey a host passes in still resolves in the host.
  • API. errorAlert(title:buttonTitle:) take optional keys (nil uses the module's text); callers that pass a key are unchanged. FjordLogo takes an accessibilityLabel so an app can name itself.
  • Tests. The fonts register and are available by PostScript name, registering twice is harmless, the module bundle carries all 11 languages, and four keys are translated in German.
  • README. The "Fonts and strings" host requirement is gone; the section says what ships and what still resolves in the host.

Breaking? No source break for hosts. A host that keeps its own copies keeps working; fjord-ios drops its copies in the adoption PR after the 0.3.0 tag.

Known edge cases (follow-up): LocalizedStringResource captures Locale.current when created, so the accent swatch names (a static let) do not follow an in-process locale change; the app does not change locale in process. A missing font file would log a fault and fall back to the system font; the files ship in the package and a test registers them.

GRD-486. The design system no longer needs its host to supply the Share font or its own strings. - **Fonts.** The four Share files (Carrois Type Design, SIL OFL; the licence text ships beside them in `Fonts/OFL.txt`) live in `FjordDesignSystem`. `FjordFonts.register()` registers them with CoreText for the process the first time the theme builds a font (`FontFamily.regularFontName` and `boldFontName` call it), so no `UIAppFonts` entry and no copy of the files in the app, and an app extension gets them too. A host that still lists them gets `alreadyRegistered`, which is ignored. `Theme.Typography.fontFamily = .system` still selects the system font. - **Strings.** `Resources/Localizable.xcstrings`: 22 keys in the 11 shipped languages, copied from fjord-ios's catalog with their translations and comments (error alert defaults, "Loading", the stale-data sentences, "Cached data", "Refresh", "now", the appearance and accent names, "Fjord"). They resolve in the module bundle: `Text(..., bundle: .module)`, `String(localized:bundle:)`, and `LocalizedStringResource` for the appearance and accent names. `Package.swift` gets `defaultLocalization: "en"` and the resources. A `LocalizedStringKey` a host passes in still resolves in the host. - **API.** `errorAlert(title:buttonTitle:)` take optional keys (nil uses the module's text); callers that pass a key are unchanged. `FjordLogo` takes an `accessibilityLabel` so an app can name itself. - **Tests.** The fonts register and are available by PostScript name, registering twice is harmless, the module bundle carries all 11 languages, and four keys are translated in German. - **README.** The "Fonts and strings" host requirement is gone; the section says what ships and what still resolves in the host. Breaking? No source break for hosts. A host that keeps its own copies keeps working; fjord-ios drops its copies in the adoption PR after the 0.3.0 tag. Known edge cases (follow-up): `LocalizedStringResource` captures `Locale.current` when created, so the accent swatch names (a `static let`) do not follow an in-process locale change; the app does not change locale in process. A missing font file would log a fault and fall back to the system font; the files ship in the package and a test registers them.
Ship the Share fonts and the design system's strings inside FjordDesignSystem (GRD-486)
Some checks failed
CI / Build and test (iOS Simulator) (pull_request) Failing after 25s
CI / Icon usage lists (pull_request) Successful in 44s
9c2c2c2d9f
The four Share font files (SIL OFL, licence text included) live in the package and register
with CoreText the first time the theme builds a font (FjordFonts.register()), so a host needs
no UIAppFonts entry. The strings the design system owns now live in its own String Catalog
(22 keys, the 11 shipped languages, copied from fjord-ios) and are looked up in the module
bundle: the error alert defaults, the loading label, the stale-data sentences, "now", the
appearance and accent names. Strings a host passes in still resolve in the host.

FjordLogo takes an accessibilityLabel so an app can name itself. errorAlert's title and
buttonTitle become optional (nil uses the module's own text); callers that pass a key are
unchanged.
Return the font name explicitly now that the getter registers first
Some checks failed
CI / Icon usage lists (pull_request) Successful in 9s
CI / Build and test (iOS Simulator) (pull_request) Failing after 25s
31c14067ce
gerri approved these changes 2026-11-19 03:22:07 +00:00
Dismissed
gerri left a comment

Automated Codex review (read-only) of head 31c14067ce.

  • Low Sources/FjordDesignSystem/FjordFonts.swift:35. Invariant: a host that already provides the Share fonts must see no failure (the PR body: "A host that keeps its own copies keeps working"). Only error code 105 (alreadyRegistered) is filtered out. I could not run CoreText here, so I am relying on my recollection that a same-named font from a different file URL returns duplicatedName (305), not 105. If so, fjord-ios will hit it. The PR says fjord-ios keeps its own UIAppFonts copies until the adoption PR, and those are different files from the module's. Scenario: on first theme build, registerAll() gets 305 for each of the four files. It logs four log.error lines and register() returns false. The fonts still work through the host's copies, so the impact is log noise and a misleading false return. Fix: also ignore CTFontManagerError.duplicatedName, or treat the batch as successful when UIFont(name:size:) already resolves every name. Run on a device with UIAppFonts set to confirm the code.

  • Low Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:41-58. Standards item 13 (tests test the claim). testRegisteringTwiceIsHarmless only reads the cached static let registered, so it never calls CoreText a second time. It would pass with the alreadyRegistered filter deleted. The host-lists-the-fonts path the README and PR body promise has no test. Fix: call CTFontManagerRegisterFontsForURLs on the same URLs first, then check that register() still returns true. Better, factor registerAll so a test can call it twice. The string tests also cover only four keys, in German. A key typo at a call site, such as ModuleStrings.resource("Tealz") or a changed Text key, silently shows English and no test fails. Fix: add a test that resolves every call-site key through the de bundle.

  • Low (edge case, unclaimed behavior change) ErrorAlert.swift, HarborLoaders.swift, Theme.swift, FjordLogo.swift. Default strings used to resolve in the host's catalog and now resolve in the module's. A host with its own wording for "Loading", "OK" or "System", or its own extra languages, is silently overridden. A host that localizes into fewer languages than the module's 11 will show module-language text on devices set to those languages. The PR body says the sources are compatible but does not mention this. It is acceptable for fjord-ios, which copied the catalog. Add one line to the README.

  • Low (known deferral) The accent swatch names are a static let of LocalizedStringResource, which captures the locale at creation. The PR body already lists this as an accepted edge case, and the diff gives no new evidence against it.

  • Process note: the PR body has no "Failure paths" or "Fix scope" section as the standards ask. This is not a code defect.

BLOCKING: 0


Reviewed head 31c14067ce at 2026-11-19T03:22:06Z by claude -p, read-only tools (Codex unavailable).

Automated Codex review (read-only) of head 31c14067ce8cba2b3f467266f1f734b4a20c05fa. - **Low** `Sources/FjordDesignSystem/FjordFonts.swift:35`. Invariant: a host that already provides the Share fonts must see no failure (the PR body: "A host that keeps its own copies keeps working"). Only error code 105 (`alreadyRegistered`) is filtered out. I could not run CoreText here, so I am relying on my recollection that a same-named font from a different file URL returns `duplicatedName` (305), not 105. If so, fjord-ios will hit it. The PR says fjord-ios keeps its own `UIAppFonts` copies until the adoption PR, and those are different files from the module's. Scenario: on first theme build, `registerAll()` gets 305 for each of the four files. It logs four `log.error` lines and `register()` returns false. The fonts still work through the host's copies, so the impact is log noise and a misleading false return. Fix: also ignore `CTFontManagerError.duplicatedName`, or treat the batch as successful when `UIFont(name:size:)` already resolves every name. Run on a device with `UIAppFonts` set to confirm the code. - **Low** `Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:41-58`. Standards item 13 (tests test the claim). `testRegisteringTwiceIsHarmless` only reads the cached `static let registered`, so it never calls CoreText a second time. It would pass with the `alreadyRegistered` filter deleted. The host-lists-the-fonts path the README and PR body promise has no test. Fix: call `CTFontManagerRegisterFontsForURLs` on the same URLs first, then check that `register()` still returns true. Better, factor `registerAll` so a test can call it twice. The string tests also cover only four keys, in German. A key typo at a call site, such as `ModuleStrings.resource("Tealz")` or a changed `Text` key, silently shows English and no test fails. Fix: add a test that resolves every call-site key through the `de` bundle. - **Low** (edge case, unclaimed behavior change) `ErrorAlert.swift`, `HarborLoaders.swift`, `Theme.swift`, `FjordLogo.swift`. Default strings used to resolve in the host's catalog and now resolve in the module's. A host with its own wording for "Loading", "OK" or "System", or its own extra languages, is silently overridden. A host that localizes into fewer languages than the module's 11 will show module-language text on devices set to those languages. The PR body says the sources are compatible but does not mention this. It is acceptable for fjord-ios, which copied the catalog. Add one line to the README. - **Low** (known deferral) The accent swatch names are a `static let` of `LocalizedStringResource`, which captures the locale at creation. The PR body already lists this as an accepted edge case, and the diff gives no new evidence against it. - Process note: the PR body has no "Failure paths" or "Fix scope" section as the standards ask. This is not a code defect. BLOCKING: 0 --- Reviewed head 31c14067ce8cba2b3f467266f1f734b4a20c05fa at 2026-11-19T03:22:06Z by claude -p, read-only tools (Codex unavailable).
Take the catalog key as a String.LocalizationValue
All checks were successful
CI / Icon usage lists (pull_request) Successful in 17s
CI / Build and test (iOS Simulator) (pull_request) Successful in 2m44s
659372d321
gerri approved these changes 2026-11-19 03:27:06 +00:00
Dismissed
gerri left a comment

Automated Codex review (read-only) of head 659372d321.

  • Low Sources/FjordDesignSystem/FjordFonts.swift:34. Invariant: the PR says "a host that keeps its own copies keeps working" and that a host still listing the files gets alreadyRegistered, which is ignored.

    • What is wrong: only the alreadyRegistered code (the same file URL registered again) is tolerated. A host app that bundles its own Share-*.ttf and lists them in UIAppFonts has those fonts registered from a different URL. I'm going from memory here: CoreText returns a different code for that case, probably duplicatedName. I didn't check it, and no test covers it.
    • Failure scenario: during the transition, fjord-ios still has its copies until the adoption PR. register() returns false, log.error fires for each of the four fonts, and the failed result is cached in registered. Rendering still works through the host's copies, so the impact is log noise and a misleading false for anyone who checks the return value.
    • Fix: also tolerate the duplicate-name code, or skip registration when UIFont(name:size:) already resolves the name. Say which case is covered in the PR body.
  • Low Sources/FjordDesignSystem/Theme.swift:113. Invariant: copy matches behavior (standards item 11).

    • What is wrong: the doc comment still says the fonts are "bundled in Resources/Fonts and registered through UIAppFonts in project.yml". Both claims are now false. The fonts live in Fonts/ inside the package and register themselves.
    • Failure scenario: a host author reads it and adds a UIAppFonts entry or a copy of the files, which is exactly what the PR removes.
    • Fix: update the comment to point at FjordFonts.
  • Low Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:57. Invariant: tests test the claim (standards item 13).

    • What is wrong: the tests prove the catalog compiled into a de.lproj and that four keys are translated there. They do not prove the views resolve through .module. Nothing exercises errorAlert's nil-title fallback, FjordLogo's default label, Theme.Appearance.localizedLabel, the accent preset names, SharedFormatters.relative or StaleCue. Nothing checks that the 22 keys in the catalog match the keys used in code.
    • Failure scenario: a later edit drops bundle: .module from one call site, or renames a key without updating the catalog. The strings silently fall back to the host's catalog or to the English key, and every test stays green.
    • Fix: add a test that resolves a few of the real call sites against a German bundle, for example localizedLabel, StaleCue and spokenLabel. Also assert that the catalog's key set equals the keys the code uses.
  • Low Package.swift:4. Invariant: the title and body claim all behavior changes.

    • What is wrong: the leading // header comment became ///. That is unrelated churn, and it attaches a doc comment to let package.
    • Fix: revert it.

Edge case, already deferred in the PR body and not re-raised as blocking: the accent swatch names capture Locale.current when the static let is created. The deferred missing-font fallback is also unchanged.

I found no high or medium issues. The catalog has all 22 keys, every module-owned literal I could find now resolves through .module, and the new errorAlert and FjordLogo parameters are source-compatible.

BLOCKING: 0


Reviewed head 659372d321 at 2026-11-19T03:27:05Z by claude -p, read-only tools (Codex unavailable).

Automated Codex review (read-only) of head 659372d3215932b6be108265248f06575099c8aa. - **Low** `Sources/FjordDesignSystem/FjordFonts.swift:34`. Invariant: the PR says "a host that keeps its own copies keeps working" and that a host still listing the files gets `alreadyRegistered`, which is ignored. - **What is wrong:** only the `alreadyRegistered` code (the same file URL registered again) is tolerated. A host app that bundles its own `Share-*.ttf` and lists them in `UIAppFonts` has those fonts registered from a different URL. I'm going from memory here: CoreText returns a different code for that case, probably `duplicatedName`. I didn't check it, and no test covers it. - **Failure scenario:** during the transition, fjord-ios still has its copies until the adoption PR. `register()` returns `false`, `log.error` fires for each of the four fonts, and the failed result is cached in `registered`. Rendering still works through the host's copies, so the impact is log noise and a misleading `false` for anyone who checks the return value. - **Fix:** also tolerate the duplicate-name code, or skip registration when `UIFont(name:size:)` already resolves the name. Say which case is covered in the PR body. - **Low** `Sources/FjordDesignSystem/Theme.swift:113`. Invariant: copy matches behavior (standards item 11). - **What is wrong:** the doc comment still says the fonts are "bundled in Resources/Fonts and registered through `UIAppFonts` in project.yml". Both claims are now false. The fonts live in `Fonts/` inside the package and register themselves. - **Failure scenario:** a host author reads it and adds a `UIAppFonts` entry or a copy of the files, which is exactly what the PR removes. - **Fix:** update the comment to point at `FjordFonts`. - **Low** `Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:57`. Invariant: tests test the claim (standards item 13). - **What is wrong:** the tests prove the catalog compiled into a `de.lproj` and that four keys are translated there. They do not prove the views resolve through `.module`. Nothing exercises `errorAlert`'s nil-title fallback, `FjordLogo`'s default label, `Theme.Appearance.localizedLabel`, the accent preset names, `SharedFormatters.relative` or `StaleCue`. Nothing checks that the 22 keys in the catalog match the keys used in code. - **Failure scenario:** a later edit drops `bundle: .module` from one call site, or renames a key without updating the catalog. The strings silently fall back to the host's catalog or to the English key, and every test stays green. - **Fix:** add a test that resolves a few of the real call sites against a German bundle, for example `localizedLabel`, `StaleCue` and `spokenLabel`. Also assert that the catalog's key set equals the keys the code uses. - **Low** `Package.swift:4`. Invariant: the title and body claim all behavior changes. - **What is wrong:** the leading `//` header comment became `///`. That is unrelated churn, and it attaches a doc comment to `let package`. - **Fix:** revert it. Edge case, already deferred in the PR body and not re-raised as blocking: the accent swatch names capture `Locale.current` when the `static let` is created. The deferred missing-font fallback is also unchanged. I found no high or medium issues. The catalog has all 22 keys, every module-owned literal I could find now resolves through `.module`, and the new `errorAlert` and `FjordLogo` parameters are source-compatible. BLOCKING: 0 --- Reviewed head 659372d3215932b6be108265248f06575099c8aa at 2026-11-19T03:27:05Z by claude -p, read-only tools (Codex unavailable).
Treat a duplicated font name as already registered
All checks were successful
CI / Icon usage lists (pull_request) Successful in 1m7s
CI / Build and test (iOS Simulator) (pull_request) Successful in 1m22s
3cb8d8c4d9
gerri approved these changes 2026-11-19 03:31:16 +00:00
gerri left a comment

Automated Codex review (read-only) of head 3cb8d8c4d9.

No high or medium findings. I read the diff and the call sites but did not build it or run the tests. I checked the font and string paths against ~/fleet-week/STANDARDS.md.

  • Low Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:52 (standard 13, tests test the claim). testRegisteringTwiceIsHarmless does not exercise the second-registration path. FjordFonts.registered is a static let, so the second register() returns the cached Bool and never calls CoreText. The benign alreadyRegistered and duplicatedName filter in FjordFonts.swift:34 is therefore untested. That filter is what keeps a host that still lists the fonts in UIAppFonts working. Fix: factor registerAll() so a test can call it directly twice, or register the four URLs with CTFontManagerRegisterFontsForURLs first and then assert registerAll() still returns true.

  • Low PR body (standards "Failure paths" and "Fix scope"). The body has no "Failure paths" section answering the applicable checklist items, and no "Fix scope" section. Items 4 (a failed font registration falls back to the system font, and register() returns false and logs) and 13 apply, and the body covers them only in passing. Fix: add the two short sections. Process only; the code is fine.

  • Low Package.swift:4. The header comment changed from // to ///, which attaches it as a doc comment to let package. It is unrelated churn that the title and body do not mention. Revert it or note it.

  • Low (edge case, already deferred in the PR body). The accent swatch LocalizedStringResources are built once in a static let, so they do not follow an in-process locale change. Nothing in the diff shows normal-operation impact, so I'm not re-raising it.

I checked several things and found no problem:

  • Every use of the font names (Theme.swift:178, Theme.swift:221, FjordLogo.swift:69) goes through regularFontName or boldFontName, which call register() first.
  • Each String Catalog key matches its call site, including the %@ interpolation keys.
  • AccentColorPreset.name was already a LocalizedStringResource, so the type change does not break callers.

BLOCKING: 0


Reviewed head 3cb8d8c4d9 at 2026-11-19T03:31:16Z by claude -p, read-only tools (Codex unavailable).

Automated Codex review (read-only) of head 3cb8d8c4d9bace0161c600e8bb0fd6c22d2aa923. No high or medium findings. I read the diff and the call sites but did not build it or run the tests. I checked the font and string paths against `~/fleet-week/STANDARDS.md`. - **Low** `Tests/FjordDesignSystemTests/FjordDesignSystemTests.swift:52` (standard 13, tests test the claim). `testRegisteringTwiceIsHarmless` does not exercise the second-registration path. `FjordFonts.registered` is a `static let`, so the second `register()` returns the cached `Bool` and never calls CoreText. The benign `alreadyRegistered` and `duplicatedName` filter in `FjordFonts.swift:34` is therefore untested. That filter is what keeps a host that still lists the fonts in `UIAppFonts` working. Fix: factor `registerAll()` so a test can call it directly twice, or register the four URLs with `CTFontManagerRegisterFontsForURLs` first and then assert `registerAll()` still returns true. - **Low** PR body (standards "Failure paths" and "Fix scope"). The body has no "Failure paths" section answering the applicable checklist items, and no "Fix scope" section. Items 4 (a failed font registration falls back to the system font, and `register()` returns false and logs) and 13 apply, and the body covers them only in passing. Fix: add the two short sections. Process only; the code is fine. - **Low** `Package.swift:4`. The header comment changed from `//` to `///`, which attaches it as a doc comment to `let package`. It is unrelated churn that the title and body do not mention. Revert it or note it. - **Low** (edge case, already deferred in the PR body). The accent swatch `LocalizedStringResource`s are built once in a `static let`, so they do not follow an in-process locale change. Nothing in the diff shows normal-operation impact, so I'm not re-raising it. I checked several things and found no problem: - Every use of the font names (`Theme.swift:178`, `Theme.swift:221`, `FjordLogo.swift:69`) goes through `regularFontName` or `boldFontName`, which call `register()` first. - Each String Catalog key matches its call site, including the `%@` interpolation keys. - `AccentColorPreset.name` was already a `LocalizedStringResource`, so the type change does not break callers. BLOCKING: 0 --- Reviewed head 3cb8d8c4d9bace0161c600e8bb0fd6c22d2aa923 at 2026-11-19T03:31:16Z by claude -p, read-only tools (Codex unavailable).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rasterstate/fjord-apple-kit!4
No description provided.