OpenCRE icon indicating copy to clipboard operation
OpenCRE copied to clipboard

feat(workstream-c): add cheatsheet categorizer and grouping

Open shreeshtripurwarcomp23-coder opened this issue 5 months ago • 5 comments

  • Implement categorize_cheatsheet() with 29-label controlled taxonomy
  • Implement group_cheatsheets() with stable sha256-based group IDs
  • Deterministic keyword/rule baseline, no LLM dependency
  • LLM-optional path with safe fallback on failure
  • Validate all CheatsheetRecord fields in post_init
  • 50 tests covering all acceptance criteria from RFC Issue C

Review Change Stack

[!NOTE]

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • [ ] ▶️ Resume reviews
  • [ ] 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: af50adff-c2d1-4dfd-aa58-5c95b33567c7

📥 Commits

Reviewing files that changed from the base of the PR and between 2592552fc6ac7767dc05c9890bb8c7640c3b9bef and 6ca28393724a7cd0dcf09579367a2d7bc6ddf0c0.

📒 Files selected for processing (1)
  • application/utils/external_project_parsers/parsers/cheatsheet_categorizer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • application/utils/external_project_parsers/parsers/cheatsheet_categorizer.py

Summary by CodeRabbit

  • New Features
    • Added Workstream C cheatsheet categorization with a controlled label vocabulary and an “uncategorized” fallback.
    • Implemented deterministic label extraction from title/headings and category hints, with an opt-in AI-assisted path and safe fallback when AI output is unusable.
    • Added grouping of cheatsheets by canonical label sets, including stable group IDs and consistent ordering.
  • Tests
    • Added end-to-end and unit tests covering taxonomy rules, deterministic outputs, fallback behavior, AI-path handling, and grouping semantics.

Walkthrough

Adds a cheatsheet categorizer with controlled taxonomy labels, deterministic and LLM-assisted categorization, stable grouping by label set, and a unittest suite covering taxonomy integrity, categorization, validation, and grouping.

Changes

Cheatsheet Categorization System

Layer / File(s) Summary
Taxonomy and group contract
application/utils/external_project_parsers/parsers/cheatsheet_categorizer.py, application/tests/test_cheatsheet_categorizer.py
Defines TAXONOMY, UNCATEGORIZED, and deterministic group IDs; tests verify taxonomy integrity and group ID stability.
Categorization helpers and validation
application/utils/external_project_parsers/parsers/cheatsheet_categorizer.py, application/tests/test_cheatsheet_categorizer.py
Implements deterministic matching, LLM validation, and fallback behavior; tests cover mappings, uncategorized results, LLM outcomes, and label validation.
Grouping by label set
application/utils/external_project_parsers/parsers/cheatsheet_categorizer.py, application/tests/test_cheatsheet_categorizer.py
Groups records by canonical label sets and returns sorted groups; tests cover membership, stable IDs, empty input, and direct execution.

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

Suggested reviewers: northdpole, pa04rth, paoga87, robvanderveer

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.42% 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
Title check ✅ Passed The title clearly summarizes the main change: adding cheatsheet categorization and grouping.
Description check ✅ Passed The description is directly related to the implemented categorizer, grouping, fallback behavior, and tests.
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
🧪 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.

coderabbitai[bot] avatar Jun 15 '26 04:06 coderabbitai[bot]

Hey @shreeshtripurwarcomp23-coder, great work! I found a few points that might be worth looking into:

  1. The categorizer uses record.category_hints as input for categorization, but Module B intentionally leaves this field empty. My understanding is that Module C is expected to categorize the records and populate these category hints. Currently, it returns the generated labels separately but does not populate the record's category_hints field.

  2. The categorizer currently does not use record.summary; it only uses the title, headings, and category_hints (which are empty upstream). In cases where the title or headings provide limited context, the summary could potentially help with categorization. However, with the current simple keyword-matching approach, it may need to be handled carefully to avoid overly broad matches.

  3. The CheatsheetGroup dataclass currently has no basic validation. Since it can also be used directly, invalid group_ids or labels outside the taxonomy can be passed. It might be worth adding some basic validation.

Abhijeet2409 avatar Jul 12 '26 14:07 Abhijeet2409

@Abhijeet2409 Thank you so much! I'll look into this.

@coderabbitai review

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar Jul 15 '26 17:07 coderabbitai[bot]