Skip to content

test(compile): add coverage for engine.provider base-url/resource validation - #1867

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test/provider-config-validation-coverage-4d0c15e5e6053489
Draft

test(compile): add coverage for engine.provider base-url/resource validation#1867
github-actions[bot] wants to merge 1 commit into
mainfrom
test/provider-config-validation-coverage-4d0c15e5e6053489

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Gap Fixes

Test suite snapshot: 2948 unit tests, 225 tests in compiler_tests.rs (up from 222), passing across the full cargo test run.

Added Coverage

Module Function/Path Why It Matters Test Added
src/validate.rs is_valid_provider_base_url — plaintext `(redacted) rejection The provider endpoint receives the bearer token / API key, so only https:// literals or ADO $(VAR) macros are accepted; this scheme check previously had zero compile-level coverage (only the happy path was exercised) test_provider_base_url_rejects_plaintext_http
src/validate.rs is_valid_provider_resource_url — shell metacharacter rejection provider.token.resource is shell-interpolated verbatim into the generated az account get-access-token --resource '(value)' mint step; an unvalidated value could break out of the quoted argument test_provider_token_resource_rejects_shell_metacharacters
src/compile/types.rs (ProviderConfig) macro base-url + non-default provider.token.resource override, compiled together Both the macro-accepting branch of is_valid_provider_base_url and a custom resource override were previously completely untested test_provider_base_url_macro_and_custom_resource_compile

These target the BYOK (engine.provider) validated-newtype surface in src/secure.rs/src/validate.rs, which handles values interpolated directly into generated shell/YAML and therefore is security-sensitive. Note: because ProviderConfig/ProviderToken sit inside the untagged EngineConfig enum, serde's rejection surfaces as a generic "Failed to parse YAML front matter" / "no variant matched" error rather than the newtype's specific message — the negative tests assert on that observed behavior.

Validation

  • cargo test (2948 passed, 0 failed)
  • cargo clippy --all-targets --all-features (clean)

Scope: only tests/compiler_tests.rs was modified; no production code changes.


This PR was created by the automated test gap finder. Modules audited this cycle: sanitize.rs, validate.rs, secure.rs (provider validation newtypes), fuzzy_schedule.rs, hash.rs.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Gap Finder · auto · 185.9 AIC · ⌖ 15.4 AIC · ⊞ 11.2K ·

…idation

Adds three compile-level tests exercising validated newtypes that
previously had no direct test coverage:

- is_valid_provider_base_url rejects a plaintext http:// literal URL
  (only https:// literals or ADO $(VAR) macros are accepted, since the
  provider endpoint receives the bearer token / API key)
- is_valid_provider_resource_url rejects shell metacharacters in
  provider.token.resource (this value is shell-interpolated verbatim
  into the generated az account get-access-token --resource mint step)
- the macro-accepting branch of is_valid_provider_base_url plus a
  non-default provider.token.resource override compile successfully
  together (both previously untested paths)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the test label Aug 10, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants