Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/rules/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ paths:
- Concurrency in `ci.yml`: a PR keeps its newest run, main pushes run one at a time and a newer pending run replaces the older, and each `release/**` commit and dispatch has its own group. `linux-packages.yml` runs only when called or dispatched, under its caller's concurrency.
- `nightly.yml` is the one schedule, at 19:17 UTC: every suite in full on main, with core's Arm64 SSH tunnel tests and `build-linux.yml` extended, then `linux-packages.yml` with the Flatpak repository (arm64 too on Sundays, the second cron line), and the Release Build job, which builds and packages the app and every registry plugin as a tag does, unsigned, on `xcode-27`, and `ai-models.yml`, which regenerates the AI model catalog from models.dev and pushes it to gh-pages as `ai/models-v1.json`. No tag waits for it. GitHub mails a red run to whoever last edited the schedule. A push to main that changes `core/crates/ai/ai-models.json` runs `ai-models.yml` too, which publishes that file as committed.
- macOS Tests runs the Unit and UI plans in full, with no shard, parallel, iteration or retry flag.
- `core.yml` runs the core on Windows x64 and Arm64 and on macOS, where the same job builds and tests the Swift bindings, and SQL Server's integrated login on Windows x64. The SSH tunnel tests through Windows' OpenSSH Server run on x64; Arm64, whose image installs the server in about 20 minutes, runs them nightly.
- `core.yml` runs the core on Windows x64 and Arm64 and on macOS, where the same job builds the macOS and iOS slices and tests the Swift bindings, and SQL Server's integrated login on Windows x64. iOS and Package Tests builds the Simulator's slice. The SSH tunnel tests through Windows' OpenSSH Server run on x64; Arm64, whose image installs the server in about 20 minutes, runs them nightly.
- A `v*` tag runs only `release.yml`, a `linux-v*` tag only `release-linux.yml`, a `windows-v*` tag only `release-windows.yml`. The last two also run by dispatch: `release-windows.yml` then publishes nothing (`windows/RELEASING.md`), and `release-linux.yml` publishes nothing with `dry-run` and otherwise uploads a packaging fix (`linux/docs/releasing.md`).
- `windows.yml`'s live job runs the interop tests against MySQL, SQL Server, ClickHouse, Cassandra, MongoDB and Redis on `windows-2025`, beside the x64 job (`windows/docs/decisions/0016-live-server-tests.md`).
- `windows-grid-gate.yml` runs only by dispatch: the Windows data grid's timing and behavior gate on `windows-2025` and `windows-11-arm`, whose numbers vary too much between hosted runners to gate a merge (`windows/docs/decisions/0003-data-grid-control.md`, Gate). `windows.yml` runs the grid's tests on every change.
Expand All @@ -47,7 +47,7 @@ paths:

- `scripts/ci/detect-changed-paths.sh [--base <sha>] [--head <rev>] <suite>` prints `true` or `false`. No base prints true; an all-zero base diffs from the merge base with `origin/main`.
- Suites: `macos`, `plugins`, `ios`, `oracle`, `hana`, `swiftlint`, `linux` (`linux/`, `core/` and the Cargo workspace files at the top; no Markdown but `linux/CHANGELOG.md`, `linux/docs/regression-tests.md` and `linux/data/`), `linux-docs`, `linux-deps` (Cargo manifests and lock, toolchain, `deny.toml`, the Flatpak manifests, the Debian build dependencies), `packages` (Cargo manifests and lock, toolchain, Meson files, `linux/build-aux/` but its tests, `po/LINGUAS`; no Markdown), `core` (`core/`, `Cargo.toml`, `Cargo.lock`, `rust-toolchain.toml`, the FFI Swift package and what builds it; no Markdown), `windows` (`windows/`, `core/`, `Cargo.toml`, `Cargo.lock` and `rust-toolchain.toml` at the top; no Markdown), `release` (what the Release Build job reads) and `shipped` (`release` without `.github/`; `version.py check` reads it, and `macos` and `ios` for a test job a tag's run left out).
- `macos`, `release` and `shipped` also watch the core the app links: `core/` but its drivers, its crates' `tests/` and its Markdown, the Cargo workspace files and `apple/scripts/build-core.sh`.
- `macos`, `ios`, `release` and `shipped` also watch the core the apps link: `core/` but its drivers, its crates' `tests/` and its Markdown, the Cargo workspace files and `apple/scripts/build-core.sh`.
- Every suite but `shipped` watches `ci.yml` and its own workflow. A path a suite newly reads joins its pattern in the same change.

## Runners
Expand Down
5 changes: 5 additions & 0 deletions .claude/rules/data-sync-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ paths:
- "apple/TableProMobile/TableProMobile/Helpers/*Persistence.swift"
- "apple/TableProMobile/TableProMobile/Helpers/LibraryFile.swift"
- "apple/TableProMobile/TableProMobile/Platform/PastedSSHKeyMigration.swift"
- "apple/TableProMobile/TableProMobile/Platform/ManagedAppConfiguration.swift"
- "apple/TableProMobile/TableProMobile/Account/**/*"
- "apple/Packages/TableProCore/Sources/TableProConnectionLibrary/LibraryFileRecords.swift"
- "apple/Packages/TableProCore/Sources/TableProSync/**/*"
- "apple/TablePro/Models/Connection/DatabaseConnection.swift"
Expand Down Expand Up @@ -175,6 +177,9 @@ This path holds user data. A silent wrong answer here looks exactly like an empt
| TablePro account: the device, the entitlement, the chosen server, a company server's license and entitlement keys | `Account/account.json` in Application Support, device-local, never synced | the core's `tablepro-account` through `AccountServices` |
| The account's refresh token: tablepro.app's in the item earlier builds read, each company server's in its own | Keychain `com.TablePro.account.refreshToken`, and one item per company server, device-only | the core through `KeychainHostSecrets` |
| The entitlement builds before the core kept, read once when `account.json` is missing so the update stays signed in | `Account/entitlement.jwt` in Application Support | the core (`legacy_entitlement_file`) |
| iOS: TablePro account, as on the Mac | `TableProMobile/Account/account.json` in Application Support, device-local, kept out of backups, never synced | the core's `tablepro-account` through `AccountModel` |
| iOS: the account's refresh tokens, named as on the Mac, and the device ID it registers, 32 random bytes made once | Keychain `com.TablePro.account.refreshToken` and one item per company server, `com.TablePro.account.deviceID`; this device only, after first unlock, in the app's own access group, not the widget's | the core through `KeychainHostSecrets`, `AccountDeviceID` |
| iOS: what an MDM sets for the app (core ADR 0055) | UserDefaults `com.apple.configuration.managed`, written only by the MDM | `ManagedAppConfiguration`, read by `OnboardingPreferences` and the account |
| A license key an older build stored, until the key exchange trades it for an account; the digest of one the server refused | Keychain `com.TablePro.license.key`, UserDefaults `com.TablePro.license.setAside` | `StoredLicenseKey` |
| Sidebar database and schema filters, recent tables | UserDefaults, device-local | `DatabaseTreeFilterStorage`, `RecentTablesStore` |
| History drawer state | UserDefaults, device-local | `HistoryPanelPreferencesStorage` |
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/fix-issue/references/platform-apple.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The macOS app and the iOS app, with everything they build from. Every profile ha
| `l10n` | none | strings, or plugin or package messages, changed. Passes only when every plugin and package string, and every string the last build of each app in the tree extracted, is in that app's catalog. Prints the `--add` command for each check that failed |
| `docs` | `[docs-checkout]`, default `tablepro-docs` beside the main checkout | AGENTS Every change 4 applies, or a menu, shortcut, driver list or docs.tablepro.app link changed |

- `build`, `plugins`, `test`, `uitest`, `abi` and `package TableProFFI` first build the core the app links, with `apple/scripts/build-core.sh` for this Mac's arch, when the tree has none or a file it is built from changed after it. A first build takes several minutes.
- `build`, `plugins`, `test`, `uitest`, `abi` and `package TableProFFI` first build the core the apps link, with `apple/scripts/build-core.sh` for this Mac's arch, and `ios` adds the Simulator's slice, when the tree has none, lacks that slice, or a file it is built from changed after it. A rebuild keeps the slices the last one had. A first build takes several minutes.
- Pick tests by the types you changed, not the test files you edited: `verify.sh` finds a type name in every test target of the tree.
- Extra review pass: the ABI pass when PluginKit changed.
- Test names, verdicts, the remedies `verify.sh` does not print, and red CI checks: `references/verification-apple.md`.
Expand Down
60 changes: 52 additions & 8 deletions .claude/skills/fix-issue/scripts/lib/platform-apple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -369,30 +369,73 @@ swiftlint_filtered_dirs() {

# ---------------------------------------------------------------------------- steps

# The macOS project links the core (apple/project.yml, TableProFFI), and SwiftPM refuses to resolve it before
# apple/scripts/build-core.sh has built its binary target. Rebuilt for this Mac's architecture when a file it is
# built from changed after the last build. Fails the step when the core does not build.
# Both Apple projects link the core (TableProFFI), and SwiftPM refuses to resolve it before
# apple/scripts/build-core.sh has built its binary target. Rebuilt when a file it is built from changed after the last
# build, or when it lacks the slice this step needs: this Mac's architecture, plus the Simulator's for an iOS step.
# A rebuild keeps every slice the last one had, since each build replaces the XCFramework. Fails the step when the core
# does not build.
ensure_core() {
local log="$1" built="$APPLE_ROOT/Packages/TableProFFI/Build/TableProFFIC.xcframework" changed code
local log="$1" needed="${2:-$(uname -m)}" built="$APPLE_ROOT/Packages/TableProFFI/Build/TableProFFIC.xcframework"
local changed code slices
slices="$(core_slices "$built")"
if [ -d "$built" ]; then
changed="$(cd "$REPO_ROOT" && find core Cargo.toml Cargo.lock rust-toolchain.toml apple/scripts/build-core.sh \
apple/scripts/lib/deployment-target.sh apple/scripts/lib/system-sqlite.sh \
-type f ! -name '*.md' -newer "$built" -print -quit 2> /dev/null)"
[ -z "$changed" ] && return 0
note "core: $changed changed after the last core build, so it is rebuilt first"
if [ -n "$changed" ]; then
note "core: $changed changed after the last core build, so it is rebuilt first"
elif core_has_slice "$slices" "$needed"; then
return 0
else
note "core: built without its $needed slice, so it is rebuilt first"
fi
else
note "core: not built in this tree, so it is built first"
fi
# One macOS slice only, since build-core.sh takes arm64, x86_64 or both: a universal one already covers either.
if ! core_has_slice "$slices" "$needed"; then
case "$needed" in
arm64 | x86_64 | both) slices="$(printf '%s\n' $slices | grep -vxE 'arm64|x86_64|both')" ;;
esac
slices="$(printf '%s\n' $slices "$needed")"
fi
slices="$(printf '%s\n' $slices | sort -u | tr '\n' ' ')"
require_tool cargo
echo "== apple/scripts/build-core.sh $(uname -m)" >> "$log"
nice -n 10 "$APPLE_ROOT/scripts/build-core.sh" "$(uname -m)" >> "$log" 2>&1
echo "== apple/scripts/build-core.sh $slices" >> "$log"
# shellcheck disable=SC2086
nice -n 10 "$APPLE_ROOT/scripts/build-core.sh" $slices >> "$log" 2>&1
code=$?
[ $code -eq 0 ] && return 0
STATUS=FAIL
note "the core did not build: $(grep -E '^error|FATAL|❌' "$log" 2> /dev/null | head -5)"
emit "$log" "$code"
}

# grep reads every line rather than quitting at a match, which would leave printf a SIGPIPE under pipefail.
core_has_slice() {
case "$2" in
arm64 | x86_64) printf '%s\n' $1 | grep -xE "$2|both" > /dev/null ;;
*) printf '%s\n' $1 | grep -x "$2" > /dev/null ;;
esac
}

