You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SqlHandler.AppendLiteral takes any string when it is called directly, past the typed holes #109
area/migrationsThe differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiringbugSomething isn't workingpackage/coreAffects CodoMetis.EFCore.SchemaKit (the kernel)severity/lowCosmetic, message or documentation-level difference
Found by the pre-preview sweep of main @ 948496a (GPT's read of the kernel); read against the code, not run.
What happens
SqlHandler is public, as an interpolated-string handler has to be, with a public constructor and a public AppendLiteral(string) (SchemaSql.cs:102-120). A contributor can build one by hand, pass any string to AppendLiteral and hand it to sql.Statement(ref handler). The string reaches the DDL as it is.
CLAUDE.md and the type's own remarks say that nothing reaches the DDL unquoted is a property of the types. That holds for a hole of an interpolated string, which KernelProbeTests compiles. It does not hold for the handler called directly; SchemaSqlTests has a helper that does exactly that.
To decide, before the contract freezes at rc.1
[ConstantExpected] on AppendLiteral's parameter. The compiler passes constants; a call with anything else is CA1857, which the repository's own build treats as an error and a contributor's build as a warning.
Say what the guarantee is: the holes, not the handler. The remarks and CLAUDE.md then say so.
Both are compatible, and the first costs nothing.
Test
A compile probe in KernelProbeTests: handler.AppendLiteral(runtimeString) from a contributor's assembly, with its diagnostic asserted.
Fixed in #163 with option 1, and option 2 on top of it.
Chosen: [ConstantExpected] on AppendLiteral's parameter. A string built at run time is CA1857: a warning in a contributor's build by default, an error here. The compiler passes constants, so sql.Statement($"…") is unchanged.
Not chosen:
A handler only the compiler can build. The compiler builds the handler in the contributor's assembly, so its constructor and AppendLiteral have to be accessible there, which means a contributor can call them too.
Refusing a direct call at run time. The only signal is whether the argument is the interned literal, and string.Intern gets around that. It would also depend on how the runtime interns strings.
The guarantee is now stated as the holes', not the handler's: in the handler's remarks, in CLAUDE.md ("The SQL vocabulary") and in design/schemakit-api.md.
Reproduced and held.KernelProbeTests now runs the SDK's .NET analyzers, so each snippet is compiled the way a contributor's build compiles it. Probe E11.literal-from-a-runtime-string builds a handler by hand and feeds it "DROP INDEX " + name. Before the fix it compiled clean; with the fix it fails with CA1857, beside the interpolated form, which compiles clean. PublicSurfaceTests.The_handler_takes_a_constant_for_a_literal checks the attribute and fails without it.
area/migrationsThe differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiringbugSomething isn't workingpackage/coreAffects CodoMetis.EFCore.SchemaKit (the kernel)severity/lowCosmetic, message or documentation-level difference
Activity
CaffeinatedCoder commentedon Nov 16, 2026
Fixed in #163 with option 1, and option 2 on top of it.
Chosen:
[ConstantExpected]onAppendLiteral's parameter. A string built at run time is CA1857: a warning in a contributor's build by default, an error here. The compiler passes constants, sosql.Statement($"…")is unchanged.Not chosen:
AppendLiteralhave to be accessible there, which means a contributor can call them too.string.Interngets around that. It would also depend on how the runtime interns strings.The guarantee is now stated as the holes', not the handler's: in the handler's remarks, in
CLAUDE.md("The SQL vocabulary") and indesign/schemakit-api.md.Reproduced and held.
KernelProbeTestsnow runs the SDK's .NET analyzers, so each snippet is compiled the way a contributor's build compiles it. ProbeE11.literal-from-a-runtime-stringbuilds a handler by hand and feeds it"DROP INDEX " + name. Before the fix it compiled clean; with the fix it fails with CA1857, beside the interpolated form, which compiles clean.PublicSurfaceTests.The_handler_takes_a_constant_for_a_literalchecks the attribute and fails without it.Merge pull request #163 from CaffeinatedCoder/claude/109-append-liter…