Skip to content

Allow getting a word from the Frontier#4148

Merged
imnasnainaec merged 3 commits intomasterfrom
word-repo-get-frontier
Feb 16, 2026
Merged

Allow getting a word from the Frontier#4148
imnasnainaec merged 3 commits intomasterfrom
word-repo-get-frontier

Conversation

@imnasnainaec
Copy link
Copy Markdown
Collaborator

@imnasnainaec imnasnainaec commented Feb 13, 2026

Important piece of #4146 (though the payoff of this pr alone is small)

Purpose: Without this, whenever we want a frontier word, it requires a 2-part operation: getting the word from WordsCollection then confirming that it's in FrontierCollection.


This change is Reviewable

Summary by CodeRabbit

  • Bug Fixes

    • Made frontier lookups consistent across audio upload, deletion, and duplicate handling to prevent incorrect audio associations and assertion failures.
  • Refactor

    • Split frontier access into a bulk retrieval and a targeted lookup to clarify list vs single-item behavior and improve data consistency.
  • Tests

    • Updated tests and mocks to align with the revised frontier retrieval patterns and ensure assertions reflect the new behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 13, 2026

Warning

Rate limit exceeded

@imnasnainaec has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Renamed the repository bulk frontier method to GetAllFrontier(projectId), added a single-item GetFrontier(projectId, wordId, audioFileName?), and updated controllers, services, repository, tests, and mocks to use the new API surface and nullable single-word semantics.

Changes

Cohort / File(s) Summary
Interface & Repository
Backend/Interfaces/IWordRepository.cs, Backend/Repositories/WordRepository.cs
Removed old GetFrontier(projectId) list method; added GetAllFrontier(projectId) (bulk) and GetFrontier(projectId, wordId, audioFileName?) (single, nullable); repository implements both.
Controllers
Backend/Controllers/WordController.cs, Backend/Controllers/AudioController.cs
List retrievals switched to GetAllFrontier(...); single-word lookups now call GetFrontier(projectId, wordId, ...) instead of prior GetWord/old variants.
Services
Backend/Services/...
LiftService.cs, MergeService.cs, StatisticsService.cs, WordService.cs, MergeService.cs
Internal calls updated from GetFrontier(projectId) to GetAllFrontier(projectId); WordService and other flows use GetFrontier(...) for targeted lookups and handle nullable results.
Tests
Backend.Tests/Controllers/..., Backend.Tests/Services/...
Backend.Tests/Controllers/AudioControllerTests.cs, Backend.Tests/Controllers/WordControllerTests.cs, Backend.Tests/Services/MergeServiceTests.cs, Backend.Tests/Services/WordServiceTests.cs
All test call sites changed to GetAllFrontier for lists and to GetFrontier overload for single lookups; assertions adjusted to reflect renamed APIs and nullable single-item semantics.
Test Mocks
Backend.Tests/Mocks/WordRepositoryMock.cs
Mock renamed bulk method to GetAllFrontier, added single-item GetFrontier(projectId, wordId, audioFileName?), and renamed related delay/call-count fields and setters.
Other
Backend.Tests/..., other touched files
Consistent renames and minor refactors across codebase to align with new frontier API signatures and usages.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Ctrl as Controller
  participant Svc as Service
  participant Repo as Repository

  Client->>Ctrl: Request frontier list
  Ctrl->>Svc: GetAllFrontier(projectId)
  Svc->>Repo: GetAllFrontier(projectId)
  Repo-->>Svc: List<Word>
  Svc-->>Ctrl: List<Word>
  Ctrl-->>Client: 200 OK (list)

  Client->>Ctrl: Request single frontier word (with optional audio)
  Ctrl->>Svc: GetFrontier(projectId, wordId, audioFile?)
  Svc->>Repo: GetFrontier(projectId, wordId, audioFile?)
  Repo-->>Svc: Word? (nullable)
  Svc-->>Ctrl: Word or NotFound
  Ctrl-->>Client: 200 OK / 404 NotFound
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • jasonleenaylor

Poem

🐇 I hopped through code with a twitch and a grin,

One call to fetch many, one call to pin.
Tests tidied up, mocks learned the new dance,
Frontier split fine — give this change a chance.
🥕✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allow getting a word from the Frontier' accurately describes the main change: introducing new GetFrontier and GetAllFrontier methods to retrieve words directly from the Frontier rather than using the previous GetWord method.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch word-repo-get-frontier

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 Feb 13, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (bbbdacf) to head (363b527).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
Backend/Services/MergeService.cs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4148       +/-   ##
===========================================
+ Coverage   74.76%   86.12%   +11.36%     
===========================================
  Files         302       56      -246     
  Lines       11068     4829     -6239     
  Branches     1389      599      -790     
===========================================
- Hits         8275     4159     -4116     
+ Misses       2390      524     -1866     
+ Partials      403      146      -257     
Flag Coverage Δ
backend 86.12% <92.85%> (ø)
frontend ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

Am I missing a test that uses the new GetFrontier implementation?
I saw the mock was added but I don't think there are any tests which call GetFrontier.

@jasonleenaylor reviewed 12 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec).

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

:lgtm:

@jasonleenaylor reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec).

coderabbitai[bot]

This comment was marked as resolved.

@imnasnainaec imnasnainaec force-pushed the word-repo-get-frontier branch from c3a9af7 to e82d6a3 Compare February 16, 2026 20:20
coderabbitai[bot]

This comment was marked as resolved.

@imnasnainaec imnasnainaec force-pushed the word-repo-get-frontier branch from e82d6a3 to a6d0bfc Compare February 16, 2026 20:25
@imnasnainaec imnasnainaec force-pushed the word-repo-get-frontier branch from a6d0bfc to 363b527 Compare February 16, 2026 20:38
@imnasnainaec imnasnainaec merged commit 21b27bf into master Feb 16, 2026
15 of 16 checks passed
@imnasnainaec imnasnainaec deleted the word-repo-get-frontier branch February 16, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants