Skip to content

feat(ait): resolve game identity from Toss user hash - #37

Merged
imjlk merged 1 commit into
mainfrom
codex/ait-game-identity
Jul 10, 2026
Merged

imjlk merged 1 commit into
mainfrom
codex/ait-game-identity

Conversation

@imjlk

@imjlk imjlk commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • resolve Apps in Toss game identity from the official getUserKeyForGame() hash
  • return explicit bridge errors for unsupported app versions, invalid categories, SDK failures, and malformed responses
  • keep the fixed local identity behind the explicit dev:plain mock environment
  • add focused identity tests and document the Toss app/game-category requirement

Why

The AIT wrapper previously returned ait-local-player from its production bridge. That could merge players across sessions and make backend save, leaderboard, and ledger identity incorrect. The wrapper now uses the game-specific SDK hash while keeping local browser development deterministic through an explicit mock provider.

Validation

  • pnpm --dir apps/target-ait test
  • pnpm --dir apps/target-ait check
  • pnpm build:ait
  • pnpm smoke:target ait
  • pnpm check
  • pnpm test
  • ocr review --audience agent (no actionable issues)

Notes

This changes the private AIT target wrapper only, so no Sampo changeset is required. The official API requires a game mini-app and Toss app 5.232.0 or newer; sandbox/QR verification remains part of release QA.

@codex review
@coderabbitai review

Summary by CodeRabbit

  • New Features

    • Added game-specific player identity resolution through the Apps in Toss SDK.
    • Production builds now use the game identity, while plain-browser development supports a local mock identity.
    • Identity failures provide clearer outcomes for unsupported games, invalid responses, and retryable SDK errors.
  • Documentation

    • Clarified Toss app version 5.232.0+ and game mini-app requirements.
    • Documented Sandbox verification through QR testing in the Toss app.
  • Tests

    • Added coverage for successful identity resolution and expected error scenarios.

imjlk commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Ready for review. The AIT identity bridge now uses the official game user hash and keeps the fixed player id behind the explicit dev:plain mock path. @codex review @coderabbitai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — I'll take a look at the AIT identity bridge changes now, including the Toss user hash resolution, the dev:plain mock path, and the new bridge error handling.

✅ 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

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eef4b1d8-d7c1-40a8-a4fb-2a547624b456

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The AIT target now resolves player identity through getUserKeyForGame, maps results into bridge responses, supports a local mock identity mode, adds resolver tests and test configuration, and documents Toss app requirements and verification steps.

Changes

AIT game identity flow

Layer / File(s) Summary
Identity resolver and validation
apps/target-ait/src/aitIdentity.ts, apps/target-ait/src/aitIdentity.test.ts, apps/target-ait/tsconfig.test.json
Adds structured identity resolution for HASH responses, SDK sentinels, malformed results, and thrown errors, with corresponding tests and test compiler configuration.
Bridge identity integration
apps/target-ait/src/aitBridge.ts, apps/target-ait/src/main.ts
Passes a configurable game-key provider into the bridge and maps resolved identities or errors through identity.getPlayer.
Local workflow and documentation
apps/target-ait/package.json, README.md, apps/target-ait/README.md
Pins mock identity environment variables for dev:plain and documents production requirements, identity mapping, and QR verification.
Estimated code review effort: 3 (Moderate) ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant PlatformGateway
  participant AITBridge
  participant IdentityResolver
  participant AppsInTossSDK
  PlatformGateway->>AITBridge: identity.getPlayer
  AITBridge->>IdentityResolver: resolveAitGameIdentity
  IdentityResolver->>AppsInTossSDK: getUserKeyForGame
  AppsInTossSDK-->>IdentityResolver: HASH or failure result
  IdentityResolver-->>AITBridge: player identity or structured error
  AITBridge-->>PlatformGateway: identity response
Loading

Poem

A bunny hops where HASH keys gleam,
The bridge now joins the Toss-y stream.
Mock players help the browser play,
While real IDs guide apps away.
Tests thump softly: “All is right!” 🐇

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: resolving AIT game identity from Toss user hash.
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-game-identity

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

❤️ Share

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

@imjlk
imjlk merged commit d318b06 into main Jul 10, 2026
5 checks passed
@imjlk
imjlk deleted the codex/ait-game-identity branch July 15, 2026 13:41
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