Skip to content

test: diff cross-cutting / order-sensitivity pins#89

Merged
winebarrel merged 1 commit into
mainfrom
test-diff-cross-cutting
May 5, 2026
Merged

test: diff cross-cutting / order-sensitivity pins#89
winebarrel merged 1 commit into
mainfrom
test-diff-cross-cutting

Conversation

@winebarrel

Copy link
Copy Markdown
Owner

Summary

Fourth item from the PR #84 postmortem audit (TODO.md "Medium — test coverage audit", item 4). Mutators in the diff layer run in sequence on the same current map (table renames → column renames → cross-table FK ref rewrites → diffTable). Existing rename_test.go covers 1-to-1 cases; pin three open shapes where multiple kinds of change interact.

  • error_column_rename_destination_exists.yml — catalog has both old_name and name; desired says "renamed-from old_namename" but name already exists. The guard in applyColumnRenames refuses with destination already exists rather than silently clobbering one of the two columns. Pinned via the error: field of the YAML harness.
  • index_rename_with_unrelated_drop.yml — rename one index AND drop a different index in the same plan. Both pass through the Stmts bucket; the diff orders them rename-first / drop-after so the resulting plan is two clean ALTER TABLEs that compose without interfering.
  • bulk_alter_partition_with_charset_and_column.ymlREORGANIZE PARTITION must stay its own ALTER under --bulk-alter (partition ops excluded per CAVEATS) while DEFAULT CHARSET + ADD COLUMN fold together. Three change kinds in one diff covering the bulk-alter excluded-set / combinable-set boundary. verify_no_drift: false matches change_table_charset.yml's baseline (DEFAULT CHARSET + string columns converges in two applies).

Test plan

  • All three new fixtures pass.
  • make lint clean.
  • make test all six packages green.

🤖 Generated with Claude Code

Fourth item from the PR #84 postmortem audit. Mutators in the diff
layer run in sequence on the same `current` map (table renames →
column renames → cross-table FK ref rewrites → diffTable). Existing
rename_test.go covers 1-to-1 cases; pin three open shapes where
multiple kinds of change interact.

- error_column_rename_destination_exists.yml: catalog has both
  `old_name` and `name`; desired says
  "renamed-from old_name → name" but `name` already exists. The
  guard in applyColumnRenames refuses with "destination already
  exists" rather than silently clobbering one of the two columns.
- index_rename_with_unrelated_drop.yml: rename one index AND drop
  a different index in the same plan. Both pass through the
  `Stmts` bucket; the diff orders them rename-first / drop-after
  so the resulting plan is two clean ALTER TABLEs that compose
  without interfering. Pins per-index pass-order doesn't break.
- bulk_alter_partition_with_charset_and_column.yml: REORGANIZE
  PARTITION must stay its own ALTER under --bulk-alter (partition
  ops excluded per CAVEATS) while DEFAULT CHARSET + ADD COLUMN
  fold together. Three change kinds in one diff covering the
  bulk-alter excluded-set / combinable-set boundary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 5, 2026 15:27
@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (e22d785) to head (4acb5b7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   86.66%   86.72%   +0.06%     
==========================================
  Files          30       30              
  Lines        3277     3277              
==========================================
+ Hits         2840     2842       +2     
+ Misses        269      268       -1     
+ Partials      168      167       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 adds new YAML apply fixtures to pin order-sensitive and cross-cutting behaviors in the diff/apply pipeline, expanding regression coverage for multi-mutator interactions identified in the PR #84 postmortem audit.

Changes:

  • Add a fixture that asserts an error is raised when a myschema:renamed-from column rename would collide with an existing destination column.
  • Add a fixture that pins statement ordering when an index rename and an unrelated index drop occur in the same plan.
  • Add a fixture that pins --bulk-alter behavior at the boundary between non-combinable partition operations and combinable ALTER specs (DEFAULT CHARSET + ADD COLUMN).

Reviewed changes

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

File Description
testdata/apply/error_column_rename_destination_exists.yml Pins the rename-collision error path for column renames using error: substring matching.
testdata/apply/index_rename_with_unrelated_drop.yml Pins rename-before-drop ordering for independent index changes in a single plan.
testdata/apply/bulk_alter_partition_with_charset_and_column.yml Pins that partition ops stay separate under --bulk-alter, while charset + column add still combine.

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

@winebarrel winebarrel merged commit 63ce646 into main May 5, 2026
9 checks passed
@winebarrel winebarrel deleted the test-diff-cross-cutting branch May 5, 2026 15:44
winebarrel added a commit that referenced this pull request May 6, 2026
Five of the six items from the PR #84 postmortem audit landed:
- composed-state catalog tests   → PR #86
- kitchen-sink round-trip        → PR #87
- emitter ordering pins          → PR #88
- diff cross-cutting             → PR #89
- directive composition          → PR #90

Drop the closed items. Keep `parseCreateTable` column-loop
interactions under "Medium — test coverage gaps" — that one was
scoped out of the kitchen-sink because the open shapes (inline
`UNIQUE × DEFAULT`, inline `REFERENCES × NOT NULL × ON UPDATE`,
inline `PK × column-level CHECK`) need direct parser unit tests,
not a round-trip fixture. The kitchen-sink uses `email VARCHAR
NOT NULL UNIQUE` (no DEFAULT), an explicit named CONSTRAINT FK
(not inline REFERENCES), and a table-level CHECK (not the
column-level shape that exercises the vitess promotion path), so
the gap is real.

The "Medium — silent diffs / fidelity gaps" section keeps the
real open items, including the three new ones surfaced by the
audit itself (REFERENCES auto-name, vitess-keyword identifier
drift, CHECK referencing renamed column).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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