Skip to content

fix(api): make BugSource tolerant of unknown backend values - #274

Closed
sachiniyer wants to merge 1 commit into
mainfrom
siyer/tolerant-bug-source
Closed

sachiniyer wants to merge 1 commit into
mainfrom
siyer/tolerant-bug-source

Conversation

@sachiniyer

Copy link
Copy Markdown
Contributor

Summary

  • 0.2.0 hard-broke bugs list/show whenever a review's source field carried a backend value our vendored openapi.json hadn't seen yet (github_issue, bug_fix_check). fix: vendor updated openapi.json so BugSource accepts new backend variants #255 patched the spec reactively — but the next new value will break every released CLI in the wild the same way.
  • Drop the enum constraint from BugSource in the vendored openapi.json so progenitor generates a plain String for the field; unknown values now deserialize fine. The CLI never inspects this field, so the lost type safety costs nothing.
  • Teach cargo xtask {generate,check}-openapi to apply the same override after fetching upstream so future regenerations stay tolerant and CI's check-openapi stays green.
  • Adds a regression test in src/api/types.rs that deserializes a Bug with an invented review.source.

Test plan

  • cargo test --lib — new bug_with_unknown_review_source_deserializes test passes
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean
  • cargo build — progenitor regenerates BugReview with source: Option<String>
  • cargo xtask check-openapi against the live upstream (needs network)
  • cargo xtask generate-openapi then git diff openapi.json shows no enum reintroduction

🤖 Generated with Claude Code

0.2.0 hard-broke `bugs list/show` for any review carrying a `source`
the vendored openapi.json hadn't seen yet (`github_issue`,
`bug_fix_check`). #255 patched the spec reactively, but the next time
the backend adds a value, every released CLI in the wild will hit the
same wall.

Drop the `enum` constraint from `BugSource` in our vendored
openapi.json so progenitor generates a plain `String` instead of a
strict enum — unknown values now deserialize fine. The CLI never
inspects the field, so the lost type safety costs nothing.

Teach `cargo xtask {generate,check}-openapi` to apply the same
override after fetching upstream, so future regenerations don't
re-introduce the brittleness and CI's check-openapi stays green.

Adds a regression test in `src/api/types.rs` that deserializes a Bug
with an invented `review.source`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sachiniyer
sachiniyer temporarily deployed to integration-tests May 5, 2026 18:07 — with GitHub Actions Inactive

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

@sachiniyer

Copy link
Copy Markdown
Contributor Author

Closing — fix landed upstream, CLI doesn't need a change after all.

@sachiniyer sachiniyer closed this May 5, 2026
@sachiniyer
sachiniyer deleted the siyer/tolerant-bug-source branch May 5, 2026 18:10

This branch was previously deployed

1 inactive deployment
integration-tests — 23aaf9ee Deployed May 5, 2026 by sachiniyer via Integration #237
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