Add campaign check sync support - #644
Merged
Merged
Conversation
Regenerated against the current public GraphQL schema, which now exposes sourceCheck on Check (jklabsinc/OpsLevel!19828) -- the check a campaign copy was made from. Uses the existing lightweight CheckId type, same pattern as other Check-returning-Check-shaped fields, to avoid unbounded recursive selection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Regenerated against the schema now exposing createdChecks on checksCopyToCampaign (jklabsinc/OpsLevel!19906) -- the checks that a given copy call created, as opposed to campaign.checks which is every check on the campaign. The Terraform provider needs this to identify the check it just created. Matching campaign checks on sourceCheck is ambiguous whenever two copies of the same source check exist on one campaign, which happens without any concurrency if a copy was previously made via the UI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ampaign check nodes CopyChecksToCampaign now returns (*Campaign, []Check, error). The created checks identify the new copies unambiguously; matching campaign checks on sourceCheck cannot, because a campaign may already hold another copy of the same source check -- which happens with no concurrency at all if a copy was previously made through the UI. This is a breaking signature change. It follows the client's existing convention for payloads carrying more than one useful field, as RunnerGetPendingJob does with (*RunnerJob, ID, error), rather than exposing the payload type, which no method in this client does. CampaignCheckNode also gains SourceCheck so ListCampaignChecks can report where each campaign check was copied from. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Terraform provider's opslevel_campaign_check resource needs the campaign a copied check belongs to, so that importing a campaign check can take a bare check id rather than a composite campaign_id:check_id string. Check.Campaign is typed as CampaignId rather than Campaign. The full type would drag the entire campaign selection -- checkStats, reminder and its nine subfields, both stat blocks -- into every check read, per check, per page, to obtain one id. It would also terminate only by accident: Campaign has no Checks field today, but adding one would close a Check -> Campaign -> Checks -> Check cycle and blow up every check query. CampaignId cannot participate in such a cycle. Campaign now embeds CampaignId rather than declaring its own Id and Name, following the same pattern as CustomActionsExternalAction and CustomActionsId. Both fields remain accessible through promotion, so this is not a breaking change for consumers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CheckCreateInput.EnableOn and CheckUpdateInput.EnableOn both carried mapstructure:"enabledOn" while their JSON tags were "enableOn". The type-specific check inputs they are decoded into have no mapstructure tag, so they match on field name EnableOn. mapstructure compares case-insensitively, and "enabledon" != "enableon", so NewCheckCreateInputTypeOf and NewCheckUpdateInputTypeOf silently discarded the value -- no error, no warning, the field simply never arrived. The failure mode is the damaging kind: the mutation succeeds without the field, so a caller sees success while the value never reached the API. Latent until now, since both helpers were only exercised by tests and no test asserted on EnableOn. The Terraform provider's forthcoming opslevel_campaign_check resource is the first real consumer, and enable_on is part of its editable surface. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jasonopslevel
approved these changes
Aug 27, 2026
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.
MATTER-86
Summary
Check.Campaignvia a new lightweightCampaignIdtypeCopyChecksToCampaign, and addSourceCheckto campaign check nodesChecksCopyToCampaignPayload.CreatedChecks(generated) andCheck.SourceCheck(generated)EnableOnbeing silently dropped when converting check inputsTest plan
go build ./...go test ./...Had claude write a manual test: