fix(scoring): match labelMultipliers keys as fnmatch globs#1277
Merged
JSONbored merged 4 commits intoJun 26, 2026
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1277 +/- ##
=======================================
Coverage 95.40% 95.40%
=======================================
Files 193 193
Lines 20949 20971 +22
Branches 7575 7580 +5
=======================================
+ Hits 19986 20008 +22
Misses 383 383
Partials 580 580
🚀 New features to boost your workflow:
|
JSONbored
approved these changes
Jun 26, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Real preview-vs-validator parity gap, distinct from the casing PRs — the labelPatternToRegExp translator handles the fnmatch corners and the test pins literal-key parity. Merges for base gittensor:bug; #1273 is slop-closed in the ring, so no multiplier.
This was referenced Jun 26, 2026
Closed
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1273.
The score preview resolved a repo's configured
labelMultiplierskeys by exact string equality, but the upstream gittensor validator matches them asfnmatchglob patterns (gittensor/validator/oss_contributions/label_resolution.py:fnmatch(label.lower(), pattern.lower()), returning the highest matching multiplier). So a repo configuring a wildcard trusted label —type:*,kind/*,priority:?— had every such label scored at the neutral default in the preview, makingestimatedMergedScorediverge from what the validator actually awards (a 33% under-estimate for a1.5boost; the inverse error when the default is a penalty). Upstream explicitly tests these patterns (kind/*->kind/bug,type:*->type:bug-fix,*-dev->backend-dev,3.*/feature->3.0/feature).What changed
selectLabelMultipliernow matches each configured key against the PR's labels via a newlabelPatternToRegExphelper that ports Pythonfnmatchsemantics:*= any run,?= one char,[seq]/[!seq]= character class, all other characters literal, anchored and case-insensitive. The highest matching multiplier still wins (mirrors upstreammax(...)).change-guardrail.tsis deliberately not reused: it is segment-oriented (*stops at/,?is literal), which is notfnmatch— labels are flat strings, so*/?must span every character.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(vianpm run test:ci)npm run typechecknpm run test:coveragelocally; the new helper + matcher have both-branch coverage (wildcard,?single-char hit/miss,[seq]/[!seq]class, unclosed-bracket-as-literal, escaped metacharacter, multi-match max, and literal-key parity). The only uncovered lines reported inpreview.tsare pre-existing and outside this diff.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:check(no schema change — this is internal scoring logic)npm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderate(0 vulnerabilities)If any required check was skipped, explain why:
npm run test:ciis green (4074 passed).Safety
UI Evidencesection. (N/A — no visible UI change.)Notes
src/scoring/preview.ts; no schema, migration, binding, or guarded-path changes. Registry normalization already preserves pattern keys verbatim, so wildcard keys now resolve exactly as the validator scores them.