Skip to content

Support game-owned target release inputs - #36

Merged
imjlk merged 22 commits into
mainfrom
codex/target-config-node-esm
Jul 11, 2026
Merged

imjlk merged 22 commits into
mainfrom
codex/target-config-node-esm

Conversation

@imjlk

@imjlk imjlk commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • make target-config package dist imports Node ESM-compatible and add a built-package import smoke
  • let games own logical product/ad placement identifiers while keeping starter IDs as suggested literals
  • resolve game-owned catalog/ad placement files, app version, and source revision from the target config location for CLI target builds
  • harden release manifest merging so stale target entries reset when the release contract changes
  • minify Devvit server bundles and pass source revision into starter/template Vite defines

Validation

  • pnpm check
  • pnpm graph:preflight
  • pnpm test
  • pnpm build:web && pnpm smoke:target web-preview
  • pnpm build:ait && pnpm smoke:target ait
  • pnpm build:devvit && pnpm smoke:target reddit

Release

  • Added Sampo changesets for npm/@mpgd/platform, npm/@mpgd/target-config, and npm/@mpgd/cli.

Summary by CodeRabbit

  • New Features

    • Games can define custom product and ad placement identifiers while retaining starter identifiers.
    • Builds can use game-provided product catalogs and ad placement definitions.
    • Release metadata can capture the game version and source revision automatically.
  • Bug Fixes

    • CLI release inputs now consistently match workspace builds.
    • Release manifests reset correctly when monetization contracts change.
    • Improved Node ESM compatibility for target configuration packages.
  • Validation

    • Added stricter checks for blank, padded, or mismatched catalog and placement identifiers.

@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 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.

@coderabbitai

coderabbitai Bot commented Jul 10, 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: 19 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: c2292a6d-c16d-4bf6-ba3f-1d80f4ef2d71

📥 Commits

Reviewing files that changed from the base of the PR and between e8d26f8 and ff0e6c8.

📒 Files selected for processing (3)
  • examples/phaser-starter/vite.config.ts
  • packages/cli/templates/phaser-game/vite.config.ts
  • tools/smoke/game-owned-catalog.ts
📝 Walkthrough

Walkthrough

The PR adds game-owned catalog, ad-placement, version, and source-revision inputs; updates target builds and release manifests; enables ESM-compatible target-config output; broadens platform identifiers; and adds validation, smoke tests, and release changesets.

Changes

Release inputs and build compatibility

Layer / File(s) Summary
Extensible platform identifiers
packages/platform/src/*, .sampo/changesets/bright-game-owned-ids.md
Starter product and ad-placement literals remain available while custom string identifiers are accepted and type-checked.
ESM-compatible target-config distribution
packages/target-config/src/*, packages/target-config/test/dist-import.mjs, .sampo/changesets/calm-target-config-esm.md
Target-config imports and re-exports use explicit .js specifiers, with a built-distribution import smoke test.
Game-owned catalog resolution and validation
tools/catalog-paths.ts, tools/target/*, tools/validate-*.ts, tools/validate-public-readiness.ts, examples/phaser-starter/vite.config.ts, packages/cli/templates/phaser-game/vite.config.ts, tools/smoke/game-owned-catalog.ts, package.json
Environment overrides resolve catalog and placement files, Vite aliases use absolute paths, build validation propagates normalized values, and catalog identifiers reject blank or padded values.
Game-root release environment
packages/cli/src/index.ts, examples/phaser-starter/src/env.d.ts, packages/cli/templates/phaser-game/src/env.d.ts, tools/smoke/cli-game-release-inputs.ts, .sampo/changesets/steady-cli-game-release-inputs.md
The CLI derives release inputs from the target configuration’s game root, including monetization files, package version, and source Git SHA.
Release manifest contract and merge behavior
tools/target/generate-release-manifest.ts, tools/smoke/release-manifest-merge.ts
Manifest generation uses resolved catalog paths, supports source SHA overrides, and resets merges when any release contract field changes.
Devvit server build output
apps/target-devvit/vite.server.config.ts, packages/cli/templates/phaser-game/apps/target-devvit/vite.server.config.ts
SSR builds retain CommonJS index.cjs output while disabling code splitting; the template enables esbuild minification.

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

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI target command
  participant GameRoot as Game root
  participant Catalog as Catalog and placement files
  participant Git as Git repository
  participant Build as Target build
  CLI->>GameRoot: resolve target configuration directory
  GameRoot->>Catalog: locate game-owned monetization files
  GameRoot->>Git: resolve source revision when not overridden
  CLI-->>Build: pass catalog, placements, version, and source SHA
  Build->>Catalog: validate and embed effective target configuration
Loading

Possibly related PRs

  • imjlk/mpgd-kit#7: Both changes update CLI target-build environment resolution, including game-owned catalog, placement, version, and Git SHA inputs.
  • imjlk/mpgd-kit#9: Both changes modify Devvit Vite SSR build configuration and related game templates.

Poem

A rabbit hops where catalogs grow,
With custom IDs in rows below.
Git hops along, versions shine,
ESM paths resolve just fine.
Builds merge clean beneath moonlight—
Carrots applaud the release tonight!

🚥 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 The title clearly matches the main change: enabling game-owned release inputs.
Description check ✅ Passed The description matches the template well with Summary and Validation filled; Notes is missing but non-critical.
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/target-config-node-esm

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.

@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 (2)
packages/platform/src/index.test.ts (1)

3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding starter-literal satisfies checks for symmetry.

The test verifies game-owned arbitrary strings satisfy the broadened types, which is the key new contract. Adding equivalent checks for starter literals (e.g., 'COINS_100' satisfies LogicalProductId) would document that backward compatibility is intentional and guard against accidental narrowing in future refactors.

♻️ Optional: add starter-literal checks
 const gameOwnedProductId = 'SUDOKU_THEME_PACK' satisfies LogicalProductId;
 const gameOwnedAdPlacementId = 'SUDOKU_HINT_REWARDED' satisfies LogicalAdPlacementId;
+const starterProductId = 'COINS_100' satisfies LogicalProductId;
+const starterAdPlacementId = 'CONTINUE_AFTER_FAIL' satisfies LogicalAdPlacementId;
 
 void gameOwnedProductId;
 void gameOwnedAdPlacementId;
+void starterProductId;
+void starterAdPlacementId;
🤖 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 `@packages/platform/src/index.test.ts` around lines 3 - 7, Add starter-literal
compile-time checks alongside game-owned checks in the test, using literals such
as 'COINS_100' satisfies LogicalProductId and the corresponding starter ad
placement literal satisfies LogicalAdPlacementId; reference the existing
gameOwnedProductId and gameOwnedAdPlacementId declarations for symmetry, and
consume the new constants to avoid unused-variable errors.
tools/smoke/cli-game-release-inputs.ts (1)

91-110: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add a timeout to the spawnSync call.

Without a timeout, a hung CLI process will block the test indefinitely in CI. Adding timeout (e.g., 30s) ensures the test fails fast on hangs.

♻️ Proposed fix
   {
     cwd: process.cwd(),
     encoding: 'utf8',
     env,
+    timeout: 30_000,
   },
🤖 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 `@tools/smoke/cli-game-release-inputs.ts` around lines 91 - 110, Add a finite
timeout, such as 30 seconds, to the options object passed to the spawnSync call
in the CLI release-inputs test. Keep the existing cwd, encoding, and env
settings unchanged so hung CLI processes terminate and the test fails promptly.
🤖 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 `@packages/platform/src/index.test.ts`:
- Around line 3-7: Add starter-literal compile-time checks alongside game-owned
checks in the test, using literals such as 'COINS_100' satisfies
LogicalProductId and the corresponding starter ad placement literal satisfies
LogicalAdPlacementId; reference the existing gameOwnedProductId and
gameOwnedAdPlacementId declarations for symmetry, and consume the new constants
to avoid unused-variable errors.

In `@tools/smoke/cli-game-release-inputs.ts`:
- Around line 91-110: Add a finite timeout, such as 30 seconds, to the options
object passed to the spawnSync call in the CLI release-inputs test. Keep the
existing cwd, encoding, and env settings unchanged so hung CLI processes
terminate and the test fails promptly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 30acc61e-459c-49af-91b4-6b05226046c4

📥 Commits

Reviewing files that changed from the base of the PR and between 5147fc8 and baeba20.

📒 Files selected for processing (26)
  • .sampo/changesets/bright-game-owned-ids.md
  • .sampo/changesets/calm-target-config-esm.md
  • .sampo/changesets/steady-cli-game-release-inputs.md
  • apps/target-devvit/vite.server.config.ts
  • examples/phaser-starter/src/env.d.ts
  • examples/phaser-starter/vite.config.ts
  • package.json
  • packages/cli/src/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/vite.server.config.ts
  • packages/cli/templates/phaser-game/src/env.d.ts
  • packages/cli/templates/phaser-game/vite.config.ts
  • packages/platform/src/index.test.ts
  • packages/platform/src/index.ts
  • packages/target-config/src/effective.ts
  • packages/target-config/src/index.ts
  • packages/target-config/src/runtime.ts
  • packages/target-config/src/viewport.ts
  • packages/target-config/test/dist-import.mjs
  • tools/catalog-paths.ts
  • tools/smoke/cli-game-release-inputs.ts
  • tools/smoke/game-owned-catalog.ts
  • tools/smoke/release-manifest-merge.ts
  • tools/target/effective-config.ts
  • tools/target/generate-release-manifest.ts
  • tools/validate-ad-placements.ts
  • tools/validate-product-catalog.ts

@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: baeba20013

ℹ️ 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 tools/catalog-paths.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the current review feedback in 4a6a9f3:

  • added npm/@mpgd/catalog to the game-owned logical ID changeset
  • rejected half-configured MPGD_PRODUCT_CATALOG_FILE / MPGD_AD_PLACEMENTS_FILE in shared catalog path helpers
  • added smoke coverage for half-configured monetization env inputs
  • added starter literal compile-time checks for widened platform IDs
  • added a timeout to the CLI release-input smoke subprocess

Local validation after the patch:

  • pnpm smoke:game-config
  • pnpm smoke:cli-game-release-inputs
  • pnpm --dir packages/platform check
  • pnpm check
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the detailed update — I'll take a fresh look at the changes in 4a6a9f3, including the changeset addition for npm/@mpgd/catalog, the half-configured env var validation, the new smoke coverage, the starter literal compile-time checks, and the subprocess timeout for the CLI release-input smoke test.

✅ 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 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: 4a6a9f33fa

ℹ️ 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/platform/src/index.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex P2 feedback in d894aae:

  • reject blank/whitespace-only logical product ids in the product catalog validator
  • reject blank/whitespace-only logical ad placement ids in the ad placement validator
  • add game-owned catalog smoke coverage that exercises both validator failure paths through tools/run-ttsx.mjs

Local validation after the patch:

  • pnpm smoke:game-config
  • pnpm check
  • pnpm graph:preflight

@codex review

@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: d894aae633

ℹ️ 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 tools/target/effective-config.ts Resolved
Comment thread tools/validate-product-catalog.ts Resolved
Comment thread tools/validate-product-catalog.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex P2 round in a76e703:

  • wire the Phaser starter and generated template Vite builds to alias @mpgd/catalog/catalog.json / placements.json to game-owned catalog files when the build env provides them
  • keep public-readiness catalog/effective-config checks pinned to package catalogs instead of shell game catalog overrides
  • reject padded logical product/ad placement ids, not just all-whitespace ids
  • extend smoke:game-config coverage for padded ids, public-readiness env isolation, and Vite catalog alias mapping

Local validation after the patch:

  • pnpm validate:catalog
  • pnpm validate:ads
  • pnpm smoke:game-config
  • pnpm validate:public
  • pnpm check
  • pnpm graph:preflight
  • pnpm build:web
  • pnpm smoke:target web-preview

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll review the changes in a76e703, including the Vite catalog aliasing for game-owned files, the public-readiness pinning to package catalogs, the padded ID rejection, and the expanded smoke:game-config coverage.

✅ 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 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: a76e703c9e

ℹ️ 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 examples/phaser-starter/vite.config.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Fixed the CI-only failure from the previous push in a058802:

  • removed the full validate-public-readiness invocation from smoke:game-config, because pnpm test runs it after build:packages has intentionally produced generated source artifacts
  • kept the public-readiness env isolation fix in tools/validate-public-readiness.ts, where it is still covered by pnpm check before package build

Local validation after the CI fix:

  • pnpm smoke:game-config
  • pnpm check
  • pnpm test
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in a058802, including the removal of the full validate-public-readiness invocation from smoke:game-config and confirming the public-readiness env isolation fix remains covered by pnpm check prior to the package build.

✅ 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 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex relative-path feedback in ca634b0:

  • normalize MPGD_PRODUCT_CATALOG_FILE / MPGD_AD_PLACEMENTS_FILE to absolute paths in target builds before invoking Vite
  • resolve Vite catalog aliases against INIT_CWD so direct pnpm --dir builds interpret relative catalog env paths from the caller cwd
  • extend smoke:game-config to verify relative catalog env aliases resolve to the intended absolute game-owned files

Local validation after the patch:

  • pnpm smoke:game-config
  • pnpm check
  • MPGD_PRODUCT_CATALOG_FILE=packages/catalog/catalog.json MPGD_AD_PLACEMENTS_FILE=packages/catalog/placements.json pnpm build:web
  • pnpm smoke:target web-preview
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in ca634b0, including the absolute-path normalization for MPGD_PRODUCT_CATALOG_FILE/MPGD_AD_PLACEMENTS_FILE before invoking Vite, the INIT_CWD-relative alias resolution for direct pnpm --dir builds, and the extended smoke:game-config coverage for relative catalog env aliases.

✅ 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 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: ca634b03d3

ℹ️ 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 tools/target/build-target.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex target catalog env-base feedback in b6fbaa3:

  • centralize target catalog env normalization in tools/target/monetization-catalog-env.ts
  • resolve relative catalog env paths against the first valid caller/config base (INIT_CWD, PWD, platform targets-file base, then cwd)
  • pass the normalized catalog env through target preflight, Vite builds, release manifest generation, and embedded effective-config generation
  • keep direct Phaser starter/template Vite aliases aware of PWD for pnpm --dir flows
  • extend game-owned catalog smoke coverage for PWD and targets-base resolution

Local validation after the patch:

  • pnpm smoke:game-config
  • external pnpm --dir <kit> build:web with a temp targets file and relative catalog env paths
  • pnpm check
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in b6fbaa3, including the centralized catalog env normalization in tools/target/monetization-catalog-env.ts, the caller/config base resolution order (INIT_CWD, PWD, platform targets-file base, then cwd), the wiring through target preflight, Vite builds, release manifest generation, and embedded effective-config generation, the PWD-aware Phaser starter/template Vite aliases, and the extended smoke coverage for PWD and targets-base resolution.

✅ 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)
tools/target/monetization-catalog-env.ts (1)

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

Duplicated contract with tools/catalog-paths.ts.

readConfiguredEnvPath (Lines 34-37) and the "configured together" validation (Lines 11-15) reproduce readConfiguredPath and the exact error message already defined in monetizationCatalogFilePaths (tools/catalog-paths.ts:17-37). Two sources of truth for the same env contract can silently diverge, and the message string is asserted verbatim by tools/smoke/game-owned-catalog.ts. Consider importing/reusing the shared helper and message so the paired-config contract stays in one place.

🤖 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 `@tools/target/monetization-catalog-env.ts` around lines 11 - 37, The
monetization environment parsing duplicates the paired-file contract already
centralized in monetizationCatalogFilePaths from tools/catalog-paths.ts.
Refactor the relevant function to reuse the shared readConfiguredPath helper and
paired-configuration validation/error message, removing readConfiguredEnvPath
and the local duplicate check while preserving the existing resolved environment
output.
🤖 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/target/monetization-catalog-env.ts`:
- Around line 45-64: Update the candidate ordering in the path-resolution logic
around configuredFileExists so configBaseDir/fallbackBaseDir is checked before
INIT_CWD and PWD, ensuring game-owned monetization files take precedence. Apply
the same precedence to the fallback return expression, and add a smoke test
covering conflicting relative catalog and ad-placement files across bases.

---

Nitpick comments:
In `@tools/target/monetization-catalog-env.ts`:
- Around line 11-37: The monetization environment parsing duplicates the
paired-file contract already centralized in monetizationCatalogFilePaths from
tools/catalog-paths.ts. Refactor the relevant function to reuse the shared
readConfiguredPath helper and paired-configuration validation/error message,
removing readConfiguredEnvPath and the local duplicate check while preserving
the existing resolved environment output.
🪄 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: 7f68bfba-e3c6-4a3f-b9ae-eb58b0812265

📥 Commits

Reviewing files that changed from the base of the PR and between a76e703 and b6fbaa3.

📒 Files selected for processing (5)
  • examples/phaser-starter/vite.config.ts
  • packages/cli/templates/phaser-game/vite.config.ts
  • tools/smoke/game-owned-catalog.ts
  • tools/target/build-target.ts
  • tools/target/monetization-catalog-env.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/cli/templates/phaser-game/vite.config.ts
  • examples/phaser-starter/vite.config.ts
  • tools/smoke/game-owned-catalog.ts

@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: b6fbaa3de1

ℹ️ 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 Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest CodeRabbit/Codex follow-up feedback in 3eff5e9:

  • target catalog env normalization now prefers the platform targets-file base before caller env bases when relative files exist in multiple places
  • Phaser starter/template Vite aliases now probe INIT_CWD, PWD, then process.cwd() and use the first base where both catalog files exist
  • game-owned catalog smoke now covers both the conflicting target-base-vs-PWD case and the INIT_CWD miss / PWD hit Vite alias case

Local validation after the patch:

  • pnpm smoke:game-config
  • external pnpm --dir <kit> build:web with a temp targets file and relative catalog env paths
  • pnpm check
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in 3eff5e9, including the target-file-base-first normalization order for target catalog env resolution, the INIT_CWD → PWD → process.cwd() probing order for the Phaser starter/template Vite aliases, and the new smoke coverage for the conflicting target-base-vs-PWD case and the INIT_CWD miss / PWD hit alias case.

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

✅ 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 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the remaining CodeRabbit catalog-env parsing nitpick in bfdd43f:

  • added configuredMonetizationCatalogFilePaths() in tools/catalog-paths.ts so the paired catalog/ad-placement env contract stays in one shared place
  • exported/reused readConfiguredPath() for caller-base env trimming
  • updated target catalog env normalization to reuse the shared configured-file parser while preserving its resolved absolute env output

Local validation after the patch:

  • pnpm smoke:game-config
  • external pnpm --dir <kit> build:web with a temp targets file and relative catalog env paths
  • pnpm check
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in bfdd43f, including the new configuredMonetizationCatalogFilePaths() helper in tools/catalog-paths.ts, the exported/reused readConfiguredPath() for caller-base env trimming, and the updated target catalog env normalization that now reuses the shared configured-file parser while preserving its resolved absolute env output.

✅ 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 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: bfdd43f93f

ℹ️ 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/cli/src/index.ts Resolved
@imjlk

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex P2 review round in 45ddd9a:

  • added npm/@mpgd/game-services to the game-owned logical ID changeset so service client/backend API inputs release with the widened platform/catalog ID types
  • trim explicit MPGD_PRODUCT_CATALOG_FILE / MPGD_AD_PLACEMENTS_FILE values in the CLI before resolving them against the game root
  • extend smoke:cli-game-release-inputs to cover padded explicit relative env values and whitespace-only fallback to auto-detected game-owned files

Local validation after the patch:

  • pnpm smoke:cli-game-release-inputs
  • pnpm check
  • pnpm graph:preflight

@coderabbitai review
@codex review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a fresh look at the changes in 45ddd9a, including the npm/@mpgd/game-services addition to the game-owned logical ID changeset, the trimming of explicit MPGD_PRODUCT_CATALOG_FILE/MPGD_AD_PLACEMENTS_FILE values before resolving them against the game root, and the extended smoke:cli-game-release-inputs coverage for padded relative env values and whitespace-only fallback.

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

Reviewed commit: 45ddd9adb4

ℹ️ 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 force-pushed the codex/target-config-node-esm branch from 45ddd9a to e8d26f8 Compare July 11, 2026 02:16

@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 (3)
examples/phaser-starter/vite.config.ts (1)

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

Catalog path helpers duplicated from tools/catalog-paths.ts

readConfiguredPath (lines 66–68) is an exact duplicate of tools/catalog-paths.ts:45–48, and the paired-configuration enforcement in createCatalogAliases (lines 50–54) mirrors configuredMonetizationCatalogFilePaths. The template at packages/cli/templates/phaser-game/vite.config.ts carries the same copies. Consider importing readConfiguredPath and configuredMonetizationCatalogFilePaths from tools/catalog-paths.ts in the example starter to avoid drift. The template may need to remain self-contained, but the monorepo's own configs should use the shared helpers as the single source of truth.

🤖 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 `@examples/phaser-starter/vite.config.ts` around lines 45 - 68, Replace the
duplicated path normalization and paired-configuration logic in
createCatalogAliases with the shared readConfiguredPath and
configuredMonetizationCatalogFilePaths helpers from tools/catalog-paths.ts, then
build the aliases from their returned paths while preserving existing behavior.
Apply this shared-helper usage to the monorepo example starter; the
self-contained Phaser template may retain local implementations.
tools/smoke/game-owned-catalog.ts (1)

303-336: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add subprocess timeout to runValidator and assertValidatorFailure for consistency.

The CLI release-input smoke test (cli-game-release-inputs.ts) includes a 30-second timeout on its spawnSync call, but runValidator and assertValidatorFailure do not. A hung validator subprocess will stall the smoke test indefinitely until CI times out.

♻️ Proposed fix
 function runValidator(script: string): string {
   const result = spawnSync(process.execPath, ['tools/run-ttsx.mjs', script], {
     cwd: process.cwd(),
     encoding: 'utf8',
     env: process.env,
+    timeout: 30_000,
   });
 
   if (result.error !== undefined) {
     throw result.error;
   }
 
   assert.equal(result.status, 0, result.stderr || result.stdout);
   return result.stdout;
 }
 
 function assertValidatorFailure(
   script: string,
   env: NodeJS.ProcessEnv,
   pattern: RegExp,
 ): void {
   const result = spawnSync(process.execPath, ['tools/run-ttsx.mjs', script], {
     cwd: process.cwd(),
     encoding: 'utf8',
     env,
+    timeout: 30_000,
   });
   const output = result.stderr || result.stdout;
🤖 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 `@tools/smoke/game-owned-catalog.ts` around lines 303 - 336, Add a 30-second
subprocess timeout to the spawnSync options in both runValidator and
assertValidatorFailure, matching the timeout used by cli-game-release-inputs.ts,
so hung validator processes terminate instead of blocking indefinitely.
tools/smoke/release-manifest-merge.ts (1)

46-81: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add subprocess timeout and signal handling to runManifest.

The CLI release-input smoke test includes a 30-second timeout and explicit signal check on its spawnSync call, but runManifest has neither. A hung manifest subprocess will stall the test, and a signal kill produces a confusing "exited with status null" error message.

♻️ Proposed fix
     {
       cwd: process.cwd(),
       encoding: 'utf8',
       env: {
         ...process.env,
         APP_VERSION: '1.0.0',
         BUILD_ID: 'manifest-merge-smoke',
         MPGD_PRODUCT_CATALOG_FILE: catalogFile,
         MPGD_AD_PLACEMENTS_FILE: placementsFile,
         MPGD_EFFECTIVE_TARGET_CONFIG_OUTPUT_DIR: effectiveConfigDir,
         MPGD_SOURCE_GIT_SHA: 'game-source-sha',
       },
+      timeout: 30_000,
     },
   );
 
   if (result.error !== undefined) {
     throw result.error;
   }
 
+  if (result.signal !== null) {
+    throw new Error(
+      `Manifest subprocess was killed by signal ${result.signal}:\n${result.stderr || result.stdout || '(no output)'}`,
+    );
+  }
+
   assert.equal(
     result.status,
     0,
     `Manifest subprocess exited with status ${String(result.status)}:\n${result.stderr || result.stdout || '(no output)'}`,
   );
🤖 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 `@tools/smoke/release-manifest-merge.ts` around lines 46 - 81, Update
runManifest to pass a 30-second timeout to spawnSync and handle signal
termination explicitly. After checking result.error, assert that result.signal
is null, including the signal in the failure message, then retain the
exit-status assertion for non-signaled processes.
🤖 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 `@examples/phaser-starter/vite.config.ts`:
- Around line 75-93: Update resolveCatalogBaseDir to prioritize the game-owned
fallback base directory, matching resolveConfiguredBaseDir, before checking
INIT_CWD, PWD, or process.cwd(). Normalize configured environment paths through
readConfiguredPath rather than accessing process.env.INIT_CWD and
process.env.PWD directly, while preserving the paired catalog existence checks
and final fallback behavior.

---

Nitpick comments:
In `@examples/phaser-starter/vite.config.ts`:
- Around line 45-68: Replace the duplicated path normalization and
paired-configuration logic in createCatalogAliases with the shared
readConfiguredPath and configuredMonetizationCatalogFilePaths helpers from
tools/catalog-paths.ts, then build the aliases from their returned paths while
preserving existing behavior. Apply this shared-helper usage to the monorepo
example starter; the self-contained Phaser template may retain local
implementations.

In `@tools/smoke/game-owned-catalog.ts`:
- Around line 303-336: Add a 30-second subprocess timeout to the spawnSync
options in both runValidator and assertValidatorFailure, matching the timeout
used by cli-game-release-inputs.ts, so hung validator processes terminate
instead of blocking indefinitely.

In `@tools/smoke/release-manifest-merge.ts`:
- Around line 46-81: Update runManifest to pass a 30-second timeout to spawnSync
and handle signal termination explicitly. After checking result.error, assert
that result.signal is null, including the signal in the failure message, then
retain the exit-status assertion for non-signaled processes.
🪄 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: 8aa622a0-b96e-4161-b53a-9be8a724d402

📥 Commits

Reviewing files that changed from the base of the PR and between b6fbaa3 and e8d26f8.

📒 Files selected for processing (29)
  • .sampo/changesets/bright-game-owned-ids.md
  • .sampo/changesets/calm-target-config-esm.md
  • .sampo/changesets/steady-cli-game-release-inputs.md
  • apps/target-devvit/vite.server.config.ts
  • examples/phaser-starter/src/env.d.ts
  • examples/phaser-starter/vite.config.ts
  • package.json
  • packages/cli/src/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/vite.server.config.ts
  • packages/cli/templates/phaser-game/src/env.d.ts
  • packages/cli/templates/phaser-game/vite.config.ts
  • packages/platform/src/index.test.ts
  • packages/platform/src/index.ts
  • packages/target-config/src/effective.ts
  • packages/target-config/src/index.ts
  • packages/target-config/src/runtime.ts
  • packages/target-config/src/viewport.ts
  • packages/target-config/test/dist-import.mjs
  • tools/catalog-paths.ts
  • tools/smoke/cli-game-release-inputs.ts
  • tools/smoke/game-owned-catalog.ts
  • tools/smoke/release-manifest-merge.ts
  • tools/target/build-target.ts
  • tools/target/effective-config.ts
  • tools/target/generate-release-manifest.ts
  • tools/target/monetization-catalog-env.ts
  • tools/validate-ad-placements.ts
  • tools/validate-product-catalog.ts
  • tools/validate-public-readiness.ts
✅ Files skipped from review due to trivial changes (7)
  • packages/target-config/src/viewport.ts
  • examples/phaser-starter/src/env.d.ts
  • .sampo/changesets/steady-cli-game-release-inputs.md
  • .sampo/changesets/bright-game-owned-ids.md
  • packages/platform/src/index.test.ts
  • .sampo/changesets/calm-target-config-esm.md
  • packages/cli/templates/phaser-game/src/env.d.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/target-config/test/dist-import.mjs
  • packages/target-config/src/effective.ts
  • packages/target-config/src/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/vite.server.config.ts
  • packages/target-config/src/runtime.ts
  • apps/target-devvit/vite.server.config.ts
  • tools/validate-ad-placements.ts
  • tools/target/effective-config.ts
  • packages/cli/templates/phaser-game/vite.config.ts
  • packages/platform/src/index.ts
  • package.json
  • tools/validate-product-catalog.ts

Comment thread examples/phaser-starter/vite.config.ts Resolved
@imjlk
imjlk merged commit 63720ae into main Jul 11, 2026
6 checks passed
@imjlk
imjlk deleted the codex/target-config-node-esm branch July 13, 2026 23:28
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