Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Accelerate release convergence on PVE

rcourtman9ef94418e8c7
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index 55a6872524..186f270fb0 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -1334,9 +1334,8 @@ jobs:
needs:
- prepare
- create_release
- - release_readiness
- stage_private_pro_runtime
- if: ${{ always() && needs.prepare.result == 'success' && needs.create_release.result == 'success' && needs.release_readiness.result == 'success' && ( !startsWith(needs.prepare.outputs.version, '6.') || needs.stage_private_pro_runtime.result == 'success' ) }}
+ if: ${{ always() && needs.prepare.result == 'success' && needs.create_release.result == 'success' && needs.prepare.outputs.historical_asset_backfill_only != 'true' && github.event.inputs.draft_only != 'true' && ( !startsWith(needs.prepare.outputs.version, '6.') || needs.stage_private_pro_runtime.result == 'success' ) }}
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
diff --git a/.github/workflows/release-convergence.yml b/.github/workflows/release-convergence.yml
index 09f402953e..410eebd041 100644
--- a/.github/workflows/release-convergence.yml
+++ b/.github/workflows/release-convergence.yml
@@ -118,6 +118,20 @@ jobs:
exit 0
fi
rm -f "${marker}"
+ source_state="$(
+ gh run view "${EXPECTED_SOURCE_RUN_ID}" \
+ --repo "${{ github.repository }}" \
+ --json status,conclusion,url \
+ --jq '[.status, (.conclusion // ""), .url] | @tsv' \
+ 2>/dev/null || true
+ )"
+ source_status="$(awk -F '\t' '{print $1}' <<<"${source_state}")"
+ source_conclusion="$(awk -F '\t' '{print $2}' <<<"${source_state}")"
+ source_url="$(awk -F '\t' '{print $3}' <<<"${source_state}")"
+ if [ "${source_status}" = "completed" ]; then
+ echo "::error::Source release run completed without the exact activation marker: conclusion=${source_conclusion:-none} ${source_url}."
+ exit 1
+ fi
echo "Activation marker for ${TAG} is not committed yet (${attempt}/${max_attempts})."
sleep 2
done
diff --git a/docs/release-control/v6/internal/records/api-runtime-decomposition-2026-08-21.md b/docs/release-control/v6/internal/records/api-runtime-decomposition-2026-08-21.md
index cdee194c55..6f6fdc1a40 100644
--- a/docs/release-control/v6/internal/records/api-runtime-decomposition-2026-08-21.md
+++ b/docs/release-control/v6/internal/records/api-runtime-decomposition-2026-08-21.md
@@ -236,3 +236,52 @@ Preserved local evidence files and checksums:
After the measurements, the worker had no matching release-backend, API race,
or Docker build process. The temporary remote files and logs were preserved.
+
+## Exact RC.6 Release Timing
+
+Release run [`32514803052`](https://github.com/rcourtman/Pulse/actions/runs/32514803052)
+published and converged exact source commit
+`779f9a10bc342fcbe66ee1b26493f1fa10355a06` as `v6.3.0-rc.6`.
+The release remained a draft until every immutable gate passed, and the public
+activation marker binds the tag, release id, source run, convergence run, and
+private R2 prefix.
+
+| Boundary from `18:43:31Z` dispatch | UTC | Elapsed | Result |
+| --- | --- | ---: | --- |
+| Exact-SHA public compilation complete | `18:47:07Z` | 3:36 | pass |
+| Private Pro child complete | `18:52:37Z` | 9:06 | pass |
+| GitHub release published | `18:57:14Z` | 13:43 | pass |
+| Source activation workflow complete | `18:57:32Z` | 14:01 | pass |
+| Customer convergence verdict | `18:59:14Z` | 15:43 | pass |
+| Promotion lease cleanup / convergence workflow complete | `18:59:27Z` | 15:56 | pass |
+
+Publication met the 15-minute objective, but definitive customer convergence
+missed it by 43 seconds. The acceleration objective therefore remained open.
+The exact backend log started with 14,858 MiB available and no admission wait.
+Its two 1,813-test shards began together at `18:45:19Z`, passed at
+`18:50:28Z` and `18:56:47Z`, and completed the backend gate at `18:56:48Z`.
+The 5:08 versus 11:27 split proves that equal test counts are not an adequate
+cost model for this ordered package.
+
+An unchanged exact-SHA three-equal-shard calibration passed every race test
+but still took 706.36 seconds because the final third retained the long tail.
+Deterministic contiguous bisection then established that tests 1,814–2,720
+take 69 seconds, 2,721–3,173 take 49 seconds, 3,174–3,400 take 9 seconds, and
+3,401–3,513 take 12 seconds when isolated. The remaining cost is the repeated
+integration-server setup in the final 113 tests. The canonical three-shard
+plan therefore keeps the 3,595-test fast prefix in one compressed expression
+and divides the last 31 integration tests at named, fail-closed boundaries.
+
+The two isolated hot-tail boundary proofs passed in 189 and 290 seconds. The
+final canonical PVE qualification then exercised the patched auto-selected
+release command against the unchanged RC.6 source with all 3,626 API tests and
+all 155 non-API packages. Admission selected three shards from eight vCPUs at
+16,399 MiB available, recorded exact shard sizes of 3,595, 15, and 16 in the
+manifest, and kept every shard in one compressed test-binary invocation. The
+three shards passed in 591, 320, and 434 seconds respectively, and the complete
+race-enabled backend gate passed in 639.57 seconds. This is a conservative
+full-worker result: the package graph and API shards ran concurrently, rather
+than timing the API partitions in isolation. Together with early inert
+convergence dispatch, it removes more than the 43-second RC.6 convergence miss
+without weakening exact-SHA, signing, integrity, installer-smoke, publication,
+or convergence requirements.
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index bd34e6d8ee..f46202bdac 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -9651,8 +9651,8 @@
"summary": "Reduce warm RC dispatch-to-convergence time to 15 minutes with credential-isolated PVE runners, deterministic sharding, and cross-repo build parallelism.",
"target_id": "v6-product-lane-expansion",
"claimed_at": "2026-08-21T11:23:13Z",
- "heartbeat_at": "2026-08-21T11:23:13Z",
- "expires_at": "2026-08-21T19:23:13Z",
+ "heartbeat_at": "2026-08-21T19:14:24Z",
+ "expires_at": "2026-08-21T21:14:24Z",
"work_item": {
"kind": "lane",
"id": "L1"
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index c7412e86a1..bd87825524 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -642,8 +642,8 @@ upgrade, update, release, or artifact-selection behavior.
per-argument limit. A shard may split only at deterministic contiguous
batch boundaries when its compressed exact-name regex exceeds the configured
ceiling. Tests at those boundaries must initialize their own package-global
- prerequisites rather than inheriting state from a prior process. Two API
- shards and the remaining Go packages may then
+ prerequisites rather than inheriting state from a prior process. On the
+ dedicated 8-vCPU release worker, three API shards and the remaining Go packages may then
execute concurrently with isolated data directories. A failed shard must
fail the complete backend gate and terminate every descendant test process;
sharding must never select a coverage subset or leave orphan race binaries
@@ -651,15 +651,30 @@ upgrade, update, release, or artifact-selection behavior.
decision from the transient memory peak created by sibling credential-free
release compilers. On an 8-vCPU worker it may wait up to 120 seconds for
those bounded compile processes to exit, but it must then require measured
- headroom for two race binaries plus the concurrent package graph and fail
+ 16 GiB of available guest memory for three race binaries plus the concurrent
+ package graph and fail
immediately with a capacity diagnosis when that admission floor is still
- unavailable. The backend job owns a 20-minute ceiling, while each
+ unavailable. The exact RC.6 graph uses measured named boundaries: the fast
+ prefix ends at
+ `TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback`, and
+ the repeated integration-server tail is divided after
+ `TestServerInfoEndpointMethodNotAllowed`. The planner fails closed if those
+ anchors disappear or reorder, and the manifest records them while
+ continuing to prove exact ordered, complete, disjoint coverage. The backend
+ job owns a 20-minute ceiling, while each
invocation retains the canonical 30-minute Go timeout as protection against
a stuck package.
The warm-path release-control performance objective is 15 minutes or less
from dispatch to definitive publication/convergence. This objective is an
optimization target, not permission to weaken exact-SHA qualification,
signing, artifact integrity, installer smoke, or convergence proof.
+ Customer convergence should be dispatched as soon as the immutable draft
+ and applicable private packet are staged, so its credential-free activation
+ waiter can absorb hosted-runner startup while the readiness join finishes.
+ That early run remains inert until it verifies the exact public activation
+ marker; if the exact source release run terminates without that marker, the
+ waiter must fail promptly without acquiring the promotion lease or mutating
+ a customer surface.
The rehearsal diagnostic spec is opt-in by design, so both the hosted
rehearsal and its worker profile must set `PULSE_E2E_DIAGNOSTIC=1`; invoking
that spec while leaving it skipped is not browser proof.
@@ -1659,7 +1674,7 @@ after qualification. Post-publication Helm and paid-runtime convergence likewise
consume source-run artifacts and retain exact-SHA, installer, signature,
public/private artifact, and definitive convergence proof.
For `v6.3.0-rc.6`, the release path retains credential-free PVE compilation
-while requiring the measured memory floor for two API race shards after a
+while requiring the measured memory floor for API race shards after a
bounded admission wait. Production chart and resource-query services move
their complete handler, cache, tenant-store, and high-scale query suites out of
the residual root package so the Go scheduler can overlap real domains rather
@@ -1682,9 +1697,9 @@ Release run `32497250921` then proved that naïve byte-bounded alternation was
not semantically sufficient: its third fresh test-binary process reached
`TestEstablishSession` without the package-global session store historically
initialized earlier in the ordered suite. Prefix compression reduces the exact
-3,736-test expression from 182,429 bytes to 110,384 bytes, so the one-shard
-fallback needs only two bounded processes at the default 65,536-byte ceiling
-instead of three naïve alternation batches. The two session-establishment tests
+3,736-test expression from 182,429 bytes to 110,384 bytes, so the release
+planner can keep the measured fast prefix in one process at the 120,000-byte
+ceiling instead of fragmenting it into naïve alternation batches. The two session-establishment tests
now initialize their own persistent session store, removing the boundary-order
dependency instead of relying on a larger process. The planner still records
the complete test-name digest, proves each compressed expression is an exact
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 009135aa8d..96700b86b1 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -2469,11 +2469,22 @@ func TestReleasePipelinePromotesOneImmutableCandidate(t *testing.T) {
t.Fatalf("immutable readiness must exclude mutable customer state: %s", forbiddenDependency)
}
}
- for _, dependency := range []string{"- release_readiness", "- stage_private_pro_runtime"} {
+ for _, dependency := range []string{"- create_release", "- stage_private_pro_runtime"} {
if !strings.Contains(dispatchJob, dependency) {
t.Fatalf("durable convergence dispatch missing staged dependency: %s", dependency)
}
}
+ if strings.Contains(dispatchJob, "- release_readiness") {
+ t.Fatal("durable convergence dispatch must prewarm before the readiness join")
+ }
+ if !strings.Contains(dispatchJob, "github.event.inputs.draft_only != 'true'") ||
+ !strings.Contains(dispatchJob, "historical_asset_backfill_only != 'true'") {
+ t.Fatal("early convergence dispatch must remain disabled for inert release modes")
+ }
+ if !strings.Contains(convergenceWorkflow, `gh run view "${EXPECTED_SOURCE_RUN_ID}"`) ||
+ !strings.Contains(convergenceWorkflow, "completed without the exact activation marker") {
+ t.Fatal("prewarmed convergence must terminate when its source run ends without activation")
+ }
if !strings.Contains(activationJob, "- dispatch_release_convergence") {
t.Fatal("release activation must depend on the exact durable convergence dispatch")
}
@@ -2783,9 +2794,11 @@ func TestReleaseBackendRaceGateUsesCompletePVEPartition(t *testing.T) {
"python3 scripts/shard_go_tests.py",
`--max-regex-bytes "$MAX_REGEX_BYTES"`,
`MEMORY_WAIT_SECONDS="${PULSE_BACKEND_TEST_MEMORY_WAIT_SECONDS:-120}"`,
- `memory_reserve_kib=$((4 * 1024 * 1024))`,
- `memory_per_api_shard_kib=$((5 * 1024 * 1024))`,
- "two-shard backend admission requires",
+ `required_kib=$((16 * 1024 * 1024))`,
+ "backend shard admission requires",
+ "--shard-boundaries",
+ "TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback",
+ "TestServerInfoEndpointMethodNotAllowed",
"go test -race -timeout 30m",
`-test.timeout 30m`,
} {
diff --git a/scripts/installtests/install_docker_sh_test.go b/scripts/installtests/install_docker_sh_test.go
index 3ca28c6a10..7e21ceb498 100644
--- a/scripts/installtests/install_docker_sh_test.go
+++ b/scripts/installtests/install_docker_sh_test.go
@@ -366,7 +366,7 @@ func TestInstallDockerProofTracksPrereleaseContract(t *testing.T) {
)
if version == "6.3.0-rc.6" {
assertFileContainsAllNormalized(t, repoFile("docs", "release-control", "v6", "internal", "subsystems", "deployment-installability.md"),
- "For `v6.3.0-rc.6`, the release path retains credential-free PVE compilation while requiring the measured memory floor for two API race shards after a bounded admission wait.",
+ "For `v6.3.0-rc.6`, the release path retains credential-free PVE compilation while requiring the measured memory floor for API race shards after a bounded admission wait.",
"Public server and provider control-plane image publication uses independent matrix jobs that each revalidate the exact checkout and candidate manifest.",
"Private packaging transfers only the products consumed by Pro assembly, and paid-runtime Docker and direct-binary mismatch proofs execute concurrently without weakening either proof.",
)
diff --git a/scripts/release_control/internal/release_preflight_test.py b/scripts/release_control/internal/release_preflight_test.py
index 22d47254b2..bfbb34594c 100755
--- a/scripts/release_control/internal/release_preflight_test.py
+++ b/scripts/release_control/internal/release_preflight_test.py
@@ -152,6 +152,68 @@ class ReleasePreflightTest(unittest.TestCase):
build_plan(["TestOnly"], 2, 10)
with self.assertRaisesRegex(ValueError, "safe per-argument ceiling"):
build_plan(["TestOnly"], 1, 10, max_regex_bytes=120_001)
+ with self.assertRaisesRegex(ValueError, "one value per shard"):
+ build_plan(["TestOne", "TestTwo"], 2, 10, shard_weights=[1])
+ with self.assertRaisesRegex(ValueError, "positive integers"):
+ build_plan(["TestOne", "TestTwo"], 2, 10, shard_weights=[1, 0])
+ with self.assertRaisesRegex(ValueError, "one fewer value"):
+ build_plan(
+ ["TestOne", "TestTwo"],
+ 2,
+ 10,
+ shard_boundaries=["TestOne", "TestTwo"],
+ )
+ with self.assertRaisesRegex(ValueError, "unknown shard boundary"):
+ build_plan(
+ ["TestOne", "TestTwo"],
+ 2,
+ 10,
+ shard_boundaries=["TestMissing"],
+ )
+ with self.assertRaisesRegex(ValueError, "mutually exclusive"):
+ build_plan(
+ ["TestOne", "TestTwo"],
+ 2,
+ 10,
+ shard_weights=[1, 1],
+ shard_boundaries=["TestOne"],
+ )
+
+ def test_api_shard_plan_supports_measured_contiguous_weights(self) -> None:
+ test_names = [f"TestReleaseCase{index:04d}" for index in range(20)]
+ plan = build_plan(
+ test_names,
+ shard_count=3,
+ batch_size=100,
+ shard_weights=[6, 1, 1],
+ )
+
+ shards = [
+ [name for batch in shard["batches"] for name in batch]
+ for shard in plan["shards"]
+ ]
+ self.assertEqual([len(shard) for shard in shards], [15, 3, 2])
+ self.assertEqual([name for shard in shards for name in shard], test_names)
+ self.assertEqual(plan["shard_weights"], [6, 1, 1])
+
+ def test_api_shard_plan_supports_named_contiguous_boundaries(self) -> None:
+ test_names = [f"TestReleaseCase{index:04d}" for index in range(8)]
+ plan = build_plan(
+ test_names,
+ shard_count=3,
+ batch_size=100,
+ shard_boundaries=[test_names[3], test_names[5]],
+ )
+
+ shards = [
+ [name for batch in shard["batches"] for name in batch]
+ for shard in plan["shards"]
+ ]
+ self.assertEqual([len(shard) for shard in shards], [4, 2, 2])
+ self.assertEqual([name for shard in shards for name in shard], test_names)
+ self.assertEqual(
+ plan["shard_boundaries"], [test_names[3], test_names[5]]
+ )
def test_api_shard_plan_bounds_one_shard_regex_argument_bytes(self) -> None:
test_names = [
@@ -232,7 +294,13 @@ class ReleasePreflightTest(unittest.TestCase):
'MEMORY_WAIT_SECONDS="${PULSE_BACKEND_TEST_MEMORY_WAIT_SECONDS:-120}"',
backend,
)
- self.assertIn("two-shard backend admission requires", backend)
+ self.assertIn("backend shard admission requires", backend)
+ self.assertIn(
+ "TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback,"
+ "TestServerInfoEndpointMethodNotAllowed",
+ backend,
+ )
+ self.assertIn("Completed internal/api shard", backend)
self.assertIn("export GITHUB_ACTIONS=true", backend)
self.assertIn("export CI=true", backend)
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index b652c0b096..8a7ec9712d 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -376,7 +376,11 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("- release_readiness", activation)
self.assertIn("- dispatch_release_convergence", activation)
- self.assertIn("- release_readiness", dispatch)
+ self.assertNotIn("- release_readiness", dispatch)
+ self.assertIn("- create_release", dispatch)
+ self.assertIn("- stage_private_pro_runtime", dispatch)
+ self.assertIn("github.event.inputs.draft_only != 'true'", dispatch)
+ self.assertIn("needs.prepare.outputs.historical_asset_backfill_only != 'true'", dispatch)
self.assertIn("return_run_details: true", dispatch)
self.assertIn("release-convergence.yml/dispatches", dispatch)
self.assertIn("Customer convergence dispatch did not return an exact workflow run", dispatch)
@@ -704,6 +708,9 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn('max_attempts=10500', await_commit)
self.assertIn('sleep 2', await_commit)
self.assertIn("source_release_run_id", await_commit)
+ self.assertIn('gh run view "${EXPECTED_SOURCE_RUN_ID}"', await_commit)
+ self.assertIn('source_status}" = "completed"', await_commit)
+ self.assertIn("completed without the exact activation marker", await_commit)
self.assertIn("EXPECTED_CONVERGENCE_RUN_ID: ${{ github.run_id }}", await_commit)
self.assertIn('original_status}" != "completed"', await_commit)
self.assertIn("successor adoption is not yet allowed", await_commit)
diff --git a/scripts/run-release-backend-tests.sh b/scripts/run-release-backend-tests.sh
index bc00aa477c..d3fa4d324d 100755
--- a/scripts/run-release-backend-tests.sh
+++ b/scripts/run-release-backend-tests.sh
@@ -10,17 +10,19 @@ Options:
--api-shards VALUE auto or a positive integer (default: auto)
--batch-size VALUE Top-level tests per API test-binary invocation (default: 10000)
--max-regex-bytes VALUE
- Maximum encoded -test.run regex bytes (default: 65536)
+ Maximum encoded -test.run regex bytes (default: 120000)
--memory-wait-seconds VALUE
- Bounded wait for two-shard memory admission (default: 120)
+ Bounded wait for multi-shard memory admission (default: 120)
EOF
}
DATA_ROOT=""
API_SHARDS="${PULSE_BACKEND_TEST_SHARDS:-auto}"
BATCH_SIZE=10000
-MAX_REGEX_BYTES="${PULSE_BACKEND_TEST_MAX_REGEX_BYTES:-65536}"
+MAX_REGEX_BYTES="${PULSE_BACKEND_TEST_MAX_REGEX_BYTES:-120000}"
MEMORY_WAIT_SECONDS="${PULSE_BACKEND_TEST_MEMORY_WAIT_SECONDS:-120}"
+SHARD_WEIGHTS="${PULSE_BACKEND_TEST_SHARD_WEIGHTS:-}"
+SHARD_BOUNDARIES="${PULSE_BACKEND_TEST_SHARD_BOUNDARIES:-}"
while [ "$#" -gt 0 ]; do
case "$1" in
@@ -106,34 +108,39 @@ AVAILABLE_KIB="$(read_available_kib)"
if [ -z "$AVAILABLE_KIB" ]; then AVAILABLE_KIB=0; fi
if [ "$API_SHARDS" = auto ]; then
- cpu_shards=$((VCPUS / 4))
- if [ "$cpu_shards" -lt 1 ]; then cpu_shards=1; fi
- if [ "$cpu_shards" -gt 2 ]; then cpu_shards=2; fi
+ if [ "$VCPUS" -ge 8 ]; then
+ cpu_shards=3
+ elif [ "$VCPUS" -ge 4 ]; then
+ cpu_shards=2
+ else
+ cpu_shards=1
+ fi
# A release starts the public and private credential-free compilers beside
# this lane. Their short peak must not permanently collapse an otherwise
- # capable 8-vCPU/24-GiB worker to one 20-minute API shard. Wait only while
- # those useful jobs finish, then require measured headroom for both race
- # binaries plus the concurrent non-root package graph. If that headroom
- # never appears, fail at admission instead of discovering the capacity
- # problem at the job timeout.
+ # capable 8-vCPU worker to a long API shard. Wait only while those useful
+ # jobs finish, then require measured headroom for every race binary plus the
+ # concurrent non-root package graph. If that headroom never appears, fail at
+ # admission instead of discovering the capacity problem at the job timeout.
if [ "$cpu_shards" -gt 1 ]; then
- memory_reserve_kib=$((4 * 1024 * 1024))
- memory_per_api_shard_kib=$((5 * 1024 * 1024))
- required_kib=$((memory_reserve_kib + cpu_shards * memory_per_api_shard_kib))
+ if [ "$cpu_shards" -ge 3 ]; then
+ required_kib=$((16 * 1024 * 1024))
+ else
+ required_kib=$((14 * 1024 * 1024))
+ fi
waited_seconds=0
while [ "$AVAILABLE_KIB" -lt "$required_kib" ] && [ "$waited_seconds" -lt "$MEMORY_WAIT_SECONDS" ]; do
remaining_seconds=$((MEMORY_WAIT_SECONDS - waited_seconds))
wait_seconds=5
if [ "$remaining_seconds" -lt "$wait_seconds" ]; then wait_seconds="$remaining_seconds"; fi
- echo "Waiting ${wait_seconds}s for two-shard memory admission: $((AVAILABLE_KIB / 1024)) MiB available, $((required_kib / 1024)) MiB required."
+ echo "Waiting ${wait_seconds}s for backend shard admission: $((AVAILABLE_KIB / 1024)) MiB available, $((required_kib / 1024)) MiB required."
sleep "$wait_seconds"
waited_seconds=$((waited_seconds + wait_seconds))
AVAILABLE_KIB="$(read_available_kib)"
if [ -z "$AVAILABLE_KIB" ]; then AVAILABLE_KIB=0; fi
done
if [ "$AVAILABLE_KIB" -lt "$required_kib" ]; then
- echo "Error: two-shard backend admission requires $((required_kib / 1024)) MiB available after a ${MEMORY_WAIT_SECONDS}s bounded wait; found $((AVAILABLE_KIB / 1024)) MiB." >&2
+ echo "Error: backend shard admission requires $((required_kib / 1024)) MiB available after a ${MEMORY_WAIT_SECONDS}s bounded wait; found $((AVAILABLE_KIB / 1024)) MiB." >&2
exit 4
fi
fi
@@ -143,10 +150,23 @@ elif [[ ! "$API_SHARDS" =~ ^[1-9][0-9]*$ ]]; then
exit 2
fi
+if [ -n "$SHARD_WEIGHTS" ] && [ -n "$SHARD_BOUNDARIES" ]; then
+ echo "Error: configure shard weights or shard boundaries, not both." >&2
+ exit 2
+fi
+if [ -z "$SHARD_WEIGHTS" ] && [ -z "$SHARD_BOUNDARIES" ] && [ "$API_SHARDS" -eq 3 ]; then
+ # RC.6 exact-SHA bisection found the repeated integration-server cost in the
+ # final 31 tests. Keep the fast prefix together, then divide that hot tail
+ # across the remaining two processes at stable top-level test boundaries.
+ SHARD_BOUNDARIES="TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback,TestServerInfoEndpointMethodNotAllowed"
+fi
+
echo "Release backend test plan"
echo " vCPUs: $VCPUS"
echo " Available MiB: $((AVAILABLE_KIB / 1024))"
echo " API shards: $API_SHARDS"
+echo " Shard weights: ${SHARD_WEIGHTS:-none}"
+echo " Shard boundaries: ${SHARD_BOUNDARIES:-automatic}"
echo " Memory wait: ${MEMORY_WAIT_SECONDS}s max"
echo " Batch size: $BATCH_SIZE"
echo " Regex bytes: $MAX_REGEX_BYTES max"
@@ -160,12 +180,20 @@ go test -c -race -o "$API_BINARY" ./internal/api
"$API_BINARY" -test.list '^Test'
) | awk '/^Test[A-Za-z0-9_]+$/ { print }' > "$TEST_NAMES_FILE"
-python3 scripts/shard_go_tests.py \
- --tests-file "$TEST_NAMES_FILE" \
- --shards "$API_SHARDS" \
- --batch-size "$BATCH_SIZE" \
- --max-regex-bytes "$MAX_REGEX_BYTES" \
+plan_args=(
+ --tests-file "$TEST_NAMES_FILE"
+ --shards "$API_SHARDS"
+ --batch-size "$BATCH_SIZE"
+ --max-regex-bytes "$MAX_REGEX_BYTES"
--output-dir "$PLAN_DIR"
+)
+if [ -n "$SHARD_WEIGHTS" ]; then
+ plan_args+=(--shard-weights "$SHARD_WEIGHTS")
+fi
+if [ -n "$SHARD_BOUNDARIES" ]; then
+ plan_args+=(--shard-boundaries "$SHARD_BOUNDARIES")
+fi
+python3 scripts/shard_go_tests.py "${plan_args[@]}"
API_IMPORT_PATH="$(go list -f '{{.ImportPath}}' ./internal/api)"
mapfile -t OTHER_PACKAGES < <(
@@ -187,6 +215,7 @@ run_api_shard() {
local shard_index="$1"
local shard_dir="$RUN_ROOT/data/api-shard-$shard_index"
local regex_file regex batch_index=0
+ local shard_started_seconds="$SECONDS"
mkdir -p "$shard_dir"
shopt -s nullglob
local regex_files=("$PLAN_DIR"/shard-"$shard_index"-batch-*.regex)
@@ -207,6 +236,7 @@ run_api_shard() {
"$API_BINARY" -test.run "$regex" -test.timeout 30m
)
done
+ echo "Completed internal/api shard $shard_index in $((SECONDS - shard_started_seconds))s."
}
pids=()
diff --git a/scripts/shard_go_tests.py b/scripts/shard_go_tests.py
index dd8d3338c8..c874dd227c 100755
--- a/scripts/shard_go_tests.py
+++ b/scripts/shard_go_tests.py
@@ -102,6 +102,8 @@ def build_plan(
shard_count: int,
batch_size: int,
max_regex_bytes: int = DEFAULT_MAX_REGEX_BYTES,
+ shard_weights: Sequence[int] | None = None,
+ shard_boundaries: Sequence[str] | None = None,
) -> dict[str, object]:
if shard_count < 1:
raise ValueError("shard_count must be at least 1")
@@ -119,6 +121,23 @@ def build_plan(
if shard_count > len(test_names):
raise ValueError("shard_count cannot exceed the number of top-level tests")
+ weights = list(shard_weights) if shard_weights is not None else None
+ boundaries_by_name = (
+ list(shard_boundaries) if shard_boundaries is not None else None
+ )
+ if weights is not None and boundaries_by_name is not None:
+ raise ValueError("shard weights and shard boundaries are mutually exclusive")
+ if weights is not None:
+ if len(weights) != shard_count:
+ raise ValueError("shard weights must contain one value per shard")
+ if any(
+ isinstance(weight, bool) or not isinstance(weight, int) or weight < 1
+ for weight in weights
+ ):
+ raise ValueError("shard weights must be positive integers")
+ if boundaries_by_name is not None and len(boundaries_by_name) != shard_count - 1:
+ raise ValueError("shard boundaries must contain one fewer value than shards")
+
invalid = sorted({name for name in test_names if not TEST_NAME_PATTERN.fullmatch(name)})
if invalid:
raise ValueError(f"invalid top-level Go test name(s): {', '.join(invalid)}")
@@ -133,11 +152,39 @@ def build_plan(
# legacy API tests still exercise package-global state, so sorting, hash
# distribution, or extra process boundaries can change their historical
# neighbours.
- base_size, remainder = divmod(len(canonical), shard_count)
shards: list[list[str]] = []
+ if boundaries_by_name is not None:
+ unknown = [name for name in boundaries_by_name if name not in canonical]
+ if unknown:
+ raise ValueError(f"unknown shard boundary test(s): {', '.join(unknown)}")
+ boundaries = [canonical.index(name) + 1 for name in boundaries_by_name]
+ if boundaries != sorted(set(boundaries)):
+ raise ValueError("shard boundaries must follow compiled test order")
+ points = [0, *boundaries, len(canonical)]
+ sizes = [end - start for start, end in zip(points, points[1:])]
+ elif weights is None:
+ base_size, remainder = divmod(len(canonical), shard_count)
+ sizes = [
+ base_size + (1 if shard_index < remainder else 0)
+ for shard_index in range(shard_count)
+ ]
+ else:
+ total_weight = sum(weights)
+ boundaries: list[int] = []
+ cumulative_weight = 0
+ for shard_index, weight in enumerate(weights[:-1], start=1):
+ cumulative_weight += weight
+ boundary = (
+ len(canonical) * cumulative_weight + total_weight // 2
+ ) // total_weight
+ minimum = shard_index
+ maximum = len(canonical) - (shard_count - shard_index)
+ boundaries.append(max(minimum, min(boundary, maximum)))
+ points = [0, *boundaries, len(canonical)]
+ sizes = [end - start for start, end in zip(points, points[1:])]
+
offset = 0
- for shard_index in range(shard_count):
- size = base_size + (1 if shard_index < remainder else 0)
+ for size in sizes:
shards.append(canonical[offset : offset + size])
offset += size
@@ -168,7 +215,7 @@ def build_plan(
if assigned != canonical or len(assigned) != len(set(assigned)):
raise RuntimeError("generated shard plan is not a complete, disjoint partition")
- return {
+ plan: dict[str, object] = {
"schema_version": 1,
"test_count": len(canonical),
"test_names_sha256": _digest(canonical),
@@ -177,6 +224,11 @@ def build_plan(
"max_regex_bytes": max_regex_bytes,
"shards": shard_records,
}
+ if weights is not None:
+ plan["shard_weights"] = weights
+ if boundaries_by_name is not None:
+ plan["shard_boundaries"] = boundaries_by_name
+ return plan
def write_plan(plan: dict[str, object], output_dir: Path) -> Path:
@@ -216,6 +268,14 @@ def main() -> int:
parser.add_argument(
"--max-regex-bytes", type=int, default=DEFAULT_MAX_REGEX_BYTES
)
+ parser.add_argument(
+ "--shard-weights",
+ help="comma-separated positive integer weights for contiguous shard sizes",
+ )
+ parser.add_argument(
+ "--shard-boundaries",
+ help="comma-separated test names that end each contiguous shard except the last",
+ )
parser.add_argument("--output-dir", type=Path, required=True)
args = parser.parse_args()
@@ -224,8 +284,26 @@ def main() -> int:
for line in args.tests_file.read_text().splitlines()
if line.strip()
]
+ shard_weights = None
+ if args.shard_weights:
+ try:
+ shard_weights = [
+ int(value.strip()) for value in args.shard_weights.split(",")
+ ]
+ except ValueError as error:
+ parser.error(f"invalid --shard-weights: {error}")
+ shard_boundaries = None
+ if args.shard_boundaries:
+ shard_boundaries = [
+ value.strip() for value in args.shard_boundaries.split(",")
+ ]
plan = build_plan(
- test_names, args.shards, args.batch_size, args.max_regex_bytes
+ test_names,
+ args.shards,
+ args.batch_size,
+ args.max_regex_bytes,
+ shard_weights,
+ shard_boundaries,
)
manifest_path = write_plan(plan, args.output_dir)
print(manifest_path.read_text(), end="")