Repository navigation
Conversation
The approved plan for issue 64 goes into the 3.0.0 appendix with its links fixed. D325 to D333 record the choices the plan left for the start of the work: UniFFI bindings in version 3.0.0, built on the core of D312; one reader interface for calculations, with the core holding their arithmetic; the phone storage binding; where a phone keeps its file; the boundary types; the host client and its sign-in; platform floors; release packaging; and one shared test bundle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`mobile/` holds the `athleticstandard-mobile` crate, built with UniFFI 0.33.0, which exposes the record checks: `validate`, `validateCurrentRecord`, and `libraryVersion`. One failure type carries the desktop error code and message, and validation issues keep field names and list positions apart (D329). `mobile/scripts/` builds an XCFramework for iPhone, the iPhone simulator, and macOS, and the Android libraries for arm64-v8a and x86_64 with a 16 KB page alignment check. `mobile/swift/` is the Swift package and `mobile/android/` is the Gradle build of `ai.athleticstandard`. `mobile/tests/fixtures.rs` runs every recorded model vector through the binding and writes the shared phone test bundle (D333). The vector exceptions moved to `tests/vector_rules/`, so the desktop harness and the bundle read one list. All 7,285 run cases match on a Mac through the Swift package and on an Android emulator through the Android library. The iPhone simulator run is not done yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tions in process. The `athleticstandard` crate gains a `cli` feature, on by default, that holds the command line, terminal handling, provider import readers, prediction and log planning, and the network runtime. Without it the crate builds the store, files, packages, calculations, and views, which is what a phone needs (D327). The two provider-import operations and the prediction operations are left out of that build; the operation order the npm client is generated from does not change. `protocol::run_in_process` runs one protocol operation on a store the caller keeps open and returns its output and streamed items. The worker keeps its events in memory for such a call. An operation that calls back to its client is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phone binding gains `Database`, behind the mobile crate's default `sqlite` feature. It creates and opens `.ath.sqlite` files through the desktop store, reads records, runs the npm client's record operations in process, previews and runs migrations after a verified backup, and writes verified single-file copies that include edits still in the companion log. A closed handle refuses every call (D327). `PickedDocument` in Swift and Kotlin works on a picked document through a private copy and saves it back only when the document still has the content it started from (D328). `FileLocationAdvice` holds the suggested wording that recommends local storage. Tests run the same storage steps in Rust, Swift, and Kotlin: create, edit, close, reopen, a stale correction, a read-only open, an outdated 2.1.0 file, and a copy taken while edits were in the log. `roundtrip.sh` has the desktop `ath` create a file and then check the file the phone library saved. The round trip passed on a Mac and on Android emulators with 4 KB and 16 KB pages. A dependency test checks that the storage build has SQLite and no command-line or network crate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…interface. The calculation settings, methods, range arithmetic, and receipts move to `core/src/calculate/`, with the calendar rules in `core/src/calendar.rs` and the shipped skills in `core/src/assets.rs` (D312). The core has its own error type; the desktop error converts from it with the same codes and messages. Every calculation now asks for its data through `CalculationReader` (D326). The desktop's SQLite reader in `src/calculate/sqlite.rs` runs the same indexed queries as before, inside one read snapshot. A memory snapshot in the core answers the same requests from supplied records, with the same filters and order. A batch with an invalid record or a repeated ID is refused and leaves the builder as it was. The 3.0.0 workout operations and threshold methods ask for their recordings, intensity references, and workout windows as one request each. The SQLite reader answers with the 3.0.0 queries, unchanged, in `src/calculate/recorded.rs`, `recorded_inputs.rs`, and `window.rs`; the arithmetic, results, and `apply_with` move to the core. A memory snapshot does not hold recordings yet, so it refuses those calculations and says to run them on a database. `tests/calculate_readers.rs` runs every worked example and a set of synthetic edge cases on both readers and compares the complete results, including failures and the input limit at 100,000 and 100,001 inputs. A calculation that reads recordings must get exactly the documented refusal from the snapshot: 30 worked examples and 69 case requests agree, and 12 examples and 2 requests need a database. Every existing calculation, golden, and query-plan test passes unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`src/runtime/sign_in.rs` and `src/runtime/host_sync.rs` send and read JSON with `ureq` and make random `uuid` values, but the root manifest did not turn on `ureq/json` or `uuid/v4`. A workspace build got them from `host/`, so `cargo check -p athleticstandard --bin ath` failed only when the program was built alone. The `cli` feature now turns both on, so the phone build without it still has neither. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phone binding gains `RecordSnapshotBuilder` and `RecordSnapshot`, which calculate on records an app supplies, and `apply`, `applyWith`, and `calculate` on an open `Database`. Both give the desktop JSON. A skill is either a shipped name or the text of an edited copy, `applyWith` takes the options of `ath apply --set` for the threshold methods, and `RangeRequest` carries the options of `ath calculate`. The phone test bundle gains a calculation suite, with the 42 worked examples and the reader edge cases, each with its records, a SQLite file, and the desktop outcome, and a coaching suite for the 20 record-example blocks. All 113 calculation requests match the desktop through the database. Through the memory snapshot, 99 match and 14, which read device recordings or intensity references, get the documented refusal, which the bundle carries as `expected_memory`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`host/examples/test-sign-in-provider.rs` answers like the WorkOS AuthKit recipe: OpenID Connect discovery, a browser authorization endpoint that requires S256 PKCE, a token endpoint that exchanges the code and rotates refresh tokens, and the signing keys. Tokens carry `client_id` and the requested `resource` as their audience, and are signed with the fixed test key. `mobile/scripts/host-test-env.sh` starts it with a real `ath-host` that trusts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kages. `AthleticStandardHost` in Swift and `ai.athleticstandard.host` in Kotlin connect to `ath-host` (D330). Sign-in reads the host's protected-resource metadata and the provider's discovery document, runs the authorization code flow with S256 PKCE in the system browser, checks the callback's address and `state`, asks for a token for the host's resource, and refreshes it. Tokens stay in the Keychain or in a file encrypted with an Android Keystore key. An app with its own session can supply the token. Owner writes are prepared as exact request bytes with an idempotency key, so a retry after a lost reply sends the same request. The tests run both clients against a real host and the test provider: retries, a stale correction, a reused key, refresh and a refused refresh, cancelled and foreign callbacks, a revoked coach, and a disconnected app. The record snapshot builder also accepts the host's record list and the `ath records list --json` output, which hold the array under `records`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le examples. `mobile/scripts/stage-apple.sh` zips the release XCFramework with fixed file times, writes the Swift package repository as released and a tagged staged copy that differ only in the binary target line, and runs every package test through a consumer that resolves the staged copy by version. `mobile/scripts/stage-android.sh` publishes the Android library to a local Maven repository, checks that the POM declares JNA, and has the consumer app resolve it by coordinate: it checks 16 KB alignment of every native library in a shrunk release APK and runs the library's tests through the installed copy in a debug and a shrunk release build (D332). `validate.yml` gains the `mobile-apple` and `mobile-android` jobs. The release job adds the tested zip and both reports to the GitHub release and uploads the tested Maven bundle for the maintainer to publish. `release-mobile-packages.yml`, run by hand, tags the Swift package repository with the tested checksum and installs both packages from their public locations. None of these workflows has run on GitHub yet. The Android consumer app and `swift run AthleticStandardExample` are the runnable examples: offline work on a local file, a picked document, and host sign-in with a read and a saved edit. The phone tests read the expected version from the bundle, and a test checks that every phone build file names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root `.gitignore` ignores every `*.xml` so a real health export is never added by accident, which also left out the five Android build files the phone library needs: two library manifests, the example app's manifest, its strings, and its network rule. Each is reviewed, listed with its hash in `tools/public-data-allowlist.json`, and named in an explicit `.gitignore` exception, as `tests/public_data.rs` requires. None holds athlete data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The build, round-trip, and host scripts read Cargo's output from `target/`. Cargo writes to `CARGO_TARGET_DIR` when it is set, as a fresh clone built against a shared target folder showed, so the scripts now read from there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test expected the backup path to end in `/before-migration.ath.sqlite`. On Windows the path uses `\`, so the check failed although the migration and its backup worked. It now compares the file name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version 3.0.0 was released before the phone library was merged, so the phone packages ship as 3.1.0. D334 says why: under D290 the release only adds packages and library calls, so it is minor, and migration step 9 records the version without changing a table, as step 4 did for 2.1.0. The Open Wearables plan moves to 3.2.0 with step 10 and keeps D272–D289, which replaces the version D317 named for it. The new `build-history/v3.1.0/` folder holds a short spec, D325–D334, the plan, the progress notes, and the evidence. These were added to the 3.0.0 folder on this branch and never released, so they move; the 3.0.0 folder is back to its released text. D325 now names 3.1.0, and the plan's links reach the files where they are now. AGENTS.md lists 3.1.0 as the current version, and the phone README links the new folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The program, the record, the database, the npm package, the crates, and the phone packages move to 3.1.0 under D334. Migration step 9 sets athleticstandard_version to 3.1.0 and changes no table, as step 4 did for 2.1.0. New records, packages, and databases declare 3.1.0, and 3.0.0 packages and databases are still read, imported, and migrated. 3.0.0 is released, so its migration, JSON Schemas, and host API description are pinned, and its 31 calculation skills join the released files, so `ath skill install` replaces an unedited 3.0.0 copy (D231). The generated 3.1.0 schemas match the 3.0.0 files except for the version list and the schema IDs. A test checks the published 3.0.0 files against 2.1.3, and another runs step 9 as a file after step 8. The demo database changed only in its metadata row. SPEC.md, the README, the hosting guide, AGENTS.md, and every skill name 3.1.0. The phone tests read the migrated schema step from the test bundle, as they already read the version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refresh test asks the test sign-in provider to forget refresh tokens, then checks that the next refresh asks for sign-in. The provider forgot every token, so when two emulators ran the test at once, one device could end the other's session between its sign-in and its refresh. The staged Android run failed that way once. The provider's test route now takes a `subject` and forgets only that person's tokens, and the Swift and Kotlin tests name the person each signed in as. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The evidence for 3.1.0 now comes from the 3.1.0 build: the Swift package installed by version, the Android library installed by coordinate on emulators with 4 KB and 16 KB pages in a debug and a shrunk release build, the desktop round trip on each platform, two Swift staging runs with the same zip bytes, and the whole workspace. It also names the two test problems found while gathering it. The simulator, the release CI jobs, and publication are still not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`supplied_fields`, sleep stage minutes, and record extensions were plain JSON maps, and a calculation parameter's value was a plain JSON value. They become `JsonObject` and `JsonValue`, which hold the same JSON and read and write the same text. The Swift and Kotlin bindings need a type of their own to carry them across as JSON text, and a plain map would take the name `Map`, which Kotlin already uses. Nothing in the format or the published schema changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UniFFI now generates a Swift and a Kotlin type for every record type, every part of a record, every list of allowed values, the record wrapper, and every calculation answer, from the Rust model and result types (D329). The core marks them under an optional `uniffi` feature, so the desktop program and the WebAssembly build do not depend on UniFFI. Phone writes take the typed values and run the npm client's request through the same protocol operation, so they get the desktop checks and messages. Reads check the stored JSON before returning a type. JSON stays available through converters, `addRecordsJson`, and `runOperation`. An app keeps its own values as extensions under its own key. The library reads and sets one key and checks the key and the format's limits. The Swift package adds Codable helpers; the Kotlin library adds helpers that take the app's own JSON text. The host clients read and write the typed records too. Result types that UniFFI cannot carry change shape without changing their JSON: whole-number counts are u64, fixed names are String, readings around the best power are (offset, value) pairs, and a threshold answer is one untagged enum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apps add https://github.com/mwhitham/ath by version. The root Package.swift builds the package from mobile/swift/. On main its binary target is the XCFramework that build-apple.sh writes. A release from main tags one commit on top of the tested commit that names the zip on the GitHub release by address and checksum and adds the generated Swift, so Swift Package Manager installs the tested bytes (D332). stage-apple.sh stages that commit in a tagged clone of this repository and installs it by version. The release workflow builds the commit through the GitHub API, tags it, and adds the zip to the release. The separate package repository, its token, and its templates are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UniFFI copies Rust doc comments into the Swift and Kotlin that Xcode and Android Studio show. The phone crate now denies missing documentation, so every call, and every type, field, and case it defines, has a description. Every call is in this crate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mobile/README.md walks an app developer through eight steps, from looking around and choosing where the athlete's data lives to shipping, staying current, and asking for what is missing. The Swift and Android guides show each call with code from the example apps. mobile/tests/guides.rs checks that every sample is a marked region of an example file, unchanged, and that every region is shown. Each example is split by task: records, calculations, the app's own values, picked files, and the host. Each has a README that says how to start an app from it. Their tests run the guide's code on a Mac and on the emulators. The Android consumer app is now mobile/android/example. mobile/CONTRIBUTING.md holds the build, test, and release notes, and the main README gains a "Build an app" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A release from a pushed tag names the tested commit, which Swift Package Manager cannot install. The pull request comment and the release summary now say so instead of naming a release commit that does not exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Progress gains steps 8 to 10, the spec gains the guides as a release gate, and the evidence is gathered again from commit 797813b: 942 Rust tests, the Swift package installed by version from a tagged clone (33 tests), the Android library installed by coordinate in the example app (37 tests on each emulator, debug and shrunk release), two identical XCFramework zips, and the round trip on every platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UniFFI copies Rust doc comments into the Swift and Kotlin that app developers read. The core now denies missing documentation, so every record type, part of a record, list of allowed values, calculation answer, field, and value has a description: about 1,700 new lines, from the code, SPEC.md, the skills, and the studies behind the methods. Each value of a list of allowed values also says how it is stored, such as "Stored as `import_time`.", with a line on what it means where its name says too little. Several existing descriptions that sat on one field but described a group, or that left out cases, were corrected. The generated Swift has a description on all 1,742 of its items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The branch was rebased onto two npm lockfile updates on main, which changed every commit ID. The evidence now names the rebased commits and records the checks run after the descriptions commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mwhitham
force-pushed
the
build/3.0.0-iphone-and-android-library
branch
from
December 1, 2026 02:58
aa2aefd to
93b27be
Compare
Owner
Author
|
Continued in #77. Renaming the branch to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #64: the Athletic Standard library for iPhone and Android apps, built with UniFFI on the shared Rust core, released as version 3.1.0.
The rules stay in Rust. Swift and Kotlin get generated bindings, so an app gets the same record checks, error messages, calculation results, and file handling as the desktop
ath. Every record type and every calculation answer is a Swift and a Kotlin type. Local use needs no account or network connection.The spec, the plan, and decisions D325–D334 are in
build-history/v3.1.0/. Progress is inprogress.md. App developers start atmobile/README.md.What an app developer gets
extensionJsonandwithExtensionJsoncheck the key and the limits. Swift addsCodablehelpers; Kotlin takes JSON text from any JSON library..ath.sqlitefiles (Database): create, open, read, edit, migrate after a verified backup, and save a verified copy.PickedDocument) from iCloud Drive or an Android picker, edited through a private copy and saved back only if the document did not change elsewhere.RecordSnapshot) or from a file.AthleticStandardHost,ai.athleticstandard.host), reading and writing the same typed records.https://github.com/mwhitham/athby version; the Swift package is this repository (D332). Android:ai.athleticstandard:athleticstandardfrom Maven Central.mobile/README.mdwalks through eight steps, from choosing where the athlete's data lives to shipping. The Swift and Android guides show each call with code from example apps; a test checks that every sample is the example's code, unchanged. Each example is split by task and has a README on starting an app from it.mobile/CONTRIBUTING.mdcovers building, testing, and releasing the library.Version 3.1.0
3.0.0 was released before this work merged, so the phone packages ship as 3.1.0 (D334).
v2.2.0folder and will need its version updated.Changes to shared code (worth a close look)
21f2f78, D326). The arithmetic and receipts move intocore/src/calculate/; the desktop SQL stays insrc/calculate/. No expected value in any existing test changed.clifeature, on by default (91a56ea, D327), which the phone build turns off.76bb349) for theureqanduuidfeatures that the sign-in runtime uses.a6d603f). The core gains an optionaluniffifeature; only the phone crate turns it on. Model fields that hold any JSON are now the named typesJsonObjectandJsonValue(825e444). Result types that UniFFI cannot carry changed shape without changing their JSON: counts areu64, fixed names areString, readings around the best power are(offset, value)pairs, and a threshold answer is one untagged enum. Every desktop JSON golden is unchanged.cc3b475). A release frommainnow tags one commit on top of the tested commit, which pointsPackage.swiftat the tested XCFramework by address and checksum and adds the generated Swift. It builds that commit through the GitHub API. A release from a pushed tag cannot, and says so. The separate Swift package repository and its token are gone.0e416f0, renamed inc1cc8e0), each listed with its hash intools/public-data-allowlist.json. None holds athlete data.Tests
All data is synthetic. Everything ran on one Mac, from commit
c1cc8e0. After the descriptions commit (comments only), the Rust, npm, Swift, and WebAssembly checks ran again with the same results, and the Android code compiled; the emulator runs were not repeated.cargo fmt --check,cargo clippy --all-targets -- -D warningsclifeature for the library and without SQLite for the phone cratecargo test(workspace)npm ci,typecheck,test)Databaseathcreates a file, the phone edits it,athchecks itThe details are in
release-evidence.md.Not tested
mobile-applejob runs it in the release check.mobile-appleandmobile-androidare invalidate.yml, which runs only insiderelease-cross-platform.yml. The new release commit step ran only as a dry run with a stand-in forgh. A full check of this branch without a release isgh workflow run release-cross-platform.yml --ref build/3.0.0-iphone-and-android-library -f publish=false.Found, not changed here
main.zip2.6.1 has two critical and two high alerts. Upgrading to 9.x needs three one-line changes and one test adjustment, and every other test passes; it belongs in its own pull request. Therustls,rustls-webpki, andlibsql-sqlite3-parseralerts come only throughlibsql0.10.0 inath-host, which is already the newest release.ath calculatewithout calendar grouping,--to 2026-10-31is compared as text, so readings during that day are left out. This is older than this branch, in both readers.training_impactcan be read two ways. "Did it change your training: full, reduced, or none?" does not say whetherfullmeans full training or a full change. Its values are described only by their stored names until that is settled.coaching_note,training_plan, andplanned_session; the code also allowsapproval,intensity_reference, andevent.How to review
Each commit is one logical step, so reading commit by commit works best:
a51201dthe plan and D325–D333f60a0b2the UniFFI crate, the Swift package, and the Android library, with record checks91a56eatheclifeature and in-process protocol operations653561afiles on phones:DatabaseandPickedDocument21f2f78calculations in the core, behind one reader interface76bb349theureqanduuidfeature fix9090e11calculations from the phone packagesd689dd3the test-only sign-in provider37d8d8cthe host client with browser sign-in6bc7f7cstaging, installing, the CI jobs, and the runnable examples0e416f0the tracked Android XML files2b27a1bscripts that followCARGO_TARGET_DIR5e8f67ba phone storage test that compares the backup's file name, so it passes on Windows36d3a74the phone library recorded as 3.1.0: thev3.1.0folder and D334320c5bfversion 3.1.0 and migration step 9c075431the host refresh test ends only its own person's sessions78b76c9the first 3.1.0 evidence825e444named types for the model's free-form JSON valuesa6d603ftyped records and calculation answers for Swift and Kotlin (D329 rewritten)cc3b475the Swift package served from this repository (D332 rewritten)e95e347descriptions for every phone library call, type, field, and casec1cc8e0app guides and starting-point examples463dfeethe release comment says whether the tag carries the Swift package1a31e37progress, the guides gate, and the evidence76f6e8ddescriptions for every record and result type, and the core denies missing documentation93b27bethe evidence names the rebased commits🤖 Generated with Claude Code