fix(workflows): stop flagging whole-field references in JSON fields and correct the quoting advice

Merged
WA
11d ago
+101-5

Summary

  • The unquoted-JSON-reference lint no longer flags a field made only of references (e.g. Response data or an API body set to <agent.content>). The block receives that text as-is: Response returns text it can't parse unchanged, API sends it as a raw body. Quoting it would only turn JSON text into a JSON string.
  • A reference inside JSON text ({"note": <agent.content>}, [<agent.content>]) still flags, as do the Table row cases.
  • Rewrote the advice. References are inserted raw and there's no JSON-aware escaping outside Function code, so quoting is only safe for text with no ", \ or line break (ids and the like). For free text it now says to build the JSON in a Function block and set the field to that block's result reference.
  • Deploy warnings come from the same lint report, so they pick this up unchanged.

Type of Change

  • Bug fix

Testing

  • New cases in json-literal-refs.test.ts: whole-field and references-only fields don't flag, references inside JSON still flag, advice text. The behavior tests fail on the previous code and pass now.
  • Probed against the real block registry: Response/API whole-field <agent.content> flagged before, clean after; API {"text": <agent.content>} and Table v2 Insert Row {"name": <agent.content>} flag both before and after.
  • bun run lint, bun run type-check, bun run check:audits, vitest on lib/workflows/editing, lib/workflows/application, executor/variables.

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)