Skip to content

Fix case-sensitive repoFullName match dropping maintainer-lane detection - #225

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/maintainer-lane-repo-casing
Jun 2, 2026
Merged

Fix case-sensitive repoFullName match dropping maintainer-lane detection#225
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/maintainer-lane-repo-casing

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Closes #223.

Problem

buildRoleContext derived a contributor maintainer association by filtering cached PRs/issues with a case-sensitive pr.repoFullName === args.repoFullName. That authoredAssociations list is the only signal that promotes someone to owner/member/collaborator and sets maintainerLane. Everywhere else repo names are compared case-insensitively (sameRepo, and even this same function uses toLowerCase for the official-repo and reposTouched checks).

The canonical repoFullName passed in by buildContributorOutcomeHistory takes 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 with sameRepo (engine.ts:1452) precisely because the casing can differ. When it differs, authoredAssociations comes back empty, the maintainer association is lost, and maintainerLane silently 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 sameRepo for the four repoFullName comparisons in buildRoleContext (the authoredAssociations PR/issue filters and the touchedByCache PR/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 yield role: "org_member", maintainerLane: true. The old case-sensitive code returned role: "unknown".

vitest run signals (signals-v2 + signals + signals-coverage) 66/66; decision-pack + agent-orchestrator 46/46; tsc --noEmit clean.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@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 sameRepo matches 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.

@dosubot dosubot Bot added the lgtm label Jun 2, 2026
@JSONbored
JSONbored merged commit 08f0c50 into JSONbored:main Jun 2, 2026
3 checks passed
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

3 participants