Skip to content

feat(target-config): add adaptive game shell composition - #135

Merged
imjlk merged 6 commits into
mainfrom
codex/adaptive-game-shell
Aug 11, 2026
Merged

imjlk merged 6 commits into
mainfrom
codex/adaptive-game-shell

Conversation

@imjlk

@imjlk imjlk commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • add resolveTargetViewportComposition() to compute concrete safe-area-aware game and rail bounds
  • support side-rails, bottom-controls, and compact-portrait composition modes
  • add smoke coverage for 3:4 desktop, intermediate landscape fallback, compact portrait safe areas, and invalid aspect ratios
  • document the adaptive shell contract and add a minor @mpgd/target-config changeset

Why

Games such as Revolving Cards need a stable 3:4 playfield on wide desktop surfaces while remaining full portrait on phones. Keeping this geometry in target-config prevents each game from duplicating viewport breakpoints and preserves the existing container-measurement and safe-area model.

Impact

Consumers can opt into side rails on sufficiently wide landscape viewports. Narrow landscape and portrait layouts retain the full safe content bounds, and gameplay logic can remain independent of the selected shell mode.

Validation

  • pnpm --dir packages/target-config test
  • pnpm --dir packages/target-config check
  • pnpm graph:target-config
  • pnpm smoke:target-config:dist
  • git diff --check
  • downstream Revolving Cards unit tests, typecheck, production build, and responsive browser scenarios at 1280×720, 720×540, and 390×844

Summary by CodeRabbit

  • New Features

    • Added adaptive game-shell layouts that account for safe areas and screen orientation.
    • Supports 3:4 side rails, minimum rail widths, bottom-control fallbacks, and full-bleed compact portrait modes.
    • Added viewport geometry resolution for game, rail, and control-panel bounds.
  • Documentation

    • Documented layout modes, safe-area handling, aspect-ratio behavior, and CSS-pixel coordinates.
  • Bug Fixes

    • Added validation to reject invalid game aspect ratios.
    • Improved timeout handling for in-app purchase verification.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@imjlk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f59b1ca6-4aaf-40b8-9b52-c15cabe979e7

📥 Commits

Reviewing files that changed from the base of the PR and between 48d9309 and 056107b.

📒 Files selected for processing (3)
  • adapters/ait/src/host.test.ts
  • docs/GAME_DEVELOPMENT.md
  • packages/target-config/test/target-config-smoke.ts
📝 Walkthrough

Walkthrough

Adds safe-area-aware adaptive viewport composition. The resolver supports side rails, bottom controls, and compact portrait layouts. It validates game aspect ratios and includes documentation and smoke tests. The AIT host test types the IAP verifier input and validates a bounded timeout.

Changes

Adaptive viewport composition

Layer / File(s) Summary
Composition contracts and defaults
packages/target-config/src/viewport.ts
Adds public composition modes, input and result interfaces, and a 160-pixel default minimum rail width.
Adaptive composition resolution
packages/target-config/src/viewport.ts
Resolves game, rail, and control bounds from safe areas, orientation, aspect ratio, requested layout, and rail width. Rejects invalid game aspect ratios.
Composition validation and documentation
packages/target-config/test/target-config-smoke.ts, docs/GAME_DEVELOPMENT.md, .sampo/changesets/add-adaptive-game-shell.md
Adds coverage for side rails, bottom-control fallback, compact portrait bounds, and invalid aspect ratios. Documents the resolver and records the changeset.

AIT host test adjustment

Layer / File(s) Summary
IAP verifier test expectations
adapters/ait/src/host.test.ts
Types the mock verifier input and checks that the generated timeout is positive and does not exceed 25 seconds.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant resolveTargetViewportComposition
  participant ViewportGeometry
  Caller->>resolveTargetViewportComposition: Provide viewport and layout input
  resolveTargetViewportComposition->>ViewportGeometry: Evaluate safe area, aspect ratio, and rail constraints
  ViewportGeometry-->>resolveTargetViewportComposition: Return composed bounds
  resolveTargetViewportComposition-->>Caller: Return game, rail, and control bounds
Loading

Possibly related PRs

  • imjlk/mpgd-kit#33: Extends the same viewport module and smoke tests with related layout resolution behavior.
  • imjlk/mpgd-kit#123: Modifies the same viewport module, documentation, and tests with a distinct safe-area snapshot API.

Poem

A rabbit maps the safe-area ground,
And places rails with bounds around.
If rails are narrow, controls descend;
Portrait drawers neatly bend.
The timeout stays within its bound.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adaptive game shell composition in target-config.
Description check ✅ Passed The description explains the change, rationale, impact, and validation, but it does not use the template's Summary and Notes headings or checklist format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/adaptive-game-shell

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imjlk
imjlk marked this pull request as ready for review August 11, 2026 08:24

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/GAME_DEVELOPMENT.md`:
- Around line 202-211: Update the example around
resolveTargetViewportComposition and the mountLeftRail/mountRightRail calls to
branch on composition.mode === 'side-rails'. Mount both rails only in side-rails
mode; otherwise hide or unmount both rails, while always mounting
composition.gameBounds.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a6a008c-15c3-4f92-a21e-d2cf50d34643

📥 Commits

Reviewing files that changed from the base of the PR and between 48187e4 and b63512c.

📒 Files selected for processing (4)
  • .sampo/changesets/add-adaptive-game-shell.md
  • docs/GAME_DEVELOPMENT.md
  • packages/target-config/src/viewport.ts
  • packages/target-config/test/target-config-smoke.ts

Comment thread docs/GAME_DEVELOPMENT.md Resolved

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b63512cb2f

ℹ️ 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".

Comment thread packages/target-config/src/viewport.ts Resolved

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: c5cd1e7ca1

ℹ️ 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".

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

CI follow-up in d1c2c85: the AIT verifier deadline assertion now checks the production contract (0 < timeoutMs <= 25_000) instead of requiring an exact unconsumed budget. The AIT suite passed three consecutive runs (91/91 each), adapter typecheck passed, and the full CI-ordered build:packages + test:prepared workflow passed under the repository's mise Node 24.11.0.

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1c2c85b8f

ℹ️ 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".

Comment thread packages/target-config/src/viewport.ts Resolved
Comment thread packages/target-config/src/viewport.ts Resolved
@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

Review follow-up in 78f0e08: composition results are now a discriminated union, so mode === 'side-rails' narrows both rail bounds, and side rails are selected only when the requested game width itself fits the safe content. Added narrowing and 720×540 / 2:1 / zero-minimum-rail regression coverage. Target-config tests/typecheck, full package build, dist import smoke, formatting, graph inspection, and git diff --check pass.

@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78f0e0894c

ℹ️ 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".

Comment thread packages/target-config/src/viewport.ts Resolved
Comment thread packages/target-config/src/viewport.ts Resolved
@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

Review follow-up in 48d9309: side rails are now limited to expanded viewport classifications, and fractional minRailWidth values are validated without whole-pixel rounding. Added 899×400 medium-layout and 900×600 / 3:2 / 0.1px regressions. Target-config tests/typecheck, formatting, full package build, dist import smoke, and git diff --check pass.

@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 48d9309bb3

ℹ️ 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".

@imjlk

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@imjlk
imjlk force-pushed the codex/adaptive-game-shell branch from 48d9309 to 056107b Compare August 11, 2026 18:26

imjlk commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

Please re-review exact rebased head 056107b8e5dd71c82b9d00cf843f60d2efa074fe. Rebased onto #134 merge e7029d71; the single AIT test conflict preserved both the capability support-probe coverage and the verifier deadline undefined guard. pnpm check, target-config smoke, and all 61 AIT host tests pass.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

@imjlk I will review the rebased head 056107b8e5dd71c82b9d00cf843f60d2efa074fe, including the merged AIT test coverage.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 056107b8e5

ℹ️ 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".

@imjlk
imjlk merged commit 9b32a48 into main Aug 11, 2026
6 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Aug 11, 2026
@imjlk
imjlk deleted the codex/adaptive-game-shell branch October 27, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant