Skip to content

Preserve generated model alias compatibility - #74

Open
uffejaeger wants to merge 5 commits into
mainfrom
codex/fix-api-216-review-gaps
Open

Preserve generated model alias compatibility#74
uffejaeger wants to merge 5 commits into
mainfrom
codex/fix-api-216-review-gaps

Conversation

@uffejaeger

Copy link
Copy Markdown
Owner

Summary

Follow-up to #73 that addresses the two review findings reported against its final head.

  • Preserve the historical Conversation.Source.Author shape, including FromAiAgent and IsAiAnswer, through reproducible OpenAPI normalization.
  • Restore generated-model compatibility coverage for types transitively exposed through public root-package aliases.
  • Filter the generated comparison by actual alias reachability so private client changes do not become a second public API surface.
  • Add normalization, reachability, and downstream compile regression tests, and document the compatibility behavior.

Root cause

The API 2.16 schema changed conversation_source.author to a narrower generated type, while Conversation remained a public alias. The public-module apidiff export 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.FromAiAgent and conversation.Source.Author.IsAiAnswer. Future incompatible changes beneath public generated-model aliases now fail the compatibility check.

Validation

  • go test ./...
  • make pre-push
    • go fix ./...
    • gofmt
    • go vet ./...
    • Staticcheck
    • 99.9% coverage
    • reproducible generation
    • public and generated-alias API compatibility against v0.2.0
    • govulncheck (no vulnerabilities found)

@uffejaeger
uffejaeger marked this pull request as ready for review August 10, 2026 00:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/tools/filter-generated-api-diff/main.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +125 to +127
typeSpec, ok := rawSpec.(*ast.TypeSpec)
if !ok || !typeSpec.Assign.IsValid() {
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +153 to +154
if !ok || valueSpec.Type == nil || !valueSpecIsExported(valueSpec) {
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +404 to +407
} else if declaration.Type.Results != nil {
for _, result := range declaration.Type.Results.List {
symbolExpressions[declaration.Name.Name] = append(symbolExpressions[declaration.Name.Name], result.Type)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant