-
Notifications
You must be signed in to change notification settings - Fork 15
refactor: replace selectors with a single selector field in policy sc… #794
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
Changes from all commits
cb40d5f
dba161b
460772e
7f5e5fe
8229754
e16ebe9
305c166
68277cb
efeb147
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -858,7 +858,8 @@ export interface components { | |
| name: string; | ||
| priority?: number; | ||
| rules?: components["schemas"]["PolicyRule"][]; | ||
| selectors?: components["schemas"]["PolicyTargetSelector"][]; | ||
| /** @description CEL expression for matching release targets. Use "true" to match all targets. */ | ||
| selector?: string; | ||
| }; | ||
| CreateRelationshipRuleRequest: { | ||
| description?: string; | ||
|
|
@@ -1212,7 +1213,8 @@ export interface components { | |
| name: string; | ||
| priority: number; | ||
| rules: components["schemas"]["PolicyRule"][]; | ||
| selectors: components["schemas"]["PolicyTargetSelector"][]; | ||
| /** @description CEL expression for matching release targets. Use "true" to match all targets. */ | ||
| selector: string; | ||
| workspaceId: string; | ||
| }; | ||
| PolicyRequestAccepted: { | ||
|
|
@@ -1232,12 +1234,6 @@ export interface components { | |
| verification?: components["schemas"]["VerificationRule"]; | ||
| versionCooldown?: components["schemas"]["VersionCooldownRule"]; | ||
| }; | ||
| PolicyTargetSelector: { | ||
| deploymentSelector?: components["schemas"]["Selector"]; | ||
| environmentSelector?: components["schemas"]["Selector"]; | ||
| id: string; | ||
| resourceSelector?: components["schemas"]["Selector"]; | ||
| }; | ||
| PropertyMatcher: { | ||
| fromProperty: string[]; | ||
| /** @enum {string} */ | ||
|
|
@@ -1515,15 +1511,16 @@ export interface components { | |
| }; | ||
| UpsertPolicyRequest: { | ||
| description?: string; | ||
| enabled?: boolean; | ||
| enabled: boolean; | ||
| /** @description Arbitrary metadata for the policy (record<string, string>) */ | ||
| metadata?: { | ||
| metadata: { | ||
| [key: string]: string; | ||
| }; | ||
| name: string; | ||
| priority?: number; | ||
| rules?: components["schemas"]["PolicyRule"][]; | ||
| selectors?: components["schemas"]["PolicyTargetSelector"][]; | ||
| priority: number; | ||
| rules: components["schemas"]["PolicyRule"][]; | ||
| /** @description CEL expression for matching release targets. Use "true" to match all targets. */ | ||
| selector: string; | ||
|
Comment on lines
1512
to
+1523
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n 'PolicyTargetSelector' --type=tsRepository: ctrlplanedev/ctrlplane Length of output: 435 🏁 Script executed: cat -n apps/web/app/api/openapi.ts | sed -n '1512,1523p'Repository: ctrlplanedev/ctrlplane Length of output: 667 🏁 Script executed: # Also check if PolicyTargetSelector is defined anywhere in the file
rg -n 'PolicyTargetSelector' apps/web/app/api/openapi.ts -C3Repository: ctrlplanedev/ctrlplane Length of output: 48 🏁 Script executed: # Check a wider context around lines 1512-1523 to see the old structure (if any) and confirm the current state
cat -n apps/web/app/api/openapi.ts | sed -n '1500,1550p'Repository: ctrlplanedev/ctrlplane Length of output: 2229 🏁 Script executed: cd apps/web/app/api && git diff HEAD -- openapi.ts | head -150Repository: ctrlplanedev/ctrlplane Length of output: 48 🏁 Script executed: # Also check if there's a commit message or PR info that confirms what changed
git log --oneline -20 -- apps/web/app/api/openapi.tsRepository: ctrlplanedev/ctrlplane Length of output: 149 🏁 Script executed: git show cb40d5f9:apps/web/app/api/openapi.ts | sed -n '1500,1550p'Repository: ctrlplanedev/ctrlplane Length of output: 1872 🏁 Script executed: # Show the actual commit diff for the UpsertPolicyRequest section
git show cb40d5f9 -- apps/web/app/api/openapi.ts | grep -A50 "UpsertPolicyRequest"Repository: ctrlplanedev/ctrlplane Length of output: 3649 🏁 Script executed: # Show the actual diff (before and after) for this commit
git show cb40d5f9 -- apps/web/app/api/openapi.ts | grep -B20 -A20 "UpsertPolicyRequest" | head -100Repository: ctrlplanedev/ctrlplane Length of output: 2850 🏁 Script executed: # Check the previous version of the file to see what UpsertPolicyRequest looked like before
git show cb40d5f9^:apps/web/app/api/openapi.ts 2>/dev/null | grep -A30 "UpsertPolicyRequest:" || echo "Pattern not found or commit has no parent"Repository: ctrlplanedev/ctrlplane Length of output: 107 🏁 Script executed: # Check git log to see if there's a prior version with 'selectors' instead of 'selector'
git log --all --oneline -p -- apps/web/app/api/openapi.ts | grep -B5 -A15 "selectors.*PolicyTargetSelector" | head -50Repository: ctrlplanedev/ctrlplane Length of output: 1666 🏁 Script executed: # Also check if this file is auto-generated by looking for a generation script or header
head -20 apps/web/app/api/openapi.tsRepository: ctrlplanedev/ctrlplane Length of output: 570 Breaking API change: This is a breaking change for existing API consumers:
Existing clients calling the upsert endpoint without these fields will receive validation errors. Ensure all known consumers are updated and that API versioning or migration documentation addresses this breaking change. Note: 🤖 Prompt for AI Agents |
||
| }; | ||
| UpsertRelationshipRuleRequest: { | ||
| description?: string; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 5300
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 1326
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 48
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 3369
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 1437
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 1891
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 93
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 990
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 1041
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 48
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 48
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 1229
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 870
UpsertPolicyRequestrequires all major fields; this is a breaking API change from create behavior.The
enabled,metadata,priority,rules, andselectorfields are now all required in upsert payloads. Unlike thecreatePolicyhandler (which provides defaults:enabled: true,priority: 0,metadata: {},selector: "true"), theupsertPolicyhandler has no such defaults—it extracts fields directly from the request body. Clients that previously relied on optional defaults for partial upsert payloads will receive validation errors. This is an intentional asymmetry between create and upsert semantics, but callers (SDKs, internal services, or direct API consumers) must be updated to provide all required fields.🤖 Prompt for AI Agents