Repository navigation
Conversation
… renderer [RED-1547] The deploy preview's construct diff (render both sides with the import codegen, mark moved secrets with sentinels, diff the texts, add the content diffs and notes) moves into construct-diff.ts with explicit before and after sides, labels, render settings and an origin note, so another caller can render a diff between two import-format sides. The preview keeps its output: render.ts supplies its labels, its project registration, the loaded project's defaults and its CLI-upgrade note. import-shape.ts exports substitute() and the reference key tables for the same reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odegen [RED-1547] generateConstructDiff takes a resource as Checkly holds it now, in the import format, and the changes the deploy diff reports for it since the last deploy, rebuilds the deployed side from them and renders the two as a construct diff with the import codegen, deployed first. Properties that differ are spelled out on both sides, so a change to or from a default reads as a changed line; secrets are masked on both sides; a change it cannot place (an object set, a key the import format lacks, an unknown reference, a hashed value whose deployed text is gone) becomes a note rather than a guess. Rendering failures fall back to a listing, the entry stays free of side effects, and the deploy preview is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-1547] The backend reports an object removed since the deploy by its leaves alone, with no change at the object's own path, so the rebuild of the deployed side had no container to create it under and noted each leaf instead. It now recreates an absent node under an object the payload holds when every change under it restores a leaf that decodes, none passes through a list index, and none is a set element, recognised by its key being a prefix of the digest the backend keys set elements by. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1547] generateConstructDiff now takes the resource as its last deploy left it (`deployed`, in the deploy payload's vocabulary) instead of rebuilding it by undoing each reported change on the current resource. Positions no change reaches equal the current resource; a reported value comes from its change's masked `before`; sets, objects and lists removed in Checkly are taken from the deployed resource, so they render as diff lines instead of notes. The undo heuristics are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ults are given [RED-1547]
generateConstructDiff defaulted projectDefaults to {}, a project without
defaults, so a property at its default value was left out. With no
defaults given, it now writes every property, as generateConstructFiles
does for the same option, so the diff reads like the code generated for
the resource. Passing {} keeps the previous output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
generateConstructDiff masked every value a redaction rule reaches, so an
empty password rendered as '********' with a basicAuth block the
resource does not have. In the drift diff an unconditional rule (a
password, a header value) now leaves an empty value ('', null or absent)
as it is. A conditional rule (a locked or secret variable) still masks
whatever the value, since such a variable read without decrypting holds
null. The deploy preview and write-back keep masking empty values: there
the API blanks credentials to '', so an empty value cannot be told from
a blanked one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Affected Components
Notes for the Reviewer
Adds
generateConstructDiffto the experimentalcheckly/codegenentry (RED-1547). Given a resource as Checkly holds it now (import format), the resource as its last deploy left it (deployed, in the deploy payload's vocabulary) and the changes the deploy diff reports between the two, it renders deployed (−) → current (+) as a construct diff with the import codegen, the waycheckly deploy's preview shows a construct diff. Checkly's backend will use it to show drift as code in the web app.Commits.
render.tsintoconstruct-diff.ts. The deploy preview's output is unchanged; its specs pass without edits.codegen/diff.ts(the public function andGenerateDiff*types) overdeploy-diff/drift.ts.deployedinput instead of undoing each change on the current resource, which could not restore structure the current resource no longer holds.projectDefaults, the diff writes every property, asgenerateConstructFilesdoes, so it reads like the code generated for the resource;{}keeps the previous output.How the deployed side is built (
deployedSide).before(an object set to null, a set emptied) is built fromdeployed, each leaf from its change.before, which is masked across both sides, so a variable locked since the deploy never shows its old value.deployedin the current order;intentis taken whole (the two vocabularies spell it differently); objects and lists removed in Checkly are restored fromdeployedand render as diff lines.Input contract for callers.
deployedmasks every position that is sensitive at the deploy or now as{ $masked: 'same' }; other values known only by hash are{ $hash };referencescovers every resource the changes ordeployedrefer to by logical id. The function never mutates its inputs and never throws for a rendering failure (falls back to a listing with a reason).Validated against real data. A fixture captured from a local environment with the backend's own functions (API and browser check: intent edits, headers, a variable locked since the deploy, legacy
doubleCheck, a long script, a group reference, removed alert reminders, location and tag changes) is committed and rendered indiff.spec.ts.Known limits (v1). Relation drift (subscriptions, assignments) is not an input yet. A whole list added in Checkly whose secret elements cannot be marked inline gets a
secret changed:note, as in the preview. A text changed in Checkly whose deployed version is known only by its hash is noted as unavailable.Tests
pnpm --filter checkly test(pack, type tests, all vitest): passes.codegen/__tests__/diff.spec.ts(incl. the captured fixturefixtures/drift.json),deploy-diff/__tests__/drift.spec.ts(incl.deployedSidecases) (incl. a coverage table and call-site scan of everyspelledOut(/spelledOutUnder(in the codegens),construct-diff.spec.ts, acontext: Infinitycase indiff-lines.spec.ts, and v2/v3 status page cases inrender.spec.ts.🤖 Generated with Claude Code