feat: add plans and masking policy clients - #26
Merged
Conversation
Two of the gaps between the SDK and the API. The Python package tracks the
newest primitives well - sets and keymaps are both current - but had nothing
for Plans or masking, which are the governed path the product now leads with.
client.plans.get_plans() / get_plan() / update_plan() / delete_plan()
client.masking_policies.get_masking_policies() / get_masking_policy()
/ create_masking_policy() / update_masking_policy()
/ delete_masking_policy()
Both mirror the shapes in the API's OpenAPI document, and the method names
match the resource clients that were already here so nothing new has to be
learned.
Two behaviours are documented rather than smoothed over, because an SDK that
quietly disagrees with its server is worse than one that reports it:
- `delete_plan` answers `{"success": true}`, not the `{"message": ...}` every
other resource returns. Returned as-is; normalising the wire shape is the
API's decision, not the SDK's.
- `create_masking_policy` sends only the arguments the caller actually set, so
the API applies its own defaults for `consistent` and `reversible`. Sending
nulls would override them.
The plan RUN endpoints are deliberately absent: they carry artifacts, logs and
multi-step state that the API does not yet describe in its spec, and guessing
their shape is how an SDK ends up confidently wrong.
69 tests pass, 24 skipped, unchanged from before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two of the gaps between this SDK and the API. The package tracks the newest primitives well -
setsandkeymapsare both current - but had nothing for Plans or masking policies, which are the governed path the product now leads with.client.plansget_plansget_planupdate_plandelete_planclient.masking_policiesget_masking_policiesget_masking_policycreate_masking_policyupdate_masking_policydelete_masking_policyBoth mirror the shapes in the API's OpenAPI document (automators-com/datamaker#2879), and the method names match the resource clients already here.
Two behaviours documented rather than smoothed over
delete_plananswers{"success": true}, not the{"message": ...}every other resource returns. Returned as-is. Normalising the wire shape is the API's decision, and an SDK that hides the difference makes the eventual fix harder to reason about.create_masking_policysends only what the caller set, so the API applies its own defaults forconsistentandreversible. Sending explicit nulls would override them - a subtle way to get non-consistent masking without asking for it.The docstring for
reversiblealso spells out that it only means anything alongsidekey_map_name, since that pairing is easy to miss.Deliberately absent
The plan run endpoints (
/plans/{id}/run,/runs,/signoffs). They carry artifacts, logs and multi-step state that the API does not yet describe in its spec, and guessing their shape is how an SDK ends up confidently wrong.Verification
ruff check --select F,E9clean on both new modules;ruff format --checkreports them already formatted. The remaining default-ruleset complaints areUP006/UP045pyupgrade suggestions that the entire package shares (sets.pyhas the same 23), so the new files match house style rather than diverging from it.