diff --git a/.github/workflows/publish-version.yml b/.github/workflows/publish-version.yml index cb4fa105..b95637bc 100644 --- a/.github/workflows/publish-version.yml +++ b/.github/workflows/publish-version.yml @@ -334,6 +334,16 @@ jobs: node -e 'const p=require(process.argv[1]); for (const k of ["kind","id","root"]) console.log(`${k}=${p[k]}`)' "$RUNNER_TEMP/plan.json" >> "$GITHUB_OUTPUT" cat "$RUNNER_TEMP/plan.json" + - name: Fetch the release schedule + # Before any content is on disk: this is the only step that holds the + # job's token, and the build reads the result from a file. + working-directory: engine/apps/docs + env: + DOCS_GITHUB_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + pnpm run --silent publish:release-schedule -- --out "$RUNNER_TEMP/release-schedule.json" + - name: Check out the content tree at the resolved commit uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: @@ -401,9 +411,8 @@ jobs: # variable is "1": it builds the semantic index and turns on the # hybrid search dialog. DOCS_SEMANTIC_SEARCH: ${{ vars.DOCS_SEMANTIC_SEARCH }} - # Read-only: the release schedule is public, and the job's own token - # only lifts the anonymous rate limit for the sync's GitHub fetch. - DOCS_GITHUB_TOKEN: ${{ github.token }} + # Fetched above, before the content checkout. + DOCS_RELEASE_SCHEDULE_FILE: ${{ runner.temp }}/release-schedule.json run: | set -euo pipefail pnpm turbo run build --filter=@coder/docs-site diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 3c888fa2..cd6a8e02 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -200,7 +200,10 @@ It is the next step if the sanitizer ever has to be weakened, and otherwise a la The Releases page's release schedule is data, not content: coder/coder authors a `
` marker with a fallback link, and the engine fills it from GitHub. `buildReleaseSchedule` in `@coder/docs-config` is the one definition of the rows: stable is the minor of GitHub's latest release, mainline and security support are the released minor lines either side of it (ordered by major, then minor), the ESR set comes from coder/coder's `scripts/release_channels/esr_versions.txt`, and an ESR drops out 365 days after its first release. -The sync fetches the schedule once per build (`writeReleaseSchedule` in `@coder/docs-build`), a publish fails if it cannot, and `remarkReleasesTable` rewrites the marker into `ReleasesTable`, whose children carry the same rows as a Markdown table for search and the Markdown twin. +The sync gets the schedule once per build (`writeReleaseSchedule` in `@coder/docs-build`), and `remarkReleasesTable` rewrites the marker into `ReleasesTable`, whose children carry the same rows as a Markdown table for search and the Markdown twin. +In a publish, a separate `Fetch the release schedule` step fetches it with the job's token before the content checkout, and the sync reads that file through `DOCS_RELEASE_SCHEDULE_FILE` instead of fetching. +That keeps the invariant that there is no token in the build step's environment, the step that compiles untrusted content, so never pass that step a token. +A publish fails if the fetch does. A tag build is never rebuilt, so on the public site `ReleasesTable` refreshes from the router's `/releases.json`, which fetches GitHub at most once an hour per isolate; the offline export keeps its build-time table. Older refs carry a static table between `RELEASE_CALENDAR_START/END` comments; the sync strips comments, so `rewriteLegacyReleaseCalendar` turns that region into the marker first, line for line. diff --git a/apps/docs/README.md b/apps/docs/README.md index 9caeb2f2..fa8d382d 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -321,6 +321,13 @@ Any experiment with `DOCS_UPLOAD_CONCURRENCY` above `16` must be a single publis `publish:cleanup` deletes an archive prefix once the manifest no longer references it and it has stayed unreferenced for at least seven days, giving an in-flight reader time to finish against a prefix the manifest just stopped pointing at. A tag prefix (`versions///` for a `vX.Y.Z` tag) is never deleted by the pipeline, whatever the manifest says, since a tag is frozen forever once published. +Every upload writes a small `_uploading.json` marker at the prefix root before any other object, and `_publish.json` last. +A re-upload of the same commit leaves the old `_publish.json` in place until its final put, so cleanup takes the newer of the two as the prefix's last activity and keeps any prefix whose last activity falls inside the grace period. +The listing ages each prefix by `_publish.json` alone to pick candidates; the check that decides is a re-read of both objects, made after the candidate's objects have been listed and immediately before each delete call, including a delete retried after a rate limit. +A prefix without `_publish.json` is never deleted: at listing time it is an upload in flight, and at delete time it is already gone. +A skipped candidate is logged with the reason, either `saw upload activity at