Skip to content

List each CLI parameter once in the help text - #562

Merged
ChrisonSimtian merged 2 commits into
Fallout-build:mainfrom
ChrisonSimtian:bugfix/dedupe-help-parameters
Jul 26, 2026
Merged

ChrisonSimtian merged 2 commits into
Fallout-build:mainfrom
ChrisonSimtian:bugfix/dedupe-help-parameters

Conversation

@ChrisonSimtian

@ChrisonSimtian ChrisonSimtian commented Jul 26, 2026 •

Copy link
Copy Markdown
Collaborator

Collapses duplicate declarations of one CLI parameter. On this repo, ./build.sh --help printed --nuget-api-key twice.

What changed

  • ValueInjectionUtility.GetParameterMembers groups members by the dashed name the user types, and keeps the most specific declaration.
  • Precedence is explicit: an interface declaration ranks below any class declaration, and among classes a deeper inheritance chain wins. Ties break on declaring-type name, so the result is deterministic.
  • Add DuplicateParameterSpecs.

Why

A build class can implement a component interface and re-declare one of its parameters. build/Build.cs does this with NuGetApiKey, which IPublish also declares. Both members reached the help renderer.

Two notes for review:

  • The duplicate only appears when the class declaration is private. GetAllMembers drops the interface member when the class declares a public member of the same name, and the idiomatic build-class parameter is a private readonly field. The specs declare their fields private for this reason.
  • The generated schema was also affected. It wrote both members under one JSON key, so the surviving description and type were incidental. Regenerating the schema after this change produces no diff, so the winner happens to match what the overwrite produced.

This resolves the standing // TODO: check duplicated names on GetParameterMembers.

Verification

dotnet test tests/Fallout.Build.Specs — 5 new specs pass, 3 of which failed before the fix. ./build.sh --help now lists --nuget-api-key once.

Closes #554

ChrisonSimtian and others added 2 commits July 27, 2026 00:08
A build class that implements a component interface and re-declares one of its
parameters yields two members for one CLI parameter.

The declaration has to be private to reproduce it. GetAllMembers only drops the
interface member when the class declares a public member of the same name, and
the idiomatic build-class parameter is a private readonly field.

3 of 5 fail: --api-key is listed twice, and there is no rule for which
declaration wins.

Part of Fallout-build#554

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Group parameter members by the name the user types and keep the most specific
declaration. Interface declarations rank below any class declaration; among
classes, the deeper the inheritance chain, the more specific.

A build class that implements a component interface and re-declares one of its
parameters produced two members for one CLI parameter. --help printed it twice,
and the generated schema wrote both under one key, so which declaration's
description and type survived was incidental.

This resolves the standing "check duplicated names" note on GetParameterMembers.

Closes Fallout-build#554

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ChrisonSimtian ChrisonSimtian added bug Something isn't working release/Stable Targets the current/stable release labels Jul 26, 2026
@ChrisonSimtian
ChrisonSimtian marked this pull request as ready for review July 26, 2026 12:33
@ChrisonSimtian
ChrisonSimtian requested a review from a team as a code owner July 26, 2026 12:33
@ChrisonSimtian
ChrisonSimtian merged commit 334f3e3 into Fallout-build:main Jul 26, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the bugfix/dedupe-help-parameters branch July 26, 2026 22:06
This was referenced Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working release/Stable Targets the current/stable release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--help lists the same parameter twice when a class member shadows an interface parameter

2 participants