Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): repo-root-relative file chips open in subfolder projects #14510

MergedGigioxx(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/14510/headmerged by juliusmarminge View on GitHub

Repository-relative file chips in a subfolder project can repeat the project folder and open a nonexistent path. Qualifying chat links now try the stripped indexed file after a fresh host check confirms the literal path is missing. Existing literal files win; explicit absolute links and links relative to a nested Markdown preview keep their original targets. Panel open and Reveal share the decision, preserving Windows spelling, line numbers, permissions, destination environment, and latest-click ordering.

Maintainer takeover of #14510, with thanks to @Gigioxx for the original fix. Contributor commits are preserved and main was merged. Replaced the index-only absence assumption and helper-test coverage with real chip interactions.

Validation: original PR-added helper cases 5 → 7 observable component cases; the two primary files 83 → 85 cases. All 119 focused tests pass including the existing 34 metadata cases. Original fallback, truncated-index, absolute-link, and nested-preview regressions were each checked against their broken versions. Web and client-runtime typechecks and targeted lint/format pass. Four independent Opus/Sol review rounds addressed stale-index precedence, authored absolute paths, and nested preview bases; round 4 returned no findings from either reviewer.

Before (main): the chip opens the missing duplicated path.

Before: repeated project prefix opens a missing file

After: the same chip opens the repository file at line 1.

After: file chip opens the repository package.json

An existing nested literal file still wins.

Existing literal file takes precedence

Headless Linux app proof used an isolated synthetic conversation and actual filesystem/index/metadata reads, including creating and deleting a nested literal file. A reload was needed to clear the file preview's existing cached missing-file state after creating it. Both sides use the same browser-only fallback font because this VM's Chromium system fonts render blank; production fonts are unchanged. Absolute/nested-preview preservation, Windows paths and stale clicks are proven by Chromium component tests. Reveal's shell action, remote/tunnel sessions, macOS, Windows, iOS, Android, and Electron desktop were not exercised. Mobile's separate renderer is unchanged.

Implementation: GPT-6.1 Sol / Codex. Tests: GPT-6 Astra / Codex. Reviews: Claude Opus 5.5 / Claude Code and GPT-6 Sol / Codex.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 149e2b4

      Macroscope's review found this PR approvable — This is a focused web bug fix that corrects repository-relative file-chip resolution while preserving explicit paths and existing-file precedence. Its small production surface is covered by targeted browser tests, and the filesystem metadata call uses an existing authorized RPC without changing schemas or defaults.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Warning

      Review limit reached

      Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

      Next included review available in 9 seconds.

      Check out review usage here.

      View limit details

      Limit details: You’ve used all 10 included reviews currently available.

      Learn how review limits work.

      Review configuration:

      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 983efada-e16f-42a0-907f-617f95beb1a4
      📥 Commits

      Reviewing files that changed from the base of the PR and between 60499a44330ab07b8a69b9a923b9fc52e99d468f and 149e2b4ae9e01d5195d32ae2284194d1b195e539.

      📒 Files selected for processing: 5
      • apps/web/src/components/ChatMarkdown.browser.test.tsx
      • apps/web/src/components/ChatMarkdown.tsx
      • apps/web/src/markdown-links.ts
      • apps/web/src/workspaceBasenameLookup.ts
      • packages/client-runtime/src/state/filesystem.ts

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 0878da61-f756-4659-95e8-770a3add3949

      📥 Commits

      Reviewing files that changed from the base of the PR and between 2fba7430e8efe1a73b6eee6c859ccc98ff2a6995 and 60499a44330ab07b8a69b9a923b9fc52e99d468f.

      📒 Files selected for processing (3)
      • apps/web/src/components/ChatMarkdown.tsx
      • apps/web/src/workspaceBasenameLookup.test.ts
      • apps/web/src/workspaceBasenameLookup.ts

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

      📝 Walkthrough
      📝 Walkthrough

      Walkthrough

      Workspace file lookup now handles bare filenames and paths that repeat the workspace directory prefix. File-panel opens use this lookup when needed and open other paths directly.

      Changes

      Workspace file lookup

      Layer / File(s)Summary
      Repeated-prefix normalization
      apps/web/src/workspaceBasenameLookup.ts, apps/web/src/workspaceBasenameLookup.test.ts
      Adds a helper to strip repeated workspace-directory prefixes. Tests cover slash styles, Windows-style case differences, and paths that do not match.
      File-panel path lookup
      apps/web/src/components/ChatMarkdown.tsx, apps/web/src/workspaceBasenameLookup.ts, apps/web/src/workspaceBasenameLookup.test.ts
      Lookup now handles bare basenames and repeated-prefix paths. It preserves literal indexed paths and returns no match when lookup fails. Tests cover path selection and platform-specific casing.

      Priority: ⬇️ Low

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

      Change: Bug fix · Severity of issue fixed: Low

      Merge Risk: ⚪ Minimal · up to 60499

      The change adds lookup for repeated project prefixes while preserving indexed literal paths. No concrete merge-blocking issue is established; merge after normal checks pass.

      ### Architecture Summary

      Architecture risk: 🟡 Medium · up to 2fba7

      The change affects 1 system.

      Changed systems: apps/web

      Architecture concerns No architecture-level concerns identified.

      Review details

      Systems and components

      • observed — apps/web (ui) was modified; 3 changed files map to changed impact.

      Before / after behavior

      • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: Adds stripRepeatedWorkspacePrefix to the workspace basename lookup imports.
      • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: findWorkspaceBasenameMatch now searches for both bare basenames and paths with repeated workspace prefixes. It strips repeated prefixes before querying; for basename lookups it selects a matching entry, and for stripped paths it returns the stripped path only when the index contains it and does not contain the original literal path. Search failures or invalid paths return no match. The adjacent comment now also identifies repo-root-relative paths as lookup cases.
      • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: openFileInPanel now performs lookup when the path is a basename or has a repeated workspace prefix. Paths that are neither, and paths without a working directory, continue to open directly.
      • observed — Modified behavior in apps/web/src/workspaceBasenameLookup.test.ts: The test file adds stripRepeatedWorkspacePrefix to its imports.

      Reliability and maintainability

      • inferred — Risk-relevant change factors for apps/web: blast_radius_1; direct_dependents_1
      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Linked Issues checkPassedIssue #14492 requires web file chips to resolve repository-root-relative paths in subfolder projects. ChatMarkdown.tsx uses the new workspace lookup for chat and file-panel opens. `stripRepeatedWork…
      Out of Scope Changes checkPassedThe changed files implement and test the web behavior required by issue #14492. No unrelated production changes are identified. Mobile remains unchanged, which is within the stated web scope.
      Description checkPassedThe description clearly covers the problem, implementation, scope, linked prior work, verification results, screenshots, limitations, and agent metadata. It does not use the template headings, but it …
      Title checkPassedThe title is concise, specific, and accurately summarizes the main change: fixing repo-root-relative file chips in subfolder projects.
      Full details: Linked Issues check

      Explanation

      Issue #14492 requires web file chips to resolve repository-root-relative paths in subfolder projects. ChatMarkdown.tsx uses the new workspace lookup for chat and file-panel opens. stripRepeatedWorkspacePrefix removes repeated project prefixes. pickStrippedWorkspaceMatch uses the stripped path only when the literal path is not indexed. Tests cover prefix stripping, nested-path precedence, and Windows path casing.

      Full details: Description check

      Explanation

      The description clearly covers the problem, implementation, scope, linked prior work, verification results, screenshots, limitations, and agent metadata. It does not use the template headings, but it includes the required information.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Autopilot is currently an internal CodeRabbit preview.

      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. juliusmarminge assignedjuliusmarminge

    6. Taking over this one as maintainer for batch web-misc-04. I will preserve your commits, merge current main, simplify the tests and implementation where useful, and run independent reviews. Thanks @Gigioxx for the subfolder file-chip fix.

    7. juliusmarminge merged this10b6779

    8. juliusmarminge closed this

Sign in to join this conversation.