Skip to content

feat(cli): add --no-health opt-out to recipe list#1314

Merged
mchmarny merged 1 commit into
NVIDIA:mainfrom
njhensley:cli/no-health-recipe-list
Jun 11, 2026
Merged

feat(cli): add --no-health opt-out to recipe list#1314
mchmarny merged 1 commit into
NVIDIA:mainfrom
njhensley:cli/no-health-recipe-list

Conversation

@njhensley

Copy link
Copy Markdown
Member

Summary

Add a --no-health (alias --skip-health) opt-out flag to aicr recipe list that skips the per-leaf structural-health computation and renders only the #1208 enumeration columns/fields.

Motivation / Context

As of #1228, aicr recipe list resolves every leaf overlay through pkg/health.Compute (via client.ComputeHealth) on every invocation to populate the STATUS/COVERAGE columns (table) and the health block (json/yaml). The previously-cheap catalog enumeration now always pays the full health-compute cost, with no way to opt out. For purely interactive "what overlays exist?" lookups — or scripted/CI callers that only consume name/criteria/is_leaf/source — the health resolution is wasted latency.

Raised as a non-blocking follow-up in PR #1302 review.

Fixes: #1311
Related: #1228, #1302

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Documentation update

Component(s) Affected

  • CLI (cmd/aicr, pkg/cli)
  • Docs/examples (docs/, examples/)

Implementation Notes

  • The client.ComputeHealth(...) call is gated behind showHealth := !cmd.Bool(flagNoHealth) and skipped entirely when the flag is set — a real latency win, not just a column drop.
  • When skipped, healthByName stays nil: the table emits the pre-aicr recipe list: add structural-health + coverage columns #1228 8-column header (no STATUS/COVERAGE), and json/yaml omit the health block via the existing omitempty (reading a nil map yields the zero-value pointer, so each entry's Health is nil).
  • Gating lives in pkg/cli only; no pkg/health or facade changes. Default behavior (no flag) is unchanged from aicr recipe list: add structural-health + coverage columns #1228.

Testing

go test ./pkg/cli/...          # pass
golangci-lint run -c .golangci.yaml ./pkg/cli/...   # 0 issues (pinned v2.12.2)

New tests cover the flag across table/json/yaml, the --skip-health alias (byte-identical output), and the empty-result + --no-health intersection — including that the health block is absent in json/yaml when set. The YAML test decodes and asserts no health key (rather than a substring scan) plus a leaf-present guard.

pkg/cli coverage: 68.7% → 68.7% (flat, no regression). No new exported functions.

Risk Assessment

  • Low — Isolated, additive CLI flag; default path unchanged; easy to revert.

Rollout notes: Backwards compatible. The flag defaults to false, so existing invocations and scripts see the #1228 output unchanged.

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

`aicr recipe list` resolves every leaf overlay through
pkg/health.Compute
on each invocation to populate the STATUS/COVERAGE columns and the
health
block (NVIDIA#1228). Add a --no-health (alias --skip-health) flag that skips
the
ComputeHealth call entirely and renders the pre-NVIDIA#1228 enumeration shape:
the table omits the STATUS/COVERAGE columns and json/yaml omit the
health
block. Default behavior is unchanged.

Gating lives in pkg/cli only; no pkg/health or facade changes.
Documented
in docs/user/cli-reference.md and covered by table/json/yaml/alias/empty
tests, including that the health block is absent in json/yaml when set.

Closes NVIDIA#1311
@njhensley njhensley requested a review from a team as a code owner June 11, 2026 16:31
@njhensley njhensley added the theme/validation Constraint evaluation, health checks, and conformance evidence label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c95bcaa7-44b9-478c-bce6-4e9bbfbf6a3d

📥 Commits

Reviewing files that changed from the base of the PR and between 6e95906 and be5682e.

📒 Files selected for processing (4)
  • docs/user/cli-reference.md
  • pkg/cli/consts.go
  • pkg/cli/recipe_list.go
  • pkg/cli/recipe_list_test.go

📝 Walkthrough

Walkthrough

This PR implements a --no-health (alias --skip-health) boolean flag for aicr recipe list to skip per-leaf structural-health computation and omit health-related output columns. The flag gates the client.ComputeHealth call; when disabled, table output omits STATUS/COVERAGE columns and JSON/YAML output omits the health field entirely. Changes include the flag constant, command action conditional logic, adapted table/JSON/YAML rendering in writeCatalogEntries, comprehensive end-to-end tests covering all output formats and flag aliases, and CLI reference documentation with usage examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • NVIDIA/aicr#1302: Introduced health rendering logic to recipe list that this PR conditionally disables via the --no-health flag.

Suggested labels

area/cli, area/docs, size/M

Suggested reviewers

  • mchmarny
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a --no-health opt-out flag to the recipe list CLI command, which is the primary focus of this PR.
Description check ✅ Passed The PR description is comprehensive and directly related to the changeset, explaining the motivation, implementation approach, testing, and risk assessment for the --no-health flag feature.
Linked Issues check ✅ Passed The PR fully implements the objectives from issue #1311: adds --no-health/--skip-health flags, skips ComputeHealth when set, omits STATUS/COVERAGE in table and health block in JSON/YAML, includes documentation and tests covering table/json/yaml/alias/empty-result scenarios, and maintains backward compatibility.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the --no-health opt-out flag for recipe list as specified in issue #1311; no out-of-scope modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@mchmarny mchmarny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Clean implementation. The showHealth gate is in exactly the right place (CLI layer, facade untouched), nil healthByName correctly signals both the table renderer and the json/yaml omitempty path, and test coverage is thorough (table, JSON, YAML, alias, empty-result intersection). One nit on a PR reference in a code comment; same pattern appears in the writeCatalogEntries godoc at ~line 254 — both can drop the #1228 number. No correctness issues; good to merge once CI clears.

Comment thread pkg/cli/recipe_list.go
@@ -151,20 +157,30 @@ Include overlays from an external data directory:
fmt.Sprintf("unknown output format %q, valid formats are: json, yaml, table", cmd.String(flagFormat)))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: pre-#1228 will rot — PR references in code comments belong in the commit/PR description. Drop the issue number; the behaviour description ("no STATUS/COVERAGE columns, no health block") stands on its own.

@mchmarny mchmarny merged commit 5f8647d into NVIDIA:main Jun 11, 2026
34 of 35 checks passed
@njhensley njhensley deleted the cli/no-health-recipe-list branch June 23, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli area/docs size/L theme/validation Constraint evaluation, health checks, and conformance evidence

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: add --no-health opt-out to aicr recipe list

3 participants