Skip to content

chore(sc-43976): design + runbook to move git history to archive repo#69

Open
yodem wants to merge 2 commits into
masterfrom
chore/sc-43976/move-sefaria-export-git-history
Open

chore(sc-43976): design + runbook to move git history to archive repo#69
yodem wants to merge 2 commits into
masterfrom
chore/sc-43976/move-sefaria-export-git-history

Conversation

@yodem

@yodem yodem commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds design doc + one-shot migration runbook for splitting Sefaria-Export into a lean main repo + a new Sefaria-Export-Archive holding the full historical commit graph (resolves sc-43976).
  • Adds a "Cloning" section to the README pointing users at --depth 1 and the (forthcoming) archive repo.
  • Adds project-scope Shortcut MCP via .mcp.json.example (real .mcp.json is gitignored — contains an API token).

This PR does not perform the destructive force-push. Phase 1 and Phase 2 scripts in scripts/migration/ are run by a maintainer with admin rights on the Sefaria org, after this PR is reviewed and merged.

What's in here

  • docs/superpowers/specs/2026-05-06-archive-git-history-design.md — full design: two-repo split, alternatives considered, 4-phase migration plan, risks, verification, recovery procedure.
  • scripts/migration/01_create_archive.sh — mirror-clone source repo to archive (non-destructive). Tags pre-migration-master for recovery.
  • scripts/migration/02_orphan_master.sh — replace master with single orphan commit. Verifies the new tree hash matches the pre-migration tree before pushing. Two confirm prompts. Uses --force-with-lease.
  • scripts/migration/README.md — runbook overview, ordering, prerequisites, recovery.
  • README.md — new "Cloning" section.
  • .gitignore / .mcp.json.example — keep the Shortcut API token out of the public repo.

Test plan

  • Review the design doc — flag any concerns about hash rewriting, fork breakage, or branch protection before the cutover is scheduled.
  • Skim both migration scripts; verify the prompts and the tree-hash sanity check.
  • Decide a freeze date and notify open-PR / fork owners.
  • Confirm next `generate-books-json` workflow run is green before the cutover.
  • (Post-merge, manual) create empty `Sefaria/Sefaria-Export-Archive`, run `01_create_archive.sh`, verify on GitHub, archive the repo.
  • (Post-merge, manual) relax branch protection, run `02_orphan_master.sh`, restore protection.
  • (Post-merge, manual) verify `du -sh .git` on a fresh clone is well under 100 MB.

🤖 Generated with Claude Code

Adds the design doc and one-shot migration runbooks for splitting
Sefaria-Export into a lean main repo + Sefaria-Export-Archive holding
the full historical commit graph. Also adds a 'Cloning' section to the
README pointing users at --depth 1 and the (forthcoming) archive repo,
and ignores local .mcp.json (contains an API token; ships as
.mcp.json.example instead).

This PR does not perform the destructive force-push. Phase 1 and Phase 2
scripts are run by a maintainer with admin rights, after PR review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gitvelocity-reviewer

Copy link
Copy Markdown

📊 Code Quality Score: 18/100

46 × 0.4 (Small ESF) = 18.4, rounded to 18

Category Score Factors
🔭 Scope 7/20 4 files across docs/scripts/config/README; single subsystem (repo maintenance); no new APIs or external integrations; cross-cutting only within the repo itself
🏗️ Architecture 8/20 Introduces two-repo split pattern with clear migration path; significant structural decision for the project; no code architecture changes; well-reasoned alternatives table
⚙️ Implementation 9/20 Shell scripts with set -euo pipefail, tree-hash sanity check, interactive confirmation prompts, --force-with-lease, pre-migration SHA recording; non-trivial defensive engineering for runbooks
⚠️ Risk 10/20 Migration itself is high-risk (force-push, history rewrite) but this PR is design/runbook only; risk well-documented with mitigations; multiple abort points in scripts; recovery path documented
✅ Quality 10/15 Comprehensive design doc with alternatives table, risk table, verification steps, recovery path; good inline comments in scripts; no tests (appropriate for runbook); minor gaps between design doc and script implementation
🔒 Perf / Security 2/5 --force-with-lease over bare --force is meaningful safety choice; disk space requirements documented; no benchmarks or security threat model needed for this change type

Scored by GitVelocity · How are scores calculated?

…esence, audit non-master refs, fix README tense

- 02_orphan_master.sh now ABORTs if pre-migration-master tag is missing from
  the archive (no Phase 2 without a recovery path).
- 02_orphan_master.sh audits non-master heads/tags on origin and prompts to
  delete them after the force-push; otherwise the size goal silently fails
  because default clones still pull all reachable history.
- README "Cloning" section: future tense; archive link no longer points at
  a 404 between merge and migration.
- migration/README.md: documents Phase 1 resume path (set WORKDIR=) and the
  workflow-pause prerequisite for Phase 2's --force-with-lease.
- design doc: scope assumptions (no LFS / Pages / submodules / signed-commit
  requirement) recorded; Phase 2 prereqs and ref-audit step formalised.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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