Skip to content

Reject folder ids on dashboards get, check, and delete - #225

Open
hayaa wants to merge 2 commits into
masterfrom
dashboards-reject-folder-ids
Open

hayaa wants to merge 2 commits into
masterfrom
dashboards-reject-folder-ids

Conversation

@hayaa

@hayaa hayaa commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Context

Agents inventorying dashboards often pass a folder name (BMLL, AWS) or a folder UUID to cx dashboards get. That hits GetDashboard, which returns 400 Bad Request: dashboard_id is not 21 characters length. Catalog list already works; the mistake is using the wrong identifier. This PR fails those calls locally with a pointer to catalog id vs folder UUID/--folder.

Linked Issues

N/A — prompted by a PoC inventory failure (folder names/UUIDs passed to get), not a tracked ticket.

Design

validate_dashboard_id lives in src/commands/dashboards/mod.rs and requires a non-empty 21-character id (unicode scalar count). run_get, run_delete, and run_check (by-id) call it before HTTP. Delete confirmation in main.rs runs after this check so a folder name never prompts. Help text on get/delete/check and the cx-dashboards / cx-search-dashboard skills document the same rule: catalog item id for get; folder UUIDs only for --folder / --parent-id; inventory a folder by filtering catalog JSON.

Key Decisions

  • Local 21-char check only — do not relax the server validator, and do not add catalog --folder in this PR (list-then-filter is enough for inventory).
  • Length-only (not nanoid alphabet) so we match the API error agents already see and keep the check cheap.
  • Validate before the delete --yes prompt so a bad id is never treated as a destructive write.

Changes

  • cx dashboards get|delete|check <id> reject ids that are not 21 characters, with an error that names catalog vs folders list vs filter-by-folder.
  • Clap help and examples use 21-character dashboard ids.
  • Skills (cx-dashboards 0.2.1, cx-search-dashboard 0.1.1, deploy reference) tell agents not to get a folder id or name.

Testing

  • cargo fmt
  • cargo clippy --locked -- -D warnings
  • cargo test --locked --lib --test dashboard_commands --test dashboards --test console_urls
    Unit tests cover accept nanoid / reject BMLL, catalog, UUID, blank. Integration tests cover get without HTTP for a folder UUID, plus existing get/delete/check paths with 21-char ids.

Risks & Rollout

CLI-only, no API or schema change. Ids that are not 21 characters never reached a successful GetDashboard before; those calls now fail earlier with a clearer message. Rollback is revert. Skills version bumps apply on next cx skills install.

Out of Scope / Follow-ups

No cx dashboards catalog --folder filter flag. No change to dashboards-api validation. Folder get/list commands are unchanged.

Made with Cursor

Agents were passing folder names and UUIDs to get, which hit the API 21-char validator. Fail locally with catalog vs folder guidance instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hayaa
hayaa requested a review from a team as a code owner September 7, 2026 20:22
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Haya Stern seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 070b4c82d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs
.await?;
}
DashboardsCmd::Delete { dashboard_id } => {
commands::dashboards::validate_dashboard_id(&dashboard_id)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the live delete test for the new validator

When the credentialed E2E workflow runs cargo test --locked --test e2e -- --ignored --test-threads=1 (.github/workflows/e2e.yml:34-38), dashboards_delete_nonexistent still passes the 18-character nonexistent-id-000 and asserts that stderr contains Deleting dashboard (tests/e2e/dashboards/mod.rs:48-64). This validation now returns before that status line is emitted, so every E2E run will deterministically fail; use a nonexistent 21-character ID in that test or update it to assert the new local rejection.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T20:26:21.609564Z 070b4c8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Local id validation now rejects shorter strings before the Deleting status line, which would fail this ignored test in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
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