You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f17d264
Browse filesBrowse the repository at this point in the historyBrowse files
feat: keep the generated stub path out of the public API surface (#12) (#14)
* feat: keep the generated stub path out of the public API surface
The per-language SDK repo is the distribution mechanism, so the generated
tree has to stay an implementation detail. It was not one: add_github_source,
list_sources, the three mint-side methods, attach and revision_request all
named saas_sdk._gen types, and datasource/work_context re-exported the whole
generated module as `pb` in __all__.
Each facade now re-exports the types it takes and returns — the generated
classes themselves, so isinstance and existing imports keep working — and
tests/test_api_boundary.py fails when a consumer-reachable signature names
the generated package again.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: close three gaps found reviewing the boundary gate
The README's mint example still built scopes through work_context.pb, which
is the exact import the change removes from the API surface — and the one a
consumer is most likely to copy, since it is the documented happy path for
minting. A signature gate cannot see it, so the examples are now checked too.
Two holes in the gate itself: a quoted annotation ("list[pb.Datasource]")
parsed as an opaque string constant and passed silently, and an empty facade
glob would have parametrized every check into nothing and reported green.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: close the star-import leak and three gaps in the boundary gate
authorization_revision declared no __all__, so `from
saas_sdk.authorization_revision import *` handed a consumer `pb` — the
generated module itself, and with it everything the gate was written to
fence off. The __all__ check could not see this: it only inspected modules
that already declared one, so it passed on the single module that leaked.
No __all__ is now a failure rather than a skip, and a runtime star-import
test asserts what Python actually exports, since that is the thing the
static read was wrong about.
Three further gaps, each demonstrated by restoring the defect it hides:
- _consumer_reachable walked only the top level and one level into a class,
so a public definition inside a try:/if block was invisible. This module
already defines its optional transports behind `try: import`, so the blind
spot sat directly on a pattern the package uses. It now recurses.
- identity was the only proof that a re-export aliases the proto, which
proves nothing for the three replay-policy enum values: they are small
ints, so `= 0` satisfies `is` through CPython's integer cache while
decoupling the constant from the proto and keeping a stale value across a
renumbering. The binding is now checked structurally.
- a non-literal __all__ raised AttributeError instead of failing with a
reason.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Antoine Toussaint <312536060+antoinetoussaint-byte@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments