Skip to content

refactor(status): share CLI status reporter constructor - #1507

Merged
skevetter merged 1 commit into
mainfrom
refactor/status-cli-reporter-constructor
Oct 16, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/status-cli-reporter-constructor

Conversation

@skevetter

@skevetter skevetter commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

Four CLI commands (ci, config apply, provider status, workspace up status) each built a status.NewReporter with the same boilerplate and the same ForPipeline wrap. Only format, prefix, labels, envelope, and pipeline differed, so a single constructor removes the duplication without changing output.

Changes

  • pkg/status/render.go: add CLIOptions and NewCLIReporter(o CLIOptions) (Reporter, error). It wraps NewReporter with SuppressFailureDetails: true and calls ForPipeline.
  • cmd/ci/status.go, cmd/config/apply.go, cmd/provider/status.go, cmd/workspace/up/status.go: newStatusReporter now calls status.NewCLIReporter. Signatures, label maps, envelopes, and the variadic verbose handling in provider and workspace/up are unchanged.
  • Not changed: NewReporter, ForPipeline, all call sites, existing tests.

Verification

  • Equivalence (throwaway tests, deleted before commit): for each package, the pre-change literal and the new newStatusReporter were driven with the same events and their output compared byte-for-byte.
    • cmd/ci: plain, identical (122 bytes)
    • cmd/config: plain identical (158 bytes); json identical (894 bytes)
    • cmd/provider: plain identical (162 bytes); json identical (842 bytes)
    • cmd/workspace/up: plain identical (123 bytes); json identical (877 bytes)
  • task cli:format: exit 0
  • task cli:lint:ci: exit 0
  • go test ./pkg/status/... ./cmd/ci/... ./cmd/config/... ./cmd/provider/... ./cmd/workspace/up/...: all ok
  • Smoke: go build -o /tmp/devsy-smoke . succeeded; devsy ci --help, devsy config apply --help, and devsy provider --help print their usage text. devsy up does not exist as a top-level command (it is workspace up), so that probe was not meaningful.
  • CodeRabbit CLI (coderabbit review --agent --committed): completed, 0 findings, 5 files reviewed.

Summary by CodeRabbit

  • Refactor
    • Standardized progress reporting across pipeline commands. Existing output formats, labels, prefixes, verbosity, and JSON envelopes are preserved.
    • Failure details remain suppressed in CLI progress output.

Add status.NewCLIReporter/CLIOptions in pkg/status so the four CLI newStatusReporter constructors (ci, config apply, provider status, workspace up status) share one wrapper around NewReporter and ForPipeline. Output, labels, envelopes and error returns are unchanged.
@skevetter skevetter added the auto-refactor Automated refactor PR label Oct 16, 2026
@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 4a3cbd4
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad2336172f32ecff8f06224

@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 4a3cbd4
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad23361c9ce3b7f1fa5f5f9

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d9ec1ac-b0e4-4054-92cd-553d33025a6f
📥 Commits

Reviewing files that changed from the base of the PR and between 4cc4ca2 and 4a3cbd4.

📒 Files selected for processing: 5
  • cmd/ci/status.go
  • cmd/config/apply.go
  • cmd/provider/status.go
  • cmd/workspace/up/status.go
  • pkg/status/render.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The status package adds a shared constructor for CLI reporters. Four command packages use it to configure reporter options and pipelines.

Changes: CLI status reporting

Layer / File(s) Summary
Shared CLI reporter constructor
pkg/status/render.go
Adds CLIOptions and NewCLIReporter. The constructor creates a reporter with failure details suppressed, applies the configured pipeline, and returns construction errors.
CLI reporter call sites
cmd/ci/status.go, cmd/config/apply.go, cmd/provider/status.go, cmd/workspace/up/status.go
Each status reporter uses NewCLIReporter with its configured pipeline and existing CLI options. The call sites return the constructor result directly.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 4a3cb

The CLI status reporter refactor preserves the reviewed command behavior and is ready to merge after normal checks.

Security architecture risk: ⚪ Minimal · up to 4a3cb

The shared constructor preserves the existing commands’ reporter settings, error handling, and pipeline behavior. No introduced or worsened security risk was identified in this change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed contract affects status presentation for the four migrated CLI commands. The comparison shows no added resource-management operation, credential authority, or deployment configuration; the relevant security exposure is preservation of existing output handling.

Trust Boundaries and Controls

  • observed — The provider command retains its output writer and WriteStatusJSON envelope callback. Moving reporter creation into the shared helper does not replace that output destination or bypass the existing suppression setting.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a shared CLI status reporter constructor.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@skevetter

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@skevetter
skevetter marked this pull request as ready for review October 16, 2026 15:24
@skevetter
skevetter merged commit ce2fce1 into main Oct 16, 2026
109 of 111 checks passed
@skevetter
skevetter deleted the refactor/status-cli-reporter-constructor branch October 16, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-refactor Automated refactor PR size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant