Skip to content

fix(cli): seven defects found by live-testing the CLI against staging - #7176

Merged
waleedlatif1 merged 9 commits into
stagingfrom
fix/cli-validation-round2
Aug 27, 2026
Merged

fix(cli): seven defects found by live-testing the CLI against staging#7176
waleedlatif1 merged 9 commits into
stagingfrom
fix/cli-validation-round2

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Seven defects found by exercising every CLI domain against staging, each independently re-verified before it was fixed. Sixteen reported issues were investigated; eight did not survive verification and are not here.

  • tools get <unversioned> returned NOT_FOUND for 204 of 244 versioned families. A superseded tool stays registered, so resolveToolId short-circuits on the exact hit and the visibility gate then refuses it. Resolution now walks the visible set newest-first, as blocks already do. resolveToolId is untouched — execution depends on an exact id returning that exact id, and none of the 5182 visible ids change.
  • Archived folder paths were truncated to their own name when the parent was still active, so folders delete a/sub and folders restore a/sub addressed different folders and the path/parentPath fields were wrong. Restoring by path also silently picked the first of several archived folders sharing a canonical path — it now refuses and names the folder-id form.
  • workflows activate create switched production with no confirmation while rollback — the same application operation under a different transition — refused without --yes. The destructive-operation classification in the client tests listed activate as non-destructive, which is what kept its sweep from noticing.
  • configure's refusal printed a command without --profile, so following it verbatim wrote the default profile.
  • folders list --parent <missing> 404'd on workflows, tables and knowledge and returned an empty page on files. The empty page is the rule the API already publishes on six list surfaces; two TSDocs asserted the folder lists already followed it, and they did not.
  • tables rows batch-delete exited 0 when nothing matched, while the table equivalent exited 1 on the same shape.
  • Ids opening with - could not be passed at all (1 in 64 short ids), and the -- escape was documented nowhere.

Type of Change

  • Bug fix

Public API behavior change

GET /api/v2/{workflows,tables,knowledge}/folders with a parentPath naming no folder now returns 200 with an empty page instead of 404. Folder mutations keep their 404. Restore-by-path on an ambiguous archived path now returns a conflict instead of restoring an arbitrary match.

Testing

Every fix carries a test that was mutation-verified — the fix reverted, the test confirmed red, the fix restored. bun run lint, bun run check:audits (36/36), both type-checks, 782 CLI tests and 8363 apps/sim tests.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

`tools get github_comment` answered NOT_FOUND while `github_comment_v2` worked,
though the toolId help promises an unversioned name resolves to the newest
version. A superseded tool stays in the registry, so `resolveToolId`
short-circuits on the exact hit and returns it unchanged; the visibility gate
then refuses it because no visible block exposes a v1 tool. 204 base names were
unresolvable this way.

Resolution now walks the visible set newest-first, the way blocks already do.
`resolveToolId` is untouched — execution depends on an exact id returning that
exact id, and none of the 5182 visible ids change under the new path.
The archived folder listing built its path map from the archived rows alone, so
a folder whose parent is still active came back as its own name. Deleting
`a/sub` and restoring `a/sub` therefore disagreed — restore only matched the
truncated `sub` — and the path and parentPath fields were wrong.

The extra read is taken only for the archived scope; active and all keep their
single query, which a test now pins.

Restoring by path also stopped guessing. Archiving, recreating and archiving
again leaves two archived folders with the same canonical path, and the resolver
took the first match, silently restoring the wrong one. It now refuses and names
the folder-id form.
A parentPath naming no folder returned 404 on the workflow, table and knowledge
folder lists, and an empty page on files. The rule the codebase already
publishes is the empty page: V2_FOLDER_FILTER_MISS is appended to the folderPath
filter on six list surfaces, and resolveFolderPathFilter documents why a list
must not become an existence oracle — a 404 claims the collection is missing and
breaks a walk when a folder is deleted mid-pagination.

Both TSDocs asserted the sibling folder lists already behaved that way. They did
not; that premise is corrected here too.

Mutations keep every 404. The miss short-circuits before the row query, because
an unfiltered parent id lists the whole workspace.
`workflows activate create` switched which version production serves with no
confirmation, while `rollback` refused without --yes. They are the same
application operation under two transitions, so gating one and not the other was
an accident of naming.

The destructive-operation classification in the client tests listed activate as
non-destructive, which is what kept its sweep from noticing. Moved, so two
independent tests now hold the gate.
Refusing a root global printed a command to save it — without --profile, so
following it verbatim wrote the default profile and left the named one
untouched. The neighbouring suggestions in this file already carry the flag.

Resolution matches resolveProfile, so SIM_PROFILE is covered too, and the
profile name is redacted like the value beside it.
`tables rows batch-delete` exited 0 when none of the named rows existed, while
the table equivalent exited 1 on the same shape. Only the id-list selection is
checked: a filter answers without a requested count, so the guard self-excludes
and an idempotent sweep still exits 0 on its second run.
Short ids draw from a 64-character alphabet containing one dash, so 1 in 64 open
with one and commander reads it as an unknown option. It reaches `audit-logs
get` and the custom-tool commands, and the escape was documented nowhere.

The hint is appended only for a lone dash followed by two or more characters
carrying an uppercase letter or digit — a shape no flag on this surface has — so
a misspelt flag keeps commander's own suggestion.
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 27, 2026 10:01pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes seven live-tested CLI and API defects while aligning generated documentation and contract projections.

  • Resolves unversioned tool names against the caller-visible catalog.
  • Corrects archived folder paths and rejects ambiguous restore-by-path operations.
  • Makes missing folder filters consistently return empty pages.
  • Adds confirmation for workflow activation and failure handling for empty batch deletes.
  • Preserves and safely quotes selected profiles in configure suggestions.
  • Documents and diagnoses dash-prefixed positional IDs.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/sim-cli/src/commands/configure.ts The selected profile now follows CLI-over-environment precedence and is safely quoted for POSIX pasteable commands.
packages/sim-cli/src/runtime/build.ts Unknown-option handling now provides the documented -- escape for ID-shaped positional arguments while deliberately preserving Commander diagnostics for ordinary flag typos.
apps/sim/lib/catalog/application/tool-scope.ts Adds visible-set version resolution while preserving exact visible tool IDs.
apps/sim/lib/workspace-files/application/workspace-file-folders.ts Archived path restoration now rejects ambiguous canonical paths instead of selecting an arbitrary folder.
apps/sim/lib/uploads/contexts/workspace/workspace-file-folder-manager.ts Archived folder paths are built with active and archived ancestors so canonical paths are not truncated.
apps/sim/lib/workflows/application/workflow-folders.ts Missing parent-path filters now short-circuit to an empty folder page.
apps/sim/lib/table/application/folders.ts Table folder listing adopts the shared empty-page behavior for unmatched parent paths.
apps/sim/lib/knowledge/application/folders.ts Knowledge folder listing adopts the shared empty-page behavior for unmatched parent paths.

Reviews (3): Last reviewed commit: "fix(cli): quote a profile name a pasted ..." | Re-trigger Greptile

Comment thread packages/sim-cli/src/contract/commands.ts
Comment thread packages/sim-cli/src/commands/configure.ts Outdated
Comment thread packages/sim-cli/src/runtime/build.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

The suggestion configure prints is meant to be pasted, and it interpolated the
profile name bare. Profile-name validation is creation-only by design — the
validator says so, because a hand-written `[profile my stack]` has to keep
resolving — so a name carrying whitespace, or a `;` that would end the pasted
command and start another, reaches this message unchecked.

Names that already satisfy the creation rule stay bare; the rest are single
quoted, embedded quotes included. Redaction runs first, so a control character
becomes a space and is then quoted rather than splitting the command.
@waleedlatif1 waleedlatif1 changed the title fix(cli,v2): seven defects found by live-testing the CLI against staging fix(cli): seven defects found by live-testing the CLI against staging Aug 27, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
waleedlatif1 merged commit 479ae8c into staging Aug 27, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/cli-validation-round2 branch August 27, 2026 22:14
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.

1 participant