fix(function): omit oversized display code instead of failing the execution
Merged
WA
1mo ago+31+31+01234567890123456789-2-2-0123456789
Summary
- #8344 capped the Function execute contract's
sourceCodeat the 1 MiB source limit.sourceCodeisn't the code that runs. It's the display copy used only to render errors, and the resolver inlines each referenced block output into it in full, while the executed code carries those values as__blockRef_Nbindings. A Function block that references a large upstream output (e.g.data = <api.data>over ~1 MiB, which Python and shell never offload) therefore produced a request the route rejected, although its executed code was tiny. That same workflow runs on main buildFunctionExecuteBodynow omitssourceCodewhen it exceedsMAX_FUNCTION_CODE_LENGTH. Error rendering already falls back to the executed code whensourceCodeis absent, which keeps line numbers correct; truncating would misplace them. The route keeps #8344's bound on both fields, and the cap on the executedcodeis unchanged
Type of Change
- Bug fix
Testing
- New
execute.test.tscase: a body whose display code outgrows the cap passes the realfunctionExecuteBodySchemaand carries nosourceCode, and display code within the cap is still sent. It fails on staging (safeParse(...).success === false) - Function tool, handler, route, and function-execution suites (371 tests), including #8344's own oversized-input rejections, pass. Type-check, lint, and
check:auditspass
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)