Skip to content

feat(ait): add production host bridge#102

Merged
imjlk merged 7 commits into
mainfrom
codex/ait-production-bridge
Jul 19, 2026
Merged

feat(ait): add production host bridge#102
imjlk merged 7 commits into
mainfrom
codex/ait-production-bridge

Conversation

@imjlk

@imjlk imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a reusable Apps in Toss production host backed by official anonymous identity, native Storage, sharing, Ads 2.0, lifecycle, and Game Center APIs
  • keep commerce fail-closed and gate IAP/ad grants behind an explicit authoritative game-services target flag
  • move the reference wrapper onto the shared adapter and forward game-owned ad placement configuration
  • add Sampo changesets, production readiness coverage, and adapter/runtime regression tests

Verification

  • pnpm check
  • pnpm test:prepared
  • adapter AIT: 3 files, 15 tests
  • target AIT production build
  • effective target config and production readiness smoke tests
  • OpenCodeReview run for every code commit; all findings addressed and final reviews clean

Summary by CodeRabbit

  • New Features
    • Apps in Toss AIT production-host bridge: game-scoped anonymous identity, native Storage persistence, Ads 2.0 callbacks, sharing, lifecycle pause/resume, and Game Center leaderboards. Phaser starters now own the AIT wrapper under apps/target-ait.
    • Added authoritativeGameServices to opt out of monetization and ads in effective configuration.
  • Bug Fixes
    • Rewarded Ads 2.0 now preloads before display; rewarded outcomes follow the native reward → dismissal sequence, and commerce/ads remain fail-closed until verified in-app handling.
    • Improved deep-link/share validation and storage load resilience.
  • Documentation
    • Updated README and starter templates for wrapper ownership and authority/fail-closed behavior.

@coderabbitai

coderabbitai Bot commented Jul 19, 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: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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

Run ID: 27fb769d-0b7f-475c-ae6e-2e49e1ceda7e

📥 Commits

Reviewing files that changed from the base of the PR and between c9d050f and 9d384f6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • .sampo/changesets/ait-production-host.md
  • README.md
  • adapters/ait/package.json
  • adapters/ait/src/ad-config.test.ts
  • adapters/ait/src/ad-config.ts
  • adapters/ait/src/host.test.ts
  • adapters/ait/src/host.ts
  • adapters/ait/src/wrapper-url.test.ts
  • adapters/ait/src/wrapper-url.ts
  • adapters/ait/src/wrapper.ts
  • apps/target-ait/README.md
  • apps/target-ait/granite.config.ts
  • apps/target-ait/package.json
  • apps/target-ait/src/main.ts
  • apps/target-ait/tsconfig.bundle.json
  • apps/target-ait/vite.config.ts
  • docs/AGENTIC_GAME_WORKFLOW.md
  • docs/GAME_DEVELOPMENT.md
  • examples/phaser-starter/vite.shared.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/apps/target-ait/granite.config.ts
  • packages/cli/templates/phaser-game/apps/target-ait/index.html
  • packages/cli/templates/phaser-game/apps/target-ait/package.json
  • packages/cli/templates/phaser-game/apps/target-ait/src/main.ts
  • packages/cli/templates/phaser-game/apps/target-ait/src/styles.css
  • packages/cli/templates/phaser-game/apps/target-ait/tsconfig.json
  • packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts
  • packages/cli/templates/phaser-game/gitignore
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • packages/cli/templates/phaser-game/package.json
  • packages/cli/templates/phaser-game/vite.shared.ts
  • packages/target-config/targets.json
  • pnpm-workspace.yaml
  • tools/smoke/game-owned-catalog.ts
  • tools/validate-starter-workflow.ts
  • tsconfig.base.json
📝 Walkthrough

Walkthrough

This change adds a reusable Apps in Toss host bridge, shared bundle wrapper, lifecycle and native service integrations, game-owned starter scaffolding, and configurable authoritative game-services behavior that disables IAP and ads when opted out.

Changes

Apps in Toss production host

Layer / File(s) Summary
AIT host bridge, ads, sharing, and storage
adapters/ait/src/host.ts, adapters/ait/src/ad-config.ts, adapters/ait/src/*.test.ts, adapters/ait/package.json
Adds bridge request handling for identity, storage, sharing, Ads 2.0, launch intents, and Game Center, with validation, preload coordination, reward evidence, and package exports.
Lifecycle, wrapper, and target integration
adapters/ait/src/lifecycle.*, adapters/ait/src/wrapper*, apps/target-ait/src/main.ts, apps/target-ait/vite.config.ts
Adds deduplicated lifecycle events and reusable game-bundle mounting, then wires the host bridge and extracted ad configuration into the target.
Authoritative game-services configuration
tools/target/*, packages/target-config/*, packages/cli/src/*, examples/phaser-starter/*, tools/smoke/*
Adds and validates authoritativeGameServices, disables IAP and ads when false, propagates effective availability, and updates smoke coverage.
Game-owned starter scaffolding
packages/cli/templates/phaser-game/apps/target-ait/*, packages/cli/templates/phaser-game/*, tools/validate-starter-workflow.ts
Adds the generated AIT app, Granite/Vite setup, devtools workflow, wrapper entrypoint, styles, ignore rules, and validation.
Documentation and release metadata
README.md, apps/target-ait/README.md, packages/cli/templates/phaser-game/README.md, .sampo/changesets/*
Documents native identity, storage, sharing, ads, evidence-based rewards, fail-closed commerce, and authority configuration.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GameTarget
  participant AitHostBridge
  participant AppsInTossSDK
  participant EffectiveConfig
  GameTarget->>AitHostBridge: Send bridge request
  AitHostBridge->>AppsInTossSDK: Invoke native service
  AppsInTossSDK-->>AitHostBridge: Return result or reward evidence
  AitHostBridge-->>GameTarget: Return bridge response
  GameTarget->>EffectiveConfig: Resolve authority setting
  EffectiveConfig-->>GameTarget: Expose or disable IAP and ads
Loading

Possibly related PRs

  • imjlk/mpgd-kit#37: Previous AIT identity-resolution flow transitioned into the new host bridge.
  • imjlk/mpgd-kit#38: Earlier AIT bridge identity and deep-link sharing behavior replaced by this adapter flow.
  • imjlk/mpgd-kit#46: Related production readiness handling for conditional gameServicesUrl validation.

Poem

A rabbit hops through Toss today,
Native services lead the way.
Ads bring proof, grants wait in line,
Storage keeps the state just fine.
When authority is set to no,
IAP and ads stay closed below.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Clear and specific; it accurately summarizes the main change of adding the AIT production host bridge.
Description check ✅ Passed Summary and verification details cover the main changes and tests, so the description is mostly complete despite a renamed Validation section and empty Notes.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ait-production-bridge

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.

@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: 90e73a14d1

ℹ️ 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 adapters/ait/src/host.ts Outdated
Comment thread packages/target-config/src/effective.ts
Comment thread adapters/ait/src/host.ts Outdated
Comment thread packages/target-config/targets.json

@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

🧹 Nitpick comments (1)
apps/target-ait/vite.config.ts (1)

37-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Preserve the parse error cause and reuse the shared ad-placement schema.
The bare catch drops the underlying I/O/JSON failure, making a bad config harder to diagnose. There’s already a shared AdPlacements schema and validator in packages/ad-placements/tools/validate-ad-placements.ts, so this hand-rolled shape check can drift.

♻️ Preserve error cause
   try {
     parsed = JSON.parse(readFileSync(path, 'utf8')) as unknown;
-  } catch {
-    throw new Error(`AIT ad placements file is unreadable or invalid JSON: ${path}`);
+  } catch (error) {
+    throw new Error(`AIT ad placements file is unreadable or invalid JSON: ${path}`, { cause: error });
   }
🤖 Prompt for 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.

In `@apps/target-ait/vite.config.ts` around lines 37 - 86, Update readAitAdConfig
to catch the original readFileSync/JSON.parse error and rethrow the existing
contextual error with that failure preserved as its cause. Replace the manual
isRecord/placements validation and entry checks with the shared AdPlacements
schema and validator from
packages/ad-placements/tools/validate-ad-placements.ts, while retaining the
existing AIT-specific filtering and returned adGroupIds/adPlacementTypes
mappings.
🤖 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 `@tools/smoke/adapter-effective-config.ts`:
- Around line 344-348: Update the enabledActionMethods expectation used by the
authoritativeBridge.methods assertion so it excludes the leading
runtime.getCapabilities entry, matching authoritativeBridge.methods.slice(1).
Preserve the existing enabled-action ordering and align this assertion with the
corresponding expectation in the earlier block.

---

Nitpick comments:
In `@apps/target-ait/vite.config.ts`:
- Around line 37-86: Update readAitAdConfig to catch the original
readFileSync/JSON.parse error and rethrow the existing contextual error with
that failure preserved as its cause. Replace the manual isRecord/placements
validation and entry checks with the shared AdPlacements schema and validator
from packages/ad-placements/tools/validate-ad-placements.ts, while retaining the
existing AIT-specific filtering and returned adGroupIds/adPlacementTypes
mappings.
🪄 Autofix (Beta)

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

Run ID: 23ed7480-acc8-4a25-8919-a06364acbf36

📥 Commits

Reviewing files that changed from the base of the PR and between 542f386 and 3442857.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (35)
  • .sampo/changesets/ait-production-host.md
  • README.md
  • adapters/ait/package.json
  • adapters/ait/src/host.test.ts
  • adapters/ait/src/host.ts
  • adapters/ait/src/index.ts
  • adapters/ait/src/lifecycle.test.ts
  • adapters/ait/src/lifecycle.ts
  • apps/target-ait/README.md
  • apps/target-ait/package.json
  • apps/target-ait/src/aitBridge.test.ts
  • apps/target-ait/src/aitBridge.ts
  • apps/target-ait/src/aitIdentity.test.ts
  • apps/target-ait/src/aitIdentity.ts
  • apps/target-ait/src/bridgeTypes.ts
  • apps/target-ait/src/main.ts
  • apps/target-ait/tsconfig.bundle.json
  • apps/target-ait/tsconfig.test.json
  • apps/target-ait/vite.config.ts
  • examples/phaser-starter/mpgd.targets.json
  • packages/cli/src/production-target-readiness.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • packages/target-config/src/effective.ts
  • packages/target-config/src/runtime.ts
  • packages/target-config/targets.json
  • packages/target-config/test/target-config-smoke.ts
  • tools/graph/requests/bridge-contracts.json
  • tools/smoke/adapter-effective-config.ts
  • tools/smoke/effective-target-config.ts
  • tools/smoke/production-target-readiness.ts
  • tools/target/effective-config.ts
  • tools/target/platform-targets.ts
  • tools/target/schemas.ts
  • tsconfig.base.json
💤 Files with no reviewable changes (5)
  • apps/target-ait/src/aitIdentity.test.ts
  • apps/target-ait/src/bridgeTypes.ts
  • apps/target-ait/src/aitBridge.test.ts
  • apps/target-ait/src/aitBridge.ts
  • apps/target-ait/src/aitIdentity.ts

Comment thread tools/smoke/adapter-effective-config.ts
@imjlk
imjlk force-pushed the codex/ait-production-bridge branch from 3442857 to 30f06b9 Compare July 19, 2026 19:42
@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@codex review

All prior findings were addressed on the refreshed head. Please re-review the current diff.

@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please re-review the refreshed head. The earlier adapter smoke finding was verified and withdrawn; the configuration parser and wrapper safety follow-ups are included.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

@imjlk: I’ll re-review the refreshed head, focusing on the configuration parsing and wrapper-safety follow-ups as well as regressions in the new host bridge.

✅ 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.

@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.

🧹 Nitpick comments (1)
apps/target-ait/vite.config.ts (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import extractAitAdBridgeConfig via the package specifier, not a relative path.

This file reaches into adapters/ait/src directly, while the template counterpart (packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts) and this app's own main.ts import the same adapter via @mpgd/adapter-ait/* package specifiers. apps/target-ait/package.json already depends on @mpgd/adapter-ait (workspace:*), so the package import is resolvable here too.

♻️ Proposed fix
-import { extractAitAdBridgeConfig } from '../../adapters/ait/src/ad-config';
+import { extractAitAdBridgeConfig } from '`@mpgd/adapter-ait/ad-config`';

Also applies to: 16-16

🤖 Prompt for 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.

In `@apps/target-ait/vite.config.ts` at line 7, Update the import of
extractAitAdBridgeConfig in vite.config.ts to use the `@mpgd/adapter-ait` package
specifier, matching the imports in the template counterpart and the app’s
main.ts; do not access adapters/ait/src through a relative path.
🤖 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.

Nitpick comments:
In `@apps/target-ait/vite.config.ts`:
- Line 7: Update the import of extractAitAdBridgeConfig in vite.config.ts to use
the `@mpgd/adapter-ait` package specifier, matching the imports in the template
counterpart and the app’s main.ts; do not access adapters/ait/src through a
relative path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dabd8c7e-ff7f-4345-9347-41d0d49c5b61

📥 Commits

Reviewing files that changed from the base of the PR and between 3442857 and 30f06b9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (55)
  • .sampo/changesets/ait-production-host.md
  • README.md
  • adapters/ait/package.json
  • adapters/ait/src/ad-config.test.ts
  • adapters/ait/src/ad-config.ts
  • adapters/ait/src/host.test.ts
  • adapters/ait/src/host.ts
  • adapters/ait/src/index.ts
  • adapters/ait/src/lifecycle.test.ts
  • adapters/ait/src/lifecycle.ts
  • adapters/ait/src/wrapper-url.test.ts
  • adapters/ait/src/wrapper-url.ts
  • adapters/ait/src/wrapper.ts
  • apps/target-ait/README.md
  • apps/target-ait/granite.config.ts
  • apps/target-ait/package.json
  • apps/target-ait/src/aitBridge.test.ts
  • apps/target-ait/src/aitBridge.ts
  • apps/target-ait/src/aitIdentity.test.ts
  • apps/target-ait/src/aitIdentity.ts
  • apps/target-ait/src/bridgeTypes.ts
  • apps/target-ait/src/main.ts
  • apps/target-ait/tsconfig.bundle.json
  • apps/target-ait/tsconfig.test.json
  • apps/target-ait/vite.config.ts
  • examples/phaser-starter/mpgd.targets.json
  • examples/phaser-starter/vite.shared.ts
  • packages/cli/src/production-target-readiness.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/apps/target-ait/granite.config.ts
  • packages/cli/templates/phaser-game/apps/target-ait/index.html
  • packages/cli/templates/phaser-game/apps/target-ait/package.json
  • packages/cli/templates/phaser-game/apps/target-ait/src/main.ts
  • packages/cli/templates/phaser-game/apps/target-ait/src/styles.css
  • packages/cli/templates/phaser-game/apps/target-ait/tsconfig.json
  • packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts
  • packages/cli/templates/phaser-game/gitignore
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • packages/cli/templates/phaser-game/package.json
  • packages/cli/templates/phaser-game/vite.shared.ts
  • packages/target-config/src/effective.ts
  • packages/target-config/src/runtime.ts
  • packages/target-config/targets.json
  • packages/target-config/test/target-config-smoke.ts
  • pnpm-workspace.yaml
  • tools/graph/requests/bridge-contracts.json
  • tools/smoke/adapter-effective-config.ts
  • tools/smoke/effective-target-config.ts
  • tools/smoke/game-owned-catalog.ts
  • tools/smoke/production-target-readiness.ts
  • tools/target/effective-config.ts
  • tools/target/platform-targets.ts
  • tools/target/schemas.ts
  • tools/validate-starter-workflow.ts
  • tsconfig.base.json
💤 Files with no reviewable changes (5)
  • apps/target-ait/src/bridgeTypes.ts
  • apps/target-ait/src/aitIdentity.ts
  • apps/target-ait/src/aitIdentity.test.ts
  • apps/target-ait/src/aitBridge.test.ts
  • apps/target-ait/src/aitBridge.ts
🚧 Files skipped from review as they are similar to previous changes (22)
  • examples/phaser-starter/mpgd.targets.json
  • apps/target-ait/tsconfig.bundle.json
  • packages/target-config/targets.json
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • tools/target/schemas.ts
  • packages/cli/src/production-target-readiness.ts
  • tools/graph/requests/bridge-contracts.json
  • apps/target-ait/tsconfig.test.json
  • adapters/ait/src/lifecycle.test.ts
  • packages/cli/templates/phaser-game/README.md
  • adapters/ait/src/lifecycle.ts
  • adapters/ait/src/index.ts
  • tools/target/effective-config.ts
  • tools/smoke/adapter-effective-config.ts
  • packages/target-config/src/effective.ts
  • .sampo/changesets/ait-production-host.md
  • packages/target-config/src/runtime.ts
  • tools/smoke/effective-target-config.ts
  • tools/target/platform-targets.ts
  • adapters/ait/src/host.test.ts
  • packages/target-config/test/target-config-smoke.ts
  • apps/target-ait/README.md

@imjlk
imjlk force-pushed the codex/ait-production-bridge branch from 30f06b9 to 392fa9a Compare July 19, 2026 19:55
@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

The package-subpath consistency nit is fixed on the refreshed head, and the reference wrapper build and typecheck pass.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

@imjlk: I’ll review the refreshed diff, including the package subpath wiring and wrapper integration.

✅ 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/ait-production-bridge branch 2 times, most recently from 22e65ab to 6fe51d1 Compare July 19, 2026 20:02

@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: 30f06b9c51

ℹ️ 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 adapters/ait/src/host.ts Outdated
Comment thread adapters/ait/src/host.ts Outdated
Comment thread adapters/ait/src/host.ts
Comment thread packages/cli/templates/phaser-game/mpgd.targets.json
Comment thread adapters/ait/src/host.ts Outdated
@imjlk
imjlk force-pushed the codex/ait-production-bridge branch from 6fe51d1 to c9d050f Compare July 19, 2026 22:54
@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@codex review Please re-review the refreshed AIT production host and game-owned wrapper head. All prior threads are addressed and local checks, full workspace tests, and incremental OCR review pass.

@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review Please re-review the refreshed head after the AIT host timeout, serialized load queue, metadata, local authority, and bridge parsing fixes.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

@imjlk: I’ll re-review the refreshed head, focusing on the AIT host timeout and serialized load queue fixes, effective metadata/local-authority behavior, and bridge parsing safety.

✅ 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.

@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

🧹 Nitpick comments (1)
adapters/ait/src/host.test.ts (1)

138-432: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated load/show harness setup into a helper.

The loadCallbacks/showCallbacks/markShowRegistered/showRegistered boilerplate (and the matching createAitHostBridge + dependencies.loadFullScreenAd/showFullScreenAd wiring) is duplicated near-verbatim across ~8 test cases in this range. A small factory (e.g. createFullScreenAdHarness()) returning the callbacks refs, the registered-promise, and pre-wired dependencies would cut a large amount of repetition and reduce the risk of the copies drifting apart over time.

Also applies to: 559-773

🤖 Prompt for 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.

In `@adapters/ait/src/host.test.ts` around lines 138 - 432, The full-screen ad
test setup is duplicated across multiple cases. Extract the shared load/show
callback references, showRegistered promise, and pre-wired
loadFullScreenAd/showFullScreenAd dependencies into a helper such as
createFullScreenAdHarness, then update the affected tests to reuse it while
preserving each test’s bridge-specific configuration and timing options.
🤖 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 `@adapters/ait/src/host.test.ts`:
- Around line 116-136: Wrap the assertions in the “treats a configured preload
as a no-op when Ads 2.0 is unsupported” test in a try/finally block, keeping
warning.mockRestore() in the finally clause. Preserve the existing request and
warning assertions while ensuring console.warn is restored even when an
assertion fails.

---

Nitpick comments:
In `@adapters/ait/src/host.test.ts`:
- Around line 138-432: The full-screen ad test setup is duplicated across
multiple cases. Extract the shared load/show callback references, showRegistered
promise, and pre-wired loadFullScreenAd/showFullScreenAd dependencies into a
helper such as createFullScreenAdHarness, then update the affected tests to
reuse it while preserving each test’s bridge-specific configuration and timing
options.
🪄 Autofix (Beta)

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

Run ID: 3be3fce6-d269-44ac-8473-31aba94ec1fb

📥 Commits

Reviewing files that changed from the base of the PR and between 30f06b9 and c9d050f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • .sampo/changesets/ait-production-host.md
  • README.md
  • adapters/ait/package.json
  • adapters/ait/src/ad-config.test.ts
  • adapters/ait/src/ad-config.ts
  • adapters/ait/src/host.test.ts
  • adapters/ait/src/host.ts
  • adapters/ait/src/wrapper-url.test.ts
  • adapters/ait/src/wrapper-url.ts
  • adapters/ait/src/wrapper.ts
  • apps/target-ait/README.md
  • apps/target-ait/granite.config.ts
  • apps/target-ait/package.json
  • apps/target-ait/src/main.ts
  • apps/target-ait/tsconfig.bundle.json
  • apps/target-ait/vite.config.ts
  • docs/AGENTIC_GAME_WORKFLOW.md
  • docs/GAME_DEVELOPMENT.md
  • examples/phaser-starter/vite.shared.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/apps/target-ait/granite.config.ts
  • packages/cli/templates/phaser-game/apps/target-ait/index.html
  • packages/cli/templates/phaser-game/apps/target-ait/package.json
  • packages/cli/templates/phaser-game/apps/target-ait/src/main.ts
  • packages/cli/templates/phaser-game/apps/target-ait/src/styles.css
  • packages/cli/templates/phaser-game/apps/target-ait/tsconfig.json
  • packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts
  • packages/cli/templates/phaser-game/gitignore
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • packages/cli/templates/phaser-game/package.json
  • packages/cli/templates/phaser-game/vite.shared.ts
  • packages/target-config/targets.json
  • pnpm-workspace.yaml
  • tools/smoke/game-owned-catalog.ts
  • tools/validate-starter-workflow.ts
  • tsconfig.base.json
🚧 Files skipped from review as they are similar to previous changes (28)
  • adapters/ait/src/ad-config.test.ts
  • packages/cli/templates/phaser-game/apps/target-ait/tsconfig.json
  • packages/cli/templates/phaser-game/apps/target-ait/index.html
  • packages/cli/templates/phaser-game/apps/target-ait/src/styles.css
  • pnpm-workspace.yaml
  • tsconfig.base.json
  • adapters/ait/src/ad-config.ts
  • packages/cli/templates/phaser-game/apps/target-ait/package.json
  • packages/target-config/targets.json
  • tools/smoke/game-owned-catalog.ts
  • adapters/ait/src/wrapper-url.test.ts
  • apps/target-ait/package.json
  • adapters/ait/package.json
  • packages/cli/templates/phaser-game/gitignore
  • packages/cli/templates/phaser-game/apps/target-ait/granite.config.ts
  • apps/target-ait/granite.config.ts
  • adapters/ait/src/wrapper-url.ts
  • packages/cli/templates/phaser-game/package.json
  • packages/cli/templates/phaser-game/vite.shared.ts
  • apps/target-ait/README.md
  • apps/target-ait/vite.config.ts
  • packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts
  • examples/phaser-starter/vite.shared.ts
  • packages/cli/templates/phaser-game/apps/target-ait/src/main.ts
  • tools/validate-starter-workflow.ts
  • .sampo/changesets/ait-production-host.md
  • apps/target-ait/src/main.ts
  • adapters/ait/src/host.ts

Comment thread adapters/ait/src/host.test.ts
@imjlk
imjlk force-pushed the codex/ait-production-bridge branch from c9d050f to 9d384f6 Compare July 19, 2026 23:11
@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@codex review Final follow-up only hardens test spy cleanup; please confirm the refreshed head has no further issues.

@imjlk

imjlk commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review The console warning spy cleanup finding is fixed across all affected tests; please confirm no further review is required.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Current PR diff summary ---'
git diff --stat HEAD^..HEAD || true
git diff --name-only HEAD^..HEAD || true

printf '%s\n' '--- Console warning spies and cleanup in adapter tests ---'
rg -n -C 5 '(console\.warn|spyOn\s*\(\s*console\s*,\s*["'\'']warn|restoreAllMocks|mockRestore\s*\()' \
  adapters/ait/src --glob '*test.ts' || true

printf '%s\n' '--- Test hook structure ---'
rg -n -C 3 '(beforeEach|afterEach|describe\s*\()' adapters/ait/src --glob '*test.ts' || true

printf '%s\n' '--- Changed test-file outlines ---'
for f in adapters/ait/src/host.test.ts adapters/ait/src/lifecycle.test.ts adapters/ait/src/ad-config.test.ts adapters/ait/src/wrapper-url.test.ts; do
  if [ -f "$f" ]; then
    echo "### $f"
    ast-grep outline "$f" --items all --type function --view compact || true
  fi
done

Length of output: 16108


@imjlk Confirmed: the console warning spy cleanup is now correct across all affected adapter tests. Each console.warn spy is restored in finally, and fake timers are likewise reset where used. I found no further issues in this follow-up review; no additional review work is required for this concern.

✅ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9d384f6472

ℹ️ 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 5c39d37 into main Jul 19, 2026
6 checks passed
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