Skip to content

Mobile: add unit tests for the client_ffi conversion layer - #140

Open
katulevskiy wants to merge 3 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/625
Open

katulevskiy wants to merge 3 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/625

Conversation

@katulevskiy

Copy link
Copy Markdown
Owner

Upstream mirror

Source: zeronsh#625
Original author: @katulevskiy
Original revision: a25c3c826a2f5010a5bd97b73b8e275464ddd775

This PR is an isolated Contribution Manager pilot mirror. Its reviews, checks and merge state are separate from upstream. An empty [skip ci] commit suppresses automatic bulk CI; the code tree matches the imported upstream revision.


Summary

  • crates/mobile/src/client_ffi converts UniFFI types to and from zeron-client types and had no tests, so a swapped field or a missing enum arm would only show up on a device. This adds 51 offline unit tests.
  • Covered: ChatConfig/NewSession round trips and every sandbox level; every harness and effort id (exhaustive matches, so adding a proto variant breaks the build until it is handled); unknown harness or effort ids returning InvalidArgument while unknown model ids pass through; fallback catalog ids being accepted by the ChatConfig conversion; SendRequest, attachment bytes at and over the 24 MiB limit, the queue edit lease and ComposerState; old and newer engine catalog JSON decoding; SessionRow, WorkspaceSnapshot and event mapping.
  • Tests only. Each of the three production files gains one #[cfg(test)] mod tests; line.
  • Two behaviours are pinned that reviewers may want an opinion on: non-string model_options become strings when a ChatConfig round-trips through the phone (true becomes "true"), and fallback_models for an unknown harness returns the default harness's model list rather than an empty one.

katulevskiy and others added 2 commits September 28, 2026 21:07
client_ffi is the only place UniFFI types become zeron-client types, and it
had no tests, so a swapped field or a dropped enum arm surfaced only on a
device. Add 51 offline unit tests covering:

- ChatConfig / NewSession round trips, every sandbox level, and every
  harness and effort id (exhaustive matches force an update when proto
  grows a variant)
- unknown harness or reasoning ids returning InvalidArgument instead of
  panicking, and unknown model ids passing through
- picker catalog ids (fallback harnesses/models/levels) being accepted by
  the ChatConfig conversion
- SendRequest, attachment bytes at and over the 24 MB limit, queue edit
  lease, ComposerState (per-capability flags, queue gates, pending sends)
- old/new engine catalog JSON (missing or unknown fields) decoding into
  HarnessInfo / ModelInfo, and SessionRow/WorkspaceSnapshot/event mapping

Tests only; production files gain a `#[cfg(test)] mod tests;` line each.
@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added the review:needs-triage Managed by Contribution Manager label Oct 6, 2026
@contribution-manager-katulevskiy

contribution-manager-katulevskiy Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Contribution Manager

needs triage · medium risk · untriaged

Open review workspace · Revision 31ff8774

Next actions:

  • Direction decision needed
  • Scope, risk, and platform triage needed
  • Independent code review needed
  • Required check: core-tests (missing)

This summary is maintained by the review app. Decisions and test evidence are recorded in the workspace; the app does not merge PRs.

@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added cm:inbox Contribution Manager: waiting for triage and removed review:needs-triage Managed by Contribution Manager labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cm:inbox Contribution Manager: waiting for triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant