Skip to content

status: the fourth file, and its local layer — what is in and out of sync across an estate, read-only, as of the last fetch - #9

Merged
brettheap merged 5 commits into
mainfrom
feat/status-local-layer
Sep 11, 2026
Merged

brettheap merged 5 commits into
mainfrom
feat/status-local-layer

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Ruling: Brett Heap, 2026-09-10, verbatim: "lets go with a fourth file. start with the local status layer." From the brainstorm that preceded it: the sync check was the strongest candidate, a third of it already lived inside park's not-carried report, and a fourth file beats a park --status flag because a read-only report should not sit under a verb whose name means commit-and-push.

Stacked on #8 (feat/park-all-flag), which is why the base is that branch; it carries only this change on top.

What status is

The read-only view of an estate: what is in and out of sync. It finds the estate exactly as park and resume do — the shared resolver block is now carried byte for byte by THREE files, and both identity tests hold it three ways — and then only READS.

status: Atlas - the assembly root at /home/b/projects/Atlas
  as of the last fetch: status reads local refs only and fetches nothing.

  root   main   /home/b/projects/Atlas
    - ahead of origin/main by 1 commit(s): unpushed
    - dirty: 2 path(s)
    - branch 001-a-thing: 1 commit(s) never pushed (no upstream branch)
  leg    main   /home/b/projects/Atlas/spec
    - checked out at 1a2b3c4, pinned at 9f8e7d6: moved but not pinned (scripts/bump-leg.py)

status: Atlas - 4 finding(s) in 2 repositories; nothing was changed.

Per repository — the holder or root, each member's working clone beside the holder, and every mounted leg, the same rows park's report reads:

  • root / holder: ahead of or behind origin/<tracking>; dirty (with --ignore-submodules=all, so a moved leg is not counted twice); stashes; on a feature branch or detached; feature branches never pushed, with unpushed commits, or whose remote branch is [gone]; dirty linked worktrees (the extension's feature worktrees).
  • leg: checked out away from its pin; pin behind origin/<tracking>; pin on a commit the leg never pushed; on a feature branch at its pin (AGENTS.md rule 1's resume refusal, named on the leg's own row); declared in .gitmodules and not mounted.
  • family: a member with no working clone beside the holder is a finding, not a silent skip.

It fetches nothing — every run prints as of the last fetch: status reads local refs only and fetches nothing. — and it writes nothing: every git call goes through git --no-optional-locks, so it never takes a lock and never refreshes an index. Exit 0: in sync and clean. Exit 1: findings printed. Exit 2: refused, nothing read. READ THE LINES — an unpushed feature commit is a fact to look at, and exactly what park exists to carry.

Bare status inside an estate reads that estate. Outside every estate it reads them ALL, without asking — unlike park's bare form, which asks before a sweep that writes; a question before a read is only friction. status --all / -a says the same from anywhere. status --fetch refuses by name: this is the LOCAL layer, and fetching is the next one.

Not here yet, by design and in this order: --fetch; the fork's origin against its upstream (gh); the estate's copied shape files against contracts/shape-pin.yaml and the pinned openRepoShape against openRepoShape's main; the parked record in ~/.agents/workspace.yaml against the worktrees on disk.

Everything else that changed

  • openRepoTools --install places FOUR files, 4 of 4 placed; all four in hand before any is placed, as before. --help lists status [<Name>]. The refusal names status --help too. The "FOURTH FILE" argument for the duplicated fetch shim is now the "FIFTH FILE" argument.
  • park and resume change only in comments: the shared block's header says three copies and a fifth file; the two "Installed with the other two" lines say three.
  • README.md 182 -> 203, AGENTS.md 99 -> 111 (new rule 4: status fetches nothing, exit 1 is findings not failure, never git fetch on its behalf, bare form reads all without asking), caps raised in dated docstring entries. .gitattributes and the CI comments count four; the macOS job parses status with /bin/bash -n.

Review

An independent adversarial review of the first draft ran it against 14 synthetic estates (standalone and family; legs mounted, unmounted, moved, unfetched; worktrees; stashes; every %(upstream:track) form; sweep; refusals) and proved the no-write claim with a full-$HOME snapshot that is byte-, size-, mtime- and mode-identical before and after — and NOT identical with --no-optional-locks removed. It found six things, all fixed here:

  1. No git guard (high): every call is || true-guarded so a missing ref is a finding — which meant a git that could not run at all (or one older than 2.15, which rejects the flag) was REPORTED as an estate with no commits and no legs, exit 1. Now refused by name, exit 2.
  2. One unguarded pipeline (git stash list | wc -l), latent under pipefail.
  3. TAB-separated for-each-ref fields: TAB is IFS whitespace, so an empty middle field shifts the rest left; 0x1F (%1f / $'\037') does not collapse.
  4. 0 commit(s) never pushed for a branch with no commit of its own — reworded, behaviour kept.
  5. A missing flag value exited 1 with bash's ${2:?} message — and 1 is what this command means by "findings". Now REFUSED, exit 2.
  6. A valueless .gitmodules key printed bare and became a phantom leg.

Plus the gap it flagged: a leg on a feature branch at its pin now has its own finding.

Tests

160 -> 187. New tests/test_status_command.py (22): real bare remotes with a root that mounts a leg, per-test remotes so a pushed commit cannot leak into the next test's clone; one scenario per finding, the caveat proved (a commit on origin is invisible until the clone fetches), the family (borrowing the estate fixture), --all / -a / bare-outside / bare-inside, every refusal including the git shim and the missing value, and the one promise: refs, HEAD, porcelain and stash list identical before and after, no index.lock, nothing fetched. The installer and hygiene suites are taught the fourth file; a new hygiene test holds "fetches nothing", "as of the last fetch", "local layer" and the four-file count in README, AGENTS.md and the command's header.

bash -n on all four; shellcheck status reports only SC2317 (functions called indirectly). python3 -m pytest tests -q: 187 passed locally with the submodule initialised.

Not merged

Opened for review, stacked on #8. workBenches re-vendors all four after this lands.

🤖 Generated with Claude Code

Summary by Sourcery

Add a read-only local status layer that reports estate synchronization findings as of the last fetch without changing or fetching anything.

New Features:

  • Add a read-only status command that reports local synchronization findings across estate roots, members, worktrees, and mounted legs without fetching or modifying repositories.
  • Support targeted, bare, and --all/-a status scans with explicit refusal handling and exit codes for clean results, findings, and refused requests.

Bug Fixes:

  • Ensure status refuses when Git cannot run with the required no-lock option instead of misreporting an empty estate.
  • Correct status handling for missing option values, malformed Git reference fields, unguarded stash pipelines, and valueless submodule declarations.
  • Report mounted legs on feature branches at their pins as status findings.

Enhancements:

  • Extend estate resolution consistency checks across park, resume, and status.
  • Make the installer atomically install and validate four command files, and update command help and installation reporting accordingly.

CI:

  • Validate the new status script with Bash syntax checks in the macOS CI job.

Documentation:

  • Document the read-only local status layer, last-fetch caveat, exit codes, supported invocation forms, and intentionally deferred status layers.

Tests:

  • Add comprehensive status coverage for synchronization findings, estate sweeps, refusals, no-fetch behavior, and repository state preservation.
  • Update installer, hygiene, resolver consistency, and cross-platform command tests for the fourth installed command.

brettheap and others added 3 commits September 10, 2026 22:04
… `park --all` / `-a` is the sweep unasked

Brett Heap's RULING of 2026-09-10, verbatim: "lets change that so it parks
the current repo. if not in a repo, then asks if want to park all. and park
all should be park -a or park --all." It supersedes his openRepoShape #91
ruling of the same day, under which bare `park` with no estate around the
cwd parked every estate unasked.

- The walk-up is unchanged: inside an estate, bare `park` parks that one.
- Outside every estate, at a terminal: list, then `park every estate
  above? [y/N]` on stderr. Only y/yes runs #91's sweep; anything else
  exits 2 with "nothing was parked".
- Outside every estate, with no terminal on stdin: refuse, list, and name
  `--all`. Never hang on a question nobody can see.
- `park --all` / `park -a`: the sweep from anywhere, unasked. Refused
  alongside <Name> or --repo, and when no estate exists at all.
- `resume --all` / `-a` refuses by name and says why `resume` has no
  sweep, instead of the generic "put it after `--`".
- The sweep itself (name order, continue past a refusal, skip roots
  without the overlay, one summary) is untouched; it now takes its rows
  from the caller that listed them.

Tests 147 -> 160: the question under a real pseudo-terminal (y/Y/yes/YES,
Enter/n/no/other), the no-terminal refusal, --all and -a, --all from
inside an estate, the flag conflicts, and the sweep tests now driven by
--all. README 178 -> 182 and AGENTS.md 95 -> 99, caps raised in dated
docstring entries.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…f sync across an estate, read-only, as of the last fetch

Brett Heap's RULING of 2026-09-10, verbatim: "lets go with a fourth file.
start with the local status layer."

`status [<Name>] | --all` finds the estate exactly as `park` and `resume`
do — the shared resolver block is now carried byte for byte by three files —
and then only READS: for the holder or root, each member's working clone
and every mounted leg, whether the tracking branch is ahead of or behind its
origin, what is dirty or stashed, a root off its tracking branch or detached,
feature branches never pushed or whose remote branch is gone, dirty feature
worktrees, a leg checked out away from its pin or pinned behind its origin
or on an unpushed leg commit, a leg on a feature branch, a leg declared and
not mounted, and a member with no working clone. It fetches nothing, says
"as of the last fetch" on every run, and takes no lock
(`git --no-optional-locks`). Exit 0 in sync, 1 findings printed, 2 refused.
Bare `status` inside an estate reads that one; outside every estate it reads
them all WITHOUT asking, because nothing writes; `--fetch` refuses by name
as the next layer.

- `openRepoTools --install` places FOUR files; the count line says `4 of 4`.
- README and AGENTS.md (new rule 4) document it; caps raised in dated entries.
- CI parses the fourth file with /bin/bash -n.
- `park` and `resume` change only in comments: the shared block now says
  three copies.

An independent review of the first draft (14 synthetic estates, a full-tree
snapshot proving nothing is written) found six things, all fixed here: a git
that cannot run is refused rather than reported as an empty estate; the one
unguarded pipeline; 0x1F rather than TAB between for-each-ref fields so an
empty field cannot shift; "0 commit(s) never pushed" reworded; a missing flag
value exits 2 in the command's own words, not bash's exit 1; a valueless
.gitmodules key no longer invents a leg. Plus the gap it flagged: a leg on a
feature branch at its pin is a finding, as AGENTS.md rule 1 already names it.

Tests 160 -> 187: a new tests/test_status_command.py (22, real bare remotes
and a leg submodule, one scenario each), the installer and hygiene suites
taught the fourth file, and the resolver identity held three ways.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 11, 2026 00:39

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 38 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR introduces the fourth installed command, status, as a local, read-only estate synchronization report. It reuses the existing estate resolution, inspects repositories and legs using lock-free local Git reads, reports findings with distinct exit semantics, and expands installation, documentation, CI, hygiene checks, and integration tests to enforce the no-fetch/no-write contract.

Sequence diagram for the read-only local status report

sequenceDiagram
    participant User
    participant status
    participant Resolver as EstateResolver
    participant Git

    User->>status: status Name
    status->>Resolver: resolve estate
    Resolver-->>status: root, members, legs
    status->>Git: git --no-optional-locks local reads
    Git-->>status: refs, worktree, stash, submodule state
    status-->>User: findings as of the last fetch
    status-->>User: exit 0 clean, exit 1 findings, or exit 2 refusal
Loading

Flow diagram for status scope and exit semantics

flowchart TD
    Start[status invocation] --> Resolve[Resolve selected estate or all estates]
    Resolve --> Read[Read repositories and legs with git --no-optional-locks]
    Read --> Findings{Findings present?}
    Findings -->|No| Clean[Print clean report; exit 0]
    Findings -->|Yes| Report[Print per-repository findings]
    Report --> Exit1[Exit 1]
    Start --> Refusal{Unsupported option or unavailable Git?}
    Refusal -->|Yes| Exit2[Print refusal; exit 2; read nothing]
Loading

File-Level Changes

Change Details Files
Add a read-only status command that reports local synchronization findings without fetching or modifying repositories.
  • Reuse the estate resolver shared byte-for-byte with park and resume.
  • Inspect roots, holders, member clones, linked worktrees, and legs for branch, ref, dirty, stash, pin, mount, and upstream conditions.
  • Use git --no-optional-locks and local refs only; distinguish clean (0), findings (1), and refusals (2).
  • Support named estates, bare in-estate resolution, and read-only all-estate sweeps; explicitly refuse --fetch and invalid invocations.
status
Extend installation, command identity, documentation, and portability checks for the fourth shipped file.
  • Install and validate status atomically alongside openRepoTools, park, and resume, updating counts and help/refusal text.
  • Document the local-layer semantics, last-fetch caveat, exit codes, bare/all behavior, and intentionally deferred status layers.
  • Update shared-resolver identity checks, shell parsing, hygiene rules, line-count caps, and CI comments for four shipped scripts.
openRepoTools
README.md
AGENTS.md
.gitattributes
.github/workflows/tests.yml
park
resume
tests/test_openrepotools_command.py
tests/test_park_resume_commands.py
tests/test_repo_hygiene.py
Add comprehensive integration coverage for status findings, read-only guarantees, estate traversal, and refusal behavior.
  • Exercise standalone roots with mounted/unmounted/moved legs, stale or unpushed pins, feature branches, worktrees, dirty and stashed changes, and missing family clones.
  • Verify local-ref behavior before and after an explicit fetch, all-estate and bare invocation semantics, output summaries, and exit codes.
  • Prove refusals read nothing and prove refs, HEAD, porcelain, stash state, file metadata, and locks remain unchanged.
tests/test_status_command.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 11, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unresolved critical status error-handling issue and a moderate --repo coverage gap remain, alongside documentation nits.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a read-only status command for local estate synchronization checks without fetching or modifying repositories.

Changes:

  • Reports repository, branch, leg, worktree, and family findings.
  • Updates installation, documentation, resolver metadata, and CI for four shipped files.
  • Adds comprehensive status, refusal-path, and no-write tests.
File summaries
File Review summary
tests/test_status_command.py Adds status behavior, refusal, and no-write coverage.
tests/test_repo_hygiene.py Extends hygiene checks for the new command.
tests/test_park_resume_commands.py Verifies resolver consistency across three commands.
tests/test_openrepotools_command.py Tests four-file installation behavior.
status Implements local status reporting. Critical (1 vote): handle git worktree list failures instead of reporting an incomplete scan as clean. Moderate (3 votes): cover successful and no-match --repo resolution. Nit (2 votes): update the shared comment to reference three commands.
resume Updates shared resolver metadata.
README.md Documents status behavior and exit semantics.
park Updates shared resolver metadata.
openRepoTools Installs and documents the fourth command.
AGENTS.md Adds status operating guidance. Nit (3 votes): change “two INSTALLED commands” to “three INSTALLED commands.”
.github/workflows/tests.yml Adds status shell syntax validation.
.gitattributes Extends line-ending rules to status. Nit (1 vote): update the explanation from three to four installed files.
Review details

Suppressed comments (1)

.gitattributes:9

  • The explanation below still says a second install can report three files as updated at, but --install now places four files. This leaves the line-ending rationale inconsistent with the new four-command install; update the count.
# `\n` in `openRepoTools`, `park`, `resume` and `status` into `\r\n`, and every one
  • Files reviewed: 12/12 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread status
path=""; branch=""
;;
esac
done < <(g "$repo" worktree list --porcelain 2>/dev/null; printf '\n')
Comment thread status
Comment on lines +884 to +886
--repo)
[ $# -ge 2 ] || die "--repo needs a value: <owner>/<name>, or any url spelling of one."
REPO_SLUG="$2"; REPO_ARG="$REPO_SLUG"; shift 2 ;;
Comment thread AGENTS.md
and this repository pins the commit its tests were verified against. Read that
repository's `AGENTS.md` for the Make targets (`make park`, `make resume`) and
everything about a project's layout; what follows is only what changes when a
person is driving the two INSTALLED commands.
Comment thread status
# One indent-zero scalar out of a small YAML file, with parameter expansion
# only: no YAML library, no python per line, no forks per line. This is the
# reader the Speckit extension's `workspace_read_scalar` is, narrowed to the
# keys these two commands read (`kind`, `name`, `family`, `tracking_branch`).
…s diff is its own change

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@brettheap brettheap reopened this Sep 11, 2026
@brettheap
brettheap changed the base branch from feat/park-all-flag to main September 11, 2026 02:38
@brettheap
brettheap dismissed sourcery-ai[bot]’s stale review September 11, 2026 02:38

The base branch was changed.

@sonarqubecloud

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants