Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 6.02 KB

REVIEW.md

File metadata and controls

50 lines (34 loc) · 6.02 KB

Code and architecture review (vcs-python/libvcs)

Posture: experimental (pre-1.0 zero-dependency Python library for Git, Mercurial, and Subversion URLs, command wrappers, and checkout synchronization; repair asymmetric or leaky contracts at the owning module and update callers, docs, and CHANGES in the same diff).

Posture defines experimental, stable and private.

Review the complete change against <base>, including untracked files. Report all findings in one pass without editing files. Writing conventions · Contributing gates · AI policy.

1. Layer ownership

Layer Modules Owns Must not own
Sync orchestration src/libvcs/sync/* (base.py, git.py, hg.py, svn.py) Checkout lifecycle (obtain, update_repo, remote/branch sync), dirty-tree guards, and repository state inspection Raw subprocess spawning bypassing cmd/* or vcspull manifest schemas
Typed CLI wrappers src/libvcs/cmd/* (git.py, git_filter.py, hg.py, svn.py) Flag construction, command invocation over _internal/run.py, and structured vcs_* log fields URL scheme detection or multi-repo workspace orchestration
URL grammar and registry src/libvcs/url/* (base.py, registry.py, git.py, hg.py, svn.py) Pure URL parsing, explicit/implicit rule matching, SCP-like syntax, and scheme normalization Subprocess execution, filesystem probes, or network I/O
Internal runtime and locks src/libvcs/_internal/*, exc.py Subprocess runner (run.py, subprocess.py), QueryList, file locks (file_lock.py), and working-tree preservation (preservation.py, svn_preservation.py) Serving as an undocumented cross-package API for vcspull when a public export is warranted
Test fixtures src/libvcs/pytest_plugin.py Isolated $HOME, VCS config fixtures, and disposable git/hg/svn repositories Mutating the host user's $HOME, ~/.gitconfig, or SSH agent

Changing the map

Do not BLOCK against <base>:REVIEW.md's prior owner row when a pull request migrates an invariant cleanly to a single owner, updates callers, tests, and REVIEW.md in the same diff, and states the old and new owner in the pull request description.

Adapters and format leaks

  • Adapter versus duplicated rule: sync/* orchestrates repository state over cmd/* and url/*, and pytest_plugin.py adapts temporary repositories for tests. Block when sync/* re-parses URLs with ad-hoc regexes instead of libvcs.url, spawns VCS binaries directly instead of routing through cmd/*, or forces downstream vcspull callers to import libvcs._internal for a capability that belongs on the public API.
  • Zero-import format leaks: Check dependency direction even when imports stay clean. Block url/*, cmd/*, or sync/* modules that parse vcspull YAML/JSON workspace structures, snapshot .ambr headers, or PYTEST_CURRENT_TEST environment state, or attach test-only attributes to sync objects.

Rejected here

  • Asymmetric behavior across git, hg, and svn siblings: When changing URL rule precedence, obtain / update_repo contracts, or structured vcs_* log fields, check git, hg, and svn modules together and document backend-specific differences explicitly.
  • Boundary-blind URL regexes: Test positive and negative boundary inputs on libvcs.url rules (scheme spoofing, ports, credentials, SCP colons, Unicode paths, and control characters).
  • Silent partial multi-step state or data loss: Multi-step sync, remote-update, and preservation.py / svn_preservation.py backup-and-restore flows must preserve uncommitted work and surface partial state clearly if step N fails mid-flight.
  • Runtime dependencies or import-time side effects: Keep dependencies = [] in pyproject.toml, and never configure logging handlers or spawn VCS binaries at module import.
  • Unpinned VCS tool workarounds: Track version-specific git, hg, or svn quirks in .github/workarounds.toml (issue_only = true with reason_no_lock and an upstream issue URL) verified by the shared check-workarounds action in CI.

2. Regression baseline and decision

  1. For bug fixes and behavioral changes, reproduce the failure on <base> (or on <pre_fix_head> when fixing a defect introduced earlier in the same open pull request) through the public libvcs.url, libvcs.cmd, or libvcs.sync API.
  2. Verify the production-only revert check fails the new test inside the real owner call (for behavioral changes), then run uv run ruff check ., uv run ruff format . --check, uv run ty check, uv run pytest, and the shared libtmux/.github/actions/check-workarounds action, which CI runs.
  3. Emit BLOCK or NO FINDINGS (plus optional non-blocking NOTE items). Before emitting BLOCK on placement, weigh any boundary-adapter or ownership-transfer counter-case and state a concrete test, command, or code observation that would prove the finding wrong.

3. Verdict

These rules decide which findings block.

  • Base run: A finding that code misbehaves shows its check run on <base> and on the change, with one line of output from each.
  • Existing and separate: Behavior <base> already has does not block. Report it as a NOTE, unless the change adds a promise the behavior breaks; then the broken promise is the finding.
  • Unverified: A gate nobody ran is unverified. Name the command that would run it. It holds the merge until someone runs it, and it does not make the verdict BLOCK.
  • Behavior defects: A behavior defect blocks when a caller can reach it in a supported environment, or when it breaks a promise in the pull request description, a docstring, help text or the changelog. Otherwise it is a NOTE.
  • Checks and claims: A weakened check, a rule written in a second place and a behavior claimed as tested with no test that bites block whether or not a caller reaches them.