282 Commits
Author SHA1 Message Date
1433f3d29c Fix Docker deployment connectivity issues (#4795)
* Fix Docker deployment connectivity issues

- Shardok: Listen on 0.0.0.0:40042 instead of localhost for container networking
- Shardok: Add env var fallback for resource paths (SHARDOK_RESOURCES_PATH, SHARDOK_MAPS_PATH)
- Eagle: Use plaintext gRPC for internal container-to-container communication
- docker-compose: Pass CLI args directly instead of env vars, default to gpt-5.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Document Docker networking and resource configuration

Added section explaining:
- Why Shardok binds to 0.0.0.0 instead of localhost for container networking
- Why Eagle uses .usePlaintext() for internal gRPC
- How env var fallbacks replace Bazel runfiles in Docker
- Future considerations for multi-host deployment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 10:41:53 -08:00
e0d5a9f2ec Convert ChronicleEventGenerator to return Scala ChronicleEvent types (#4786)
- Change return type from Vector[EventForChronicle] (proto) to Vector[ChronicleEvent] (Scala)
- Remove intermediate EventForChronicleDetails layer - create Scala types directly
- Update all 23 event type mappings to use Scala *ChronicleEvent types
- Add DateConverter.fromProto() to convert proto dates to Scala dates
- Update NewRoundAction to use Scala types directly (remove ChronicleEventConverter)
- Update DEPROTO_PLAN.md: now 47/52 (90%) action files are fully protoless

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 12:12:54 -08:00
1617867c60 Add Scala withdrawnFromProvinceView overload, making EndBattleAftermathPhaseAction fully protoless (#4773)
- Add withdrawnFromProvinceView(ProvinceT, ScalaGameState, FactionId) Scala overload
- Add supporting helpers: myIncomingArmiesScala, incomingArmyInfoScala
- Add BattalionViewFilter.limitedBattalionView for Scala BattalionT
- Update EndBattleAftermathPhaseAction to use Scala overload
- Remove unused proto converter imports and BUILD deps

Progress: 46/52 action files (88%) are now fully protoless

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 06:43:58 -08:00
c8906b1c04 Migrate reconnedProvinces to Scala ProvinceView, making PerformReconResolutionAction fully protoless (#4769)
- Change FactionT.reconnedProvinces from proto ProvinceView to Scala ProvinceView
- Change FactionC.reconnedProvinces from proto ProvinceView to Scala ProvinceView
- Change ChangedFactionC.updatedReconnedProvinces from proto to Scala ProvinceView
- Update FactionConverter and ChangedFactionConverter to convert at boundary
- Remove ProvinceViewConverter.toProto calls from PerformReconResolutionAction
  and EndBattleAftermathPhaseAction
- Update GameStateFactionExtensions import to use Scala ProvinceView
- Update test assertions to use Scala Date type

Progress: 45/52 action files (87%) are now fully protoless

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 21:33:42 -08:00
1fe062baaa Add productionization plan for cloud deployment (#4764)
Documents the architecture and migration plan to move Eagle and Shardok
servers from home Mac to DigitalOcean cloud infrastructure:

- On-demand Shardok with Eagle lifecycle management
- Docker containerization strategy
- GitHub Actions CI/CD pipeline
- Cost estimates and scaling options
- Migration phases and rollback procedures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 17:08:39 -08:00
6b2ab53574 Remove dead proto code: UnaffiliatedHeroMovedAction and fromGameState (#4762)
- Delete UnaffiliatedHeroMovedAction: was never called from production code;
  PerformUnaffiliatedHeroesAction.heroMovedResult constructs ActionResultC directly
- Delete HeroBackstoryUpdateActionGenerator.fromGameState: dead method that
  converted proto to Scala; only apply(GameState) is used
- Update DEPROTO_PLAN.md: now 44/52 (85%) action files are fully protoless

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 17:04:35 -08:00
ee4914dcc8 Add Scala overloads for ProvinceViewFilter and dependencies (#4752)
* Add Scala overloads for ProvinceViewFilter and dependencies

Enable ProvinceViewFilter to accept Scala ProvinceT and GameState types
instead of proto types, supporting the ongoing deproto migration for
internal logic. This unblocks dependent actions like EndBattleAftermathPhaseAction.

Changes:
- Add pure Scala filterArmy overload to ArmyFilter
- Add filteredProvinceView(ProvinceT, ScalaGameState) to ProvinceViewFilter
- Add monthlyFoodConsumption Scala overload to ProvinceUtils
- Update BUILD.bazel files with required deps, exports, and visibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update DEPROTO_PLAN with ProvinceViewFilter progress

- Mark ProvinceViewFilter server-side overload as complete (PR #4752)
- Update View Filters section to show partial completion status
- Mark EndBattleAftermathPhaseAction and PerformReconResolutionAction as unblocked
- Add validation checkbox for server-side ProvinceViewFilter
- Update estimated remaining effort

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 16:36:31 -08:00
d16aa63c00 Add Scala view models and update DEPROTO_PLAN.md (#4718)
Foundation for converting ProvinceViewFilter to use Scala types.

New Scala view models:
- StatWithCondition - condition enum (Low/Medium/High) with stat value
- ArmyView - faction army with units
- IncomingArmyView - incoming army details with optional unit info
- UnaffiliatedHeroBasics - unaffiliated hero info for province views
- FullProvinceInfo - detailed province information
- ProvinceView - top-level province view combining all the above

DEPROTO_PLAN.md updates:
- Mark Phase 6 Part 1 (ActionResultApplier) as complete
- Update ActionResultProto Consumer Inventory with current status
- Add table of remaining proto usage in actions with blockers
- Update estimated effort and validation checkboxes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 12:30:09 -08:00
b73d834fab Delete LegacyRandomStateTSequencer and migrate ProtolessSequentialResultsActionWrapper (#4705)
* Delete LegacyRandomStateTSequencer and migrate ProtolessSequentialResultsActionWrapper

- Migrate ProtolessSequentialResultsActionWrapper to use protoless RandomStateSequencer
- Delete LegacyRandomStateTSequencer.scala (no longer used)
- Remove legacy_random_state_trait_sequencer target from BUILD.bazel
- Clean up unnecessary proto dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Migrate postCommand to protoless flow and delete wrapper classes

- Add withTCommand and protoless action methods to RandomStateSequencer
- Migrate EngineImpl.postCommand to use protoless RandomStateSequencer
- Delete CommandFactory.makeCommand (no longer used)
- Delete ProtolessSequentialResultsActionWrapper (no longer used)
- Delete ProtolessSimpleActionWrapper (no longer used)
- Delete ProtolessRandomSimpleActionWrapper (no longer used)

The postCommand flow now uses:
1. RandomStateSequencer (protoless) instead of RandomStateProtoSequencer
2. makeTCommand instead of makeCommand
3. withTCommand to execute commands without proto wrapping
4. appliedResultsScala to process results

Proto conversion now only happens at the very end via appliedResultsScala.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 11:37:10 -08:00
deecd5a9ca Migrate EngineImpl.recursiveTransformT to protoless RandomStateSequencer (#4704)
* Migrate EngineImpl.recursiveTransformT to use protoless RandomStateSequencer

This removes the proto conversion roundtrip in recursiveTransformT by using
the new RandomStateSequencer which works with Scala GameState throughout.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update DEPROTO_PLAN.md with EngineImpl.recursiveTransformT migration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 10:36:07 -08:00
314ff83d24 Migrate EndDiplomacyResolutionPhaseAction and PerformUnaffiliatedHeroesAction to protoless RandomStateSequencer (#4702)
* Migrate EndDiplomacyResolutionPhaseAction to protoless RandomStateSequencer

- Use ActionResultApplier instead of ActionResultTApplier
- Use RandomStateSequencer instead of LegacyRandomStateTSequencer
- All helper methods now accept GameState instead of GameStateProto
- Removed all proto converter calls
- Updated test to use ActionResultApplierImpl and provide a date

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Convert PerformUnaffiliatedHeroesAction to use protoless RandomStateSequencer

- Migrated from LegacyRandomStateTSequencer to RandomStateSequencer
- Changed from ActionResultTApplier to ActionResultApplier
- Updated RoundPhaseAdvancer to pass actionResultApplier
- Updated test to call .results() directly and convert to proto (matching other migrated action tests)
- Updated DEPROTO_PLAN.md to mark action as migrated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update PerformUnaffiliatedHeroesActionTest to use Scala types directly

- Use .results(SeededRandom(...)) instead of resultsOfExecute()
- Assert on ActionResultT types (HeroChangedResultType, ChangedHeroC, ChangedProvinceC)
- Use inside() pattern for safe type matching instead of asInstanceOf
- Add Scala testing patterns guidance to CLAUDE.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor PerformUnaffiliatedHeroesActionTest to use Scala GameState directly

Instead of constructing proto GameState and converting to Scala,
the test now creates Scala GameState directly with all required fields.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 09:57:23 -08:00
9cee497886 Migrate EndBattleAftermathPhaseAction to protoless RandomStateSequencer (#4699)
* Migrate EndBattleAftermathPhaseAction to protoless RandomStateSequencer

- Replace LegacyRandomStateTSequencer with RandomStateSequencer
- Convert deferredChangeAR to use Scala DeferredChangeT types instead of proto
- Update allDeferredChanges and convertToUnaffiliated to take Scala GameState
- Replace ActionResultTApplier with ActionResultApplier
- Keep lazy proto conversion for ProvinceViewFilter calls in revelationChange
- Remove unused proto converter imports and dependencies
- Update tests to use ActionResultApplierImpl and Scala GameState

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update DEPROTO_PLAN with migration progress and ProvinceView needs

- Add NewRoundAction and EndBattleAftermathPhaseAction to completed migrations
- Add EndDiplomacyResolutionPhaseAction and PerformUnaffiliatedHeroesAction as pending
- Add View Filters section documenting ProvinceViewFilter blocking full deproto
- Document need for Scala ProvinceViewT model
- Update Open Questions about view generation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 17:31:33 -08:00
52f0cbe180 Migrate EndVassalCommandsPhaseAction and PerformReconResolutionAction to protoless RandomStateSequencer (#4696)
* Migrate EndVassalCommandsPhaseAction to protoless RandomStateSequencer

- Change from TRandomSequentialResultsAction to ProtolessRandomSequentialResultsAction
- Use ActionResultApplier instead of ActionResultTApplier
- Use RandomStateSequencer instead of LegacyRandomStateTSequencer
- Update RoundPhaseAdvancer to pass ActionResultApplier directly
- Add BattalionTypeConverter for proto conversion of battalionTypes parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Migrate PerformReconResolutionAction to protoless RandomStateSequencer

- Change from TRandomSequentialResultsAction to ProtolessRandomSequentialResultsAction
- Use ActionResultApplier instead of ActionResultTApplier
- Use RandomStateSequencer instead of LegacyRandomStateTSequencer
- Convert from proto IncomingEndTurnAction to Scala IncomingEndTurnAction
- Update RoundPhaseAdvancer to pass ActionResultApplier directly
- Keep lazy proto GameState conversion only for ProvinceViewFilter.filteredProvinceView
- Update test to use ActionResultApplierImpl and Scala types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 22:28:49 -08:00
2a0654f884 Migrate PerformVassalCommandsPhaseAction and PerformVassalDefenseDecisionsAction to protoless RandomStateSequencer (#4692)
- Change both actions to use RandomStateSequencer instead of LegacyRandomStateTSequencer
- Use ActionResultApplier instead of ActionResultTApplier
- Use TCommandFactory instead of CommandFactory
- Use Scala ProvinceUtils instead of LegacyProvinceUtils
- Update RoundPhaseAdvancer callers to use new parameter names
- Update PerformVassalCommandsPhaseActionTest to use new types and chooseCommand signature
- Update BUILD.bazel dependencies for both actions and test
- Mark both actions as migrated in DEPROTO_PLAN.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 21:35:25 -08:00
90f239c696 Migrate EndHandleRiotsPhaseAction to protoless RandomStateSequencer (#4684)
* Migrate EndHandleRiotsPhaseAction to protoless RandomStateSequencer

- Use RandomStateSequencer instead of LegacyRandomStateTSequencer
- Use ActionResultApplier instead of ActionResultTApplier
- Use ProvinceUtils.hasImminentRiot instead of LegacyProvinceUtils
- Match on TCommand cases to execute commands properly
- Update test to include rulingFactionHeroIds and hero in game state
- Update DEPROTO_PLAN.md with migration progress

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Extract TCommandFactory trait for lightweight mocking

- Create TCommandFactory trait with just makeTCommand method
- CommandFactory now extends TCommandFactory
- EndHandleRiotsPhaseAction accepts TCommandFactory instead of CommandFactory
- Test mocks TCommandFactory to avoid pulling in 40+ command dependencies
- Update DEPROTO_PLAN.md with migration progress

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix: Use current game state for deferred notifications

Was using initial gameState instead of current gs from sequencer,
causing deferred notifications to not be properly tracked.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 19:05:40 -08:00
9e97f71bb9 Add hasImminentRiot to ProvinceUtils (#4683)
This function was missing from ProvinceUtils but present in
LegacyProvinceUtils. Adding it enables EndHandleRiotsPhaseAction
to be migrated away from proto dependencies.

Also updates DEPROTO_PLAN.md to document LegacyProvinceUtils
migration progress.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 15:34:19 -08:00
5e2e7a454c Introduce protoless RandomStateSequencer, rename old to Legacy (#4679)
- Rename RandomStateTSequencer to LegacyRandomStateTSequencer
- Create new fully protoless RandomStateSequencer in its own package
- Update all 13 action usages to import LegacyRandomStateTSequencer
- The new sequencer uses Scala GameState throughout (no proto conversions)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 13:31:42 -08:00
2ae235e933 Convert EndDiplomacyResolutionPhaseAction to use Scala types (#4675)
- Accept Scala GameState in constructor instead of proto
- Use RandomStateTSequencer.apply() which takes Scala GameState
- Update helper methods to use GameStateProto type alias for clarity
- Update test to construct Scala GameState directly
- Update DEPROTO_PLAN.md with Phase 5c progress and sequencer migration plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 07:28:13 -08:00
2982927200 Convert three more actions to take Scala GameState (#4667)
* Convert three more actions to take Scala GameState

- EndFreeForAllDecisionPhaseAction: now takes Scala GameState directly
- EndBattleRequestPhaseAction: renamed fromProtoState to apply, takes Scala GameState
- EndDefenseDecisionPhaseAction: renamed fromProtoState to apply, takes Scala GameState

Updated RoundPhaseAdvancer callers to use GameStateConverter.fromProto().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Document Scala 3 compiler crash blocker for EndPleaseRecruitMePhaseAction

When attempting to convert EndPleaseRecruitMePhaseAction to take Scala GameState,
the Scala 3.7.2 compiler crashes during the lambdaLift phase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Convert EndPleaseRecruitMePhaseAction to Scala GameState and fix test

- Convert EndPleaseRecruitMePhaseAction to take Scala GameState directly
- Rewrite EndDefenseDecisionPhaseActionTest to use pure Scala model objects
  (instead of creating proto GameState and converting)
- Fix test to expect correct phase transition (TruceTurnBack, not BattleRequest)
- Update BUILD.bazel deps for both action and test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update DEPROTO_PLAN.md - mark EndPleaseRecruitMePhaseAction complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 16:30:09 -08:00
09a51e4280 Update DEPROTO_PLAN: consolidate completed phases, focus on Phase 6 (#4660)
Completed phases (1-5b) are now summarized in a table. The plan now
focuses on Phase 6: migrating from ActionResultProto consumers to
ActionResultT consumers throughout the engine.

Key finding: No code directly produces ActionResultProto anymore - all
production goes through ActionResultProtoConverter.toProto() from
ActionResultT. The next step is eliminating internal consumption.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 19:06:47 -08:00
44c268de93 Convert PerformProvinceEventsAction to pure Scala types and delete RandomSequentialResultsAction (#4654)
* Convert PerformProvinceEventsAction to pure Scala types and delete RandomSequentialResultsAction

- Convert PerformProvinceEventsAction to use ProtolessRandomSequentialResultsAction
  with pure Scala types (zero proto dependencies in action logic)
- Add BeastUtils.beastInfosT for T-type BeastInfo access
- Update RoundPhaseAdvancer to pass both GameStateProto and applier to execute()
- Delete RandomSequentialResultsAction base class (no longer used)
- Update PerformProvinceEventsActionTest to use T-types with proper casting
- Move Actions and ActionResultT to "What's Done" in DEPROTO_PLAN.md

All 10 RandomSequentialResultsAction subclasses are now converted to T-type base classes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove proto BeastInfo from BeastUtils and update tests to use T-types

- BeastUtils.beastInfos now returns T-type BeastInfo (removed proto version)
- SuppressBeastsPromptGenerator updated to use T-type BeastInfo
- PerformProvinceEventsAction: replace isInstanceOf with pattern matching
- PerformProvinceEventsActionTest: construct T-type test data directly
  instead of proto data that gets converted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Move province utility methods to ProvinceUtils

- Move effectiveEconomy and effectiveInfrastructure usage from local methods
  to existing ProvinceUtils implementations
- Add hasBlizzard, hasDrought, hasFlood, hasFestival, hasEpidemic, hasBeasts
  predicates to ProvinceUtils
- Remove duplicate local methods from PerformProvinceEventsAction

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 18:57:28 -08:00
0551dd0f13 Convert vassal command Actions to use T-type commands via TCommand sealed trait (#4636)
* Convert remaining RandomSequentialResultsAction subclasses to TRandomSequentialResultsAction

- Convert EndHandleRiotsPhaseAction to TRandomSequentialResultsAction
- Convert PerformVassalCommandsPhaseAction to TRandomSequentialResultsAction
- Convert PerformVassalDefenseDecisionsAction to TRandomSequentialResultsAction
- Add withRandomAction and withOptionalRandomAction to RandomStateTSequencer
- Create ActionResultProtoWrapper to wrap proto ActionResult as ActionResultT
- Update VigorXPApplier to skip proto-wrapped results
- Expose protoApplier on ActionResultTApplierImpl for sequencer access

This enables executing proto Actions from CommandFactory.makeCommand() within
the T-based sequencer by wrapping results in ActionResultProtoWrapper.

9/10 RandomSequentialResultsAction subclasses now converted. Only
PerformProvinceEventsAction remains (heavily proto-based internally).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert vassal command Actions to use T-type commands via TCommand sealed trait

- Create TCommand sealed trait unifying Simple, RandomSimple, and Sequential T-type actions
- Add makeTCommand method to CommandFactory returning T-type actions directly
- Add withTCommand/withOptionalTCommand helpers to RandomStateTSequencer
- Convert PerformVassalCommandsPhaseAction, PerformVassalDefenseDecisionsAction,
  and EndHandleRiotsPhaseAction to use T-type commands
- Add executeProtolessAction helper in RoundPhaseAdvancer to bridge T-type actions
  with proto-based engine interface
- Delete ActionResultProtoWrapper (no longer needed after T-type conversion)
- Add exports to action_result_trait for interface types to support ScalaMock mocking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add VigorXPApplier.withVigorXp to test helper to match production behavior

Addresses Copilot review comment about test executeAction helper missing
vigor XP application that RoundPhaseAdvancer.executeProtolessAction does.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove actionResultProtoApplier from TRandomSequentialResultsAction.randomResults

TRandomSequentialResultsAction subclasses should only use ActionResultTApplier,
not both appliers. The execute() method creates the T-type applier internally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add execute method to ProtolessRandomSequentialResultsAction

Move the duplicate executeAction/executeProtolessAction helper code
into a proper execute() method on ProtolessRandomSequentialResultsAction.
This eliminates code duplication between tests and RoundPhaseAdvancer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add troubleshooting guidance for Scala MissingType errors

Document that MissingType errors are BUILD.bazel dependency issues,
not compiler crashes. Also note to never run bazel clean without asking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-13 09:04:06 -08:00
c5466e38a8 Convert NewRoundAction to TRandomSequentialResultsAction (#4631)
- Change base class from RandomSequentialResultsAction to TRandomSequentialResultsAction
- Use T-based types: ActionResultC, ChangedProvinceC, ChangedHeroC, ChangedFactionC
- Use LlmRequestT.ChronicleUpdateMessage for chronicle requests
- Use ChronicleEventConverter.fromProto to convert proto events to T-types
- Use UnaffiliatedHeroConverter.fromProto for unaffiliated hero updates
- Add newChronicleEntry field to ActionResultT/ActionResultC
- Update BUILD.bazel dependencies and visibility for chronicle_entry, unaffiliated_hero, quest

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-05 17:03:04 -08:00
95e1d80e78 Convert PerformReconResolutionAction to TRandomSequentialResultsAction (#4628)
- Change base class from RandomSequentialResultsAction to TRandomSequentialResultsAction
- Replace proto ActionResult with ActionResultC
- Replace proto ChangedProvince/ChangedFaction/ClientTextVisibilityExtension with T-based equivalents
- Update test to use T-based types
- Update DEPROTO_PLAN.md: 5/10 actions now converted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-05 08:54:25 -08:00
0dce9f47b0 Phase 5b: Convert more RandomSequentialResultsAction subclasses to TRandomSequentialResultsAction (#4627)
* Add Phase 8: Create Scala-Native Sequencer to deproto plan

Documents the future goal of creating a ScalaOnlySequencer that operates
entirely on Scala GameState, eliminating per-callback proto conversions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert PerformUnaffiliatedHeroesAction and PerformProvinceMoveResolutionAction to TRandomSequentialResultsAction

- PerformUnaffiliatedHeroesAction: Was already mostly T-based internally,
  now extends TRandomSequentialResultsAction and uses RandomStateTSequencer
- PerformProvinceMoveResolutionAction: Uses T-based sub-actions
  (FriendlyMoveAction, ShipmentArrivedAction), converted to use
  ActionResultTApplier and ActionResultTWithResultingState
- Updated BUILD.bazel dependencies for both actions
- Updated DEPROTO_PLAN.md with progress (4/10 actions converted)

Phase 5b progress: 4/10 RandomSequentialResultsAction subclasses converted.
Remaining 6 actions blocked on CommandFactory or direct proto construction.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-05 06:58:39 -08:00
6e788f4388 Add TRandomSequentialResultsAction base class (Phase 5b) (#4626)
* Add TRandomSequentialResultsAction and convert first two actions

- Create TRandomSequentialResultsAction base class for actions that:
  - Take Scala GameState as constructor parameter
  - Extend Action trait (provides execute())
  - Use ActionResultTApplier for applying results
  - Use RandomStateTSequencer for sequencing operations

- Convert EndVassalCommandsPhaseAction to TRandomSequentialResultsAction
- Convert TruceTurnBackPhaseAction to TRandomSequentialResultsAction

Both converted actions now return ActionResultT instead of proto ActionResult,
eliminating proto usage in their result construction.

Part of Phase 5b: deleting RandomSequentialResultsAction base class.
8 more actions remain to be converted.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Sort BUILD.bazel deps alphabetically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 14:02:41 -08:00
e6038927f1 Convert RandomSequentialResultsAction subclasses to Scala GameState (#4624)
* Convert EndVassalCommandsPhaseAction to use Scala GameState

- Change constructor to take Scala GameState instead of proto
- Pass GameStateConverter.toProto() to parent RandomSequentialResultsAction
- Use ActionResultC with EndVassalCommandsPhaseResultType for final result
- Handle notifications with Scala types (withDeferred for delivery)
- Update RoundPhaseAdvancer to convert proto to Scala GameState
- Add required BUILD.bazel dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert EndHandleRiotsPhaseAction to use Scala GameState

- Change constructor to take Scala GameState instead of proto
- Pass GameStateConverter.toProto(gameState) to parent class
- Use withActionResultT with ActionResultC for endPhaseResult
- Update RoundPhaseAdvancer to convert proto to Scala GameState
- Add generated_text_request dependency to BUILD.bazel
- Update test to pass converted Scala GameState

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert more RandomSequentialResultsAction subclasses to Scala GameState

- PerformProvinceMoveResolutionAction: takes Scala GameState, converts to proto internally
- PerformProvinceEventsAction: takes Scala GameState, converts to proto internally
- TruceTurnBackPhaseAction: takes Scala GameState, uses RandomStateProtoSequencer with initialState
- PerformVassalCommandsPhaseAction: takes Scala GameState, uses gameStateProto for internal proto operations

Updated RoundPhaseAdvancer to convert proto to Scala GameState for each action.
Fixed tests to use GameStateConverter.fromProto().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert PerformVassalDefenseDecisionsAction to Scala GameState

Also updates related tests to use GameStateConverter.fromProto() where needed.

Note: PerformProvinceEventsActionTest has 10 failing tests that need
their expectations updated to account for complete beast data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Convert NewRoundAction and PerformReconResolutionAction to Scala GameState

Continue the deproto conversion of RandomSequentialResultsAction subclasses:
- Convert PerformReconResolutionAction to use Scala GameState
- Convert NewRoundAction to use Scala GameState
- Fix test fixtures to provide required fields for proto-to-Scala conversion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 07:08:38 -08:00
acad796662 Document Shardok resync mechanism and unused request_full_resync field (#4623)
The request_full_resync field exists in eagle.proto but is not read by the server.
The actual resync mechanism uses filteredResultCount = 0 instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 20:45:58 -08:00
49bbdb1d2c Delete unused DeterministicSingleResultAction base class (#4614)
All actions that previously extended DeterministicSingleResultAction have
been converted to ProtolessSimpleAction. The base class is no longer used.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 19:28:20 -08:00
19f5cf9e89 Complete DeterministicSingleResultAction deproto conversions (#4611)
Convert the final 3 DeterministicSingleResultAction classes to ProtolessSimpleAction:
- PerformFoodConsumptionPhaseAction
- PerformHostileArmySetupAction
- NewYearAction

All actions now use Scala GameState internally and return ActionResultT.
RoundPhaseAdvancer updated to convert via GameStateConverter at boundaries.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 19:09:37 -08:00
429725c4e1 Add comprehensive connection resilience implementation plan (#4599)
Added detailed multi-week implementation plan to CONNECTION_ARCHITECTURE.md with specific code implementations and prioritized roadmap for improving client-server connection reliability.

## Implementation Plan Overview

**Priority 1 (Week 1):** Critical fixes and diagnostics
- Fix Shardok security vulnerability (remove unauthenticated public access)
- Add comprehensive connection logging with structured metrics
- Reduce HTTP/2 keepalive to 15s for NAT traversal

**Priority 2 (Week 2):** State consistency and recovery
- Implement state resync mechanism with sequence numbers
- Add exponential backoff for reconnection attempts
- Create health monitoring UI for connection status visibility

**Priority 3 (Week 3):** Architecture improvements
- Consolidate heartbeat mechanisms (application-level + HTTP/2)
- Add circuit breaker pattern for cascading failure prevention
- Implement server-side metrics and monitoring

**Priority 4 (Week 4+):** Advanced features
- Adaptive keepalive parameters based on network conditions
- WebSocket fallback for environments with HTTP/2 issues
- Client-side prediction for improved UX during disconnections

## Includes
- Specific code implementations in C#, Scala, nginx, Python
- Complete testing strategy (unit, integration, load, manual)
- Success criteria with quantifiable metrics
- Monitoring & observability recommendations
- Security, performance, and rollback considerations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-30 19:24:06 -08:00
98baf7ec66 Organize documentation into docs/ folder (#4598)
Create docs/ folder at repo root and move documentation files:
- CONNECTION_ARCHITECTURE.md (new comprehensive connection docs)
- COMMAND_PROTO_USAGE_ANALYSIS.md
- DEPROTO_PLAN.md
- SCALA3_MODERNIZATION.md
- actions-model-usage-analysis.md
- occupants-optimization-report.md
- scala3-reflection-issues.md

CLAUDE.md remains at root (project instructions for Claude Code).

Connection architecture documentation includes:
- gRPC bidirectional streaming protocol details
- Client-side connection management (PersistentClientConnection)
- Server-side implementation (EagleServiceImpl)
- nginx proxy configuration and timeouts
- Timeout settings across all layers (client, nginx, server)
- Eagle ↔ Shardok communication flow

Critical findings:
- 🔴 SECURITY: Shardok internal interface exposed without auth in nginx config
- Mystery "2-minute timeout" doesn't exist in code (all timeouts are 5-20 minutes)
- No state resync mechanism after connection drops during Shardok
- Inefficient dual-layer heartbeat (HTTP/2 + application level)

Hypotheses for remote player connection issues:
- Most likely: NAT/firewall timeout at player's router/ISP (60-120s)
- HTTP/2 keepalive (45s) may not be frequent enough to keep NAT alive
- Shardok's bursty traffic pattern may appear "idle" at transport layer

Recommendations:
1. Fix Shardok internal interface security vulnerability
2. Add precise connection drop logging with timestamps
3. Reduce HTTP/2 keepalive from 45s to 15s
4. Get network diagnostics from affected remote player
5. Implement state resync mechanism for Shardok

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-30 14:11:51 -08:00