Skip to content

FLPATH-4895: Replace SP provider with environment agents and bump control-plane - #34

Merged
jenniferubah merged 3 commits into
dcm-project:mainfrom
jenniferubah:env-agent
Sep 29, 2026
Merged

jenniferubah merged 3 commits into
dcm-project:mainfrom
jenniferubah:env-agent

Conversation

@jenniferubah

Copy link
Copy Markdown
Contributor

Summary

  • Bump control-plane to latest
  • Replace dcm sp provider with dcm agent (list/get) via the Agent Manager client
  • Update SP resource filtering/table: --provider / PROVIDER → --agent-name / AGENT
  • Update documentation

Related to: https://redhat.atlassian.net/browse/FLPATH-4895

Assisted-By: Cursor AI

Assisted-By: Cursor AI

Signed-off-by: Jennifer Ubah <cju.cipher@gmail.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Replace SP providers with environment agents and bump control plane

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace SP provider commands with top-level environment agent list/get operations.
• Filter and display SP resources by agent name instead of provider.
• Bump control-plane clients and align tests, specifications, and user documentation.
Diagram

graph TD
  U(["CLI User"]) --> R["Root Command"] --> A["Agent Commands"] --> AC["Agent Client"] --> AM["Agent Manager"]
  R --> S["SP Resource"] --> SC["Resource Client"] --> RM["Resource Manager"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Provide a deprecated provider compatibility alias
  • ➕ Reduces disruption for scripts using dcm sp provider
  • ➕ Provides users a staged migration period
  • ➖ Provider and agent identifiers have different semantics
  • ➖ Maintains obsolete command and output contracts
  • ➖ May be impossible if the provider API is no longer available

Recommendation: Use the PR's direct replacement because it matches the new control-plane domain model and generated Agent Manager API without preserving misleading provider semantics. A deprecated alias is only preferable if backward compatibility is required for an upcoming release and a reliable provider-to-agent mapping exists.

Files changed (14) +446 / -231

Enhancement (4) +43 / -41
agent.goImplement environment agent list and get commands +32/-31

Implement environment agent list and get commands

• Converts the former provider command implementation into a top-level agent command backed by the generated Agent Manager client. Adds health-status filtering and agent-specific response parsing and table columns.

internal/commands/agent.go

helpers.goReplace the provider client factory with an agent client factory +3/-3

Replace the provider client factory with an agent client factory

• Imports the generated Agent Manager client and constructs it with the existing authenticated and TLS-aware HTTP client configuration.

internal/commands/helpers.go

root.goRegister the top-level agent command +1/-0

Register the top-level agent command

• Adds the environment agent command group directly beneath the root CLI command.

internal/commands/root.go

sp_resource.goSwitch SP resource filtering and output to agents +7/-7

Switch SP resource filtering and output to agents

• Renames provider table columns and response fields to agent equivalents. Replaces the --provider filter with --agent-name and sends the generated agent_name query parameter.

internal/commands/sp_resource.go

Refactor (1) +0 / -1
sp.goRemove provider commands from the SP command group +0/-1

Remove provider commands from the SP command group

• Stops registering the obsolete provider subcommand, leaving SP resource operations under the SP namespace.

internal/commands/sp.go

Tests (4) +296 / -99
dcm-cli-unit.test-plan.mdAlign the unit-test plan with agent commands +41/-80

Align the unit-test plan with agent commands

• Replaces SP provider test scenarios and requirement mappings with environment agent list/get coverage. Updates SP resource filtering and table expectations from provider fields to agent fields.

.ai/test-plans/dcm-cli-unit.test-plan.md

agent_test.goAdd unit coverage for environment agent commands +222/-0

Add unit coverage for environment agent commands

• Tests agent list/get endpoints, pagination, health filtering, empty output, missing IDs, RFC 7807 errors, and table formatting through mock HTTP servers.

internal/commands/agent_test.go

root_test.goUpdate command registration and argument validation tests +17/-3

Update command registration and argument validation tests

• Removes provider expectations from SP help, verifies agent registration in root help, and checks missing agent IDs as usage errors.

internal/commands/root_test.go

sp_resource_test.goUpdate SP resource tests for agent-based fields +16/-16

Update SP resource tests for agent-based fields

• Changes fixtures, query assertions, output values, and table headers to validate agent-name filtering and display behavior.

internal/commands/sp_resource_test.go

Documentation (3) +104 / -87
dcm-cli.spec.mdReplace provider requirements with environment agent requirements +51/-74

Replace provider requirements with environment agent requirements

• Reframes the CLI specification around top-level agent list/get commands and the Agent Manager client. It also updates SP resource filtering, table columns, command registration, examples, and acceptance criteria to use agent terminology.

.ai/specs/dcm-cli.spec.md

CLAUDE.mdUpdate development guidance for Agent Manager integration +3/-3

Update development guidance for Agent Manager integration

• Documents the generated Agent Manager client, the new agent command file, and the revised read-only command organization.

CLAUDE.md

README.mdDocument environment agent commands and agent-based resources +50/-10

Document environment agent commands and agent-based resources

• Adds agent list/get usage, filters, table output, API routing, and generated-client references. Updates SP resource examples and flags to use agent names and documents soft-deleted resource listing.

README.md

Other (2) +3 / -3
go.modBump the control-plane module +1/-1

Bump the control-plane module

• Updates the control-plane pseudo-version to the September 2026 revision containing the Agent Manager client and revised SP resource API.

go.mod

go.sumRefresh control-plane dependency checksums +2/-2

Refresh control-plane dependency checksums

• Replaces checksums for the previous control-plane revision with checksums for the newly selected version.

go.sum

@qodo-code-review

qodo-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Later resource pages ignore agent ✓ Resolved
Description
newSPResourceListCommand assigns the new AgentName request parameter but does not preserve
--agent-name in the listCmd supplied to the formatter. When an agent-filtered table response has
another page, the displayed command drops that filter and can show resources belonging to other
agents.
Code

internal/commands/sp_resource.go[R92-93]

+			if agentName, _ := cmd.Flags().GetString("agent-name"); agentName != "" {
+				params.AgentName = &agentName
Evidence
The SP resource command constructs its pagination hint with only --page-size, although the request
independently applies AgentName. FormatList then combines the incomplete hint with the returned
page token without restoring omitted filters.

internal/commands/sp_resource.go[67-93]
internal/output/formatter.go[107-112]
README.md[587-599]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
SP resource pagination hints omit the active agent-name filter, causing the suggested next-page command to request resources from every agent.

## Fix Focus Areas
- internal/commands/sp_resource.go[67-93]
- internal/output/formatter.go[107-112]

## Recommended Fix
Include the `--agent-name` value in the command string passed to the formatter with safe command-line quoting, and add a test asserting that a filtered response with `next_page_token` prints a next-page command retaining the agent name.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Later agent pages ignore status ✓ Resolved
Description
newAgentListCommand adds HealthStatus to the request parameters but never appends the selected
--health-status value to listCmd. When a filtered table response has a continuation token,
FormatList prints an unfiltered follow-up command, so subsequent pages can include agents outside
the requested status.
Code

internal/commands/agent.go[R69-71]

+			if healthStatus, _ := cmd.Flags().GetString("health-status"); healthStatus != "" {
+				status := agentapi.ListAgentsParamsHealthStatus(healthStatus)
+				params.HealthStatus = &status
Evidence
The agent command constructs listCmd with only the page size while separately applying the
health-status filter to the API parameters. The formatter uses that incomplete string verbatim when
emitting the next-page command.

internal/commands/agent.go[51-71]
internal/output/formatter.go[107-112]
README.md[624-637]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Agent pagination hints omit the active health-status filter, causing the suggested next-page command to request unfiltered results.

## Fix Focus Areas
- internal/commands/agent.go[51-71]
- internal/output/formatter.go[107-112]

## Recommended Fix
Include the validated `--health-status` value in the command string passed to the formatter, using safe command-line quoting, and add a test asserting that a response with `next_page_token` prints a next-page command retaining the filter.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
⚠️ Tickets: not configured — ticket URL found in PR but could not be fetched — check ticket provider credentials
✅ Compliance rules (platform): 16 rules
Review mode: 🧠 Deep: This is a broad behavioral CLI/API migration with substantial new agent-command logic, dependency/client changes, renamed filters, and many independent code and test paths where multiple subtle defects are plausible.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread internal/commands/agent.go
Comment thread internal/commands/sp_resource.go
Assisted-By: Cursor AI

Signed-off-by: Jennifer Ubah <cju.cipher@gmail.com>
Comment thread internal/commands/agent_test.go
Comment thread internal/commands/sp_resource.go
Assisted-By: Cursor AI

Signed-off-by: Jennifer Ubah <cju.cipher@gmail.com>

@gciavarrini gciavarrini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@jenniferubah
jenniferubah merged commit 376515a into dcm-project:main Sep 29, 2026
4 checks passed
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.

3 participants