Skip to content

Improvement/dash sync integration - #2

Merged
podkovyrin merged 51 commits into
dashpay:developfrom
QuantumExplorer:Improvement/DashSyncIntegration
Nov 13, 2018
Merged

podkovyrin merged 51 commits into
dashpay:developfrom
QuantumExplorer:Improvement/DashSyncIntegration

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

No description provided.

QuantumExplorer and others added 30 commits October 24, 2018 13:29
Remove some sources from 'no watch' target, adds IGNORE_WATCH_TARGET …

@podkovyrin podkovyrin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UNAck

@podkovyrin
podkovyrin merged commit b0bf917 into dashpay:develop Nov 13, 2018
podkovyrin added a commit that referenced this pull request Mar 27, 2020
llbartekll added a commit that referenced this pull request Apr 7, 2026
Stage 2 of #2 migration. SwiftDashSDK is now the sole authoritative
source for address validation; the parallel DashSync call, mismatch
logger, and devnet fallback are all removed.

Verified that DashSync's NSString+Dash.m:69-82 and rust-dashcore's
Address::is_valid_for_network use byte-identical logic for every
network — both fall back to testnet's version bytes (140/19) for
devnet/regtest — so the devnet fallback was dead code.

Adapter shrinks from ~70 to ~30 lines. Status in DASHSYNC_MIGRATION.md
moves from 🌗 Flipped to 🌘 Solo.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
llbartekll added a commit that referenced this pull request Apr 7, 2026
The migrator's `reencryptSeedForPINChange` branch was designed to handle
a dual-stack window where v1's migrator ships in a release that still
uses DashSync as the user-facing PIN owner. In that window, a user
could rotate their PIN through DashSync's existing in-app flow, leaving
SwiftDashSDK's encrypted seed keyed off the old PBKDF2 key — and any
later `WalletStorage().retrieveSeed(pin: newPIN)` call would fail.

That window doesn't exist in our deployment plan. We're not shipping a
release until DashSync is fully replaced; v1, v2, v3 all happen on the
same development branch and ship in one App Store release. From the
moment the migrator runs successfully, SwiftDashSDK is the sole owner of
the encrypted seed, and any subsequent PIN rotation goes through the
SDK's own PIN-change UI (which will be ported in a later wave) calling
`CoreWalletManager.changeWalletPIN(currentPIN:newPIN:)` — the SDK's
official API for this exact operation, located at
`Core/Wallet/CoreWalletManager.swift:285`. Its implementation is
literally `storage.retrieveSeed(currentPIN)` →
`storage.storeSeed(seed, pin: newPIN)`, the same recipe the migrator
was implementing by hand.

Delete:

  - `reencryptSeedForPINChange(newPIN:newPINHash:)` (~32 lines)
  - `sha256Hex(_:)` private helper (~4 lines)
  - `import CryptoKit` (no longer used)
  - `currentPINHash` computation in `performMigration`
  - `pinHash` computation in `performMigration`
  - The PIN-change detection branch inside the `doneFlag` guard

Simplify the done flag from a `SHA256(pin)` hex string to a `"v1"`
version sentinel; consolidate both write sites (fresh-install and
successful-migration) on the same value. The migrator only checks
whether the flag exists, not its value, so old users with an existing
SHA256-hex flag from a development build are correctly treated as
"already done" — forward compatibility is preserved.

Net change: ~52 lines removed. Hard invariants unchanged. The migrator
still never deletes from DashSync's keychain, never throws, never
crashes, and runs on a background queue with all thread-safety
considerations identical to follow-up #2.

DASHSYNC_KEY_MIGRATION.md updated to drop the PIN-change special branch
documentation and to point future PIN-rotation work at
`CoreWalletManager.changeWalletPIN`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
llbartekll added a commit that referenced this pull request May 14, 2026
Migration row #2 sat at 🌘 Solo with a dedicated infra-layer @objc
adapter whose entire job was to let Obj-C payment code reach
SwiftDashSDK's Swift-only `Address.validate(_:network:)`. Localize the
bridge as a Swift category-style extension on `NSString`, co-located
with the payment code that consumes it.

- Delete `SwiftDashSDKAddressValidator.swift`.
- Add `NSString+SwiftDashSDKAddress.swift` — `@objc(dw_isValidDashAddressOnChain:)`
  NSString extension that calls `Address.validate` directly. The `dw_`
  prefix avoids colliding with DashSync's existing
  `isValidDashAddressOnChain:` NSString category in `NSString+Dash.h`.
  The DSChain → SwiftDashSDK.Network mapping is a `fileprivate`
  extension on `DSChain` in the same file.
- Swap 4 call sites — `DWPaymentInputBuilder.m` (×3) and
  `DWPaymentProcessor.m` (×1) — to the new selector. Each call site
  already had `request.paymentAddress` and `chain` in scope; the new
  shape reads naturally next to existing DashSync `NSString` neighbors
  (`isValidDashPrivateKeyOnChain:`, `isValidDashBIP38Key`).
- Swap the file references in the Xcode project (build files, file
  reference, group entry moves from the SwiftDashSDK group to
  PaymentModels, two source-build-phase entries).
- Mark `DASHSYNC_MIGRATION.md` row #2 ✅ Done in both the
  "Where we are" body and the functional table.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
llbartekll added a commit that referenced this pull request Jul 2, 2026
SwiftDashSDKReceiveAddressReader ignored its DSChain argument (it resolves the
wallet via SwiftDashSDKHost.shared), so every call site fetched
DWEnvironment.currentChain / account.wallet.chain purely to feed a discarded
value. Drop the parameter: receiveAddress(on:) -> receiveAddress(),
@objc(receiveAddressOnChain:) -> plain @objc (auto selector `receiveAddress`).

- 10 Swift sites + the BIP70 provider drop the arg; 8 shed a now-dead
  `let chain` binding.
- 5 ObjC sites become a selector swap; DWURLRequestHandler sheds a dead
  `account` local. Sites that still need chain/account for DSPaymentRequest /
  Apple Watch balance keep them (those belong to #22 / #5-#6).
- The reader file is now completely DashSync-free (zero DS* symbols); kept as a
  permanent SDK-only helper (same shape as #2 / #21).

Flips migration item #1 (receive address) from Solo to Done. dashpay scheme
builds clean on iPhone 17 sim (arm64).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
llbartekll added a commit that referenced this pull request Jul 8, 2026
The PIN-lockout countdown computes against DashSync's secureTime
(UserDefaults SECURE_TIME), which nothing has updated since the M6
freeze — after 4+ wrong PINs the 'Try again in N minutes' message was
frozen forever (Bug #2), recoverable only by wipe.

New SecureTimeService (Infrastructure/Authentication/ — the C7 home):
the D5 hybrid clock. Same SECURE_TIME key + only-forward rule DashSync
used, so existing lockout state carries with zero migration and the
pod's own lockoutWaitTime benefits immediately, before the C7 auth
cutover:
- wall-clock ratchet at every launch (AppDelegate) and on read — a
  fully offline device's lockout still elapses;
- server re-feed from the TLS-protected Date header of every Moya
  response (HTTPClient._request, next to the ETag read) — the 60 s CTX
  rates poll keeps it tracking real time online.
Deliberate delta, documented in-file: DashSync's 'rare case' lowered a
corrupted-forward value against chain checkpoint/tip times; with no
chain clock to cross-check, this service never decreases the value.

Verified on the testnet sim: container SECURE_TIME backdated to 1.6e9
-> launch ratchets it to the wall clock (fractional epoch), and ~60 s
later a whole-second server timestamp lands from the rates poll.

Co-Authored-By: Claude Fable 5 <[email protected]>
llbartekll added a commit that referenced this pull request Jul 8, 2026
Remove the one-shot DashSync parity assertion (its byte-compat guard is
now redundant — every flow cut over and the pre-C7 DashSync-written PIN
unlocks under the post-cutover build) and its AppDelegate call. Migration
row #28 + teardown C7 marked done (Bugs #2/#3 fixed), both noting the one
deferred tail: the forgot-PIN DSRecoveryViewController (TODO(C7-recovery)).

Verified: dashpay arm64-sim BUILD SUCCEEDED; zero DSAuthenticationManager/
DSBiometricsAuthenticator references in Swift.

Co-Authored-By: Claude Fable 5 <[email protected]>
llbartekll added a commit that referenced this pull request Jul 8, 2026
…7.9)

Close the C7 recovery tail across the migration docs: row #28 and the
inventory row 10 flip to ✅ Done (auth fully off DashSync, both pod auth
classes zero-refs); the teardown plan's C7 section records the C7.9
forgot-PIN port (DWRecoverAction_ResetPin → ChangePin, wallet kept; wipe
only past threshold; enableAuthenticationIfNeeded); Bugs #2 and #3 flip
from "Open — fixed by C7 PRx" to ✅ Fixed (C7.1 / C7.4).

Co-Authored-By: Claude Fable 5 <[email protected]>
QuantumExplorer added a commit that referenced this pull request Aug 7, 2026
`performReload` set `isReloading = true` on entry and back to false before
returning, and `onTransactionStatusChanged` checked the flag from inside
`queue.async`. Both run on the same serial `queue`, and `performReload` has a
single caller — also inside `queue.async` — with no early return, `await`, or
re-dispatch between the two assignments. So the reload always finished, and
reset the flag, before the guard could run: it never observed `true`.

That made the accompanying comment wrong in the way guardrail #2 forbids. It
claimed to "skip incremental updates while a full reload is in progress to
prevent race conditions that could cause missing transactions" — describing
protection the code did not provide. A reader auditing the feed for lost
transactions would have credited a guard that does nothing.

Removes the property, all three assignments, and the guard. Two neighbouring
comments are trimmed so they no longer describe a flag that is gone.

No behavior change: the guard's body was unreachable.

Co-authored-by: Claude Opus 5 <[email protected]>
romchornyi added a commit that referenced this pull request Nov 23, 2026
… again

The codemod's integer interpolations grouped digits by locale
("block #2,123,456"). The 21 places that can show 1000 or more look
their Baseline key up through String(format:) again, as the Baseline
did; the 13 Baseline entries come back with all their translations and
their moved copies leave the Catalog. Key map rewritten; the zero-loss
check passes in both modes.

SDD-Task: T28
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>
romchornyi added a commit that referenced this pull request Nov 24, 2026
… again

The codemod's integer interpolations grouped digits by locale
("block #2,123,456"). The 21 places that can show 1000 or more look
their Baseline key up through String(format:) again, as the Baseline
did; the 13 Baseline entries come back with all their translations and
their moved copies leave the Catalog. Key map rewritten; the zero-loss
check passes in both modes.

SDD-Task: T28
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>
romchornyi added a commit that referenced this pull request Nov 25, 2026
* feat(l10n): generate the String Catalog from the Baseline lists

scripts/localization/generate_catalog.py reads the 43 Localizable.strings
and .stringsdict files at a git revision and writes Localizable.xcstrings
in the Xcode app's format (catalog_io.py + catalog_writer.swift), following
the pilot's plural rules. On e798ee8f2: 2709 entries, 43 locales, 62
counted phrases (49 plural variations, 13 substitutions), deterministic,
and xcstringstool compiles it without warnings.

SDD-Task: T2
SDD-AC: AC-06
SDD-AC: AC-07
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): add the swift-syntax codemod for plain Swift lookups

scripts/localization/codemod rewrites NSLocalizedString("k", comment: "c")
to String(localized: "k", comment: "c") when the key is a literal without
format codes, keeping every byte of trivia and the literal token, and lists
what it leaves (non-literal key, unsupported argument, format code for T4).
swift-syntax is pinned to 603.0.2; built and tested on Xcode 27.2 only.
Dry run on DashWallet + DashWalletTests: 409 format-code places for T4,
1 non-literal key, deterministic.

SDD-Task: T3
SDD-AC: AC-08

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): rewrite formatted Swift lookups as String(localized:) interpolations

The codemod now turns String(format:) and localizedStringWithFormat around a
literal NSLocalizedString into an interpolated String(localized:), mapping
sequential and positional codes in text order and %% to %. Keys in the
--keep-literal-keys file keep their literal key and formatting call. Floats,
argument mismatches, unsupported specifiers and multi-line arguments are
listed, never guessed. Real dry run: 44 leftovers (was 410); a rerun on the
rewritten code changes nothing.

SDD-Task: T4
SDD-AC: AC-08

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): extract Baseline and current lookup places and pair them

scripts/localization/places.py lists every code place that looks a text up
at the Baseline (git archive + xcstringstool extract: NSLocalizedString and
SwiftUI literals with a Baseline entry; Objective-C) and now (the build's
.stringsdata plus the legacy extraction of the working tree), pairs them by
file and ordinal, names files whose counts differ, and detects a stale build.
On the pilot tree vs e798ee8f2: 3917 Baseline places, the 3 hand-moved keys
pair to their derived keys; the 38 count mismatches are untranslated SwiftUI
literals (T11's set).

SDD-Task: T5
SDD-AC: AC-09
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): format texts per locale with Foundation for the zero-loss check

scripts/localization/foundation_format.py drives format.swift, which loads
each <locale>.lproj table through its own bundle and formats with
String(format:locale:arguments:), so every locale gets its own plural rules
and number formatting in one process (pilot Q-format). Samples are inferred
from the English codes. --self-test exits 2 when uk formats 2 and 5 with the
same plural form; forcing localizedStringWithFormat proves it does.
Test expectations for numbers >= 1000 follow Foundation's locale grouping
(1.001, 1,001, 1 001), as a phone shows them.

SDD-Task: T6
SDD-AC: AC-02
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): add the zero-loss check's pre-merge mode

scripts/localization/zero_loss_check.py follows contracts/cli.md: it pairs
every code place with its Baseline key (places.py), formats both sides per
locale with Foundation (foundation_format.py) and reports place, file-places,
missing-key, unused and watch findings, exit 0/1/2, offline. --write-key-map
writes the key map only on a pass. The formatter now returns a text without
arguments raw (a literal "50% since" is not a format) and turns a crashing
format into the sentinel ⟂format-crash instead of failing the run; a crash
on both sides counts as the same wording. A Baseline ja/tr translation of
"%d merchant(s) in %@" swaps its unnumbered codes and crashes Foundation.

SDD-Task: T7
SDD-AC: AC-04
SDD-AC: AC-06
SDD-AC: AC-09
SDD-AC: AC-10
SDD-AC: AC-14
SDD-AC: AC-15
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): add the zero-loss check's release mode and ADR-0007

--release checks the Catalog through the committed key map (Baseline key ->
current keys) instead of pairing code places, so later code changes do not
fail it; it needs no build, writes nothing, and still checks the key set,
Unused entries and Watch files. ADR-0007 (Proposed) amends ADR-0004 for
release runs; sad Flow 8, §9 and §11 and contracts/cli.md follow it.

SDD-Task: T8
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(l10n): move changed Catalog entries to their derived keys

scripts/localization/move_entries.py pairs Baseline and current places,
moves each entry whose key the rewrite changed to the derived key in every
locale, and rewrites format codes by argument position (plural forms and
substitutions included, %n$ and %% kept, nothing invented). A multi-argument
Moved key's English value is written positional so Xcode's sync keeps it.
The old key is removed unless a place still uses it; a clash or a key shared
with Objective-C stops the run with nothing written. On the pilot it finds
exactly the 3 hand-moved keys and is a no-op on their already-moved Catalog.

SDD-Task: T9
SDD-AC: AC-06

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build(l10n): turn on string extraction, drop BartyCrouch, add the Catalog sync phase

Project level: SWIFT_EMIT_LOC_STRINGS and LOCALIZATION_PREFERS_STRING_CATALOGS
on, and XCSTRINGS_LANGUAGES_TO_COMPILE lists the 22 locales the app ships
today. Both BartyCrouch phases and .bartycrouch.toml are gone. dashpay gets
a "Sync String Catalog" phase after compilation that runs
scripts/localization/sync_catalog.py: compiler .stringsdata plus a legacy
extraction of the target's Swift and Objective-C sources, xcstringstool sync,
then the Xcode app's serialization (ADR-0008); on the pilot data it writes the
same Catalog as the Xcode app. It skips itself when its inputs are unchanged
(0.1 s) and is a no-op until the Catalog exists. dashpay builds; the build
leaves the checkout clean.

SDD-Task: T10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): show untranslated SwiftUI literals verbatim

186 SwiftUI places the compiler extracted without a Baseline entry (137
literals, 49 interpolations; Storage Explorer, sync diagnostics, debug and
preview text) become Text(verbatim:) or take a String value, so they are not
Catalog entries (AC-06) and the Xcode app and the sync phase agree on them.
Numbers inside them use .formatted(), which gives the same grouped text as
before in en_US and uk_UA; no literal used Markdown. The 51 places with a
Baseline entry are unchanged. dashpay builds; the a11y audit passes.

SDD-Task: T11
SDD-AC: AC-06
SDD-AC: AC-13

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(l10n): fail on NSLocalizedString in Swift

scripts/ci/check_no_old_swift_lookup.py lists every line of Swift in
DashWallet/ and DashWalletTests/ that calls NSLocalizedString outside
comments and string literals and exits 1 on any; Objective-C and the Watch
app are not scanned. The unit-tests workflow runs its tests and the guard in
the membership job. It reports 3664 lines today and goes green when T13
finishes the Swift rewrite, inside the same pull request.

SDD-Task: T14
SDD-AC: AC-08
SDD-AC: AC-17

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): pause the app text sync and describe the String Catalog routine

.tx/config keeps only the Watch and App Store resources, so tx push/pull no
longer touches the main app's texts (Translation sync pause, nothing sent).
AGENTS.md, DEVELOPER-NOTES.md, README.md, ACCESSIBILITY.md, the design
system notes and the agent guides now describe the routine after the move:
String(localized:) in Swift, NSLocalizedString only in Objective-C, the
build's "Sync String Catalog" phase keeping Localizable.xcstrings in step,
22 shipped locales of 43, the CI guards, and the pause.

SDD-Task: T17
SDD-AC: AC-11
SDD-AC: AC-14

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): pair Baseline places from a compiler build and add regenerate.sh

Running the tools on the real code found three gaps. A lightweight
extraction cannot derive the keys of SwiftUI interpolations, so the
Baseline's Swift places now come from a dashpay build of the Baseline commit
(build_baseline.sh; zero_loss_check.py and move_entries.py take
--baseline-derived-data) plus the legacy NSLocalizedString extraction. A
Swift file the dashpay target does not compile gets a lightweight
String(localized:) extraction on the current side. The entry mover replaces
the English-only `new` entry the build's sync makes for a derived key.
regenerate.sh runs ADR-0006's steps (Baseline build, generate, project file
via catalog_project.py, codemod with Objective-C and colliding keys kept
literal, build, move, build); contracts/cli.md lists the new flag.

SDD-Task: T12
SDD-AC: AC-09
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* generated: string catalog, codemod and moved keys

Output of scripts/localization/regenerate.sh on the merge-base f6e507b5b
(ADR-0069): DashWallet/Localizable.xcstrings generated from the 43
Baseline text and plural lists, which are deleted; the project references the
Catalog; Swift lookups rewritten to String(localized:) by the codemod (keys
looked up from Objective-C and colliding keys kept literal); 85 Baseline
keys replaced by their derived keys; the Catalog as the second build's sync left it.
A third build leaves it unchanged. On a rebase this commit is dropped and
regenerate.sh is run again; hand fixes follow in their own commits (T13).

SDD-Task: T12
SDD-AC: AC-07
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): leave Baseline translations that take an argument as the wrong type out of the check

A Baseline translation such as ja/tr "%@ で %d の加盟店" for "%d merchant(s) in %@"
reads its arguments in the wrong order, so Foundation formats undefined text and the
two sides can never compare. The check now judges the format codes against the sample
arguments: such a translation is a baseline defect, printed on a DEFECT line and left
out of both columns, not a finding. The rule looks at codes, never at keys, so the
check still has no list of accepted changes.

SDD-Task: T13
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): judge baseline defects with the arguments the formatter used

The defect rule read sample arguments with the check's own code pattern, which
takes "50% since" for a code, so prose percent signs looked like a wrong type.
It now uses the arguments format.swift inferred, and only when the formatter
crashed falls back to a pattern identical to format.swift's.

SDD-Task: T13
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): look up the codemod's leftovers with String(localized:)

The 45 Swift calls the codemod could not rewrite (formatted keys outside a
formatting call, fixed-precision floats, multi-line and mismatched arguments,
one non-literal key in a test) now use String(localized:) with the same
literal key and comment and keep their formatting call. Without interpolation
String(localized:) returns the table text raw and keeps a .stringsdict plural
rule, so no key changes and no entry moves. No Swift code calls
NSLocalizedString any more.

SDD-Task: T13
SDD-AC: AC-08

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): number the codes of the ja and tr "%d merchant(s) in %@" translations

Both translations put the distance before the count with unnumbered codes, so
Foundation read the count as an object and showed undefined text. Numbered codes
(%2$@ … %1$d) show the distance and the count. The zero-loss check reports these
Baseline translations as baseline defects.

SDD-Task: T13
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): commit the zero-loss key map and record T13's state

The pre-merge check passes on Baseline e798ee8f2 (0 findings, places == same
on all 43 locales, 4 baseline defects left out) and wrote the key map that
release mode reads. pr-notes.md records the hand-fix pattern and the one
intended wording change (ja/tr merchants).

SDD-Task: T13
SDD-AC: AC-09
SDD-AC: AC-10
SDD-AC: AC-12

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): move the accessibility audit and the encoding script onto the Catalog

The audit resolved A11Y010 keys from en.lproj, which the move deleted, so the
check silently tested nothing, and it did not know String(localized:), so the
codemod's labels showed up as 32 false findings. It now reads the keys from
DashWallet/Localizable.xcstrings (an interpolated key matches its format
codes), counts String(localized: as localized, and stops when the Catalog is
missing. --check matches the merge-base: 582 findings, 0 new, 0 lost.

convert_strings_to_utf8.sh checks only the Catalog: strips a UTF-8 BOM,
refuses UTF-16, never touches WatchApp/. Both scripts get tests, run in CI.

SDD-Task: T15
SDD-AC: AC-16

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): rewrite the zero-loss key map on Baseline 088eead15

After the rebase onto develop the check passes on the new merge-base
(3924 places, 0 findings); the key map's keys are unchanged, only its
baseline moves. The rebase routine now names --write-key-map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): add the plural-fidelity test and move the plural tests onto the compiled Catalog

PluralFidelityTests formats every Baseline counted phrase in each of the 22
compiled locales for the counts 0, 1, 2, 5, 21, 101 from the app's compiled
Catalog, through String(localized:) where the code interpolates, and compares
it with BaselinePluralForms.json, written from the Baseline lists by the
zero-loss check's formatter (scripts/localization/baseline_plural_forms.py).
It also fails when a locale has plural variants its Baseline lacked. The
other 21 Catalog locales are covered by the zero-loss check.

CountedPhrasePluralTests and VotingListSectionTests read the derived keys;
the voting test accepts a single-form plural in the text table.

SDD-Task: T16
SDD-AC: AC-02
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): measure the NFRs and sync the Catalog in Debug builds only

verification.md records the T19 measurements: incremental Debug build 4.6 s
on the branch against 21.2 s on the Baseline with BartyCrouch (medians of 3);
0 Catalog changes over 4 builds; Release text resources -1.5%; Catalog UTF-8
without BOM, Watch files unchanged; AC-03, AC-04, AC-14, AC-15 and the
zero-loss check's release mode pass.

A Release build marked "Amount too low" stale: its only lookup is in a
#Preview inside #if DEBUG, which Release does not compile. The sync phase
now runs only in Debug builds; other configurations compile the Catalog as
committed (owner decision, ADR-0008 amended). Two Xcode-app checks are left
for the owner, listed in verification.md.

SDD-Task: T19
SDD-AC: AC-03
SDD-AC: AC-04
SDD-AC: AC-05
SDD-AC: AC-14
SDD-AC: AC-15

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(l10n): move the Baseline reader into a module the zero-loss check keeps

The zero-loss check and the plural-fixture writer read the Baseline lists
through baseline_lists.py, so removing the Catalog generator no longer
breaks them. T20's list now names catalog_project.py and its test.

SDD-Task: T21
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(ci): catch NSLocalizedString inside interpolations, after raw literals and before a spaced paren

The old-call guard scans string interpolations as code, skips raw
literals by their own delimiters and matches NSLocalizedString\s*\(.

SDD-Task: T25
SDD-AC: AC-08
SDD-AC: AC-17

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): promote the String Catalog migration's ADRs to the log as 0064–0071

Feature ADR-0001…0008 go to docs/adr as Proposed under the l10n Area,
with a feature summary that links them (ADR-0001 rule 4).

SDD-Task: T32
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): give every plural position its own count in the zero-loss samples

A phrase with two plural variables whose arguments were swapped now
fails the check. The check and the plural-fidelity fixture share one
sampler; the fixture is regenerated on Baseline 088eead15.

SDD-Task: T22
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(l10n): run the String Catalog tool tests on every pull request

The unit-tests job runs scripts/localization/tests and the codemod's
tests after Xcode is selected, with the compiled helpers cached in the
runner temp dir.

SDD-Task: T26
SDD-AC: AC-04
SDD-AC: AC-05
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): make the zero-loss key-set check two-way

Pre-merge reports a Catalog key no Baseline key, Moved key or current
lookup place accounts for (extra-key); both modes report a leftover old
copy of a Moved key next to its replacement (old-copy). Release mode has
no lookup places, so it cannot tell a new text from a stray key and
reports old-copy only.

SDD-Task: T23
SDD-AC: AC-06
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): refuse to run the zero-loss check on a wrong or missing build

The check exits 2 with one line when the Baseline build is missing, empty
or recorded for another commit, and when no dashpay build of this
checkout exists. build_baseline.sh records the commit and worktree it
built, and Baseline sources map through that recorded root.

SDD-Task: T24
SDD-AC: AC-10
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): make the tool docs and comments say what the code does

The zero-loss check's usage names --baseline-derived-data and release
mode, its argument comment covers a Baseline crash, the contract's
examples pass the Baseline build, module docs cite the log ADRs instead
of task ids, and the CI comment no longer names BartyCrouch.

SDD-Task: T33
SDD-AC: AC-09
SDD-AC: AC-10
SDD-AC: AC-11

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): show block heights and counts without thousands separators again

The codemod's integer interpolations grouped digits by locale
("block #2,123,456"). The 21 places that can show 1000 or more look
their Baseline key up through String(format:) again, as the Baseline
did; the 13 Baseline entries come back with all their translations and
their moved copies leave the Catalog. Key map rewritten; the zero-loss
check passes in both modes.

SDD-Task: T28
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): guard the Catalog sync phase against missing and leftover inputs

The phase fails the build when the target has Swift files but the
compiler produced no .stringsdata, and counts a .stringsdata or .d only
when its object file is in the target's LinkFileList, so the leftovers
of a deleted source neither fail the build nor keep its keys alive.
Checked with a real incremental dashpay build carrying such leftovers.

SDD-Task: T27
SDD-AC: AC-04
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): record the Baseline-defect exception and lock the fixed ja/tr text

AC-01 and the wording NFR name the one intended wording change: the ja
and tr "%d merchant(s) in %@" translations, which formatted undefined
text at the Baseline, now show the count and the place.

SDD-Task: T31
SDD-AC: AC-01
SDD-AC: AC-02

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): limit ADR-0071's preview rule to new literals

The one Baseline lookup inside a #Preview keeps its lookup: its key has
translations, so the Xcode app keeps it, and dropping the place would
break the zero-loss pairing. T19 stays open for the Xcode-app checks.

SDD-Task: T30
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): keep the zero-loss check's contract next to the check

The contract moves to scripts/localization/ZERO_LOSS_CHECK.md, so it
ships with the pull request while the pipeline drafts do not; the ADRs,
tests and feature summary point there. The one test that reads a
planning draft skips when the drafts are absent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): keep the preview-only Catalog entry out of the Xcode app's stale marking

The Xcode app does not extract #Preview code, so a build in it marked
"Amount too low" stale while the command-line sync kept it. The entry is
manual now, which neither writer changes, and a test requires that of
every key looked up only in #Preview or #if DEBUG code.

SDD-Task: T30
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): read the current places from a simulator Debug build only

The zero-loss check's default build was the newest dashpay build of this
checkout, which could be a device build; that compiles other files than
the simulator Debug build the Baseline is, so its places did not pair.

SDD-Task: T24
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(string-catalogs-migration): record which Xcode-app checks ran and which risk the owner accepted

SDD-Task: T37
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): record that ungrouped integers keep String(format:) in ADR-0066

SDD-Task: T40
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): name the default build and release mode's old-copy limit in the check's contract

SDD-Task: T41
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): find SwiftUI literal keys in debug-only code too

The guard that keeps preview-only Catalog keys manual saw only
String(localized:). A Text/Button/Label literal in a #Preview is a key
the Xcode app drops and the sync phase keeps, so it now sees those too.

SDD-Task: T36
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): show the DashConnect status code without thousands separators again

The interpolated OSStatus rendered as (-25,300) where the Baseline showed
(-25300). The site keeps its Baseline key through String(format:), joins
UngroupedCountTests' list, and a new test renders two app sites under the
host's grouping locale, so reverting either of them fails.

SDD-Task: T34
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style(l10n): wrap the String(format:) calls that went over the line limit

SDD-Task: T35
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): name behaviour instead of task and review labels in the kept tools

SDD-Task: T38
SDD-AC: AC-11

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): drop the task ID from ADR-0071's body

SDD-Task: T44
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): find the remaining SwiftUI literal keys in debug-only code

The guard listed only some SwiftUI initializers and modifiers that take a
LocalizedStringKey. It now also sees ContentUnavailableView,
NavigationLink, ProgressView, Stepper, DatePicker, DisclosureGroup,
LabeledContent, GroupBox, ColorPicker, alert, confirmationDialog, help
and navigationSubtitle, so a debug-only key looked up through one of
them cannot leave the Xcode app and the sync phase disagreeing.

SDD-Task: T45
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): name the default build in the zero-loss check's --help

SDD-Task: T46
SDD-AC: AC-10
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style(l10n): wrap the remaining long lines the ungrouped-integer fix wrote

The birth-height confirmation call gets its arguments wrapped like the
"Resync armed" call; its Baseline key stays one literal, because a split
key would be another key. The test's copy of that key is split into
concatenated literals. T35's checklist now names only the lines T28
wrote.

SDD-Task: T47
SDD-AC: AC-01
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): describe the current rebase routine and the tools' removal in ADR-0069

ADR-0069 still said a rebase regenerates only the generated commit and that the
codemod's future is decided later; ADR-0065, the SAD's accepted-debt list and
its Flow 1 diagram said the same. All now state that a rebase re-applies every
later commit in order with the tool removal last, and that the one-off tools
leave the repository in the pull request's last commit.

SDD-Task: T49
SDD-AC: AC-18
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): drop the task and brief IDs from the promoted ADRs

ADR-0065, 0066, 0067, 0070 and 0071 (and their feature copies) cited a brief
section, a brief risk ID, a task ID and the pilot's task ID, which point at
pipeline drafts the pull request does not carry. The sentences already state
the risk; the pilot is named by what it was.

SDD-Task: T50
SDD-AC: AC-05
SDD-AC: AC-10
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): name ADR-0066's plural-rules driver instead of the brief

SDD-Task: T53
SDD-AC: AC-09

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): drop compiler places of Swift files that are not in the checked tree

The zero-loss check reads every .stringsdata under the build folder, and
an incremental build keeps the data of a Swift file that was deleted or
renamed since. Those old places could pair with the file's Baseline
places and hide a file-places finding. Both readers now keep a compiler
place only when its file is a Swift file of the tree they describe: the
working tree for the current side, the Baseline checkout for the
Baseline side.

SDD-Task: T61
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): give step 5's DerivedData deletion the reason it still has

Since the check drops compiler places of Swift files that are not in the
tree, a deleted or renamed file no longer leaves its places behind. The
rebase routine now deletes DerivedData for the case the check still
keeps: old data of a Swift file that is on disk but no longer compiled.
The check's contract states the rule for both sides.

SDD-Task: T63
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): compile the Swift helpers for the macOS host inside the build

The sync phase runs in the dashpay target, where Xcode exports SDKROOT
as the iPhoneSimulator SDK. The Catalog writer compiled there with a
plain `xcrun swiftc` targets macOS against the iOS SDK and fails, so the
first Debug build on a machine without the cached helper failed. Both
helpers (the Catalog writer and the zero-loss check's formatter) now
compile through one function that drops SDKROOT and asks xcrun for the
macOS SDK.

Verified: a dashpay Debug build with an empty helper cache compiles the
writer inside the phase and passes.

SDD-Task: T69
SDD-AC: AC-03
SDD-AC: AC-04
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): cite the promoted ADR numbers in the sync phase and the tools

The Sync String Catalog phase cited ADR-0005 and ADR-0008, the feature
drafts' numbers; in docs/adr ADR-0005 is another decision and ADR-0008
does not exist. It now cites ADR-0068 and ADR-0071. The three tools the
last commit removes carried draft numbers too and are corrected so the
new guard holds before and after that commit.

The guard: every ADR number cited under scripts/localization or in the
sync phase's script names a docs/adr record that links to this feature.

SDD-Task: T70

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): keep the Today extension's "Setup Wallet" as a manual entry

The Catalog is compiled into the dashwallet, Today extension and dashpay
targets, but only dashpay syncs it, so a key only the Today extension
looks up was marked stale and read as an Unused entry. "Setup Wallet"
is now manual. The test that keeps debug-only lookups manual also fails
on a key only the Today extension looks up, or one looked up only under
`#if !DASHPAY`, whose entry is not manual. ADR-0071 names the case.

A dashpay Debug build leaves the Catalog unchanged (20 stale).

SDD-Task: T71
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): let new counted phrases through the plural-variant test

The test failed on every compiled plural key missing from the Baseline's
variant lists, so the first counted phrase added after the move would
turn CI red, and only a hand edit of the generated fixture would clear
it. It now holds only the Baseline's counted phrases to the Baseline: a
key that had variants in some Baseline locale must not gain them in a
locale whose Baseline lacked them (the two English-only phrases). A key
no Baseline locale had passes.

SDD-Task: T72
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): format the counted phrases through the app's call in the plural test

The app formats every counted phrase it looks up without an
interpolation as String.localizedStringWithFormat(String(localized:
"<key>"), ...). The test formatted those phrases from
Bundle.localizedString instead, so it could not see String(localized:)
lose the plural rule on that route. It now takes the format from
String(localized:) and formats it with the locale under test standing
in for the app's current locale; the Japanese and Turkish merchant-count
check uses the same call.

Every form matches the Baseline. A run that formatted with the
simulator's English current locale picked English plural categories
and grouping for the other locales, so the call keeps the plural rule
and takes it from the current locale, as the Baseline's call did.

SDD-Task: T73
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): count as seen only the branches the dashpay Debug sync sees

The manual-entry scan counted as seen every branch except `#if DEBUG`,
`#if !DASHPAY` and the `#else` of `#if DASHPAY`, and did not look at
Objective-C conditions. A text looked up only in the `#else` of
`#if DEBUG`, under `#if !DEBUG` or an undefined flag, or in Objective-C
under `#if DEBUG`, is marked stale by every Debug build and reads as
Unused, and the test passed.

Swift: a branch is seen only when the dashpay Debug build compiles it
and its condition does not name DEBUG; a condition the scan cannot
evaluate and an `#elseif` branch are unseen. Objective-C: a lookup under
a positive DEBUG condition is unseen, as `xcstringstool sync` marks it
stale; every other condition is kept.

The fixed scan found one entry: "NFC device didn't transmit a valid
Dash address", looked up on purpose in dead `#ifdef DEBUG` code, is
now manual. ADR-0071's Negative list states the rule. The sync phase
run on a copy of the Catalog with this checkout's dashpay Debug build
data leaves it unchanged.

SDD-Task: T74
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): check every Objective-C condition shape and every dashpay source

The manual-entry scan read only DashWallet/Sources and the Today
extension, and counted an Objective-C branch as unseen only under a
positive DEBUG condition it recognised: any `!` made a condition
negative, `#elif` and `#else` looked only at the previous branch, and
`#if 0`, `# if` and a `/* */` comment were missed. The sync marks such
lookups stale while the test passed.

Objective-C: a branch counts as seen only when no condition in its
chain names DEBUG and it is not `#if 0`, or when it is a lone negative
DEBUG branch or the `#else` of a lone positive one. Both Catalog tests
scan every `.swift` and `.m` file under DashWallet/, DashPay/ and
Shared/. No key is newly flagged; the Catalog is unchanged.

ADR-0071 and the file's docstrings now say separately what the sync
marks stale and where the scan asks for `manual` out of caution.

SDD-Task: T75
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): read Objective-C conditions and the dashpay file list from the tools

The manual-entry scan now takes each Objective-C lookup and its
condition from `xcstringstool extract --legacy-localizable-strings`, the
extraction the sync phase runs, instead of its own preprocessor parser.
A lookup counts as seen only with no visibility, or one that names
DEBUG only negated and names neither the simulator nor an always-false
condition. Comments, line continuations, #elifdef and constant
conditions now read as the sync reads them.

The dashpay files are the target's own list in project.pbxproj (its
Sources phase plus its synchronized folders, .mm included), so a file
in no target no longer counts its lookups as seen.

ADR-0071 and the docstring name the simulator and always-false cases.

SDD-Task: T76
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): read Swift lookups and their conditions from the extractor

The manual-entry scan read Swift lookups line by line, so it missed a
lookup wrapped over lines and counted a commented-out one as seen. It
now reads them through `xcstringstool extract --modern-localizable-strings
--SwiftUI`, as it already reads Objective-C, and classifies each by the
visibility the extractor records: seen only with no visibility, or a
condition of flags, `!`, `&&` and `||` that names no DEBUG and is true
for the dashpay Debug flags. An `#elseif` branch is now evaluated from
its full condition. A literal passed `as String` is no longer counted
as a lookup.

sync_catalog's extraction helper takes the modes as arguments so the
test runs the same call. ADR-0071 and the docstring name every
cautious case of both languages, including the Objective-C opaque,
module and Catalyst conditions.

SDD-Task: T77
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): read the Debug flags from the project and every Swift lookup shape in the scan

The manual-entry scan now evaluates Swift conditions for the flags
xcodebuild resolves for the dashpay Debug build (DASH_DEVNET, COCOAPODS,
SystemSQLite and Debug were missing), so CI runs the Catalog tests after
pod install. It compares keys under the Catalog's names: an untyped
interpolation, %arg, matches any format specifier, and a seen one that
matches several keys sees none. Literals the potential-key extraction
finds in unseen Swift code count as unseen, which covers
LocalizedStringKey("K"), LocalizedStringResource literals, key-typed
parameters and ternaries in Text; NSLocalizedString in Swift is read
through the legacy extraction the sync runs. ADR-0071 and the docstring
say what the Swift extraction covers.

SDD-Task: T78
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): read the Debug build settings with the pinned packages

The manual-entry scan read the dashpay Debug flags through
`xcodebuild -project … -target dashpay`, which resolves the package graph
afresh, so on CI the Catalog tests fetched DashUIKit at master instead of
the version the workspace pins. It now reads them through the workspace
and scheme dashpay with -disableAutomaticPackageResolution and
-onlyUsePackageVersionsFromResolvedFile, as the test build does; the
flag set is unchanged and a test pins the command.

The workflow comment and the docstring name both flags the Pods xcconfig
adds (COCOAPODS, SystemSQLite), and Swift `#if false` moves from the
cautious cases to the ones the sync marks stale, in the docstring and
ADR-0071.

SDD-Task: T79
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): say the flag lookup still fetches a missing pinned package

The `debug_build_flags` docstring said no package is fetched. The two
resolution flags stop xcodebuild from resolving a newer revision, but
on an empty DerivedData it still clones the pinned DashUIKit, as on a
fresh CI runner. The docstring now says so; the code is unchanged.

SDD-Task: T80
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): rewrite the zero-loss key map on Baseline ee68513eb

The rebase onto develop moved the Baseline to ee68513eb. The keys of the
UIKit screens develop removed (#1445) no longer have a lookup, so they leave
the map and stay in the Catalog as Unused entries. The check passes on the
new Baseline: 0 findings, 45 Unused entries intact, 43 Watch files identical.

SDD-Task: T12
SDD-AC: AC-10
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): regenerate the plural-fidelity fixture on Baseline ee68513eb

The Credits phrase lost its only lookup when develop removed the UIKit
screens (#1445), so the codemod no longer moves it: its key stays the
Baseline's "%@ ~ %lu contacts / %lu profile updates". The other 61 phrases
are unchanged.

SDD-Task: T16
SDD-AC: AC-02
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): check the wording of every key the dashpay target looks up

The zero-loss check read places only under DashWallet/, so the keys
looked up only from the dashpay target's Objective-C under DashPay/ had
no place, no wording row and no key-map entry: their translations were
compared by nothing, while the contract promised every key the app uses.

The dashpay target's source list moves from the Catalog test into
dashpay_target.py, and places.py covers every file under DashWallet/
plus every file that list names, each side from its own project file.
The check passes on Baseline ee68513eb with 3931 places per locale
(was 3880); the rewritten key map leaves out only the Today extension's
"Setup Wallet", which the contract now names as out of scope.

SDD-Task: T81
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): bring ADR-0067's How it works in line with the check

ADR-0067 is still Proposed, and it described a check the code does not
run: Baseline places from the legacy extraction, no baseline-defect
rule, a one-way key set, and a stale-build refusal left to `tasks`. It
now names the sources covered, the compiled Baseline build, the
baseline-defect rule, the two-way key set with its carve-out for keys a
current place asks for, and the exit-2 refusal of a stale build, as the
code and ZERO_LOSS_CHECK.md do.

SDD-Task: T82
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): check the zero-loss samples against format.swift's inference

When the formatter crashes on a Baseline text, the check judges the
baseline defect with sample_args, a Python copy of format.swift's
inferArgs, which was tested only against itself. One test now has
format.swift infer the arguments of texts with every length modifier,
conversion, flag, position gap and escape it can format, and compares
them with sample_args; another compares the two patterns for the codes
that crash (%s, %S). Changing the pattern or a sample value on either
side alone fails them.

SDD-Task: T83
SDD-AC: AC-09

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): state the release judgement in the zero-loss contract

ZERO_LOSS_CHECK.md stays in the repository for the person preparing the
next releases, but it sent them to "Flow 8", "spec §7" and "SAD §8" for
how to judge a release finding, and those pipeline drafts do not ship
with the pull request. The file now states the rule itself: who judges,
when a `key` or `old-copy` finding is a deliberate change rather than a
loss, and that every other finding is fixed before the release. No
reference to a Flow, spec or SAD section is left in it.

SDD-Task: T84
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): sync only the build's architectures, through a staging file of its own

The sync scanned every <arch> folder under OBJECT_FILE_DIR_normal. Xcode
keeps the folder of an architecture an earlier build compiled, with its
own link list, so after one x86_64 build a deleted key stayed counted as
seen locally while a clean CI build marked it stale. In a build phase it
now reads only the folders ARCHS names (an architecture without a folder
is an error); run by hand without ARCHS it reads every folder as before.

Every run also staged the Catalog in one fixed file, so two builds of
one checkout syncing at once could fail each other. Each run now stages
in a file of its own in the Catalog's folder, keeps the Catalog's mode,
and removes the staging file if the replace fails.

SDD-Task: T85
SDD-Task: T86
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): read the Baseline's synchronized folders from its project file

The Baseline side chose which top-level folders to extract by listing
the dashpay target's sources, but a synchronized folder's files are
found by walking the disk, and only DashWallet/ was on disk at that
point. A synchronized folder outside DashWallet/ therefore had no
Baseline places while the current side read them, and every file in it
would fail the check as a places mismatch. dashpay_target.top_folders
now reads the folders of the build-phase files and of the synchronized
groups from the project file alone, and the Baseline side extracts
those. Today the folders are DashPay, DashWallet and Shared, plus
Components, a synchronized group under Recovered References that is not
on disk and is skipped as not in the commit; the check's places do not
change.

SDD-Task: T87
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): assert the no-target case with a file that is on disk

The Catalog test checked that a file in no target is not in the dashpay
file list by naming DWExploreHeaderView.m, which develop deleted (#1445),
so the assertion held whatever the list read. It now names DWButton.m,
the one Objective-C file on disk that no target compiles, and asserts it
exists; adding every file on disk to the list fails it.

SDD-Task: T89
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): name the Baseline commit without a SHA in UngroupedCountTests

The doc comment said each site's Baseline key is read from
`git show 088eead15:<file>`; the rebase moved the Baseline to ee68513eb,
and every rebase would leave a SHA stale again. It now says the Baseline
commit, the merge-base with develop. No shipped code names 088eead15.

SDD-Task: T91
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): rewrite the zero-loss key map on Baseline 43e07f371

The rebase onto develop moved the Baseline to 43e07f371. Only the map's
Baseline changes; every place keeps its key. The check passes on the new
Baseline: 0 findings, 45 Unused entries intact, 43 Watch files identical.

SDD-Task: T12
SDD-AC: AC-10
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): regenerate the plural-fidelity fixture on Baseline 43e07f371

Only the fixture's Baseline changes; the 62 phrases and their forms are
the same as on ee68513eb.

SDD-Task: T16
SDD-AC: AC-02
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): publish a localization file only over the bytes it was derived from

A Debug build's Catalog sync compared its result with the live Catalog, so
a translation saved in Xcode while the sync ran was replaced by the older
result. The sync now works on a snapshot, publishes only while the Catalog
on disk still holds the snapshot's bytes (otherwise it stops with an error
and leaves the edit), runs one at a time per checkout (a lock on the
Catalog's folder), and stamps the inputs as it read them before the sync.

The same rule covers the other writers of checked-in localization files:
--write-key-map and baseline_plural_forms.py now write through
catalog_io.publish_text, which writes atomically and refuses when the
Catalog or key map they were derived from changed since it was read.

SDD-Task: T96
SDD-AC: AC-04
SDD-AC: AC-05

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): refuse compiler data older than its own Swift source

The pre-merge check compared only the newest .stringsdata with the newest
Swift file, so an incremental build that refreshed one file's data and
stopped before another's passed, and the old record of the second file was
read as current (and could reach the key map). Every record of a
working-tree Swift file is now checked against its own file, leftover
folders of another architecture included; one older record refuses the run
and names the file.

build_baseline.sh removes its records before building, and the whole folder
when it holds no record of the same commit, so a failed or partial build
never vouches for its .stringsdata.

SDD-Task: T97
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): keep four uncapped counts ungrouped as at the Baseline

Pending asset-lock recoveries ("%d still in progress", "Finishing %1$d of
%2$d…"), Quick voting casts and an unknown special transaction type were
locale-less String(format:) at the Baseline and became integer
interpolations, which group digits ("1,000"). None is capped below 1000.
Each keeps its Baseline key inside String(format:) again, the Baseline
entries are back with all 43 locales, the derived entries are gone, and
UngroupedCountTests lists the four sites. The other five moved
String(format:) places are bounded (countdowns from 10, a percentage,
constants); localizedStringWithFormat places grouped at the Baseline too.
Key map rewritten; the zero-loss check passes.

SDD-Task: T98
SDD-AC: AC-01

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): check every kept Baseline translation, whatever the entry's state

An entry kept under its Baseline key was compared only through a wording
row (a place, or the key map in release mode) or, when stale, as an Unused
entry. A manual key no place reads ("Setup Wallet", looked up only by the
Today extension) or an Unused entry a later lookup makes live again was
checked for presence only, so a lost translation passed. Both modes now
compare the Baseline translations of every such entry and report a loss as
an `unmapped` finding.

SDD-Task: T99
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): sample every plural category an integer selects

The counts 0, 1, 2, 5, 21, 101 never reach the Slovenian `few` form (3 and
4 mod 100), the Filipino `other` form or the `many` form of ca/es/fr/it/pt
(a million), so a change to one of those forms passed the zero-loss check.
The counts are now 0, 1, 2, 4, 5, 21, 101, 1000000. A test asks Foundation
which categories an integer selects in each of the Catalog's locales and
fails when the counts miss one; another changes only the Slovenian `few`
form and expects a finding. The plural-fidelity fixture is regenerated with
the eight counts.

SDD-Task: T100
SDD-AC: AC-02
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): state when each release finding is acceptable and who decides

Release mode compares every Watch Interface.strings byte for byte with the
Baseline, while the Watch texts still sync with the translation service, so
a reviewed Watch translation update failed the release check with no rule
for it. The contract now rules every release finding kind: a `watch`
finding is acceptable when every change since the Baseline is a reviewed
Watch translation update in its own commit that keeps the keys and the
encoding; `missing-key`, `unused` and `unmapped` when a later pull request
deleted the text on purpose. The person preparing the release judges them;
the pre-merge run accepts no finding. ADR-0070 names step 5b.

SDD-Task: T101
SDD-AC: AC-15

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): replace the BartyCrouch directive with context for translators

Nine Swift lookups still passed "#bc-ignore!" as their comment, and the
build wrote it into five Catalog entries. BartyCrouch is gone, so the
directive controlled nothing and showed translators a tool command. Each
key now carries one comment that says what the number counts, and a test
fails on a directive in a Catalog comment or a Swift lookup's comment.

SDD-Task: T102
SDD-AC: AC-11

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): remove only a Baseline build folder the script made

build_baseline.sh removed its derived-data folder whenever it held no
record of the commit being built, so a folder passed as the second
argument, such as Xcode's own DerivedData, was deleted whole. The folder
preparation now lives in prepare_baseline_folder.sh: it empties a folder
the script made for another commit, an empty folder or one under the
default cache root, removes the records of a folder of the same commit,
and refuses any other non-empty folder, leaving it untouched. Tests run
the preparation on each kind of folder.

SDD-Task: T103
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): say the ATM and merchant phrases show the search radius

The %@ of "%d ATM(s) in %@" and "%d merchant(s) in %@" is the search radius
(e.g. "20 mi"), not an area; the translator comment now says so.

SDD-Task: T105
SDD-AC: AC-11

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): fail the directive test when git grep cannot run

SDD-Task: T106
SDD-AC: AC-11

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): recognize the Baseline build folder by its own mark, not its path

The folder guard trusted any folder under the default cache root. When that
root could not be resolved the pattern became "/*" and matched every path,
and the root itself matched too, so a foreign folder or the whole cache
could be removed. The guard now reads only the folder's contents: the
script marks its folder before every build, and it empties only a folder
with that mark or a baseline-commit record, or an empty one. Any other
non-empty folder is refused and left untouched. Tests cover an unusable
cache root and the cache root passed as the folder.

SDD-Task: T107
SDD-AC: AC-09
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): let the Baseline build script delete nothing

