Skip to content

Add the scheduled link-cache-refresh workflow - #2780

Merged
chalin merged 6 commits into
docsy:mainfrom
chalin:chalin-m24-link-cache-refresh-2026-0831
Sep 1, 2026
Merged

chalin merged 6 commits into
docsy:mainfrom
chalin:chalin-m24-link-cache-refresh-2026-0831

Conversation

@chalin

@chalin chalin commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator
  • Contributes to the owned-link-cache adoption (docsy.dev: switch the committed link cache to owned JSONC (link-cache.jsonc) #2779): the operational half -- a daily rotation that re-verifies the lychee-verified entries (1069 today) in roughly two weeks of merged daily refreshes.
  • Model: prune the N (default 75) oldest lychee-verified entries, rebuild + re-check, push to the single reused bot/link-cache-refresh branch, open-or-refresh its PR (body carries the oldest-entry marker for prune tuning, and a triage warning when the refresh recorded failing links). Manual seeds are prune-exempt ([email protected]) and retire via their expires dates.
  • Failure semantics: dead links don't fail the run -- the merge-back records them as negative statuses and the PR diff is the triage surface; preflight failures (exit 2: tool/config broken, zero links verified) fail hard; a prune whose refresh changes nothing fails the run (sanity assertion, independent of PR state).
  • Hardening: passes the repo's supply-chain audit (credential-free checkout, token-URL pushes, step outputs, SHA256-pinned lychee); PR detection ignores cross-repository branches of the same name; the single-token trade-off is recorded in the workflow header.
  • Simplifications vs the otel.io original (refcache-refresh.yml): plain GITHUB_TOKEN instead of a bot app -- regular CI doesn't auto-run on the refresh PR (the link check that matters runs in this workflow, and merges are maintainer-gated); no browser double-check probe; merge-only branch sync.
  • Open items for the first live runs (dispatch-testable): whether cla/google accepts github-actions[bot] commits, and prune-count tuning.

chalin added 5 commits August 31, 2026 20:24
Daily rotation: prune the N (default 75) oldest lychee-verified entries
of docsy.dev/link-cache.jsonc, rebuild, re-check, and open (or update)
the single refresh PR on the bot/link-cache-refresh branch. Manual
seeds are exempt from pruning (link-cache 0.4.1) and retire via their
expires dates. Ported from otel.io's refcache-refresh workflow,
simplified: no bot app (GITHUB_TOKEN; regular CI doesn't auto-run on
the PR -- the link check that matters runs here), no double-check
probe, merge-only branch sync. Dead links don't fail the run: the
merge-back records them and the PR is the triage surface; preflight
failures (exit 2) fail hard. An empty refresh after pruning fails the
run (sanity assertion).
- Supply-chain audit compliance: credential-free checkout with
  per-command token-URL pushes (explicit-lease force for the reset
  path); inter-step state via step outputs instead of GITHUB_ENV.
- PR detection filters isCrossRepository == false: a fork's same-named
  branch could otherwise hijack the lookup and strand refresh commits.
- lychee tarball SHA256-pinned; the single-token decision (write-capable
  token visible to the checker) is recorded in the header.
- Empty-refresh assertion moved to the commit step, so it fires
  regardless of PR state and PR-create failures report as themselves.
- An existing PR's body is refreshed each run (oldest-entry marker,
  dead-link warning added or cleared); wording aligned with the
  manual-entry prune exemption.
…ling merges

- Pushes go to the origin remote with a command-scoped auth header
  (base64 token), so tracking refs update: URL-form pushes left
  origin/BRANCH unresolvable, which broke the push predicate and made
  gh pr create abort noninteractively -- new rotations could never open
  their PR. pr create also pins --base/--head. The job-wide
  token-bearing env is gone (auth lives only in the two pushing steps).
- Build is its own fail-hard step: check:links chains build && lychee,
  so a Hugo failure exited 1 and read as dead links, committing pruned
  entries without re-verification.
- Cache-only merge conflicts self-heal (take main's version; the run's
  own check refreshes it) instead of wedging every subsequent run;
  wider conflicts fail for a human.
- PR queries add --base main and take one URL; oldest-entry extraction
  fails hard on empty output; backticks stripped from cache-derived
  text before it enters the PR body's Markdown.
…default

- pipefail in the branch step: a transient gh API failure exiting
  through head's 0 read as 'no open PR' and took the destructive
  reset path against a healthy PR branch.
- The cache-only self-heal now signals the prune step (self_healed
  output): taking main's whole cache voids the branch's pending
  refresh -- restored entries keep timestamps lychee trusts within
  max_cache_age -- so the cycle re-prunes instead of stalling the PR
  at an empty diff under a header that claimed otherwise. Comments
  rewritten to match reality.
- refresh_count default DRYed with a YAML anchor (the otel.io
  pattern) + shell fallback; PR-body wording made rotation-generic so
  body refreshes don't overwrite a dispatch-set count claim.
- maintainer-notes: one-line pointer to the rotation workflow.
…e, honest gates

- pipefail added to the PR-create step (the branch step documented the
  invariant; a transient gh failure there misrouted to a duplicate
  create).
- A --help probe precedes the tolerated-exit link check: a renamed
  _check:links script exits 1 via npm, indistinguishable from dead
  links -- the probe fails such drift outside the exit interpretation.
- Empty-refresh gate comments now claim exactly what it catches
  (prune-no-op; 'pruned but unverified' is the checker's exit-2 duty);
  header notes gone URLs are retired, not re-verified; PR-body
  oldest-entry marker labels its manual-seed caveat.
@chalin
chalin marked this pull request as ready for review September 1, 2026 03:03
…install cross-pointers

- Workflow header rewritten to purpose + PR model (was restating the
  self-heal, no-op-gate, auth, and checksum mechanics that live as
  richer step comments; also carried a dangling 'exit 2 above' and two
  em dashes). Owning tool (link-cache npm package) named.
- Literal em dashes removed (comma/colon per the construct).
- lychee installs cross-pointed between test.yaml and this workflow,
  with the checksum divergence justified where it occurs (this job
  holds a write-capable token); maintainer-notes pointer names both
  installers; PR body links the workflow file.
@chalin
chalin merged commit a694aac into docsy:main Sep 1, 2026
18 checks passed
@chalin
chalin deleted the chalin-m24-link-cache-refresh-2026-0831 branch September 1, 2026 06:58
chalin added a commit to chalin/docsy that referenced this pull request Sep 4, 2026
The four queued 0.18 lines (docsy#2780, docsy#2787, docsy#2788, docsy#2790) stay queued for a
CL-touching PR of their own; the release-prep coverage ledger keeps them as
todo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant