-
Notifications
You must be signed in to change notification settings - Fork 3k
refactor: centralize approval mode contracts #9796
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9d97622
refactor: centralize approval mode contracts
yiliang114 6de4222
fix: align Python SDK import grouping
yiliang114 acf260f
test: restore approval mode exports in CLI mocks
yiliang114 339effd
fix: close approval mode drift gaps
yiliang114 2eb610e
test(cli): preserve core exports in serve mocks
yiliang114 cb809b4
fix: close approval mode review gaps
yiliang114 809c368
test(cli): complete permission request fixture
yiliang114 ba664be
test(sdk): match approval mode route
yiliang114 f36d296
test(approval): close review coverage gaps
yiliang114 50b3928
test(sdk): cover approval mode global scope path
yiliang114 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Approval Mode Contract | ||
|
|
||
| ## Decision | ||
|
|
||
| Keep `ApprovalMode` and `APPROVAL_MODES` in core as the runtime source of | ||
| truth. TypeScript packages derive their local types and validators from either | ||
| that core contract or the TypeScript SDK's checked tuple. Python and Java keep | ||
| native public types, with their accepted values checked against a small JSON | ||
| fixture that is also checked against core. | ||
|
|
||
| This avoids adding a runtime dependency from the published SDKs to core and | ||
| does not introduce code generation for one five-value domain. | ||
|
|
||
| ## Changes | ||
|
|
||
| - Export the string-union form of core's `ApprovalMode`. | ||
| - Replace repeated TypeScript unions and validation arrays with the core or | ||
| SDK contract. | ||
| - Type the CLI and TypeScript SDK system-message `permission_mode` fields with | ||
| the shared union. | ||
| - Check core, TypeScript, Python, and Java accepted values against one fixture | ||
| in their existing test suites. | ||
| - Trigger the Python and Java SDK workflows when the fixture changes. | ||
|
|
||
| Adjacent value domains such as channel modes, hook permission decisions, and | ||
| desktop cycling preferences remain independent because their supported values | ||
| and semantics intentionally differ. | ||
|
|
||
| ## Verification | ||
|
|
||
| - Core approval-mode tests. | ||
| - CLI ACP and non-interactive type checking plus focused tests. | ||
| - TypeScript SDK drift and query-option tests. | ||
| - Python validation tests. | ||
| - Java permission-mode tests. | ||
| - Relevant lint, typecheck, and build commands. |
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
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
Oops, something went wrong.
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.