Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 5.59 KB

REVIEW.md

File metadata and controls

49 lines (33 loc) · 5.59 KB

Code and architecture review (vcs-python/g)

Posture: experimental (pre-1.0 zero-dependency CLI wrapper that detects the current directory's git, svn, or hg checkout and proxies arguments directly; fix leaky or asymmetric behavior at the owning function and update tests, 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 Functions / Files Owns Must not own
VCS path detection find_repo_type(), vcspath_registry (src/g/__init__.py) Walking directory ancestors for .git (directory or worktree/submodule file), .svn, and .hg markers Subprocess spawning, sys.argv reading, or logging configuration
CLI parser create_parser() (src/g/__init__.py) --version / -V flag definition and argparse.REMAINDER pass-through help metadata (docs/cli/index.md) Intercepting or rewriting downstream VCS flags (-h, -v, subcommands)
Process runner run() (src/g/__init__.py) Entry-point dispatch, --version short-circuit, missing-VCS reporting, and subprocess.Popen execution (wait vs communicate) Re-implementing find_repo_type() marker rules or adding runtime dependencies
Metadata and tests src/g/__about__.py, conftest.py, tests/test_cli.py Package version metadata (exec'd by docs/conf.py) and real-VCS CLI integration tests Mocking subprocess.Popen when a real tmp_path repository exercises the path

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: run() adapts sys.argv and find_repo_type() into a transparent subprocess.Popen call, while create_parser() documents the CLI contract for Sphinx. Block when run() and create_parser() diverge on --version / -V vs forwarded VCS flags, or when run() duplicates marker checks owned by find_repo_type().
  • Zero-import format leaks: Keep find_repo_type() and create_parser() free of test-runner or environment inspection. G_IS_TEST in run() exists solely so tests/test_cli.py can inspect the spawned Popen handle instead of printing a REPL return value; do not add new PYTEST_CURRENT_TEST or G_IS_TEST branches to detection or parsing logic.

Rejected here

  • Swallowing VCS arguments: g must forward arbitrary VCS flags (such as g status -s or g log -n 1) untouched across git, svn, and hg checkouts.
  • Asymmetric marker detection across .git, .svn, and .hg: Check standard checkouts, nested subdirectories, git worktrees/submodules (.git file), and non-repository directories (tmp_path) together.
  • Import-time side effects or runtime dependencies: Keep src/g/__init__.py import-pure (logging.basicConfig stays inside run(), never at module import) and keep runtime dependencies empty.
  • Partial process or stream state: When run() spawns a child VCS process (wait=True vs communicate()), ensure stdout/stderr pipes and non-zero return codes remain observable to callers without deadlocking or leaving zombie children.
  • Unpinned upstream workarounds: Record temporary VCS or tooling workarounds in .github/workarounds.toml 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 run() or find_repo_type() against a real tmp_path directory layout.
  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 py.test, 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.