Skip to content

Print platform version from AOSP repo manifest#59

Merged
soimkim merged 1 commit into
mainfrom
platform
May 13, 2026
Merged

Print platform version from AOSP repo manifest#59
soimkim merged 1 commit into
mainfrom
platform

Conversation

@soimkim

@soimkim soimkim commented May 11, 2026

Copy link
Copy Markdown
Contributor

Description

  • Improved Android platform version detection with a more robust extraction method and automatic fallback mechanism for enhanced reliability.

@soimkim soimkim self-assigned this May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d06fc926-179a-4571-a3c2-b2dea6adab52

📥 Commits

Reviewing files that changed from the base of the PR and between 1849743 and 7aa2658.

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

Walkthrough

The script now extracts Android platform version preferentially from .repo/manifests XML files by scanning for AOSP remotes and normalizing revision strings. New helper functions parse the manifest structure and normalize tag/branch prefixes; the environment setup function accepts the source path and calls these helpers, falling back to log parsing if manifest extraction fails. The main entry point wires the source path through the updated function signature.

Changes

Manifest-based Platform Version Extraction

Layer / File(s) Summary
Module Imports
src/fosslight_android/android_binary_analysis.py
Added glob and xml.etree.ElementTree imports to support manifest file discovery and XML parsing.
Manifest Parsing Helpers
src/fosslight_android/android_binary_analysis.py
New helper functions extract normalized platform/revision values from .repo/manifests XML by selecting AOSP remotes, parsing the manifest structure, and stripping common tag/branch/revision prefixes.
Environment Setup Integration
src/fosslight_android/android_binary_analysis.py
set_env_variables_from_result_log() signature now accepts android_src_path parameter to locate manifest files; manifest-based extraction is attempted first before falling back to log-line parsing.
Main Entry Point Wiring
src/fosslight_android/android_binary_analysis.py
main() is updated to pass android_src_path to set_env_variables_from_result_log() to enable manifest-based lookups.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

chore

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title 'Print platform version from AOSP repo manifest' clearly and specifically describes the main change: extracting platform version from Android manifest files rather than logs.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch platform

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@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/android_binary_analysis.py (1)

13-13: ⚡ Quick win

Consider using defusedxml for XML parsing as defense-in-depth hardening.

ET.parse(xml_path) at line 249 parses local .repo/manifests/*.xml files. While these are trusted repository-managed files (not untrusted external input), using defusedxml.ElementTree is an optional defense-in-depth improvement against potential XML-based attacks. The current exception handling (except ET.ParseError: continue) is already appropriate and specific.

If adopted, add defusedxml to pyproject.toml dependencies and update:

-import xml.etree.ElementTree as ET
+from defusedxml import ElementTree as ET
🤖 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/android_binary_analysis.py` at line 13, Replace the
stdlib xml.etree.ElementTree import with defusedxml.ElementTree to harden XML
parsing: change the import to use defusedxml.ElementTree (so existing calls like
ET.parse(...) in function(s) that process local repo manifests, e.g., the
ET.parse(xml_path) at/around the current parse site) and keep the existing
ET.ParseError handling intact; also add defusedxml to pyproject.toml
dependencies. Ensure no other references rely on stdlib-specific behavior and
run tests to verify parsing continues to work.
🤖 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/android_binary_analysis.py`:
- Around line 266-276: The loop over android_log_lines swallows all exceptions
with "except Exception: pass", obscuring parsing failures; replace that broad
catcher with specific exception handlers (e.g., except re.error, IndexError,
AttributeError as e) and log the failure at debug including the offending line
content and the exception (use the module logger or
logging.getLogger(__name__)), so when evaluating pattern = re.compile(...) and
extracting matched.group(1) you record debug-level details while still allowing
unexpected exceptions to surface.

---

Nitpick comments:
In `@src/fosslight_android/android_binary_analysis.py`:
- Line 13: Replace the stdlib xml.etree.ElementTree import with
defusedxml.ElementTree to harden XML parsing: change the import to use
defusedxml.ElementTree (so existing calls like ET.parse(...) in function(s) that
process local repo manifests, e.g., the ET.parse(xml_path) at/around the current
parse site) and keep the existing ET.ParseError handling intact; also add
defusedxml to pyproject.toml dependencies. Ensure no other references rely on
stdlib-specific behavior and run tests to verify parsing continues to work.
🪄 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: d595267c-5de8-40a5-8812-ca378566db7f

📥 Commits

Reviewing files that changed from the base of the PR and between f856256 and 1849743.

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

Comment thread src/fosslight_android/android_binary_analysis.py
@soimkim soimkim changed the title d Print platform version from AOSP repo manifest May 11, 2026
@soimkim soimkim added the enhancement New feature or request label May 11, 2026
@soimkim
soimkim merged commit 48005ae into main May 13, 2026
7 checks passed
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