Skip to content

rt repos reidentify and the shared-checkout folder paths - #524

Merged
m4ttheweric merged 25 commits into
mainfrom
mattstack-rename-spec
Sep 27, 2026
Merged

m4ttheweric merged 25 commits into
mainfrom
mattstack-rename-spec

Conversation

@m4ttheweric

Copy link
Copy Markdown
Collaborator

Problem

Renaming m4ttstack/rt to m4ttstack/mattstack changes the identity rt derives from the remote, and every per-repo store keys on that identity: the repo index, the worktree registry and data dir, rt.repoTracking, repos.<id> settings sections, the events cursor, eight state.db tables and herds.db. After a set-url all of it reads as empty. No tool moved state between two identities, and the shared checkout path ~/Documents/GitHub/repo-tools was hard-coded in the release and settings code.

This is Stage 2a of docs/superpowers/plans/2026-09-27-mattstack-rename-and-plugin-foldins.md. It names nothing new: the repo keeps its name until Stage 2b, and this PR ships in a release before then.

Fix

rt repos reidentify <old> <new> [--dry-run] [--json] (lib/repo-reidentify.ts)

  • Moves every identity-keyed store, one report line each: kv:repo-index, data-dir, rt.repoTracking, kv:events-cursor, the eight state.db tables, herds.repo, settings:workspacePrefs.editors, and the user, machine and team repos.<id> sections. branch_cache and git_badges are dropped as regenerable caches.
  • Every move re-reads after writing. A store holding rows under both identities refuses and names itself, unless both sides are equal (a crashed or re-registered move), which finishes. A throw or an unreadable store is that store's refused line; the other stores still move.
  • Idempotent: a second run is already or none everywhere. Raw args go through normalizeRemote, so GitHub.com/…, .git and URL forms match.
  • Runs through the daemon when one is present (inside the reconciler hold, then memo clear, watcher refresh, repo:reidentified), locally when none is; a present but silent daemon is a hard stop. A refusal exits 2 with one JSON document under --json.
  • The worktree pool directory never moves; registry rows hold absolute paths.

Rename detector (lib/daemon/rename-detect.ts): after the boot identity migration settles and every 6 hours, reads each indexed repo's remote fresh from git config. When it derives a new GitHub identity, and GitHub's 301 for the old name leads to a repo whose full_name is that identity, the detector applies through the same repos:reidentify handler. Fetches time out at 10s, passes never overlap, and nothing applies after stop.

Shared checkout (lib/release/shared-checkout.ts): ~/Documents/GitHub/mattstack first, repo-tools as the fallback, in rt release, update-machine and rt settings source detection. Docs and skills name the new folder and the fallback. AGENTS.md and the rt-release skill state that the old repo name is never recreated.

Stage 1: rename redirect proof (2026-09-27)

A throwaway repo m4ttstack/rename-probe, with a release carrying appcast.xml, was renamed and then deleted.

  • The asset through the old name answered 200.
  • An API read through the old name answered 301 to /repositories/<id> (the numeric id, not the new name), and gh api followed it.
  • A ref PATCH through the old name succeeded, so writes follow the redirect too.

Tests

  • New suites: store primitives, section rename, tracking move, the orchestrator (every store, idempotence, per-store refusal, dry run, identity forms, failing and unreadable data dirs, unlistable teams), locate after reidentify, handler (memo clear, refresh on partial refusal), dispatch, command (JSON shape, refusal table, headers), detector (every no-fire case, two-hop fetch, overlap guard, stop mid-pass), shared checkout.
  • bun run test: 11537 pass, 6 fail. The 6 are in commands/__tests__/flavor-takeover.test.ts and daemon-logdy-config.test.ts; this diff touches neither, and both files pass 19/0 on their own.
  • bun run check, picker:check, docs:check, test:pty and scripts/repo-purity.sh are green. test:e2e: 150 pass, 1 fail (the plugin-scaffold typecheck that fails under a temp HOME on this machine's mise shim, unrelated).
  • Every task had an Opus spec and quality review, and the branch had an Opus whole-branch review (ready to merge).

🤖 Generated with Claude Code

m4ttheweric and others added 24 commits September 27, 2026 11:39
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…plugin CI and purity, machine cleanup)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…potent re-key, pool dir stays)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…l reidentify)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…es the real identity stores

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntities

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d of throwing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R_NS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ting none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refuse unlistable teams

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fter any real run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls as fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly after stop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ath appears

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r move

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mirror, say when nothing moved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 76 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

This review is too large to run within your organization's remaining usage spending cap. Raise or remove your spending cap in the billing tab, then retry.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4a9eaf8f-3c46-4cf8-be36-6508d6b58a80

📥 Commits

Reviewing files that changed from the base of the PR and between 74fdb71 and 55adfb3.

📒 Files selected for processing (38)
  • AGENTS.md
  • apps/chat/AGENTS.md
  • apps/chat/ARCHITECTURE.md
  • commands/__tests__/repos-reidentify.test.ts
  • commands/release.ts
  • commands/repos-reidentify.ts
  • commands/settings.ts
  • docs/superpowers/plans/2026-09-27-mattstack-rename-and-plugin-foldins.md
  • docs/superpowers/specs/2026-09-27-mattstack-rename-and-plugin-foldins-design.md
  • lib/__tests__/repo-reidentify-dispatch.test.ts
  • lib/__tests__/repo-reidentify-locate.test.ts
  • lib/__tests__/repo-reidentify.test.ts
  • lib/__tests__/repo-tracking-move.test.ts
  • lib/command-tree-def.ts
  • lib/daemon.ts
  • lib/daemon/__tests__/rename-detect.test.ts
  • lib/daemon/__tests__/repos-reidentify-handler.test.ts
  • lib/daemon/handlers/repos.ts
  • lib/daemon/rename-detect.ts
  • lib/module-registry.ts
  • lib/release/__tests__/shared-checkout.test.ts
  • lib/release/shared-checkout.ts
  • lib/release/update-machine.ts
  • lib/repo-reidentify-dispatch.ts
  • lib/repo-reidentify.ts
  • lib/repo-tracking.ts
  • lib/state/__tests__/reidentify-primitives.test.ts
  • lib/state/cursors-store.ts
  • lib/state/reidentify.ts
  • packages/rt-client/src/settings/__tests__/rename-repo-section.test.ts
  • packages/rt-client/src/settings/identity.ts
  • packages/rt-client/src/settings/write.ts
  • skills/rt-build-dev-app/SKILL.md
  • skills/rt-release/SKILL.md
  • skills/rt-repo-identity/SKILL.md
  • skills/rt-settings/SKILL.md
  • website/docs/reference/repos/index.mdx
  • website/docs/reference/repos/reidentify.mdx

Comment @coderabbitai help to get the list of available commands.

@m4ttheweric
m4ttheweric merged commit 2070c06 into main Sep 27, 2026
13 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