feat(ait): add production host bridge#102
Conversation
|
Warning Review limit reached
Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (36)
📝 WalkthroughWalkthroughThis 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. ChangesApps in Toss production host
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
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/target-ait/vite.config.ts (1)
37-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPreserve the parse error cause and reuse the shared ad-placement schema.
The barecatchdrops the underlying I/O/JSON failure, making a bad config harder to diagnose. There’s already a sharedAdPlacementsschema and validator inpackages/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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (35)
.sampo/changesets/ait-production-host.mdREADME.mdadapters/ait/package.jsonadapters/ait/src/host.test.tsadapters/ait/src/host.tsadapters/ait/src/index.tsadapters/ait/src/lifecycle.test.tsadapters/ait/src/lifecycle.tsapps/target-ait/README.mdapps/target-ait/package.jsonapps/target-ait/src/aitBridge.test.tsapps/target-ait/src/aitBridge.tsapps/target-ait/src/aitIdentity.test.tsapps/target-ait/src/aitIdentity.tsapps/target-ait/src/bridgeTypes.tsapps/target-ait/src/main.tsapps/target-ait/tsconfig.bundle.jsonapps/target-ait/tsconfig.test.jsonapps/target-ait/vite.config.tsexamples/phaser-starter/mpgd.targets.jsonpackages/cli/src/production-target-readiness.tspackages/cli/templates/phaser-game/README.mdpackages/cli/templates/phaser-game/mpgd.targets.jsonpackages/target-config/src/effective.tspackages/target-config/src/runtime.tspackages/target-config/targets.jsonpackages/target-config/test/target-config-smoke.tstools/graph/requests/bridge-contracts.jsontools/smoke/adapter-effective-config.tstools/smoke/effective-target-config.tstools/smoke/production-target-readiness.tstools/target/effective-config.tstools/target/platform-targets.tstools/target/schemas.tstsconfig.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
3442857 to
30f06b9
Compare
|
@codex review All prior findings were addressed on the refreshed head. Please re-review the current diff. |
|
@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. |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/target-ait/vite.config.ts (1)
7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport
extractAitAdBridgeConfigvia the package specifier, not a relative path.This file reaches into
adapters/ait/srcdirectly, while the template counterpart (packages/cli/templates/phaser-game/apps/target-ait/vite.config.ts) and this app's ownmain.tsimport the same adapter via@mpgd/adapter-ait/*package specifiers.apps/target-ait/package.jsonalready 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (55)
.sampo/changesets/ait-production-host.mdREADME.mdadapters/ait/package.jsonadapters/ait/src/ad-config.test.tsadapters/ait/src/ad-config.tsadapters/ait/src/host.test.tsadapters/ait/src/host.tsadapters/ait/src/index.tsadapters/ait/src/lifecycle.test.tsadapters/ait/src/lifecycle.tsadapters/ait/src/wrapper-url.test.tsadapters/ait/src/wrapper-url.tsadapters/ait/src/wrapper.tsapps/target-ait/README.mdapps/target-ait/granite.config.tsapps/target-ait/package.jsonapps/target-ait/src/aitBridge.test.tsapps/target-ait/src/aitBridge.tsapps/target-ait/src/aitIdentity.test.tsapps/target-ait/src/aitIdentity.tsapps/target-ait/src/bridgeTypes.tsapps/target-ait/src/main.tsapps/target-ait/tsconfig.bundle.jsonapps/target-ait/tsconfig.test.jsonapps/target-ait/vite.config.tsexamples/phaser-starter/mpgd.targets.jsonexamples/phaser-starter/vite.shared.tspackages/cli/src/production-target-readiness.tspackages/cli/templates/phaser-game/README.mdpackages/cli/templates/phaser-game/apps/target-ait/granite.config.tspackages/cli/templates/phaser-game/apps/target-ait/index.htmlpackages/cli/templates/phaser-game/apps/target-ait/package.jsonpackages/cli/templates/phaser-game/apps/target-ait/src/main.tspackages/cli/templates/phaser-game/apps/target-ait/src/styles.csspackages/cli/templates/phaser-game/apps/target-ait/tsconfig.jsonpackages/cli/templates/phaser-game/apps/target-ait/vite.config.tspackages/cli/templates/phaser-game/gitignorepackages/cli/templates/phaser-game/mpgd.targets.jsonpackages/cli/templates/phaser-game/package.jsonpackages/cli/templates/phaser-game/vite.shared.tspackages/target-config/src/effective.tspackages/target-config/src/runtime.tspackages/target-config/targets.jsonpackages/target-config/test/target-config-smoke.tspnpm-workspace.yamltools/graph/requests/bridge-contracts.jsontools/smoke/adapter-effective-config.tstools/smoke/effective-target-config.tstools/smoke/game-owned-catalog.tstools/smoke/production-target-readiness.tstools/target/effective-config.tstools/target/platform-targets.tstools/target/schemas.tstools/validate-starter-workflow.tstsconfig.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
30f06b9 to
392fa9a
Compare
|
@coderabbitai review The package-subpath consistency nit is fixed on the refreshed head, and the reference wrapper build and typecheck pass. |
|
✅ Action performedReview finished.
|
22e65ab to
6fe51d1
Compare
There was a problem hiding this comment.
💡 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".
6fe51d1 to
c9d050f
Compare
|
@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. |
|
@coderabbitai review Please re-review the refreshed head after the AIT host timeout, serialized load queue, metadata, local authority, and bridge parsing fixes. |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
adapters/ait/src/host.test.ts (1)
138-432: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the repeated load/show harness setup into a helper.
The
loadCallbacks/showCallbacks/markShowRegistered/showRegisteredboilerplate (and the matchingcreateAitHostBridge+dependencies.loadFullScreenAd/showFullScreenAdwiring) 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (36)
.sampo/changesets/ait-production-host.mdREADME.mdadapters/ait/package.jsonadapters/ait/src/ad-config.test.tsadapters/ait/src/ad-config.tsadapters/ait/src/host.test.tsadapters/ait/src/host.tsadapters/ait/src/wrapper-url.test.tsadapters/ait/src/wrapper-url.tsadapters/ait/src/wrapper.tsapps/target-ait/README.mdapps/target-ait/granite.config.tsapps/target-ait/package.jsonapps/target-ait/src/main.tsapps/target-ait/tsconfig.bundle.jsonapps/target-ait/vite.config.tsdocs/AGENTIC_GAME_WORKFLOW.mddocs/GAME_DEVELOPMENT.mdexamples/phaser-starter/vite.shared.tspackages/cli/templates/phaser-game/README.mdpackages/cli/templates/phaser-game/apps/target-ait/granite.config.tspackages/cli/templates/phaser-game/apps/target-ait/index.htmlpackages/cli/templates/phaser-game/apps/target-ait/package.jsonpackages/cli/templates/phaser-game/apps/target-ait/src/main.tspackages/cli/templates/phaser-game/apps/target-ait/src/styles.csspackages/cli/templates/phaser-game/apps/target-ait/tsconfig.jsonpackages/cli/templates/phaser-game/apps/target-ait/vite.config.tspackages/cli/templates/phaser-game/gitignorepackages/cli/templates/phaser-game/mpgd.targets.jsonpackages/cli/templates/phaser-game/package.jsonpackages/cli/templates/phaser-game/vite.shared.tspackages/target-config/targets.jsonpnpm-workspace.yamltools/smoke/game-owned-catalog.tstools/validate-starter-workflow.tstsconfig.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
c9d050f to
9d384f6
Compare
|
@codex review Final follow-up only hardens test spy cleanup; please confirm the refreshed head has no further issues. |
|
@coderabbitai review The console warning spy cleanup finding is fixed across all affected tests; please confirm no further review is required. |
🧩 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
doneLength of output: 16108
✅ Action performedReview finished.
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Verification
pnpm checkpnpm test:preparedSummary by CodeRabbit
apps/target-ait.authoritativeGameServicesto opt out of monetization and ads in effective configuration.