diff --git a/docs/maintenance-2026-11-28.md b/docs/maintenance-2026-11-28.md new file mode 100644 index 0000000..03ca80f --- /dev/null +++ b/docs/maintenance-2026-11-28.md @@ -0,0 +1,58 @@ +# Upstream maintenance — 2026-11-28 + +## Scope +Fork baseline `1e1b2b67ccb17de53f4da95e199d2f5497f48db7`. Upstream default +main inspected `dbe641f286a489ecb39e3c041c554371e6add864`; previous review tip +`85225381d89915595598ed13766cd79890c03a84`. Partial semantic adaptation of +`54ed2ba2016642abd897456f48d84b9f0fee6632` (empty/null schema enum values). +Previous PR #1 is verified merged; no open maintenance PR existed. +The Rust fork and Go upstream have independent roots: 4,420 patch-unmatched +non-merge commits are not 4,420 proven missing features. Do not merge unrelated +histories or declare the inspected upstream tip covered. + +## Combined behavior and retained fork additions +Adapt the upstream fix to the existing strict Rust schema cleaner. Filter blank, +whitespace-only and null enum members before serializing Gemini declarations; +preserve empty-string/null intent as advisory descriptions and native Antigravity +nullable state. All-stripped enums are omitted rather than emitting an empty +restriction. Existing numeric/boolean conversion and declared Antigravity types +remain. Compound enums/unsupported references still fail closed. Nested property +names, original descriptions and cleaner idempotence are regression-tested. +No wholesale source replacement or textual merge conflict. The semantic conflict +between upstream's broad Go normalizer and this focused Rust subset is resolved +without widening supported composition or signed-replay claims. + +AI48 branding, Home-owned scheduling/credentials/database-backed runtime, +mTLS/RESP, accounting, auth/security, plugin-disable guard, request payload rules +and all Home/UI routes/payloads are unchanged. This affects declarations, never +historical function argument values. + +## Database +Home fork schema **31 -> 31**, upstream Home **21**. No schema/migration change, +version bump, production access or migration execution in this worker change. + +## Verification +Rust 1.100.0, locked dependencies. Separate exact-origin baseline and maintenance +worktrees with identical toolchain/environment; logs outside repository source. +Focused new `cargo test --locked --all-targets enum_regressions`: 3 passed. +Maintenance full `cargo test --locked --all-targets`: 528 passed, 0 failed, +1 ignored (493 library + 6 binary + 6 signing + 13 CPA + 10 Zed). +`cargo fmt --all --check` and `git diff --check`: passed. +Strict `cargo clippy --locked --all-targets -- -D warnings`: failed six lints in +unchanged codex_catalog.rs, ws_recovery.rs, websocket.rs, codex_multiagent_tests.rs +and gateway_client_tests.rs. Independent baseline target directory rerun: +`cargo test --locked --all-targets`: 525 passed, 0 failed, 1 ignored; +`cargo clippy --locked --all-targets -- -D warnings`: same six errors at the +same unchanged source locations, exit 101. Initial shared-target baseline run +reused the maintenance binary (528 tests), so it is NOT baseline evidence; the +independent rebuild above is authoritative. Baseline fmt also passed. +No release/container build, live provider test, deployment, restart or production +DB write. Keep PR draft while required gate fails. + +## Remaining upstream review +Watcher/auth-file fixes are Home/control-plane responsibilities rather than local +worker file-backed runtime features. Review transport pool isolation, signed cache +scope, Gemini tool-response ordering, post-commit SSE errors and new cancellation +behavior in Rust-specific paths separately. This focused change does not claim +coverage for them. Home Copilot/provider namespace changes do not establish worker +executor support; unsupported-provider gates remain intact. diff --git a/src/protocol/gemini_schema.rs b/src/protocol/gemini_schema.rs index 124af95..de9f1ae 100644 --- a/src/protocol/gemini_schema.rs +++ b/src/protocol/gemini_schema.rs @@ -75,14 +75,45 @@ fn clean_node(schema: &Value, antigravity: bool, placeholder: bool, depth: usize values.iter().all(|v| !v.is_object() && !v.is_array()), "unsupported compound enum" ); - let strings: Vec = values.iter().map(display).collect(); + let saw_empty = values + .iter() + .any(|v| v.as_str().is_some_and(|s| s.trim().is_empty())); + let saw_null = values.iter().any(Value::is_null); + let strings: Vec = values + .iter() + .filter(|v| !v.is_null() && !v.as_str().is_some_and(|s| s.trim().is_empty())) + .map(display) + .collect(); if !strings.is_empty() && strings.len() <= 10 { hint(&mut out, format!("Allowed: {}", strings.join(", "))); } - if !antigravity { + if !antigravity && (!strings.is_empty() || values.is_empty()) { out.insert("enum".into(), json!(strings)); out.insert("type".into(), json!("string")); } + if saw_empty { + hint( + &mut out, + if strings.is_empty() { + "Allowed: \"\"" + } else { + "Empty string \"\" allowed" + } + .into(), + ); + if !antigravity || !out.contains_key("type") { + out.insert("type".into(), json!("string")); + } + } + if saw_null { + hint(&mut out, "nullable".into()); + if antigravity { + out.insert("nullable".into(), json!(true)); + } + if !out.contains_key("type") { + out.insert("type".into(), json!("null")); + } + } } if let Some(types) = out.get("type").and_then(Value::as_array).cloned() { let non_null: Vec<_> = types.iter().filter(|v| **v != "null").cloned().collect(); @@ -258,3 +289,54 @@ fn clean_node(schema: &Value, antigravity: bool, placeholder: bool, depth: usize } Ok(Value::Object(out)) } + +#[cfg(test)] +mod enum_regressions { + use super::*; + + #[test] + fn blank_and_null_enum_members_preserve_advisory_semantics() { + for antigravity in [false, true] { + let schema = json!({"type":"integer","enum":["", " ", null, 0, false, "ok"],"description":"Original"}); + let result = clean(&schema, antigravity, false).unwrap(); + if antigravity { + assert!(result.get("enum").is_none()); + assert_eq!(result["type"], "integer"); + assert_eq!(result["nullable"], true); + } else { + assert_eq!(result["enum"], json!(["0", "false", "ok"])); + assert_eq!(result["type"], "string"); + } + let description = result["description"].as_str().unwrap(); + assert!(description.contains("Original")); + assert!(description.contains("Empty string \"\" allowed")); + assert!(description.contains("nullable")); + assert_eq!(clean(&result, antigravity, false).unwrap(), result); + } + } + + #[test] + fn entirely_stripped_enum_is_not_sent_as_empty_restriction() { + for antigravity in [false, true] { + for values in [json!(["", "\t"]), json!([null]), json!(["", null])] { + let result = clean(&json!({"enum":values}), antigravity, false).unwrap(); + assert!(result.get("enum").is_none()); + assert!(result.get("type").is_some()); + assert!(result.get("description").is_some()); + } + } + } + + #[test] + fn nested_enum_cleaning_keeps_property_names_and_fails_closed() { + let result = clean( + &json!({"type":"object","properties":{"enum":{"type":"string","enum":["", "ok"]}}}), + false, + false, + ) + .unwrap(); + assert_eq!(result["properties"]["enum"]["enum"], json!(["ok"])); + assert!(clean(&json!({"enum":[{}]}), false, false).is_err()); + assert!(clean(&json!({"$ref":"#/x"}), false, false).is_err()); + } +}