Skip to content

Add cacheSingleOpenCourseData helper and tests; use it in batch fetch#19

Open
ntornberg wants to merge 2 commits intomasterfrom
update-batchfetchcoursesdata-implementation-zsydqu
Open

Add cacheSingleOpenCourseData helper and tests; use it in batch fetch#19
ntornberg wants to merge 2 commits intomasterfrom
update-batchfetchcoursesdata-implementation-zsydqu

Conversation

@ntornberg
Copy link
Owner

Motivation

  • Reduce duplicated cache-write logic for open course entries and ensure consistent cache key usage across code paths.
  • Make cache writes for single open-course entries reusable and robust to missing hash keys.

Description

  • Added a new helper cacheSingleOpenCourseData in src/course-management/services/api/DialogMenuSearch/dataService.ts that writes a single course into the openCourses cache and updates the in-memory openCoursesCache, while warning and returning early when the hash key is missing.
  • Replaced inline cache-write logic inside batchFetchCoursesData with calls to cacheSingleOpenCourseData to centralize behavior and remove duplication.
  • Added unit tests in src/course-management/services/api/DialogMenuSearch/dataService.test.ts that include a chrome storage mock and validate both successful cache writes and the skip behavior when a hash key is missing.

Testing

  • Executed the new unit tests with node --test src/course-management/services/api/DialogMenuSearch/dataService.test.ts, and both tests passed.
  • The tests verify that getGenericCache returns the stored combinedData matching the JSON-serialized course and that missing hash keys produce no cache writes.

Codex Task

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Warning

Rate limit exceeded

@ntornberg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 27 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15c97eb5-6827-4ef3-90ee-c6466f6801bd

📥 Commits

Reviewing files that changed from the base of the PR and between 8b9423f and 4d4ea37.

📒 Files selected for processing (2)
  • src/course-management/services/api/DialogMenuSearch/dataService.test.ts
  • src/course-management/services/api/DialogMenuSearch/dataService.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-batchfetchcoursesdata-implementation-zsydqu

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant