Skip to content

feat: resumable state manifest, --retry-failed, --sparse-checkout#40

Merged
blairham merged 5 commits into
mainfrom
feat/state-manifest-and-repo-hygiene
Apr 30, 2026
Merged

feat: resumable state manifest, --retry-failed, --sparse-checkout#40
blairham merged 5 commits into
mainfrom
feat/state-manifest-and-repo-hygiene

Conversation

@blairham
Copy link
Copy Markdown
Owner

Summary

  • Adds a per-repo _ghorg_state.json manifest written next to _ghorg_stats.csv recording last SHA, status, branch, and error per repo. New --retry-failed flag composes with the existing 7-stage filter pipeline to re-attempt only previously-failed repos. Manifest is human-readable JSON, written atomically (tmp + rename), schema-versioned for future migrations.
  • Adds --sparse-checkout flag that plumbs cone-mode patterns through the exec backend (git sparse-checkout init --cone + set post-clone). go-git logs unsupported and skips, mirroring the existing --git-filter precedent. README gains a backend feature matrix documenting which clone modes work where.
  • Adds HeadSHA to the Gitter interface so the manifest can record commit hashes; both backends delegate to existing GetRefHash(repo, "HEAD").
  • Aligns repo hygiene with the pinpredict Go-stack standard: bumps pre-commit hook revs (pre-commit-hooks v6, pre-commit-golang -repo variants, gitleaks v8.30.1), drops detect-secrets + .secrets.baseline in favor of gitleaks alone, adds .editorconfig, moves goreleaser from asdf into the go.mod tool block (go tool goreleaser ...), drops now-redundant deps-install / deps-verify Makefile targets.

Documentation in README.md and sample-conf.yaml describes the new --retry-failed, --sparse-checkout, the _ghorg_state.json schema, and the backend feature matrix (depth/mirror = both, filter/sparse = exec only).

Test plan

  • make fmt && make lint && make test clean across all 7 packages
  • make release-check validates .goreleaser.yml via go tool goreleaser
  • pre-commit run --all-files (or pre-commit run on staged) green with new config
  • New unit tests cover: state manifest round-trip, atomic write, concurrent record, schema-version handling, corrupt-JSON handling, processor recording on success/failure/no-state, retry-failed filter (missing-state, mixed states, no-error states), HeadSHA on both backends, end-to-end sparse-checkout via local bare repo.
  • Manual end-to-end (network-dependent): clone a small org with a synthetic failure, confirm _ghorg_state.json lists it as error, then rerun with --retry-failed and confirm only that repo is attempted.
  • Manual: --clone-depth=1 --sparse-checkout="docs,README.md" --git-backend=exec produces a shallow, sparse working tree.

Deferred follow-ups

  • auth consolidation: internal/configs/configs.go has 5 near-parallel getOrSetXxxToken functions and duplicated macOS Keychain shellouts. Sketch: introduce CredentialResolver interface chained per provider, plus a git credential helper resolver. Separate PR.
  • reclone-server hardening: bearer-token auth, /metrics, structured logging, rate limit. Separate small PR.
  • Sparse-checkout in go-git remains warn-and-skip; upstream go-git doesn't support it.

🤖 Generated with Claude Code

blairham and others added 5 commits April 30, 2026 10:05
…kout

Adds a per-repo _ghorg_state.json manifest written next to _ghorg_stats.csv
that records last SHA, status, and error for each repo. New --retry-failed
flag composes with the existing filter pipeline to re-attempt only
previously-failed repos. New --sparse-checkout flag plumbs cone-mode
patterns through the exec backend (go-git logs unsupported). HeadSHA is
added to the Gitter interface so the manifest can record commit hashes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds README sections for --retry-failed and partial-clone usage, plus a
backend feature matrix showing which clone modes work with go-git vs exec.
Updates sample-conf.yaml with the new git.sparse-checkout and retry-failed
keys and inline notes on backend support.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Updates hook revs (pre-commit-hooks v6.0.0, pre-commit-golang v1.0.0-rc.4
with -repo variants, gitleaks v8.30.1) and adds the standard header
comment block. Drops detect-secrets and the .secrets.baseline file in
favor of gitleaks alone. Drops golangci-lint-full from pre-commit since
it runs in CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds .editorconfig matching the pinpredict template (2-space default,
tabs for Go/Makefile, preserves trailing whitespace in markdown).
Drops goreleaser from .tool-versions; it's now a go.mod tool dep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds goreleaser/v2 as a go.mod tool dep so it can be invoked via
go tool goreleaser, matching the pinpredict pattern. Updates Makefile
targets accordingly and drops the now-redundant deps-install and
deps-verify targets. CLAUDE.md command table updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blairham blairham merged commit 255cdeb into main Apr 30, 2026
5 checks passed
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.

1 participant