@krx3d/tizentube2 1.30.610 → 1.30.630

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -507,7 +507,13 @@ jobs:
507
507
  run: |
508
508
  set -euo pipefail
509
509
  echo "Fetching the registry document for ${PKG} ..."
510
- curl -fsSL "https://registry.npmjs.org/${PKG}" -o /tmp/packument.json
510
+ # ?write=true is served from the origin rather than the CDN in front
511
+ # of it. Without it this read can predate the publish that just
512
+ # happened: a run that had waited 76 seconds for its own version to
513
+ # become readable then read dist-tags here that still said the
514
+ # version before it, which is the value the keep-set is built from.
515
+ curl -fsSL -H 'Cache-Control: no-cache' \
516
+ "https://registry.npmjs.org/${PKG}?write=true" -o /tmp/packument.json
511
517
  node -e '
512
518
  const fs = require("fs");
513
519
  const doc = JSON.parse(fs.readFileSync("/tmp/packument.json","utf8"));
@@ -727,17 +733,24 @@ jobs:
727
733
  # --------------------
728
734
  # Final wait + verify final state
729
735
  # --------------------
730
- - name: Wait before final verify
731
- if: steps.confirm_publish.outputs.confirmed == 'true'
732
- run: |
733
- echo "Short wait to let registry propagate final state..."
734
- sleep 8
735
-
736
736
  # The cleanup steps above rewrite the whole package document, so the last
737
737
  # thing this job does is check that the version it published is still the
738
738
  # one npm hands out. Without this the job reported success while `latest`
739
739
  # had silently fallen back a release, and the first sign of it was a TV
740
740
  # loading a userscript older than its own app.
741
+ #
742
+ # It has to be patient, which it was not. A run failed here reporting the
743
+ # version it had just published as gone, while npm was in fact serving it
744
+ # as latest the whole time. The registry had taken 76 seconds to make
745
+ # that publish readable — the confirm step above needed six attempts for
746
+ # it — and this read the document once, eight seconds after that, off a
747
+ # CDN replica still carrying the state from before. The guard was right
748
+ # to exist and wrong about this run.
749
+ #
750
+ # So: the same patience as the step that waits for the publish, reading
751
+ # from the origin rather than the cache in front of it, and failing only
752
+ # once the state has stayed wrong for long enough that propagation cannot
753
+ # be the explanation.
741
754
  - name: Verify final state
742
755
  if: steps.confirm_publish.outputs.confirmed == 'true'
743
756
  env:
@@ -748,23 +761,45 @@ jobs:
748
761
  npm view "${PKG}" versions --json
749
762
  echo ""
750
763
 
751
- # Read through the registry rather than `npm view`, whose cache is
752
- # what made the original breakage invisible here.
753
- curl -fsSL "https://registry.npmjs.org/${PKG}" -o /tmp/packument_final.json
764
+ WANT=$(cat /tmp/current_version.txt)
765
+ for i in $(seq 1 20); do
766
+ # ?write=true bypasses the CDN; npm view is avoided entirely, since
767
+ # its own HTTP cache is what made the original breakage invisible.
768
+ if curl -fsSL -H 'Cache-Control: no-cache' \
769
+ "https://registry.npmjs.org/${PKG}?write=true" -o /tmp/packument_final.json; then
770
+ VERDICT=$(node -e '
771
+ const fs = require("fs");
772
+ const doc = JSON.parse(fs.readFileSync("/tmp/packument_final.json","utf8"));
773
+ const want = fs.readFileSync("/tmp/current_version.txt","utf8").trim();
774
+ const latest = (doc["dist-tags"] || {}).latest;
775
+ const live = !!(doc.versions || {})[want];
776
+ const deprecated = live && !!doc.versions[want].deprecated;
777
+ if (deprecated) { console.log("deprecated"); }
778
+ else if (live && latest === want) { console.log("ok"); }
779
+ else { console.log("waiting " + (live ? "live" : "absent") + " latest=" + latest); }
780
+ ')
781
+ echo "attempt ${i}: ${VERDICT}"
782
+ case "$VERDICT" in
783
+ ok) echo "npm latest matches the version this run published."; exit 0 ;;
784
+ deprecated) echo "::error::${WANT} was published deprecated."; exit 1 ;;
785
+ esac
786
+ else
787
+ echo "attempt ${i}: the registry document could not be read"
788
+ fi
789
+ sleep 15
790
+ done
791
+
792
+ # Five minutes of the wrong answer is no longer propagation.
754
793
  node -e '
755
794
  const fs = require("fs");
756
795
  const doc = JSON.parse(fs.readFileSync("/tmp/packument_final.json","utf8"));
757
796
  const want = fs.readFileSync("/tmp/current_version.txt","utf8").trim();
758
797
  const latest = (doc["dist-tags"] || {}).latest;
759
798
  const live = !!(doc.versions || {})[want];
760
- const deprecated = live && !!doc.versions[want].deprecated;
761
799
  console.log("published: " + want + ", latest tag: " + latest + ", still live: " + live);
762
- let failed = false;
763
- if (!live) { console.log("::error::" + want + " is no longer on npm. A cleanup write removed the version this run published."); failed = true; }
764
- if (latest !== want) { console.log("::error::npm latest is " + latest + ", not " + want + ". The CDN will serve the wrong bundle to every TV."); failed = true; }
765
- if (deprecated) { console.log("::error::" + want + " was published deprecated."); failed = true; }
766
- if (failed) process.exit(1);
767
- console.log("npm latest matches the version this run published.");
800
+ if (!live) console.log("::error::" + want + " is no longer on npm after five minutes. A cleanup write removed the version this run published.");
801
+ if (latest !== want) console.log("::error::npm latest is " + latest + ", not " + want + ", after five minutes. The CDN will serve the wrong bundle to every TV.");
802
+ process.exit(1);
768
803
  '
769
804
 
770
805
  # --------------------
@@ -884,6 +919,57 @@ jobs:
884
919
 
885
920
  echo "Individual purge attempts complete"
886
921
 
922
+ # The purge above is fire-and-forget: jsDelivr answers "pending" and that
923
+ # is the end of it. Nothing checked the result, and a capture showed what
924
+ # that costs — the unversioned URL, which is the one the TV actually
925
+ # fetches, kept serving the previous release for hours after a publish
926
+ # (x-cache HIT, age 15039, the bundle inside it a version behind). Every
927
+ # TV was loading that, so a diagnostic merged that afternoon was simply
928
+ # not running, and its absence read as the feature being broken.
929
+ #
930
+ # So the last word belongs to the URL the TV uses, read the way the TV
931
+ # reads it. The version string has to be inside the bundle itself: a
932
+ # 200 proves nothing when the stale object is also a 200.
933
+ #
934
+ # One caveat worth stating: jsDelivr serves from many points of presence
935
+ # and this checks the one that answers here. It cannot prove every edge
936
+ # is current. What it does prove is that the origin resolves this
937
+ # package's unversioned path to the version just published — which is the
938
+ # failure that was actually seen, and the one that affects every edge.
939
+ - name: Verify the CDN serves this version
940
+ if: steps.confirm_publish.outputs.confirmed == 'true'
941
+ env:
942
+ PKG: ${{ env.PACKAGE_NAME }}
943
+ run: |
944
+ set -euo pipefail
945
+ VER=$(cat /tmp/current_version.txt)
946
+ URL="https://cdn.jsdelivr.net/npm/${PKG}/dist/userScript.js"
947
+ echo "Checking ${URL} for ${VER} ..."
948
+
949
+ for i in $(seq 1 10); do
950
+ if curl -fsSL -H 'Cache-Control: no-cache' "$URL" -o /tmp/cdn_bundle.js; then
951
+ if grep -q "$VER" /tmp/cdn_bundle.js; then
952
+ echo "attempt ${i}: the CDN serves ${VER}."
953
+ exit 0
954
+ fi
955
+ FOUND=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' /tmp/cdn_bundle.js | sort -u | tail -1 || true)
956
+ echo "attempt ${i}: still serving ${FOUND:-an unknown version}"
957
+ else
958
+ echo "attempt ${i}: the CDN could not be read"
959
+ fi
960
+
961
+ # Ask again rather than only waiting: the first purge can land
962
+ # before npm's latest has propagated, in which case jsDelivr
963
+ # re-resolves the old version and caches that instead.
964
+ curl -s -X POST -H 'Content-Type: application/json' \
965
+ --data "{\"path\":[\"/npm/${PKG}/dist/userScript.js\",\"/npm/${PKG}/dist/service.js\",\"/npm/${PKG}@latest/dist/userScript.js\",\"/npm/${PKG}@latest/dist/service.js\"]}" \
966
+ https://purge.jsdelivr.net/ > /dev/null || true
967
+ sleep 20
968
+ done
969
+
970
+ echo "::error::The CDN is still not serving ${VER} at ${URL} after ten attempts. Every TV will keep loading the previous bundle until this clears, which looks exactly like the new build not working. Purge it by hand (https://www.jsdelivr.com/tools/purge) or re-run this workflow."
971
+ exit 1
972
+
887
973
  - name: Cache purge complete
888
974
  if: steps.confirm_publish.outputs.confirmed == 'true'
889
975