Skip to content

feat(pkg list): fall back group to component-group(s) if a binary RPM is not in any package-group#165

Open
liunan-ms wants to merge 2 commits into
microsoft:mainfrom
liunan-ms:liunan/pkg_list_group
Open

feat(pkg list): fall back group to component-group(s) if a binary RPM is not in any package-group#165
liunan-ms wants to merge 2 commits into
microsoft:mainfrom
liunan-ms:liunan/pkg_list_group

Conversation

@liunan-ms
Copy link
Copy Markdown
Contributor

Currently the group field on each PackageListResult is the name of the package-group that contains the binary package, or "" if the package isn't in any group. After switching to component-based config, it cannot reflect the component group.

This pull request improves how the group field is determined. When a binary RPM is not in any package-group, attribute it to the resolved component's component-group(s) (sorted, comma-joined). SRPM rows from --rpm-file and synthesized debug package entries get the same attribution. Update Cobra help, the inspect-package-config how-to, and regenerated CLI reference docs.

Example output of azldev pkg list --rpm-file <rpm_source_map.json>:

[
...
 {
    "packageName": "fence-agents",
    "type": "srpm",
    "group": "base-packages",   <-- component group name
    "component": "fence-agents",
    "publishChannel": "rpm-base-srpm"
  },
 {
    "packageName": "fence-agents-amt-ws",
    "type": "rpm",
    "group": "exceptions-packages",  <-- package group name
    "component": "fence-agents",
    "publishChannel": "rpm-sdk"
  },
  {
    "packageName": "fence-agents-apc",
    "type": "rpm",
    "group": "base-packages",
    "component": "fence-agents",
    "publishChannel": "rpm-base"
  },
...
]

Copilot AI review requested due to automatic review settings May 7, 2026 18:56
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates azldev pkg list group attribution so packages not belonging to any package-group fall back to their resolved component’s component-group(s), and documents the new behavior.

Changes:

  • Add component-group fallback (sorted, comma-joined) for the group field when no package-group match exists, including SRPM rows.
  • Add tests covering fallback behavior and package-group precedence.
  • Update CLI help and documentation to describe the new group attribution semantics.

Reviewed changes

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

File Description
internal/app/azldev/cmds/pkg/list.go Implements component-group fallback logic via componentGroupLabel, applies it to RPM and SRPM results, and updates help/comments.
internal/app/azldev/cmds/pkg/list_test.go Adds unit tests validating fallback behavior, sorting/determinism, and package-group precedence, including --rpm-file cases.
docs/user/reference/cli/azldev_package_list.md Documents the updated meaning of the group column in CLI reference output.
docs/user/how-to/inspect-package-config.md Updates the Group column description to include the component-group fallback behavior.

Comment thread internal/app/azldev/cmds/pkg/list.go Outdated
Comment thread internal/app/azldev/cmds/pkg/list.go Outdated
When a binary RPM is not in any package-group, attribute it to the resolved component's component-group(s) (sorted, comma-joined). SRPM rows from --rpm-file and synthesized -debugsource entries get the same attribution. Update Cobra help, the inspect-package-config how-to, and regenerated CLI reference docs.

Tests: adds unit tests covering the component-group baseline (single and multi-membership, sort/join), the package-group override, the --rpm-file path (SRPM and binary RPM both attributed to the component-group), and the -debugsource package-group override over the component-group baseline.
@liunan-ms liunan-ms force-pushed the liunan/pkg_list_group branch from ba62ab4 to ee4dc12 Compare May 7, 2026 21:31
@reubeno
Copy link
Copy Markdown
Member

reubeno commented May 7, 2026

@liunan-ms Is the group actually getting used for anything? Or is it just a diagnostic data point? (I would hope nothing is relying on it for routing correctness.)

@liunan-ms
Copy link
Copy Markdown
Contributor Author

liunan-ms commented May 8, 2026

@liunan-ms Is the group actually getting used for anything? Or is it just a diagnostic data point? (I would hope nothing is relying on it for routing correctness.)

It's metadata surfaced on azldev package list output to help users understand why a package resolved the way it did (which component-group provides the baseline, which package-group overrides it). Nothing replies on it so this change will not break anything.

@reubeno
Copy link
Copy Markdown
Member

reubeno commented May 9, 2026

@liunan-ms Is the group actually getting used for anything? Or is it just a diagnostic data point? (I would hope nothing is relying on it for routing correctness.)

It's metadata surfaced on azldev package list output to help users understand why a package resolved the way it did (which component-group provides the baseline, which package-group overrides it). Nothing replies on it so this change will not break anything.

Given that's the case, I'd recommend that we replace 'group' with groups, then, and make it a list? We can clarify whether each group is a component or a package.

…entGroups'

Replace the single Group field on PackageListResult with two independent
sorted []string fields: PackageGroups (every package-group whose 'packages'
list contains the package; always empty for SRPM rows) and ComponentGroups
(every component-group the resolved component belongs to). Both fields are
guaranteed non-nil so JSON output is '[]' instead of 'null'.

Updates the table output, JSON schema, CLI help, how-to docs, and unit
tests accordingly.
Copilot AI review requested due to automatic review settings May 11, 2026 23:30
Copy link
Copy Markdown
Contributor

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 on lines +77 to +80
Each result has two independent group lists. 'packageGroups' is every package-group whose
'packages' list contains the package (always empty for SRPM rows). 'componentGroups' is
every component-group the resolved component belongs to. Both lists are sorted alphabetically
and are emitted as empty arrays (never null) when there are no memberships.`,
groupOf := make(map[string]string)
// Build an index: pkgName → sorted list of package-group names that contain it.
// Used by '-a', '--rpm-file', and '-p' modes for the [PackageListResult.PackageGroups]
// list on each result. A package may appear in multiple package-groups; all are reported.
Comment on lines +367 to +370
// of package-group names whose 'packages' list contains it. A package may appear in any
// number of package-groups; the returned slice for each package is sorted alphabetically
// for stable output. Packages with no package-group membership are omitted (a missing key
// reads as a nil slice, which is the desired empty-list behavior).
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.

5 participants