Skip to content

fix: migrate the local HEAD commit instead of the remote's default branch - #15

Merged
lucasbraum merged 2 commits into
mainfrom
fix-clone-from-local-head
Oct 5, 2026
Merged

lucasbraum merged 2 commits into
mainfrom
fix-clone-from-local-head

Conversation

@lucasbraum

Copy link
Copy Markdown
Collaborator

What and why

A real run: uptide fix vitest --pr --yes in a repository whose local main was 23 commits ahead of origin/main. The private clone was switched to origin/main (an "Initial commit" with only a README), so the run failed with "no package.json; run fix at the project root".

  • Clone from local HEAD. The clone was already made from the local path, but then switched to the remote's default branch. It is now checked out at the local HEAD commit. Hooks off, lifecycle scripts off and the before/after checkout comparison are unchanged.
  • Divergence, before any work. fixPreflight runs before any clone, install or LLM call.
    • Without --pr: one line, for example main is 23 commits ahead of origin/main; migrating your local state.
    • With --pr: when the base branch on origin does not contain local HEAD, the run stops: main is 23 commits ahead of origin/main. Push it first (git push origin main) so the PR only contains the migration, or pass --base <branch>. Exit 1.
  • Uncommitted changes. fix uses the committed state and lists the files left out. With --pr it refuses unless --allow-dirty. Previously any dirty tree was refused.
  • Uncommitted package.json. The error names the commit and the repository it would be cloned from.
  • New flags. --base <branch> (also used as the PR base) and --allow-dirty.

Behaviour changes to review

  • A run without --pr now includes unpushed local commits in the migration branch. Before, it branched from origin/<default> and left them out with a note.
  • The remote is compared as last fetched; no network call is made in the preflight.
  • When there is no origin, a --pr run is not refused by the preflight; the publish step fails as before.

How it was verified

  • New tests in packages/core/src/fix/isolate.test.ts: ahead of upstream, behind, no upstream, dirty tree and uncommitted package.json, with and without --pr. The refused runs assert no clone, no check and no publish.
  • New CLI test: the note is printed, a refused --pr run exits 1 without calling the engine, and --base / --allow-dirty are passed through.
  • pnpm lint, pnpm typecheck and pnpm test pass locally (783 core, 286 CLI). pnpm smoke was not run.

Checklist

  • Tests for the change
  • pnpm lint && pnpm typecheck && pnpm test pass
  • Docs updated (docs/cli.md, fix --help)
  • Changeset added (patch)
  • No new dependency
  • No private code, names or paths in fixtures, tests or docs

🤖 Generated with Claude Code

lucasbraum and others added 2 commits October 5, 2026 13:58
…al repository

uptide fix switched its private clone to the remote's default branch. In a
repository whose local branch was ahead of origin (origin held only an initial
commit), that left a clone without package.json and the run failed with
"no package.json; run fix at the project root".

The clone is now checked out at the local HEAD commit. Before any clone, install
or LLM call, fix settles what differs from the remote: a branch ahead of or
behind its upstream is migrated as it is, with one line saying so; uncommitted
files are left out and listed; and a --pr run stops when the base branch on
origin does not contain the commit (--base names another base) or the working
tree is dirty (--allow-dirty). A package.json that is not committed is reported
with the commit and the repository it would have been cloned from.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
Review of #15. The CLI prints the preflight notes before the run and tells the
engine so, which then leaves them out of the report instead of repeating them.
A --pr run whose commit is behind its base on origin gets a warning, not a
refusal. The refusal for a commit ahead of the base says to fetch when the push
was made from elsewhere, since the remote is compared as last fetched.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
@lucasbraum
lucasbraum merged commit cbd7236 into main Oct 5, 2026
5 checks passed
@lucasbraum
lucasbraum deleted the fix-clone-from-local-head branch October 5, 2026 22:33
lucasbraum added a commit that referenced this pull request Oct 15, 2026
## Pack

`ioredis` `>=5 <6` → `>=6 <7` (queue entry `ioredis`, now `blocked`).
**Candidate, not verified.** No breaking false positive on five public
merged upgrades. But none of them has a compiler diagnostic or a
breaking site in application code; the only breaking expected sites are
two lines of test data, which the pack doesn't predict. So the gate (≥1
predicted breaking finding) can't be met honestly. Evidence:
`packages/core/src/packs/ioredis/RESEARCH.md`.

**Rebased on main `3c8902d` (2026-10-15).** The only conflicts were
`registry.ts` (both entries kept, alphabetical) and the generated README
table (regenerated). The rebase also picks up #145's re-recorded
react-router `verification.json`; the Packs workflow had been red on
main since #143 without it.

After the rebase, #143 and #144 changed scoring and the ground-truth
rule:
- I re-ran `pnpm packs:truth` on all five repositories: still no
compiler diagnostic.
- I added the four ioredis insertion anchors it now drafts, unchanged.
- I dropped one anchor from the @sentry/node bump.
- No earlier site was moved or removed.
- The revision is recorded in the truth's `$comment` and in RESEARCH.md.

## Sources

All read 2026-10-14 and pinned:
- the official [Upgrading from v5 to
v6](https://github.com/redis/ioredis/wiki/Upgrading-from-v5-to-v6) (wiki
`e859962`)
- the CHANGELOG and README at `v6.0.0`
- #2127 (RESP3), #2160 (defaults), #2206 (String.prototype, only in
6.1.0-beta.1)
- the BullMQ 6.0.0 changelog
- the published `ioredis` 5.11.1/6.0.0 and `@ioredis/commands`
1.10.0/2.0.0 tarballs, diffed
- the dependents' registry manifests

v6 removes **no** command (373 → 382 methods) and no public export.
Reply shapes and types are unchanged for default (`"legacy"`) clients,
and so are event names and `exec()` types. Breaking changes: Node ≥20,
RESP3 by default, plus new `retryStrategy`/`keepAlive` defaults.

## Rules and behavior notes

**Assisted rules** (no rewrite):
- `bundled-ioredis`: TS2322/2345/2739-41 naming `Redis<"legacy">` not
assignable, i.e. a dependent that installs its own ioredis 5. The guide
gives options (a)–(d), so the agent's choice lands in *Decisions for
you*. Never a cast.
- `duplicate-signature`: TS2416/2430 on `'duplicate'` overrides.

**Finding notes** (syntactic, binding-aware):
- `client-defaults` (deprecated, also a decision): constructions that
leave `protocol`/`retryStrategy`/`keepAlive` at the changed defaults.
Tests are skipped.
- `subscriber-mode` (breaking): `mode === 'subscriber'`.
- `offline-queue-connect` (breaking): a `connect` listener sending a
command when `enableOfflineQueue: false`.
- `handshake-auth` (breaking): AUTH recognized by command name. v6 sends
credentials inside `HELLO 3 AUTH`.

**Decision notes** (with `applies()` evidence):
- `node-20`
- `bundled-copies`: bullmq <6, bull, @hocuspocus/extension-redis,
@chat-adapter/state-ioredis, cache-manager-ioredis-yet
- `instrumentation`: OTel `instrumentation-ioredis` <0.70 /
`auto-instrumentations-node` <0.80
- `stale-types`: `@types/ioredis`
- `string-prototype`: target exactly 6.0.0
- `also-review`

**Not declared:**
- No release group: ioredis ships alone.
- No `requiresBuild`: no case of a build failing where tsc passes.
- Explicit peers rejecting 6 (typeorm, ioredis-mock,
@liaoliaots/nestjs-redis) are left to the engine's peer-conflict report.

## Ground-truth repositories

| Repository | Parent | Upgrade | Findings |
| --- | --- | --- | --- |
| ferni-ai/voiceai | `c59ed09` | `c6838d5` (#703) | 7 `client-defaults`
(protocol: 2 pins, 2 of them insertion anchors) |
| syzygyhack/open-foundry | `7391001` | `a466e0d` | 2 `client-defaults`
(1 anchor) |
| simondietschi/dokunc | `83681ed` | `c475390` (#15) | 2
`client-defaults` (v5 retryStrategy, 1 anchor), 2 `handshake-auth` |
| safe-global/safe-client-gateway | `14bd05b` | `80135d2` (#3409) | 0
(control, Yarn Berry) |
| kazumadev619-dev/FishingConditionsApp | `8ba3f0d` | `cdecc03` (#235) |
0 (control, npm) |

Screened out: elie222/inbox-zero#3821. Its TS2322 (two copies via bullmq
5) is a `packs:truth` linking artifact; a real scripts-off install
compiles it. Its upgrade also moved bullmq 5 → 6.

## `uptide pack test` output

```
uptide pack test ioredis · candidate
fixtures      6 cases, 19 sites · pass
ground truth
  ferni-ai/voiceai@c59ed0982f96                ioredis 5.8.2 → 6.0.0  predicted 6, expected 7, false positives 2, false negatives 3
  syzygyhack/open-foundry@73910018b5e8         ioredis 5.10.1 → 6.0.0  predicted 1, expected 2, false positives 0, false negatives 1
  simondietschi/dokunc@83681ed0ccc5            ioredis 5.11.1 → 6.0.0  predicted 2, expected 4, false positives 0, false negatives 2
    ✗ blocked: @hocuspocus/extension-redis 4.7.0 depends on ioredis ~5.6.1; no release accepts ioredis 6.0.0
  safe-global/safe-client-gateway@14bd05b98bf4 ioredis 5.11.1 → 6.0.0  predicted 0, expected 0, false positives 0, false negatives 0
  kazumadev619-dev/FishingConditionsApp@8ba3f0d24bc7 ioredis 5.11.1 → 6.0.0  predicted 1, expected 0, false positives 1, false negatives 0
    with @types/ioredis 4.28.10 → 5.0.0

  rule                         precision  recall    tp   fp   fn
  client-defaults                    70%     64%     7    3    4
  handshake-auth                     n/a      0%     0    0    2
  overall (sites)                    70%     54%     7    3    6
  behavior notes (sites)             70%     54%     7    3    6
  breaking (sites)                   n/a      0%     0    0    2

PASS ioredis: candidate
```

The dokunc "blocked" line is the engine's own report (#142) of the
bundled hocuspocus copy that `bundled-copies` describes; the repository
upgraded anyway, keeping both copies.

**Remaining false positives:**
- voiceai `:101`/`:92` against truth `:98`/`:89`: the anchor is at the
first line of the rewritten run.
- FishingConditionsApp `client.ts:13`: a client deliberately left on
RESP3.

**Remaining false negatives:**
- voiceai `embedding-cache.ts:134`: the module name is hidden from
static scans.
- voiceai `:98`/`:89` and open-foundry `:136`: anchor offsets.
- dokunc `log.test.ts:20/28`: `handshake-auth`, test data.

**Engine gaps still open** (RESEARCH.md):
1. A runtime-only major can't reach `verified`.
2. Detection reaches only files with static usages.
3. There is no "remove a package" outcome (`@types/ioredis`).
4. `with` can't model a required dependent major.
5. `packs:truth` links per workspace, and `--directory` fails with a
root lockfile.

Gaps 2 and 3 of the original list were resolved by #143 and #144.

## Checklist

- [x] Every rule and note comes from a source listed in `meta.sources`
- [x] Every rule that rewrites or detects has a fixture case, with a
site it must leave alone (`keep`). The two compiler-claim rules are
unit-tested instead, because a `message:` marker can't contain `"`.
- [x] Ground truth: public repositories at the commit before their
upgrade; expected findings read from their own upgrade commit and the
compiler, never copied from Uptide's output
- [ ] At least two public repositories for `verified`; otherwise the
pack ships as a candidate (5 repos, still a candidate: no predicted
breaking site)
- [x] `pnpm uptide pack test ioredis` passes and its output is pasted
above; `verification.json` written with `--write`
- [x] `pnpm lint && pnpm typecheck && pnpm test` pass: core 1727 passed
/ 32 network-skipped, CLI 454 passed; lint at baseline; `docs:packs
--check` current. All 10 CI checks pass on `30579da`, Pack test
included.
- [x] Changeset added
- [x] No private code, names or paths anywhere: fixtures are synthetic,
ground truth is public

No third-party repository was pushed to, commented on or modified. Every
install ran with scripts off, and no bare `npx` was used.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_017BYqQRCpXk6jz9vcCnx21H

---------

Signed-off-by: Claude <[email protected]>
Co-authored-by: Claude <[email protected]>
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