From 6c736b9cf6b855093208c1a846b034c178bb631c Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Wed, 2 Sep 2026 00:36:42 +0530 Subject: [PATCH 1/2] Address review feedback on the SDK bump automation Three follow-ups from the review of #101. The stale-CDN check dropped whole lines, so a line carrying both a bumped and a stale reference hid the stale one; it now matches with -o so each reference is judged on its own, and excludes the current version with -F so the dots in the version stay literal. A dispatched version was taken at face value, surfacing a typo only as an npm 404 well into the bump. It is now confirmed against the registry in the check step. An older version stays allowed on purpose, as that is how a bad release gets rolled back. A draft opened by a failing e2e run told nobody what to do with it, while every later scheduled run skipped that version for good. The draft body now spells out the three recovery paths. Claude-Session: https://claude.ai/code/session_0117hJP3TxNWJxrg4YPMNNiS --- .github/workflows/update-nutrient-sdk.yml | 35 +++++++++++++++++++++-- scripts/check-nutrient-update.sh | 15 ++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-nutrient-sdk.yml b/.github/workflows/update-nutrient-sdk.yml index 1410e34..72db729 100644 --- a/.github/workflows/update-nutrient-sdk.yml +++ b/.github/workflows/update-nutrient-sdk.yml @@ -64,10 +64,15 @@ jobs: # example that gains a script tag without an entry is left behind in # silence. examples/salesforce/README.md is exempt: its version is an # illustration, not a pin. - stale="$(grep -rEn "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" examples/ \ + # + # -o prints one match per line rather than one line per match, so a + # line carrying both a bumped and a stale reference cannot have the + # stale one dropped along with the whole line. -F keeps the dots in + # ${VERSION} literal instead of matching any character. + stale="$(grep -rEon "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" examples/ \ --exclude-dir=node_modules --exclude-dir=dist \ --exclude-dir=.next --exclude-dir=.nuxt \ - | grep -v "pspdfkit-web@${VERSION}" \ + | grep -vF "pspdfkit-web@${VERSION}" \ | grep -v '^examples/salesforce/README.md:' || true)" if [ -n "$stale" ]; then @@ -158,6 +163,32 @@ jobs: [Workflow run](${RUN_URL}) BODY + # Nothing retries a draft. The scheduled job treats any pull request + # for this branch as "handled", so without these instructions the + # version is parked on whoever opens the draft next, with no way to + # re-run the suite from the pull request itself. + if [ "$E2E_OUTCOME" != "success" ]; then + cat >> /tmp/pr-body.md <&2 + exit 1 + fi +fi + # jq -r prints "null" and exits 0 for a missing key, which would silently # disable the already-on-this-version check. if ! current="$(jq -er '.dependencies["@nutrient-sdk/viewer"]' \ From 7ebd6b35202b01a57bc2a55e5f6df9d36ed0c217 Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Wed, 2 Sep 2026 01:36:53 +0530 Subject: [PATCH 2/2] Correct the draft recovery instructions and tighten two checks The recovery section told a human to close the draft, delete the branch and re-dispatch. That does not work: the existing-pull-request check lists with --state all, so the closed draft still reads as "already handled" and the re-run exits with should_update=false. It now says to close and reopen the pull request instead, which fires pull_request: reopened as that human and so does run Biome and Playwright against the bump. Marking a draft ready for review is not an activity type either workflow acts on, so it attaches no checks; the section now says so rather than implying otherwise. For the same reason, the comment claiming a dispatched older version is the rollback path was wrong: every released version already has an update-examples-X pull request, so the check refuses all of them. The comment now records why no ordering check is needed at all. Two smaller ones: the stale-CDN exclusion matched the version as a substring, so 1.20.1 would have hidden a stale 1.20.10; it now escapes the dots and anchors on $. And the registry check dropped curl's -f so that a 404 and an unreachable registry no longer report identically. Claude-Session: https://claude.ai/code/session_0117hJP3TxNWJxrg4YPMNNiS --- .github/workflows/update-nutrient-sdk.yml | 30 +++++++++++++---------- scripts/check-nutrient-update.sh | 24 ++++++++++++++---- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-nutrient-sdk.yml b/.github/workflows/update-nutrient-sdk.yml index 72db729..47bba4a 100644 --- a/.github/workflows/update-nutrient-sdk.yml +++ b/.github/workflows/update-nutrient-sdk.yml @@ -67,12 +67,13 @@ jobs: # # -o prints one match per line rather than one line per match, so a # line carrying both a bumped and a stale reference cannot have the - # stale one dropped along with the whole line. -F keeps the dots in - # ${VERSION} literal instead of matching any character. + # stale one dropped along with the whole line. The exclusion escapes + # the dots in ${VERSION} and anchors on $, so 1.20.1 cannot swallow a + # stale 1.20.10 as a prefix of it. stale="$(grep -rEon "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" examples/ \ --exclude-dir=node_modules --exclude-dir=dist \ --exclude-dir=.next --exclude-dir=.nuxt \ - | grep -vF "pspdfkit-web@${VERSION}" \ + | grep -vE "pspdfkit-web@${VERSION//./\\.}$" \ | grep -v '^examples/salesforce/README.md:' || true)" if [ -n "$stale" ]; then @@ -164,9 +165,9 @@ jobs: BODY # Nothing retries a draft. The scheduled job treats any pull request - # for this branch as "handled", so without these instructions the - # version is parked on whoever opens the draft next, with no way to - # re-run the suite from the pull request itself. + # for this branch as "handled" whatever its state, so without these + # instructions the version is parked on whoever opens the draft next, + # with no way to re-run the suite from the pull request itself. if [ "$E2E_OUTCOME" != "success" ]; then cat >> /tmp/pr-body.md <&2 + curl_status=0 + http_code="$(curl -sSL --retry 3 --retry-delay 2 -o /dev/null \ + -w '%{http_code}' "${PACKAGE_URL}/${requested}")" || curl_status=$? + + if [ "${curl_status}" -ne 0 ]; then + echo "Could not reach the npm registry to check ${requested}" \ + "(curl exited ${curl_status})." >&2 + exit 1 + fi + + if [ "${http_code}" != "200" ]; then + echo "@nutrient-sdk/viewer@${requested} is not published on the registry" \ + "(HTTP ${http_code})." >&2 exit 1 fi fi