Code tab: resolve bare-filename file refs when basename is unique#900
Conversation
#898) The Code-tab open-file pipeline (terminal link clicks, right-click "Open path:N") only matched repo-relative or cwd-relative path candidates. A compiler error printing just `Foo.hs:42` without its `src/lib/` prefix silently fell through to a "File reference not found" toast even when exactly one repo file ended in that basename. `resolveLineRefPath` now falls back to a basename match when the path-based candidates miss. Ambiguous basenames (multiple repo files share the name) keep returning null — opening the wrong file is worse than the toast.
The basename-fallback rationale lives in the JSDoc on resolveLineRefPath. The same paragraph (compiler output / src/lib prefix / ambiguity) was also restated as a section banner in lineRef.test.ts, three per-test inline comments, and a four-line Gherkin preamble. Test names and assertions already say what each test does; the feature scenario name carries the intent. Trimmed all four sites — JSDoc remains canonical.
Hickey/Lowy Analysis
Hickey rationaleThe module continues to address parsing, formatting, and resolution. The new Lowy rationale
|
|
| Step | Status | Duration | Verification |
|---|---|---|---|
| sync | ✓ | 1s | git fetch ok; forge=github; noGit=false |
| research | ✓ | 3m 19s | Issue #898: extend resolveLineRefPath in lineRef.ts:108 with basename fallback when no path-based candidate matches; return null when ambiguous |
| branch | ✓ | 7s | On feature branch fix-898-basename-fileref |
| implement | ✓ | 2m 4s | Modified resolveLineRefPath with basename fallback; added 4 unit tests + 1 e2e scenario; vitest 122/122 passed |
| check | ✓ | 2m 17s | just check exited 0; only pre-existing unrelated warnings |
| docs | ✓ | 17s | README.md line 38 already accurate — basename fallback is a resolution refinement, not a new shape |
| fmt | ✓ | 12s | just fmt — no changes |
| commit | ✓ | 21s | Commit 7f99a4b3 pushed |
| hickey+lowy | ✓ | 3m 34s | Hickey: 0 findings. Lowy: 5 findings, all No-op |
| police | ✓ | 6m 7s | Rules + fact-check clean; elegance trimmed duplicated WHY comments — commit 1aff3f03 |
| test | ✓ | 5m 1s | 44/44 e2e scenarios pass across file-ref-link + code-tab; new scenario passed first try |
| create-pr | ✓ | 1m 33s | Draft PR #900; hickey/lowy ledger posted |
| ci | ✓ | 28m 35s | 11/13 statuses success; e2e@aarch64-darwin success on retry; e2e@x86_64-linux flakes (different scenario each run, all pass individually — see #320); ci/unit verified pre-existing on origin/master |
| evidence | ✓ | 6m 41s | Screenshot captured + uploaded to evidence-assets release |
| Total | 60m 25s |
Slowest step: ci (28m 35s — 47% of total)
Optimization suggestions
- CI ate the budget — five full
ci::e2e@x86_64-linuxruns to chase a different agent-mock-state-polling flake each time (opencode/codex/claude-code state expectations + theGiven a Code tab in "branch" modesetup). Hardening these viae2e-poll-async-state(page.waitForFunctionwithPOLL_TIMEOUT) would collapse the ladder; flake patterns already filed to Flaky tests log #320. - Pre-existing
ci/unitfailure (subscribeGitInfo watcher churn > setCwd between two distinct git repos) is a master-branch regression that gates the sequentialunit → surface-example-buildchain — fixing it independently unblocks the chain and stopssurface-example-buildfrom being marked "not run" on every fulljust ci. - Re-runs from this point can use
--from ci-onlyto skip ~12 minutes of research → implement → check → fmt → commit → hickey/lowy → police → test that the workflow already verified. - Evidence step's 6m 41s is mostly chrome-devtools MCP cold-start + dev-server boot — if multiple
/doruns queue up the same day, leaving the dev server running across runs would reclaim ~3m per evidence capture.
Workflow completed at 2026-05-14 21:14 UTC.

The Code tab now resolves a bare filename like
Foo.hs:42to the unique repo file ending in that basename. Compiler output frequently emits source locations without the full path prefix; previously those clicks fell through to a "File reference not found" toast even when exactly one file in the repo could match. Closes #898.Resolution still tries the path-based candidates first (repo-relative, cwd-relative, absolute-stripped) — the basename scan only fires when all of them miss, and only commits to a result when there's exactly one match. Ambiguous basenames keep returning
null; opening the wrong file is worse than the toast.The fallback covers terminal-link clicks and right-click Open path:N alike — both producers route through the single
openInCodeTabresolver added in #891.Coverage
lineRef.test.ts: unique basename, ambiguous basename → null, slash-with-bad-prefix falls back, exact path candidate still preferred over basenamefile-ref-link.feature: terminal emitsnotes.txt:2while the file lives atsrc/lib/notes.txt; click opens the file in browse mode at line 2Try it locally
```sh
nix run github:juspay/kolu/fix-898-basename-fileref
```
Generated by `/do` on Claude Code (model `claude-opus-4-7`).