Skip to content

fix(cli): print data keys as they are and label refusal details as details - #911

Open
Brooooooklyn wants to merge 1 commit into
mainfrom
fix/operator-output-keys
Open

Brooooooklyn wants to merge 1 commit into
mainfrom
fix/operator-output-keys

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

How this was found

During a live end-to-end run of a self-hosted platform, done to test the security audits work (PR #886), two operator CLI text outputs looked wrong. Neither bug is part of that feature, and both exist on main today, so this PR fixes them on their own.

Bug 1: hyphens in data keys turn into spaces

Repro on main

On any platform, preview a full worker rollback in text mode:

void platform worker rollback-all --plan

The preview's versions object is keyed by worker name (proxy, email-gateway, api, ...).

  • Expected: email-gateway: <version id>
  • Actual: Email gateway: <version id>

With the security audits branch, void platform security models --block @cf/zai-org/glm-5.3 --plan printed @cf/zai org/glm 5.3: 1, which is a model ID nobody can copy back into a command.

Root cause

fieldLabel in packages/void/src/cli/operator-cmd.ts:113 (on main) turns every object key into a readable label: it splits on spaces, _ and -, lowercases, and capitalizes the first word. That is right for field names like createdAt or project_id, but wrong for keys that are data.

Fix

API field names are camelCase or snake_case. A small character check (isFieldName, no regex) now treats any key with another character (-, /, @, ., :, space) as data and prints it unchanged. Field names are still labelled as before (createdAt -> Created at, project_id -> Project ID).

Bug 2: plain refusals print "Partial result:"

Repro on main

On a self-hosted platform, run any hosted-only worker command in text mode:

void platform worker list

The API replies 501 capability_unavailable with details: { capability: "hosted-platform-operations" } (platform/packages/api/src/operator/worker-operations.ts:20).

  • Expected: the message, then Details: and the details.
  • Actual:
    platform: Manage this self-hosted Void platform with `void platform upgrade`.
    Partial result:
    { "capability": "hosted-platform-operations" }
    

"Partial result" tells the operator that some work was done, but nothing ran. Other refusals with details hit the same path, for example revision_conflict, plan_has_accounts and ownership_transfer_blocked.

Root cause

packages/void/src/cli/cli-main.ts:103 (on main) prints Partial result: for every OperatorClientError that has details, whatever the error code.

Fix

isPartialResult prints Partial result: only when the error code is partial_failure or the details say partial: true. Any other error prints Details:. The details are still printed in full, and --json output does not change.

Tests

  • packages/void/test/unit/operator-cli.test.ts: humanLines keeps @cf/zai-org/glm-5.3, email-gateway and api.example.com unchanged and still labels createdAt and project_id.
  • packages/void/test/integration/operator-cli.test.ts (real CLI subprocess against a stub HTTP server):
    • worker rollback-all --plan prints email-gateway: version-gateway.
    • A 501 capability_unavailable refusal prints Details: and not Partial result.
    • The existing rollback partial-failure test still expects Partial result:.
  • Without the fix, all three new tests fail. With the fix, both test files pass.
  • vp run --filter ./packages/void typecheck, vp lint and vp fmt --check pass on the changed files.
  • vp run test: everything this PR touches passed. Some platform API integration tests timed out because the machine was heavily loaded (load average above 100). None of them use the changed code except operator-cli-e2e, which passed on rerun. The rest passed on rerun or with a longer timeout.
  • In this fresh worktree, vp check reported only "Invalid tsconfig" errors for playgrounds whose .void/tsconfig.json had not been generated yet.

🤖 Generated with Claude Code

…tails

Operator text output turned every object key into a label, so data keys
such as worker names ("email-gateway") and model IDs
("@cf/zai-org/glm-5.3") had their hyphens replaced with spaces. Keys that
are not camelCase or snake_case field names now print unchanged.

A failed platform request with details always printed "Partial result:",
even for a plain refusal such as the self-hosted capability error. The CLI
now prints "Partial result:" only for partial failures and "Details:" for
everything else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T22:53:49.590398Z c5a231f 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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-operator-output-keys-void-cloud.voidzero-docs.workers.dev (commit c5a231f)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://7a09eb15-void-cloud.voidzero-docs.workers.dev c5a231f 2026-11-23T22:53:13.329Z Visit the dashboard ↗

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.

1 participant