feat(data): normalize player dataset to 2022 FIFA World Cup squad#557
feat(data): normalize player dataset to 2022 FIFA World Cup squad#557nanotaboada merged 3 commits intomasterfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughTests and fixtures were updated to normalize the seeded Argentina squad to a 26-player Nov‑2022 snapshot with deterministic UUID v5 IDs; test DB switched to in-memory for CI; player fixtures and REST examples retargeted (create: squad 27, existing/update: squad 23); changelog and package version bumped. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Assessment against linked issues
Out-of-scope changes
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #557 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 128 128
Branches 20 20
=========================================
Hits 128 128
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
tests/player-test.ts (1)
141-148: Tighten this POST smoke test to a single expected status.
playerStub.nonexistentis supposed to be absent at test start, and the suite already deletes squad 27 inafterEach. Accepting409here just hides leaked state instead of surfacing it.Suggested assertion change
it('Request POST /players within rate limit → Response processed', async () => { // Arrange const body = playerStub.nonexistent; // Act const response = await request(app).post('/players').send(body); // Assert - expect([201, 409]).toContain(response.status); + expect(response.status).toBe(201); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/player-test.ts` around lines 141 - 148, The test "Request POST /players within rate limit → Response processed" currently allows either 201 or 409 which masks leaked state; tighten it to assert only the created status by replacing the flexible assertion with a strict expect(response.status).toBe(201) for the POST to '/players' when using playerStub.nonexistent, and remove the acceptance of 409 so failures surface; update the test named exactly as above (and referencing playerStub.nonexistent and the POST '/players' call) to enforce a single expected status.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Around line 53-67: Update the release notes to match the PR: replace the
statement "playerStub.update added" with an explanation that the fixtures were
renamed to playerStub.nonexistent and playerStub.existing (and remove any
reference to a newly added playerStub.update), and add a Docker volume-refresh
instruction referencing `#551` (note that users must run `docker compose down -v`
to pick up the rebuilt seeded DB); ensure the rest of the 2.1.0-dribble
"Changed" entries remain accurate (e.g., deterministic UUID v5 namespace
f201b13e-c670-473d-885d-e2be219f74c8, squad retargeting to 23/27, and player
substitutions).
In `@rest/players.rest`:
- Around line 50-59: The PUT example in players.rest omits "middleName": null so
the controller that forwards the request body as-is (player-controller ->
updatePlayer) preserves the seeded middleName instead of clearing it; add
"middleName": null to the given JSON payloads (both occurrences referenced in
the comment) so the PUT demonstrates a clear-to-null update when forwarded by
updatePlayer in the player controller.
In `@tests/player-test.ts`:
- Around line 275-279: The afterEach cleanup currently ignores the response from
request(app).put(...).send(...), so capture the response in the afterEach block
and assert it succeeded (e.g., expect status to be 200/204 and/or verify
returned body indicates success) when restoring
playerStub.findBySquadNumber(playerStub.existing.squadNumber) at
path/squadNumber/: use the same afterEach and request(app).put(...).send(...)
call, check the response status and throw or fail the test if the restore did
not succeed to prevent leaked mutated state.
---
Nitpick comments:
In `@tests/player-test.ts`:
- Around line 141-148: The test "Request POST /players within rate limit →
Response processed" currently allows either 201 or 409 which masks leaked state;
tighten it to assert only the created status by replacing the flexible assertion
with a strict expect(response.status).toBe(201) for the POST to '/players' when
using playerStub.nonexistent, and remove the acceptance of 409 so failures
surface; update the test named exactly as above (and referencing
playerStub.nonexistent and the POST '/players' call) to enforce a single
expected status.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fb650106-861b-4cc0-8fe0-17f6d1666f91
⛔ Files ignored due to path filters (1)
storage/players-sqlite3.dbis excluded by!**/*.db,!**/storage/**,!**/*.db
📒 Files selected for processing (7)
.env.test.gitignoreCHANGELOG.mdpackage.jsonrest/players.resttests/player-stub.tstests/player-test.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|



Closes #551
Summary
storage/players-sqlite3.dbwith all 26 players (11 starters + 15 substitutes), using deterministic UUID v5 values and correcting data errors (Di MaríaabbrPosition, Enzo Fernández, Mac Allister, Messi team/league)playerStub.allto 26 players; renames fixtures tononexistent(Lo Celso, squad 27) andexisting(Martínez, squad 23) for consistency with test description vocabularybeforeEachPOST, addsafterEachrestore; all tests retargeted to always-seeded squad 23STORAGE_PATH=:memory:) viabeforeAllseed — production DB is never touched during test runsrest/players.restand bumps version to2.1.0-dribbleTest plan
npm run lintpasses cleannpx tsc --noEmitpasses cleannpm run coverage— 32 tests pass, 100% coverage maintainedstorage/players-sqlite3.dbno longer appears ingit diffafter running testsGET /playersreturns 26 players matching corrected datasetPOST /playerswith Lo Celso (squad 27) returns 201GET /players/squadNumber/10returns Messi withteam: 'Paris Saint-Germain'PUT /players/squadNumber/23with Emiliano body returns 204DELETE /players/squadNumber/27after POST returns 204🤖 Generated with Claude Code
This change is
Summary by CodeRabbit