Test_issueWriteSchemaClassification fails when a schema property is added without classifying it as either form-resendable (issueWriteFormParams) or known-non-form (knownNonForm below). Without this guard, an unclassified property would silently flip UI gating: form-incompatible fields would stop tr
(t *testing.T)
| 1603 | // property would silently flip UI gating: form-incompatible fields would |
| 1604 | // stop tripping the safety-net bypass and the form would drop their values. |
| 1605 | func Test_issueWriteSchemaClassification(t *testing.T) { |
| 1606 | t.Parallel() |
| 1607 | |
| 1608 | // Schema properties the MCP App form cannot represent — their presence |
| 1609 | // must trigger the safety-net bypass via hasNonFormParams. The |
| 1610 | // form currently collects every schema property, so this allowlist is |
| 1611 | // empty; add a property here only if it is added to the schema without |
| 1612 | // corresponding form support. |
| 1613 | knownNonForm := map[string]struct{}{} |
| 1614 | |
| 1615 | cases := []struct { |
| 1616 | name string |
| 1617 | tool inventory.ServerTool |
| 1618 | }{ |
| 1619 | {name: "IssueWrite", tool: IssueWrite(translations.NullTranslationHelper)}, |
| 1620 | } |
| 1621 | |
| 1622 | for _, tc := range cases { |
| 1623 | t.Run(tc.name, func(t *testing.T) { |
| 1624 | t.Parallel() |
| 1625 | schema, ok := tc.tool.Tool.InputSchema.(*jsonschema.Schema) |
| 1626 | require.True(t, ok, "InputSchema should be *jsonschema.Schema") |
| 1627 | |
| 1628 | for prop := range schema.Properties { |
| 1629 | _, isForm := issueWriteFormParams[prop] |
| 1630 | _, isNonForm := knownNonForm[prop] |
| 1631 | |
| 1632 | assert.Falsef(t, isForm && isNonForm, |
| 1633 | "property %q is classified as both form-resendable and non-form — pick one", prop) |
| 1634 | assert.Truef(t, isForm || isNonForm, |
| 1635 | "property %q in %s schema is unclassified — add it to issueWriteFormParams (pkg/github/issues.go) "+ |
| 1636 | "if the MCP App form can carry it on submit, otherwise add it to the knownNonForm allowlist in this test", |
| 1637 | prop, tc.name) |
| 1638 | } |
| 1639 | }) |
| 1640 | } |
| 1641 | } |
| 1642 | |
| 1643 | func Test_ListIssues(t *testing.T) { |
| 1644 | // Verify tool definition |
nothing calls this directly
no test coverage detected