Repository navigation
fix(web): a file under a missing directory says it isn't on this ref - #668
Conversation
A blob URL whose directory doesn't exist on the ref showed the red "That read did not land" error with Try again. It now shows the same "File not found on this ref" state as a missing file in an existing directory; the tree view shares the check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
PastaPastaPasta
left a comment
There was a problem hiding this comment.
Verdict: approve
The fix is correct and as small as it can be. The nested case was failing because treeAtPath throws path not found: <dir> (forge-web/lib/view/tree-nav.ts:163), and the blob view only matched file not found. Both views now go through one predicate, so a missing directory or file anywhere in the path shows the not-found state.
What I checked:
- Could another error be mistaken for a missing path?
isMissingPathError(tree-nav.ts:170) only matchespath not found:orfile not found:. Acrossforge-web, onlytree-nav.ts:163andblob-content.tsx:119produce those strings. Storage and reader failures (object … not found in any pack,REF_DELTA base not found in live packs, quorum and contract misses) don't match, so they still show the retryableReadErrorState.ObjectTypeErrorand malformed-object errors don't match either. - Tree view: before, it matched
includes('path not found')with no colon. It now needspath not found:, andtreeAtPathalways writes that. The tree view now also matchesfile not found:, butloadDircan't throw it, so nothing changes there. - IsDirectory and tags: a tag of a blob returns before any path walk (
blob-content.tsx:108). A path that names a directory still throwsIsDirectoryand redirects. When a middle segment is a file (README.md/x), the tree walk needsMODE_TREE, so it fails aspath not foundand now shows "File not found". That's right. A tag of a tree or blob opened in the tree view still fails inrootTreeOf/ObjectTypeErrorand isn't caught by the new check. - I ran
vitest run lib/view/tree-nav.test.ts(2/2 pass) andtsc --noEmit(clean) on 8002a49.
Nits (none block the merge):
tree-nav.test.ts:13: thefile not foundcase uses a literal string, not the messageloadBlobactually throws (blob-content.tsx:119). If that throw's wording changes, the blob view drops back to the retry error and this test still passes. A typedPathNotFoundErrorwould remove the coupling.causeis already available fromuseAsync, asIsDirectorydoes. Thrown fromtreeAtPath, withloadBlobthrowing it too, it could be matched withinstanceof, not regex. That's optional, since the error strings come from code we own.blob-content.tsx:241: the comment is still accurate, but it could say that a missing parent directory now counts too.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
A link to a file whose directory doesn't exist on the ref (a stale link, a renamed folder, a typo) showed the red "That read did not land — path not found: nope — Try again" error. Retrying can't help. A missing file in an existing directory already got the calm "File not found on this ref" state; only the nested case fell through, because the directory walk throws
path not foundand the blob view only matchedfile not found.The fix adds
isMissingPathErrorinlib/view/tree-nav.ts, and the blob and tree views both use it, so a missing path anywhere shows the not-found state.Before (live, build 3e672fb) and after (local static build of this branch, 8002a49), both at
/repo/blob/?…prime-number-finder&path=nope/missing.txton testnet:Tests:
lib/view/tree-nav.test.ts(new) covers a missing nested directory, a missing file and an unrelated read error. tsc and eslint are clean.Found in UX wave 5's browse probe.
🤖 Generated with Claude Code
Summary by CodeRabbit