Repository navigation
fix: compare composite subcommand ids case-insensitively when tracking parents - #1806
RaphaelFakhri wants to merge 1 commit into
Conversation
…g parents Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: RaphaelFakhri The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description of Changes
validateCompositeCommandresolves subcommand references case-insensitively and stores the lowercase command ID inparentCommands, but it removes the entry with the raw reference. When a reference is not lowercase (for exampleComposite-Aforcomposite-a), the entry is never removed, and a later reference to the same command fails withcomposite command cannot indirectly reference itself, even though the devfile has no cycle.This change deletes the lowercase key, matching how the key is added and looked up. It also adds a test case to
TestValidateCompositeCommandwith a mixed-case subcommand reference.Related Issue(s)
Fixes #1805
Acceptance Criteria
Unit/Functional tests
New case
Valid Composite command with mixed-case subcommand referencesinpkg/validation/commands_test.go.QE Integration test
Not needed: the change only removes a false validation error.
Documentation
Not needed: no documented behavior changes.
Client Impact
None expected: devfiles that previously failed with a false cycle error now pass. Devfiles with real cycles still fail.
Tests Performed
go test ./pkg/validation/ -run TestValidateCompositeCommand -v: the new case fails without the fix (the command "composite-b" is invalid - composite command cannot indirectly reference itself) and passes with it (7 of 7 subtests pass).go test ./pkg/validation/... ./pkg/utils/... ./pkg/devfile/... ./pkg/apis/...passes.gofmt -l pkg/validationandgo vet ./pkg/validation/are clean.How To Test
go test ./pkg/validation/ -run TestValidateCompositeCommand -vNotes To Reviewer
The other lookups in
validateCompositeCommandalready usestrings.ToLower(cmd). This change makes thedeletecall consistent with them.Summary by CodeRabbit
Composite-Aversuscomposite-a. This makes validation more consistent when command IDs are written with different capitalization.