fix: 👍 Top features/issues by Votes (updated automatically every hour)#614
fix: 👍 Top features/issues by Votes (updated automatically every hour)#614abhiavi wants to merge 1 commit intobrowseros-ai:mainfrom
Conversation
Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement. To sign the CLA, please add a comment to this PR with the following text: You only need to sign once. After signing, this check will pass automatically. Troubleshooting
|
Greptile SummaryThis PR fixes a bug in the Key changes:
One follow-up to consider: Confidence Score: 5/5Safe to merge — the fix is targeted, well-tested, and corrects a clear false-positive in binary-patch comparison without introducing regressions. The core change is a one-line simplification with a clear root cause and matching test coverage. All remaining findings are P2 style/cleanup suggestions. No correctness, data-integrity, or reliability issues remain. packages/browseros/tools/bdev/internal/patch/repo.go — the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["signature(p FilePatch)"] --> B{"Op == OpDelete"}
B -- Yes --> C["return delete:path"]
B -- No --> D{"IsPureRename"}
D -- Yes --> E["return rename:oldPath:path"]
D -- No --> F{"Op == OpBinary"}
F -- "Yes - AFTER FIX all OpBinary" --> G["return binary:path"]
F -- "No - default" --> H["content-based text signature"]
G --> I["Consistent match: Binary files patch and .binary marker both give binary:path"]
H --> J["BEFORE FIX: OpBinary with content fell here causing NeedsUpdate mismatch"]
Prompt To Fix All With AIThis is a comment left during a code review.
Path: packages/browseros/tools/bdev/internal/patch/repo.go
Line: 125-126
Comment:
**`patchWriteTarget` condition is now inconsistent with `signature()`**
Now that `signature()` treats all `OpBinary` patches identically (ignoring `Content`), the write path in `patchWriteTarget` has a parallel `len(patchFile.Content) == 0` guard that no longer reflects how comparison works. Binary patches *with* content are stored as raw files (with the content written to disk), but their content is now ignored at compare-time — making the stored content effectively dead weight.
Per the project's cleanup conventions, consider removing the `&& len(patchFile.Content) == 0` guard here and always writing `OpBinary` patches as `.binary` markers, consistent with how `signature()` now treats them:
```go
case patchFile.Op == OpBinary:
return filepath.Join(patchesDir, filepath.FromSlash(patchFile.Path+".binary")), []byte("Binary file")
```
This would make the write path and compare path coherent with each other.
**Rule Used:** Remove unused/dead code rather than leaving it in ... ([source](https://app.greptile.com/review/custom-context?memory=9b045db4-2630-428c-95b7-ccf048d34547))
**Learnt From**
[browseros-ai/BrowserOS-agent#126](https://github.com/browseros-ai/BrowserOS-agent/pull/126)
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix: handle binary patches consistently ..." | Re-trigger Greptile |
|
I have read the CLA Document and I hereby sign the CLA. |
|
Sorry @abhiavi the PR title and fix is completely different! can you please elaborate what is being fixed here. Thanks! |
Fix for 👍 Top features/issues by Votes (updated automatically every hour). Verified with local tests.