Skip to content

Commit 0721dd6

Browse files
authored
v0.9.34: oauth reconnect conflicts, sandbox host drain, token sealing backfill, migrate guards
2 parents 6154482 + 4af6c5e commit 0721dd6

99 files changed

Lines changed: 7699 additions & 2470 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ jobs:
657657
permissions:
658658
contents: read
659659
actions: read
660+
checks: read
660661
steps:
661662
- name: Checkout code
662663
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
@@ -666,27 +667,31 @@ jobs:
666667
with:
667668
bun-version: 1.4.4
668669

669-
# Diff from the head of the last earlier run whose submission succeeded, not the previous
670+
# Diff from the last earlier main commit whose `indexnow` check succeeded, not the previous
670671
# push: a push that never deployed, or whose submission failed, would otherwise drop its
671-
# changed URLs for good. Falls back to the previous push when no such run is in view. The
672-
# diff needs only the two trees, so that one commit is fetched alone; an all-zero `before`
673-
# (the branch's first push) has no base, which the script skips.
672+
# changed URLs for good. The check-runs lookup asks for this one check per commit, so it
673+
# stays small and counts every attempt of a re-run; a lookup that errors counts as no
674+
# success. With no success in view, the base is the oldest run in view, so URLs that no
675+
# submission ever covered are sent now. The diff needs only the two trees, so that one
676+
# commit is fetched alone; an all-zero `before` (the branch's first push) has no base,
677+
# which the script skips.
674678
- name: Submit changed URLs to IndexNow
675679
env:
676680
GH_TOKEN: ${{ github.token }}
677681
PUSH_BEFORE: ${{ github.event.before }}
678682
run: |
679683
BASE_SHA=""
680-
while read -r run_id head_sha; do
681-
conclusion="$(gh api --paginate "repos/$GITHUB_REPOSITORY/actions/runs/$run_id/jobs?per_page=100" \
682-
--jq '.jobs[] | select(.name == "indexnow") | .conclusion')"
683-
if [[ "$conclusion" == "success" ]]; then
684+
OLDEST_SHA=""
685+
while read -r head_sha; do
686+
OLDEST_SHA="$head_sha"
687+
if succeeded="$(gh api "repos/$GITHUB_REPOSITORY/commits/$head_sha/check-runs?check_name=indexnow&filter=all" \
688+
--jq '[.check_runs[] | select(.conclusion == "success")] | length')" && [[ "$succeeded" -gt 0 ]]; then
684689
BASE_SHA="$head_sha"
685690
break
686691
fi
687692
done < <(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs?branch=main&event=push&per_page=30" \
688-
--jq ".workflow_runs[] | select(.id < $GITHUB_RUN_ID) | \"\\(.id) \\(.head_sha)\"")
689-
BASE_SHA="${BASE_SHA:-$PUSH_BEFORE}"
693+
--jq ".workflow_runs[] | select(.id < $GITHUB_RUN_ID) | .head_sha")
694+
BASE_SHA="${BASE_SHA:-${OLDEST_SHA:-$PUSH_BEFORE}}"
690695
echo "Submitting URLs changed in $BASE_SHA..$GITHUB_SHA"
691696
if [[ ! "$BASE_SHA" =~ ^0+$ ]]; then
692697
git fetch --no-tags --depth=1 origin "$BASE_SHA"

‎.github/workflows/migrate.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,41 @@ jobs:
3838
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
3939
# Bulk projection loads and concurrent index builds can outlast ordinary schema changes.
4040
timeout-minutes: 300
41+
# One migrate job per environment at a time, so a manual dispatch queues
42+
# behind a CI run instead of racing it for migrate.ts's advisory lock, which
43+
# gives up after 30 minutes. Job-level because a called workflow evaluates
44+
# workflow-level concurrency with the caller's github context; the group
45+
# must also never equal ci.yml's ci-<ref> group or the two deadlock.
46+
concurrency:
47+
group: migrate-${{ inputs.environment }}
48+
cancel-in-progress: false
4149

4250
steps:
51+
# An environment only migrates from its own branch, so a manual dispatch
52+
# from a feature branch cannot apply that branch's migrations to a shared
53+
# database. Under workflow_call github.ref is the caller's ref (ci.yml's
54+
# push to main/staging/dev). This fails rather than skips: ci.yml's
55+
# promote gates on migrate succeeding, and a skipped run must never read
56+
# as a migration that happened. It runs before any secret is read.
57+
- name: Require the environment's own branch
58+
env:
59+
ENVIRONMENT: ${{ inputs.environment }}
60+
REF: ${{ github.ref }}
61+
run: |
62+
case "${ENVIRONMENT}" in
63+
production) expected=refs/heads/main ;;
64+
staging) expected=refs/heads/staging ;;
65+
dev) expected=refs/heads/dev ;;
66+
*)
67+
echo "::error::Unknown migrate environment '${ENVIRONMENT}'"
68+
exit 1
69+
;;
70+
esac
71+
if [ "${REF}" != "${expected}" ]; then
72+
echo "::error::Refusing to migrate ${ENVIRONMENT} from ${REF}; ${ENVIRONMENT} migrates only from ${expected}"
73+
exit 1
74+
fi
75+
4376
- name: Checkout code
4477
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
4578
with:

0 commit comments

Comments
 (0)