Skip to content

fix: export the error classes from sanka_sdk and show whoami fields - #38

Open
sanka-change-bot[bot] wants to merge 1 commit into
mainfrom
sdk-errors-whoami
Open

sanka-change-bot[bot] wants to merge 1 commit into
mainfrom
sdk-errors-whoami

Conversation

@sanka-change-bot

Copy link
Copy Markdown
Contributor

Summary

Gauge coding-agent evals (2026-11-20 07:30Z rerun, Qwen run cmwonov5l003a01j07jpd9n51) had to search the package to find UnauthorizedError and ApiError, because sanka_sdk exported neither (exclude_types_from_init_exports also hides errors) and sanka_sdk.errors/init.py is empty. Fern's additional_init_exports (fern/generators.yml and the config in scripts/generate_sdk.sh) now adds ApiError, BadRequestError, ForbiddenError, UnauthorizedError, UnprocessableEntityError and ErrorEnvelope to the root package; regenerated with fern-python-sdk 4.34.0, only src/sanka_sdk/init.py changed (lazy imports like the rest). The README example catches sanka_sdk.UnauthorizedError and prints identity.data.workspace_name and identity.data.permission_level, which agents had to dig out of nested generated types; the example was run against mocked 200 and 401 responses. The new test fails on main (AttributeError: no UnauthorizedError) and passes here. If a regeneration ever drops one of these error modules, the import fails loudly at first use; update the list then. Lines: 32 test, 84 non-test (38 config, 8 script, 18 generated init, 20 README).

Test Intent

  • tests/test_errors.py: a 401 from whoami not being catchable as sanka_sdk.UnauthorizedError / sanka_sdk.ApiError with an ErrorEnvelope body (the top-level exports the README tells users to import); owner: the Fern export config in fern/generators.yml and scripts/generate_sdk.sh

Audit

  • Requester: @haegwan
  • Authoring identity: Sanka Change Bot
  • Head SHA: d0355f029706d118f2d1d342a5064fb4f137317a
  • Risk: low
  • Deploy mode: none
  • Production surface: PyPI sanka-sdk (published separately by tag)

Validation

  • env PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin uv run --frozen -- python -W error -m unittest discover -s tests -> passed
  • No-local-check reason: N/A
  • Required GitHub checks must complete before landing.
  • Valid review findings must be addressed before landing.

Change Safety

  • Data or migration impact: None. Package exports and README only.
  • Rollback: Revert the merge commit; nothing is published until a release tag.
  • Monitoring: Repository deployment helper smoke checks.

Approval And Deployment Authorization

  • The PR is ready for final human review; no intended code changes remain.
  • The listed head SHA is the exact revision being presented for approval.

By approving this PR, the reviewer authorizes merge of the exact approved revision. This repository has no production deployment in this flow. A later push requires a new approval.

This branch has not been deployed

No deployments
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