Skip to content

Adding DBL projects into create project dropdown - #313

Open
Joel-Joseph-George wants to merge 2 commits into
mainfrom
ft/dropdown-search
Open

Adding DBL projects into create project dropdown #313
Joel-Joseph-George wants to merge 2 commits into
mainfrom
ft/dropdown-search

Conversation

@Joel-Joseph-George

@Joel-Joseph-George Joel-Joseph-George commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added authenticated Bible search supporting language names, ISO codes, Bible names, and abbreviations.
    • Search results now include matching languages and a flat list of source Bibles.
    • Bible responses now display the provider information.
  • Tests

    • Added coverage for Bible search results, including grouped languages and matching Bible entries.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 9c8aeaef-c871-4b61-ae42-a0de779ad3e0

📥 Commits

Reviewing files that changed from the base of the PR and between c7c47dc and 523dc66.

📒 Files selected for processing (5)
  • src/domains/bibles/bibles.repository.test.ts
  • src/domains/bibles/bibles.repository.ts
  • src/domains/bibles/bibles.route.ts
  • src/domains/bibles/bibles.service.ts
  • src/domains/bibles/bibles.types.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Adds authenticated source Bible search with language grouping, flat Bible results, query filtering, response schemas, repository coverage, and provider mapping in standard Bible responses.

Changes

Source Bible Search

Layer / File(s) Summary
Response contracts
src/domains/bibles/bibles.types.ts, src/domains/bibles/bibles.service.ts
Adds source-search schemas and inferred types. Standard Bible responses now include provider.
Repository search and grouping
src/domains/bibles/bibles.repository.ts, src/domains/bibles/bibles.repository.test.ts
Queries joined Bible and language records with optional matching filters, limits results to 100 rows, groups results by language, and returns a flat Bible list. Tests mock the query chain and verify the response shape.
Authenticated search route
src/domains/bibles/bibles.route.ts, src/domains/bibles/bibles.service.ts
Adds authenticated GET /bibles/search, forwards the optional q parameter through the service, validates successful responses, and maps failures to HTTP responses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 523dc

This change adds authenticated Bible search results with language grouping and provider metadata in standard Bible responses. The supplied implementation and coverage indicate no remaining merge-blocking risk.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant searchBiblesRoute
  participant bibleService
  participant searchSourceBibles
  participant Database
  Client->>searchBiblesRoute: GET /bibles/search?q
  searchBiblesRoute->>bibleService: searchSourceBibles(q)
  bibleService->>searchSourceBibles: Forward query
  searchSourceBibles->>Database: Query matching Bibles and languages
  Database-->>searchSourceBibles: Return up to 100 rows
  searchSourceBibles-->>bibleService: Return grouped and flat results
  bibleService-->>searchBiblesRoute: Return result
  searchBiblesRoute-->>Client: Return response data or error
Loading

Suggested reviewers: anumonachan

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes the intended feature: adding DBL projects to the create-project dropdown. The changes add the source-bible search API and supporting types needed for that feature.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ft/dropdown-search

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.

@Joel-Joseph-George
Joel-Joseph-George marked this pull request as ready for review September 7, 2026 05:52

@kaseywright kaseywright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review found two correctness issues worth addressing before merge.

)
: undefined
)
.limit(100);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

searchSourceBibles uses .limit(100) with no ORDER BY, making results non-deterministic and able to silently drop matches. If a search matches more than 100 rows, Postgres gives no ordering guarantee for LIMIT without ORDER BY, so repeated identical requests can return a different subset of 100 rows (e.g. after autovacuum, index scans, or concurrent writes), causing the dropdown to show inconsistent or incomplete results. Every other .limit(n>1) query in this codebase pairs the limit with .orderBy(); this one is the outlier.

.innerJoin(languages, eq(bibles.languageId, languages.id))
.where(
cleanQuery.length > 0
? or(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

User-supplied search text is interpolated into a SQL LIKE pattern without escaping LIKE metacharacters (% and _). A search containing a literal underscore (e.g. an abbreviation like NIV_1) will also match unrelated rows like NIVX1 since _ is a LIKE wildcard for any single character. A literal % in the query would similarly broaden matches unexpectedly.

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.

2 participants