Skip to content

fix: raise the typed errors, and make the smoke suite exercise them - #42

Merged
gierschv merged 1 commit into
masterfrom
fix/typed-errors-and-smoke
Sep 10, 2026
Merged

fix: raise the typed errors, and make the smoke suite exercise them#42
gierschv merged 1 commit into
masterfrom
fix/typed-errors-and-smoke

Conversation

@gierschv

Copy link
Copy Markdown
Member

Follow-up to #41, found by running the smoke suite against production for the first time.

Typed errors were dead code

flat_api/errors.py defined FlatNotFoundError, FlatRateLimitError and the rest, plus a from_response mapper. Nothing called it. api_client.py still raised the generated ApiException subclasses, so a developer following the README and catching FlatNotFoundError caught nothing.

The smoke suite said so on its first real run:

FAIL typed-not-found: raised NotFoundException, not FlatNotFoundError
FAIL typed-auth-error: raised UnauthorizedException, not FlatAuthenticationError

tools/patches/20_errors.py wrote the module but never rewired the raise site. It does now, and stays idempotent.

Worth noting every other check passed while this was broken: coverage, docs, determinism, idempotency, the build matrix. Only a real request against a real API could catch it, which is the argument for the smoke suite existing.

Three runner fixes, all from running it

  • data must be base64. dataEncoding accepts nothing else, so raw text failed validation in the client.
  • createScore takes the ScoreCreation union, not a variant directly.
  • Pagination traverses listCollections rather than getUserScores: the latter returns only public scores and the score this run creates is private, so it traversed an empty list and proved nothing.

Also

The SDK_RELEASE_TOKEN assertion in tag-on-merge.yml moved above the checkout step. Below it, a missing secret surfaced as Input required and not supplied: token, naming neither the secret nor why it cannot be the automatic GITHUB_TOKEN.

Verified

Against production, with cleanup:

whoami ... ok                     create-score ... ok
read-score ... ok                 update-score-metadata ... ok
export-score ... ok               list-collections-paginated ... ok
typed-not-found ... ok            typed-auth-error ... ok
cleanup 6aa2ce7e... ... deleted
smoke: PASS

Patch idempotency passes.

Typed errors were dead code. `flat_api/errors.py` defined FlatNotFoundError,
FlatRateLimitError and the rest along with a from_response mapper, and nothing ever
called it: api_client.py still raised the generated ApiException subclasses. A developer
following the README and catching FlatNotFoundError caught nothing. Typed errors are most
of why an SDK is worth using over raw HTTP, and it is listed as a headline feature of the
2.0.0 rebuild.

tools/patches/20_errors.py wrote the module but never rewired the one raise site. It does
now, placing the import with the other first-party ones rather than above the module
docstring, and it is idempotent.

The smoke suite is what found this, on its first real run:

    FAIL typed-not-found: raised NotFoundException, not FlatNotFoundError
    FAIL typed-auth-error: raised UnauthorizedException, not FlatAuthenticationError

Three fixes to the runner itself, all from running it rather than reading it. `data` must
be base64: `dataEncoding` accepts nothing else, so the raw text failed validation in the
client. `createScore` takes the ScoreCreation union rather than a variant directly. And
the pagination scenario now traverses listCollections rather than getUserScores, because
the latter returns only public scores and the score this run creates is private, so it
traversed an empty list and proved nothing.

The SDK_RELEASE_TOKEN assertion in tag-on-merge.yml moved above the checkout step. Below
it, a missing secret surfaced as "Input required and not supplied: token", which names
neither the secret nor why it cannot be the automatic GITHUB_TOKEN.

Verified against production: whoami, create, read, update, export, paginate, both typed
errors, and cleanup deleting the score it created.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
馃摑 Code Review 鈿狅笍 Failed 2026-09-10T15:37:59.620505Z 8db4811 PR opened
鈩癸笍 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" or "@codex security review".

Codex reacts with 馃憖 while any review is running, comments if it has suggestions, and reacts with 馃憤 once all reviews finish with no findings.

@gierschv
gierschv merged commit 024fc34 into master Sep 10, 2026
5 checks passed
@gierschv
gierschv deleted the fix/typed-errors-and-smoke branch September 10, 2026 15:43
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