fix(server): recurse portable_schema into all draft-2020-12 positions - #126
Merged
Conversation
The pass and its mirror test only visited `properties` and `items`, so a future HashMap value or tuple slot could keep a type union or `uint64` format that Gemini/Vertex would refuse. Recurse into object-form `additionalProperties`, `patternProperties` values, `prefixItems`, and array-form `items`. Boolean `additionalProperties` is not a subschema and is skipped. Canaries plant a non-portable node under each new keyword so deleting an arm fails even though no live `#[tool]` struct emits those positions today. DESIGN.md now attributes stray `"default": null` to `#[serde(default)]` and marks `enum` as a dead keep-list entry. Closes #120
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
portable_schemaand its mirror walk now recurse into every draft2020-12 subschema position a
#[tool]param struct can emit:properties(already visited)itemsas an object or as an array of schemasadditionalPropertiespatternPropertiesvaluesprefixItemsBoolean
additionalProperties(the twocustom_fieldsparams) is nota subschema and is left alone. Other applicator keywords (
anyOf/oneOf/allOf/$ref/$defs/not/if/then/else/
contains/propertyNames/dependentSchemas/ …) stay absentfrom served schemas; the mirror test fails if one appears.
Canaries plant a type union,
"default": null, andformat: "uint64"under each newly covered keyword. Live
#[tool]structs do not emitthose positions today, so deleting an arm would have shipped green
against
served_tool_schemas_are_client_portablealone.DESIGN.md's schemars bullet now attributes stray
"default": nullto#[serde(default)](not schemars' rendering ofOption<T>), andmarks
enuminPORTABLE_FORMATSas a dead keep-list entry — notload-bearing.
Why
PR #119's pass and its mirror test shared the same recursion blind
spot. A future param like
HashMap<String, u64>(object-schemaadditionalPropertiescarryingformat: "uint64") or a tuple(
prefixItemscarrying a type union) would have been invisible toboth walks, so a Gemini/Vertex regression would ship green.
Schema advertisement only: serde still accepts an explicit
nullforevery
Option<T>field. No tool's accepted input changed, and noinvariant (I1–I16) is involved.
How verified
cargo fmt --checkcleancargo clippy --workspace --all-targets -- -D warningscleancargo clippy -p bugwarden --features gen --all-targets -- -D warningscleancargo test --workspace --all-targets --lockedgreencargo deny checkclean (existing duplicate-crate warnings only)optional_params_still_accept_an_explicit_nullstill passesMutation: delete the
prefixItemsarmportable_schema'sprefixItemsblock was removed and the canarysuite was rerun with
--no-fail-fast. Only the plantedprefixItemsnode stayed dirty; the other new arms and the mirror walk still
passed:
The arm was restored before commit.
Adversarial review
(
properties,itemsobject-or-array, object-formadditionalProperties,patternProperties,prefixItems).prefixItemsarm is killed (evidence above).#[serde(default)]attribution, andenumis explicitly a dead keep-list entry.Deserialize/ handler edits).Closes #120