fix(admin): don't treat an enclosing repo as an editable install - #562
Open
ddy4633 wants to merge 1 commit into
Open
fix(admin): don't treat an enclosing repo as an editable install#562ddy4633 wants to merge 1 commit into
ddy4633 wants to merge 1 commit into
Conversation
`_repo_dir()` walked every ancestor of the package looking for `.git`, so a wheel installed anywhere inside a git repository was classified as an editable clone. Two common layouts hit this: - a venv inside the user's own project (`project/.venv/lib/.../browser_harness`) - `uv tool install` under a dotfiles-managed `$HOME` In both cases `browser-harness --update -y` ran `git status` and `git pull --ff-only` against the *user's* repository, skipped the actual package upgrade, and still printed "update complete." Only two directories can hold this package as source: the package's parent (flat layout) and its grandparent (src layout). Checking just those keeps editable-clone detection working while no longer claiming unrelated repos.
Kastan97
reviewed
Jul 28, 2026
Kastan97
left a comment
There was a problem hiding this comment.
Ollie (CTO) Review: APPROVED ✅
What this does: Fixes wheel-install detection by checking for site-packages in the path rather than walking up to any enclosing .git directory. Prevents accidental git operations on enclosing repos when browser-harness is installed as a dependency.
Good to merge once CI passes.
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 bug
_repo_dir()insrc/browser_harness/admin.pywalked every ancestor of the package looking for a.gitdirectory:A wheel installed anywhere inside a git repository therefore gets classified as an editable clone. Two ordinary layouts hit this:
project/.venv/lib/python3.x/site-packages/browser_harness/uv tool installunder a dotfiles-managed$HOMErun_update()then takes the clone branch: it runsgit statusandgit pull --ff-onlyagainst the user's own repository, never performs the package upgrade, and still printsupdate complete.Sobrowser-harness --update -ysilently does nothing except touch an unrelated repo — and reports success.The fix
Only two directories can plausibly hold this package as source: the package's own parent (flat layout) and its grandparent (src layout). Checking just those keeps editable-clone detection working for real clones while no longer claiming enclosing repositories.
How to test
Five tests added. Three fail without the fix:
The other two pin the behaviour that must not change — a genuine editable clone in both flat and src layout is still detected.
Note
While reading the surrounding modules I noticed a separate, unrelated issue worth a maintainer's design input rather than a drive-by patch: in
video_render.py,_start_exporthard-codes Chrome'sdownloadPathto the recording directory and passes onlywebm.name, while the poll loop at:440-445watchesoutput.with_suffix(".webm")derived from--output. Any--outputoutside the recording directory times out afterduration + 30sand orphans a fully-recorded file. There are two reasonable fixes (download intooutput.parent, or force the output into the recording dir), so I've left it alone — happy to file it as an issue if that's useful.Summary by cubic
Fixes editable-install detection so wheels installed inside a git repo aren’t mistaken for editable clones. This prevents
browser-harness --update -yfrom runninggit pullon a user’s repo and ensures the package actually upgrades._repo_dir()now only checks the package’s parent and grandparent for.git(flat andsrclayouts) instead of walking all ancestors.run_update()for wheel installs no longer touches enclosing repos; it performs the upgrade (e.g.,uv tool upgrade browser-harness).Written for commit 1e49f5f. Summary will update on new commits.