Repository navigation
fix(dashboard): show one source-link chip per GitHub PR whatever the owner/repo case - #34650
Conversation
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The duplicate chip has a reproduction in the description and in tests, and the fix goes into the one identity every chip consumer keys on. That is the cause, not a per-site patch. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: one chip per GitHub PR or issue on a session card, however the owner/repo was capitalised — FIX.
[FIRST-PRINCIPLES-REVIEWED] bf3f702 Description read[DESCRIPTION-READ] 5e2b664e07e796cd44e83969a7d9899a8a2c9008d8ff797c7059771d14818ad3 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fold lives in the one identity every chip consumer keys on, and dismissal keys already on disk are folded when read, not migrated. [DESIGN-REVIEWED] bf3f702 Description read[DESCRIPTION-READ] d9046d41a22cf18f6ded4b424a45dbd4a8793c8d472b7e22013bcd3d6bf3df98 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Backend Tests reds on c1686df are main's, not this PR's: the Slack code-channel trust tests and test_session_markdown's markdown-it-py case fail identically on a clean origin/main (6cc4e97 and ed80c1d). #34646 fixes both; this PR rebases onto main once it merges. Coverage Gate fails closed only because Backend Tests did. |
c1686df to
bf3f702
Compare
|
Rebased onto main now that #34646 (the fix for main's Backend Tests breaks) has merged. The PR's patch is unchanged; CI is running again. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved. On this head the review read the full unlink handler and the derivation in slot_projection.py. It confirmed that every membership test that can meet an old mixed-case GitHub key now folds it, and that GitLab, Jira, Bitbucket and Gerrit keys keep their case. It ran the new test file (20 passed) and 321 related source-link tests (all passed), and applied single-line mutations that showed the identity fold and the route fold are pinned.
Done well: the fix lives in SourceRef.identity, the one key every chip reader uses. Old tombstones are folded when read instead of rewritten on disk, and the ASCII-only fold keeps lookalike owners apart and keeps keys inside the 512-character bound.
Optional:
- The folded cap check in chat_api/source_links.py (line 580) has no test. A retry of an old-key unlink on a slot that already holds 512 dismissed keys should return 200. A test for that case would pin it.
- "host" in the GitHub fold set (contract.py:158) changes nothing, because links.py already lowercases the host. You could drop it, or correct the body's coverage sentence, which also credits the pending-set fold that no test exercises.
- When the in-memory set holds no spelling of an old key, the persist path can store both spellings of one tombstone. Skipping the write when the key is already durably dismissed would avoid the extra slot.
Problem / Motivation
Goal: A session card in the Crew sidebar shows one chip per GitHub pull request or issue, even when the chat mentioned it with different owner/repo letter case.
A session that mentioned
https://github.com/kirodotdev/KiroCrew/pull/21991and laterhttps://github.com/kirodotdev/kirocrew/pull/21991showed two chips,kirodotdev/KiroCrew #21991andkirodotdev/kirocrew #21991. GitHub treats owner and repository names case-insensitively, so both are the same pull request.Why it matters
The duplicate chip takes one of the card's three chip slots, inflates the "+N" overflow count, and costs a second provider status read for the same PR. Unlinking one of the two chips left the other on the card, so the user could not remove the PR in one step.
Not a goal
What changed (motivation → approach → change)
The sidebar dedupes chips on
SourceRef.identity, and for GitHub that identity kept owner and repo exactly as written, so two spellings of one PR got two identities.SourceRef.identity(source_providers/contract.py)k) and can lengthen a key past its 512-character bound.canonical_source_identity_key(contract.py)slot_projection.py)chat_api/source_links.py,state_parts/source_links.py)The frontend needed no change:
sourceLinkKeyinwebsite/src/utils/pullRequestLinks.tsalready case-folds GitHub URLs, and it treats the backend'sidentityfield as opaque.Backwards compatibility
Compatible: identity keys for mixed-case GitHub links now serialize lowercase, and keys stored or sent in the old mixed-case form still validate and still match because both readers fold them.
Removes nothing: the change merges chips that named the same GitHub object; every key, route and stored field keeps its shape.
Tests
test/test_source_link_github_case.pycovers:source_links_totaland the three-chip budget, and refreshed for status once (_slot_chip_urls)./pull/21991and/issues/21991stay two chips; GitLab paths that differ only in case stay two.mentions_source_identitymatches across spellings.Each production hunk was reverted on its own: the identity fold is caught by 11 tests, the derivation fold by the old-tombstone test and the route test, the route fold by the route test, the folded already-dismissed checks by the retry, long-line and rebound-slot tests, and the ASCII-only fold by both non-ASCII tests.
Determinism: the new file passes 20 runs at
-n0, 10 runs at-n 4besidetest/test_dashboard_source_link_unlink.py, and 3 shuffled orders.Proof: PROVEN test/test_source_link_github_case.py::TestOneChipPerObject::test_case_variants_collapse_to_one_chip[https://github.com//pull/21991], test/test_source_link_github_case.py::TestOneChipPerObject::test_case_variants_collapse_to_one_chip[https://github.com//pull/21991], test/test_source_link_github_case.py::TestOneChipPerObject::test_case_variants_collapse_to_one_chip[https://github.com//pull/21991], test/test_source_link_github_case.py::TestOneChipPerObject::test_the_chip_shows_the_newest_spelling, test/test_source_link_github_case.py::TestOneChipPerObject::test_variants_count_once_toward_the_three_chip_budget (head c1686df)
Manual verification
N/A — unit coverage sufficient: the chip list is computed server-side by the derivation these tests drive, and the frontend renders that list unchanged.
Related Issues
N/A — no tracking issue.
Sibling sweep
Swept: git grep -nE ".identity\b|source_ref_identity_key|_dismissed_source_links" -- src/kiro_crew/dashboard
Sibling: src/kiro_crew/dashboard/state_parts/source_links.py:355 -- not affected -- mentions_source_identity compares against SourceRef.identity, which now folds
Sibling: src/kiro_crew/dashboard/source_providers/chip_status.py:191 -- not affected -- status and visibility keys follow the one chip URL a session now carries
Sibling: website/src/utils/pullRequestLinks.ts:75 -- not affected -- sourceLinkKey already lowercases GitHub URLs
Pattern harvest
Not generalizable: the case rule is specific to how GitHub resolves names, and it now lives in the one identity every source-link consumer keys on.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)