Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

TML-2573: chain-aware upgrade-coverage gate (accepts skip-publish releases) - #535

Merged
wmadden merged 4 commits into
mainfrom
tml-2573-fix-deployment-check-upgrade-coverage-8-violations-07-09
May 19, 2026
Merged

wmadden merged 4 commits into
mainfrom
tml-2573-fix-deployment-check-upgrade-coverage-8-violations-07-09

Conversation

@wmadden

@wmadden wmadden commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Refs TML-2573

At a glance

A publish from a previously-shipped v0.7.0 to a head at 0.9.0 now passes the coverage gate against the two consecutive directories authors already wrote:

$ pnpm check:upgrade-coverage --mode publish --prev v0.7.0
$ echo $?
0

Previously the gate demanded a synthetic upgrades/0.7-to-0.9/ and rejected the per-step 0.7-to-0.8/ + 0.8-to-0.9/ directories as stale — exactly the entries the authoring skill teaches contributors to write. The failing run that surfaced this was GH Actions run 26090222604.

Decision

The gate's transition model becomes a chain instead of a single step:

  1. Replace coverageTransitionLabel(head, prev) (returned one string) with coverageTransitionChain(head, prev) returning the ordered list of consecutive M.N-to-M.N+1 directories spanning prev.minor → head.minor. PR-mode steady-state (prev.minor === head.minor) collapses to a one-element list naming the in-flight directory — preserving today's behaviour.
  2. The coverage rule loops over the chain and emits one [coverage] violation per missing directory, naming each so the author sees exactly which steps the gate wants.
  3. The new-entries rule's allowed-transitions set widens from {coverage, in-flight} to {...chain, in-flight} — an entry in any chain step is a valid landing spot during a skip-publish release.
  4. record-upgrade-instructions/SKILL.md gets one paragraph noting the skip-publish chain: authoring stays one directory per minor bump; the gate aggregates.

Major-boundary chains (prev.major !== head.major) keep the existing single-step transitionLabel(prev, head) behaviour — the minor counter resets, so a literal chain doesn't compose. Revisit before a major bump.

How it fits together

The model: package.json.version on a ref is the currently published version on that ref. When pnpm bump-minor runs and the resulting publish workflow succeeds, the published tag catches up to package.json. If a bump landed on main but the publish workflow failed and was never re-run, the next successful publish crosses two minor steps in one release — prev (last v[0-9]* tag) is at M, head is at M+2, and the diff describes everything shipped over the two-minor span.

  1. Lift the model from single-step to chain. scripts/check-upgrade-coverage.mjs introduces coverageTransitionChain; the rule loop walks the returned list.
  2. Coverage diagnostic widens naturally. One violation per missing directory; the existing line-oriented renderer already enumerates per-violation, so the output stays readable when two steps are missing.
  3. New-entries allow-set tracks the chain. A skip-publish release legitimately has new entries in any of the in-chain directories (each one targets a different conceptual minor); the rule accepts any of them and continues rejecting pre-prev adds.
  4. Authoring discipline unchanged. skills-contrib/record-upgrade-instructions/SKILL.md gains a ## Skipped publishes paragraph that says: keep writing per single-step transition; the gate aggregates. No author behaviour change.

Behavior changes & evidence

  • Coverage rule accepts a chain of consecutive transition directories. Previously it required exactly one <prev.minor>-to-<head.minor>/ directory; a skip-publish release was unsatisfiable. Impl: scripts/check-upgrade-coverage.mjs coverageTransitionChain + the coverage-rule loop. Evidence: check-upgrade-coverage — skip-publish chain describe block in scripts/check-upgrade-coverage.test.mjs (coverage with both / one / neither directory present).
  • New-entries rule allows additions in any chain step. Previously only the single coverage directory + in-flight were allowed; chain steps between were stale. Impl: same file, allowedTransitions construction. Evidence: new-entries: accepts an added file in any chain transition or in-flight and new-entries: rejects an added file in a pre-prev (stale) transition directory in the same describe block.
  • JSON envelope reports one violation per missing chain directory. Previously one global [coverage] violation per substrate. Evidence: --json envelope: one violation per missing chain directory.
  • Authoring skill notes the skip-publish chain. Impl: skills-contrib/record-upgrade-instructions/SKILL.md ## Skipped publishes section. No code evidence; doc-only paragraph.

Reviewer notes

  • The 0.7-to-0.8/ and 0.8-to-0.9/ directories already on this branch are untouched — they were exactly the per-step entries the authoring skill teaches contributors to write, and the chain-aware gate accepts them as-is. No aggregation, no merge, no rewrite.
  • One pre-existing biome warning in scripts/check-upgrade-coverage.mjs — runCheck's mode parameter has been unused since before this PR. Left as-is per the "only fix pre-existing lints if necessary" convention; happy to fix in a follow-up.
  • The JSON envelope shape changes (coverageTransition field replaced by coverageChain; one [coverage] violation per missing directory instead of one combined). No external consumer of the envelope exists in this repo (rg coverageTransition and rg coverageChain outside the script come back empty), so I treated this as free to change. If downstream tooling reads this, flag and I'll add a compatibility shim.
  • Major boundary (prev.major !== head.major) keeps the existing single-step label. The minor counter resets at majors so a literal chain doesn't compose. The function carries an inline comment noting this; before any planned major bump, a follow-up should decide what the major-boundary semantics actually are.

Compatibility / migration / risk

No on-disk migration needed. Existing per-step directories continue to satisfy the gate. PR-mode + consecutive-publish modes are unchanged behaviour (single-element chain == previous single-step). The only diagnostic-shape change is in the skip-publish case, which previously errored unconditionally.

Verification

  • node --test scripts/check-upgrade-coverage.test.mjs — 29 cases pass (5 new in the skip-publish chain describe block + updated assertion in the in-flight minor source-of-truth case for the chain shape).
  • pnpm check:upgrade-coverage --mode publish --prev v0.7.0 — exits 0 on this branch (was 8 violations on main).
  • pnpm check:upgrade-coverage --mode pr — exits 0.
  • pnpm biome check scripts/check-upgrade-coverage.{mjs,test.mjs} — clean modulo the pre-existing mode warning noted above.

Follow-ups

  • Decide major-boundary chain semantics before any major bump is planned. No Linear ticket yet — flag during review if anyone disagrees with deferring.
  • (Optional) Drop the unused mode parameter from runCheck in a follow-up cleanup PR.

Skill update

skills-contrib/record-upgrade-instructions/SKILL.md gains a ## Skipped publishes paragraph documenting the chain semantics — the only user-facing surface this PR touches.

Alternatives considered

  • Aggregate the two existing instructions directories into a single 0.7-to-0.9/. Faster to unblock the release, but throws away the per-version-step authoring model the receiving skills are built around, and re-encodes the same fragility next time a publish is skipped. The downstream upgrade skills expect one set of instructions per minor — aggregating into a synthetic directory would either lose detail or force the receiving skill to learn to split.
  • Fail-loud on skip-publish (refuse to run the gate; demand a re-publish of the skipped minor). Would protect against an operator accidentally shipping a multi-minor leap, but the gate is a release-time check, not a release-policy enforcer; multi-minor leaps are real and benign when the in-tree work is per-step.
  • Combine all missing chain directories into a single [coverage] violation block per substrate. Tidier output for the common case (1 missing dir), but obscures which specific steps are missing in the skip case. The line-oriented one-per-missing format trades brevity for diagnostic specificity, which seemed worth it.

Checklist

  • All commits are signed off (git commit -s) per the DCO. The DCO status check will block merge if any commit is missing a Signed-off-by: trailer.
  • I read CONTRIBUTING.md and the change is scoped to one logical concern.
  • Tests are updated (5 new cases covering the skip-publish chain; one existing case updated for the chain shape).
  • The PR title is in TML-NNNN: <sentence-case title> form.
  • The Skill update section above is filled in.

Summary by CodeRabbit

  • Bug Fixes

    • Coverage now enforces upgrade-instruction directories for every consecutive minor transition in a chain, reporting one violation per missing step and accepting new-entry destinations across the full valid chain (including the in-flight head).
  • Documentation

    • Added guidance on authoring per-step upgrade instructions when minor versions advance without corresponding releases.

Review Change Stack

wmadden added 2 commits May 19, 2026 14:21
… gate

The gate previously assumed the last-published version and the version
being published differ by exactly one minor, requiring a single
`<prev.minor>-to-<head.minor>/` directory. When a minor is bumped
in-tree but never actually shipped to npm, the next publish crosses
two minor steps in one release; the previous shape demanded a
synthetic merged directory and rejected the per-step entries authors
were taught to write.

Replace `coverageTransitionLabel` with `coverageTransitionChain`
returning the ordered list of consecutive `M.N-to-M.N+1` directories
covering `prev.minor → head.minor`. Coverage rule loops over the
chain (one violation per missing directory, naming each so the author
sees exactly which steps the gate wants). New-entries allow-set
widens to `chain ∪ {in-flight head→head+1}` so an entry in any chain
step is a valid landing spot.

Refs: TML-2573

(TML-2573)

Signed-off-by: Will Madden <[email protected]>
Author one entry per single-step transition; the coverage gate
aggregates consecutive directories into a chain when a minor was
bumped in-tree but never actually shipped to npm.

Refs: TML-2573

(TML-2573)

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden requested a review from a team as a code owner May 19, 2026 12:22
@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: fc953622-0f80-4f7c-9f4b-9f2af882a713

📥 Commits

Reviewing files that changed from the base of the PR and between c1dad08 and 701a0a8.

📒 Files selected for processing (2)
  • scripts/check-upgrade-coverage.mjs
  • scripts/check-upgrade-coverage.test.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/check-upgrade-coverage.test.mjs
  • scripts/check-upgrade-coverage.mjs

📝 Walkthrough

Walkthrough

The PR replaces single-step coverage logic with an ordered minor-version transition chain: adds COVERAGE_SUBSTRATES, exposes coverageTransitionChain(head, prev), iterates coverageChain in runCheck to require each upgrades// directory, expands new-entries acceptance, updates tests, and amends docs.

Changes

Upgrade Coverage Chain Validation

Layer / File(s) Summary
Transition Chain Helper and Gate Documentation
scripts/check-upgrade-coverage.mjs, skills-contrib/record-upgrade-instructions/SKILL.md
Adds COVERAGE_SUBSTRATES, replaces coverageTransitionLabel with exported coverageTransitionChain(head, prev) that returns an ordered array of consecutive minor-step transition labels (or a single prev→head for major boundaries). Updates gate and skill docs to describe chain-based skip-publish handling.
Coverage Validation Using Transition Chain
scripts/check-upgrade-coverage.mjs
runCheck computes coverageChain and iterates all transitions for each substrate diff, requiring each upgrades/<transition>/ directory and emitting one coverage violation per missing directory. Expands allowedTransitions for the new-entries rule to include all coverageChain entries plus the in-flight transition. Result diagnostics now include coverageChain.
Test Coverage for Chain Helper and Validation
scripts/check-upgrade-coverage.test.mjs
Replaces coverageTransitionLabel tests with coverageTransitionChain unit tests (PR mode, consecutive publishes, skip-publish spans, major boundaries) and adds skip-publish chain tests verifying per-transition violations, new-entries acceptance/rejection, and JSON reporting. Updates in-flight assertion for prev=0.6.0, head=0.8.0 to expect both 0.6-to-0.7 and 0.7-to-0.8.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • prisma/prisma-next#508: Introduced the original check-upgrade-coverage gate and the earlier coverageTransitionLabel helper.

Poem

🐇 From single leaps to chains that flow,
Each minor hop now gets its show.
When publishes skip, the path's made plain,
Per-step instructions keep the train.
Hops counted, checked — the rabbit nods with glee.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: making the upgrade-coverage gate aware of version-transition chains and accepting skip-publish releases.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2573-fix-deployment-check-upgrade-coverage-8-violations-07-09

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@pkg-pr-new

pkg-pr-new Bot commented May 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-author-tools@535

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-runtime@535

@prisma-next/family-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-mongo@535

@prisma-next/sql-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-runtime@535

@prisma-next/family-sql

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-sql@535

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-arktype-json@535

@prisma-next/extension-cipherstash

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-cipherstash@535

@prisma-next/middleware-cache

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/middleware-cache@535

@prisma-next/mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo@535

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-paradedb@535

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-pgvector@535

@prisma-next/extension-postgis

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-postgis@535

@prisma-next/postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/postgres@535

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-orm-client@535

@prisma-next/sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sqlite@535

@prisma-next/target-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-mongo@535

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-mongo@535

@prisma-next/driver-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-mongo@535

@prisma-next/contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract@535

@prisma-next/utils

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/utils@535

@prisma-next/config

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config@535

@prisma-next/errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/errors@535

@prisma-next/framework-components

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/framework-components@535

@prisma-next/operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/operations@535

@prisma-next/ts-render

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ts-render@535

@prisma-next/contract-authoring

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-authoring@535

@prisma-next/ids

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ids@535

@prisma-next/psl-parser

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-parser@535

@prisma-next/psl-printer

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-printer@535

@prisma-next/cli

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli@535

@prisma-next/emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/emitter@535

@prisma-next/migration-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/migration-tools@535

prisma-next

npm i https://pkg.pr.new/prisma/prisma-next@535

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/vite-plugin-contract-emit@535

@prisma-next/mongo-codec

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-codec@535

@prisma-next/mongo-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract@535

@prisma-next/mongo-value

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-value@535

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-psl@535

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-ts@535

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-emitter@535

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-schema-ir@535

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-ast@535

@prisma-next/mongo-orm

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-orm@535

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-builder@535

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-lowering@535

@prisma-next/mongo-wire

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-wire@535

@prisma-next/sql-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract@535

@prisma-next/sql-errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-errors@535

@prisma-next/sql-operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-operations@535

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-schema-ir@535

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-psl@535

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-ts@535

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-emitter@535

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane-query-builder@535

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-relational-core@535

@prisma-next/sql-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-builder@535

@prisma-next/target-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-postgres@535

@prisma-next/target-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-sqlite@535

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-postgres@535

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-sqlite@535

@prisma-next/driver-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-postgres@535

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-sqlite@535

commit: 701a0a8

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/check-upgrade-coverage.mjs (1)

280-308: ⚡ Quick win

Move substrate coverage rules to a declarative table.

The examples/ and packages/3-extensions/ coverage blocks are duplicated and hardcoded. A small substrate config array would keep rule changes in one place and reduce drift risk.

Refactor sketch
+const COVERAGE_SUBSTRATES = [
+  { substrate: 'examples/', pathspec: 'examples/', skillPkg: USER_SKILL_PKG },
+  {
+    substrate: 'packages/3-extensions/',
+    pathspec: 'packages/3-extensions/',
+    skillPkg: EXT_SKILL_PKG,
+  },
+];
+
-const examplesDiff = diffPaths(repoRoot, prev, head, ['examples/']);
-if (examplesDiff.length > 0) {
-  for (const transition of coverageChain) {
-    const requiredDir = `${USER_SKILL_PKG}/upgrades/${transition}`;
-    ...
-  }
-}
-
-const extDiff = diffPaths(repoRoot, prev, head, ['packages/3-extensions/']);
-if (extDiff.length > 0) {
-  for (const transition of coverageChain) {
-    const requiredDir = `${EXT_SKILL_PKG}/upgrades/${transition}`;
-    ...
-  }
-}
+for (const { substrate, pathspec, skillPkg } of COVERAGE_SUBSTRATES) {
+  const substrateDiff = diffPaths(repoRoot, prev, head, [pathspec]);
+  if (substrateDiff.length === 0) continue;
+  for (const transition of coverageChain) {
+    const requiredDir = `${skillPkg}/upgrades/${transition}`;
+    if (!existsSync(`${repoRoot}/${requiredDir}`)) {
+      violations.push({
+        rule: 'coverage',
+        substrate,
+        requiredDir,
+        sampleDiffPaths: substrateDiff.slice(0, 5),
+      });
+    }
+  }
+}

As per coding guidelines: "scripts/**/*.mjs: Prefer declarative data structures ... over hardcoded conditionals for validation rules, constraints, and configuration logic."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/check-upgrade-coverage.mjs` around lines 280 - 308, Extract the
duplicated coverage checks for examplesDiff and extDiff into a declarative array
(e.g., an array of substrate descriptors containing the diffPaths arg, substrate
label, and pkg prefix such as USER_SKILL_PKG and EXT_SKILL_PKG), then iterate
that array to call diffPaths(repoRoot, prev, head, descriptor.diffPath) and, if
length > 0, loop coverageChain to build requiredDir from descriptor.pkgPrefix
and transition and push the same violation object (use existing symbols
examplesDiff/extDiff only where helpful during refactor). Replace the two
hardcoded blocks with this single generic loop so the validation logic
(diffPaths, existsSync, violations push) is centralized and driven by the new
substrate config array.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/check-upgrade-coverage.mjs`:
- Around line 108-120: The function coverageTransitionChain doesn't handle the
case where head.major === prev.major but head.minor < prev.minor; add an
explicit check in coverageTransitionChain to fail fast for reversed same-major
ranges (e.g., if (head.major === prev.major && head.minor < prev.minor) throw
new Error(...)) or return a strict fallback label, and include details of head
and prev in the error message to make the invalid range obvious; place this
check before generating labels so the rest of the logic (the inFlight and
ascending loop) can assume head.minor >= prev.minor.

---

Nitpick comments:
In `@scripts/check-upgrade-coverage.mjs`:
- Around line 280-308: Extract the duplicated coverage checks for examplesDiff
and extDiff into a declarative array (e.g., an array of substrate descriptors
containing the diffPaths arg, substrate label, and pkg prefix such as
USER_SKILL_PKG and EXT_SKILL_PKG), then iterate that array to call
diffPaths(repoRoot, prev, head, descriptor.diffPath) and, if length > 0, loop
coverageChain to build requiredDir from descriptor.pkgPrefix and transition and
push the same violation object (use existing symbols examplesDiff/extDiff only
where helpful during refactor). Replace the two hardcoded blocks with this
single generic loop so the validation logic (diffPaths, existsSync, violations
push) is centralized and driven by the new substrate config array.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: ba06ad53-9ace-4ad5-8739-94c15e7e7c9a

📥 Commits

Reviewing files that changed from the base of the PR and between 4496dc0 and c1dad08.

📒 Files selected for processing (3)
  • scripts/check-upgrade-coverage.mjs
  • scripts/check-upgrade-coverage.test.mjs
  • skills-contrib/record-upgrade-instructions/SKILL.md

Comment thread scripts/check-upgrade-coverage.mjs Resolved
wmadden added 2 commits May 19, 2026 15:21
…nChain

Previously, when `head.major === prev.major` and `head.minor < prev.minor`,
`coverageTransitionChain` silently returned an empty array. The empty chain
then caused the coverage-rule loop to find nothing to require, which could
mask missing directories on a misordered run (refs supplied in reverse,
unexpected rebase state, etc.).

Fail fast with an explicit Error naming both versions instead, so the operator
sees the misordering rather than a silently-passing gate.

Signed-off-by: Will Madden <[email protected]>
The two coverage blocks (examples/ + packages/3-extensions/) were identical
modulo their substrate label, diff pathspec, and skill package. Extract the
varying parts into a small COVERAGE_SUBSTRATES table and iterate it once.

Adding a new substrate is now a one-line table entry instead of a copy-paste
block, and the validation logic (diffPaths, existsSync, violations push) lives
in one place. Matches the scripts/**/*.mjs declarative-data-structure
coding guideline.

No behaviour change; the full upgrade-coverage test suite (30 cases) stays
green and the live publish-mode gate against v0.7.0 still exits 0.

Signed-off-by: Will Madden <[email protected]>
@wmadden

wmadden commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

Done (CodeRabbit nitpick on scripts/check-upgrade-coverage.mjs L280-308): the two duplicated coverage blocks (examples/ + packages/3-extensions/) now drive off a single COVERAGE_SUBSTRATES declarative table iterated by one loop — see 701a0a8. Behaviour-preserving: the 30-case test suite (incl. the skip-publish chain describe block) stays green and the live pnpm check:upgrade-coverage --mode publish --prev v0.7.0 still exits 0.

Inline thread on coverageTransitionChain (reversed same-major range) was addressed separately in 57afbf3 and resolved.

@wmadden
wmadden merged commit 4c43391 into main May 19, 2026
16 checks passed
@wmadden
wmadden deleted the tml-2573-fix-deployment-check-upgrade-coverage-8-violations-07-09 branch May 19, 2026 14:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant