Skip to content

fix(workflow-code): keep js template escapes verbatim, add table agent tool form, pin create fingerprint - #10528

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/wac-js-template-escapes
Dec 1, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/wac-js-template-escapes

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Three fixes found while solving benchmark tasks with the CLI.

1. js/py/sh/json/md templates dropped backslashes. These templates used to be read as cooked text, so js`/\s+/` was stored as /s+/ and the regex stopped matching with no error. They are now read raw, like String.raw. The only escapes left are \` and \${. The printer writes code back so that compiling it gives the same text. A backtick and ${ get a backslash. Anything raw text cannot hold (CR, invisible characters, and a backslash that would otherwise escape a backtick, ${ or the end of the template) is written as a ${'…'} interpolation. t templates are prose and stay cooked. The storable-literal check no longer reads cooked escapes in verbatim templates.

2. table.tool.queryRows(...) was refused with E_UNKNOWN_BUILDER. The editor's agent tool picker offers Table, Knowledge and File beside integrations, and stores them in the same { type, operation, params } shape. The catalog now marks those blocks agentTool, and hasToolForm accepts them. As a result, compile, print, SDK codegen and the v2 catalog contract all have table.tool.*, knowledge.tool.* and file.tool.*, and a picker-stored Table tool prints back through the builder instead of raw(). The core agent tool type list moved from the tool-input UI utils to blocks/agent-tools.ts so the catalog projection can use it.

3. source create --deploy failed with a "draft changed" conflict. The write printed its answer with the plan's resource resolver. That resolver only knows resources the source named by key. A table the source wrote by id, such as the tableId of a raw() tool, therefore printed and fingerprinted differently from the next read and from the pinned deploy's draft check. A write now resolves the ids the plan resolver misses through the workspace's resource keys. A commit allocates missing keys; a dry run only reads existing ones.

Test plan

  • Regression tests that fail before the fix:
    • print/verbatim-templates.test.ts: a raw js template keeps its backslashes and still runs correctly, escaped backtick and ${ work, a NUL escape stays text, and a regex prints undoubled.
    • real-catalog.test.ts: a picker-stored Table tool prints as table.tool.queryRows, type-checks against the generated SDK and compiles back.
    • apply-workflow-source.integration.ts: create, then a deploy pinned to the returned fingerprint, succeeds, and the next read has the same fingerprint (keyed and unkeyed tables).
  • Round-trip edge cases and a seeded fuzz over the template syntax alphabet. Corpus values now carry backslash payloads in text, JS, Python and shell.
  • Ran locally: workflow-code, workspace-code, workflow-sdk, sim-cli and utils suites; apps/sim units for the touched areas; workflow application and workspace-source integration suites against Postgres; type-check; generate; lint; check:audits; check:test-types; the block-registry check.

…ledge/file agent tool forms, pin create fingerprint

- js/py/sh/json/md tagged templates now store the raw text written between the
  backticks (only \` and \${ are escapes), so js`/\s+/` stores /\s+/ instead of
  silently dropping the backslash. The printer writes code back so compile
  reads exactly the stored text, using ${'...'} for what raw text cannot hold.
- The catalog marks the built-in blocks the agent tool picker offers
  (agentTool), so table.tool.queryRows(...), knowledge.tool.search(...) and
  file.tool.read(...) compile and print instead of requiring raw().
- A source write now prints its answer with the workspace's resource keys for
  any resource the source wrote by id, so the returned fingerprint matches the
  next read and a pinned deploy (create --deploy no longer fails with a
  draft-changed conflict).
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 1, 2026 3:42am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge, with the earlier renamed-tag issue fixed and no new actionable findings.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the earlier renamed-tag issue fixed and no new actionable findings.

Summary

The PR preserves backslashes in code templates, adds built-in agent tool builders, and makes write responses use the same resource keys as later reads.

  • Code templates keep their backslashes when workflow code is printed.
  • Built-in agent tools can use named operation calls in workflow code.
  • Source writes return fingerprints that later reads can match.

Reviews (2) · Last reviewed commit: "docs(workflow-sdk): show a table operati..." · 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.

All reported issues were addressed across 29 files

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

Turn on auto-fix | Re-trigger cubic

… in the character check

A cooked t imported as js skipped the NUL/lone-surrogate check while compile still read it cooked. Also documents that agentTool marks hidden legacy versions.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 32 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 1bdc20a into staging Dec 1, 2026
87 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/wac-js-template-escapes branch December 1, 2026 04:30

This branch was previously deployed

1 inactive deployment
Preview — e077248f Deployed Dec 1, 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