Skip to content

feat(observability): log what diverged in review-time drift#738

Merged
Kiran01bm merged 1 commit into
mainfrom
kiran01bm/drift-divergence-logging
Jul 19, 2026
Merged

feat(observability): log what diverged in review-time drift#738
Kiran01bm merged 1 commit into
mainfrom
kiran01bm/drift-divergence-logging

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

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 PlanDiff never logged its resulting change set. Triaging a divergence meant connecting to the deployment's database and diffing it by hand.

What

  • Worker: LocalClient.PlanDiff logs its result mirroring the ExecutePlan convention — a response line with change_count, plus one line per table change with namespace/table/change type/DDL length (no DDL bodies).
  • Control plane: the diverged warn in the rollup now carries the comparator's diff items as structured attrs (diff_missing, diff_unexpected, and the vschema lists) — namespace[/shard].table operation per item, capped with a +N more overflow, 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.

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).
Copilot AI review requested due to automatic review settings July 16, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PlanDiff result 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.

Comment thread pkg/api/plan_review_drift_test.go
@Kiran01bm
Kiran01bm marked this pull request as ready for review July 16, 2026 11:39
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Kiran01bm
Kiran01bm merged commit 3d7ce99 into main Jul 19, 2026
33 checks passed
@Kiran01bm
Kiran01bm deleted the kiran01bm/drift-divergence-logging branch July 19, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants