Skip to content

fix(ci): exempt a package's first publish from the version contract - #2982

Closed
mfal wants to merge 1 commit into
mainfrom
claude/version-contract-first-publish-2980
Closed

fix(ci): exempt a package's first publish from the version contract#2982
mfal wants to merge 1 commit into
mainfrom
claude/version-contract-first-publish-2980

Conversation

@mfal

@mfal mfal commented Aug 28, 2026

Copy link
Copy Markdown
Member

Closes #2980.

The problem

Going private: true → public while adding engines.node fails the version-contract guard:

::error::@mittwald/flow-codemods: engines.node raised ((none) -> >=24.0.0)
::error::Version contract: a breaking engines.node/peer change is not marked breaking.

Neither remedy the message offers is available:

  • A breaking marker routes to the major line, and the routing job in the same workflow rejects a breaking marker on a standing line. The two guards contradict each other for this change.
  • Dropping the floor means publishing a CLI without one, while its code uses import attributes, structuredClone and toSorted. On an older Node that is a bare SyntaxError with no hint why, and all twelve already-published packages declare a floor.

Why the guard is wrong here, and only here

A private: true package has never been published. No consumer, no prior contract — its first publish establishes the floor and the peer ranges rather than narrowing them.

collectFindings already skips a package with no base file at all, for exactly this reason:

if (!isPublishable(head)) continue; // not a consumer-facing Flow package
if (!base) continue; // new package: no prior contract to break

The gap was the case in between: the package existed at the base but was not publishable. This adds that line.

What is deliberately not changed

The rule for anything already on npm. The second of the two added tests is the one that matters — it pins that @mittwald/flow-react-components gaining engines.node is still reported as raised, so this is an exemption for the first publish, not a hole in the guard.

I also checked it by hand: with the fix applied, an artificial "already-published package gains a floor" still produces the finding, and the guard goes green on #2978's branch.

Route

fix(ci):main, from where the forward-merge carries it to next. #2978 targets next and is blocked on this; the cascade unblocks it without that PR needing to carry CI infrastructure.

14 guard tests pass (12 existing, 2 added).

The guard read `private: true` -> public as a tightening: adding
`engines.node` where a private package had none reports
`(none) -> >=24.0.0` and demands a breaking marker.

Both remedies it offers are unavailable for that change. A breaking marker
routes the PR to the major line, and the routing job in the same workflow
rejects a breaking marker on a standing line — so the two guards contradict
each other. And dropping the floor means publishing a CLI without one while its
code needs Node 24.

There is nothing to break. A private package has never been published, so it
has no consumer and no prior contract; its first publish establishes the floor
and the peer ranges rather than narrowing them. `collectFindings` already
skipped a package with no base file at all for exactly this reason — this
extends that to one that existed but was not publishable.

The rule is unchanged for anything already on npm. The second added test pins
that: `flow-react-components` gaining `engines.node` is still reported as
raised.

Closes #2980.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 76% 627 / 825
🔵 Statements 75.91% 643 / 847
🔵 Functions 77.95% 145 / 186
🔵 Branches 66.66% 298 / 447
File CoverageNo changed files found.
Generated in workflow #6371 for commit 6d794ff by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-2982.docs.review.flow-components.de
storybook pr-2982.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-2982
  • storybook: ghcr.io/mittwald/flow/storybook:pr-2982

@mfal mfal closed this Aug 28, 2026
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.

Version-contract guard reads a first publish as a tightening, and its two remedies contradict the routing guard

1 participant