feat(observability): log what diverged in review-time drift#738
Merged
Conversation
Make a diverged deployment triageable from logs alone: the worker's PlanDiff logs its resulting change set (mirroring ExecutePlan), and the control plane's diverged warn carries the comparator's diff items (table + operation, capped, no DDL bodies).
There was a problem hiding this comment.
Pull request overview
This PR improves observability for review-time drift by logging the specific change-set differences when a deployment is classified as diverged, making drift triage possible from logs without including raw DDL bodies.
Changes:
- Worker: added structured
PlanDiffresult logging (change count + per-table change metadata with DDL length). - Control plane: enhanced “deployment diverged” warn logs to include capped, formatted diff item lists (missing/unexpected changes and vschema differences).
- Tests: added unit tests covering diff attribute rendering, omission of empty lists, and overflow capping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/tern/local_client.go | Logs PlanDiff output similarly to Plan, including per-table change metadata without DDL bodies. |
| pkg/api/plan_review_drift.go | Adds diff formatting helpers and includes diff attrs in diverged drift warn logs with item caps/overflow. |
| pkg/api/plan_review_drift_test.go | Adds tests for diff log attribute formatting behavior (including caps/omissions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Kiran01bm
marked this pull request as ready for review
July 16, 2026 11:39
Kiran01bm
requested review from
aparajon,
eeSeeGee,
jayjanssen and
morgo
as code owners
July 16, 2026 11:39
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
aparajon
approved these changes
Jul 18, 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.
Summary
When the review-time drift rollup classifies a deployment as diverged, neither side of the system logged what diverged — the control plane warn named the deployment but not the differing change-set items, and the worker's
PlanDiffnever logged its resulting change set. Triaging a divergence meant connecting to the deployment's database and diffing it by hand.What
LocalClient.PlanDifflogs its result mirroring theExecutePlanconvention — a response line withchange_count, plus one line per table change with namespace/table/change type/DDL length (no DDL bodies).diff_missing,diff_unexpected, and the vschema lists) —namespace[/shard].table operationper item, capped with a+N moreoverflow, empty lists omitted.Why
With both, the triage question "what would the diverged deployment run that the reviewed plan doesn't say?" is answerable from either side's logs alone, keeping raw DDL bodies out of log lines per the existing convention.