Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.
Rust ai-agentsai-gatewayclaude-codecodexcoding-agentcost-optimizationdeepseekllm-gatewayllm-routerlocal-firstmodel-routingrusttask-routingtauri
ci: shard hosted backend tests on CNCF runners (#3)
澄潭5d756c5b96df
diff --git a/.github/workflows/gateway-core.yml b/.github/workflows/gateway-core.ymlindex 06ee0315..255fc997 100644--- a/.github/workflows/gateway-core.yml+++ b/.github/workflows/gateway-core.yml@@ -9,6 +9,7 @@ permissions:contents: readenv:PYTHONDONTWRITEBYTECODE: '1'+ CARGO_INCREMENTAL: '0'jobs:selection:runs-on: ubuntu-latest@@ -16,6 +17,7 @@ jobs:rust: ${{ steps.plan.outputs.rust }}frontend: ${{ steps.plan.outputs.frontend }}native_required: ${{ steps.plan.outputs.native_required }}+ backend_matrix: ${{ steps.shards.outputs.matrix }}steps:- uses: actions/checkout@v4with:@@ -29,7 +31,13 @@ jobs:run: |args=(--full)if [[ -n "$BASE_SHA" ]]; then args=(--base "$BASE_SHA"); fi- python3 scripts/test-plan.py "${args[@]}" --github-output+ python3 scripts/test-plan.py "${args[@]}" --github-output | tee "$RUNNER_TEMP/test-plan.json"+ - id: shards+ name: Validate and select backend shards+ run: |+ python3 scripts/test-ci-shards.py+ python3 scripts/ci-shards.py check+ python3 scripts/ci-shards.py matrix --plan "$RUNNER_TEMP/test-plan.json" --github-output- if: steps.plan.outputs.native_required == 'true'run: echo 'Native Desktop changed. Hosted backend/frontend checks do not replace macOS platform validation.' >> "$GITHUB_STEP_SUMMARY"- name: Selected tooling checks when no backend job is needed@@ -46,12 +54,16 @@ jobs:name: tooling-${{ github.run_id }}-${{ github.run_attempt }}path: artifacts/ciif-no-files-found: ignore- backend:+ backend_shard:+ name: backend-shard (${{ matrix.shard }})needs: selectionif: needs.selection.outputs.rust == 'true'+ strategy:+ fail-fast: false+ matrix: ${{ fromJSON(needs.selection.outputs.backend_matrix) }}runs-on:- group: Default Larger Runners- labels: ubuntu-latest-8-cores+ group: Default+ labels: cncf-ubuntu-16-64-x86timeout-minutes: 90steps:- uses: actions/checkout@v4@@ -60,8 +72,10 @@ jobs:fetch-depth: 0- uses: ./.github/actions/ci-setup- name: CI adapter tests+ if: matrix.shard == 'quality' || matrix.shard == 'affected'run: python3 scripts/test-ci-run.py && python3 scripts/test-rust-file-size.py- name: Rust size boundary+ if: matrix.shard == 'quality' || matrix.shard == 'affected'env:STRUCTURE_BASE: ${{ github.event.pull_request.base.sha || github.event.before }}run: |@@ -72,19 +86,37 @@ jobs:args=(--base HEAD^)fipython3 scripts/ci-run.py --name structure -- bash scripts/check-rust-file-size.sh "${args[@]}"- - name: Selected Rust checks (full short set on main)+ - name: Selected backend shardenv:BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- args=(--full)- if [[ -n "$BASE_SHA" ]]; then args=(--base "$BASE_SHA"); fi- python3 scripts/test-plan.py "${args[@]}" --run-ci+ scope=(--full)+ if [[ -n "$BASE_SHA" ]]; then scope=(--base "$BASE_SHA"); fi+ python3 scripts/ci-shards.py run --shard '${{ matrix.shard }}' "${scope[@]}"- uses: actions/upload-artifact@v4if: always()with:- name: backend-${{ github.run_id }}-${{ github.run_attempt }}+ name: backend-${{ matrix.shard }}-${{ github.run_id }}-${{ github.run_attempt }}path: artifacts/ciif-no-files-found: warn+ backend:+ needs: [selection, backend_shard]+ if: always()+ runs-on: ubuntu-latest+ timeout-minutes: 5+ steps:+ - name: Require every selected backend shard+ env:+ SELECTION_RESULT: ${{ needs.selection.result }}+ RUST_SELECTED: ${{ needs.selection.outputs.rust }}+ SHARD_RESULT: ${{ needs.backend_shard.result }}+ run: |+ test "$SELECTION_RESULT" = success+ if [[ "$RUST_SELECTED" == true ]]; then+ test "$SHARD_RESULT" = success+ else+ test "$SHARD_RESULT" = skipped+ fifrontend:needs: selectionif: needs.selection.outputs.frontend == 'true'diff --git a/docs/github-actions-validation.md b/docs/github-actions-validation.mdindex dfbfd1cf..afbd8e67 100644--- a/docs/github-actions-validation.md+++ b/docs/github-actions-validation.md@@ -6,22 +6,38 @@ GitHub Actions runs on the checked-out commit through `scripts/ci-run.py`.| File | Execution | Scope || --- | --- | --- |-| `gateway-core.yml` | PR, main push, manual, reusable | Affected PR scope or full main Linux backend formatting, size boundary, clippy, tests, E2E contract; separate frontend build/tests and model-data generator checks |+| `gateway-core.yml` | PR, main push, manual, reusable | Affected PR scope or full main Linux backend formatting, size boundary, clippy, tests, E2E contract; full plans use coverage-checked parallel shards; separate frontend build/tests and model-data generator checks || `p0-gateway-gates.yml` | Manual, reusable | Linux listener build, neutral loopback, H1/H2 lifecycle, replay/privacy tests, contract checks, benchmark harness smoke || `gateway-core-dedicated.yml` | Manual or reusable | Hosted Linux production stability and socket churn || `p0-gateway-final-gates.yml` | Manual | Aggregate the three current hosted workflows |-Rust jobs select `Default Larger Runners`: `ubuntu-latest-8-cores` for normal-checks and `ubuntu-latest-16-cores` for stability. The organization must permit-the repository to use this group. Frontend and result-only jobs use the standard-GitHub-hosted Ubuntu runner. Jobs receive read-only repository permissions and-checkout does not persist credentials. No repository or deployment secrets are provided to-pull-request jobs.+Normal Rust checks select the organization `Default` runner group with the+`cncf-ubuntu-16-64-x86` label. The organization must permit this public repository+to use that group. Dedicated stability continues to use `Default Larger Runners`+with `ubuntu-latest-16-cores`. Frontend, selection and result-only jobs use the+standard GitHub-hosted Ubuntu runner. Jobs receive read-only repository permissions,+checkout does not persist credentials, and pull-request jobs receive no repository or+deployment secrets.++An affected PR plan remains one backend shard and executes the exact commands selected by+`test-plan.py`. A full plan expands into eight bounded jobs: formatting/clippy, unit and+binary tests, three ordinary integration-test groups, Gateway E2E, Product smoke, and the+remaining doctest/contract/transport gates. Each Cargo test shard keeps the full workspace+package and all-features context. `ci-shards.py check` compares every non-Desktop Cargo+integration target with the explicit shard inventory; a missing, duplicate or same-name+cross-shard target fails selection instead of being silently omitted. The required+`backend` status is a small aggregate job, so the public branch-protection contract remains+stable while individual shard jobs can run concurrently.++Changes to `gateway-core.yml`, `ci-run.py`, or `ci-shards.py` force a full plan on the pull+request because those files define the hosted backend execution contract. Changes only to+their tests or documentation keep the ordinary tooling-only selection.The toolchain comes from `rust-toolchain.toml`. Cargo sources are cached, not-`target/`. Build concurrency defaults to the runner CPU count; incremental-compilation is disabled. Every job keeps its own checkout-local Cargo output.-The hosted job is disposable, so there is no persistent worktree cleanup service.+`target/`; shards do not exchange compiled binaries or claim another runner's build+evidence. Build concurrency defaults to the runner CPU count; incremental compilation is+disabled. Every job keeps its own checkout-local Cargo output. The hosted job is+disposable, so there is no persistent worktree cleanup service.## Evidence and failures@@ -36,7 +52,8 @@ not establish product scenario acceptance.`artifacts/ci/<name>/` contains the complete command log and JSON result, includingrevision, CPU count, platform, timestamps, and Cargo/Rust versions for Cargocommands. Failure prints the log tail; Actions uploads available artifacts even-when a check fails. Timeout and cancellation stop the command process group+when a check fails. Each shard uses a distinct artifact name; the aggregate job does not+replace those per-command records. Timeout and cancellation stop the command process groupbefore removing its private short TMPDIR. A forcibly terminated VM cannot beexpected to finish uploading artifacts.@@ -44,6 +61,8 @@ The adapter can be tested without Rust compilation or remote access:```shpython3 scripts/test-ci-run.py+python3 scripts/test-ci-shards.py+python3 scripts/ci-shards.py check```## Coverage boundariesdiff --git a/scripts/ci-shards.py b/scripts/ci-shards.pynew file mode 100755index 00000000..5ab5aaef--- /dev/null+++ b/scripts/ci-shards.py@@ -0,0 +1,271 @@+#!/usr/bin/env python3+"""Partition a full hosted backend plan without weakening its Cargo coverage."""+import argparse+import importlib.util+import json+import os+from pathlib import Path+import subprocess+import sys+++ROOT = Path(__file__).resolve().parent.parent+FULL_TEST = [+ "cargo", "test", "--locked", "--workspace", "--exclude", "hiroute-desktop",+ "--all-features",+]++# Integration targets are explicit so a new target cannot silently land in an+# arbitrary shard. Targets with the same Cargo name stay together because a+# workspace-level `--test NAME` selects every matching package target.+INTEGRATION_SHARDS = {+ "integration-foundation": {+ ("hiroute-application-api", "pre_gateway_compute_routing"),+ ("hiroute-daemon", "pre_gateway_compute_routing"),+ ("hiroute-product-e2e", "pre_gateway_compute_routing"),+ ("hiroute-domain", "canonical_digest"),+ ("hiroute-domain", "compute"),+ ("hiroute-client-core", "transport"),+ ("hiroute-diagnostics", "files_safety"),+ ("hiroute-diagnostics", "worker_probe_progress"),+ ("hiroute-diagnostics", "writer_bounds"),+ ("hiroute-cli", "contracts"),+ ("hiroute-cli", "desktop_locator"),+ ("hiroute-cli", "work_plans"),+ ("hiroute-cli", "worker_dependencies"),+ ("hiroute-integrations", "agent_profiles"),+ ("hiroute-integrations", "current_model_metadata"),+ ("hiroute-integrations", "model_connections"),+ ("hiroute-integrations", "pre_gateway_compute"),+ ("hiroute-integrations", "release_facts"),+ ("hiroute-local-storage", "canonical_compat"),+ },+ "integration-daemon": {+ ("hiroute-daemon", "discovered_model_product"),+ ("hiroute-daemon", "local_worker_platform"),+ ("hiroute-daemon", "publication_process"),+ ("hiroute-daemon", "subscription_management_product"),+ },+ "integration-gateway": {+ ("hiroute-gateway-core", "attempt_exchange"),+ ("hiroute-gateway-core", "body_memory"),+ ("hiroute-gateway-core", "body_memory_and_framing"),+ ("hiroute-gateway-core", "component_boundaries"),+ ("hiroute-gateway-core", "filter_state_machine"),+ ("hiroute-gateway-core", "gateway_lifecycle"),+ ("hiroute-gateway-core", "gateway_stability"),+ ("hiroute-gateway-core", "publication_and_configuration"),+ ("hiroute-gateway-core", "routing_contracts"),+ ("hiroute-gateway-core", "sse_streaming"),+ ("hiroute-gateway-core", "telemetry_and_privacy"),+ ("hiroute-gateway-core", "transport_loopback"),+ ("hiroute-e2e", "case_shards"),+ ("hiroute-e2e", "p0_gateway_commit_boundary"),+ ("hiroute-e2e", "p0_gateway_context_hold"),+ ("hiroute-e2e", "p0_gateway_matrix_coverage"),+ ("hiroute-e2e", "p0_gateway_observation"),+ ("hiroute-e2e", "p0_gateway_oracle"),+ ("hiroute-e2e", "p0_gateway_planner"),+ ("hiroute-e2e", "p0_gateway_privacy"),+ ("hiroute-e2e", "p0_gateway_protocol"),+ ("hiroute-e2e", "p0_gateway_replay"),+ ("hiroute-e2e", "p0_gateway_request_authority"),+ ("hiroute-e2e", "p0_gateway_runtime"),+ },+ "integration-product": {+ ("hiroute-product-e2e", "agent_connection"),+ ("hiroute-product-e2e", "bundled_release_data"),+ ("hiroute-product-e2e", "compute_pool"),+ ("hiroute-product-e2e", "control_shell"),+ ("hiroute-product-e2e", "cpa_connector"),+ ("hiroute-product-e2e", "gateway_adapter_contract"),+ ("hiroute-product-e2e", "local_observation"),+ ("hiroute-product-e2e", "product_oracle"),+ ("hiroute-product-e2e", "routing_plans"),+ ("hiroute-product-e2e", "transaction_recovery"),+ ("hiroute-product-e2e", "worker_delegation"),+ ("hiroute-product-e2e", "worker_read"),+ },+ "integration-smoke": {+ ("hiroute-product-e2e", "smoke_cli"),+ },+}++FULL_SHARDS = [+ "quality",+ "unit",+ "integration-foundation",+ "integration-daemon",+ "integration-gateway",+ "integration-product",+ "integration-smoke",+ "gates",+]+++def load_test_plan():+ path = Path(__file__).with_name("test-plan.py")+ spec = importlib.util.spec_from_file_location("hiroute_test_plan", path)+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module+++def cargo_metadata(root=ROOT):+ output = subprocess.check_output(+ ["cargo", "metadata", "--format-version=1", "--no-deps", "--locked"],+ cwd=root,+ text=True,+ )+ return json.loads(output)+++def integration_targets(metadata):+ members = set(metadata["workspace_members"])+ targets = set()+ unsupported = []+ for package in metadata["packages"]:+ if package["id"] not in members or package["name"] == "hiroute-desktop":+ continue+ for target in package["targets"]:+ kinds = set(target["kind"])+ if "test" in kinds:+ targets.add((package["name"], target["name"]))+ elif target.get("test") and not kinds & {"lib", "proc-macro", "bin"}:+ unsupported.append((package["name"], target["name"], sorted(kinds)))+ if unsupported:+ raise ValueError("test-enabled targets need an explicit coverage rule: " + repr(unsupported))+ return targets+++def verify_assignments(metadata):+ actual = integration_targets(metadata)+ owners = {}+ for shard, entries in INTEGRATION_SHARDS.items():+ for entry in entries:+ if entry in owners:+ raise ValueError(f"duplicate integration target assignment: {entry!r}")+ owners[entry] = shard+ expected = set(owners)+ missing = sorted(actual - expected)+ extra = sorted(expected - actual)+ if missing or extra:+ raise ValueError(f"integration target assignments differ: missing={missing!r}, extra={extra!r}")++ by_name = {}+ for (package, name), shard in owners.items():+ by_name.setdefault(name, set()).add(shard)+ split_names = {name: sorted(shards) for name, shards in by_name.items() if len(shards) != 1}+ if split_names:+ raise ValueError("same-name workspace targets cannot span shards: " + repr(split_names))+ return {shard: sorted({name for _, name in entries})+ for shard, entries in INTEGRATION_SHARDS.items()}+++def matrix(plan):+ if not plan.get("rust"):+ return {"include": []}+ shards = FULL_SHARDS if plan.get("mode") == "full" else ["affected"]+ return {"include": [{"shard": shard} for shard in shards]}+++def full_commands(plan, metadata):+ commands = plan.get("commands")+ if not isinstance(commands, list) or commands.count(FULL_TEST) != 1:+ raise ValueError("full plan no longer has exactly one canonical workspace test command")+ names = verify_assignments(metadata)+ quality = [command for command in commands+ if command[:2] in (["cargo", "fmt"], ["cargo", "clippy"])]+ remainder = [command for command in commands if command != FULL_TEST and command not in quality]+ if not quality or not remainder:+ raise ValueError("full plan no longer has both quality and explicit gate commands")++ result = {+ "quality": quality,+ "unit": [[*FULL_TEST, "--lib", "--bins"]],+ "gates": [[*FULL_TEST, "--doc"], *remainder],+ }+ for shard, targets in names.items():+ result[shard] = [[*FULL_TEST, *[arg for name in targets for arg in ("--test", name)]]]+ if set(result) != set(FULL_SHARDS):+ raise ValueError("full shard command set is incomplete")+ return result+++def plan_for_args(base=None, full=False):+ planner = load_test_plan()+ paths = planner.changed_paths(base) if base else []+ result = planner.select(paths, full=full)+ result["candidate"] = planner.revision("HEAD")+ result["base"] = planner.revision(base) if base else None+ return result+++def run_commands(shard, commands):+ if os.environ.get("GITHUB_ACTIONS") != "true":+ raise ValueError("shard execution is restricted to GitHub Actions")+ runner = Path(__file__).with_name("ci-run.py")+ for index, command in enumerate(commands):+ argv = [sys.executable, str(runner), "--name", f"{shard}-{index}", "--phase", "final"]+ if command[:2] == ["cargo", "test"]:+ argv.append("--require-tests")+ completed = subprocess.run([*argv, "--", *command])+ if completed.returncode:+ return completed.returncode+ return 0+++def write_matrix(value, github_output=False):+ encoded = json.dumps(value, separators=(",", ":"))+ print(encoded)+ if github_output:+ output = os.environ.get("GITHUB_OUTPUT")+ if not output:+ raise ValueError("GITHUB_OUTPUT is required with --github-output")+ with open(output, "a") as stream:+ stream.write("matrix=" + encoded + "\n")+++def main():+ parser = argparse.ArgumentParser(description=__doc__)+ subparsers = parser.add_subparsers(dest="action", required=True)+ check = subparsers.add_parser("check")+ check.add_argument("--root", type=Path, default=ROOT)+ matrix_parser = subparsers.add_parser("matrix")+ matrix_parser.add_argument("--plan", type=Path, required=True)+ matrix_parser.add_argument("--github-output", action="store_true")+ run = subparsers.add_parser("run")+ run.add_argument("--shard", required=True)+ scope = run.add_mutually_exclusive_group(required=True)+ scope.add_argument("--base")+ scope.add_argument("--full", action="store_true")+ args = parser.parse_args()++ try:+ if args.action == "check":+ metadata = cargo_metadata(args.root)+ names = verify_assignments(metadata)+ print(json.dumps({"integration_targets": len(integration_targets(metadata)),+ "selector_names": sum(map(len, names.values())),+ "shards": {key: len(value) for key, value in names.items()}},+ sort_keys=True))+ return 0+ if args.action == "matrix":+ write_matrix(matrix(json.loads(args.plan.read_text())), args.github_output)+ return 0++ plan = plan_for_args(args.base, args.full)+ selected = [entry["shard"] for entry in matrix(plan)["include"]]+ if args.shard not in selected:+ raise ValueError(f"shard {args.shard!r} is not selected; expected {selected!r}")+ if args.shard == "affected":+ commands = plan["commands"]+ else:+ commands = full_commands(plan, cargo_metadata())[args.shard]+ return run_commands(args.shard, commands)+ except (OSError, ValueError, subprocess.CalledProcessError, json.JSONDecodeError) as error:+ parser.error(str(error))+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/test-ci-shards.py b/scripts/test-ci-shards.pynew file mode 100755index 00000000..e50651e3--- /dev/null+++ b/scripts/test-ci-shards.py@@ -0,0 +1,112 @@+#!/usr/bin/env python3+"""Regression tests for hosted backend shard planning; no Rust build."""+import copy+import contextlib+import io+import importlib.util+import json+import os+from pathlib import Path+import tempfile+import unittest+from unittest.mock import patch+++spec = importlib.util.spec_from_file_location(+ "ci_shards", Path(__file__).with_name("ci-shards.py")+)+shards = importlib.util.module_from_spec(spec)+spec.loader.exec_module(shards)+++def full_plan():+ return {+ "mode": "full",+ "rust": True,+ "commands": [+ ["cargo", "fmt", "--check"],+ ["cargo", "clippy", "--locked", "--workspace", "--exclude",+ "hiroute-desktop", "--all-targets", "--all-features", "--", "-D", "warnings"],+ shards.FULL_TEST[:],+ ["cargo", "test", "--locked", "-p", "hiroute-gateway-core",+ "--no-default-features", "--test", "transport_loopback"],+ ["python3", "scripts/check-contract-convergence.py"],+ ],+ }+++class ShardPlanningTests(unittest.TestCase):+ @classmethod+ def setUpClass(cls):+ cls.metadata = shards.cargo_metadata()++ def test_current_workspace_assigns_every_integration_target_once(self):+ names = shards.verify_assignments(self.metadata)+ self.assertEqual(set(names), set(shards.INTEGRATION_SHARDS))+ self.assertEqual(sum(map(len, names.values())), len({name for _, name in shards.integration_targets(self.metadata)}))++ def test_unknown_target_is_a_hard_coverage_failure(self):+ metadata = copy.deepcopy(self.metadata)+ package = next(item for item in metadata["packages"]+ if item["name"] == "hiroute-product-e2e")+ target = copy.deepcopy(next(item for item in package["targets"] if "test" in item["kind"]))+ target["name"] = "new_unassigned_journey"+ package["targets"].append(target)+ with self.assertRaisesRegex(ValueError, "missing=.*new_unassigned_journey"):+ shards.verify_assignments(metadata)++ def test_same_name_targets_must_share_one_shard(self):+ assignments = copy.deepcopy(shards.INTEGRATION_SHARDS)+ assignments["integration-daemon"].add(+ ("hiroute-daemon", "pre_gateway_compute_routing")+ )+ assignments["integration-foundation"].remove(+ ("hiroute-daemon", "pre_gateway_compute_routing")+ )+ with patch.object(shards, "INTEGRATION_SHARDS", assignments):+ with self.assertRaisesRegex(ValueError, "same-name workspace targets"):+ shards.verify_assignments(self.metadata)++ def test_full_plan_becomes_bounded_shards_without_dropping_gates(self):+ plan = full_plan()+ commands = shards.full_commands(plan, self.metadata)+ self.assertEqual(set(commands), set(shards.FULL_SHARDS))+ self.assertEqual(commands["quality"], plan["commands"][:2])+ self.assertEqual(commands["unit"], [[*shards.FULL_TEST, "--lib", "--bins"]])+ self.assertEqual(commands["gates"][0], [*shards.FULL_TEST, "--doc"])+ self.assertEqual(commands["gates"][1:], plan["commands"][3:])+ for name in shards.INTEGRATION_SHARDS:+ command = commands[name][0]+ self.assertEqual(command[:len(shards.FULL_TEST)], shards.FULL_TEST)+ self.assertIn("--test", command)++ def test_matrix_keeps_affected_plans_linear(self):+ self.assertEqual(+ shards.matrix({"rust": True, "mode": "affected"}),+ {"include": [{"shard": "affected"}]},+ )+ self.assertEqual(+ shards.matrix({"rust": True, "mode": "full"}),+ {"include": [{"shard": name} for name in shards.FULL_SHARDS]},+ )+ self.assertEqual(shards.matrix({"rust": False, "mode": "affected"}), {"include": []})++ def test_matrix_github_output_is_compact_and_machine_readable(self):+ value = shards.matrix({"rust": True, "mode": "affected"})+ with tempfile.TemporaryDirectory() as directory:+ output = Path(directory) / "github-output"+ with patch.dict(os.environ, {"GITHUB_OUTPUT": str(output)}):+ with contextlib.redirect_stdout(io.StringIO()):+ shards.write_matrix(value, github_output=True)+ key, encoded = output.read_text().strip().split("=", 1)+ self.assertEqual(key, "matrix")+ self.assertEqual(json.loads(encoded), value)++ def test_execution_is_github_actions_only(self):+ with patch.dict(os.environ, {}, clear=True):+ with self.assertRaisesRegex(ValueError, "restricted to GitHub Actions"):+ shards.run_commands("quality", [["true"]])+++if __name__ == "__main__":+ unittest.main()diff --git a/scripts/test-plan.py b/scripts/test-plan.pyindex 0c173873..7ac21b2c 100644--- a/scripts/test-plan.py+++ b/scripts/test-plan.py@@ -38,10 +38,15 @@ SELECTION_TOOLING = {"scripts/test-plan.py", "scripts/test-test-plan.py"}INTEGRATION_SKILL = ".agents/skills/hiroute-integrate/SKILL.md"WEBSITE_TOOLING = {".github/workflows/website.yml", ".github/workflows/release.yml"}WEBSITE_PREFIXES = ("apps/website/", ".github/scripts/")+HOSTED_BACKEND_EXECUTION = {+ ".github/workflows/gateway-core.yml",+ "scripts/ci-run.py",+ "scripts/ci-shards.py",+}VALIDATION_TOOLING = {"scripts/validation.py", "scripts/validation-host.py", "scripts/test-validation.py",- ".github/workflows/gateway-core.yml","scripts/validation-report.py", "scripts/test-validation-report.py","scripts/ci-run.py", "scripts/test-ci-run.py",+ "scripts/ci-shards.py", "scripts/test-ci-shards.py","scripts/pilot-builds.py", "scripts/test-pilot-builds.py","scripts/desktop-pilot.py", "scripts/test-desktop-pilot.py","scripts/local-rust.py", "scripts/test-local-rust.py",@@ -89,6 +94,13 @@ def select(paths, full=False):# Static site and OSS/release publication have their own Node/browser# workflow. They do not change Desktop or backend product behavior.continue+ elif path in HOSTED_BACKEND_EXECUTION:+ # These files decide what the hosted backend actually executes. Unit+ # tests validate their mapping, while one full run proves the changed+ # workflow and shard contract on its real entry path.+ full = True+ validation_tooling = True+ reasons.append("hosted backend execution contract: " + path)elif path in VALIDATION_TOOLING:validation_tooling = Trueelif e2e_consumers(path):@@ -179,7 +191,7 @@ def select(paths, full=False):if validation_tooling:commands.extend([["python3", "scripts/" + name] for name in("test-validation.py", "test-validation-report.py", "test-local-rust.py", "test-remote-rust.py", "test-validation-schedule.py",- "test-ci-run.py", "test-desktop-pilot.py", "test-pilot-builds.py")])+ "test-ci-run.py", "test-ci-shards.py", "test-desktop-pilot.py", "test-pilot-builds.py")])if full or paths:commands.append(["python3", "scripts/test-contract-convergence.py"])commands.append(["python3", "scripts/check-contract-convergence.py"])diff --git a/scripts/test-test-plan.py b/scripts/test-test-plan.pyindex 96614ae9..832788c9 100644--- a/scripts/test-test-plan.py+++ b/scripts/test-test-plan.py@@ -17,15 +17,27 @@ spec.loader.exec_module(plan)class SelectionTests(unittest.TestCase):def test_validation_tooling_selects_runner_consumers_without_product_builds(self):result = plan.select(['scripts/validation.py', 'scripts/local-rust.py', 'scripts/pilot-builds.py',- 'scripts/desktop-pilot.py', 'docs/validation-routing.md', '.github/workflows/gateway-core.yml'])+ 'scripts/desktop-pilot.py', 'docs/validation-routing.md'])self.assertFalse(result['rust'])self.assertFalse(result['frontend'])- for name in ('test-validation.py', 'test-local-rust.py', 'test-remote-rust.py', 'test-desktop-pilot.py', 'test-pilot-builds.py'):+ for name in ('test-validation.py', 'test-local-rust.py', 'test-remote-rust.py',+ 'test-ci-shards.py', 'test-desktop-pilot.py', 'test-pilot-builds.py'):self.assertIn(['python3', 'scripts/' + name], result['commands'])mixed = plan.select(['scripts/validation.py', 'crates/daemon/src/lib.rs'])self.assertTrue(mixed['rust'])self.assertIn('daemon', mixed['groups'])+ def test_hosted_backend_execution_contract_runs_full_matrix(self):+ for path in sorted(plan.HOSTED_BACKEND_EXECUTION):+ with self.subTest(path=path):+ result = plan.select([path])+ self.assertEqual(result['mode'], 'full')+ self.assertTrue(result['rust'])+ self.assertTrue(result['frontend'])+ self.assertIn('--workspace', result['commands'][2])+ self.assertIn('hosted backend execution contract: ' + path, result['reasons'])+ self.assertIn(['python3', 'scripts/test-ci-shards.py'], result['commands'])+def test_docs_do_not_build_rust(self):result = plan.select(["docs/testing.md", "README.md", "AGENTS.md"])self.assertFalse(result["rust"])