Skip to content

Rename Commons to Game throughout the codebase (closes #276) - #277

Merged
pconrad merged 1 commit into
mainfrom
pc-Claude-issue276
Aug 11, 2026
Merged

Rename Commons to Game throughout the codebase (closes #276)#277
pconrad merged 1 commit into
mainfrom
pc-Claude-issue276

Conversation

@pconrad

@pconrad pconrad commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #276. The user-facing terminology was already renamed from "Commons" to "Game" in #271; this does the same for the code itself: database table/column names, class/file names, method names, parameter names, API routes, and test names, respecting each artifact's case convention (Commons->Game, commons->game, COMMONS->GAME, e.g. commonsId->gameId, CommonsPlus->GamePlus).

Details:

  • Renamed 80 source files (entities, controllers, repositories, services, jobs, errors, DTOs, and their frontend/test/story counterparts), including moving the frontend's Commons/ component directory to Game/. Also fixed a pre-existing filename typo (AdminListCommonPageV2.jsx, singular) to match its already-plural component name, now AdminListGamePageV2.jsx.
  • Added a new idempotent migration (007_rename_commons_to_game.json, following the same precondition-guarded pattern as the prior two rename migrations from Change UserCommons name to Farmer throughout the app #274/Hotfix: make lib-jobs migration's FK drop idempotent #272) that renames the commons table to game, and the commons_id column (plus its two FK constraints) across every table that references it: farmer, profits, announcement, chat_message, commonstats, cowdeath, and reports.
  • The case-aware substitution deliberately protects two collisions:
    • CommonStats — a distinct, unrelated entity/table (Common is singular, not Commons) — via a negative-lookahead regex guarding the literal lowercase commonstats substring used in its API routes (/api/commonstats/*).
    • "Tragedy of the Commons" — the real-world economics term the app is named after — by excluding prose documentation (README, gamePlay.md, copilot-instructions.md) from the bulk substitution entirely, fixing only the one genuinely stale code reference in copilot-instructions.md.
  • Caught and reverted a second-order corruption from that same collision risk: pom.xml's actual Apache Commons Maven dependency (org.apache.commons:commons-csv) and its imports across 6 files got mangled to org.apache.game by an earlier, less careful substitution pass and had to be restored — a good reminder that "Commons" the app concept and Apache Commons the library share nothing but a name.

Test plan

  • Backend: mvn verify — 379/379 tests, 100% JaCoCo coverage
  • Frontend: 742/742 tests, 100% coverage (statements/branches/functions/lines), lint/format clean
  • Pitest on all ~58 changed backend classes: 411/411 mutants killed, 100%, 0 survivors
  • Stryker on all ~44 changed frontend files: 100% mutation score (0 survivors; met the break threshold)
  • Playwright integration suite run locally end-to-end: GameWebIT, FarmerWebIT, and GameIT all pass. DashboardWebIT hits an unrelated pre-existing Playwright flake (element detached from DOM) that reproduces identically on unmodified main — already documented in the Change "Commons" in user facing terminology to something else #271/Change UserCommons name to Farmer throughout the app #274 PRs, not introduced by this change.
  • Exhaustive final repo-wide grep confirms zero remaining occurrences of Commons/commons/COMMONS outside: the historical migration files (which must stay byte-identical), the new migration file (which necessarily references the old names as its rename targets), and the legitimate CommonStats/org.apache.commons/"Tragedy of the Commons" exclusions above.

🤖 Generated with Claude Code

The user-facing terminology was already renamed from "Commons" to
"Game" in #271; this does the same for the code itself: database
table/column names, class/file names, method names, parameter names,
API routes, and test names, respecting each artifact's case
convention (Commons->Game, commons->game, COMMONS->GAME, e.g.
commonsId->gameId, CommonsPlus->GamePlus).

- Renamed 80 source files (entities, controllers, repositories,
  services, jobs, errors, DTOs, and their frontend/test/story
  counterparts), including moving the frontend's Commons/ component
  directory to Game/. Also fixed a pre-existing filename typo
  (AdminListCommonPageV2.jsx, singular) to match its already-plural
  component name, now AdminListGamePageV2.jsx.
- Added a new idempotent migration (008... actually 007, following
  the same precondition-guarded pattern as the prior two rename
  migrations) that renames the commons table to game, and the
  commons_id column (plus its two FK constraints) across every table
  that references it: farmer, profits, announcement, chat_message,
  commonstats, cowdeath, and reports.
- The case-aware substitution deliberately protects two collisions:
  "CommonStats" (a distinct, unrelated entity/table - "Common" is
  singular, not "Commons") via a negative-lookahead regex guarding
  the literal lowercase "commonstats" substring used in its API
  routes, and "Tragedy of the Commons" (the real-world economics term
  the app is named after) by excluding prose documentation from the
  bulk substitution entirely.
- Caught and reverted a second-order corruption from the same
  collision risk: pom.xml's actual Apache Commons Maven dependency
  (org.apache.commons:commons-csv) and its imports across 6 files got
  mangled to "org.apache.game" by an earlier, less careful pass and
  had to be restored - a reminder that "Commons" the app concept and
  Apache Commons the library share nothing but a name.

Verified: backend `mvn verify` (379/379 tests, 100% JaCoCo); frontend
(742/742 tests, 100% coverage, lint/format clean); Pitest on all ~58
changed backend classes (411/411 mutants killed, 100%); Stryker on
all ~44 changed frontend files (100% mutation score, 0 survivors);
and the Playwright integration suite run locally end-to-end (GameWebIT,
FarmerWebIT, and GameIT all pass; DashboardWebIT hits the same
unrelated pre-existing flake already documented in the #271/#274 PRs).

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

@pconrad pconrad left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pconrad
pconrad merged commit 4f14fc2 into main Aug 11, 2026
20 checks passed
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.

Change Commons to Game inside the code.

1 participant