docs: make repo_status spec faithful to source check_repo#11
Merged
Conversation
Corrects logic drift in the repo_status spec (the next unimplemented M1 item)
against the authoritative check_repo:
- field is sync_state, not state
- gate on local_sha == remote_sha -> up-to-date FIRST, then ahead/behind
- check_repo never returns DIRTY (flag only; DIRTY comes from the scan path)
- no-remote leaves tracking_branch unset
- fetch failure -> sync_state=ERROR, error="Fetch failed: {stderr}"
- exact error strings preserved
- flags the src/python.rs pyclass `state` -> `sync_state` rename for the
implementor (not changed here, to avoid racing in-flight per-method work)
Docs-only; no source files touched. No private refs reintroduced.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
hartsock
added a commit
that referenced
this pull request
May 31, 2026
WHAT: src/repo/fetch.rs — `fetch_result(path, remote) -> (bool, stderr)` and
`fetch(path, remote) -> bool`, a contained `git fetch` shell-out. Per PORTING.md,
gix network fetch is the least-mature path; shelling out to the user's `git`
honors their config / credentials / ssh-agent. `fetch_result` exposes stderr so
the repo_status roll-up can build "Fetch failed: {stderr}" (API.md / #11).
Registered + PyO3 wrapper. Tested vs a local bare remote (fetch advances
origin/main) and a bad-remote failure.
WHY: Last read-side primitive of M1, and the (ok, stderr) seam S1 needs.
NOTE: pilot-authored. The newt-agent worker prose-scrubbed twice here (the long
pre-written shell-out recipe pushed it past its whole-file-emit envelope — see
newt-agent docs/notes/2026-05-31-newt-coder-driving-sweet-spots.md). 12 of the 13
read methods were worker-coded; this network method is the exception.
Co-authored-by: Shawn Hartsock <hartsock@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
hartsock
added a commit
that referenced
this pull request
May 31, 2026
WHAT: src/status.rs — RepoStatusData + repo_status(path, fetch) porting check_repo verbatim per #11: gates on SHA equality first (up-to-date), then ahead/behind (diverged/behind/ahead); NEVER returns "dirty" (is_dirty is a flag only); no-remote leaves tracking_branch None; a fetch failure -> sync_state "error", error "Fetch failed: {stderr}" (via repo::fetch_result). Renamed the RepoStatus pyclass getter state -> sync_state (python.rs + the .pyi stub) for a true drop-in (the #11 follow-up). Wired the repo_status PyO3 wrapper. WHY: The keystone roll-up; closes the M1 read side. Tests: error (Directory not found / Not a git repository), no-remote, up-to-date, ahead, behind (+ new_remote_commits), diverged — built on real fixtures with a local bare remote. NOTE: pilot-authored (a large multi-state file beyond the worker's whole-file envelope; the 13 read primitives it composes were newt-agent-coded). Co-authored-by: Shawn Hartsock <hartsock@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Docs-only correction of the
repo_statusspecification — the nextunimplemented M1 item (
src/status.rsis stilltodo!()). Brings the specinto line with the authoritative source
check_repoit is meant to reproduce.No source files touched, so this does not collide with the in-flight per-method
implementation work (#3–#10). No private/internal references reintroduced
(verified against the cleanup in #8).
Why
The earlier scaffold spec for
repo_statushad drifted from the realcheck_repologic in several ways that would have produced a subtlynon-drop-in implementation:
statesync_statelocal_sha == remote_sha→ up-to-date first, then ahead/behindDIRTYcheck_reponever returnsDIRTY(it's a flag;DIRTYcomes from the scan path)tracking_branchNonesync_state=ERROR,error="Fetch failed: {stderr}"Changes
docs/API.md—RepoStatus.sync_state(notstate); decision rewritten asthe verbatim
check_repotree; field-name caveat for the implementor.docs/PORTING.md—repo_statuspseudocode transcribed line-for-line fromcheck_repo, including exact error strings and the_fetch -> (ok, stderr)note.
Implementor follow-up (flagged, not changed here)
The compiled
RepoStatus#[pyclass]getter isstate; the source contractuses
sync_state. Whenrepo_statusis implemented, rename the getter insrc/python.rsand the.pyistub for a true drop-in. Left to the impl threadto avoid racing the in-flight
src/work.🤖 Generated with Claude Code