Skip to content

fix: a declaration's kind holds no white space and no control character, like its owner - #55

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
fix/51-kind-validation
Nov 12, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
fix/51-kind-validation

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #51

Problem

A named declaration's key is hashed over name\n{Kind}\n{name}. DeclarationCodec.Validate refused an owner with a colon, white space or a control character, and a kind only when it was empty. So kind "index\nx" named "y" and kind "index" named "x\ny" had one key.

A consumer would have seen the second of two different declarations refused as "declared twice". Nothing was lost or replaced.

Change

  • Declarations/Internal/DeclarationCodec.cs: Validate refuses a kind with white space or a control character. Key and Value both go through it, so Declare, Redeclare and the reader do.
  • Infrastructure/Internal/SchemaKitStrings.cs: InvalidKind, which says why.

A name may still hold a line break: it is the last part of the identity, so nothing can follow it.

Tests

Kernel tests without a server: 263 before, 271 after. The PostgreSQL integration tests did not run locally; CI runs them.

  • Seven new rows in A_declaration_that_cannot_be_stored_is_refused: a line break (named and unnamed), a space, a tab, a no-break space, U+0001 and U+0085.
  • A_kind_cannot_borrow_part_of_another_declarations_name holds the pair from the issue.
Undone Fails
The check all seven rows and A_kind_cannot_borrow_part_of_another_declarations_name
White space only the row with U+0001
Control characters only the rows with a space and a no-break space

This and the PR for #50 both add a message to SchemaKitStrings.cs and tests to DeclarationCodecTests.cs, in different places.

🤖 Generated with Claude Code

…er, like its owner

Closes #51.

A named declaration's key is over its kind and its name with a line break
between them, and a kind was only refused when it was empty. Kind
"index\nx" named "y" and kind "index" named "x\ny" therefore had one key,
and the store refused the second as declared twice.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 11, 2026
@CaffeinatedCoder CaffeinatedCoder added bug Something isn't working package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) severity/low Cosmetic, message or documentation-level difference area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 11, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 2116ba5 into main Nov 12, 2026
7 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the fix/51-kind-validation branch November 12, 2026 07:32
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 bug Something isn't working package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) severity/low Cosmetic, message or documentation-level difference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A declaration's kind is not checked like its owner, so a kind with a line break can share a key with another declaration

1 participant