Repository navigation
feat(apiv2): add the v2 contract harness, probe, and pilot operations [api-v2 phase 3] - #253
Conversation
Adds scripts/sync-apiv2-fixtures.sh, which copies only the fixtures the Apple pilot consumes (plus index entries and fixtures.schema.json) from a silo-server checkout and records the exact server commit in SOURCE. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Handwritten Codable models for the pilot operations, Problem and SystemInfo, decoded with the production HTTPClient decoder. Every string enum keeps an unknown case; APIv2ProfilePatch distinguishes omitted from JSON null. APIv2ContractTests decodes every vendored fixture. Co-Authored-By: Claude Fable 5.1 <[email protected]>
APIv2Probe GETs /api/v2/system/info once per connection and returns v2/updateServer/failure per the compatibility rule: only Go's plain "404 page not found" is update-server. ConnectionMonitor records the verdict as contractStatus; the Home overlay shows a pill and APIv2Client refuses pilot calls while it is set. ContinuumAPI.currentUser and updateProfile now go through APIv2Client with no v1 replay. Co-Authored-By: Claude Fable 5.1 <[email protected]>
AuthService.checkServer runs the contract probe, then reads /api/v2/system/setup; refreshActiveServerName re-probes. DownloadAPI gains listProgress on /api/v2/progress; pullProgressDeltas(since:) stays on v1 by design. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The server pilot branch gained schema examples, which changed the contract digest carried in get_system_info_ok.json. Re-run the sync script against that commit; SOURCE now pins 17380cbca59dff44d8e1454fd07ece37efc26afe. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e054a3e93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Quick104
left a comment
There was a problem hiding this comment.
Reviewed commit 0e054a3. Three correctness findings below. The contract-verdict and tvOS findings independently confirm the existing automated review; the onboarding quality mismatch is additional. Validation covered the complete PR diff, callers, fixtures, and companion server/Android changes. No Xcode builds or tests were run.
PR #251 renamed the continuum* theme tokens to silo*. The update-required pill added on this branch still referenced continuumOnSurface and continuumCaption, which broke the build after the apiv2 merge. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PR #251 renamed ContinuumAPI to SiloAPI. The no-v1-replay test on this branch still constructed ContinuumAPI, which failed to compile once the apiv2 branch was merged in. Co-Authored-By: Claude Fable 5.1 <[email protected]>
probeContract wrote every verdict into ConnectionMonitor unconditionally. checkServer probes a candidate before committing it, so a failed attempt to add a v1-only server marked the currently active v2 session as update-required and APIv2Client refused its pilot calls. A slow refreshActiveServerName probe could likewise overwrite a newer server's verdict, because its active-id guard ran only after the write. ConnectionMonitor now remembers which registry server id its verdict describes. noteContractProbe takes the probed server id and drops the result when that server is not active at record time; the verdict also switches off (isServerUpdateRequired == false) as soon as the active server no longer matches. APIv2Client gates on that scoped property. checkServer probes the candidate without recording, throws on .updateServer as before, and records the verdict only after the registry has added and switched to the candidate. refreshActiveServerName captures the active id before the probe and records against it, so a switch during the probe discards the stale verdict. Co-Authored-By: Claude Fable 5.1 <[email protected]>
ServerUpdateRequiredPill was only rendered in the non-tvOS Home branch. On Apple TV a v1-only server recorded .updateRequired and pilot calls were blocked with no visible explanation. tvOS has no offline pill to share a slot with, so the same pill is laid over the top of the Home content, driven by ConnectionMonitor.shared.isServerUpdateRequired with the same animation as the iOS branch. It does not take focus or hit testing. Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7777979b9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… verdict setupStatus(serverURL:) is an explicit-URL, unauthenticated probe of a setup candidate, but it called gate(), which reads the ACTIVE server's contract verdict. When the active saved server was update-required and the user tapped Add Server, checkServer probed the candidate successfully and then setupStatus threw before contacting it, so no updated server could ever be added from that state. Explicit-URL operations are not gated by the active session. The candidate's own contract probe, which checkServer runs first and which throws on .updateServer, is the gate for candidates. The gate stays on every relative-URL operation (currentUser, listProgress, updateProfile). Tests: the existing refusal test now exercises currentUser(), and a new test asserts setupStatus(serverURL:) still issues its request while the active verdict is update-required. Co-Authored-By: Claude Fable 5.1 <[email protected]>
ServerSetupViewModel.connect caught every candidate error and reported "Could not reach a Silo server at that address." A first-time user entering a v1-only server therefore saw a connectivity error instead of the update instruction. Because the candidate is not the active server, no verdict is recorded and the Home pill cannot appear, so the setup screen is the only place the message can be shown. connect now catches APIv2Error.serverUpdateRequired per candidate and shows APIv2Error.serverUpdateRequiredMessage, the same string the Home pill uses for its accessibility label. An update-required verdict from a candidate that answered wins over "could not reach" from the other scheme/port candidates. checkServer is injected through the initializer so the error handling can be tested without a network; the default still calls AuthService.shared. Tests: ServerSetupViewModelTests covers the update message, the precedence over unreachable candidates, and the unchanged generic message for a plain URLError. Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 423e3501ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The server pilot branch documented updateProfile's real statuses and media type (contract digest moved) and switched listProgress to keyset cursors, so list_progress_ok.json carries a new next_cursor and the contract test pins it. SOURCE now pins 74fe2b4ac97349167d1bb85892d7f0566bd43d49. The hosted-diagnostics lifecycle test stubbed the account fetch at the v1 path; the coordinator reads it over v2 since the pilot migration, so the stub and its expected request list follow (CI red on 423e350). Co-Authored-By: Claude Fable 5.1 <[email protected]>
isLegacyNotFound trimmed all surrounding whitespace, so a proxy answering " 404 page not found" read as a v1-only Silo server and produced the update-server verdict. Compare exactly, tolerating only the single trailing newline Go's http.NotFound writes. Reported by Codex on #253. Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 174c75d704
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Once ConnectionMonitor marked the active server update-required, the verdict was sticky for the process: the only probe is AuthService.refreshActiveServerName, which ContentView runs on server switch but not on foreground or reachability recovery. After an in-place server upgrade the pill stayed up and APIv2Client.gate() kept refusing until relaunch. Re-probe on the two edges that look like an upgrade: - Reachability: ConnectionMonitor.noteServerResponded fires a new onContractRecheckNeeded hook on the unreachable -> reachable edge when isServerUpdateRequired. A hook keeps Networking from depending on AuthService; ContentView installs it in onAppear. - Foreground: ContentView's scenePhase handler calls refreshActiveServerName when the scene becomes active while update-required, outside the iOS-only switch so tvOS gets it too. Neither edge changes the verdict; only a probe result does, and a failed probe still leaves the previous verdict in place. refreshActiveServerName keeps its server-identity checks. Tests: testV2VerdictAfterUpdateRequiredClearsForSameServer, testRecheckHookFiresOnceOnRecoveryWhileUpdateRequired, testRecheckHookStaysQuietWithoutUpdateRequired. Co-Authored-By: Claude Fable 5.1 <[email protected]>
sync-apiv2-fixtures.sh copied working-tree bytes but recorded `git rev-parse HEAD` in SOURCE, so a dirty server checkout produced a SOURCE whose commit could not reproduce the vendored fixtures. The script now refuses to run when `git status --porcelain` reports changes under the fixture directory or the schema (no --allow-dirty is offered on purpose), and reads every selected fixture, index.json, and the schema with `git show HEAD:<path>` so the bytes match the recorded commit even when the index differs from HEAD. jq filtering of index.json is unchanged. The usage comment and SOURCE trailer describe the rule. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The server pilot branch constrained the profile PIN schema (contract digest moved) and bound listProgress cursors to the viewer's access policy (list_progress_ok.json carries a new next_cursor, pinned in the contract test). SOURCE now pins c9e5a4e376f919a90e76aa8408892ba925d5661e. Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7191981125
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
UpdateProfileBody documents "" on the language members as "inherit". The v2
PATCH converter forwarded it as .set(""), but v2 reads "" as a value and
expresses "inherit" by clearing the member, so returning a profile to inherit
either left the old language in place or failed validation. Map "" to .clear
for subtitle_language and preferred_metadata_language.
Reported by Codex on #253.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4781b6bf3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
checkServer threw serverUpdateRequired before recording, which is right for
a setup candidate (its verdict must not touch the active session) but wrong
when the URL being rechecked is the active server itself ("Check again" on
the needs-setup screen): the previous .v2 or .unknown verdict stayed and
pilot calls kept hitting v2 endpoints. Record .updateServer for the active
server before rethrowing; candidates are still ignored.
Reported by Codex on #253.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df48cdcf17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The foreground handler and the unreachable-to-reachable hook can start overlapping refreshActiveServerName calls; both passed the server-id check, so an older v1-only probe completing after a newer v2 probe overwrote .v2 with .updateRequired. ConnectionMonitor now hands out a per-server probe generation and drops any completion that is not the latest for that server. Reported by Codex on #253. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Both needs-setup retry views (iOS and tvOS) caught serverUpdateRequired as a generic failure and showed "Couldn't reach the server." while the user was still on the setup screen, where the Home pill is not visible. Route the error through a shared message mapper that returns the update-required text. Reported by Codex on #253. Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b706c27d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
checkServer recorded through the overload that mints a generation at completion, so a "Check again" that overlapped a foreground or recovery refresh could declare itself newest when it finished and overwrite the genuinely newer verdict. Issue the generation before the probe and use it on both the update-required and the post-activation record paths. Reported by Codex on #253. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The server pilot branch paginated listAdminUsers, declared the statuses the listener really emits, relaxed the profile quality/subtitle enums, and bound listProgress cursors to the library-restriction flag (contract digest and list_progress_ok.json next_cursor moved). SOURCE now pins 7bd3af1430962a8b6662510caffe49e2954c4055. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Problem
The server's API v2 pilot (silo-server
[api-v2 phase 3], branchapi-v2/phase-3-pilot) publishes five operations with deterministic contract fixtures. The Apple client had no way to prove offline that its handwritten models decode that contract, no v2 discovery probe, and no explicit state for a server that only speaks v1.Solution
scripts/sync-apiv2-fixtures.sh <server checkout>vendors only the fixtures this client consumes (four pilot operations, the system-info probe body, the generic problem bodies; 14 files) plusfixtures.schema.jsonand a filteredindex.jsonintoiosApp/Tests/Fixtures/APIv2/, and writesSOURCEwith the exact server commit (17380cbca59dff44d8e1454fd07ece37efc26afe). The OpenAPI document is never vendored.Networking/APIv2/(new types, never the v1 structs) forgetSetupStatus,getCurrentUser,listProgress,updateProfile, plusProblemandSystemInfo, decoded with the productionHTTPClient.makeJSONDecoder().APIv2ContractTests,APIv2ProbeTests, 36 tests): every vendored fixture decodes with the production decoder; the fields each UI flow consumes are asserted with deliberate null/absence semantics; unknown object fields and unknown enum values are injected and decoding still succeeds with the unknown enum observable; the PATCH encoder distinguishes omitted from explicitnull; problem fixtures decode to the right type; no v1 URL literal exists in the v2 layer; a failed v2updateProfileis never retried against/api/v1.APIv2ProbeGETs/api/v2/system/infoonce per connection (AuthServiceconnect path andrefreshActiveServerName). Only the legacy listener's plain 404 maps to.updateServer; timeout, TLS failure, HTML with 200, malformed JSON, 401, 429, and 5xx each remain their own error.ConnectionMonitor.noteContractProberecords the verdict and the update-server case surfaces one user-visible message. No probe result enables a v1 path for a pilot operation.AuthServicesetup status,ContinuumAPIcurrent user and profile update, andDownloadAPIprogress listing use v2;pullProgressDeltas(since:)stays on v1 by design (that delta pull is a later server section).Non-pilot operations stay on v1 during the bridge, as the server contract specifies.
Validation
xcodegen generate;xcodebuild build(scheme Silo, iPhone 17 Pro simulator,CODE_SIGNING_ALLOWED=NO): BUILD SUCCEEDED.xcodebuild test -only-testing:SiloTests/APIv2ContractTests -only-testing:SiloTests/APIv2ProbeTestson the resynced fixtures: 36 tests, 0 failures.SiloTests: 1264 tests, 1 skipped, 3 failing tests (ProfileLaunchMigrationTests.testLegacyRegistryProfileMigratesBeforeProfileFieldIsRemoved,SettingValuesAPITests.testOrdinaryUnauthorizedResponseCannotRetryAfterProfileSwitch,SettingValuesAPITests.testScopedRefreshPersistsServerAccountRotationAcrossProfileChange). The same three fail identically on an untouched checkout of the base commitf6171e25; they are pre-existing and not touched here.make verify-apiv2-fixtures-siblingsagainst this branch reports the vendored copies current.Risks and follow-up
Companion PRs: Silo-Server/silo-server#941 (fixtures source), Silo-Server/silo-android#294.
Related issue: Silo-Server/silo-server#135
AI Disclosure
claude-fable-5-1[1m]) for orchestration, the implementer, and all review agents🤖 Generated with Claude Code