Skip to content

feat!: pass a catalog value newer than the client through - #25

Merged
robingenz merged 2 commits into
mainfrom
feat/open-catalogs
Nov 21, 2026
Merged

robingenz merged 2 commits into
mainfrom
feat/open-catalogs

Conversation

@robingenz

Copy link
Copy Markdown
Member

Summary

The client no longer fails a call because the API answers a catalog value it does not know. A value newer than the client passes through, as an unknown error code already does.

What changes

Catalog fields of returned models. Every one of the 32 catalog fields is typed Literal[...] | str, such as App.framework as Framework | str. Before, an unknown value raised a pydantic ValidationError for the whole call. Method arguments keep their closed types.

Release conditions. Release.conditions is a list of ReleaseCondition | UnknownCondition. A condition the client cannot read, such as one of a type newer than the client, arrives as the new UnknownCondition. It keeps its type, and its other fields are in model_extra. The conditions argument of apps.channels.releases.create takes only the five known models.

The known condition models are tried first. So a condition of a known type that lacks a required field is also read as an UnknownCondition, where it failed the call before. A condition without a type still fails the call.

Breaking for typed code

Nothing changes at runtime for the values the client knows. Code checked with mypy or pyright must change in these cases, and BREAKING.md shows each one:

  • code that handles every value of a catalog needs a branch for an unknown value
  • a value from a response must be narrowed before it goes into a method argument
  • code that handles every condition model needs a branch for UnknownCondition
  • a check of condition.type no longer narrows the model

Tests

One contract test answers every call with catalog values and condition types the client does not know. It fails when a response field is typed as a closed Literal again, and when UnknownCondition leaves the union. The existing contract test fails when the order of the union is turned around.

Verification

  • the format check, lint, mypy strict and the 780 tests pass
  • a second model reviewed both commits, and its findings are applied

🤖 Generated with Claude Code

robingenz and others added 2 commits November 21, 2026 06:30
Every catalog field of a returned model is typed `Literal[...] | str`. A
value the API adds later now arrives as it is, where the whole call raised
a `ValidationError` before. Method arguments keep their closed types, and
so does the `type` of a release condition.

One contract test answers every call with catalog values the client does
not know, so a response field typed as a closed `Literal` fails it.

BREAKING CHANGE: a catalog field of a returned model is typed `Literal[...] | str`. Code checked with mypy or pyright needs a branch for an unknown value, and must narrow a response value before it passes it to a method argument. See BREAKING.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ondition

A release that carries a condition of a type newer than the client can be
read again. The condition arrives as an `UnknownCondition`. It keeps its
`type`, and its other fields are in `model_extra`. Before, the whole call
raised a `ValidationError`. The `conditions` argument of
`apps.channels.releases.create` takes only the five known models.

The contract test now answers every condition with an unknown type too.

BREAKING CHANGE: `Release.conditions` is a list of `ReleaseCondition | UnknownCondition`. Code checked with mypy or pyright needs a branch for `UnknownCondition`, and a check of `condition.type` no longer narrows the model. See BREAKING.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@robingenz
robingenz marked this pull request as ready for review November 21, 2026 05:46
@robingenz
robingenz merged commit f9d8ed8 into main Nov 21, 2026
10 checks passed
@robingenz
robingenz deleted the feat/open-catalogs branch November 21, 2026 05:57
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