Skip to content

fix(desktop): false positive LFS detection from .lfsconfig - #1246

Merged
Kitenite merged 1 commit into
ParadevAI:mainfrom
de1mat:fix/lfs-false-positive
Feb 6, 2026
Merged

Kitenite merged 1 commit into
ParadevAI:mainfrom
de1mat:fix/lfs-false-positive

Conversation

@de1mat

@de1mat de1mat commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

The repoUsesLfs() function checks .lfsconfig for the string [lfs] and treats it as evidence that the repo tracks files with LFS. However, .lfsconfig is a configuration file for LFS behaviour (server URLs, lock settings) - the [lfs] string is just an INI section header present in every .lfsconfig file.

The superset.sh repo itself has a .lfsconfig with only locksverify = false, which triggers a false positive. This blocks workspace creation with a "please install git-lfs" error even though no files are tracked with LFS.

Here is a screenshot of trying to create a new workspace using the superset repo:

image

This PR removes .lfsconfig from the attribute file check. The remaining detection methods are sufficient:

  • .git/lfs/ directory (LFS objects present)
  • .gitattributes with filter=lfs (files configured for LFS tracking)
  • .git/info/attributes with filter=lfs
  • git check-attr filter on sample files

Related Issues

Fixes #1244

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

  • Updated the "detects LFS via .lfsconfig" test to verify that .lfsconfig alone does not trigger LFS detection
  • All 12 existing tests pass

Remove .lfsconfig from the LFS detection check. The file only
configures LFS behaviour (e.g. locksverify) and does not indicate
that files are tracked with LFS. This caused workspace creation to
fail for repos with a .lfsconfig but no actual LFS-tracked files.
@coderabbitai

coderabbitai Bot commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR fixes a bug where Git LFS detection incorrectly identifies repositories as using LFS based solely on the presence of a .lfsconfig file. The fix removes .lfsconfig from LFS detection logic and updates corresponding tests to verify that actual LFS tracking indicators (.gitattributes and .git/info/attributes) are required for detection.

Changes

Cohort / File(s) Summary
LFS Detection Logic
apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts
Removed .lfsconfig from the list of attribute files checked by repoUsesLfs, narrowing LFS detection to .gitattributes and .git/info/attributes only.
LFS Detection Tests
apps/desktop/src/lib/trpc/routers/workspaces/utils/git.test.ts
Updated test to reflect that .lfsconfig alone does not indicate LFS usage; changed assertion to verify .lfsconfig with only locksverify setting does not trigger LFS detection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • git lfs fix #256: Previously added .lfsconfig as an LFS detection attribute source; this PR reverses that change after identifying it as the root cause of false-positive LFS detection.

Poem

🐰 A config file caused quite the fuss,
.lfsconfig fooled us, no LFS for us!
Now detection is keen, only true signs we see,
.gitattributes speaks truth—LFS guaranteed! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing false positive LFS detection caused by .lfsconfig files.
Linked Issues check ✅ Passed The changes fully address issue #1244 by removing .lfsconfig from LFS detection, preventing false positives for repos without LFS-tracked files.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the LFS detection issue; no unrelated or out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description provides a clear explanation of the issue, rationale for the fix, and evidence via screenshots. All required template sections are completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@de1mat

de1mat commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

@Kitenite found this bug today when I went to try and create a new workspace in my superset repo, and it would not create because of the above error.

@Kitenite Kitenite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review: LGTM

Summary: Clean, correct, and minimal fix for a real false-positive bug.

Analysis

The root cause is clear: .lfsconfig is an INI-format config file (server URLs, lock settings) where [lfs] is just a section header present in every .lfsconfig file. Checking it alongside .gitattributes and .git/info/attributes — which use an entirely different format — was a category error. Any repo with a .lfsconfig would hit the content.includes("[lfs]") branch and falsely report LFS usage.

The remaining four detection methods are robust and cover all legitimate LFS scenarios:

  1. .git/lfs/ directory — LFS objects are present
  2. .gitattributes with filter=lfs — files configured for tracking
  3. .git/info/attributes with filter=lfs — same, local override location
  4. git check-attr filter on sample files — runtime attribute check

Test update

The test change is appropriate — it now asserts the correct behavior (.lfsconfig alone ≠ LFS detection) instead of the incorrect behavior it was previously verifying.

Minor observation (not blocking)

The condition on line 258 still checks content.includes("[lfs]") for .gitattributes and .git/info/attributes. Since those files use gitattributes format (not INI), [lfs] would never appear in a well-formed attributes file, so this branch is dead code for the remaining files. Could be cleaned up separately but is harmless.

@Kitenite Kitenite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review: LGTM

Summary: Clean, correct, and minimal fix for a real false-positive bug.

Analysis

The root cause is clear: .lfsconfig is an INI-format config file (server URLs, lock settings) where [lfs] is just a section header present in every .lfsconfig file. Checking it alongside .gitattributes and .git/info/attributes — which use an entirely different format — was a category error. Any repo with a .lfsconfig would hit the content.includes("[lfs]") branch and falsely report LFS usage.

The remaining four detection methods are robust and cover all legitimate LFS scenarios:

  1. .git/lfs/ directory — LFS objects are present
  2. .gitattributes with filter=lfs — files configured for tracking
  3. .git/info/attributes with filter=lfs — same, local override location
  4. git check-attr filter on sample files — runtime attribute check

Test update

The test change is appropriate — it now asserts the correct behavior (.lfsconfig alone does not equal LFS detection) instead of the incorrect behavior it was previously verifying.

Minor observation (not blocking)

The condition on line 258 still checks content.includes("[lfs]") for .gitattributes and .git/info/attributes. Since those files use gitattributes format (not INI), [lfs] would never appear in a well-formed attributes file, so this branch is dead code for the remaining files. Could be cleaned up separately but is harmless.

@Kitenite

Kitenite commented Feb 6, 2026

Copy link
Copy Markdown
Member

My bad claude code decided to make those comments. Don't worry, i actually review PRs haha

@Kitenite
Kitenite merged commit b8c5015 into ParadevAI:main Feb 6, 2026
1 check passed
@Kitenite

Kitenite commented Feb 6, 2026

Copy link
Copy Markdown
Member

Thanks @de1mat !

@de1mat
de1mat deleted the fix/lfs-false-positive branch February 8, 2026 07:07
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.

[bug] Creating workspace fails with Git LFS error for repos that don't use LFS

2 participants