Fix detailed Nitro schema change diagnostics - #10180
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Nitro schema change diagnostics by requesting the correct nested schema change details from the Nitro API and formatting more informative schema change messages in the Aspire integration.
Changes:
- Fix the
PollNitroSchemaValidationoperation to querySchemaChangedetails/leaves (instead ofSchemaChangeLogEntry) and includeseverity/__typenameon leaves. - Improve
NitroSchemaValidatorschema change descriptions, especially for field add/remove, usingfieldNameandtypeName. - Update persisted operation hash and adjust affected tests/snapshots to the new diagnostic output.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Aspire.Tests/Nitro/NitroSchemaValidatorTests.cs | Updates expected schema-change diagnostic text in validator test data. |
| src/HotChocolate/Fusion/test/Fusion.Aspire.Tests/Nitro/NitroSchemaValidationFormatterTests.cs | Updates formatter expectations to match the new detailed schema-change message. |
| src/HotChocolate/Fusion/test/Fusion.Aspire.Tests/Nitro/NitroOperationDocumentsTests.cs | Adds coverage to validate the schema validation document includes the new schema change fragments. |
| src/HotChocolate/Fusion/src/Fusion.Aspire/Nitro/Operations/PollNitroSchemaValidation.graphql.sha256 | Updates the persisted operation hash for the modified GraphQL document. |
| src/HotChocolate/Fusion/src/Fusion.Aspire/Nitro/Operations/PollNitroSchemaValidation.graphql | Fixes fragment type conditions and requests nested schema change details/leaves correctly. |
| src/HotChocolate/Fusion/src/Fusion.Aspire/Nitro/NitroSchemaValidator.cs | Enhances schema change message generation for field add/remove and field-change cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Assert.Contains( | ||
| "fragment SchemaChangeDetail on SchemaChange", | ||
| document, | ||
| StringComparison.Ordinal); | ||
| Assert.Contains( | ||
| "fragment SchemaChangeLeaf on SchemaChange", | ||
| document, | ||
| StringComparison.Ordinal); | ||
| } |
| "FieldAddedChange" => DescribeFieldChange(change, "added"), | ||
| "FieldRemovedChange" => DescribeFieldChange(change, "removed"), | ||
| "InputFieldChanged" => DescribeNamedFieldChange(change, "Input field"), | ||
| "OutputFieldChanged" => DescribeNamedFieldChange(change, "Output field"), |
There was a problem hiding this comment.
Added a focused FieldAddedChange entry to the KnownTerminalFailureData theory in this commit. The test verifies that typeName ("Product") and fieldName ("price") are correctly surfaced through DescribeFieldChange, producing "Field 'price' was added to type 'Product'." in the violation output.
Patch coverage55.6% of changed lines covered (45/81)
Uncovered changed lines (JSON){
"sha": "770e7bf3984907a8590ad3b444fb2455e25bcc12",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Aspire/Nitro/NitroSchemaValidator.cs", "ranges": [[649, 649], [651, 651], [653, 653], [656, 661], [668, 670], [672, 672], [674, 677], [679, 679], [681, 681], [683, 687], [689, 690], [693, 693], [697, 703]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Aspire/Nitro/NitroSchemaValidationFormatter.cs", "ranges": [[156, 156], [158, 158]] }
]
}Project coverage: 54.0% (237606/439971 lines) |
|
|
No description provided.