Repository navigation
Extend tool-schema wire-key guard to relationships, edge fields and nested items (#2836) - #3028
Conversation
…ested items (closes #2836) Generalize schema_tool_field_keys_are_accepted_schema_field_wire_keys into a table-driven walk (schema_tool_item_keys_are_accepted_wire_keys) that round-trips every declared item key of create_schema/update_schema through its real struct: SchemaField for fields/add_fields, SchemaRelationship for relationships/add_relationships, EdgeField for edgeFields, EnumValue for coreValues. The walk descends into any nested item schema that declares properties and fails asking for a struct mapping if one is missing; it also pins that the nested surfaces were actually reached. The probe helper gains an enum arm for direction/cardinality. No declared key was misspelled. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pragmatic Code Review: PR #3028Review Type: Initial Review (no prior reviews or comments on the PR) Scope: Test-only change in Requirements Check (issue #2836)
Code Review Findings🟡 The top-level surface list is hand-maintained, so same-class sibling surfaces stay unguarded
These are outside the issue's literal table, so this doesn't block. It is the same bug class the issue says has happened three times, though, and fixing it is cheap. Recommendation:
🟢 🟢 The vacuity pin skips 🟢 Nit: odd indentation in the rustfmt'd panic string 🟢 Nit: the enum arm always probes the first variant What's good
Recommendation: APPROVEThis improves the codebase and covers every requirement in the issue. The 🟡 finding (the |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
…at top level - Add FieldRename and FieldValueAddition shapes (values[] -> EnumValue) so update_schema's rename_fields and add_field_values item keys are checked. - Fail when any create_schema/update_schema parameter declares item properties without a row in the surfaces table, matching the nested walk. - Pin UpdateSchema.add_fields[].coreValues[] and add_field_values[].values[] as reached paths. - Document that WireShape::nested lists every nested array of the struct, including ones not yet declared; flatten the nested-shape lookup. Skipped: adding items to edgeFields' coreValues declaration — changes the production tool schema, outside this test-only PR. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review addressed (e21c4f3)✅ Addressed
⏭️ Skipped
Verification: each mutation below was tested and then reverted. All were caught with actionable messages. The pre-push gate passed.
Re-review: not needed. The changes stay inside the reviewed pattern: two table rows, two statics, and one extra fail-closed loop. |
Closes #2836
Summary
Generalizes
schema_tool_field_keys_are_accepted_schema_field_wire_keysinto a table-driven walk,schema_tool_item_keys_are_accepted_wire_keys, that round-trips every declared item key ofcreate_schema/update_schemathrough the real deserializer:fields/add_fieldsSchemaFieldrelationships/add_relationshipsSchemaRelationship…edgeFields[]EdgeField…coreValues[]EnumValueproperties. Each struct'sWireShapemaps nested keys (fields,itemFields,coreValues,userValues,edgeFields) to their child shapes. An unmapped nested schema fails with a message asking for the mapping, so it can't be skipped silently.fields[].coreValues[], bothedgeFields[]) were actually visited, so a walk that stops early can't pass vacuously.sample_value_for_declared_keynow has anenumarm that uses the first variant, which coversdirection/cardinality/reverseCardinality. Theunknown fieldcheck that separates harness gaps from real key failures is unchanged.Test-only change. The sweep found no misspelled key.
Verification
required→is_requiredfails withCreateSchema.relationships[].edgeFields[] declares key "is_required" … EdgeField rejects it, and renamingreverseCardinality→reverse_cardinalityfails forSchemaRelationship.🤖 Generated with Claude Code