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
fix(ci): validate release catalogs without version assumptions (#55)
澄潭7acff81822ed
diff --git a/crates/host-runtime/src/releases.rs b/crates/host-runtime/src/releases.rsindex 119070b0..fda2c49c 100644--- a/crates/host-runtime/src/releases.rs+++ b/crates/host-runtime/src/releases.rs@@ -283,21 +283,50 @@ mod tests {fn current_website_catalog_is_the_upgrade_reader_contract() {let bytes = include_bytes!("../../../apps/website/data/releases.json");let catalog = WebsiteReleasesV2::parse(bytes).unwrap();- let update = catalog.desktop_update("0.0.1", "arm64").unwrap().unwrap();- assert!(- update- .download_url()- .starts_with("https://hiroute.ai/releases/0.1.0/HiRoute-")- );- assert!(catalog.desktop_update("0.1.0", "arm64").unwrap().is_none());- assert!(catalog.desktop_update("99.0.0", "arm64").unwrap().is_none());+ let original: serde_json::Value = serde_json::from_slice(bytes).unwrap();+ for architecture in ["arm64", "x86_64"] {+ let update = catalog+ .desktop_update("0.0.1", architecture)+ .unwrap()+ .unwrap();+ let release = original["releases"]+ .as_array()+ .unwrap()+ .iter()+ .find(|r| r["version"] == update.version && r["channel"] == "stable")+ .unwrap();+ let artifact = release["artifacts"]+ .as_array()+ .unwrap()+ .iter()+ .find(|a| a["kind"] == "desktop" && a["architecture"] == architecture)+ .unwrap();+ assert_eq!(update.filename, artifact["filename"].as_str().unwrap());+ assert_eq!(update.sha256, artifact["sha256"].as_str().unwrap());+ assert_eq!(update.size, artifact["size"].as_u64().unwrap());+ assert_eq!(update.architecture, architecture);+ assert_eq!(+ update.download_url(),+ format!(+ "https://hiroute.ai/releases/{}/{}",+ release["version"].as_str().unwrap(),+ artifact["filename"].as_str().unwrap()+ )+ );+ assert!(update.revision_prefix().is_ok());+ assert!(+ catalog+ .desktop_update(&update.version, architecture)+ .unwrap()+ .is_none()+ );+ }assert!(catalog.desktop_update("0.0.1", "riscv64").unwrap().is_none());- let original: serde_json::Value = serde_json::from_slice(bytes).unwrap();for (field, bad) in [("filename", "../other.dmg"),("sha256", "unverified"),@@ -305,7 +334,14 @@ mod tests {("distribution", "unsigned"),] {let mut broken = original.clone();- broken["releases"][0]["artifacts"][0][field] = bad.into();+ let desktop = broken["releases"]+ .as_array_mut()+ .unwrap()+ .iter_mut()+ .flat_map(|r| r["artifacts"].as_array_mut().unwrap())+ .find(|a| a["kind"] == "desktop")+ .unwrap();+ desktop[field] = bad.into();assert!(WebsiteReleasesV2::parse(&serde_json::to_vec(&broken).unwrap()).is_err(),"{field}"@@ -315,4 +351,50 @@ mod tests {broken["download_url"] = "https://other.invalid".into();assert!(WebsiteReleasesV2::parse(&serde_json::to_vec(&broken).unwrap()).is_err());}++ #[test]+ fn update_selection_uses_latest_stable_version_for_each_architecture() {+ let release = |version: &str, channel: &str, architecture: &str| {+ serde_json::json!({+ "version": version, "channel": channel, "published_at": "2026-10-09",+ "notes": {"zh": "版本说明", "en": "Release notes"},+ "artifacts": [{+ "kind": "desktop", "platform": "macOS", "architecture": architecture,+ "format": "dmg", "minimum_os": "15.0", "distribution": "self-signed",+ "filename": format!("HiRoute-{version}-0123456789ab-macos-{architecture}-trial.dmg"),+ "sha256": "a".repeat(64), "size": 1024+ }]+ })+ };+ let bytes = serde_json::to_vec(&serde_json::json!({+ "schema": "hiroute.website.releases/v2",+ "releases": [+ release("0.10.0", "stable", "arm64"),+ release("1.0.0-rc.1", "preview", "arm64"),+ release("0.11.0", "stable", "x86_64"),+ release("0.2.0", "stable", "arm64")+ ]+ }))+ .unwrap();+ let catalog = WebsiteReleasesV2::parse(&bytes).unwrap();+ for (architecture, expected) in [("arm64", "0.10.0"), ("x86_64", "0.11.0")] {+ let update = catalog+ .desktop_update("0.1.0", architecture)+ .unwrap()+ .unwrap();+ assert_eq!(update.version, expected);+ assert!(+ catalog+ .desktop_update(expected, architecture)+ .unwrap()+ .is_none()+ );+ assert!(+ catalog+ .desktop_update("2.0.0", architecture)+ .unwrap()+ .is_none()+ );+ }+ }}diff --git a/docs/github-actions-validation.md b/docs/github-actions-validation.mdindex 1713dfa4..b5bfd596 100644--- a/docs/github-actions-validation.md+++ b/docs/github-actions-validation.md@@ -34,6 +34,11 @@ Changes to `gateway-core.yml`, `ci-run.py`, or `ci-shards.py` force a full planrequest because those files define the hosted backend execution contract. Changes only totheir tests or documentation keep the ordinary tooling-only selection.+The website release catalog (`apps/website/data/releases.json`) also selects the+`hiroute-host-runtime` library tests and package Clippy in backend CI. The native+upgrade reader consumes this data, so website validation alone cannot cover a new+release. Other website-only edits retain their dedicated workflow.+The toolchain comes from `rust-toolchain.toml`. Cargo sources are cached, not`target/`; shards do not exchange compiled binaries or claim another runner's buildevidence. The shared Rust setup exports `CARGO_NET_GIT_FETCH_WITH_CLI=true` fordiff --git a/scripts/test-plan.py b/scripts/test-plan.pyindex 019ef037..cea0ab42 100644--- a/scripts/test-plan.py+++ b/scripts/test-plan.py@@ -327,6 +327,10 @@ def select(paths, full=False):continueif path in SELECTION_TOOLING or path == INTEGRATION_SKILL:selection_tooling = True+ elif path == "apps/website/data/releases.json":+ # The native upgrade reader embeds this catalog in its contract test.+ targets.add(("hiroute-host-runtime", "lib"))+ reasons.append("release catalog upgrade reader: " + path)elif path in WEBSITE_TOOLING or path.startswith(WEBSITE_PREFIXES):# Static site and OSS/release publication have their own Node/browser# workflow. They do not change Desktop or backend product behavior.diff --git a/scripts/test-test-plan.py b/scripts/test-test-plan.pyindex 5b21ddc7..b7c59370 100644--- a/scripts/test-test-plan.py+++ b/scripts/test-test-plan.py@@ -329,6 +329,28 @@ class SelectionTests(unittest.TestCase):self.assertFalse(result["native_required"])self.assertIn(["python3", "scripts/test-contract-convergence.py"], result["commands"])+ def test_release_catalog_selects_upgrade_reader(self):+ reader = ["cargo", "test", "--locked", "-p", "hiroute-host-runtime",+ "--all-features", "--lib"]+ catalog = "apps/website/data/releases.json"+ for paths in ([catalog], [catalog, "apps/website/src/pages/index.astro"],+ [catalog, "crates/daemon/src/lib.rs"]):+ with self.subTest(paths=paths):+ result = plan.select(paths)+ self.assertEqual(result["mode"], "affected")+ self.assertTrue(result["rust"])+ self.assertFalse(result["frontend"])+ self.assertFalse(result["native_required"])+ self.assertEqual(result["commands"].count(reader), 1)+ self.assertIn(["cargo", "clippy", "--locked", "-p", "hiroute-host-runtime",+ "--all-targets", "--all-features", "--", "-D", "warnings"],+ result["commands"])+ # The full workspace already includes this library; do not run it twice.+ full = plan.select([catalog], full=True)+ self.assertNotIn(reader, full["commands"])+ self.assertIn(["cargo", "test", "--locked", "--workspace", "--exclude",+ "hiroute-desktop", "--all-features"], full["commands"])+def test_release_build_tooling_selects_packaging_consumers(self):for path in plan.RELEASE_BUILD_TOOLING:with self.subTest(path=path):