Skip to content

improvement(workflow-code): round 11 audit — fix found bugs, remove dead and compatibility code, one home for shared rules - #10379

Open
waleedlatif1 wants to merge 6 commits into
stagingfrom
improvement/workflow-code-r11-audit
Open

waleedlatif1 wants to merge 6 commits into
stagingfrom
improvement/workflow-code-r11-audit

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

A final audit of workflows and workspace as code: six audit agents covered compile/print, catalog/values, workspace-code/SDK, the CLI source commands, the server, and docs/constants. Independent verifiers then tried to refute each finding. 35 of 57 survived; the rest were wrong, deliberate, or not a strict improvement.

Bugs (each has a test that fails on the old code)

  • A reference to an output a block lacks also got W_JSON_REF_UNTYPED once the warning cap cut its W_UNKNOWN_OUTPUT_PATH from the listing. The reporter now records where each code was reported, listed or not.
  • workflows source check and status wrote workspace files (workspace.d.ts, tsconfigs, SDK blocks) without the source-directory lock. They now take it, as the workspace commands do.
  • workflows source params ignored a starter directory's workspace and read the profile's catalog. Check, create and params now share one recordedWorkspace.
  • A code file's E_SYNTAX (and a tool's E_TOOL_CODE) kept Babel's (line:col) suffix with its 0-based column. Both now use babelMessage, like the entry file.
  • The SDK reference printed <McpServerRef> in example calls instead of mcp('<key>'). folder() and file() are fixed the same way.

Dead and compatibility code removed

  • The unused legacyIds/legacyCanonicalIds catalog projection, its contract fields and type.
  • A catch around connect() that could not fire, and requireCachedCatalog.
  • The billing-owner fallback in the source scope: every source operation admits only human principals.
  • apply* operations declared by both status commands, which only plan.
  • A variables.renamed ?? [] fallback.
  • Two unreachable printer branches.
  • SPECIAL_BUILDER_KEYS.

One home for shared rules

  • The SDK major (SDK_MAJOR in @sim/workflow-code/sdk).
  • The server→CLI refusal codes (SOURCE_REFUSAL_CODES), and one renderer for the two workflow source policies.
  • Exit-code help built from the one table, status commands included; one INTERRUPTED_EXIT_CODE.
  • The model-field predicate, the env-name pattern, the stored() check and the resource-key hint.
  • typeCheckWorkspace for both checks.

Docs and help the code contradicted

  • get-started (npm, not Bun, for the type check).
  • limits (a workspace get over a kind limit skips that kind and exits 0).
  • ci (check downloads the catalog once).
  • directory layout (stored-edges.json; the root written.json).
  • MCP URL changes (host or path replaces; query updates).
  • The auth-scheme list.
  • The not-executable error.
  • The tables/ stray-file hint.

Type of Change

  • Bug fix
  • Improvement

Testing

  • bun run generate, bun run lint, bun run type-check, bun run check:audits, check:api-validation:strict, check-block-registry.ts origin/staging, root bun run test.
  • New and changed tests pass the test-audit authoring gate. Each behaviour fix was shown red on the old code by restoring the old file, then green.
  • Final Opus benchmark on staging before this round: 10/10 runs at 100%. Over tasks 1–6 the code path averaged 11.8 turns and 900k tokens per run, against 12.2 and 927k in the previous round.

Checklist

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

…low-sdk and workspace-code

- compile: keep refs to unknown outputs out of W_JSON_REF_UNTYPED past the warning cap
- babelMessage lives in babel.ts and strips (line:column) from code-file syntax errors
- SDK_MAJOR defined once in workflow-code/sdk; workspace-code and the CLI starter use it
- drop SPECIAL_BUILDER_KEYS, dead subflow edge branches, duplicate env/stored/key helpers
- isModelField, RESOURCE_KEY_HINT, isStoredCall shared; casts narrowed
- builder snippets fill McpServerRef, FolderRef and FileRef params
- doc fixes: MCP url identity, auth schemes, not-executable message, limits and TSDoc
…fusal codes, human subject for source scope, drop legacy-id catalog projection, doc fixes
…from one table

- workflow check and status hold the command lock (read-only), so they never read a
  directory an apply or get is rewriting; check help names exit 10
- recordedWorkspace binds check, create and params to the workspace a directory records
- workspace check: no login keeps its AUTH_REQUIRED refusal (exit 13); drop requireCachedCatalog
- typeCheckWorkspace shared by the workspace check and a workflow folder check
- status commands declare no apply operation
- every source command's exit-code help built from the one table, status included
- drop renamedVariables; reword apply's workflowId argument, name SOURCE_WORKFLOW_MISMATCH
- workspace get never exits 7; INTERRUPTED_EXIT_CODE defined once
…each code was reported, one env-name pattern, one createdBy, recordedWorkspace reads the flag
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Nov 24, 2026 8:18pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

This PR fixes workflow-source checks and brings shared rules into common helpers.

  • Source checks and status wait for the directory lock before working.
  • Workflow source commands follow the workspace recorded in their directory.
  • The server and CLI use shared names and help for source refusals and exit codes.
  • Workflow checks keep warning locations and report clearer code-file syntax messages.
  • Workflow and workspace source tools share SDK, declaration, and file-layout rules.
  • Catalog responses no longer include unused legacy field rename details.
  • Workflow source writes use the human caller as their resource owner.
  • Workflow-as-code docs and help now match the current CLI behavior.

No actionable issues were found. This assessment is based on source review; no tests were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Command[Workflow check or status] --> Lock[Take directory lock]
  Lock --> Folder{Inside workspace directory?}
  Folder -->|Yes| Root[Use workspace root lock]
  Folder -->|No| Own[Use workflow directory lock]
  Root --> Read[Read source and records]
  Own --> Read
  Read --> Work[Compile or request plan]
  Work --> Types[Refresh applicable types]
  Types --> Report[Print findings or status]
  Report --> Release[Release lock]
Loading

Reviews (1) · Last reviewed commit: "test(workflow-code): the warning-cap tes..." · Reviewed by Greptile

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 87 files

Confidence score: 5/5

  • In source-status.ts, the help omits exit 9 for rate-limited plan requests, so users may not know what the status means. Add rate-limit wording to the shared exit-code row.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/sim-cli/src/commands/protocol/source-status.ts">

<violation number="1" location="packages/sim-cli/src/commands/protocol/source-status.ts:84">
P3: `statusHelp` omits exit 9 even though a rate-limited plan request eventually exits `RATE_LIMITED_EXIT_CODE`. Add status-specific rate-limit wording to the shared exit-code row.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

failed; ${AUTH_REQUIRED_EXIT_CODE} not logged in (AUTH_REQUIRED) or the credential was refused: the status shows the
local changes only, then run \`sim login\`. A server that cannot be reached is not a failure: the
status shows the local changes only and says so (exit 0 or ${SOURCE_LOCAL_CHANGES_EXIT_CODE}).`
${sourceExitCodesHelp(command)}`

@cubic-dev-ai cubic-dev-ai Bot Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: statusHelp omits exit 9 even though a rate-limited plan request eventually exits RATE_LIMITED_EXIT_CODE. Add status-specific rate-limit wording to the shared exit-code row.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/sim-cli/src/commands/protocol/source-status.ts, line 84:

<comment>`statusHelp` omits exit 9 even though a rate-limited plan request eventually exits `RATE_LIMITED_EXIT_CODE`. Add status-specific rate-limit wording to the shared exit-code row.</comment>

<file context>
@@ -72,20 +73,16 @@ export interface StatusReport<Plan> extends SourceStatus {
-failed; ${AUTH_REQUIRED_EXIT_CODE} not logged in (AUTH_REQUIRED) or the credential was refused: the status shows the
-local changes only, then run \`sim login\`. A server that cannot be reached is not a failure: the
-status shows the local changes only and says so (exit 0 or ${SOURCE_LOCAL_CHANGES_EXIT_CODE}).`
+${sourceExitCodesHelp(command)}`
+}
 
</file context>
Fix with cubic

This branch was successfully deployed

1 active deployment
Preview — 24daf6bf Deployed Nov 24, 2026 by vercel[bot]
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