Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Describe the bug
When a diff of a type has both a breaking change and simple change, the simplify rules silently drops the breaking change.
To Reproduce Steps to reproduce the behaviour:
// packages/core/__tests__/diff/rules/simplify-changes.test.ts
test('keeps a breaking field type change when the same field also gains a description', async () => {
const a = buildSchema(/* GraphQL */ `
type Payload {
id: String!
}
type Query {
_: Boolean
}
type Mutation {
doSomething(id: String!): Payload!
}
`);
const b = buildSchema(/* GraphQL */ `
type Payload {
id: String!
}
type Query {
_: Boolean
}
type Mutation {
"Does something."
doSomething(id: String!): Boolean!
}
`);
const changes = await diff(a, b, [simplifyChanges]);
// The breaking type change must survive simplification even though the same field also gained a description in the same diff.
// `simplifyChanges` treats `FieldDescriptionAdded` as a "simple change" and pushes its path, the later `FieldTypeChanged` shares that exact path and is wrongly filtered out.
const typeChange = changes.find(c => c.type === ChangeType.FieldTypeChanged);
expect(typeChange).toBeDefined();
expect(typeChange?.criticality.level).toBe(CriticalityLevel.Breaking);
});
Expected behavior
Check should never drop breaking changes.
Environment:
Additional context
I can PR the failing test and willing to implement a fix but would need some guidance on where to best fix this.
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Describe the bug
When a diff of a type has both a breaking change and simple change, the simplify rules silently drops the breaking change.
To Reproduce Steps to reproduce the behaviour:
Expected behavior
Check should never drop breaking changes.
Environment:
@graphql-inspector/...:@graphql-hive/[email protected]which resolves@graphql-inspector/[email protected]graphql: 16Additional context
I can PR the failing test and willing to implement a fix but would need some guidance on where to best fix this.