Skip to content

feat: typed command results, batch 4 (keyboard) — Phase 2#938

Merged
thymikee merged 1 commit into
mainfrom
refactor/phase2-typed-results-batch4
Jun 29, 2026
Merged

feat: typed command results, batch 4 (keyboard) — Phase 2#938
thymikee merged 1 commit into
mainfrom
refactor/phase2-typed-results-batch4

Conversation

@thymikee

Copy link
Copy Markdown
Member

What

Phase 2 (typed results) batch 4: wire keyboard into the CommandResultMap spine, grounded in src/core/dispatch.ts handleAndroidKeyboardCommand / handleIosKeyboardCommand.

Stacked on #937 (batch 3). Review/merge that first; this PR's base auto-retargets to main when it lands. The diff here is just the keyboard addition.

Shape

Modeled as a flat closed shapeplatform and action always present; the remaining keyboard-state / message fields appear per branch — rather than a five-way platform×action union. The per-branch field sets overlap heavily and the underlying Android keyboard-state types live in the platform layer (below the public contract), so a flat closed shape is the accurate, lower-risk migration. The previous mirror's Record index signature is dropped and the spurious | nulls removed (the handler never returns null for these).

Mechanics

  • New src/contracts/keyboard.ts (moved out of the open client-types.ts mirror); CommandResultMap gains keyboard; client method returns CommandResult<'keyboard'>.
  • Public export name KeyboardCommandResult preserved (re-exported via client-types.tsindex.ts) — no API break. The keyboardCliOutput formatter type-checks unchanged.
  • Parity test now pins all 13 migrated commands.

Verification

  • tsc --noEmit exit 0
  • oxfmt + oxlint --deny-warnings clean
  • fallow audit --base origin/main clean
  • vitest core/contracts/client/commands/system → 379 tests pass
  • Layering Guard grep empty

Remaining for Phase 2

This finishes the cleanly-closeable typed results. Left: (c) the mirror cleanup — wait/alert are genuinely open (wait also has an internal name-collision; alert's iOS path returns a generic Record), so their client methods become CommandRequestResult and the last hand-written result types are deleted from client-types.ts; and (b) the TypedError graft.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.4 MB 1.4 MB 0 B
JS gzip 450.7 kB 450.7 kB 0 B
npm tarball 553.9 kB 554.3 kB +368 B
npm unpacked 2.0 MB 2.0 MB +951 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.7 ms 27.4 ms +0.7 ms
CLI --help 47.2 ms 47.8 ms +0.6 ms

Top changed chunks: no changes in the largest emitted chunks.

Base automatically changed from refactor/phase2-typed-results-batch3 to main June 29, 2026 17:08
Wire `keyboard` into the CommandResultMap spine, grounded in the dispatch
handlers' literal returns (src/core/dispatch.ts handleAndroidKeyboardCommand /
handleIosKeyboardCommand).

Modeled as a flat closed shape (platform + action always present; the remaining
keyboard-state / message fields appear per branch) rather than a five-way
platform×action union — the per-branch field sets overlap heavily and the
underlying Android keyboard-state types live in the platform layer (below the
public contract). The Record index signature of the previous hand-written mirror
is dropped and the spurious `| null`s removed (the handler never returns null).

Moves from the open client-types.ts mirror into src/contracts/keyboard.ts, wired
through CommandResult<'keyboard'>; public export name preserved (re-exported via
client-types.ts -> index.ts), so no API break. Parity test pins all 13 migrated
commands.

Stacked on the batch 3 PR. Verified: tsc --noEmit, oxfmt + oxlint
--deny-warnings, fallow audit clean, Layering Guard empty, 379 tests across
core/contracts/client/commands/system pass.
@thymikee thymikee force-pushed the refactor/phase2-typed-results-batch4 branch from b8fef04 to 68351fd Compare June 29, 2026 17:10
@thymikee

Copy link
Copy Markdown
Member Author

Reviewed current head 68351fd. I did not find actionable code blockers: the new KeyboardCommandResult shape matches the Android and iOS keyboard dispatch returns, keeps the existing public export name, and the client now routes through CommandResult consistently with the typed-result migration. Static checks, integration, unit, coverage, fallow, layering, and three smoke jobs are green; one Smoke Tests job is still pending, so I am leaving this reviewed but not marking ready-for-human until that finishes.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Jun 29, 2026
@thymikee thymikee merged commit fca2eef into main Jun 29, 2026
21 checks passed
@thymikee thymikee deleted the refactor/phase2-typed-results-batch4 branch June 29, 2026 17:57
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-29 17:58 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant