Repository navigation
refactor(trainer): typed refusals across the tier contract - #418
Conversation
1da2a4b to
f4ca58e
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughTrainer purchase failures now use typed ChangesTrainer refusal flow
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Trainer purchase refusals now use typed outcomes across the module and gateway, preserving explicit client failure responses while durable failures terminate the session. No concrete current-head merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant TrainerHandler
participant WorldStore
participant StdbReducers
participant TrainerCodec
TrainerHandler->>WorldStore: buy_trainer_spell
WorldStore->>StdbReducers: request trainer purchase
StdbReducers-->>WorldStore: Learned or Refused
WorldStore-->>TrainerHandler: return TrainerBuyOutcome
TrainerHandler->>TrainerCodec: build_trainer_buy_failed
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The Module refused a trainer buy with a "[N] detail" string and the Gateway searched that text for "[1]" or "[2]". Any failure without a bracket, a reducer timeout included, reached the client as a gameplay refusal. One shared `TrainerRefusal` enum now defines the contract. The Module sends only the tag and keeps the human detail in its log. The Gateway parses the tag from a reducer the Module rejected; a timeout, transport, or SDK failure stays an error and ends the session. `TrainerBuyOutcome` holds the client mapping onto gtker's three `TrainingFailureReason` codes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
f4ca58e to
af90e69
Compare
Trainer timeouts were reported as ordinary purchase refusals, even when the purchase result was unknown. The Module now returns stable
TrainerRefusaltags. The Coordinator translates known tags into client outcomes and propagates transport failures, timeouts and unknown results so they end the World Session.Taxi-flight purchases remain an expected
Unavailablerefusal. Missing Actors and Operator failures remain fatal. Client failure codes and successful purchases keep their existing behavior.Verification: shared tag round trips, Module purchase Gate tests, Gateway client-code mapping and timeout behavior, and
cargo check -p lyracore-gateway --tests. The review fixes are rebased onto main at3850bae. CI runs the full checks.Review fixes by GPT-5.6 Sol through Codex, reviewed by GPT-6 through Codex.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation