Repository navigation
fix(workflow-code): json-text input mappings, wiring beside blocks, source find - #10442
Conversation
…de its blocks, add source find - A Workflow block's inputMapping (and any native object/list field) stored as JSON text by the operations route printed as a t`` template that never type-checks; an untouched directory passed only because check suppresses errors in files still as get wrote them. Canonicalize now decodes the container and materialize keeps the stored text encoding. Deploy-change detection treats the two encodings as one value. - The printer emits each wiring statement under the last-declared block it names, so a block's edges sit next to it instead of ~1000 lines away in a 192-block workflow. - New `sim workflows source find <block>`: a block's code with line numbers, function file, incoming/outgoing wiring and readers, offline. - The operations batch cap error says how to split a larger edit.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 46 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; the three previously reported problems are fixed. SummaryThe PR fixes JSON-text input mappings, moves printed wiring beside block declarations, adds offline The latest changes address all three previous review threads:
No new actionable issues or repository-rule violations were found. Tests were inspected but not rerun. Reviews (2) · Last reviewed commit: "fix(workflow-code): exact JSON-text equi..." · Reviewed by Greptile |
…ons, layout-aware tests - Decode JSON text, and treat it as unchanged in deploy-change detection, only for input-mapping fields, whose runtime parses both forms (JSON_TEXT_CONTAINER_TYPES). Other container fields such as a checkbox list compare as stored again. - Compile records where each edge is written (edgeSpans), and `source find` reports every edge at its own statement. - `source find` reads function-file references the way compile does (codeFileRefs: parsed chains plus stored tags) in the file's own language. - Integration edits follow the interleaved wiring layout; docs baseline takes the new CLI reference code examples.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Fixes a bug where large or API-built workflows failed the source check after an edit, and makes large workflow sources easier to navigate. A benchmark of a 192-block workflow found both problems.
1. JSON-text
inputMappingbroke check/apply after any edit (bug)inputMappingstored as JSON text (operations applystores a string as given) printed ast`{...}`. That failsTS2322againstInputMapping.source checkonly because check deliberately ignores type errors a file already had whengetwrote it. That suppression is right: the declarations can lag the stored workflow. But one edit anywhere inworkflow.tssurfaced the error on the untouched line.input-mappingandworkflow-input-mapper, listed once asJSON_TEXT_CONTAINER_TYPES. The workflow handler and tool runnersparseJSONa string mapping. Materialize keeps the stored text encoding, and text that is not JSON (a whole-mapping reference) stays text with no warning.messagesstored as text in a landing template, and a Jina checkbox list'sreadUrlOptions(the serializer reads only native objects). Decoding those would change what runs, so they keep theirKNOWN_UNTYPEDentries.KNOWN_UNTYPEDentry:workflow_input:("an input mapping stored as JSON text") is removed, and the full corpus type-check passes without it.canonicalizeSubBlockValue) treats the two encodings as one value for the same field types only. Every other field compares as stored, whichlib/workflows/canonical/json-text-encoding.test.tspins in both directions. The diff view still shows encoding changes.2. Wiring printed beside its blocks
Each
.to()/.onError()statement now prints right under the last-declared block it names, instead of in one section at the end of the scope. Compile accepts statements in any order, so only the layout changes. Measured on the benchmark sources, reprinted with the old and new printer through the same pipeline:Route Categorycondition, whose branch statements now sit under each branch head (window 1404 → 1447 at 192 blocks, 2152 → 2292 at 297).apply-workflow-source.integration.ts) edited printed wiring text assuming the old layout. Their edits now follow the interleaved layout; the expectations are unchanged.Options considered and rejected:
3.
sim workflows source find <block>file:line, and every block that reads its outputs.CompileResult.edgeSpans.codeFileRefscombines parsed chains with stored tags, in the file's own language..sim/AGENTS.md, the coding-agents doc and the generated CLI reference. The docs compatibility baseline takes the new CLI reference code examples.4.
operations apply200-operation capatomiccovers one batch, and later batches name new blocks by the ids inmintedBlockIds.ticket-audit-2key afterseed8.sh --forceis correct dedup, not a bug. Key allocation on read never reuses a key still bound to an archived workflow, so a restore keeps its key and an old source'schildWorkflow('ticket-audit')is never silently pointed at a different workflow. A source that declares the key rebinds it on purpose (claimResourceKey).table('accounts-2')is the same case.Not done:
workflows outline --block/--matchfor the regular arm. It needs a v2 contract change and regenerated CLI artifacts, so it is not cheap.Type of Change
Testing
api-built-source.test.ts: the printed source of an operations-stored JSON-text mapping type-checks after an edit, and the edited mapping is stored as text. It fails withTS2322on the old canonicalize. The encoding assertion fails if materialize writes the object.json-text-encoding.test.ts: deploy-change detection reports a checkbox list moving between text and object, and not an input mapping.print/scaling.test.ts: a locality test that fails on the old printer.workflow-source-find.test.ts: per-edge lines, and Python and JS-tag readers; it fails on the previous head.workflow_inputexemption. The round-trip corpus (P0–P7, O1–O3) passes.apply-workflow-source.integration.tspasses locally (92 tests).bun run generate,lint,type-check,check:audits, the block registry check, the affected unit suites, and docs compatibility.canonicalize/params.ts(which fields decode) and thecanonicalizeSubBlockValuechange.Mothership impact: none in generated catalogs. The printed layout of every workflow changes once on its next print, and
.sim/AGENTS.mdlistssource find.Checklist