Skip to content

feat: Add DynamicValues and DynamicSchema validation diagnostics (#43)#76

Open
daviburg wants to merge 6 commits into
mainfrom
feature/dynamic-validation
Open

feat: Add DynamicValues and DynamicSchema validation diagnostics (#43)#76
daviburg wants to merge 6 commits into
mainfrom
feature/dynamic-validation

Conversation

@daviburg
Copy link
Copy Markdown
Member

@daviburg daviburg commented May 11, 2026

Summary

Adds a DynamicValuesValidator that validates call sites where SDK connector client methods are invoked with [DynamicValues]-annotated parameters.

How it works

When a string literal is passed to a [DynamicValues] parameter, the validator checks the LSPStore.DynamicData cache (populated by hover/completion) to see if the value matches any known dynamic value. If not, it emits CSDK300.

Key design decisions:

  • No network calls during validation - reads from existing cache only
  • No false positives - only emits when cached values exist
  • Quote-aware matching - strips surrounding quotes before comparing
  • SDK namespace filter - only inspects calls to Azure.Connectors.Sdk.* types

Diagnostic

Code Severity Trigger
CSDK300 Warning String literal does not match any cached dynamic value

Changes

  • DiagnosticCodes.cs - Added CSDK300
  • DynamicValuesValidator.cs - New validator using CompilationService, LSPStore, ConnectionsService
  • Program.cs - Registered validator in DI
  • DynamicValuesValidatorTests.cs - 8 test cases

Testing

  • Build: zero errors
  • Tests: 202 passed, 15 skipped (baseline: 199/15/0)
  • E2E verified: foobar gets squiggly, valid SharePoint URL does not

Closes #43

Copilot AI review requested due to automatic review settings May 11, 2026 05:50
@daviburg daviburg requested a review from a team as a code owner May 11, 2026 05:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds new LSP diagnostics for validating [DynamicValues] and [DynamicSchema] attribute usage in connector code, wiring the validator into the server and introducing new diagnostic codes and unit tests.

Changes:

  • Added CSDK300–CSDK305 diagnostic codes for DynamicValues/DynamicSchema validation.
  • Implemented DynamicValuesValidator to perform attribute/type checks plus dynamic operation registry lookups.
  • Registered the new validator in DI and added a new test suite.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
Server/Program.cs Registers DynamicValuesValidator as an IDiagnosticValidator.
Server/Diagnostics/Validators/DynamicValuesValidator.cs New validator implementing CSDK300–CSDK305 checks.
Server/Diagnostics/DiagnosticCodes.cs Adds constants for CSDK300–CSDK305.
Server.Tests/DynamicValuesValidatorTests.cs Adds unit tests for the new validator.

Comment thread Server/Program.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server.Tests/DynamicValuesValidatorTests.cs
Comment thread Server.Tests/DynamicValuesValidatorTests.cs Outdated
@daviburg daviburg force-pushed the feature/dynamic-validation branch from 2f61aa5 to 4786bdb Compare May 11, 2026 15:35
Copilot AI review requested due to automatic review settings May 11, 2026 16:28
@daviburg daviburg force-pushed the feature/dynamic-validation branch from 4786bdb to 97610bd Compare May 11, 2026 16:28
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 6 comments.

Comment thread Server/Diagnostics/DiagnosticCodes.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server.Tests/DynamicValuesValidatorTests.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server.Tests/DynamicValuesValidatorTests.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
)

Validates call sites where SDK connector client methods are invoked.
When a string literal is passed to a [DynamicValues]-annotated parameter,
the validator checks the LSPStore.DynamicData cache (populated by hover
and completion handlers) to see if the value is among known dynamic values.

CSDK300: String literal does not match any cached dynamic value.
Only emits when cached values exist — no false positives before
hover/completion has populated the cache.

Dropped CSDK301 — [DynamicValues] is used on non-string types
(e.g., int approvalType) so type-checking the argument is wrong.
@daviburg daviburg force-pushed the feature/dynamic-validation branch from 97610bd to bdb28f3 Compare May 11, 2026 17:03
@daviburg daviburg self-assigned this May 11, 2026
@daviburg daviburg requested a review from Copilot May 11, 2026 17:12
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
…ix named-arg matching, add tests

Co-authored-by: Dobby <dobby@microsoft.com>
@daviburg daviburg requested a review from Copilot May 11, 2026 17:25
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
…med-arg test

Co-authored-by: Dobby <dobby@microsoft.com>
@daviburg daviburg requested a review from Copilot May 11, 2026 17:35
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
@daviburg daviburg requested a review from Copilot May 11, 2026 17:44
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs Outdated
…alue-only matching

Co-authored-by: Dobby <dobby@microsoft.com>
Copy link
Copy Markdown

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
Comment thread Server/Diagnostics/Validators/DynamicValuesValidator.cs
…vocation

Co-authored-by: Dobby <dobby@microsoft.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.

Diagnostics: DynamicValues and DynamicSchema validation

2 participants