Skip to content

feat(manabrew-compat): depend on manabrew-protocol 3.0.0 instead of mirroring it - #6734

Merged
matthewevans merged 5 commits into
mainfrom
codex/manabrew-protocol-3
Jul 28, 2026
Merged

feat(manabrew-compat): depend on manabrew-protocol 3.0.0 instead of mirroring it#6734
matthewevans merged 5 commits into
mainfrom
codex/manabrew-protocol-3

Conversation

@matthewevans

@matthewevans matthewevans commented Jul 28, 2026

Copy link
Copy Markdown
Member

Replaces the ~750-line hand-mirror of the ManaBrew wire DTOs with a real
manabrew-protocol = "3" dependency, and adopts the 3.0.0 additions.

Licensing. manabrew-protocol is AGPL-3.0-or-later. Copyleft flows downstream,
so this crate now declares license = "AGPL-3.0-or-later" explicitly instead of
inheriting the workspace's MIT OR Apache-2.0. engine is unaffected — a permissive
library consumed by an AGPL work stays permissive. This crate has zero dependents
and must stay a leaf: if a distributed binary ever links it, that binary becomes AGPL
and AGPL §13's network clause applies.

The mirror was a superset, not a copy. It carried two deliberate vendor extensions
that upstream lacks — MulliganOutput::MulliganUseSerumPowder and
MulliganPutBackInput.excluded_card_id — supporting a play the engine genuinely models
(MulliganChoice::UseSerumPowder). An independent diff of all 81 shared types found
exactly these two and no others. Both are preserved as documented local supersets over
the upstream types; every other type now comes from the dependency. The wire format is
byte-identical to before.

New 3.0.0 fields. final_chapter and class_level are populated from engine state.
class_levels, saga_chapters and is_class_level_up need printed Oracle sections the
engine does not expose after lowering, so they stay at protocol defaults with explicit
capability-registry entries rather than inferred values. Registry 83 -> 87.

Verification (run first-hand, not taken on report): 92 tests pass, 0 failed;
clippy --all-targets -- -D warnings clean. The restored wire-shape test was falsified
twice — dropping skip_serializing_if and renaming the variant tag each turn it red at
different assertions — then confirmed green on restore.

Summary by CodeRabbit

  • New Features

    • Added support for the ManaBrew wire protocol v3.
    • Added Serum Powder mulligan interactions, including card exclusion during put-back selection.
    • Exposed card class-level and final-chapter information in game views.
    • Added expanded capability reporting for protocol v3.
  • Compatibility

    • Updated prompt and response handling to support upstream protocol messages alongside local extensions.

@matthewevans
matthewevans enabled auto-merge July 28, 2026 18:32
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 69682125-852a-40e1-8f24-5e6d172cc021

📥 Commits

Reviewing files that changed from the base of the PR and between d947f97 and 503ff66.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • crates/manabrew-compat/CLAUDE.md
  • crates/manabrew-compat/Cargo.toml
  • crates/manabrew-compat/src/lib.rs

📝 Walkthrough

Walkthrough

The ManaBrew adapter migrates from protocol v2 to v3, introduces extension-aware prompt wrappers and Serum Powder mulligan handling, updates card and capability payloads, and revises serialization, validation, documentation, and conformance tests.

Changes

ManaBrew protocol v3 adapter

Layer / File(s) Summary
Protocol v3 contracts and compatibility
crates/manabrew-compat/Cargo.toml, crates/manabrew-compat/src/lib.rs
The crate pins protocol v3, updates wire types and ability fields, re-exports the upstream DisplayEvent, changes RelayMessage derives, and updates protocol round-trip expectations.
Extension-aware prompt and mulligan flow
crates/manabrew-compat/src/lib.rs
Prompt inputs and outputs use upstream wrappers with local Serum Powder extensions; validation, response translation, serialization, and put-back prompts handle the new shapes.
Card payloads and capability conformance
crates/manabrew-compat/src/lib.rs
Card DTOs expose finalChapter and classLevel, printable vectors remain empty, and unsupported-capability registry entries and conformance checks reflect v3.
Documentation and test alignment
crates/manabrew-compat/CLAUDE.md, crates/manabrew-compat/src/lib.rs
Documentation, imports, prompt assertions, and capability totals are updated for the v3 adapter behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ManaBrewCompat
  participant Engine
  Client->>ManaBrewCompat: Send wrapped PromptOutput
  ManaBrewCompat->>ManaBrewCompat: Validate upstream or local response
  ManaBrewCompat->>Engine: Translate response into engine action
  Engine-->>ManaBrewCompat: Produce next prompt or result
  ManaBrewCompat-->>Client: Serialize protocol v3 message
Loading

Possibly related PRs

🚥 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 summarizes the main change: switching manabrew-compat to manabrew-protocol 3.0.0 instead of mirroring DTOs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 codex/manabrew-protocol-3

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

@matthewevans
matthewevans added this pull request to the merge queue Jul 28, 2026
@github-actions

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

Merged via the queue into main with commit 2b3510e Jul 28, 2026
15 checks passed
@matthewevans
matthewevans deleted the codex/manabrew-protocol-3 branch July 28, 2026 18:58
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