Introduce access-review source snapshot and normalize naming
Decouple each campaign from the live access-review sources it was started with by introducing a per-campaign source snapshot table (access_review_campaign_sources). The snapshot captures the source name, category, and connector at start time, so a review remains coherent even after the underlying source is edited or deleted. Fetch tracking becomes an append-only log (access_review_campaign_source_fetch_attempts) that preserves every attempt with its own status and error rather than overwriting a single row. Rename the shared access-review tables and enums to use a consistent access_review_ prefix throughout: access_entries → access_review_entries access_sources → access_review_sources access_source_category → access_review_source_category access_entry_* → access_review_entry_* The same rename propagates to every coredata type, service, GraphQL schema, MCP specification, CLI command, frontend component, and e2e test. The accessreview package gains dedicated actions.go and policies.go files for its own IAM policy set, mirroring the agentrun package pattern. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -25,8 +25,8 @@ import (
|
||||
)
|
||||
|
||||
const createMutation = `
|
||||
mutation($input: CreateAccessSourceInput!) {
|
||||
createAccessSource(input: $input) {
|
||||
mutation($input: CreateAccessReviewSourceInput!) {
|
||||
createAccessReviewSource(input: $input) {
|
||||
accessSourceEdge {
|
||||
node {
|
||||
id
|
||||
@@ -38,14 +38,14 @@ mutation($input: CreateAccessSourceInput!) {
|
||||
`
|
||||
|
||||
type createResponse struct {
|
||||
CreateAccessSource struct {
|
||||
AccessSourceEdge struct {
|
||||
CreateAccessReviewSource struct {
|
||||
AccessReviewSourceEdge struct {
|
||||
Node struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"node"`
|
||||
} `json:"accessSourceEdge"`
|
||||
} `json:"createAccessSource"`
|
||||
} `json:"createAccessReviewSource"`
|
||||
}
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -127,7 +127,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
s := resp.CreateAccessSource.AccessSourceEdge.Node
|
||||
s := resp.CreateAccessReviewSource.AccessReviewSourceEdge.Node
|
||||
out := f.IOStreams.Out
|
||||
_, _ = fmt.Fprintf(out, "Created access source %s\n", s.ID)
|
||||
_, _ = fmt.Fprintf(out, "Name: %s\n", s.Name)
|
||||
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
)
|
||||
|
||||
const deleteMutation = `
|
||||
mutation($input: DeleteAccessSourceInput!) {
|
||||
deleteAccessSource(input: $input) {
|
||||
deletedAccessSourceId
|
||||
mutation($input: DeleteAccessReviewSourceInput!) {
|
||||
deleteAccessReviewSource(input: $input) {
|
||||
deletedAccessReviewSourceId
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -81,7 +81,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
deleteMutation,
|
||||
map[string]any{
|
||||
"input": map[string]any{
|
||||
"accessSourceId": args[0],
|
||||
"accessReviewSourceId": args[0],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -24,11 +24,11 @@ import (
|
||||
)
|
||||
|
||||
const listQuery = `
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: AccessSourceOrder) {
|
||||
query($id: ID!, $first: Int, $after: CursorKey, $orderBy: AccessReviewSourceOrder) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on Organization {
|
||||
accessSources(first: $first, after: $after, orderBy: $orderBy) {
|
||||
accessReviewSources(first: $first, after: $after, orderBy: $orderBy) {
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
@@ -125,8 +125,8 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
func(data json.RawMessage) (*api.Connection[sourceNode], error) {
|
||||
var resp struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
AccessSources api.Connection[sourceNode] `json:"accessSources"`
|
||||
Typename string `json:"__typename"`
|
||||
AccessReviewSources api.Connection[sourceNode] `json:"accessReviewSources"`
|
||||
} `json:"node"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
@@ -141,7 +141,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
return &resp.Node.AccessSources, nil
|
||||
return &resp.Node.AccessReviewSources, nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
)
|
||||
|
||||
const updateMutation = `
|
||||
mutation($input: UpdateAccessSourceInput!) {
|
||||
updateAccessSource(input: $input) {
|
||||
mutation($input: UpdateAccessReviewSourceInput!) {
|
||||
updateAccessReviewSource(input: $input) {
|
||||
accessSource {
|
||||
id
|
||||
name
|
||||
@@ -36,12 +36,12 @@ mutation($input: UpdateAccessSourceInput!) {
|
||||
`
|
||||
|
||||
type updateResponse struct {
|
||||
UpdateAccessSource struct {
|
||||
AccessSource struct {
|
||||
UpdateAccessReviewSource struct {
|
||||
AccessReviewSource struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"accessSource"`
|
||||
} `json:"updateAccessSource"`
|
||||
} `json:"updateAccessReviewSource"`
|
||||
}
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -80,7 +80,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
)
|
||||
|
||||
input := map[string]any{
|
||||
"accessSourceId": args[0],
|
||||
"accessReviewSourceId": args[0],
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("name") {
|
||||
@@ -113,7 +113,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("cannot parse response: %w", err)
|
||||
}
|
||||
|
||||
s := resp.UpdateAccessSource.AccessSource
|
||||
s := resp.UpdateAccessReviewSource.AccessReviewSource
|
||||
|
||||
if *flagOutput == cmdutil.OutputJSON {
|
||||
return cmdutil.PrintJSON(f.IOStreams.Out, s)
|
||||
|
||||
@@ -28,7 +28,7 @@ const viewQuery = `
|
||||
query($id: ID!) {
|
||||
node(id: $id) {
|
||||
__typename
|
||||
... on AccessSource {
|
||||
... on AccessReviewSource {
|
||||
id
|
||||
name
|
||||
connectorId
|
||||
@@ -97,8 +97,8 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
return fmt.Errorf("access source %s not found", args[0])
|
||||
}
|
||||
|
||||
if resp.Node.Typename != "AccessSource" {
|
||||
return fmt.Errorf("expected AccessSource node, got %s", resp.Node.Typename)
|
||||
if resp.Node.Typename != "AccessReviewSource" {
|
||||
return fmt.Errorf("expected AccessReviewSource node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
if *flagOutput == cmdutil.OutputJSON {
|
||||
|
||||
Reference in New Issue
Block a user