Fix case-sensitive repoFullName match dropping maintainer-lane detection - #225
Merged
JSONbored merged 2 commits intoJun 2, 2026
Merged
Conversation
JSONbored
approved these changes
Jun 2, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
@philluiz2323 this looks right.
A few notes:
- The bug is subtle but important: casing drift between data sources can silently misclassify maintainer-owned work.
- Switching these checks to
sameRepomatches the rest of the repo identity model. - The test covers the exact maintainer-lane failure mode.
- No code changes requested.
Validation expected:
- Current GitHub checks are green.
JSONbored
added a commit
that referenced
this pull request
Jun 13, 2026
* fix(registry): resolve repo casing case-insensitively on sync persistRegistrySnapshot keyed the upsert conflict target and the de-registration on the case-sensitive fullName primary key, while repo names arrive from multiple sources (registry vs GitHub-canonical) and the rest of the system resolves repos case-insensitively. A casing mismatch inserted a duplicate row and de-registered the wrong one (same class as #223/#225). Resolve each snapshot repo to an existing row by lowercased name before upsert, and de-register by lowercased comparison. * fix(registry): guard empty snapshots and intra-snapshot case dups Address review: (1) restore the empty-snapshot guard so a failed/empty registry fetch never de-registers every repo; (2) record each resolved canonical name within the sync loop so a case-variant duplicate in the same snapshot upserts the existing row instead of inserting a second case-only-different primary key. Add tests for both. --------- Co-authored-by: galuis116 <galuis116@users.noreply.github.com> Co-authored-by: ghost <49853598+JSONbored@users.noreply.github.com>
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.
Closes #223.
Problem
buildRoleContextderived a contributor maintainer association by filtering cached PRs/issues with a case-sensitivepr.repoFullName === args.repoFullName. ThatauthoredAssociationslist is the only signal that promotes someone to owner/member/collaborator and setsmaintainerLane. Everywhere else repo names are compared case-insensitively (sameRepo, and even this same function usestoLowerCasefor the official-repo and reposTouched checks).The canonical
repoFullNamepassed in bybuildContributorOutcomeHistorytakes the highest-priority source casing (often the official Gittensor source), while the cached PRs come from the GitHub webhook/backfill. The same function already filters those PRs withsameRepo(engine.ts:1452) precisely because the casing can differ. When it differs,authoredAssociationscomes back empty, the maintainer association is lost, andmaintainerLanesilently becomes false, so the maintainer repo is mis-counted as normal outside-contributor reward evidence (wrong successLevel, reward-risk actions, and decision-pack routing).Fix
Use the existing case-insensitive
sameRepofor the fourrepoFullNamecomparisons inbuildRoleContext(theauthoredAssociationsPR/issue filters and thetouchedByCachePR/issue filters). The change only broadens matching to recognize a maintainer that was previously missed; it never removes a correct match.Tests
Added a fail-on-revert assertion to the existing role-context test:
buildRoleContext({ repoFullName: "Org/Project", pullRequests: [pr with repoFullName "org/project", association MEMBER] })must yieldrole: "org_member",maintainerLane: true. The old case-sensitive code returnedrole: "unknown".vitest runsignals (signals-v2 + signals + signals-coverage) 66/66; decision-pack + agent-orchestrator 46/46;tsc --noEmitclean.