Skip to content

test: kitchen-sink round-trip fixture + 2 new fidelity-gap TODOs#87

Merged
winebarrel merged 2 commits into
mainfrom
test-kitchen-sink-round-trip
May 5, 2026
Merged

test: kitchen-sink round-trip fixture + 2 new fidelity-gap TODOs#87
winebarrel merged 2 commits into
mainfrom
test-kitchen-sink-round-trip

Conversation

@winebarrel

Copy link
Copy Markdown
Owner

Summary

Second item from the PR #84 postmortem audit (TODO.md "Medium — test coverage audit", item 6). One YAML fixture exercising as many supported attributes as fit in a small schema: init = desired = full schema (no-op apply), verify_no_drift: true confirms the catalog read → parser model round-trip closes for every attribute combination at once. Highest single-test ROI per the audit estimate.

Coverage matrix the fixture pins:

  • column attributes: PK / AUTO_INCREMENT / NOT NULL / DEFAULT literal / DEFAULT CURRENT_TIMESTAMP / ON UPDATE / COMMENT / INVISIBLE / STORED GENERATED
  • inline column-level UNIQUE (auto-named index)
  • table-level CHECK with default ENFORCED
  • indexes: PRIMARY / UNIQUE with COMMENT / KEY with prefix length INVISIBLE / FULLTEXT with COMMENT
  • foreign key: ON DELETE CASCADE (explicit named CONSTRAINT)
  • table options: ENGINE / DEFAULT CHARSET / COLLATE / COMMENT
  • partitioning: RANGE with three partitions
  • views: simple SELECT and view with column alias list

Two open drifts surfaced and added to TODO.md

The first iteration of the fixture caught two real round-trip drifts that are independent open issues. They went into TODO.md instead of the fixture (so the kitchen-sink stays green and pins what does work):

  • Inline column-level REFERENCES auto-names the FK <table>_ibfk_<col> (parser side) while MySQL uses <table>_ibfk_<n> (catalog side). Every plan emits a redundant ADD CONSTRAINT. Workaround: explicit named CONSTRAINT (what the fixture uses now).
  • Generated-column expressions back-tick vitess-keyword identifiers. CONCAT(email, ' ', name) round-trips as CONCAT(email, ' ',``name ``) because name is in vitess's keyword list. Catalog stores the back-ticked form, parser doesn't. Workaround: rename the column to a non-keyword identifier.

Test plan

  • make lint clean.
  • make test all six packages green; new fixture rounds-trips clean against MySQL 8.0.
  • First-iteration fixture (with name column and inline REFERENCES) intentionally failed — confirmed both drifts before adjusting the fixture and filing the TODO entries.

🤖 Generated with Claude Code

Second item from the PR #84 postmortem audit. One YAML fixture
exercising as many supported attributes as fit in a small schema:
init = desired = full schema (no-op apply), verify_no_drift: true
confirms the catalog read → parser model round-trip closes for
every attribute combination at once.

Coverage matrix the fixture pins:
- column: PK / AUTO_INCREMENT / NOT NULL / DEFAULT literal /
  DEFAULT CURRENT_TIMESTAMP / ON UPDATE / COMMENT / INVISIBLE /
  STORED GENERATED / VIRTUAL GENERATED equivalent
- inline column-level UNIQUE
- table-level CHECK with default ENFORCED
- index: PRIMARY / UNIQUE with COMMENT / KEY with prefix length
  INVISIBLE / FULLTEXT with COMMENT
- foreign key: ON DELETE CASCADE
- table options: ENGINE / DEFAULT CHARSET / COLLATE / COMMENT
- partitioning: RANGE with three partitions
- views: simple SELECT and view with column alias list

Two open round-trip drifts surfaced during the work and went into
TODO.md instead of the fixture (so the kitchen-sink stays green
and pins what does work):

- inline column-level `REFERENCES` auto-names the FK
  `<table>_ibfk_<col>` while MySQL uses `<table>_ibfk_<n>`. The
  fixture uses an explicit named CONSTRAINT to side-step the drift.
- generated-column expressions back-tick vitess-keyword identifiers
  (e.g. `name` becomes `` `name` ``) which the catalog round-trips
  but the parser doesn't, so a column called `name` referenced
  inside a STORED expression drifts forever. The fixture renames
  the column.

Both drifts are now their own follow-up items.

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:21
@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.66%. Comparing base (e22d785) to head (09666f0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #87   +/-   ##
=======================================
  Coverage   86.66%   86.66%           
=======================================
  Files          30       30           
  Lines        3277     3277           
=======================================
  Hits         2840     2840           
  Misses        269      269           
  Partials      168      168           

☔ 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

Adds a comprehensive “kitchen-sink” apply fixture to exercise many MySQL DDL attributes in a single no-op round-trip test, and documents two newly discovered round-trip fidelity gaps in TODO.md from the PR #84 audit.

Changes:

  • Add testdata/apply/kitchen_sink_round_trip.yml, a no-op init == desired fixture with verify_no_drift: true.
  • Add two new fidelity-gap items to TODO.md (inline REFERENCES FK auto-naming drift; generated-column expression backtick drift with vitess keywords).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
TODO.md Adds two newly discovered drift/fidelity-gap TODO items from the kitchen-sink work.
testdata/apply/kitchen_sink_round_trip.yml Introduces a broad-coverage round-trip fixture intended to catch attribute-interaction regressions via verify_no_drift.

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

Comment thread TODO.md Outdated
Comment thread testdata/apply/kitchen_sink_round_trip.yml Outdated
Comment thread testdata/apply/kitchen_sink_round_trip.yml Outdated
Comment thread testdata/apply/kitchen_sink_round_trip.yml Outdated
Comment thread testdata/apply/kitchen_sink_round_trip.yml
Five doc/comment accuracy nits, all valid:

- TODO.md "Generated-column expression drifts" entry had nested
  back-ticks (`CONCAT(email, ' ', `name`)`) which closes the
  Markdown code span early and breaks rendering. Switch to a
  double-backtick code span so the inner literal back-ticks
  display correctly.
- kitchen_sink_round_trip.yml's coverage matrix overstated what
  the fixture actually pins. Fixed mismatches:
  - "VIRTUAL GENERATED" / "per-column COLLATE" / "UNIQUE with
    COMMENT" / "RANGE COLUMNS" claimed but not in the DDL.
  - View with column alias list claimed to round-trip "clean" but
    the alias list isn't compared (existing TODO entry).
  Rewrite the matrix to faithfully describe what the DDL exercises
  and add an "intentional omissions" footnote that points at
  where each non-pinned attribute lives (existing sub-fixtures /
  catalog tests / TODO entries). The fixture itself didn't change
  shape, only the comments above it.

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

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

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


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

@winebarrel winebarrel merged commit 4fed9c3 into main May 5, 2026
9 checks passed
@winebarrel winebarrel deleted the test-kitchen-sink-round-trip branch May 5, 2026 15:45
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