Skip to content

Use map_version.folder_name instead of filename#1096

Merged
Brutus5000 merged 4 commits into
developfrom
feature/map-version-folder-name
Jun 25, 2026
Merged

Use map_version.folder_name instead of filename#1096
Brutus5000 merged 4 commits into
developfrom
feature/map-version-folder-name

Conversation

@Brutus5000

@Brutus5000 Brutus5000 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why

faf-db V144 (FAForever/db#332, already deployed) makes map_version.folder_name the source-of-truth column and turns filename into 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 read folder_name directly, dropping its dependence on filename entirely.

What

Test fixture

  • tests/data/test-data.sql: the map_version insert now provides folder_name (e.g. scmp_001) instead of filename (now generated, so it can't be inserted). coop_map keeps its own real filename column and is untouched.
  • compose.yaml: bump faf-db-migrations image to v144.

Production code — read folder_name directly

  • game_service.get_map(): matches on func.lower(map_version.folder_name) and caches by folder_name, dropping the maps/<folder>.zip round-trip and the filename lower-compare.
  • ladder_service.fetch_map_pools(): selects folder_name directly, removing the re.match(r"maps/(.+)\.zip", ...) parsing (and the now-unused import re).
  • db/models.py: removed the filename column from the reflected map_version table — 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 coop filename payloads are untouched. The DB still has a generated map_version.filename column for other consumers; the server simply no longer references it.

Validation

pipenv run isort --check and pipenv run mypy clean (only pre-existing missing-stub warnings); py_compile clean. Schema + fixture verified to load against the v144 migrations image.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Brutus5000, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3fb7f612-a505-422f-9077-3f90455c70bd

📥 Commits

Reviewing files that changed from the base of the PR and between 7a43406 and 589192e.

📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • server/db/models.py
  • server/game_service.py
  • server/ladder_service/ladder_service.py
📝 Walkthrough

Walkthrough

Updated the database migration service image tag and changed the map_version test seed data to use folder_name values instead of ZIP-path filenames.

Changes

Database migration refresh

Layer / File(s) Summary
Migration image tag update
compose.yaml
The faf-db-migrations service image tag changes from v143 to v144.
Map version seed columns
tests/data/test-data.sql
The map_version seed insert now uses folder_name and updates the inserted row values to folder identifiers.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 I hopped through the migration gate,
with fresh new tags and seeds thatేట్? wait no!
Folder names now burrow neat and small,
while zip-path trails are gone from the hall.
Carrot confetti! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main schema-related change to use map_version.folder_name instead of filename.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/map-version-folder-name

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49681ba and 7a43406.

📒 Files selected for processing (2)
  • compose.yaml
  • tests/data/test-data.sql

Comment thread compose.yaml
Brutus5000 and others added 2 commits June 25, 2026 00:07
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>
@Brutus5000 Brutus5000 changed the title Adapt map_version test data to folder_name column Use map_version.folder_name instead of filename Jun 24, 2026
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>
@Brutus5000 Brutus5000 merged commit ac6d11d into develop Jun 25, 2026
9 of 10 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.

1 participant