Preserve generated model alias compatibility - #74
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dee1b456b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3765e7e2e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| typeSpec, ok := rawSpec.(*ast.TypeSpec) | ||
| if !ok || !typeSpec.Assign.IsValid() { | ||
| continue |
There was a problem hiding this comment.
Include direct generated-field exposures in reachability
When a public root struct directly contains a generated type, this assignment check skips it because it only seeds declarations of the form type Foo = gen.Bar. The current Contact.Companies, Contact.Location, ContactList.Type, CompanyContacts.Type, and several Ticket fields expose generated types that are not otherwise alias-reachable, such as ContactCompaniesSchema and TicketContactsSchema; therefore a future incompatible field change to one of those types is omitted by the public-module comparison and then discarded by this filter, even though downstream code such as contact.Companies.Data would stop compiling. Seed the closure from generated types referenced by all exported root declarations, not only aliases.
AGENTS.md reference: AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db68c4270b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !ok || valueSpec.Type == nil || !valueSpecIsExported(valueSpec) { | ||
| continue |
There was a problem hiding this comment.
Handle inferred exported value types
When an exported root variable or constant derives its type from an initializer, such as var Default = gen.Direct{}, this branch skips the declaration because ValueSpec.Type is nil. Consumers can still access the generated value's exported fields, but Direct never enters the reachability closure, so later incompatible changes to that generated type are silently discarded by the compatibility filter. Inspect the initializer expressions or resolve inferred declaration types instead of requiring an explicit type.
AGENTS.md reference: AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee4c29df07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if declaration.Type.Results != nil { | ||
| for _, result := range declaration.Type.Results.List { | ||
| symbolExpressions[declaration.Name.Name] = append(symbolExpressions[declaration.Name.Name], result.Type) | ||
| } |
There was a problem hiding this comment.
Traverse parameters of inferred function values
Although direct inferred initializers are now covered, a remaining case is an exported root variable that aliases a generated function, such as var Validate = gen.Validate. The variable’s parameter types are part of the public API, but package functions are indexed only by their result expressions here—and resultless functions receive no symbol entry—so the seed for Validate is discarded and incompatible changes to its generated parameter models are silently filtered out. Record the complete function type, including parameters and results.
AGENTS.md reference: AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
Summary
Follow-up to #73 that addresses the two review findings reported against its final head.
Conversation.Source.Authorshape, includingFromAiAgentandIsAiAnswer, through reproducible OpenAPI normalization.Root cause
The API 2.16 schema changed
conversation_source.authorto a narrower generated type, whileConversationremained a public alias. The public-moduleapidiffexport does not expand types below aliases into the internal generated package, and PR #73 had removed the separate generated-model comparison, allowing that nested source break to pass the gate.User impact
Existing callers can continue reading
conversation.Source.Author.FromAiAgentandconversation.Source.Author.IsAiAnswer. Future incompatible changes beneath public generated-model aliases now fail the compatibility check.Validation
go test ./...make pre-pushgo fix ./...gofmtgo vet ./...v0.2.0govulncheck(no vulnerabilities found)