Skip to content

fix(mobile): match to-do link candidates by normalized repository - #8524

Merged
iscekic merged 1 commit into
mainfrom
drain/match-todo-link-candidates-by-repo
Oct 22, 2026
Merged

iscekic merged 1 commit into
mainfrom
drain/match-todo-link-candidates-by-repo

Conversation

@iscekic

@iscekic iscekic commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Change

The link-session sheet built its repository filter from the list's stored value unchanged and compared it with a session project already normalized to owner/repo. A list whose repository is an https or ssh clone URL, or carries a .git suffix, therefore matched no session and the sheet showed its empty-in-repository state.

  • todoLinkCandidates in apps/mobile/src/lib/todos/todo-model.ts keys both sides with projectOptionKey, the project identity the session filters and the filter sheet already use. A list without a repository still offers every unlinked session; a session without a git URL is dropped only when the list names a repository.
  • apps/mobile/src/components/todos/todo-link-session-sheet.tsx renders the helper's result instead of the inline comparison.
  • apps/mobile/src/lib/case-guard.test.ts: the allowlist entry for the sheet is gone; it existed only for the raw case call this replaces.
  • Tests in apps/mobile/src/lib/todos/todo-model.test.ts: https, https without .git, ssh, owner/repo and a differing host case for the list against sessions of the same repository in each form; a list without a repository; an already linked session; a repository with no session.

The comparison now matches the contract stated in apps/web/src/lib/todos/git-url-project.ts and used by sameGitProject in the mirrored candidate query, so a list's repository and a session's git URL compare the same way on both sides.

Verification

Unit and static checks:

  • pnpm exec vitest run --project mobile-pure src/lib/todos/todo-model.test.ts src/lib/case-guard.test.ts — 27 passed.
  • pnpm exec tsc --noEmit in apps/mobile — clean.
  • oxlint on the four touched files — 0 warnings, 0 errors; oxfmt --check clean.

End to end on the Android emulator against the local dev stack, with a fake account in the local database:

  • Seeded a to-do list whose repository is https://github.com/drain-e2e-labs/notes.git, one open to-do in it, and two stored sessions: one on the same repository as git@github.com:drain-e2e-labs/notes.git, one on a different repository.
  • Before the change the sheet read "No recent sessions in https://github.com/drain-e2e-labs/notes.git" (first capture).
  • After the change the same sheet lists "Tidy the release notes" with drain-e2e-labs/notes, still excludes the other repository's session, and tapping the row links it to the to-do (second and third captures).

The three captures are in the follow-up comment.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Repo identity: Which repository key should both sides of the to-do link filter use?
    Answer: projectOptionKey on both sides (Recommended)
    Confidence: 0.85 · Precedent: Fix the root cause and the class of the issue: "fix class of issue preventing progress". The brief also names projectOptionKey for both sides, which matches the app's single project identity.
  2. Question: Test surface: How should the filter be tested, beyond the emulator run?
    Answer: Pure helper test only (Recommended)
    Confidence: 0.75 · Precedent: Do the least work possible with no drop in quality. The emulator run already proves the wiring.
  3. Question: Empty state label: The empty state says "no sessions in " using the list's stored value. Format it too?
    Answer: Leave the stored value (Recommended)
    Confidence: 0.65 · Precedent: Keep similar elements consistent across surfaces: the to-do list row shows the stored value, so the empty state should too.

The link-session sheet compared a normalized session project with the
list's stored repository unchanged, so a list holding a clone URL offered
no session. Both sides now use the shared project key, matching how the
server-side candidate query and the session filters compare repositories.
@iscekic iscekic added drain Work item from the findings drain janitor:features-workflows Janitor finding family: features-workflows labels Oct 22, 2026
@iscekic

iscekic commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android emulator E2E for the to-do link sheet, against the local dev stack with a test account seeded in the local database. The to-do list stores its repository as an https clone URL form; two stored sessions exist, one on the same repository written in ssh form and one on a different repository.

  1. Before the change: the sheet reports no session in the list's repository.
  2. After the change: the sheet offers the same-repository session and still excludes the other repository's session.
  3. After the change: tapping the offered row links the session to the to-do.

Link sheet before the change: no session in the stored repository

Link sheet after the change: the same-repository session offered

To-do after linking the offered session

@kilo-code-bot

kilo-code-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The link-candidate filter now normalizes both the list repository and each session git URL through the existing projectOptionKey, which matches the server-side sameGitProject contract; the extracted todoLinkCandidates helper is pure, correctly typed against cliSessionsV2.list (git_url: string | null), and covered by table tests for https, https without .git, ssh, owner/repo, host case, no-repository lists, linked sessions, and empty results. The removed case-guard allowlist entry is justified because the sheet no longer performs a bare case comparison, while lib/todos/todo-model.ts keeps its entry for the remaining call in todoListRepoSelection.

Assumptions: [INFERENCE] projectOptionKey intentionally drops the host, so a list holding https://github.com/owner/repo can now match a session on another host with the same owner/repo (e.g. GitLab). This mirrors sameGitProject in apps/web/src/lib/todos/git-url-project.ts and the list data model stores no host for picker-selected repositories, so it is treated as the agreed contract rather than a defect. [INFERENCE] Verification is the author's reported run (vitest --project mobile-pure, tsc --noEmit, oxlint/oxfmt, Android emulator); tests and typecheck were not re-executed in this read-only review.

Files Reviewed (4 files)
  • apps/mobile/src/lib/todos/todo-model.ts
  • apps/mobile/src/components/todos/todo-link-session-sheet.tsx
  • apps/mobile/src/lib/todos/todo-model.test.ts
  • apps/mobile/src/lib/case-guard.test.ts

Reviewed by deepseek-flash-latest · Input: 64.1K · Output: 13.1K · Cached: 765.1K

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added the merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. label Oct 22, 2026
@iscekic
iscekic enabled auto-merge October 22, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain janitor:features-workflows Janitor finding family: features-workflows merge:bot Bot-owned review; merge when ready once readiness passes and a review approves.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants