Skip to content

feat(pkg): split list 'group' column into 'packageGroups' and 'componentGroups'#165

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

feat(pkg): split list 'group' column into 'packageGroups' and 'componentGroups'#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

@liunan-ms liunan-ms commented May 7, 2026

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 replaces 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.

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

[
...
 {
    "packageName": "fence-agents",
    "type": "srpm",
    "packageGroups": [],
    "componentGroups": [
      "base-packages"
    ],
    "component": "fence-agents",
    "publishChannel": "rpm-base-srpm"
  },
 {
    "packageName": "fence-agents-amt-ws",
    "type": "rpm",
    "packageGroups": [
      "exceptions-packages"
    ],
    "componentGroups": [
      "base-packages"
    ],
    "component": "fence-agents",
    "publishChannel": "rpm-sdk"
  },
  {
    "packageName": "fence-agents-apc",
    "type": "rpm",
    "packageGroups": [],
    "componentGroups": [
      "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
@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.

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 thread internal/app/azldev/cmds/pkg/list.go
Comment thread internal/app/azldev/cmds/pkg/list.go Outdated
Comment thread internal/app/azldev/cmds/pkg/list.go Outdated
@liunan-ms liunan-ms force-pushed the liunan/pkg_list_group branch from 9bceee5 to 5979a8e Compare May 14, 2026 22:51
@liunan-ms liunan-ms changed the title feat(pkg list): fall back group to component-group(s) if a binary RPM is not in any package-group feat(pkg): split list 'group' column into 'packageGroups' and 'componentGroups' May 14, 2026
liunan-ms added 2 commits May 14, 2026 22:54
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.
…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.
@liunan-ms liunan-ms force-pushed the liunan/pkg_list_group branch from 5979a8e to 94bd53f Compare May 14, 2026 22:54
@liunan-ms
Copy link
Copy Markdown
Contributor Author

@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.

Good idea! Instead of having a nested groups with two group lists, I just removed 'group' and add 'packageGroups' and 'componentGroups' lists to indicate the group that the package belongs to.

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