Skip to content

feat(boost_usage): resolve missing headers via catalog lookup (138)#140

Open
snowfox1003 wants to merge 1 commit intocppalliance:developfrom
snowfox1003:feature/138
Open

feat(boost_usage): resolve missing headers via catalog lookup (138)#140
snowfox1003 wants to merge 1 commit intocppalliance:developfrom
snowfox1003:feature/138

Conversation

@snowfox1003
Copy link
Copy Markdown
Collaborator

@snowfox1003 snowfox1003 commented Apr 10, 2026

  • Match Boost headers using include/ catalog filenames with disambiguation
  • Add resolve_missing_header_tmp_auto / resolve_all_missing_header_tmp_batch; run
    batch before monitor_content in run_boost_usage_tracker
  • Improve BoostMissingHeaderTmp admin (columns, search, resolve action)
  • GitHubRepository.full_name; richer GitHubRepository/GitHubFile admin

Summary by CodeRabbit

Release Notes

  • New Features

    • Added bulk action to resolve missing boost headers in the admin interface.
    • Enhanced admin search to query across related repository and file data.
    • Improved admin displays with additional repository metadata and file information.
    • Added inline editing for repository languages.
  • Documentation

    • Added service API documentation for header resolution functionality.

@snowfox1003 snowfox1003 self-assigned this Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

Implements a workflow for resolving missing Boost header placeholders through admin actions and service layer functions. Adds header catalog lookup with disambiguation, placeholder deletion logic, auto-resolution workflows, and batch processing with dry-run support. Integrates resolution into management command execution and admin interface.

Changes

Cohort / File(s) Summary
Service Layer Enhancements
boost_usage_tracker/services.py
Added header catalog lookup functions (boost_catalog_filename, find_boost_files_exact_by_catalog_names, find_boost_file_for_header_name_detailed, find_boost_file_for_header_name) with disambiguation for ambiguous matches. Introduced missing-header placeholder resolution: delete_boost_missing_header_tmp, maybe_delete_placeholder_boost_usage_after_tmp_removed, resolve_missing_header_tmp_auto (with resolution status tags), and resolve_all_missing_header_tmp_batch (batch with dry-run support). Updated type signatures for create_or_update_boost_usage and bulk_create_or_update_boost_usage to use concrete BoostFile instead of forward-referenced strings.
Post-Processing Integration
boost_usage_tracker/post_process.py
Refactored _resolve_boost_headers_bulk() to use new service-layer APIs for exact catalog matching and fallback resolution. Removed legacy local _resolve_boost_header() implementation that used suffix-based scanning.
Admin Interface & Actions
boost_usage_tracker/admin.py
Enhanced BoostMissingHeaderTmpAdmin with computed display fields (usage_repo, usage_file_path), expanded search/filtering on related usage objects, added list_select_related optimization, and introduced resolve_selected_if_in_catalog bulk admin action that processes selected rows and reports aggregated outcomes.
Management Command Integration
boost_usage_tracker/management/commands/run_boost_usage_tracker.py
Added pre-processing call to resolve_all_missing_header_tmp_batch(dry_run=dry_run) before monitor_content task execution, with logging of results.
GitHub Activity Models & Admin
github_activity_tracker/models.py, github_activity_tracker/admin.py
Added GitHubRepository.full_name property and __str__ method. Enhanced GitHubRepositoryAdmin with full_name display, related field optimization, and RepoLanguageInline. Extended GitHubFileAdmin with computed display fields for repo_full_name, previous_path, boost_library_name and improved search/filtering across related objects.
Testing & Documentation
boost_usage_tracker/tests/test_services.py, docs/service_api/boost_usage_tracker.md
Added comprehensive tests for header catalog lookup (exact matching, disambiguation, ambiguity detection) and missing-header resolution flows (auto-resolution, dry-run batch processing). Documented new service functions with behavior specifications, disambiguation rules, resolution status outcomes, and batch processing dry-run capability.

Sequence Diagram(s)

sequenceDiagram
    actor Admin as Admin User
    participant AdminUI as Admin Interface
    participant Services as Service Layer
    participant DB as Database
    
    Admin->>AdminUI: Select tmp records & click<br/>resolve_selected_if_in_catalog
    AdminUI->>Services: resolve_missing_header_tmp_auto(tmp)<br/>[for each selected]
    loop For each BoostMissingHeaderTmp
        Services->>DB: Query BoostFile via<br/>find_boost_file_for_header_name
        DB-->>Services: BoostFile or None/ambiguous
        alt Found BoostFile
            Services->>DB: Create/update BoostUsage
            Services->>DB: Delete BoostMissingHeaderTmp
            Services->>DB: Maybe delete placeholder usage
            Services-->>AdminUI: "resolved"
        else Ambiguous or Not Found
            Services-->>AdminUI: "skipped_ambiguous"<br/>or "skipped_no_match"
        end
    end
    AdminUI->>Admin: Display aggregated<br/>resolution counts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Possibly related issues

Possibly related PRs

  • #20-add boost-usage-tracker app #71: Modifies the same boost_usage_tracker modules (admin.py, services.py, post_process.py, run_boost_usage_tracker.py) with overlapping concerns around header resolution and Boost file handling.

Suggested labels

enhancement

Suggested reviewers

  • jonathanMLDev

Poem

🐰 Headers were lost in the catalog's deep maze,
So we built a resolver to clear up the haze,
With admin-side clicks and batch-processing flows,
The ambiguous headers now find where truth goes,
Placeholders resolved, the data now glows! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(boost_usage): resolve missing headers via catalog lookup (138)' directly summarizes the main change: implementing header resolution via catalog lookup as described throughout the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@snowfox1003
Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
boost_usage_tracker/post_process.py (1)

45-47: Docstring mentions "suffix fallback" but implementation uses exact matching only.

The docstring says "unresolved paths are then handled by suffix fallback," but find_boost_file_for_header_name_detailed explicitly avoids substring/endswith matching (per the service layer comment at lines 245-247 in services.py). Consider updating the docstring to reflect the actual behavior:

📝 Suggested docstring fix
     """Resolve a set of Boost include paths to BoostFile instances in one pass.

     Returns a dict ``{header_path: BoostFile | None}``.  Deduplicates the
-    incoming paths and performs one bulk exact-match query on
-    ``include/<header_path>`` first; unresolved paths are then handled by
-    suffix fallback.
+    incoming paths and performs one bulk exact-match query on
+    ``include/<header_path>`` first; unresolved paths are then checked
+    individually (still exact-match only, no suffix fallback).
     """
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@boost_usage_tracker/post_process.py` around lines 45 - 47, The docstring for
find_boost_file_for_header_name_detailed incorrectly claims that unresolved
paths are handled by a "suffix fallback"; update the docstring to accurately
describe the actual behavior (it performs only exact matches against
"include/<header_path>" and does not perform substring/endswith matching per the
service-layer restriction referenced in services.py), removing any mention of
suffix fallback and clarifying that unmatched headers are not resolved via
substring matching.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@boost_usage_tracker/post_process.py`:
- Around line 45-47: The docstring for find_boost_file_for_header_name_detailed
incorrectly claims that unresolved paths are handled by a "suffix fallback";
update the docstring to accurately describe the actual behavior (it performs
only exact matches against "include/<header_path>" and does not perform
substring/endswith matching per the service-layer restriction referenced in
services.py), removing any mention of suffix fallback and clarifying that
unmatched headers are not resolved via substring matching.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e5c35fc0-4922-48a3-af77-7a0ef0b48200

📥 Commits

Reviewing files that changed from the base of the PR and between b59fc99 and 4b8ad04.

📒 Files selected for processing (8)
  • boost_usage_tracker/admin.py
  • boost_usage_tracker/management/commands/run_boost_usage_tracker.py
  • boost_usage_tracker/post_process.py
  • boost_usage_tracker/services.py
  • boost_usage_tracker/tests/test_services.py
  • docs/service_api/boost_usage_tracker.md
  • github_activity_tracker/admin.py
  • github_activity_tracker/models.py

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.

1 participant