Repository navigation
improvement(workflow-code): lean agent path for source get, params and help, and typed Function results in JSON fields - #10335
Conversation
…d help, and typed Function results in JSON fields
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge. SummaryThe PR shortens CLI output and uses known Function return types to quote references in JSON fields.
All three previous threads are addressed: receiver checks reject the reported custom methods and shadowed built-ins, brief builder output retains core signatures, and strict array checks now recognize the reported Reviews (6) · Last reviewed commit: "fix(workflow-code): prove an array throu..." · Reviewed by Greptile |
…nd built-ins the code proves, and keep the core signature in the brief params
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 27 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…d reject a shadowed Object in array inference
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 27 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…ferring Function result kinds
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
4 issues found across 27 files
Confidence score: 3/5
isArrayinfunction-returns.tstreats any.map()call as array-producing, even when the receiver is a custom object. That can leave a bare JSON reference able to splice raw text; check the receiver before classifying the result.isBuiltininfunction-returns.tsmissesNUMBER_FUNCTIONS,BOOLEAN_FUNCTIONS, andMath, so shadowed or imported names likeparseIntandisNaNcan be inferred as numeric built-ins. Extend the guard to cover these names.- The receiver-kind guard in
function-returns.tsrejectsStringandBooleancalls totoLocaleString(), leaving their text results untyped and allowing a bare JSON reference to splice raw text. Accept these known receiver kinds. - The guard in
function-returns.tsalso rejectsnew Date().toString(), leaving the text result untyped and allowing a bare JSON reference to splice raw text. Accept receivers proven byisDate.
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/workflow-code/src/compile/function-returns.ts">
<violation number="1" location="packages/workflow-code/src/compile/function-returns.ts:282">
P2: The new `isBuiltin` guard covers `String` and `STATIC_KINDS` but not `NUMBER_FUNCTIONS`, `BOOLEAN_FUNCTIONS`, or `Math` in the same `call()` method. A local or imported `parseInt`/`isNaN`/`Math` still infers a number or boolean kind. Apply the same `isBuiltin` check to these names.</violation>
<violation number="2" location="packages/workflow-code/src/compile/function-returns.ts:298">
P2: `isArray` treats every call named `.map()` as array-producing without checking its receiver, so `({ map: () => 'text' }).map().slice(0)` is classified `typed`. That bare JSON reference can splice raw text and produce invalid JSON; require a proven array receiver before using this result.</violation>
<violation number="3" location="packages/workflow-code/src/compile/function-returns.ts:318">
P2: `new Date().toString()` returns text, but this guard excludes it even though `isDate` proves the built-in receiver. It now remains untyped and can leave a bare JSON reference; accept `this.isDate(receiver)`.</violation>
<violation number="4" location="packages/workflow-code/src/compile/function-returns.ts:322">
P2: `String.prototype.toLocaleString()` and `Boolean.prototype.toLocaleString()` return text, but this guard rejects their known receiver kinds. The result stays untyped, so a bare JSON reference can splice raw text; include `string` and `boolean`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…eivers for Function result kinds
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…jecting built-in array results
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
workflows source getandworkspaces source getno longer print the primer, which is already written atop.sim/AGENTS.md. The result names the guide and aneditLoop(check, type-check, dry-run apply).--primerprints it (JSONprimerfield). Default result on a seeded workflow: 4,860 to 508 bytes; workspace: 6,898 to 626.workflows source params <builder>prints a brief by default: an example call, required params with types, optional params by name, the gate, outputs.--fullkeeps the old output. Agent builder: 7,738 to 1,034 bytes (JSON). A legacy builder names its replacement (human_in_the_looppoints tohuman).sim --helpfor a detected coding agent drops the worked examples (5,573 to 4,619 bytes); the notes andsim cli searchbanner stay, and human help is unchanged.result.<field>is now typed by what its JavaScript certainly returns (also.slice/.concaton a known string or array), so a text field is stored quoted at compile and printed back as the bare reference instead of warningW_JSON_REF_UNTYPEDand breaking the JSON at run time. Fields the compiler cannot type still warn. The runtime splice is unchanged: a bare token outside a string is spliced raw on purpose (a string holding JSON text nests as JSON), and the text is not valid JSON until the splice, so the resolver cannot tell where to encode.Type of Change
Testing
workflow-code: json-fields and print round-trip tests fail on the pre-changejson-fields.ts(6 red) and pass with it.sim-cli: get tests (default omits the primer and names the loop;--primerrestores it), params tests (brief default,--full, legacy replacement), agent help test.check:audits,check:migrations, goldens, docs compatibility, unit and integration suites. The realtimefile-doc-capabilitiesafterAll timeout fails the same way on pristine staging.Checklist
test-auditauthoring gate)