feat: add Code Farm cooperative idle game with plot-based crop system and pub/sub notifications

Implement a Farmville-style cooperative idle game mounted at `/game` with member-only play and public farm viewing. The data layer is pure and timestamp-driven with no background tick: plot states are derived from `ready_at` vs current time, never stored. Key features include plantable software projects (shell script through kernel) that build over real time, harvest for coins and XP, CI tier upgrades for faster builds, plot purchasing with doubling cost, watering mechanics for friends' builds, daily quests, and prestige system. All game endpoints negotiate HTML or JSON and return full farm state for single-request client refresh. Pub/sub notifications broadcast farm updates on `public.game.farm.{username}` topics. Database schema adds `game_farms`, `game_plots`, and `game_quests` tables with appropriate indexes.
This commit is contained in:
2026-06-22 16:41:53 +00:00
parent 743efbf61f
commit ebf6bf7f82
40 changed files with 3860 additions and 5 deletions
@@ -77,3 +77,31 @@ def test_block_mute_tools_hidden_from_guests():
names = {s["function"]["name"] for s in schemas}
for name in ("block_user", "unblock_user", "mute_user", "unmute_user"):
assert name not in names
def test_game_actions_registered_with_correct_auth():
public = {"game_state", "game_leaderboard", "game_view_farm"}
auth = {
"game_plant",
"game_harvest",
"game_buy_plot",
"game_upgrade_ci",
"game_water",
"game_fertilize",
"game_daily",
"game_upgrade_perk",
"game_claim_quest",
"game_prestige",
}
for name in public | auth:
assert name in BY_NAME, name
assert BY_NAME["game_state"].requires_auth is True
assert BY_NAME["game_leaderboard"].requires_auth is False
assert BY_NAME["game_view_farm"].requires_auth is False
for name in auth:
assert BY_NAME[name].requires_auth is True, name
def test_game_read_actions_are_read_only():
for name in ("game_state", "game_leaderboard", "game_view_farm"):
assert BY_NAME[name].is_read_only is True