Skip to content

revamp 'cscli console status' to be all-in-one - #4592

Open
buixor wants to merge 7 commits into
masterfrom
cscli-console-status-imp
Open

revamp 'cscli console status' to be all-in-one#4592
buixor wants to merge 7 commits into
masterfrom
cscli-console-status-imp

Conversation

@buixor

@buixor buixor commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 4, 2026 08:48
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

@buixor: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

Copilot AI 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.

Pull request overview

This PR revamps cscli console status into an all-in-one status report that always succeeds, showing both local sharing options and (when possible) the live Console/CAPI/PAPI connection state. It also centralizes CAPI/PAPI status querying logic so capi, papi, and console status commands report consistent information.

Changes:

  • Add shared core/consolestatus helpers for querying CAPI authentication/enrollment/subscription and PAPI permissions/last-order timestamp.
  • Update cscli console status output (human/json/raw) to include a “Console connection” section and to remove console_management from “sharing options”.
  • Adjust config/test behavior so a fully empty online credentials file is treated as “not registered” (normal state) rather than a “missing field” misconfiguration.

Reviewed changes

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

Show a summary per file
File Description
test/bats/09_console.bats Updates console status expectations; adds coverage for “not registered” and “missing credentials file” behavior.
test/bats/04_capi.bats Updates CAPI status test to treat fully empty credentials as “not registered” with a clearer message.
pkg/csconfig/console.go Introduces CONSOLE_SHARE_CONFIGS to exclude console_management from sharing-options display.
pkg/csconfig/api.go Treats an empty CAPI credentials file as “not registered” (debug log, no warning).
cmd/crowdsec-cli/core/consolestatus/consolestatus.go New shared package for CAPI/PAPI live-status querying and decision-management derivation.
cmd/crowdsec-cli/clipapi/papi.go Refactors cscli papi status to use consolestatus.QueryPAPIInfo.
cmd/crowdsec-cli/cliconsole/console.go Makes cscli console status resilient to missing/invalid online creds; adds enriched JSON output and removes console_management from raw output.
cmd/crowdsec-cli/cliconsole/console_table.go Adds a “Console connection” table and limits sharing options to CONSOLE_SHARE_CONFIGS.
cmd/crowdsec-cli/clicapi/capi.go Refactors cscli capi status to use consolestatus.QueryCAPIStatus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/crowdsec-cli/cliconsole/console_table.go
Comment thread cmd/crowdsec-cli/cliconsole/console.go
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.86624% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.79%. Comparing base (500a432) to head (6b6e28d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
cmd/crowdsec-cli/cliconsole/console.go 58.20% 24 Missing and 4 partials ⚠️
...d/crowdsec-cli/core/consolestatus/consolestatus.go 52.17% 16 Missing and 6 partials ⚠️
cmd/crowdsec-cli/cliconsole/console_table.go 44.82% 16 Missing ⚠️
cmd/crowdsec-cli/clipapi/papi.go 40.00% 3 Missing ⚠️
cmd/crowdsec-cli/clicapi/capi.go 50.00% 1 Missing and 1 partial ⚠️
pkg/apiserver/apiserver.go 0.00% 2 Missing ⚠️
pkg/apiserver/papi.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4592      +/-   ##
==========================================
- Coverage   64.35%   63.79%   -0.57%     
==========================================
  Files         499      517      +18     
  Lines       38550    39372     +822     
==========================================
+ Hits        24808    25116     +308     
- Misses      11415    11883     +468     
- Partials     2327     2373      +46     
Flag Coverage Δ
bats 41.64% <52.86%> (-0.02%) ⬇️
unit-linux 40.51% <0.00%> (-0.07%) ⬇️
unit-windows 29.20% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@buixor

buixor commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/kind enhancement
/area cscli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cscli kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants