Skip to content

fix: include companion peer blockers in retry commands - #66

Merged
lucasbraum merged 1 commit into
mainfrom
codex/peer-next-command
Oct 10, 2026
Merged

lucasbraum merged 1 commit into
mainfrom
codex/peer-next-command

Conversation

@lucasbraum

Copy link
Copy Markdown
Collaborator

What and why

The peer-blocker list could say to add a package that Next omitted. Adding another extra first can bring that package along through companionsOf (for example two scoped packages sharing an exact dependency pin). It then disappears from the unresolved preview, so the old loop never added its name to the command, while the retained history still advertised it.

The command now includes every advertised upgrade from the complete blocker history and replays that explicit set, including new blockers exposed by those upgrades, before emitting Next.

Blockers are grouped into one terminal row per package. Peers with the same range share that range in the row; different ranges remain visible. Both blocked-preflight JSON and completed fix reports use one peerConflicts entry per package with a peers array containing every range, target and inspected version. Preflight JSON also exposes next and retains exit 2. Fix summaries and PR risks use the grouped representation, and their readers still accept older flat stored reports.

How it was verified

  • Reproduced the missing-name bug in all 12 initial synthetic variants, before changing the planner.
  • Expanded to an exhaustive 24-case property matrix: six dependency orders × one/two rejected peers × with/without a preselected extra. Fixtures include shared-pin companions and another blocker discovered only after an extra moves. Every package advertised with “add … to the command” must appear in Next; each emitted command is parsed and replayed through preflight with no unallowed blockers.
  • Grouping assertions require one row/JSON entry per package and retain all peer rejections, including different ranges and inspected versions. CLI tests cover structured JSON, plain errors and exit 2; fix-summary coverage checks two rejected peers on one row.
  • Focused preflight suite: 42 passed. Focused CLI/summary suite: 59 passed.
  • pnpm lint, pnpm typecheck, pnpm docs:links: passed.
  • TMPDIR=/private/tmp pnpm test --env-mode=loose: 1,057 core + 358 CLI tests passed, 15 opt-in network tests skipped. The canonical temporary directory avoids the existing macOS /tmp versus /private/tmp assertion.
  • Local public document-name scan passed. The private identifier denylist is available only to CI.

No live migration or publication was run against alanagoyal/alanagoyal; the regression fixtures are synthetic.

Checklist

  • Regression fails before the fix
  • Lint, typecheck and full tests pass
  • CLI documentation updated
  • Patch changeset
  • Signed-off commit
  • No new dependencies or private fixture material

@lucasbraum
lucasbraum marked this pull request as ready for review October 10, 2026 19:03
@lucasbraum
lucasbraum merged commit c5611f4 into main Oct 10, 2026
8 checks passed
@lucasbraum
lucasbraum deleted the codex/peer-next-command branch October 10, 2026 19:03
@uptide-release uptide-release Bot mentioned this pull request Oct 10, 2026
lucasbraum added a commit that referenced this pull request Oct 10, 2026
Companion discovery could replace an already-compatible Radix package
with an older release just because it shared an exact dependency pin
with an explicitly upgraded peer. It could also pull tooltip into
another member's companion set at a different version from the preflight
recommendation.

This change keeps compatible installed peers in place, carries the whole
upgrade's peer targets through companion discovery, and uses one
lowest-compatible-release resolver for peer selection. Candidates cannot
be below the installed version. Real runtime release pairs and their
types remain coordinated. Fix installs the preflight plan instead of
merging in a second set of versions from check. An independent invariant
checks actual installed copies in every workspace before writing
manifests or installing, and rejects planned downgrades with an exit-2
error listing them.

Install progress now says `install · react 19.3.0 with 4 packages`.
Every spinner frame is truncated below the terminal width (80-column
fallback), and redirected stdout disables spinner frames even when
stderr is a terminal. Full companion details remain in the final
summary, report and upgrade commit.

npm also re-resolves reverse peers outside that explicit plan. Targeted
installation and `--prefer-dedupe` produce the same lockfile, so the
guard now admits only existing peer packages whose newer version stays
in the same major and satisfies every old consumer range. It records
each admitted placement and range, and still protects other consumers
from changed transitive resolutions. The comparison also recognizes
identical copies moved into new nested locations. These changes are
npm-only.

## Regression coverage

- Synthetic registry fixture for avatar 1.1.11, context-menu 2.2.16,
dialog 1.1.15, slot 1.2.3 and switch 1.2.6: all stay installed when
their React peers accept 19.
- Tooltip is recommended and planned at 1.1.0 even when 1.1.2 exists and
tabs shares its dependency pins.
- Enumerated property test over 80 combinations of installed versions,
targets, exact pins and registry order: no planned companion or
compatible-peer selection lowers an installed version.
- Installation retains the exact preflight version even if a later check
supplies a different companion version.
- Downgrade invariant rejects leader and companion downgrades before
branch creation or installation; it reads the actual installed version
rather than trusting a plan's `from` field.
- Spinner tests cover 20/80/unknown columns, initial and subsequent
frames, and stdout redirected while stderr remains a terminal.

## Rebase integration with #66

Rebased onto `c5611f4` (current main, #66 merged), with no merge
commits. Conflict resolution retains #66's grouped output/JSON and
complete Next-command loop, using #68's shared resolver and
authoritative plan. Both property regressions pass: 24 Next-command
fixture combinations replay without unallowed blockers, and 80
no-downgrade combinations. All commits are signed off.

The packaged-CLI rerun also found that the worker boundary discarded
structured peer errors. The worker now preserves `peerConflicts` and
`next`; a local mock-registry test exercises the built CLI, asserts one
entry per package with a `peers` array, and verifies the complete Next
command. This test failed against the previous bundle and passes with
the fix. The real repository's `--json` output has two entries; tooltip
contains both rejected React peers.

Actual grouped preflight output at `alanagoyal/alanagoyal@fd60b0a`, from
`uptide fix react --target 19.3.0 --no-llm` (exit 2, before cloning):

```text
Peer blockers (before cloning):
@emoji-mart/react 1.1.1  peer react ^16.8 || ^17 || ^18  →  no release accepts react 19: use --allow-peer @emoji-mart/react
@radix-ui/react-tooltip 1.0.7  peers react, react-dom ^16.8 || ^17.0 || ^18.0  →  upgrade to 1.1.0 (accepts react 19, react-dom 19): add @radix-ui/react-tooltip to the command

Next: npx uptide fix react @radix-ui/react-tooltip --target 19.3.0 --no-llm --allow-peer @emoji-mart/react
```

The printed Next command passed preflight and completed installation and
verification in the rerun below. No PR or push was made on the public
repository or a fork.

## Rerun on the public repository

Pinned `alanagoyal/alanagoyal@fd60b0a1d66e112cca9c350da33d4bbb1154aad7`,
Node 24.21.0 / npm 11.19.0:

```sh
uptide fix react @radix-ui/react-tooltip --target 19.3.0 --allow-peer @emoji-mart/react --no-llm
```

The original command naming tabs and resizable-panels was also tried:
those dependencies were removed from this commit, so that command
correctly stops in preflight. The command above uses the dependencies
still declared at this ref.

The updated run completes install, mechanical rewriting, types, tests
and lint in **1m 00s**. It keeps tooltip at the preflight's `1.1.0` and
does not downgrade compatible Radix packages.

```text
With  @radix-ui/react-tooltip 1.0.7 → 1.1.0, @types/react 18.2.62 → 19.3.0, @types/react-dom 18.2.19 → 19.3.0, react-dom 18.2.0 → 19.3.0

Re-resolved because a peer changed
  @radix-ui/react-dialog 1.1.15 → 1.2.0 · peers @types/react, @types/react-dom, react, react-dom
  react-remove-scroll 2.7.1 → 2.7.2 · peers @types/react, react

Lockfile housekeeping · 38 dedupe moves · 3 metadata-only changes
```

| Verification | Baseline | After version bump | After mechanical fix |
| --- | --- | --- | --- |
| Type errors | 0 | 13 | 12 |
| Tests | 181 passed, 0 failed | — | 181 passed, 0 failed |
| Lint of changed file | Clean | — | Clean |

The earlier full `npm run check` result is unchanged: lint and all 181
tests pass, then typecheck stops on the same 12 errors, so its
production-build step is not reached.

One `useRef` site is mechanically fixed; 22 findings remain manual. No
LLM calls. **Verification remains failed** because 12 type errors
remain; the peer compatibility exception is also explicitly reported as
a risk. No PR, push or fork was created on the external repository. The
produced report and PR-body preview contain the two peer re-resolutions
and old ranges.

## npm invocation experiments

Node 24.21.0 / npm 11.19.0,
`alanagoyal/alanagoyal@fd60b0a1d66e112cca9c350da33d4bbb1154aad7`. Four
independent copies started from the same committed manifest and
lockfile, without `node_modules`, matching the isolated installer. The
only manifest changes were the five planned versions plus the authorized
emoji-mart peer override. Each variant ran exact resolution, then
restored the original range styles and reconciled them with npm.

| Variant | Added records | Removed records | Changed records | Version
changes | Original guard rejections |
| --- | ---: | ---: | ---: | ---: | ---: |
| plain | 49 | 38 | 38 | 34 | 47 |
| targeted | 49 | 38 | 38 | 34 | 47 |
| dedupe | 49 | 38 | 38 | 34 | 47 |
| targeted-dedupe | 49 | 38 | 38 | 34 | 47 |

The changed-entry count includes the root importer and license metadata;
the 34 version changes include planned packages and their subtrees. All
four final lockfiles are byte-identical. The second pass changes only
the root importer’s restored range declarations; the unrelated version
churn is already present after the first pass. No invocation change is
made because neither targeted installation nor `--prefer-dedupe`
prevents it.

<details><summary>Exact npm commands (same scripts and lockfile
settings)</summary>

**plain** (2900ms, warm registry cache; run concurrently)

```sh
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3
```

**targeted** (2888ms, warm registry cache; run concurrently)

```sh
npm install [email protected] @types/[email protected] @types/[email protected] [email protected] @radix-ui/[email protected] --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3
```

**dedupe** (2889ms, warm registry cache; run concurrently)

```sh
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3 --prefer-dedupe
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3 --prefer-dedupe
```

**targeted-dedupe** (2885ms, warm registry cache; run concurrently)

```sh
npm install [email protected] @types/[email protected] @types/[email protected] [email protected] @radix-ui/[email protected] --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3 --prefer-dedupe
npm install --package-lock-only --ignore-scripts --no-audit --no-fund --lockfile-version=3 --prefer-dedupe
```

</details>

## Rejected-record inventory

47 original rejection entries: one importer-resolution summary and 46
package records. Peers below are from the old/new lockfile manifest,
intersected with the planned package names. `R` = react, `D` =
react-dom, `TR` = @types/react, `TD` = @types/react-dom. No record peers
on tooltip.

<details><summary>Every originally rejected record and its
planned-package peer links</summary>

| Record / original rejection | Peers on planned packages |
| --- | --- |
| `importer . resolutions` | None |
| `node_modules/@radix-ui/react-context-menu (same version, different
resolution, dependencies or execution fields)` | TR, TD, R, D |
| `node_modules/@radix-ui/react-dialog (1.1.15 → 1.2.0)` | TR, TD, R, D
|
| `node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive
(removed, was 1.1.3)` | None |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs
(removed, was 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context
(removed, was 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer
(removed, was 1.1.11)` | TR, TD, R, D |
| `node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id
(removed, was 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal
(removed, was 1.1.9)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence
(removed, was 1.1.5)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive
(2.1.3 → 2.1.11)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref
(removed, was 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state
(removed, was 1.2.2)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect
(removed, was 1.1.1)` | TR, R |
| `node_modules/@radix-ui/react-focus-scope (1.1.7 → 1.2.0)` | TR, TD,
R, D |
|
`node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs
(removed, was 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive
(2.1.3 → 2.1.11)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref
(removed, was 1.1.1)` | TR, R |
| `node_modules/@radix-ui/react-menu (same version, different
resolution, dependencies or execution fields)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-use-controllable-state
(removed, was 1.2.2)` | TR, R |
| `node_modules/@radix-ui/react-popover (same version, different
resolution, dependencies or execution fields)` | TR, TD, R, D |
| `node_modules/react-remove-scroll (2.7.1 → 2.7.2)` | TR, R |
| `node_modules/vaul (same version, different resolution, dependencies
or execution fields)` | R, D |
|
`node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-compose-refs
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards
(added at 1.1.6)` | TR, R |
| `node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot
(added at 1.4.0)` | TR, R |
|
`node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive
(added at 2.1.11)` | TR, TD, R, D |
|
`node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot
(added at 1.4.0)` | TR, R |
|
`node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-effect-event
(added at 0.0.5)` | TR, R |
|
`node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-slot
(added at 1.4.0)` | TR, R |
|
`node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-compose-refs
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-use-callback-ref
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-use-layout-effect
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive
(added at 2.1.11)` | TR, TD, R, D |
| `node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot
(added at 1.4.0)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/primitive
(added at 1.1.3)` | None |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-context
(added at 1.1.2)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-id
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-callback-ref
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-controllable-state
(added at 1.2.2)` | TR, R |
|
`node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-layout-effect
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-effect-event
(added at 0.0.5)` | TR, R |
|
`node_modules/@radix-ui/react-use-escape-keydown/node_modules/@radix-ui/react-use-callback-ref
(added at 1.1.1)` | TR, R |
|
`node_modules/@radix-ui/react-use-size/node_modules/@radix-ui/react-use-layout-effect
(added at 1.1.1)` | TR, R |

</details>

## Bounded npm peer scope

- `@radix-ui/react-dialog 1.1.15 → 1.2.0`: peers on R/D/TR/TD; existing
ranges are root `^1.1.4` and vaul `^1.1.1`.
- `react-remove-scroll 2.7.1 → 2.7.2`: peers on R/TR; existing ranges
from dialog, menu and popover are all `^2.6.3`.
- Root `react-focus-scope 1.1.7 → 1.2.0` is **not** independently
admitted: old consumers pin `1.1.7`. The new copy belongs to the
admitted dialog subtree, while unchanged menu and popover resolve nested
copies of `1.1.7`. Tests require those outside consumers to keep their
original resolution.

Only existing peer packages with a strictly newer same-major version
satisfying **every** old incoming range are admitted, by exact placement
rather than package name. Their old/new subtrees may change, but those
changes cannot alter an outside consumer’s transitive resolution. Major
changes, downgrades, out-of-range upgrades, newly added peer
declarations, same-version integrity changes, and unrelated copies
remain rejected. Identical copies moved into new nested locations are
recorded as housekeeping; identity, execution fields and resolved
dependencies must still match.

The fix JSON, Markdown report, terminal summary and generated PR body
name the admitted packages under **Re-resolved because a peer changed**,
including their old ranges in the report and PR. pnpm/Yarn invocation
and guard behavior are unchanged; this reproduction is npm-specific, and
the new relocation fallback only applies to npm’s physical tree.

## Validation

- 1,088 core tests and 364 CLI tests pass; 15 opt-in network tests
skipped.
- Build, lint, typecheck and documentation links pass.
- New tests cover npm lockfile v2/v3, every old incoming range, major
changes, downgrades, out-of-range updates, absent/new peer declarations,
integrity changes, unrelated duplicate placements, nested identical
copies, preserved exact transitive consumers, and report/PR/terminal
output.
- Existing pnpm and Yarn guard tests still pass; no invocation or policy
changes for those managers.
- Public-tree filename scan passes. The private-identifier denylist is
only available in CI, so that portion is not claimed locally.
- Patch changeset included; commits signed off with `git commit -s`.

---------

Signed-off-by: Lucas Braum <[email protected]>
lucasbraum pushed a commit that referenced this pull request Oct 11, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## [email protected]

### Patch Changes

- [#66](#66)
[`c5611f4`](c5611f4)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Include every
advertised peer upgrade in the preflight's Next command, including
blockers pulled along as companions, and replay the complete proposed
upgrade set. Group blocker output by package with all rejected peers and
preserve them in structured JSON on preflight failures and fix reports.

- [#65](#65)
[`35fe251`](35fe251)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Match
compiler-confirmed React `useRef` symbol findings so zero-argument calls
receive the existing initial-value fix. Route missing global `JSX`
namespace diagnostics (TS2503) to the React 19 agent guidance without
rewriting them automatically.

- [#68](#68)
[`4ed45ee`](4ed45ee)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Keep
already-compatible peer companions at their installed versions, share
the lowest compatible peer resolver with preflight, and reject planned
downgrades before writing manifests or installing. Keep preflight
versions authoritative throughout fix. Bound spinner text to terminal
width, summarize install companions by count, and disable animation when
stdout is piped.
  
Handle npm's unavoidable reverse-peer re-resolution only when the
upgrade stays within every previously declared range, keeps the major
version, and never downgrades. List admitted packages and their ranges
in the fix report and PR body, while preserving resolutions for other
consumers and accounting for identical nested copies.
  
Preserve grouped peer blockers and the complete Next command in JSON
when the packaged CLI runs planning in its worker thread.

Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.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