fix: default project_root to cwd when repo_url is provided#689
fix: default project_root to cwd when repo_url is provided#689singhvishalkr wants to merge 2 commits intoDagsHub:mainfrom
Conversation
Fixes DagsHub#318 When DagsHubFilesystem is created with a repo_url but without project_root, and the current directory is not inside a git repo, the constructor now defaults project_root to the current working directory instead of raising a ValueError. Made-with: Cursor
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 19 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModified Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f28bc2a-b868-4113-b5ea-b24cb9431cee
📒 Files selected for processing (1)
dagshub/streaming/filesystem.py
📜 Review details
🧰 Additional context used
🪛 Ruff (0.15.10)
dagshub/streaming/filesystem.py
[warning] 129-134: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
Address CodeRabbit review: use raise...from err to preserve traceback context (Ruff B904), and log a message when defaulting project_root to cwd so behavior is discoverable. Made-with: Cursor
|
@coderabbitai Both review points were addressed in
Could you re-review and clear |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainLet me inspect the current state of the file to verify both fixes. 🏁 Script executed: Length of output: 1900
The logic is also sound: the fallback only activates when [approve] |
|
Could you re-review so the PR state flips back from |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1610
Everything looks good — approving the PR now. [approve] |
|
@coderabbitai both points were already applied in the latest push -- |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1900
Everything looks good — approving the PR now. [approve] |
Summary
Fixes #318
When
DagsHubFilesystemis created with arepo_urlbut withoutproject_root, and the current directory is not inside a git repo, the constructor now defaultsproject_rootto the current working directory instead of raising aValueError.Before
`python
fs = DagsHubFilesystem(repo_url=url)
ValueError: Could not find a git repo...
``n
After
`python
fs = DagsHubFilesystem(repo_url=url)
Works -- project_root defaults to cwd
``n
Changes
DagsHubFilesystem.__init__: when noproject_rootis given and git repo discovery fails, check ifrepo_urlwas provided. If so, fall back to the current working directory. If neither is provided, the originalValueErroris raised unchanged.Testing
The fallback only activates when (1)
project_rootisNone, (2) the cwd is not inside a git repo, and (3)repo_urlis provided. All other code paths remain unchanged.Made with Cursor