Skip to content

Query individual effective v7 configuration properties - #5259

Merged
mergify[bot] merged 4 commits into
GitTools:mainfrom
arturcic:codex/5253-config-property-query
Sep 30, 2026
Merged

mergify[bot] merged 4 commits into
GitTools:mainfrom
arturcic:codex/5253-config-property-query

Conversation

@arturcic

@arturcic arturcic commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Description

Add gitversion config get <property-path> to retrieve one effective v7 configuration scalar as JSON. For example, config get output.update-build-number --override-config output.update-build-number=false prints false.

The command uses public configuration names and the existing workflow/file/runtime resolution, distinguishes known nulls from unknown properties, and rejects objects, maps, collections and v6 configuration. Errors use stderr and exit 1; successful stdout contains only the scalar and a newline. It does not calculate versions or update version files/build-agent outputs.

V7 --show-config now honors runtime overrides too, so querying and full display agree. V6 display and existing version-variable selection retain their behavior. CLI documentation and the generated configuration reference describe the contract.

Related Issue

Closes #5253

Motivation and Context

Scripts currently need to parse the entire configuration YAML to read one setting. This adds a scalar-only operation under the modern argument parser, with v7 configuration required independently of parser selection. Branch-map lookup and branch-specific inherited runtime settings are outside this change.

How Has This Been Tested?

macOS ARM64, .NET SDK 10.0.401:

  • dotnet test --project src/GitVersion.App.Tests/GitVersion.App.Tests.csproj: 535 passed, 0 failed, 0 skipped.
  • dotnet test --project src/GitVersion.Configuration.Tests/GitVersion.Configuration.Tests.csproj: 247 passed, 0 failed, 0 skipped.
  • Query process tests cover managed and libgit2 backends, workflow/file/runtime precedence, configuration discovery, null/boolean/string values, stdout/stderr/exit codes, early v6 rejection and unchanged v6 full display.
  • QueryNeverCallsVersionCalculationOrVersionOutput verifies the read-only execution path; scalar tests cover culture, quoting, multiline strings, public enum names and unsupported paths.
  • Configuration reference regenerated with mdsnippets --write-header false; second generation is stable.
  • dotnet build src/GitVersion.slnx: succeeded with 0 warnings and 0 errors.
  • dotnet format src/GitVersion.slnx --verify-no-changes --no-restore --include <changed C# files> and git diff --check: passed.
  • CodeRabbit uncommitted review including new files: completed with 0 findings; final re-review also completed with 0 findings.

The complete solution test suite was not run. Hosted checks will run on this draft PR.

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed (the App and Configuration suites passed; the full solution suite was not run).

Summary by CodeRabbit

  • New Features
    • Added config get <property-path> to return a single scalar value from effective v7 configuration as JSON, including workflow, file, and runtime overrides. Null values are supported; structured values and branch maps are not.
    • Updated v7 --show-config output to include runtime overrides.
  • Documentation
    • Added guidance on query syntax, supported values, options, null handling, and error responses.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9809a3f1-440e-4665-a304-76d259d50c45

📥 Commits

Reviewing files that changed from the base of the PR and between 8dfddc0 and 8d09da3.

📒 Files selected for processing (7)
  • docs/input/docs/reference/configuration.md
  • docs/input/docs/reference/mdsource/configuration.source.md
  • src/GitVersion.App.Tests/ArgumentParserTests.cs
  • src/GitVersion.App/ArgumentParser.cs
  • src/GitVersion.Configuration.Tests/Configuration/ConfigurationPropertyQueryTests.cs
  • src/GitVersion.Configuration/ConfigurationPropertyQuery.cs
  • src/GitVersion.Configuration/ConfigurationSerializer.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/input/docs/reference/configuration.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds gitversion config get <property-path> for querying scalar properties from effective v7 configuration. The command resolves configuration overrides and emits a JSON scalar. The change also updates configuration display guidance and adds parser, integration, and serialization tests.

Changes

Configuration property resolution

Layer / File(s) Summary
Resolve and serialize scalar properties
src/GitVersion.Configuration/ConfigurationPropertyQuery.cs, src/GitVersion.Configuration/ConfigurationSerializer.cs, src/GitVersion.Core/Configuration/*, src/GitVersion.Core/Options/ConfigurationInfo.cs, src/GitVersion.Core/PublicAPI.Unshipped.txt, src/GitVersion.Configuration.Tests/Configuration/ConfigurationPropertyQueryTests.cs
The configuration layer validates public property paths, supports scalar values, and serializes query results as JSON. Tests cover supported values, nulls, invalid paths, and unsupported structures.

CLI query command

Layer / File(s) Summary
Wire the query into the CLI
src/GitVersion.App/ArgumentParser.cs, src/GitVersion.App/Arguments.cs, src/GitVersion.App/GitVersionExecutor.cs, src/GitVersion.App.Tests/ArgumentParserTests.cs, src/GitVersion.App.Tests/ConfigurationQueryIntegrationTests.cs, src/GitVersion.App.Tests/HelpWriterTests.cs, docs/input/docs/reference/configuration.md, docs/input/docs/reference/mdsource/configuration.source.md, docs/input/docs/usage/cli/arguments.md
The modern parser accepts config get, and the executor selects property serialization when a path is supplied. Integration tests cover configuration resolution, overrides, errors, output streams, and the v6/v7 display distinction. Documentation describes command syntax and output behavior.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ArgumentParser
  participant GitVersionExecutor
  participant ConfigurationProvider
  participant ConfigurationSerializer
  participant ConfigurationPropertyQuery
  ArgumentParser->>GitVersionExecutor: Pass parsed property path and options
  GitVersionExecutor->>ConfigurationProvider: Resolve effective v7 configuration
  ConfigurationProvider-->>GitVersionExecutor: Return resolved configuration
  GitVersionExecutor->>ConfigurationSerializer: Serialize requested property
  ConfigurationSerializer->>ConfigurationPropertyQuery: GetValue(configuration, path)
  ConfigurationPropertyQuery-->>ConfigurationSerializer: Return scalar value
  ConfigurationSerializer-->>GitVersionExecutor: Return JSON scalar
Loading

Merge Risk: ⚪ Minimal · up to 8d09d

No issue requiring a change before merge was established; normal checks remain appropriate.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 8d09d

The command exposes a selected configuration value, but the reviewed path restricts queries to public v7 scalar properties and uses the existing effective-configuration resolution. No material security regression was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new output path is limited to scalar projections of effective configuration rather than arbitrary configuration-object traversal; existing full display can output a broader configuration document.

Trust Boundaries and Controls

  • observed — The user-supplied path is checked for allowed characters and section placement; public-property metadata and scalar-type checks constrain the value that reaches JSON output.
  • observed — V7 is enforced at parsing, execution, and property selection; the parser rejects explicitly supplied options outside those supported by config get.

Resilience and Maintainability Implications

  • observed — Successful configuration display returns before the executor's version-calculation branch, keeping the query outside that downstream operation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 11 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: querying individual effective v7 configuration properties.
Linked Issues check ✅ Passed The PR satisfies the coding requirements in [#5253]. It adds documented config get <property-path> syntax with public dot-separated paths, scalar JSON output, null handling, diagnostics on stderr, a…
Out of Scope Changes check ✅ Passed The changes remain within [#5253]. The parser, executor, configuration query, serializer, documentation, and tests directly implement or verify the requested read-only configuration lookup. The change…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 11 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@arturcic
arturcic force-pushed the codex/5253-config-property-query branch from 8dfddc0 to 9f2f259 Compare September 29, 2026 14:25
@arturcic
arturcic marked this pull request as ready for review September 29, 2026 14:36
@arturcic
arturcic force-pushed the codex/5253-config-property-query branch from c164ac6 to 8d09da3 Compare September 29, 2026 14:44
@sonarqubecloud

Copy link
Copy Markdown

@arturcic arturcic mentioned this pull request Sep 29, 2026
78 of 100 tasks
@arturcic
arturcic requested a review from asbjornu September 29, 2026 15:54

@asbjornu asbjornu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! 👏🏼

@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-30 00:56 UTC · Rule: default · triggered by @arturcic with the merge queue checkbox
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-30 00:56 UTC · at 7e5e19ee46c633f3f57e6aadc8cbc88ef3761167 · merge

This pull request spent 13 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • github-review-approved [🛡 GitHub repository ruleset rule main branch rule]
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/DotNet Format
    • check-neutral = @github-actions/DotNet Format
    • check-skipped = @github-actions/DotNet Format
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Release
    • check-neutral = @github-actions/Release
    • check-skipped = @github-actions/Release
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Build & Test (new-cli)
    • check-neutral = @github-actions/Build & Test (new-cli)
    • check-skipped = @github-actions/Build & Test (new-cli)
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Build & Package / macos-26
    • check-neutral = @github-actions/Build & Package / macos-26
    • check-skipped = @github-actions/Build & Package / macos-26
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Build & Package / ubuntu-24.04
    • check-neutral = @github-actions/Build & Package / ubuntu-24.04
    • check-skipped = @github-actions/Build & Package / ubuntu-24.04
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Build & Package / windows-2025-vs2026
    • check-neutral = @github-actions/Build & Package / windows-2025-vs2026
    • check-skipped = @github-actions/Build & Package / windows-2025-vs2026
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-neutral = Mergify Merge Protections
    • check-skipped = Mergify Merge Protections
    • check-success = Mergify Merge Protections
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @sonarqubecloud/SonarCloud Code Analysis
    • check-neutral = @sonarqubecloud/SonarCloud Code Analysis
    • check-skipped = @sonarqubecloud/SonarCloud Code Analysis
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / macos-26 - net10.0 - libgit2
    • check-neutral = @github-actions/Test / macos-26 - net10.0 - libgit2
    • check-skipped = @github-actions/Test / macos-26 - net10.0 - libgit2
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / macos-26 - net10.0 - managed
    • check-neutral = @github-actions/Test / macos-26 - net10.0 - managed
    • check-skipped = @github-actions/Test / macos-26 - net10.0 - managed
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / ubuntu-24.04 - net10.0 - libgit2
    • check-neutral = @github-actions/Test / ubuntu-24.04 - net10.0 - libgit2
    • check-skipped = @github-actions/Test / ubuntu-24.04 - net10.0 - libgit2
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / ubuntu-24.04 - net10.0 - managed
    • check-neutral = @github-actions/Test / ubuntu-24.04 - net10.0 - managed
    • check-skipped = @github-actions/Test / ubuntu-24.04 - net10.0 - managed
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / windows-2025-vs2026 - net10.0 - libgit2
    • check-neutral = @github-actions/Test / windows-2025-vs2026 - net10.0 - libgit2
    • check-skipped = @github-actions/Test / windows-2025-vs2026 - net10.0 - libgit2
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Test / windows-2025-vs2026 - net10.0 - managed
    • check-neutral = @github-actions/Test / windows-2025-vs2026 - net10.0 - managed
    • check-skipped = @github-actions/Test / windows-2025-vs2026 - net10.0 - managed
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @github-actions/Linear PR History
    • check-neutral = @github-actions/Linear PR History
    • check-skipped = @github-actions/Linear PR History
  • any of [🛡 GitHub repository ruleset rule main branch rule]:
    • check-success = @coderabbitai/CodeRabbit
    • check-neutral = @coderabbitai/CodeRabbit
    • check-skipped = @coderabbitai/CodeRabbit

@mergify mergify Bot added the queued label Sep 30, 2026
@mergify
mergify Bot merged commit 7e5e19e into GitTools:main Sep 30, 2026
41 checks passed
@mergify

mergify Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

@mergify mergify Bot removed the queued label Sep 30, 2026
@arturcic
arturcic deleted the codex/5253-config-property-query branch September 30, 2026 00:57
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.

Query an individual effective configuration property

2 participants