-
Notifications
You must be signed in to change notification settings - Fork 156
Release v0.3.1 #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akhil-vamshi-konam
wants to merge
3
commits into
main
Choose a base branch
from
release-v0.3.1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Release v0.3.1 #205
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # toolkit | ||
|
|
||
| Shared building blocks for the tool surface, split by *when* they act. All re-exported from `__init__.py`, so a resource module needs one import. | ||
|
|
||
| | Module | Acts at | Provides | | ||
| |---|---|---| | ||
| | `spec.py` | declaration | `Action`, `build_description`, `build_annotations` | | ||
| | `runtime.py` | call | `missing`, `needs`, `require`, `one_of`, `opt`, `coerce_list`, `page_params`, `as_params`, `ids_of` | | ||
| | `paging.py` | response | `envelope`, `dump_results`, `pql_failure`, `workitem_page` | | ||
| | `governance.py` | policy | `workspace_owns_resource`, `workspace_owns`, `scoped`, `plan_gated` | | ||
| | `transforms.py` | listing | `StripOutputSchemas` | | ||
|
|
||
| Nothing here knows which catalogue is calling it. Anything encoding this server's own history — the `RESOURCES` tuple, retired names — lives under `tools/`. | ||
|
|
||
| ## Workspace governance | ||
|
|
||
| Plane can move a resource's catalogue from the project to the workspace. Which scope owns it decides where writes go, and the wrong scope is refused in **both** directions: | ||
|
|
||
| | Write | Refused with | Means | | ||
| |---|---|---| | ||
| | project-scoped, workspace owns it | `workspace_managed` | omit `project_id` | | ||
| | catalogue, project still owns it | `workspace_not_managed` | pass `project_id` | | ||
|
|
||
| **There is no single flag.** `GOVERNED_BY` maps each resource to the one that governs it: | ||
|
|
||
| | Resource | Flag | | ||
| |---|---| | ||
| | work item types, epics, properties | `work_item_types` | | ||
| | states, labels, workflows, templates, automations | `states_owned_by_workspace` | | ||
|
|
||
| A workspace can own one and not the other, so never read one flag for the other resource. | ||
|
|
||
| **Two ways to ask, both needed:** | ||
|
|
||
| | Call | Reads | Use | | ||
| |---|---|---| | ||
| | `workspace_owns_resource(client, slug, resource)` | the flag | pick a scope *before* writing | | ||
| | `workspace_owns(exc, *fields)` | the refusal | after — the flag is cached and the lockout outlives it being toggled off | | ||
|
|
||
| ### Adding a newly governed resource | ||
|
|
||
| 1. **Add a row to `GOVERNED_BY`** naming its flag. | ||
| 2. **Decorate the tool with `@scoped("<noun>")`**, below `@mcp.tool`. Either refusal becomes a message naming the scope that owns it. Where the API refuses by field rather than code — work item types do — pass the field: `@scoped("work item types", "work_item_types")`. | ||
| 3. **Resolve the scope once** at the top of the dispatch, not per call site. Shape is yours: `workitem_type` returns a tuple, `state` and `workitem_property` a small local `_Scope`. | ||
| 4. **Refuse fields the other scope lacks.** A catalogue state has no ordering, triage flag or default; sent anyway they are dropped in silence, which reads as success. | ||
|
|
||
| `workitem_type resolve` is the worked ask-first example: reads the flag, adopts the type from the catalogue, imports it into the project — and still handles the refusal in case the flag is stale. | ||
|
|
||
| `test_a_wrong_scope_refusal_is_answered_not_raised` drives a real refusal through every scoped resource, so step 2 cannot be forgotten. | ||
|
|
||
| ## Plan gates | ||
|
|
||
| `@plan_gated("<feature>")` turns a 402 — or a 400 whose prose says "upgrade your plan" — into a message naming the feature, rather than an error a caller will retry. The argument is the fallback label: where the refusal names the feature itself, that wins, since one resource can trip several gates (`project` trips five). |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.