Skip to content

test: six tests assert the rule they are named for - #147

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
test/tests-assert-their-rule
Nov 16, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
test/tests-assert-their-rule

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #107

Problem

Six tests passed with the rule they are named for broken. Each counted operations, compared types, or compared two catalogs that agree when both are wrong. None of them had been seeded when #107 was filed; seeded now, each passes on main with its rule broken (the table is on #107).

Change

Tests only.

Test What it asserts now
WiringConditionTests.C04_has_differences_sees_the_declaration A model pair that differs in the declaration only. The premise is asserted too: the inner differ says "no changes" for it
OperationOrderTests.The_inner_operations_are_passed_through_untouched The inner operations as migrations add writes them into a migration (ICSharpMigrationOperationGenerator): every name, column and annotation
NameClaimTests.Every_kind_of_object_has_a_scope (kernel) Claims is asked for every member of SchemaModelObject, on three providers, and each claim carries the object's name. The_default_scopes_are_stated_for_every_kind holds the rows of The_default_scopes to the enum
NameClaimTests.A_name_that_differs_in_case_is_another_name (PostgreSQL) The statement, with the name as it is declared
ComplexIndexes5xExclusionReaderTests.A_deferrable_constraint_checked_at_commit_is_not_one_checked_at_once No operations against a model that declares the same deferral (MovedModels.SlotUnderGistDeferred, new), and the two statements against the one that does not
PgExclusionLiveTests.Changing_the_deferral Both ways, each by the catalog's text

The fifth is not what #107 proposed. Asserting the two statements is not enough: the statements of a rebuild show the target alone, so they are the same whatever the reader took the source for. What was read shows only against the model that declares it.

Tests

Each defect seeded in a scratch copy of the repository, once under the test as it is on main and once under the test of this PR:

Seeded defect On main In this PR
SchemaKitModelDiffer.HasDifferences returns the inner differ's answer passes (3 rows) fails (3 rows)
The decorator adds an annotation to the first inner operation passes (3 rows) fails (3 rows)
The kernel's dialect returns no claim for a constraint passes fails (3 rows)
The contributor writes the constraint's name in upper case passes fails
The reader takes deferrable with initiallyDeferred for not deferrable passes fails
Create never writes a deferral passes fails, on PostgreSQL 18

On this branch: the three kernel classes (116 tests) and the three PostgreSQL classes (102, the live ones on PostgreSQL 18) pass. With #108's and #126's changes beside it, both projects pass in full on PostgreSQL 16 and 18.

🤖 Generated with Claude Code

Each of them passed with its rule broken (#107): it counted operations, compared types, or
compared two catalogs that agree when both are wrong.

- C04_has_differences_sees_the_declaration: a model pair that differs in the declaration
  only, so the inner differ's own answer is "no changes".
- The_inner_operations_are_passed_through_untouched: the operations as migrations add writes
  them, with every name, column and annotation.
- Every_kind_of_object_has_a_scope: Claims is asked for every kind, on three providers, and
  the rows of The_default_scopes are held to the enum.
- A_name_that_differs_in_case_is_another_name: the statement.
- A_deferrable_constraint_checked_at_commit_is_not_one_checked_at_once: no operations
  against the model that declares the same deferral. A rebuild's statements show the target
  alone, so they say nothing about what the reader read.
- Changing_the_deferral: both ways, by the catalog's text.

Closes #107

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 16, 2026
@CaffeinatedCoder CaffeinatedCoder added tests Adds or changes tests only (harnesses, parity suites); no library code package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 16, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit c74e6c8 into main Nov 16, 2026
10 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the test/tests-assert-their-rule branch November 16, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL tests Adds or changes tests only (harnesses, parity suites); no library code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Six tests that pass with their rule broken

1 participant