Skip to content

fix(web): a file under a missing directory says it isn't on this ref - #668

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/blob-missing-path
Nov 23, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/blob-missing-path

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

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 found and the blob view only matched file not found.

The fix adds isMissingPathError in lib/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.txt on testnet:

Before After
before after

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

  • Bug Fixes
    • Missing files and directories are now recognized more consistently, so the appropriate “File not found” or missing-directory message appears when a path cannot be found.
    • Other errors, such as unrelated object-read failures, are not treated as missing paths.
  • Tests
    • Added coverage for missing files and directories, unrelated errors, and empty error values.

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]>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Blob and tree views now use a shared helper to detect missing-path errors. The helper recognizes missing file and directory messages, and tests cover those messages, unrelated errors, and a null value.

Changes: Missing-Path Handling

Layer / File(s) Summary
Shared detection and view integration
forge-web/lib/view/tree-nav.ts, forge-web/lib/view/index.ts, forge-web/components/repo/blob-content.tsx, forge-web/components/repo/tree-content.tsx, forge-web/lib/view/tree-nav.test.ts
The view library exports isMissingPathError, which recognizes messages containing path not found: or file not found: . Blob and tree views use it to select their existing missing-path states. Tests cover matching messages, an unrelated error, and null.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 8002a

Files under a missing directory should now show the "File not found on this ref" state instead of a retry error. The change is small and reversible, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the actual change: a file under a missing directory wrongly reported as not on this ref. The raw summary shows the blob and tree views now use isMissingPathError to route missing neste…
Description check Passed The description covers the problem (a missing directory showed the red 'path not found' error), the fix (isMissingPathError in lib/view/tree-nav.ts used by blob and tree views), tests (tree-nav.test.t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: a file under a missing directory wrongly reported as not on this ref. The raw summary shows the blob and tree views now use isMissingPathError to route missing nested paths to the not-found state, so the title matches the main change.

Full details: Description check

Explanation

The description covers the problem (a missing directory showed the red 'path not found' error), the fix (isMissingPathError in lib/view/tree-nav.ts used by blob and tree views), tests (tree-nav.test.ts with three cases, tsc and eslint clean), and before/after screenshots at the blob route. It does not follow the repository template: the 'What and why' and 'How it was tested' headings are not used as such, the make check-rust and make check-web items are not stated, the rule-vector and docs/guides checklist items are not addressed, and the screenshots are not given at 390 px wide in both themes. It also does not link an issue. These gaps are non-critical for a small web bug fix, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89054ea0-20f8-4536-b094-3ca5d63576a8
Commits

Reviewing files that changed from the base of the PR and between 4e34b8d and 8002a49.

Files selected for processing: 5

  • forge-web/components/repo/blob-content.tsx
  • forge-web/components/repo/tree-content.tsx
  • forge-web/lib/view/index.ts
  • forge-web/lib/view/tree-nav.test.ts
  • forge-web/lib/view/tree-nav.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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 matches path not found: or file not found: . Across forge-web, only tree-nav.ts:163 and blob-content.tsx:119 produce 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 retryable ReadErrorState. ObjectTypeError and malformed-object errors don't match either.
  • Tree view: before, it matched includes('path not found') with no colon. It now needs path not found: , and treeAtPath always writes that. The tree view now also matches file not found: , but loadDir can'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 throws IsDirectory and redirects. When a middle segment is a file (README.md/x), the tree walk needs MODE_TREE, so it fails as path not found and now shows "File not found". That's right. A tag of a tree or blob opened in the tree view still fails in rootTreeOf/ObjectTypeError and isn't caught by the new check.
  • I ran vitest run lib/view/tree-nav.test.ts (2/2 pass) and tsc --noEmit (clean) on 8002a49.

Nits (none block the merge):

  1. tree-nav.test.ts:13: the file not found case uses a literal string, not the message loadBlob actually 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 typed PathNotFoundError would remove the coupling. cause is already available from useAsync, as IsDirectory does. Thrown from treeAtPath, with loadBlob throwing it too, it could be matched with instanceof, not regex. That's optional, since the error strings come from code we own.
  2. 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.

@PastaPastaPasta
PastaPastaPasta merged commit c03f765 into master Nov 23, 2026
20 checks passed
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.

1 participant