Skip to content

fix(ownership): fold repo casing in the ownership-inspect pr-fix read (#1357) - #1371

Merged
joryirving merged 1 commit into
mainfrom
courier/misospace/dispatch/issue-1357
Oct 23, 2026
Merged

joryirving merged 1 commit into
mainfrom
courier/misospace/dispatch/issue-1357

Conversation

@itsmiso-ai

Copy link
Copy Markdown
Contributor

Fixes #1357.

The bug

PrFixQueueItem.repo is canonicalized lowercase+trim on every write (normalizeQueueRepo, #1145), but inspectIssueOwnership read the open-PR-fix evidence with the raw cached issue.repository.fullName. For a repo cached with uppercase casing (GitHub's canonical casing can carry it), the prFixQueueItem.findFirst read matched nothing and the derived ownership state degraded silently — no error, just a missing open-PR-fix signal.

The fix

  • src/lib/ownership-inspect.ts — the prFixQueueItem.findFirst lookup now folds the repo through normalizeQueueRepo before matching, like every other queue lookup.
  • src/lib/ownership-inspect.test.ts (new) — hermetic regression test: the query receives the folded value, the open-PR-fix evidence is found (derived state REVIEW_OWNED / open_pr_fix_queue), and the operator-visible issue.repoFullName plus the live forge label read keep the cache's raw casing (the fold applies to the queue identity only).

No data migration: migration 20261008000000 backfolded the legacy rows.

Local validation

Run by the coordinator in /workspace at 89c8937:

  • npx vitest run src/lib/ownership-inspect.test.ts → 5 passed
  • revert check (fold temporarily removed from the source) → 4 failed / 1 passed — the new test genuinely guards the regression
  • npm run typecheck → clean
  • npm run lint → 0 errors (1 pre-existing warning in the untouched src/app/login/page.tsx)
  • npm test → 205 test files passed, 5266 tests passed, 0 failed

CI/checks, AI review and human review are explicitly pending — the operator verifies them after this run exits.

Out of scope (follow-up)

src/lib/ownership-reconciliation.ts carries the same raw-casing read in two places (the §8.7 commit-time re-check and the bounded ladder scan). That is a release-gating path, so it is tracked separately as #1370 rather than widened into this fix.

Review

A bounded adversarial review of the final diff was run before publishing: APPROVE WITH NITS. It confirmed the fix restores the intended read semantics and the test is non-vacuous; the in-scope nits (a fold-only-the-lookup case, a faithful agentWork state filter in the fake, and the issue-number citation) are fixed in this diff, and the out-of-scope reconciliation sites are filed as #1370. All roles in this run use the same model family, so this review provides no model-family diversity.

@its-saffron its-saffron Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Automated Review

Full PR review.

Analysis engine: MiniMax-M3.1-Flash (anthropic) — primary route · pr-reviewer-action v3.7.0

Recommendation: approve. No blocking or major findings.

  • Claims: Held, 3/3. The changed lookup uses the shared canonicalizer, and the five regression cases cover folded lookup values, uppercase-cache discovery, already-folded discovery, no-row behavior, and preservation of the raw casing for the live forge read.
  • Change-by-change: ownership-inspect.ts now queries the PR-fix queue with normalizeQueueRepo(repoFullName), matching the queue's persisted identity while leaving the operator-visible and forge-facing repository casing unchanged.
  • Linked Issue Fit: The implementation directly satisfies PR 1357’s requested source and test changes; the regression coverage demonstrates that uppercase cached repository names no longer suppress open-PR-fix evidence. No migration or schema change is required for this read-side correction.
  • Standards Compliance: No documented repository convention is violated; CI at 89c8937 reports successful lint, typecheck, tests, and build checks.

Tool Harness Findings

The harness confirmed that normalizeQueueRepo trims and lowercases repository identities, that the changed lookup uses it, and that REVIEW_OWNED with open_pr_fix_queue is derived from the recovered evidence. It also found separate raw-cased reconciliation reads outside this PR's changed path and issue scope. The 24-call budget was exhausted, but the decision-relevant implementation, canonicalizer, state derivation, live-label consumer, and regression tests were inspected.

Sources

Linked issue PR 1357; src/lib/ownership-inspect.ts; src/lib/ownership-inspect.test.ts; src/lib/pr-fix-queue.ts; src/lib/ownership-state.ts; src/lib/claim-gate.ts; CI results for 89c8937.

@joryirving joryirving left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Secondary hard-blocker review on exact head 89c893758c4ee50bb78cbee1d5f2b7082d5b5a1d: APPROVE. This is the exact read-side correction #1357 asks for: only the PrFixQueueItem.repo lookup is normalized through the shared normalizeQueueRepo, matching the queue's persisted lowercase+trim identity, while the cached/operator-visible repository name and live forge read retain the original GitHub-shaped casing. The new fake uses case-sensitive equality like PostgreSQL, so the uppercase-cache regression is load-bearing rather than vacuous; it also pins already-folded, no-row, and live-read casing behavior. The separate reconciliation reads with the same casing issue are outside this narrow path and tracked as #1370. Exact-head primary review is clean and CI/security/image/smoke checks are green; only the AI workflow wrapper's final bookkeeping was still in progress when I submitted this approval. No independent blocker found.

@joryirving
joryirving merged commit 1227ace into main Oct 23, 2026
13 checks passed
@joryirving
joryirving deleted the courier/misospace/dispatch/issue-1357 branch October 23, 2026 16:38
@its-miso its-miso Bot mentioned this pull request Oct 23, 2026
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.

fix(ownership): fold repo casing in the ownership-inspect pr-fix read like every other queue lookup

2 participants