Skip to content

fix: tighten role inference and allow cRoles editing#187

Merged
michaelmwu merged 2 commits intomainfrom
michaelmwu/resume-role-fix
Mar 9, 2026
Merged

fix: tighten role inference and allow cRoles editing#187
michaelmwu merged 2 commits intomainfrom
michaelmwu/resume-role-fix

Conversation

@michaelmwu
Copy link
Member

@michaelmwu michaelmwu commented Mar 9, 2026

Description

  • Tightened resume-role prompt guidance so designer is inferred only from explicit design-role titles, avoiding false positives from generic design wording.
  • Added regression test coverage for action-language design text.
  • Added Discord UX to edit suggested cRoles with a new modal, button, and normalization handling in the resume confirmation flow.
  • Extended tests for cRoles modal visibility, prefill, submit, clear, and callback behavior.

Related Issue

How Has This Been Tested?

  • Pre-commit checks (ruff + mypy) pass during commit.
  • Added unit tests in tests/unit/test_crm.py and tests/unit/test_resume_extractor.py.

Summary by CodeRabbit

  • New Features

    • Users can now edit proposed role changes through an interactive modal during the resume update confirmation process.
  • Bug Fixes

    • Refined role detection to only recognize "designer" when explicitly stated in job titles or headings, preventing false detection from design-related action verbs.

Copilot AI review requested due to automatic review settings March 9, 2026 08:38
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds UI components for editing resume roles within the CRM discord bot and constrains designer role inference to explicit design-role signals rather than generic action verbs. It includes a new modal and button for role editing, role normalization utilities, and corresponding test coverage for both the UI additions and inference constraint.

Changes

Cohort / File(s) Summary
Discord Bot Roles UI
apps/discord_bot/src/five08/discord_bot/cogs/crm.py
Added ResumeEditRolesModal and ResumeEditRolesButton classes; integrated into ResumeUpdateConfirmationView with conditional visibility when cRoles are proposed; added _normalize_roles_value() static method for role normalization.
Resume Extractor Role Inference
packages/shared/src/five08/resume_extractor.py
Narrowed designer role inference constraint to require explicit design-role signals (e.g., Product Designer, UI Designer) rather than inferring from generic "designed" action verbs.
CRM UI Component Tests
tests/unit/test_crm.py
Added test coverage for ResumeEditRolesButton and ResumeEditRolesModal, verifying button visibility, modal prepopulation, submission behavior, and removal of roles from proposed updates.
Resume Extractor Inference Tests
tests/unit/test_resume_extractor.py
Added test_infer_roles_does_not_treat_design_verbs_as_designer() to verify design verbs do not incorrectly map to designer role.

Possibly related PRs

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


🐰 Roles get their editing buttons bright,
Designers now need clearer light,
No more verbs to claim the crown,
Just explicit signals matter now,
Tests confirm it all works right! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% 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 accurately summarizes the two main changes: tightening role inference logic and adding UI capability to edit cRoles in the confirmation flow.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/resume-role-fix

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens resume role inference around “designer” to reduce false positives from action-language “design” wording, and adds a Discord confirmation-flow UI to edit proposed CRM roles (cRoles) before applying updates.

Changes:

  • Updated the shared resume-extractor prompt guidance to infer designer only from explicit design-role signals (not generic “design/designed” language).
  • Added regression tests ensuring action-language “design” wording does not infer the designer role.
  • Added Discord UI components (button + modal) to allow editing proposed cRoles, plus unit tests covering visibility, prefill, submit, and clear behaviors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/unit/test_resume_extractor.py Adds regression test preventing “design” action-language from inferring designer.
tests/unit/test_crm.py Adds unit coverage for cRoles edit button/modal behavior in the Discord confirmation view.
packages/shared/src/five08/resume_extractor.py Tightens LLM prompt instructions for designer inference.
apps/discord_bot/src/five08/discord_bot/cogs/crm.py Adds ResumeEditRolesModal, ResumeEditRolesButton, view wiring, and role normalization helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +922 to +925
cleaned = [
line.strip() for line in raw.replace(",", "\n").splitlines() if line.strip()
]
normalized_roles = normalize_roles(cleaned)
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

normalize_roles already supports splitting a string on commas/newlines/semicolons. Here the modal pre-splits into a list (and only replaces commas), so inputs like developer;marketing (or marketing; designer) will be treated as a single role token and may normalize incorrectly. Consider passing the raw text string directly to normalize_roles(...) (or also splitting on ;) and letting it handle delimiter parsing/deduping.

Suggested change
cleaned = [
line.strip() for line in raw.replace(",", "\n").splitlines() if line.strip()
]
normalized_roles = normalize_roles(cleaned)
normalized_roles = normalize_roles(raw)

Copilot uses AI. Check for mistakes.
@michaelmwu michaelmwu merged commit bc1da5f into main Mar 9, 2026
4 of 5 checks passed
@michaelmwu michaelmwu deleted the michaelmwu/resume-role-fix branch March 9, 2026 08:46
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