Use map_version.folder_name instead of filename#1096
Conversation
faf-db V144 makes map_version.folder_name the source-of-truth column and turns
filename into a generated column (CONCAT('maps/', folder_name, '.zip')). The
test fixture can no longer insert filename, so it now provides folder_name; the
generated filename the server reads is unchanged. Bump the migrations image to
v144.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 20 minutes and 48 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughUpdated the database migration service image tag and changed the ChangesDatabase migration refresh
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@compose.yaml`:
- Line 19: The CI database migration version is out of sync with the compose
image pin: compose.yaml now uses faforever/faf-db-migrations:v144, but the test
workflow still points FAF_DB_VERSION to the older tag. Update the version pin in
the GitHub Actions workflow so it matches v144, keeping the workflow and compose
configuration aligned with the same db-migrations release.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 061b9c74-3114-430a-8029-c52d4fc51754
📒 Files selected for processing (2)
compose.yamltests/data/test-data.sql
Now that map_version.folder_name is a real column (faf-db V144), select it directly instead of deriving the folder name from the generated filename: - game_service.get_map() matches on folder_name (cache keyed on it too), dropping the "maps/<folder>.zip" round-trip. - ladder_service.fetch_map_pools() selects folder_name, removing the maps/(.+)\.zip regex (and the now-unused re import). The generated filename column still exists, so coop lookups and the replay server are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Nothing reads map_version.filename anymore now that folder_name is used directly, so remove it from the reflected table. coop_map keeps its own filename column. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The unit-test workflow builds the schema by cloning FAForever/db at FAF_DB_VERSION and running flyway; it was pinned to v143, which lacks the folder_name column. Bump it to v144 so the new column exists in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Why
faf-db V144 (FAForever/db#332, already deployed) makes
map_version.folder_namethe source-of-truth column and turnsfilenameinto a generated column (CONCAT('maps/', folder_name, '.zip')). This PR adapts the server's test data to the new schema and switches the server to readfolder_namedirectly, dropping its dependence onfilenameentirely.What
Test fixture
tests/data/test-data.sql: themap_versioninsert now providesfolder_name(e.g.scmp_001) instead offilename(now generated, so it can't be inserted).coop_mapkeeps its own realfilenamecolumn and is untouched.compose.yaml: bumpfaf-db-migrationsimage tov144.Production code — read
folder_namedirectlygame_service.get_map(): matches onfunc.lower(map_version.folder_name)and caches byfolder_name, dropping themaps/<folder>.zipround-trip and thefilenamelower-compare.ladder_service.fetch_map_pools(): selectsfolder_namedirectly, removing there.match(r"maps/(.+)\.zip", ...)parsing (and the now-unusedimport re).db/models.py: removed thefilenamecolumn from the reflectedmap_versiontable — nothing reads it anymore.coop_map.filename(a separate table) remains.Not changed
Coop map lookups (
coop_map.filename, a different table) and any client-facing coopfilenamepayloads are untouched. The DB still has a generatedmap_version.filenamecolumn for other consumers; the server simply no longer references it.Validation
pipenv run isort --checkandpipenv run mypyclean (only pre-existing missing-stub warnings);py_compileclean. Schema + fixture verified to load against the v144 migrations image.🤖 Generated with Claude Code