# The build-core.sh slice names an XCFramework holds, read from its Info.plist.
core_slices() {
local plist="$1/Info.plist" ids
[ -f "$plist" ] || return 0
ids="$(plutil -extract AvailableLibraries json -o - "$plist" 2> /dev/null \
| python3 -c 'import json, sys; print("\n".join(l["LibraryIdentifier"] for l in json.load(sys.stdin)))' 2> /dev/null)"
printf '%s\n' "$ids" | while IFS= read -r id; do
case "$id" in
macos-arm64_x86_64) echo both ;;
macos-arm64) echo arm64 ;;
macos-x86_64) echo x86_64 ;;
ios-arm64) echo ios ;;
ios-arm64-simulator) echo ios-simulator ;;
esac
done
}

platform_parse() {
local stem="${1%.log}" filters="${1%.log}.filters"
[ -f "$filters" ] || filters=/dev/null
Expand Down Expand Up @@ -638,6 +681,7 @@ platform_step() {
if [ ! -d "$project" ]; then
"$APPLE_ROOT/scripts/generate-project.sh" ios >> "$log" 2>&1
fi
ensure_core "$log" ios-simulator
# CI names one simulator; this machine may not have it, so take the first available iPhone.
simulator="$(xcrun simctl list devices available 2> /dev/null \
| grep -m1 -oE 'iPhone[^(]*\([0-9A-F-]{36}\)' | grep -oE '[0-9A-F-]{36}')"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,11 @@ jobs:
# Each importer reads its app's files from this platform's own places.
- name: Importers from other apps
run: cargo test --locked --target "$TARGET" -p tablepro-foreign-import
# Release with fat LTO, without the engines (core/docs/decisions/0010-macos-on-the-core.md).
- name: Build the static library and its Swift bindings
# Release with fat LTO, without the engines (core/docs/decisions/0010-macos-on-the-core.md). The iOS slice proves
# the core builds for an iPhone at the iOS app's floor on the system SQLite; ios-tests.yml builds the Simulator's.
- name: Build the static libraries and their Swift bindings
if: ${{ !cancelled() && matrix.swift }}
run: apple/scripts/build-core.sh arm64
run: apple/scripts/build-core.sh arm64 ios
- name: Swift binding tests
if: ${{ !cancelled() && matrix.swift }}
run: swift test --package-path apple/Packages/TableProFFI
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/ios-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
ios:
name: iOS and Package Tests
runs-on: xcode-27
timeout-minutes: 50
# The core's release build takes part of it when its cache is cold.
timeout-minutes: 70
env:
DESTINATION: platform=iOS Simulator,name=iPhone 18 Pro
defaults:
Expand All @@ -38,6 +39,21 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: scripts/download-libs.sh

- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: "1.98"
targets: aarch64-apple-ios-sim

# Saved from main only, like core.yml's: a pull request's cache serves that pull request alone.
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: apple-core-ios-simulator
save-if: ${{ github.ref == 'refs/heads/main' }}

# The app links the core for the TablePro account, and SwiftPM resolves nothing until its binary target exists.
- name: Build the shared core
run: scripts/build-core.sh ios-simulator

- name: Generate the Xcode project
run: scripts/generate-project.sh ios

Expand Down
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ Phase 7 runs now as its own lane, ahead of [Order](#order) (D-06). The account s
- [ ] macOS
- [ ] iOS
- **T-09** iOS account: sign-in through `tablepro-account` via TableProFFI, the `tablepro-ios` OAuth client and the `ios` device platform
- [ ] server
- [ ] iOS
- [x] server
- [x] iOS
- **T-10** Records in the core (`tablepro-records`): kinds, record ids, field classes, the field merge and the CloudKit mapping, one set for both providers
- [ ] core
- **T-11** Keys in the core (`tablepro-keys`): the end-to-end crypto, with signed logs, envelopes and recovery
Expand Down
4 changes: 2 additions & 2 deletions apple/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Every capability is core, a module or a plugin. The first rule that fits decides
- `Plugins/`: drivers and import/export formats as `.tableplugin` bundles, plus `TableProPluginKit`. Bundled plugins are the `copy: { destination: plugins }` targets in `project.yml`; the app never offers a registry install or update over one.
- `Packages/`: `TableProCore` (both apps), `TableProMacCore` (macOS only, never in the iOS project), `TableProOracle`, `TableProEditor`, `TableProGrammars`. Edit PluginKit in `Plugins/TableProPluginKit/` only; `TableProCore` symlinks it. Never pass `SWIFT_VERSION=` to `xcodebuild`.
- `Native/`: Rust and Go bridges. `Libs/`: static libraries from `scripts/download-libs.sh`, not in git.
- `Packages/TableProFFI`: the shared Rust core (`core/`) as the module `TableProFFI`. `scripts/build-core.sh` builds its XCFramework and generates its Swift from the same library, neither in git; then `swift test --package-path Packages/TableProFFI`. The app links it for the TablePro account (`core/docs/decisions/0010-macos-on-the-core.md`, `0044-sync-through-one-service-run-by-us-or-on-premises.md`), so SwiftPM resolves nothing in the macOS project until it is built; `verify.sh build` and `test` build it when stale. On Apple targets the core links the system SQLite the app opens its own files with, and `build-core.sh` fails when it would bundle its own or call a function newer than the deployment target.
- `Packages/TableProFFI`: the shared Rust core (`core/`) as the module `TableProFFI`. `scripts/build-core.sh` builds its XCFramework and generates its Swift from the same library, neither in git; then `swift test --package-path Packages/TableProFFI`. Both apps link it for the TablePro account (`core/docs/decisions/0010-macos-on-the-core.md`, `0047-the-apple-apps-sign-in-through-the-core.md`), so SwiftPM resolves nothing in either project until it is built with that app's slice; `verify.sh build`, `test` and `ios` build it when stale. On Apple targets the core links the system SQLite the app opens its own files with, and `build-core.sh` fails when it would bundle its own or call a function newer than the deployment target. The account's adapter over the core lives in `TablePro/Core/Services/Account/Shared/`, which the iOS app compiles too.
- XcodeGen generates `TablePro.xcodeproj` and `TableProMobile/TableProMobile.xcodeproj`; never hand-edit them. Signing overrides go in `Configs/Secrets.xcconfig`.
- Architecture lives in `.claude/rules/`: `plugin-system.md`, `connection-window.md`, `editor.md`, `theme.md` and `data-sync-storage.md`.

Expand All @@ -38,7 +38,7 @@ From the repository root:

```bash
apple/scripts/download-libs.sh # first time, and after a libs update
apple/scripts/build-core.sh arm64 # first time, and after a core change; verify.sh does it when stale
apple/scripts/build-core.sh arm64 ios-simulator # first time, and after a core change; verify.sh does it when stale. ios for a device
apple/scripts/generate-project.sh [both|macos|ios] # after a project.yml or Configs/ edit, or a new, moved or deleted source file
.claude/skills/fix-issue/scripts/verify.sh build
.claude/skills/fix-issue/scripts/verify.sh test [<Suite>|<Suite>/<case>()|<Target>/<Suite>...] # none: the Unit plan
Expand Down
Loading
Loading