Deciding which folders the script may remove kept failing: a path test
removed foreign folders, and the mark that replaced it refused the Baseline
folder the rebase routine's step 2 leaves. The folder preparation now
removes no folder and no build data. It removes only its own two record
files from a folder holding a finished build of the same commit, and
refuses any other non-empty folder with the command that deletes it; step
5 of the rebase routine deletes the old Baseline folder first, as it does
DerivedData. A folder it cannot list stops it, and a relative folder is
taken from the checkout root, since xcodebuild runs in the worktree.

SDD-Task: T108
SDD-AC: AC-09
SDD-AC: AC-10
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): name what the Baseline build leaves alone and delete the folder before a rebuild

pr-notes said build_baseline.sh deletes no folder; it replaces its own
temporary worktree, so the sentence now names the DerivedData folders it
leaves alone. The zero-loss check's hint for a Baseline folder of another
commit says to delete the folder first, since build_baseline.sh refuses it.

SDD-Task: T108

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): say when the record-age test refuses an unchanged file

The per-file age test also refuses a file a branch switch or rebase
rewrote without changing it: Xcode does not rebuild it, so its record
stays older. The message and the contract now say to delete the
DerivedData folder and build again, which the rebase routine always does.

SDD-Task: T97

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): rewrite the zero-loss key map on Baseline f6e507b5b

The rebase onto develop moved the Baseline to f6e507b5b. Develop removed
the only lookup of "This masternode uses extended (v3) network info, …"
(#1476), so that key leaves the map and stays in the Catalog as an Unused
entry with its translations. The check passes on the new Baseline: 0
findings, 46 Unused entries intact, 43 Watch files identical.

SDD-Task: T12
SDD-AC: AC-10
SDD-AC: AC-18

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): regenerate the plural-fidelity fixture on Baseline f6e507b5b

Only the fixture's Baseline changes; the 62 phrases and their forms are the
same as on 43e07f371.

SDD-Task: T16
SDD-AC: AC-02
SDD-AC: AC-07

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(adr): renumber the String Catalog ADRs to 0066–0073

Develop took ADR-0065 (#1476) while this pull request held 0064–0071, and
other open branches hold 0064. The eight Proposed ADRs move to the next
free numbers, in their order: 0064→0066 … 0071→0073. Their files, index
rows, headings, links and every ADR-00NN citation in the tools, the sync
build phase, the contract and the feature summary follow; commit messages
keep the numbers they were written with.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): put a published file in place only over the bytes the tool verified

The sync phase, the key map and the plural-fidelity fixture now publish through
catalog_io.publish_file: the result is staged first, the live file is moved aside and
verified there, and the result goes in place with link(), which fails when an editor
saved a new file in the meantime. A write into the moved-aside file after the check is
kept in a conflict file. No check-to-replace window remains.

SDD-Task: T109
SDD-AC: AC-04
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): recommend deleting only a folder that holds a Baseline build

A folder with no baseline-commit record may be the checkout or a shared DerivedData
parent, so the folder preparation and the check ask for a new empty folder instead of
printing rm -rf; the stale-data hint for --derived-data offers Clean Build Folder.

SDD-Task: T110
SDD-AC: AC-09
SDD-AC: AC-18
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): compare kept translations by plural category, not by a flat value list

The unused and unmapped checks compare the whole localization (each text under its
variation and substitution), ignoring only stringUnit state, so a Slovenian one text
renamed to few is a finding.

SDD-Task: T111
SDD-AC: AC-10
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): publish the key map before printing the report

A refused key map publication is exit 2, which prints no report; the check used to print
RESULT: PASS first.

SDD-Task: T112
SDD-AC: AC-09
SDD-AC: AC-10
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(l10n): excuse every finding of one reviewed deletion together

Deleting a mapped entry with its last lookup yields a missing-key finding and key
findings; the release rules now accept all of them for a reviewed deletion.

SDD-Task: T113
SDD-AC: AC-10
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): put the file back on every failed publication

Any error or interrupt between the move aside and the link now restores the old file;
a leftover moved-aside file refuses the next publication; a changed moved-aside file is
kept as a conflict file on every path; the live bytes are compared before the move; the
sync removes its staging file on failure.

SDD-Task: T114
SDD-AC: AC-04
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): keep the file reachable when the move or the link fails

An interrupt right after the move-aside rename puts the file back; a filesystem
without hard links is refused before anything moves; a put-back that cannot link names
the file that holds the old bytes.

SDD-Task: T115
SDD-AC: AC-04
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): hold interrupts while a file is moved aside

SIGINT, SIGTERM and SIGHUP are held from the hard-link probe to the link and delivered
after it, so no interrupt can land while the published file is moved aside; a failing
conflict rename names the moved-aside file; the probe is always removed.

SDD-Task: T116
SDD-AC: AC-04
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): restore the signal mask on every exit and never remove a leftover

The mask is read before the three signals are blocked, inside the try, so an interrupt
during the blocking call cannot leave them blocked; the hold is documented as per
thread; an empty moved-aside file left next to the path refuses like any other, since
it may be another run's.

SDD-Task: T116
SDD-AC: AC-04
SDD-AC: AC-05
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): name a moved-aside file wherever a published file is missing

A publication killed between moving a file aside and linking its result
leaves the moved-aside file as the only copy. Only the next publication
looked for it, so a Debug build skipped the sync for a missing Catalog and
the zero-loss check reported only "no Catalog" or "key map missing".

catalog_io.refuse_leftover is now the one check: publish_file calls it, and
so does every reader that finds a published file missing: the sync phase
(under the folder lock, which it now takes before its first look at the
Catalog, so another build's publication in progress is waited for rather
than taken for a missing Catalog), both modes of the zero-loss check for the
Catalog and the key map, and the plural fixture writer before any work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(l10n): judge a missing published file only under the publishers' lock

The zero-loss check and the plural fixture writer called refuse_leftover
without the lock the Debug sync holds while it publishes the Catalog, so a
check run during that moment took the expected moved-aside file for an
interrupted write and asked for it to be deleted.

catalog_io.folder_lock is now the one lock (flock on the file's folder,
taken in a fixed order): the sync holds it for its run, publish_text holds
it for every file it publishes or watches, and catalog_io.read_published
reads a published file and judges it missing under it. Every read of the
Catalog, the key map and the fixture in the tools goes through
read_published, and the wording check compiles the Catalog bytes the run
read instead of the live file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(l10n): pin the publishers' lock wait without a timing guess

The wait tests put the file back a second after start, so a reader that
reached the file later passed without the lock. The tests of
read_published and publish_text now let the caller reach the folder lock
while the file is moved aside, then restore it and release the lock, and
fail when the caller never takes that lock. The CLI tests stay as end to
end runs and say they do not prove the wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(l10n): remove the one-off migration tools

The Catalog generator, the swift-syntax codemod, the entry mover, the
Catalog project helper and regenerate.sh, with their tests and
fixtures, were needed only to produce the move. The zero-loss check,
its formatter, the Baseline reader and the key map stay for the release
re-checks. A rebase drops this commit, reruns the routine and re-adds it.

The guard that no kept script or workflow runs a removed tool now
matches a run of the codemod too, and its docstring names what it
scans: Python imports under scripts/localization, shell scripts there,
and files under .github.

SDD-Task: T20
SDD-Task: T54
SDD-Task: T56
SDD-Task: T58
SDD-Task: T60
SDD-Task: T62
SDD-Task: T64
SDD-Task: T65
SDD-Task: T66
SDD-Task: T67
SDD-Task: T68
SDD-AC: AC-10

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants