scope .gitattributes bluepilot/ binary override to actual binaries - #187
Open
kevin-david wants to merge 1 commit into
Open
scope .gitattributes bluepilot/ binary override to actual binaries#187kevin-david wants to merge 1 commit into
.gitattributes bluepilot/ binary override to actual binaries#187kevin-david wants to merge 1 commit into
Conversation
kevin-david
force-pushed
the
fix/gitattributes-bluepilot-text
branch
from
August 19, 2026 20:56
601bcf0 to
28218fa
Compare
The `bluepilot/** -filter -diff -merge` line keeps BP-owned binaries as raw git objects instead of LFS. Only 11 files under bluepilot/ need that: 10 png icons and material-icons.ttf. Those are the only ones matching an LFS rule above. The glob matches all 256 tracked files there, so the other 245 inherit `-diff` and `-merge` as well. Those 245 are Python, TypeScript/TSX, CSS, JS, JSON, and Markdown. Marking text as binary costs three things. GitHub honors .gitattributes, so it renders every change under bluepilot/ as "Binary file not shown". A pull request that touches the backend or the web portal shows no reviewable patch. `-merge` selects the binary merge driver, which cannot perform a 3-way merge. A conflict under bluepilot/ keeps one whole side and drops the other, and recovery requires extracting the three stages and running `git merge-file` by hand. bluepilot/backend_switch.py conflicts routinely when merging between branches, so this happens in practice, and nothing warns you that a side was dropped. `git grep -I` also honors the `diff` attribute, so the tree is invisible to any tool that skips binaries: CI greps, secret scanners, license scanners, and manual audits. A `git grep -I` for comma.ai under bluepilot/ returns 0 hits today and 1 hit after this change, in backend_switch.py. Replace the catch-all with the seven extensions the LFS rules above claim, scoped to bluepilot/. Text files get no override at all, so git applies its own binary detection to them. That is the behavior the original comment describes. Naming the binary extensions rather than re-enabling diff and merge on the text ones matters for two reasons. Git auto-detects binary content by NUL byte, so a new binary type under bluepilot/ is handled correctly with no attribute, while an explicit `diff` would force text treatment on it. And the seven extensions listed here are exactly the set the global LFS rules cover, so a new BP-owned binary of any of those types still bypasses LFS, which the catch-all also did. Verified with `git check-attr diff merge filter` over all 256 tracked files under bluepilot/. Before: all 256 report `diff: unset, merge: unset, filter: unset`. After: the 11 binaries keep that, and the other 245 report `unspecified` for all three, which is git's default handling. No file moves into or out of LFS. Appending one line to backend_switch.py now produces `1 file changed, 1 insertion(+)` instead of `Bin 10127 -> 10135 bytes`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kevin-david
force-pushed
the
fix/gitattributes-bluepilot-text
branch
from
August 19, 2026 21:26
28218fa to
d227feb
Compare
kevin-david
marked this pull request as ready for review
August 19, 2026 21:47
.gitattributes bluepilot/ binary override to actual binaries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
.gitattributescurrently has:-filteris the part that does the stated job, and only 11 files underbluepilot/need it: 10 png icons andmaterial-icons.ttf. Those are the only files there matching an LFS rule earlier in the file. The glob matches all 256 tracked files underbluepilot/, so the other 245 pick up-diffand-mergetoo. Those 245 are Python, TypeScript/TSX, CSS, JS, JSON, and Markdown.Marking text as binary costs three things.
Pull requests under bluepilot/ show no reviewable diff
GitHub honors
.gitattributes, so it renders every change underbluepilot/as "Binary file not shown". A PR that touches the backend or the web portal arrives with no patch to read.Conflicts under bluepilot/ cannot be 3-way merged
-mergeselects the binary merge driver, which has no 3-way merge. A conflict keeps one whole side, drops the other, and printsCannot merge binary files. Recovery means extracting the three stages and runninggit merge-fileby hand.bluepilot/backend_switch.pyconflicts routinely when merging between branches, so this happens in practice. The silent drop is the risky part, because nothing tells you a side went missing.The tree is invisible to grep-based tooling
git grep -Ialso honors thediffattribute, so every tool that skips binaries skips all ofbluepilot/: CI greps, secret and credential scanners, license scanners, and manual audits. Measured onbp-dev:A file that git cannot grep is a file nobody can audit.
The fix
Replace the catch-all with the seven extensions the LFS rules above claim, scoped to
bluepilot/. Text files get no override at all, so git applies its own binary detection to them.Naming the binaries is better than re-enabling
diffandmergeon the text files, for two reasons:bluepilot/is handled correctly with no attribute at all. An explicitdiffwould instead force text treatment on it, which recreates a smaller version of this bug.Verification
git check-attr diff merge filterover all 256 tracked files underbluepilot/:diff: unset,merge: unset,filter: unsetdiff: unset,merge: unset,filter: unsetunspecifiedfor all three, which is git's defaultNo file moves into or out of LFS.
Alternatives considered
Deleting the
bluepilot/**line outright, with no replacement: the 11 binaries then resolve tofilter: lfs, which is the LFS hosting the comment exists to avoid.Deleting the inherited
*.onnx *.svg *.png *.gif *.ttf *.otf *.wav filter=lfsblock instead, so nothing underbluepilot/needs a-filteroverride at all: this breaks the repo. 263 tracked files currently resolve tofilter: lfs, and their blobs are pointers rather than content.git cat-file -p HEAD:selfdrive/modeld/models/dmonitoring_model.onnxreturns 132 bytes ofversion https://git-lfs.github.com/spec/v1 / oid sha256:... / size 7494962. Without the filter rule, git checks those pointers out as the model files, and the model build fails. Reversing the LFS setup would mean migrating all 263 objects back into git history first.Appending one line to
bluepilot/backend_switch.py, before and after:This PR's own diff renders normally, because the bug affects files under
bluepilot/rather than.gitattributesitself. To reproduce it, edit anybluepilot/*.pyand rungit diffwith and without the patch applied.The change touches one file and no code.