Skip to content

Replace Binary DB direct access with ldb_service API - #63

Merged
soimkim merged 4 commits into
mainfrom
api
Jul 31, 2026
Merged

soimkim merged 4 commits into
mainfrom
api

Conversation

@soimkim

@soimkim soimkim commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

soimkim and others added 2 commits July 24, 2026 13:57
Reduce batch size to lower timeout risk on large Android binary scans.

Co-authored-by: Cursor <cursoragent@cursor.com>
@soimkim soimkim self-assigned this Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@soimkim, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e85aaa18-629d-4c1a-9261-845df15bb4d1

📥 Commits

Reviewing files that changed from the base of the PR and between e82f6f2 and 7dff9e6.

📒 Files selected for processing (1)
  • src/fosslight_android/_binary_db_controller.py
📝 Walkthrough

Walkthrough

The Android scanner replaces its PostgreSQL-based OSS lookup with chunked HTTP requests to ldb_service, applies returned metadata to binary records, and invokes enrichment directly after deduplication. The PostgreSQL dependency and multiprocessing lookup wiring are removed.

Changes

HTTP Binary Match Integration

Layer / File(s) Summary
HTTP lookup configuration and transport
pyproject.toml, src/fosslight_android/_binary_db_controller.py
KB URL/token resolution, /binary/match request handling, timeout and chunk settings, and HTTP error handling replace the database connection path.
Payload deduplication and result enrichment
src/fosslight_android/_binary_db_controller.py
Binary records are deduplicated by filename and checksum, sent in chunks, and updated with matched OSS metadata or new-binary status.
Analysis pipeline integration
src/fosslight_android/android_binary_analysis.py
OSS enrichment is called directly without platform_version, partial, or multiprocessing.

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

Sequence Diagram(s)

sequenceDiagram
  participant AndroidAnalysis
  participant get_oss_info_from_db
  participant ldb_service
  AndroidAnalysis->>get_oss_info_from_db: pass deduplicated bin_info_list
  get_oss_info_from_db->>ldb_service: POST chunk to /binary/match
  ldb_service-->>get_oss_info_from_db: return binary match results
  get_oss_info_from_db-->>AndroidAnalysis: return enriched bin_info_list
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so it does not convey meaningful information about the changeset. Add a brief description explaining the migration to ldb_service API, configuration changes, and updated OSS lookup behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing direct Binary DB access with the ldb_service API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch api

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.

@soimkim soimkim added the enhancement New feature or request label Jul 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_android/_binary_db_controller.py`:
- Line 18: Update the DEFAULT_KB_URL constant to use the HTTPS scheme for the
Fosslight KB endpoint, preserving the existing host and trailing slash.
- Line 21: Validate BINARY_MATCH_CHUNK_SIZE when initializing _CHUNK_SIZE,
rejecting non-integer and non-positive values before scanner startup. Preserve
the existing default for an unset variable and ensure invalid configuration
fails with a clear validation error instead of producing unusable chunking
behavior.
- Around line 107-111: Update the response handling in the binary matching flow
around _post_binary_match so a successful response is accepted only when its
results field is a list; treat a missing or non-list results value like an API
failure and return the original bin_info_list without marking items as new.
Preserve the existing empty-list behavior for valid responses that explicitly
contain results: [].
🪄 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 Plus

Run ID: f0eee34e-3ebc-4094-8609-51837ff3fc36

📥 Commits

Reviewing files that changed from the base of the PR and between 6c4becc and 880b9f7.

📒 Files selected for processing (3)
  • pyproject.toml
  • src/fosslight_android/_binary_db_controller.py
  • src/fosslight_android/android_binary_analysis.py
💤 Files with no reviewable changes (1)
  • pyproject.toml

Comment thread src/fosslight_android/_binary_db_controller.py
Comment thread src/fosslight_android/_binary_db_controller.py Outdated
Comment thread src/fosslight_android/_binary_db_controller.py Outdated
Log reachable/unreachable status for fosslight-kb so operators can see
connection outcome in the log file without relying on debug level.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/fosslight_android/_binary_db_controller.py (1)

117-119: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Narrow the broad exception boundaries.

Both catches turn programming, schema, and parsing defects into a normal “return original list” path, allowing OSS enrichment to silently disappear. Catch only expected transport/JSON failures and preserve traceback or re-raise unexpected errors. Please verify the intended exception set against the project’s supported Python target.

Also applies to: 164-166

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_android/_binary_db_controller.py` around lines 117 - 119, In
the exception handlers surrounding the binary match API calls in the relevant
controller methods, replace broad Exception catches with the specific transport
and JSON/parsing exceptions supported by the project’s Python versions. Preserve
the existing fallback list behavior only for those expected failures, while
allowing programming, schema, and other unexpected errors to propagate with
their traceback.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_android/_binary_db_controller.py`:
- Around line 156-159: Update the warning in the binary match request
error-handling path to avoid logging the full body variable. Log only the HTTP
status code and a bounded, sanitized summary derived from ex.reason, preserving
the existing reachable-but-match-failed context.

---

Nitpick comments:
In `@src/fosslight_android/_binary_db_controller.py`:
- Around line 117-119: In the exception handlers surrounding the binary match
API calls in the relevant controller methods, replace broad Exception catches
with the specific transport and JSON/parsing exceptions supported by the
project’s Python versions. Preserve the existing fallback list behavior only for
those expected failures, while allowing programming, schema, and other
unexpected errors to propagate with their traceback.
🪄 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 Plus

Run ID: 39778b36-b7d7-4ad9-ae2b-3afc05ad7183

📥 Commits

Reviewing files that changed from the base of the PR and between 880b9f7 and e82f6f2.

📒 Files selected for processing (1)
  • src/fosslight_android/_binary_db_controller.py

Comment thread src/fosslight_android/_binary_db_controller.py Outdated
Skip only the failed chunk and keep going; stop remaining chunks only
when KB is unreachable so partial match results are still applied.
@soimkim
soimkim merged commit fbd0cd1 into main Jul 31, 2026
5 of 7 checks passed
@soimkim
soimkim deleted the api branch July 31, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant