Skip to content

feat: improve --list-csv and --list output#1810

Open
bcouetil wants to merge 1 commit intofirecow:masterfrom
bcouetil:feat/improve-list-csv-output
Open

feat: improve --list-csv and --list output#1810
bcouetil wants to merge 1 commit intofirecow:masterfrom
bcouetil:feat/improve-list-csv-output

Conversation

@bcouetil
Copy link
Copy Markdown
Collaborator

@bcouetil bcouetil commented Mar 21, 2026

Closes #1809

Changes

  • allowFailure: render exit codes as [42,137] instead of just true/false in both --list and --list-csv
  • needs: empty when not specified (job follows stage ordering), [] when explicitly set to no dependencies — in both --list and --list-csv
  • description column: always shown in --list, never in --list-csv (stable CSV structure)
  • Shared private helpers formatAllowFailure and formatNeeds to avoid logic duplication

Context

These changes improve the usefulness of --list-csv for automated testing of GitLab CI job rules.

Note: the Windows id -u fix (originally in this PR) has been moved to a dedicated PR for #1684.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commander.ts">

<violation number="1" location="src/commander.ts:213">
P2: `hasDescriptions` is derived from unfiltered jobs, so `--list` can incorrectly print a `description` column based only on hidden `when: never` jobs.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@bcouetil bcouetil force-pushed the feat/improve-list-csv-output branch from b953744 to 36923f2 Compare March 21, 2026 13:48
@bcouetil bcouetil requested review from ANGkeith and firecow March 21, 2026 17:51
@bcouetil bcouetil self-assigned this Mar 21, 2026
@firecow
Copy link
Copy Markdown
Owner

firecow commented Apr 3, 2026

Having "unstable/non-deterministic" columns in CSV seems like a anti-pattern for people using CSV parsers doesn't it? @bcouetil

I can understand that --list doesn't need to show "description" column, its for humans after all.

hasDescriptions is computed before when: never filtering. If only a never job has a description, --list still shows the column for visible jobs that don't use it.

This id -u fix really should be in a PR of its own.

@bcouetil
Copy link
Copy Markdown
Collaborator Author

bcouetil commented Apr 3, 2026

Hello, nice to talk to you once again 😊

Having "unstable/non-deterministic" columns in CSV seems like a anti-pattern for people using CSV parsers doesn't it? @bcouetil
I can understand that --list doesn't need to show "description" column, its for humans after all.

You meant --list-csv I guess. I agree, I will remove this column entirely in this case.

hasDescriptions is computed before when: never filtering. If only a never job has a description, --list still shows the column for visible jobs that don't use it.

I wanted to have the column showing independently from activated jobs. In fact, consistency for PEOPLE using the descriptions, and consistency for those not using it. I guessed a on/off usage on a project... I personally do not use it, at all. So my guess is far from perfect. Please tell me your final wish on this.

This id -u fix really should be in a PR of its own.

OK, PR incoming 🫡

@bcouetil bcouetil force-pushed the feat/improve-list-csv-output branch from 36923f2 to f0caf7a Compare April 3, 2026 10:57
@firecow
Copy link
Copy Markdown
Owner

firecow commented Apr 3, 2026

Looks good — description is already dropped from --list-csv in this diff, which addresses my concern. The hasDescriptions/--list point is out of scope for this PR then.

@bcouetil bcouetil force-pushed the feat/improve-list-csv-output branch from f0caf7a to 8fbb983 Compare April 3, 2026 11:31
@bcouetil
Copy link
Copy Markdown
Collaborator Author

bcouetil commented Apr 3, 2026

Looks good — description is already dropped from --list-csv in this diff, which addresses my concern. The hasDescriptions/--list point is out of scope for this PR then.

Sorry, I saw your comment while adding the same to --list... I should not have squashed my commits, but I wanted to share the logic between the too.

I kept description on --list, but added both allow_failure and needs change, to have maximum info.

Screenshot 2026-04-03 at 13 35 31 Screenshot 2026-04-03 at 13 38 11

What do you think @firecow ?

…om csv

- Remove description column from --list-csv for stable CSV structure
  (description is already visible in --list)
- Render allowFailure exit_codes as [code1,code2] instead of true/false
  in both --list and --list-csv
- Distinguish null needs (stage ordering, no output) from [] needs
  (explicitly no dependencies) in both --list and --list-csv
- Extract shared private helpers formatAllowFailure and formatNeeds
- Update README with comprehensive examples for all cases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bcouetil bcouetil force-pushed the feat/improve-list-csv-output branch from 8fbb983 to ac73444 Compare April 3, 2026 11:45
@bcouetil
Copy link
Copy Markdown
Collaborator Author

bcouetil commented Apr 3, 2026

I've now rebased. I think it is finished on my side.

@bcouetil bcouetil requested a review from firecow April 3, 2026 11:49
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.

Improve --list-csv and --list output: allowFailure exit codes, needs distinction, conditional description

2 participants