uwarp-space 2026-03-22
Dynamic Stardock pricing, parity_check.py split, haggle markup parity, session IO fixes
28 files · 1,130+ · 923-

Dynamic Stardock pricing (TW4 sine formula)

2 files changed
  • constants.py Added dynamic_stardock_prices(game_day) — implements TW4 port.c sine oscillation: holds=[450,550], fighters=[92,108], shields=200-fighters
  • _purchases_hardware.py cmd_stardock_hardware() now calls dynamic_stardock_prices(game_day) for bulk fighters/shields purchases instead of using the static constants
  • TW4 port.c pricing formula implemented: hold_price=round(50sin(0.89756d)+500), fighter_price=round(8sin(0.89714d+1.5707)+100), shield_price=200-fighter_price. Prices oscillate daily — holds in [450,550], fighters/shields in [92,108]. Static HOLD_COST/FIGHTER_COST/SHIELD_COST constants retained as documented fallback midpoints. instantiate behavioral
    2 files
    • constants.py
    • _purchases_hardware.py

Haggle markup parity and multi-hop teleport fix

6 files changed
  • trading.py Haggle markup capped at 1.0 (pass-through) to match TWGS Gold behavior
  • config.py Updated haggle config defaults
  • test_haggle_markup.py Updated tests for 1.0 markup parity
  • test_haggle_markup_mutations.py Mutation tests for haggle markup
  • test_haggle_initial_offer.py 64 updated test cases for initial offer behavior
  • test_pricing_mode.py Updated for dynamic pricing mode
  • Haggle markup limited to 1.0 (sellers get exactly their asking price, never more) to match TWGS Gold parity. Previously could mark up above ask. Also fixed multi-hop teleport routing that was producing incorrect routes. remediate behavioral
    2 files
    • trading.py
    • test_haggle_markup.py

FK save order: corps before players

1 file changed
  • _game_state_persistence.py Moved dirty_corps save before dirty_players to satisfy the player.corp_id FK constraint — sectors → corps → players order
  • persist_dirty() was saving players before corps, causing FK constraint crashes when a player had a corp_id that hadn’t been written yet. Save order corrected to: sectors → corps → players → planets → aliens. remediate behavioral
    1 file
    • _game_state_persistence.py

Session IO exception handling

1 file changed
  • _session_io.py Added asyncio.CancelledError to inactivity timeout handler; added asyncio.LimitOverrunError to read exception set; added asyncio.IncompleteReadError to ESC sequence exception set
  • Three exception gaps closed in session IO: inactivity timeout now also catches asyncio.CancelledError (task cancellation during wait_for); character read now catches asyncio.LimitOverrunError (oversized read buffer); ESC sequence read now catches asyncio.IncompleteReadError. All exceptions set session.active=False and return empty string. harden behavioral
    1 file
    • _session_io.py

Split parity_check.py into focused modules

8 files changed
  • _runner.py New module: test runner logic extracted from parity_check.py (376 lines)
  • _preflight.py New module: preflight/setup logic extracted from parity_check.py (148 lines)
  • parity_check.py Reduced from 1000+ lines to focused coordination code
  • pvp_check.py Updated for refactored structure
  • _computer_helpers.py Updated helpers
  • _nav.py Updated nav helpers
  • _screen.py Updated screen helpers
  • _sync.py Updated sync helpers
  • parity_check.py split: test runner logic into _runner.py, preflight/ setup into _preflight.py. Each extracted module is under 500 LOC. parity_check.py now delegates to these modules as a coordination layer. decouple internal
    3 files
    • _runner.py
    • _preflight.py
    • parity_check.py

Parity test reliability fixes

10 files changed
  • _tests_cim.py Updated test cases
  • _tests_combat_deployment.py Updated test cases
  • _tests_computer.py 36-line update
  • _tests_deploy.py Updated test cases
  • _tests_personal.py Added personal parity test cases
  • _tests_settings.py Updated settings test cases
  • _tests_sim_movement.py Updated simulated movement test cases
  • _trade_helpers.py Updated trade helper utilities
  • defaults.py Updated game state defaults
  • HANDOFF.md Updated with session notes
  • Parity tests hardened: Corporate command prompt now detected as a sub-menu rather than a sector prompt. Experience/credits drift tolerance widened. Photon/genesis price differences marked as known_diff since they follow dynamic pricing. Ship settings uses O command on both sides. Added 0.5s pause between parity tests to reduce Wine/TWGS load. remediate internal
    3 files
    • _tests_settings.py
    • _tests_personal.py
    • _tests_computer.py