Skip to content

fix: order issue-type keyword rules by signal strength - #3579

Merged
eleshar merged 1 commit into
developfrom
fix/issue-type-rule-specificity-order
Sep 26, 2026
Merged

eleshar merged 1 commit into
developfrom
fix/issue-type-rule-specificity-order

Conversation

@eleshar

@eleshar eleshar commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Linked issues

Fixes #3577

Found by Qodo review of #3573, which surfaced it against code that predates that fix.

Context

Reproduction

  • Steps: call inferTypeFromContext() with a title that both names a subject and starts with an action verb.
  • Expected vs Actual:
Title Actual Intended
Add dependency upgrade Feature Dependency Update
Implement compatibility support Feature Compatibility
Add interoperability for runners Feature Compatibility
Add integration test for the sync Feature Automation
Add GitHub Action for releases Feature Automation

Root Cause

inferMappedValueFromText takes the first rule that both matches and has a configured mapping. type:feature sat second and its patterns include bare action verbs — add, implement, build, develop — that occur in almost any title, so it shadowed every subject rule below it. The specific rules were reachable only from titles that happened to contain no action verb.

Fix Summary

  • Move only the generic type:feature rule to the end of the array, leaving every other rule's relative order untouched so the change stays confined to the reported problem.
  • Keep type:test above type:compat so integration test remains a test rather than becoming Compatibility.
  • Document the ordering invariant in the file so a later rule insertion cannot quietly reintroduce the shadowing.
  • This is the ordered-cascade approach — strongest signal first, first match wins — as OpenAlex used when reclassifying 49.6M works: "Rules are ordered by measured trustworthiness: unambiguous structural signals fire first, softer text heuristics later, and the first match wins."

No configuration is touched. project_field_mappings.Type, .github/issue-types.yml and every locked file are unchanged, so derived values remain valid options and nothing downstream has to migrate.

Verification

  • Tests added/updated to cover the bug

  • Manual verification steps — N/A, no UI; verified by executing the inference directly

  • Negative/edge cases checked

  • New suite type keyword rules are ordered by signal strength covers all five reported titles plus Add a new endpoint and Implement dark mode (the generic rule must still work), body-level inference, and label precedence.

  • Proven to have teeth: reverting only the ordering makes 6 of those 12 cases fail; all pass with the reorder.

  • Full suite 282 suites / 5645 tests passed. eslint 0 errors, semgrep 0 findings, markdownlint 0 issues.

  • validate:issue-fields passes: cross-file label and issue-type parity intact.

  • Changelog gate: 10 failing entries with and without the new entry — 0 new failures.

Risk & Rollback

  • Risk level: Low-Medium. This is a deliberate behaviour change to derived values, which is why it is its own PR rather than folded into fix: correct stale issue-type inference and CommonJS title normalisation #3568.
  • Titles that change classification are ones naming a specific subject and an action verb; they were previously captured by the generic rule. Add a new endpoint and similar genuinely feature-shaped titles are unaffected.
  • An explicit type:* label still beats every keyword rule, so labelled items are unaffected.
  • Rollback plan: revert the single commit. No configuration or persisted data is involved.

Changelog

Issue Types Matched by Signal Strength — A title naming a subject now classifies by that subject, so a test or compatibility update is no longer filed as a feature. (#3577)

inferMappedValueFromText takes the first rule that both matches and has a
configured mapping. type:feature sat second and its patterns include bare
action verbs (add, implement, build, develop) that appear in almost any
title, so it captured every title that both named a subject and started with
a verb:

  "Add dependency upgrade"           -> Feature   (Dependency Update)
  "Implement compatibility support"  -> Feature   (Compatibility)
  "Add integration test for the sync"-> Feature   (Automation)
  "Add GitHub Action for releases"   -> Feature   (Automation)

Move only that rule to the end of the array and leave every other rule's
relative order untouched, so the change is confined to the reported problem.
type:test stays above type:compat so "integration test" remains a test.

This is the ordered-cascade approach of matching the strongest signal first
and taking the first match, as OpenAlex used when reclassifying 49.6M works.

No configuration is touched: project_field_mappings.Type, the canonical
issue types and every locked file are unchanged, so the derived values remain
valid options and nothing downstream has to migrate.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: lightspeedwp/.github/.coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: 2e0c94cc-3a84-4f3e-8411-4bc8115c86d9

📥 Commits

Reviewing files that changed from the base of the PR and between 22323f8 and c5c6284.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • scripts/agents/includes/__tests__/derive-project-fields.test.js
  • scripts/agents/includes/derive-project-fields.cjs

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.

@github-actions

Copy link
Copy Markdown
Contributor

PR Template Routing

Branch Type: fix
Scope: issue-type-rule-specificity-order
Template: pr_bug.md
Labels Applied: type:bug

This PR was automatically routed based on the branch naming strategy.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Order issue-type keyword rules by signal strength

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Prioritizes subject-specific issue-type keywords before generic feature action verbs.
• Adds regression coverage for title, body, fallback, and explicit-label precedence.
• Documents the ordering invariant and records the fix in the changelog.
Diagram

graph TD
  C["Issue Context"] --> L{"Explicit Label?"} -- No --> B{"Branch Prefix?"} -- No --> S{"Subject Rule?"} -- No --> F{"Feature Verb?"} -- No --> E["No Inference"]
  L -- Yes --> M["Mapped Type"]
  B -- Yes --> M
  S -- Yes --> M
  F -- Yes --> M
Loading
High-Level Assessment

The ordered-cascade approach is optimal for this targeted fix because it preserves existing first-match behavior, mappings, and precedence while moving only the overly broad feature rule. A weighted or scored classifier could reduce dependence on array order, but would substantially expand scope and alter established inference semantics without clear benefit here.

Files changed (3) +61 / -6

Bug fix (1) +16 / -6
derive-project-fields.cjsMove the generic feature rule behind specific signals +16/-6

Move the generic feature rule behind specific signals

• Moves 'type:feature' to the end of the keyword cascade so subject-specific rules match first. Comments document the ordering invariant and preserve test-before-compatibility behavior.

scripts/agents/includes/derive-project-fields.cjs

Tests (1) +44 / -0
derive-project-fields.test.jsCover signal-strength ordering and precedence +44/-0

Cover signal-strength ordering and precedence

• Adds regression cases for dependency, compatibility, automation, and generic feature titles. It also verifies body inference and confirms explicit labels retain highest precedence.

scripts/agents/includes/tests/derive-project-fields.test.js

Documentation (1) +1 / -0
CHANGELOG.mdDocument corrected issue-type classification +1/-0

Document corrected issue-type classification

• Adds a Fixed entry explaining that subject-bearing titles now avoid incorrect generic Feature classification.

CHANGELOG.md

@github-actions

Copy link
Copy Markdown
Contributor

📋 Changelog Quality Validation

Metric Count
✅ Passing 113
❌ Failing 10
🆕 New failures in this PR 0
📦 Pre-existing failures 10

Status

✅ Validation PASSED - No new failures introduced by this PR.
Note: 10 pre-existing failure(s) remain in the Unreleased section.

No action required.

@eleshar
eleshar merged commit 063e839 into develop Sep 26, 2026
40 of 44 checks passed
@eleshar
eleshar deleted the fix/issue-type-rule-specificity-order branch September 26, 2026 04:44
@linear-code

linear-code Bot commented Sep 26, 2026

Copy link
Copy Markdown

GIT-2363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: order issue-type keyword rules by signal strength

1 participant