GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — feat(web): file references open the file and lines they name by Brechard · Pull Request #6289 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| return /^\/[A-Za-z]:\//.test(normalized) ? normalized.slice(1) : normalized; | ||
| } | ||
|
|
||
| function collapseDotSegments(path: string): string { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium src/composerMentionFileTarget.ts:17
collapseDotSegments discards a leading .. segment for absolute paths. For an input like /workspace/../../workspace/file.ts, the initial /workspace is popped by the first .., leaving an empty segment stack. The second .. is then skipped because segments[segments.length - 1] is undefined (failing the segments.length > 0 check), so it is not pushed, and the final joined string is workspace/file.ts. The returned /workspace/file.ts is correct. However, the logic relies on segments.length > 0 to prevent pushing .. at the root; if that guard were ever removed, excess .. segments would be pushed and the path would escape the root. This is not currently a defect.
In file @apps/web/src/composerMentionFileTarget.ts around line 17:
`collapseDotSegments` discards a leading `..` segment for absolute paths. For an input like `/workspace/../../workspace/file.ts`, the initial `/workspace` is popped by the first `..`, leaving an empty segment stack. The second `..` is then skipped because `segments[segments.length - 1]` is `undefined` (failing the `segments.length > 0` check), so it is not pushed, and the final `joined` string is `workspace/file.ts`. The returned `/workspace/file.ts` is correct. However, the logic relies on `segments.length > 0` to prevent pushing `..` at the root; if that guard were ever removed, excess `..` segments would be pushed and the path would escape the root. This is not currently a defect.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Leaving this one as-is. The comment says it itself — "This is not currently a defect": /workspace/../../workspace/file.ts resolves to /workspace/file.ts, which is both what POSIX specifies (/.. is /) and what the code returns. The finding is about a guard that would matter only if a future edit removed it, and segments.length > 0 is the thing doing the work by design. Happy to add a test pinning the behaviour if that is preferred to code changes here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Correcting my earlier reply — I was right about the claim and wrong to stop there.
The claim as written does not hold: the second .. is pushed, not skipped. segments.length > 0 fails, so control falls through to segments.push(segment), and /workspace/../../workspace/file.ts returned /../workspace/file.ts rather than the /workspace/file.ts the comment describes.
But chasing that turned up a real defect, one I introduced two commits later while fixing the workspace-rooted-at-/ case. A surviving leading .. fails the containment check against a normal root, so the chip stays inert — but a / root has an empty prefix, so /../a/file.ts passed containment and reached the file surface as the relative ../a/file.ts, walking out of the cwd. Verified before fixing:
resolveComposerMentionFileTarget("../a/secret.ts", "/") → { relativePath: "../a/secret.ts" }
Fixed in 845ddf5: /.. is /, so an absolute path drops the climbing segment instead of keeping it. Two tests pin it. Thanks — the finding's reasoning was off but its instinct about that guard was not.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b269a49. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces significant new capability: clicking file references now opens files with line/span highlighting. It adds ~750 lines of new logic including path resolution with security-relevant containment checks and async workspace index lookups. New features of this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- `--goto` editors (VS Code, Cursor, and friends) were handed a raw `path:20-40`, which they read as part of the filename. The argument is now rebuilt from the parse as `path:line[:column]`; every non-span shape produces the same string it did before. - Two bare-filename lookups resolving out of order let the older answer land last and move the panel off the file the newest click asked for. Lookups now claim a sequence and drop their result once superseded. - `pickWorkspaceBasenameMatch` folded case, so a workspace holding both `Foo.ts` and `foo.ts` could open whichever the index ranked higher. Exact filename match wins now, with the case-insensitive pass kept as a fallback for a reference whose casing drifted from disk. - The workspace containment check folded case too, which accepted `/users/dev/repo/x.ts` against a `/Users/dev/repo` root on a case-sensitive filesystem. It compares exactly now; only a Windows drive letter is folded. - A workspace rooted at `/` stripped to an empty prefix and left every mention chip inert. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Filed #6292 for the underlying bug, per CONTRIBUTING's issue-first rule — my mistake opening the PR first. Pushed 7ebb9b6 addressing the reviewer findings: the Verification after the fixes: typecheck and lint clean for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
`collapseDotSegments` kept a `..` that had nothing left to pop, so an absolute path could come back as `/../a/file.ts`. Against a normal workspace root that fails the containment check and the chip stays inert, but the workspace-rooted-at-`/` case added in the previous commit has an empty root prefix, so the path passed containment and reached the file surface as `../a/file.ts` — a relative path that walks out of the cwd. `/..` is `/`, so an absolute path now drops the climbing segment instead of keeping it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
|
Closing this — it was size L and mixed three separate concerns, so I've split it into smaller PRs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.