Skip to content

fix: accept cat column lists - #842

Open
margaretjgu wants to merge 1 commit into
fix/numeric-union-flagsfrom
fix/cat-column-lists
Open

margaretjgu wants to merge 1 commit into
fix/numeric-union-flagsfrom
fix/cat-column-lists

Conversation

@margaretjgu

Copy link
Copy Markdown
Member

Accept a comma separated cat column list, including aliases the published enum dropped. Relates to #839.

@margaretjgu margaretjgu added the auto-loop Opt this PR into the CI and review repair loop label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

👋 This PR can use the first-failure repair loop on GitHub Actions and Buildkite.

Labels

  • auto-loop: triage the first CI or Buildkite failure and commit in-repo fixes (also AI review and CodeQL)
  • skip-ai-review: silences the review bot
  • skip-auto-loop: halt the repair loop (also added when you comment /stop)

Comments

  • /stop: halt the repair loop
  • /bad on a finding: the bot writes a short do not re-flag line from the finding and your note into .github/skills/ai-review-memory.md. A reason is optional.
    • Example: /bad false positive. This path is already encoded.

@margaretjgu margaretjgu removed the auto-loop Opt this PR into the CI and review repair loop label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

✅MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 0.41s
✅ REPOSITORY gitleaks yes no no 35.19s
✅ REPOSITORY git_diff yes no no 0.07s
✅ REPOSITORY secretlint yes no no 6.88s
✅ REPOSITORY trivy yes no no 19.1s
✅ TYPESCRIPT eslint 4 0 0 3.59s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Startup perf: PR vs merge-base ✅

command PR base delta
elastic 51.1 ms 50.5 ms +1.2%
elastic --help 50.9 ms 51.2 ms -0.7%
elastic es --help 95.7 ms 94.4 ms +1.3%
elastic es 96.7 ms 95.0 ms +1.8%
elastic cloud --help 53.1 ms 53.4 ms -0.6%
elastic cloud 53.6 ms 53.5 ms +0.1%
elastic kb --help 99.4 ms 97.9 ms +1.5%
elastic kb 98.6 ms 96.5 ms +2.2%
elastic es indices --help 87.3 ms 86.2 ms +1.3%
elastic es indices update-aliases --help 168.6 ms 166.6 ms +1.2%

Comment thread src/factory.ts
Comment on lines +602 to +605
// Cat `h` and `s` are a comma-separated list, and the published enum drops
// the spec aliases (`s`, `dpr`, `mb`). Keep the string and check that it is
// a string or a list of strings.
const columnLists = schemaArgs.filter((a) => a.description.startsWith('Comma-separated list of column names'))

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.

Another one where the root cause is upstream schema data, not the CLI. A lot of this probably needs to be applied in @elastic/schemas, either via the ES spec or the code generator.

We'd need to ask others on the team if it makes sense to change CatBase.ts in the ES spec to make some of these column types | string unions and add the missing aliases. _cat APIs are kinda weird and special because the intended audience is... CLI users who want ASCII tables. 😆

Or if this has to land as a stopgap, update the PR description to explain why an upstream fix is not possible or that we're blocked on a decision there,

Comment thread src/factory.ts
// Cat `h` and `s` are a comma-separated list, and the published enum drops
// the spec aliases (`s`, `dpr`, `mb`). Keep the string and check that it is
// a string or a list of strings.
const columnLists = schemaArgs.filter((a) => a.description.startsWith('Comma-separated list of column names'))

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.

Also: selecting fields by description prefix is fragile. Upstream wording isn't stable, and if it changes upstream, this silently stops matching and #839 comes back. Or if an unrelated field ever starts with this text, it loses validation without anyone noticing.

If a CLI-side exception is the only way, maybe key it on schema structure, or as a hard-coded list of APIs or namespaces.

Comment thread src/factory.ts
Comment on lines +614 to +620
for (const f of columnLists) {
if (f.schemaKey in props) {
props[f.schemaKey] = {
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
}
}
}

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.

This drops all column validation for the matched flags. Replacing the schema with string | string[] means typos like --h idd or --s nmae now pass --dry-run for ml-jobs, ml-datafeeds, ml-data-frame-analytics, etc. Those mistakes only show up as a server error at runtime.

If a stopgap is kept, consider splitting on , and checking items against the enum plus the known aliases, or getting the upstream types fixed so anyOf handles it.

This branch has not been deployed

No deployments
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.

2 participants