Skip to content

fix(review): compose additive linked-issue label matches with the exclusive winner - #4417

Merged
JSONbored merged 1 commit into
mainfrom
claude/fix-priority-label-additive-composition
Jul 9, 2026
Merged

fix(review): compose additive linked-issue label matches with the exclusive winner#4417
JSONbored merged 1 commit into
mainfrom
claude/fix-priority-label-additive-composition

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • resolvePrTypeLabel's propagation loop returned on the FIRST mapping the linked issue's labels satisfied, so an ADDITIVE mapping (e.g. gittensor:priority -- a reward tag meant to coexist with whichever type already applies) was silently unreachable whenever the SAME issue also carried a label an earlier, EXCLUSIVE mapping (bug/feature) matched. Since bug/feature are checked before priority in the mappings array, and our issues routinely carry a type label AND priority together (confirmed live: issue feat(enrichment): detect Mixedbread and Sourcegraph local access tokens #3348 in metagraphed carried both gittensor:feature and gittensor:priority), priority appeared to work when tested in isolation but was actually being dropped -- and REMOVED, since it's in the same exclusive-cleanup set -- on nearly every real PR. This is the actual root cause behind "priority labels aren't detected/propagating," a live, reproducible bug (screenshot: gittensory-orb repeatedly stripped a maintainer's manually-applied gittensor:priority/gittensor:feature and replaced them with gittensor:bug from title classification alone).
  • Fixed the matching loop to collect every satisfied mapping instead of stopping at the first: the first EXCLUSIVE match still wins the single type-label slot (same bug-vs-feature precedence as before), and every ADDITIVE match now composes alongside it instead of losing to whichever exclusive mapping happened to be checked first in the array.
  • Also flipped gittensor:priority's own removeOtherTypeLabels to false (additive) in every config that models it: the repo's own .gittensory.yml, the bundled fallback (src/config/gittensory-repo-focus-manifest.ts), and both public example templates (.gittensory.yml.example, config/examples/gittensory.full.yml). Priority is a reward dimension, not a type of its own -- it should never have competed with bug/feature for the same exclusive slot in the first place.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — owner-authored PR fixing a live-reported, reproduced bug; no separate issue was filed for this follow-up fix.

Validation

  • npm run typecheck
  • npm run manifest:drift-check / npm run docs:drift-check — both clean (the repo-root .gittensory.yml and the bundled GITTENSORY_REPO_FOCUS_MANIFEST_YAML fallback are kept in sync, as required)
  • npx vitest run test/unit/pr-type-label.test.ts test/unit/pr-type-label-engine.test.ts — 74/74 pass. All 18 pre-existing resolvePrTypeLabel cases traced by hand against the new logic and confirmed unaffected; 5 new regression tests added for the actual composition bug (issue carrying bug+priority, feature+priority, priority-alone, multiple additive matches, and two-exclusive-candidates-plus-additive to confirm first-exclusive-still-wins).
  • npx vitest run test/unit/queue.test.ts — full suite, 754/754 pass. One pre-existing integration test's expectations were updated: JSONbored/gittensory's own bundled-manifest fallback now correctly composes gittensor:bug (title) + gittensor:priority (additive) instead of the old exclusive-only gittensor:priority alone.
  • npm run actionlint / npm run test:workers / npm run build:mcp / npm run test:mcp-pack / npm run ui:openapi:check / npm run ui:lint / npm run ui:typecheck / npm run ui:build / npm audit — not run locally for this focused change; relying on CI (validate) for the full gate.

If any required check was skipped, explain why:

  • This is a narrow, single-concern fix; the full npm run test:ci gate is left to CI per the repo's own established practice for this size of change.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. — N/A, no auth/session surface touched.
  • API/OpenAPI/MCP behavior is updated and tested where needed. — N/A, pure label-classification logic, no external surface.
  • UI changes use live API data or real empty/error/loading states. — N/A, no UI changes.
  • Visible UI changes include a UI Evidence section. — N/A, no UI changes.
  • Public docs/changelogs are updated where needed — both public .gittensory.yml example templates corrected alongside the code fix, so new self-hosters don't copy the same bug.

Notes

…lusive winner

resolvePrTypeLabel's propagation loop returned on the FIRST mapping the linked
issue's labels satisfied, so an additive mapping (e.g. gittensor:priority, a reward
tag meant to coexist with whichever type already applies) was silently unreachable
whenever the SAME issue also carried a label an earlier, exclusive mapping (bug/
feature) matched -- the overwhelmingly common case, since our issues routinely carry
both a type label and priority together. Priority appeared to work in isolation but
was actually being dropped on nearly every real PR.

Now collects every satisfied mapping: the first exclusive match still wins the
single type-label slot (same bug-vs-feature precedence as before), and every
additive match composes alongside it instead of losing to whichever exclusive
mapping happened to be checked first in the array.

Also flips gittensor:priority's own removeOtherTypeLabels to false (additive) in
every config that models it (the repo's own .gittensory.yml + bundled fallback +
both public example templates) -- priority is a reward dimension, not a type of its
own, so it should never have competed with bug/feature for the same exclusive slot
in the first place.
@JSONbored JSONbored self-assigned this Jul 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored merged commit 46006b1 into main Jul 9, 2026
6 checks passed
@JSONbored
JSONbored deleted the claude/fix-priority-label-additive-composition branch July 9, 2026 11:26
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.97%. Comparing base (3e4df6d) to head (f3903a2).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4417   +/-   ##
=======================================
  Coverage   93.96%   93.97%           
=======================================
  Files         401      401           
  Lines       36913    36918    +5     
  Branches    13497    13499    +2     
=======================================
+ Hits        34687    34692    +5     
  Misses       1570     1570           
  Partials      656      656           
Files with missing lines Coverage Δ
src/config/gittensory-repo-focus-manifest.ts 100.00% <ø> (ø)
src/settings/pr-type-label.ts 98.14% <100.00%> (+0.18%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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