Skip to content

fix(github): explain empty-diff apply reconciliation#335

Draft
aparajon wants to merge 4 commits into
mainfrom
armand/fix-config-discovery-truncated
Draft

fix(github): explain empty-diff apply reconciliation#335
aparajon wants to merge 4 commits into
mainfrom
armand/fix-config-discovery-truncated

Conversation

@aparajon

Copy link
Copy Markdown
Collaborator

Why

When a PR no longer contains managed schema files after an apply has started, SchemaBot should fail closed with clear reconciliation guidance instead of falling through to broad repository discovery or implying the PR is clean.

What

  • Add empty-diff reconciliation handling for plan/apply/apply-confirm PR commands
  • Render distinct guidance for in-progress vs completed apply-owned state
  • Add preview scenarios and update the generated template snapshot

Risk Assessment

Medium — this changes GitHub PR-command behavior for a safety-gate edge case, but only when the current PR has no managed schema files and stored apply-owned state exists.

Generated with Amp

Copilot AI review requested due to automatic review settings June 14, 2026 01:17

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

Adds explicit “empty diff” reconciliation behavior for SchemaBot PR commands so that when a schema apply has started (or completed) but the current PR no longer contains managed schema files, SchemaBot fails closed with actionable guidance rather than falling back to broad repository discovery.

Changes:

  • Introduces reconciliation templates for “no managed schema changes” and “reconciliation required” (in-progress vs completed apply).
  • Adds a webhook guard (handleNoManagedSchemaChangesForCommand) used by plan, apply, and apply-confirm to detect empty-diff + apply-owned state and post guidance.
  • Extends preview scenarios/templates and adds E2E/unit tests for the new empty-diff behaviors (plan/apply covered).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TEMPLATES.md Adds rendered template snapshots for no-managed and reconciliation-required scenarios.
pkg/webhook/webhook_e2e_test.go Adds E2E coverage for empty-diff reconciliation behavior (plan/apply).
pkg/webhook/templates/reconciliation.go Implements new comment renderers for no-managed changes and reconciliation-required guidance.
pkg/webhook/templates/reconciliation_test.go Unit tests for the reconciliation templates.
pkg/webhook/templates/preview.go Adds preview helpers for the new reconciliation comment scenarios.
pkg/webhook/schema_reconciliation.go Adds the empty-diff guard + stored-state lookup to decide between “no managed changes” vs “reconcile”.
pkg/webhook/schema_reconciliation_test.go Unit tests for PR-file detection and reconciliation item derivation.
pkg/webhook/plan.go Runs the empty-diff reconciliation guard before schema discovery for plan.
pkg/webhook/apply_handlers.go Runs the empty-diff reconciliation guard before schema discovery for apply and apply-confirm.
pkg/webhook/check_runs.go Updates the user-facing block message for schema-removed-after-apply state.
pkg/cmd/internal/templates/preview.go Adds new preview type constants for the reconciliation scenarios.
pkg/cmd/internal/templates/preview_dispatch.go Dispatches the new preview types to the webhook template previews.
pkg/cmd/internal/templates/preview_comment.go Includes the new previews in “all comment previews” output.
pkg/cmd/commands/preview.go Wires the new preview types into CLI help and routing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/webhook/templates/preview.go
Comment thread pkg/webhook/templates/preview.go
Comment thread pkg/webhook/apply_handlers.go
@aparajon aparajon force-pushed the armand/fix-config-discovery-truncated branch from 9541932 to 3c13cae Compare June 14, 2026 01:21
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.

2 participants