Repository navigation
Cross-platform parity contracts: shared fixtures, client conformance suites, and REST route inventories - #11632
Conversation
Shared platform-neutral vectors for the rules that keep drifting across app, macOS and Windows: task due-date bucketing (both live models pinned per case), local-day identity of a UTC instant, action item wire decode, and relative day labels including the DST transition days. README carries the conformance matrix and the divergence register. Verification: fixture integrity and day-key arithmetic are asserted by backend/tests/unit/test_parity_contracts.py in this PR; each platform suite runs the same vectors through its production code.
A naive datetime reaching ActionItemResponse serialized as an offsetless ISO string, the one wire form the first-party clients disagree on: Dart and JS decode it as local wall time while Swift ISO8601 decoding rejects it. Firestore timestamps are UTC, so the response model now stamps UTC on naive values before serialization. The new suite also validates the contracts/parity fixture set structurally and arithmetically so a malformed fixture cannot pass vacuously on every client, and proves the backend round-trips the parseable wire vectors while rejecting the junk forms the clients only tolerate defensively. Verification: tests/unit/test_parity_contracts.py fails 4 cases without the validator (offsetless emission reproduced) and passes 11/11 with it; 79 neighboring action item tests pass unchanged.
… spec Siblings of test_desktop_rest_inventory.py (macOS): every first-party client now has an inventory proving its hardcoded backend routes exist in the app-client OpenAPI spec, after BasedHardware#11613 shipped a desktop route with no spec entry and broke that guard for every open PR. Known gaps are seeded from the current live surfaces with the same follow-up notes the macOS list carries, and an anti-rot test forces entries out of the allowlist as soon as the spec catches up or the call site disappears. Verification: both suites pass locally; removing a KNOWN_MISSING entry reproduces the missing-route failure with the discovered route named.
Moves bucketOf and formatDue out of the Tasks page into lib/taskBuckets so the rules run against the shared contracts/parity fixtures, and corrects the extracted bucketOf comment: the fold-into-Today model matches macOS, not the Flutter app, which has a separate Overdue bucket (both models are pinned in the fixture). Two real fixes ride the extraction: formatDue computed Tomorrow and Yesterday as fixed 24h offsets, and the conversations sectionLabel did the same for Yesterday, so on the two DST transition days each year the relative label silently degraded to a dated one. Both now use calendar day arithmetic, the same hazard bucketOf's own comment already warned about. mapBackendItem is exported for the wire-decode conformance test. Verification: new parityContracts.test.ts (28 cases, DST cases execute on this US Pacific machine) and parityWire.test.ts (8 cases) pass; mutation check reintroducing the fixed-offset math fails exactly the 4 DST cases; typecheck:node + typecheck:web clean; full windows vitest suite run recorded in the PR body.
Moves the action items page's private bucketing method into task_categorization.dart as a pure injectable-now function, unchanged in behavior, so the app's separate-Overdue model (past-due bucket plus the 7-day aging rule for dateless tasks) is finally unit-testable. The page delegates to it. The new suite runs the shared contracts/parity vectors through the real production rules: categorizeTasks for buckets, conversationLocalDayKey (the BasedHardware#10198 contract) for local day keys with offset-keyed expectations, and GeneratedActionItemResponse.fromJson for the wire decode agreement set. Day-key cases execute only when the fixture covers the runner's zone offset; offset 0 is always present so UTC CI runs every case. Verification: no local Flutter SDK on this machine; the suite is CI-verified via app/test.sh discovery. The extraction is a pure move plus a now parameter defaulting to the wall clock.
str(relative_to()) emits backslash paths on Windows, so every budgeted AGENTS.md was reported as both new-without-budget and budgeted-but-gone and local preflight could not get past the check on a Windows machine. as_posix() keeps the comparison keys forward-slashed everywhere. Verification: the script now exits 0 on this Windows checkout (it failed with 12 phantom errors before); behavior on POSIX runners is unchanged because as_posix() is the identity there.
lib/firebase_options_dev.dart, lib/firebase_options_prod.dart and the ios/Config directories were removed in e81f1e8 but the guide still pointed at them, and the agent-doc-references check fails any PR that touches agent docs while the dead pointers remain. The block now lists only paths that exist: the android dev/prod source sets and the local emulator options file.
There was a problem hiding this comment.
1 issue found across 21 files
Confidence score: 4/5
- In
desktop/windows/src/renderer/src/lib/taskBuckets.ts, the memoized grouping only evaluatesDate.now()once, so if the Tasks page remains open past midnight,openGroupscan keep tasks in yesterday’s bucket and show stale categorization to users — add a day-boundary clock dependency so groups recompute when the date rolls over.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/windows/src/renderer/src/lib/taskBuckets.ts">
<violation number="1" location="desktop/windows/src/renderer/src/lib/taskBuckets.ts:30">
P2: When the Tasks page stays open across midnight, `openGroups` keeps yesterday’s bucket because `bucketOf` reads `Date.now()` only during the memoized computation. Add a day-boundary clock dependency to the grouping memo and pass that captured `now` to `bucketOf`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // TasksPage.swift). The Flutter app uses a different model (a fifth Overdue | ||
| // bucket plus a 7-day aging rule for dateless tasks); both models are pinned in | ||
| // contracts/parity/task_due_buckets.json until the platforms converge. | ||
| export function bucketOf(t: { dueAt: number | null }, now: number = Date.now()): Bucket { |
There was a problem hiding this comment.
P2: When the Tasks page stays open across midnight, openGroups keeps yesterday’s bucket because bucketOf reads Date.now() only during the memoized computation. Add a day-boundary clock dependency to the grouping memo and pass that captured now to bucketOf.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/windows/src/renderer/src/lib/taskBuckets.ts, line 30:
<comment>When the Tasks page stays open across midnight, `openGroups` keeps yesterday’s bucket because `bucketOf` reads `Date.now()` only during the memoized computation. Add a day-boundary clock dependency to the grouping memo and pass that captured `now` to `bucketOf`.</comment>
<file context>
@@ -0,0 +1,52 @@
+// TasksPage.swift). The Flutter app uses a different model (a fifth Overdue
+// bucket plus a 7-day aging rule for dateless tasks); both models are pinned in
+// contracts/parity/task_due_buckets.json until the platforms converge.
+export function bucketOf(t: { dueAt: number | null }, now: number = Date.now()): Bucket {
+ if (t.dueAt == null) return 'nodate'
+ const due = startOfDay(t.dueAt)
</file context>
There was a problem hiding this comment.
Fixed in a48be26. The page now keeps a dayStamp anchored at local midnight (a timer re-arms at each fire) and the grouping memo depends on it, passing dayStamp to bucketOf. That is equivalent to passing the wall clock because the rule only consumes startOfDay(now).
…ught The first CI run of the parity suite surfaced a real client divergence the fixture set had wrongly filed under the shared agreement set: a present-but-unparseable due_at makes the Dart generated wire reject the WHOLE item with a FormatException (its field reader treats a non-null field that reads to null as invalid), while the Windows sync mapper maps it to no-due-date and keeps the item. One corrupt timestamp in a list response breaks the app's decode path but not Windows sync. The two junk-due cases now carry expected_by_model (strict_decode versus tolerant_decode), the Dart adapter asserts the throw, the Windows adapter asserts the tolerant mapping, the backend suite asserts the backend sits on the strict side, and the README divergence register documents it as entry 4. Also aligns Dart formatting with CI: the formatter resolves the app's language version from its package config on CI (short style from the pubspec 3.0 lower bound), which a machine without a resolved package config cannot reproduce by default. Formatted with dart 3.12.2 and an explicit language version 3.0; verified idempotent with set-exit-if-changed. Verification: backend test_parity_contracts.py 11 passed; windows parityWire.test.ts 8 passed; dart format check exits 0 on all three touched Dart files.
…uses The formatting gate formats with the language version resolved from the app's package config (3.0 from the pubspec lower bound, the short style) because CI runs pub get first. A machine without a resolved package config silently falls back to the latest language version and produces the tall style for the same sources, so the local pre-commit hook kept rewriting these files into a form the gate rejects. Formatted with dart 3.12.2 (the flutter 3.44.5 bundled version) against a resolved package config; verified with set-exit-if-changed in the same mode CI runs.
kodjima33
left a comment
There was a problem hiding this comment.
Shared fixtures + client conformance suites are a good direction for cross-platform parity; approve-only since it's test/infra scope rather than a bug fix.
Seven review findings, all verified against the code before changing it:
- The Tasks page bucket grouping now re-anchors at each local midnight
(dayStamp state armed by a timer), so a page left open across midnight
no longer keeps yesterday's Today/Tomorrow split. bucketOf(t, dayStamp)
is equivalent to passing the wall clock because the rule only consumes
startOfDay(now).
- The response timestamp guard keys off utcoffset() is None instead of
tzinfo is None, covering tzinfo objects that return no offset; new
regression test with such a tzinfo.
- Both new route inventories now match spec paths segment-wise, where a
spec {param} segment matches any client segment exactly as the HTTP
router resolves paths. This removed three wrong-reason KNOWN_MISSING
entries (/v1/wrapped/2025 and /generate match /v1/wrapped/{year}...,
the google_calendar pair matches /v1/integrations/{provider}...), and
the anti-rot test is what surfaced the stale entries.
- The Windows inventory nonempty assertion is now a >= 20 in-scope floor
matching the macOS and Flutter siblings.
- The junk-form rejection test raises pydantic.ValidationError
specifically instead of a broad Exception.
- Two wire vectors added for negative (-07:00) and half-hour (+05:30)
offsets; both platform adapters consume them data-driven.
- README macOS pointers corrected to the real TasksPage.swift path under
Sources/MainWindow/Pages.
Verification: backend parity + both inventories 18 passed; windows
parityContracts + parityWire 38 passed; npm run typecheck clean; black
clean.
lib/localDay.ts is now the single home of the local-midnight rule; the
task bucketing and conversation filtering modules import or re-export
from it instead of carrying byte-identical copies. Two older copies
(lib/voice/taskCounts.ts and a component) predate this PR and stay for a
follow-up rather than widening the diff.
The Windows inventory gains the macOS sibling's out-of-scope rot guard,
which immediately caught three prefixes matching no extracted route
(/v2/agent, /v1/config/api-keys, /v2/messages/); removed. The Flutter
inventory needs no exclusions at all: its streaming surfaces use other
bases, and the REST routes that do appear (including
/v2/messages/{id}/report and /v2/files) are modeled in the spec, so the
former blanket copy of the desktop list was excluding real in-scope
routes.
Verification: backend parity + inventories 19 passed; windows parity,
wire and conversations suites 110 passed; typecheck and eslint clean on
the touched files.
… app-client spec regenerated 60 upstream commits, 117 files (+7357/-499). Auto-merge went cleanly — 0 conflicts. Audit (ADR-0030 / CLAUDE.md §6): - Deps unchanged (requirements.txt / pylock*.toml / Dockerfile untouched) — test image needs no rebuild. - Our abstraction layers UNTOUCHED by the merge: database/store/**, utils/auth|object_store|vector|push adapters, database/_client.py — the storage/auth/vector/object delta is preserved verbatim. - Fidelity (memory upstream-fidelity-delta-storage): the 16 backend non-test files upstream changed carry NO new raw-persistence patterns (no firestore.Client()/db_client construction, no new facade ops); the database/users.py change only moves an import inside a function to break the utils.subscription cycle; process_conversation.py is persistence-neutral (the "drop ungrounded memory candidate" product fix). - All 5 boundary guards exit 0 (persistence, model-read, auth, object-store, vector). - Store contract dual-backend: 126 passed (63 Mongo replSet + 63 Firestore emulator) on the merged tree. Two new upstream guards interact with our delta: - test_flutter_rest_inventory.py (BasedHardware#11632, new REST-inventory guard) flagged OUR /v1/users/unifiedpush-endpoint route (ADR-0041, added before this guard existed) as missing from the app-client OpenAPI spec. Fixed by regenerating docs/api-reference/app-client-openapi.json (scripts.export_openapi --surface app-client --write): the route has response_model=FcmTokenResponse and is a first-party app route, so it belongs in the spec. The regen also syncs the McpSseAuthMethodResponse schema with our cluster-B change (oauth2 made Optional, cf572c4) — the committed spec was stale for both. Public spec unaffected (not regenerated). - test_process_conversation_usage_context.py::test_app_summary_results_reach_the_database fails on the merged tree with the new grounding ValueError (process_conversation.py:956) — VERIFIED it fails IDENTICALLY on pure upstream/main (same code, same test, same image), so it is inherited-upstream, not our regression. Per upstream-fidelity we take the product test verbatim; recorded as a residual. Sweep tests/unit (file-isolated, -P 16): 905 pass. Remaining reds are all non-regressions: sys_modules_hermeticity + runtime_image_contracts (known residuals) + the inherited-upstream test above.
Summary
Omi ships the same product on Flutter, macOS, and Windows against one backend, and the recurring failure mode is a rule that gets fixed on one platform and silently diverges on another. This PR adds the shared guard surface for that class: a platform-neutral contract fixture set at
contracts/parity/that every client runs through its own production code, plus per-client REST route inventories so each first-party client is pinned to backend-owned OpenAPI authority the way macOS already is.Real instances this would have caught, from the merged history:
formatDueand the conversationssectionLabelcomputed Tomorrow and Yesterday as fixed 24h offsets, which degrade relative labels to dated ones on the two DST transition days each year. The neighboringbucketOfcomment already warned about exactly this hazard. Both fixed to calendar day arithmetic.ActionItemResponseserialized with no UTC offset, the one wire form the clients disagree on (Dart and JS decode it as local wall time, Swift ISO8601 decoding rejects it). The response model now stamps UTC on naive values, with a red-first regression test.What is in here
contracts/parity/fixtures + README: task due buckets (dual model), local day keys (offset-keyed expectations), action item wire decode agreement set, relative day labels including DST transition cases. Times are local calendar components so every platform evaluates them in its own zone with identical results.test_parity_contracts.pyvalidates the fixtures structurally and arithmetically (a malformed fixture cannot pass vacuously on every client at once), proves backend round-trip of the parseable wire vectors, rejects the junk forms clients only tolerate defensively, and pins the new naive-timestamp guard.bucketOf/formatDueextracted from the Tasks page intolib/taskBuckets.ts(behavior unchanged, comment corrected), DST fixes,mapBackendItemexported, and two conformance suites (28 + 8 cases).task_categorization.dartas a pure injectable-now function (behavior unchanged), and a conformance suite covering buckets,conversationLocalDayKey, and the generated wire decode.test_windows_rest_inventory.pyandtest_flutter_rest_inventory.py, siblings of the macOS one, with known gaps seeded from the current live surfaces (mirroring the macOS list's follow-up notes) and an anti-rot test that forces allowlist entries out as soon as the spec catches up.agent-doc-referencesfor any PR touching agent docs.Why a fixture set instead of per-platform tests: the failing pattern is cross-platform disagreement, not single-platform regression. A shared vector file makes a behavior change reviewable as a cross-platform decision, and the backend integrity test keeps the fixtures themselves honest.
Verification
python -m pytest tests/unit/test_parity_contracts.py tests/unit/test_windows_rest_inventory.py tests/unit/test_flutter_rest_inventory.py -qpasses 17/17. The naive-timestamp test failed 4 cases before the validator (offsetless emission reproduced) and passes with it. 79 neighboring action item tests pass unchanged.npm run typecheckclean on both configs. Mutation check: reintroducing the fixed-offset math fails exactly the 4 DST label cases; restoring the fix returns 28/28. DST cases executed locally on a US Pacific machine; they are counted skips on UTC CI and the non-DST cases always run.app/test.shand is CI-verified (the first CI run passed 1031 of 1033 parity-adjacent cases and the two failures were the genuine strict-decode divergence above, now pinned). Dart formatting was aligned with CI exactly: dart 3.12.2 (the flutter 3.44.5 bundled version) with an explicit language version 3.0, verified with set-exit-if-changed. The extraction is a pure move plus anowparameter defaulting to the wall clock.make preflight: 26 checks pass locally;desktop-backend-candidate-probe-fixturesfails only because the probe requiressignal.SIGALRM, which does not exist on Windows runners (untouched by this diff; passes on Linux CI).Product invariants affected: none
Notes for review
task_due_buckets.jsondual-model column is deliberate: it documents that the platforms disagree today rather than pretending one of them is authoritative. Whichever way product converges, the change is one fixture edit plus the losing platform's code.