Skip to content

Controlled Exception Handling for Incomplete VECTOR_SEARCH AST Nodes - #5

Open
Fabian-Montero wants to merge 2 commits into
mainfrom
feature/HU-02-controlled-exception-handling
Open

Fabian-Montero wants to merge 2 commits into
mainfrom
feature/HU-02-controlled-exception-handling

Conversation

@Fabian-Montero

Copy link
Copy Markdown

Summary

Add controlled script-generation validation for incomplete VECTOR_SEARCH AST nodes.

Prevent the generator from silently producing invalid T-SQL when a manually constructed VectorSearchTableReference does not include the required Metric property.

Implementation

Add validation in SqlScriptGeneratorVisitor.ExplicitVisit(VectorSearchTableReference).

Reject a VECTOR_SEARCH node with Metric == null before generating any SQL tokens.

Return: VECTOR_SEARCH requires a METRIC value.

Add an MSTest regression test that manually builds a VectorSearchTableReference without Metric and verifies that generation throws InvalidOperationException.

No ANTLR grammar, parser, generated AST code, or public API was changed.

TDD Evidence

RED: Without the validation guard, the focused test failed 1/1 because no InvalidOperationException was thrown and the generator silently produced invalid SQL.

image

GREEN: With the validation guard enabled, the same focused test passed 1/1.

image

Testing

Passed:

dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedName~VectorSearchWithoutMetricIsRejected"

dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedNameVectorSearchWithoutMetricIsRejected|FullyQualifiedNameTSql170SyntaxIn170ParserTest"

dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedName~TSql180SyntaxTests"

dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1

The full net8.0 suite passed: 1,177 tests passed, 0 failed, and 0 skipped.

@allancascante allancascante added the adversarial-review:run Authorize an adversarial review after checks pass label Dec 1, 2026
@allancascante allancascante added adversarial-review:run Authorize an adversarial review after checks pass and removed adversarial-review:run Authorize an adversarial review after checks pass labels Dec 1, 2026

This branch had an error being deployed

1 failed deployment
adversarial-review — 577ddcde Deployed Dec 3, 2026 by allancascante via review #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adversarial-review:run Authorize an adversarial review after checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants