Repository navigation
fix(sdk): separate latest deployment from official archives - #65
Open
m4sh-wacker wants to merge 1 commit into
Open
m4sh-wacker wants to merge 1 commit into
m4sh-wacker wants to merge 1 commit into
Conversation
| if (!info.isFile()) { | ||
| throw new Error(`Expected regular file: ${filePath}`); | ||
| } | ||
| return readFile(filePath); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Separates continuous latest SDK deployments from immutable milestone SDK archives so ordinary
maindeployments always publish the latest website, standalone HTML, and/api//api.jsaliases without colliding with archived versions.maincommit SHA:f3f7b15aac6c7359a92a584f7c3f077207b64928Root Cause of the Previous Deployment Failure
scripts/build-sdk.mjspreviously wrote intodist/sdk/v1/<package.json version>/(0.3.3), whilepackage.jsonstays on the previous release version until a Release Please PR is merged (and Release Please ignoreschore(deps):commits becausechoreishidden: true).195c13f) bumpedvite(8.3.5->8.4.0, updatingrolldown1.2.14->1.3.4), changing the minified bytes ofdecodebox.jsanddecodebox.mjswhilepackage.jsonremained0.3.3. Consequently,Deploy to GitHub Pagesruns46672589781and46692468864failed ondiff -qr "$release" "$target"in.github/workflows/deploy-pages.yml(just as earlier engine PRs fix(encodings): refuse Base45 and Base85 groups that overflow #50 and fix(encodings): refuse punctuation in Punycode digits #51 failed prior to0.3.2and0.3.3)./__VITE_PRELOAD__(?:[\da-f]{32})?/g.standalonePlugin()invite.config.tsreplaced only__VITE_PRELOAD__, leaving a trailing 32-hex hash ([]e115532ea529dbadd736874a4545557e) insidedist/decodebox.htmland causing aSyntaxErroron load.Why
diff -qr "$release" "$target"Was Removed from Website DeploymentIn the finalized two-channel architecture, the latest online SDK built from
mainis intentionally newer than (and allowed to differ from) older official archived SDKs. Comparing a freshly built latest SDK against an archived version directory incorrectly treated the old archive as the expected latest SDK.diff -qr "$release" "$target"from the ordinarymainwebsite deployment path in.github/workflows/deploy-pages.yml.vm.SourceTextModuleparse check ondist/decodebox.htmlbefore publishing.scripts/build-sdk.mjs(--releasemode) andscripts/publish-gh-pages.mjs(--mode archive), which refuse to overwrite any existing official archive with differing bytes.Architecture: Two Independent SDK Channels
1. Latest SDK — Continuous Deployment (
main)npm run build:sdk(scripts/build-sdk.mjsin defaultlatestmode) buildsdecodebox.js,decodebox.mjs,decodebox.d.mts, andSHA256SUMSinto staging directorybuild/sdk/(gitignored, outsidedist/).dist/:/api,/api.js,/sdk/v1/decodebox.js,/sdk/decodebox.js/sdk/v1/decodebox.esm.js,/sdk/decodebox.mjs/sdk/decodebox.d.mts/sdk/v1/<version>/archive directories during ordinary deployments.scripts/check-sdk-dist.mjsvalidates alldist/aliases againstbuild/sdk/SHA256SUMS, verifies retained official archives and absence of obsolete directories, and runs the Node smoke test.src/sdk/index.tskeepsengineVersiontied topackage.json(no artificial version bumping) and adds additivebuildIdmetadata derived from the built Git commit SHA.2. Official SDK Archives —
PATCH=0Milestone PolicyOnly stable releases whose
PATCHcomponent is0generate and publish an immutable versioned archive under/sdk/v1/{version}/:0.3.4,0.3.5,0.4.1,0.4.20.4.0,0.5.0,1.0.0,1.1.0scripts/build-sdk.mjs --release <tag>validatesPATCH === 0viaarchivePathFor(), verifies<version>matches the checked-out tag'spackage.json, builds into a temp dir, verifiesSHA256SUMS, refuses to overwrite differing existing archives, and never touches/apior/api.js.One-Time Archive Cleanup (
0.3.1–0.3.3Removed;0.2.0&0.3.0Preserved)0.2.0and0.3.0are preserved byte-for-byte (includingSHA256SUMSverification before copying forward) because both are qualifyingPATCH === 0milestone releases.0.3.1,0.3.2, and0.3.3are removed viaOBSOLETE_ARCHIVE_DIRSinscripts/publish-gh-pages.mjs(--mode latest) on the nextmaindeployment because they are pre-policy patch releases (PATCH !== 0). Once removed fromgh-pages, latest deployments never generate versioned directories, so they are never restored.Release Please Integration
mainupdates the website,decodebox.html, and/api+/api.js; pending Release Please PRs update normally without publishing archives.v0.3.4): Release Please creates the GitHub Release and.github/actions/standalone-releaseuploads/verifies the standalone HTML without creating/sdk/v1/0.3.4/or overwriting latest aliases.v0.4.0): Because tags/releases created withGITHUB_TOKENdo not trigger separatepush: tagsorreleaseworkflows,.github/workflows/release-please.ymlchecks out the exact tag viastandalone-release, builds/sdk/v1/<version>/(--release "$RELEASE_TAG"), verifiesSHA256SUMS, and publishes only that archive directory viascripts/publish-gh-pages.mjs --mode archive(never replacing website files or/api//api.js). Retries are idempotent when the archive already matches and fail closed on content differences.Concurrency & GitHub Pages Publication Safety
Separate workflow concurrency groups (
github-pagesindeploy-pages.ymlandrelease-please-${{ github.ref }}inrelease-please.yml) serialize runs within each workflow, but are not sufficient alone when a release PR merge triggers both workflows concurrently onmain. Without cross-workflow coordination, a blindgit push --forcefrom whichever finishes second would wipe out either the newly deployed website/aliases or the newly published milestone archive.To prevent lost updates across workflows:
deploy-pages.yml(--mode latest) andrelease-please.yml(--mode archive) sharescripts/publish-gh-pages.mjs.publish-gh-pages.mjsreadsrefs/heads/gh-pages(expectedOid), fetches the latestFETCH_HEAD, merges only its owned slice (latest mode: website + aliases onto retained archives; archive mode:/sdk/v1/<version>/onto the entire livegh-pagessnapshot), and pushes atomically withgit push --force-with-lease=refs/heads/gh-pages:<expectedOid>.stale info/ ref moved), it retries with backoff against the freshFETCH_HEAD(up to 5 attempts), ensuring neither workflow ever force-pushes a stale snapshot or loses the other's updates.Test Results
Executed locally on Windows (Node
v24.18.0, Chrome viaplaywright-core):npm run lint(eslint .): passed (0 errors, 0 warnings; also re-run post-commit)npm run typecheck(tsc --noEmit): passed (also re-run post-commit)npm test -- --run: 77 test files, 1,279 tests passed, includingsrc/sdk/sdk.test.ts(6 tests) andscripts/sdk-distribution.test.mjs(6 tests coveringPATCH=0policy, Scenarios A–G, realbuildSdklatest/release modes, and bidirectional CAS concurrency race retries against bare git remotes)npm run build&npm run check:sdk-dist: passed (also re-run post-commit)npm audit --audit-level=high: passed (0 vulnerabilities)origin/gh-pages(67a10ed0): verified0.2.0&0.3.0preserved byte-for-byte,0.3.1–0.3.3removed (HTTP 404), livecheck-sdk-dist.mjs,check-sdk-browser.mjs(6 latest JS aliases),buildIdmetadata (f3f7b15aac6c), Chromium loads ofindex.html,decodebox.html(HTTP &file://), and simulatedv0.4.0milestone archive build/publish/--releasebrowser check.deploy-pages.yml,release-please.yml, andstandalone-release/action.ymlpassed PyYAML parsing and Git Bashbash -n;docs/*.mdprose lines checked<= 100chars;verify-release-cli.cjsYAML structure assertions verified via PyYAML andsdk-paths.mjsfixture check.Not run locally (Ubuntu runner / external toolchain dependencies): GraalJS CI job, Node 22 matrix leg,
markdownlint-cli2-action/lychee-action, and full Linux execution of.github/scripts/verify-release-cli.cjs/verify-release-notes.cjs.Remaining Risks
maindeployment after merge,/sdk/v1/0.3.1,/sdk/v1/0.3.2, and/sdk/v1/0.3.3will be removed fromgh-pages(by design under Phase 2); external links pinning those three pre-policy patch URLs will receive 404.verify-release-cli.cjs(/bin/bashfixture), and live GitHub Pages CDN propagation checks will exercise for the first time on the GitHub Actionsubuntu-24.04runners.standalone-releasechecks out the exact tagged commit, so rebuilding an old pre-PR tag runs that tag's own scripts, whereas future tags frommainuse the newPATCH=0archive and Vite 8.4.0 preload handling.