fix(fold): make reported screen dimensions match their coordinate-space contract

Open
#2,729 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Read AGENTS.md, then inspect packages/contracts/src/fold-runtime.ts and packages/platform-apple/src/foldable/pose.ts, along with the owning response fixtures/schema and user docs/help. Run the focused contract tests and pnpm check:affected --run. Done means reported dimensions retain their native-panel values and discriminator, ambiguous panels still omit screen, and documentation no longer describes snapshot coordinates.

Written by the indexing model from the issue text.

Description

bug ready-for-agent

Part of #2725.

Decision: report native panel points, not an app viewport

Keep the already-released screen.display, screen.widthPt, and screen.heightPt fields and their numeric meaning. Add the required discriminator screen.coordinateSpace: "native-panel" whenever screen is present. These are the panel's native pixel dimensions divided by its point scale; do not rotate them. Explicitly state that they are not snapshot coordinates and cannot be used to place a tap. A caller needing the app viewport must take a fresh snapshot.

Example for the open Duo:

{"pose":"open","hingeAngleDegrees":180,"screen":{"display":"LCD-1","coordinateSpace":"native-panel","widthPt":669,"heightPt":951}}

Its active app window can be 951x669. That difference is expected and must be documented.

Evidence and rationale

git tag --contains e8da1e10d includes v0.21.8: fold metadata is released. Preserve the existing fields/values, add explicit meaning, and correct the false contract instead of adding aliases or breaking field names. PR #2724 and the native capture investigation in #2727 measure a 951x669 app window on the 669x951 native-point inner panel. currentOrientation describes the display and is not a sufficient app-orientation contract for a locked app. Choosing native geometry removes that inference entirely; no locked-app experiment is needed to justify these fields.

Fold remains independent of app identity and runner startup. Do not query XCTest or rotate native dimensions solely to fill this metadata.

Bounded implementation

  • Update packages/contracts/src/fold-runtime.ts, packages/platform-apple/src/foldable/pose.ts, owning response fixtures/schema where applicable, and user docs/help.
  • Set the literal discriminator at the report construction site. Remove every claim that these dimensions equal the next snapshot's viewport.
  • Do not alter pose control, display selection, snapshot geometry, or gestures.

Acceptance and validation

  • Closed native panel: 466x678; open/half-open inner panel: 669x951 for the existing measured fixture, all marked native-panel.
  • Changing fixture currentOrientation alone does not swap native dimensions.
  • Unresolved/ambiguous panel selection retains the existing omission of screen; never invent a viewport.
  • Cover the public fold response through its owning contract tests, run focused tests and pnpm check:affected --run, and record a local fold response on the PR head.

Ready for implementation on current main. No dependency on #2724 or #2728: their geometry evidence explains the bug, but this fix promises only native panel geometry. Follow AGENTS.md and keep one issue per PR.

Dominant language
TypeScript
Stars
4.7k
Forks
304
Avg merge
12h 42m
Merged PRs (30d)
463

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from callstack/agent-device

All issues in callstack/agent-device

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.