Skip to content

fix(visibility): keep debug library identities out of normal state - #7112

Merged
matthewevans merged 3 commits into
mainfrom
ship/visibility-debug-library-identities
Aug 9, 2026
Merged

fix(visibility): keep debug library identities out of normal state#7112
matthewevans merged 3 commits into
mainfrom
ship/visibility-debug-library-identities

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added an authorized debug library view showing card names and IDs for the viewing player’s own library.
    • Debug library browsing now uses a dedicated, permission-aware card projection.
  • Bug Fixes
    • Prevented unrevealed library cards—including the viewer’s own—from appearing in normal game state views, even when debug access is enabled.
    • Improved permission handling across local, sandbox, multiplayer, and restored games.

@matthewevans
matthewevans enabled auto-merge August 8, 2026 23:52
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 47 minutes

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

How can I continue?

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

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

How do review limits work?

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

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

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 625dbbfc-7178-41c8-b92d-a140084e254a

📥 Commits

Reviewing files that changed from the base of the PR and between 9364808 and 173e6e5.

📒 Files selected for processing (1)
  • crates/engine-wasm/src/lib.rs
📝 Walkthrough

Walkthrough

The engine now exposes authorized debug library-card identities through derived views. Normal library objects remain redacted. WASM initializes permissions by game mode, and the client viewer renders the projection directly.

Changes

Debug library projection

Layer / File(s) Summary
Engine projection and redaction
crates/engine/src/game/derived_views.rs, crates/engine/src/game/visibility.rs
The engine adds debug_library_cards with sorted object IDs and names for the authorized viewer’s own library. Normal filtered library objects remain hidden. Tests cover authorized, unauthorized, own, and opponent libraries.
Debug permission initialization and snapshots
crates/engine-wasm/src/lib.rs
WASM assigns debug permissions for local, multiplayer, and sandbox games. Legacy restores backfill Player 0 when applicable. Viewer snapshots use ClientGameStateRef::wrap_filtered.
Client projection consumption
client/src/adapter/types.ts, client/src/components/chrome/DebugLibraryViewer.tsx, client/src/components/chrome/DebugPlayerActions.tsx
The client adds the projection types and renders projected cards using object_id and name. Raw GameObject mapping and hover inspection are removed.

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

Sequence Diagram(s)

sequenceDiagram
  participant Viewer
  participant WASM
  participant DerivedViews
  participant Client
  Viewer->>WASM: open debug library
  WASM->>DerivedViews: build filtered viewer snapshot
  DerivedViews-->>WASM: debug_library_cards projection
  WASM-->>Client: ClientGameStateRef
  Client->>Client: shuffle and render projected cards
Loading

Possibly related PRs

  • phase-rs/phase#4538: Shares debug visibility infrastructure but addresses face-down identity revelation instead of library-card projections.

Suggested labels: bug

Suggested reviewers: lgray, parthmishra, andriypolanski

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: keeping debug library identities out of normal state visibility.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ship/visibility-debug-library-identities

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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@crates/engine-wasm/src/lib.rs`:
- Around line 1875-1880: Update the restore logic around the legacy permission
backfill to distinguish saves that predate debug_permitted from current saves
with an intentionally empty set. Use the save-version or presence metadata
required by CLAUDE.md to backfill sandbox seats only for legacy payloads, while
preserving current sandbox permissions unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e5b75d0-3be4-4adf-a73f-ce5a72d1b53a

📥 Commits

Reviewing files that changed from the base of the PR and between bbd2445 and 9364808.

📒 Files selected for processing (6)
  • client/src/adapter/types.ts
  • client/src/components/chrome/DebugLibraryViewer.tsx
  • client/src/components/chrome/DebugPlayerActions.tsx
  • crates/engine-wasm/src/lib.rs
  • crates/engine/src/game/derived_views.rs
  • crates/engine/src/game/visibility.rs

Comment thread crates/engine-wasm/src/lib.rs Outdated
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Generated for head 173e6e59104b6a35fa7fd840c88d7b26bea080bc.

Parse changes introduced by this PR

✓ No card-parse changes detected.

@matthewevans
matthewevans added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit d8ba1e5 Aug 9, 2026
13 checks passed
@matthewevans
matthewevans deleted the ship/visibility-debug-library-identities branch August 9, 2026 00:48
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