Skip to content

feat(data): normalize player dataset to 2022 FIFA World Cup squad#557

Merged
nanotaboada merged 3 commits intomasterfrom
feat/normalize-player-dataset-551
Mar 30, 2026
Merged

feat(data): normalize player dataset to 2022 FIFA World Cup squad#557
nanotaboada merged 3 commits intomasterfrom
feat/normalize-player-dataset-551

Conversation

@nanotaboada
Copy link
Copy Markdown
Owner

@nanotaboada nanotaboada commented Mar 30, 2026

Closes #551

Summary

  • Recreates storage/players-sqlite3.db with all 26 players (11 starters + 15 substitutes), using deterministic UUID v5 values and correcting data errors (Di María abbrPosition, Enzo Fernández, Mac Allister, Messi team/league)
  • Expands playerStub.all to 26 players; renames fixtures to nonexistent (Lo Celso, squad 27) and existing (Martínez, squad 23) for consistency with test description vocabulary
  • Restructures PUT tests: removes beforeEach POST, adds afterEach restore; all tests retargeted to always-seeded squad 23
  • Switches tests to in-memory SQLite (STORAGE_PATH=:memory:) via beforeAll seed — production DB is never touched during test runs
  • Updates rest/players.rest and bumps version to 2.1.0-dribble

Test plan

  • npm run lint passes clean
  • npx tsc --noEmit passes clean
  • npm run coverage — 32 tests pass, 100% coverage maintained
  • storage/players-sqlite3.db no longer appears in git diff after running tests
  • GET /players returns 26 players matching corrected dataset
  • POST /players with Lo Celso (squad 27) returns 201
  • GET /players/squadNumber/10 returns Messi with team: 'Paris Saint-Germain'
  • PUT /players/squadNumber/23 with Emiliano body returns 204
  • DELETE /players/squadNumber/27 after POST returns 204

🤖 Generated with Claude Code


This change is Reviewable

Summary by CodeRabbit

  • Tests
    • Tests now run against an in-memory SQLite DB with one-time seeding; fixtures and expectations updated (new seeded dataset, renamed fixtures, tightened assertions, and adjusted request payloads).
  • Documentation
    • Changelog updated with the in-memory test note and a new 2.1.0-dribble release entry documenting dataset and fixture changes.
  • Chores
    • Package version bumped to 2.1.0-dribble; repository ignore patterns broadened for SQLite WAL/SHM files.

nanotaboada and others added 2 commits March 30, 2026 10:21
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 09590ed2-9688-4af1-97b9-4df84bc3d5dd

📥 Commits

Reviewing files that changed from the base of the PR and between 20bab63 and ac8dd1d.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • rest/players.rest
  • tests/player-test.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • rest/players.rest
  • tests/player-test.ts

Walkthrough

Tests 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

Cohort / File(s) Summary
Test Configuration
\.env.test, \.gitignore
Set STORAGE_PATH=:memory: to run tests against in-memory SQLite; relaxed .gitignore patterns for SQLite WAL/SHM filenames (removed directory anchor).
Test Fixtures & Tests
tests/player-stub.ts, tests/player-test.ts
Replaced playerStub.new with playerStub.nonexistent (squad 27) and added playerStub.existing (squad 23); expanded playerStub.all to 26 players with UUID v5 ids and corrected attributes (e.g., Di María abbrPosition→RW); test setup now seeds all players in beforeAll; PUT suite uses afterEach to restore Martínez.
REST Examples & Metadata
rest/players.rest, CHANGELOG.md, package.json
Updated REST client vars/bodies (@newSquadNumber=27, @existingSquadNumber=23), revised CHANGELOG with release notes, and bumped package version to 2.1.0-dribble.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Normalize player dataset to 26 rows with UUID v5 ids and corrected player attributes (#551)
Replace create/delete fixture with Lo Celso (squad 27) and add update fixture for Martínez (squad 23) (#551)
Adjust tests: seed all players once; use afterEach to restore Martínez for PUT tests; retarget tests to squads 27/23 (#551)
Update rest examples, CHANGELOG and bump version to 2.1.0-dribble (#551)
Recreate on-disk storage/players-sqlite3.db seeded file with 26 rows (#551) No diff shows a regenerated on-disk DB or migration/seed script targeting storage/players-sqlite3.db; only test seeding and docs/changelog changes are present.

Out-of-scope changes

Code Change Explanation
Relax .gitignore SQLite WAL/SHM patterns (.gitignore) Not mentioned in linked issue objectives; it affects repo ignore scope but is unrelated to dataset normalization or test seeding.

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title uses Conventional Commits format (feat:), is 65 characters (under 80), and accurately describes the main change: normalizing the player dataset to the 2022 FIFA World Cup squad.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/normalize-player-dataset-551
  • 🛠️ sync documentation: Commit on current branch
  • 🛠️ sync documentation: Create PR
  • 🛠️ enforce http error handling: Commit on current branch
  • 🛠️ enforce http error handling: Create PR
  • 🛠️ idiomatic review: Commit on current branch
  • 🛠️ idiomatic review: Create PR
  • 🛠️ verify api contract: Commit on current branch
  • 🛠️ verify api contract: Create PR

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5ea19d1) to head (ac8dd1d).
⚠️ Report is 4 commits behind head on master.

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           
Components Coverage Δ
Services 100.00% <ø> (ø)
Controllers 100.00% <ø> (ø)
Routes 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.nonexistent is supposed to be absent at test start, and the suite already deletes squad 27 in afterEach. Accepting 409 here 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea19d1 and 20bab63.

⛔ Files ignored due to path filters (1)
  • storage/players-sqlite3.db is excluded by !**/*.db, !**/storage/**, !**/*.db
📒 Files selected for processing (7)
  • .env.test
  • .gitignore
  • CHANGELOG.md
  • package.json
  • rest/players.rest
  • tests/player-stub.ts
  • tests/player-test.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@nanotaboada nanotaboada merged commit dc5bb28 into master Mar 30, 2026
12 checks passed
@nanotaboada nanotaboada deleted the feat/normalize-player-dataset-551 branch March 30, 2026 15:16
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.

Normalize player dataset to 2022 FIFA World Cup squad (26 players)

1 participant