René's URL Explorer Experiment


Title: feat(mothership): format generated function code by j15z · Pull Request #5742 · simstudioai/sim · GitHub

Open Graph Title: feat(mothership): format generated function code by j15z · Pull Request #5742 · simstudioai/sim

X Title: feat(mothership): format generated function code by j15z · Pull Request #5742 · simstudioai/sim

Description: Summary Mothership-created JavaScript and Python Function blocks now arrive formatted and readable instead of being persisted as dense single-line source. Formatting runs after workflow operations resolve the final block identity and language, preserves Sim workflow and environment references, and fails open so invalid or unverifiable source remains unchanged while the mothership receives a sanitized formatting result. This uses Prettier for JavaScript and Ruff's WebAssembly formatter for Python, keeping formatting deterministic and independent of how the mothership writes its tool-call strings. Formatted output is accepted only when Sim references remain identical and ordered, JavaScript has an equivalent Babel syntax tree, and a second formatting pass is byte-stable. Parenthesized environment expressions retain grouping through raw resolver substitution, including comment-bearing expressions; otherwise the original Function source is kept. The safety suite exercises broad JavaScript and Python syntax corpora, formatting idempotence, exact workflow/environment-reference restoration, real placeholder-token collisions, high-cardinality reference sets, invalid-source fail-open behavior, real VariableResolver integration, JavaScript runtime equivalence, and independent CPython AST and runtime equivalence. Type of Change Bug fix New feature Breaking change Documentation Other: ___________ Testing DATABASE_URL=postgres://postgres:postgres@localhost:5432/sim bunx vitest run lib/workflows/blocks/format-function-code.test.ts lib/workflows/blocks/format-function-code.safety.test.ts lib/workflows/blocks/format-function-code.validation.test.ts lib/workflows/blocks/format-function-code.integration.test.ts lib/copilot/tools/server/workflow/edit-workflow/function-code-formatting.test.ts from apps/sim - 110 tests passed. DATABASE_URL=postgres://postgres:postgres@localhost:5432/sim bun test apps/sim/lib/copilot/tools/server/workflow/edit-workflow/operations.test.ts - 14 tests passed with 45 expectations; 124 relevant tests passed in total. bunx biome check across the six formatter implementation/test files - passed. bun run check:utils - passed with no banned patterns. bun run check:api-validation - passed with all 964 API routes Zod-backed and no baseline drift. bun build apps/sim/lib/workflows/blocks/format-function-code.ts --target=node --outdir /tmp/sim-function-formatter-bundle --external @wasm-fmt/ruff_fmt/node - passed with Prettier's Babel parser bundled. bun run --cwd apps/sim type-check - the authored formatter files emitted no errors; the isolated worktree still surfaces unrelated linked-dependency drift for two audit constants, recordAuditBatch, and @google-cloud/storage. CI should validate from a fresh dependency install. Reviewers should focus on parenthesized environment-expression protection, Sim-reference ordering, the JavaScript AST normalization boundary, the independent CPython oracle, and Ruff WebAssembly tracing for standalone Next deployments. Post-deploy monitoring and validation: for 24 hours after deployment, the Workflow/Mothership owner should watch edit_workflow error rate and latency and search logs for Function code formatting failed open, grouped by language and block ID. Healthy behavior is stable edit latency/error rate with warnings limited to genuinely invalid source; a sustained warning increase, latency regression, or any behavior-changing formatted Function should trigger rollback of this change while fail-open keeps original source intact. 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) Screenshots/Videos Not applicable - this changes server-side workflow code normalization and has no new visual surface.

Open Graph Description: Summary Mothership-created JavaScript and Python Function blocks now arrive formatted and readable instead of being persisted as dense single-line source. Formatting runs after workflow operations ...

X Description: Summary Mothership-created JavaScript and Python Function blocks now arrive formatted and readable instead of being persisted as dense single-line source. Formatting runs after workflow operations ...

Opengraph URL: https://github.com/simstudioai/sim/pull/5742

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:3a51812e-530c-7aee-e117-1aa89841eb13
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8D58:1D90B4:130752:1A30C1:6A62FD8D
html-safe-noncebf060ef73f03d1aa56ec6ddff906311ef3970bcd519ed1281fe219285ec37257
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDU4OjFEOTBCNDoxMzA3NTI6MUEzMEMxOjZBNjJGRDhEIiwidmlzaXRvcl9pZCI6IjQ1MDY1ODc1MzQ4MjM5ODA0MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca2044975b6f3c1966c5be317b26ef3675b2e3049ae74f6ea1f4499b95868ca91
hovercard-subject-tagpull_request:4079183772
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5742/files
twitter:imagehttps://avatars.githubusercontent.com/u/96924014?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/96924014?s=400&v=4
og:image:altSummary Mothership-created JavaScript and Python Function blocks now arrive formatted and readable instead of being persisted as dense single-line source. Formatting runs after workflow operations ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None59e40dc698184067b40ef2d941585f66ed42711564a879644f984f1eacea129c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb4f544bf80583e749557efd76afda56317b6252d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5742/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5742%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5742%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5742/files
Reloadhttps://github.com/simstudioai/sim/pull/5742/files
Reloadhttps://github.com/simstudioai/sim/pull/5742/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
simstudioai https://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Notifications https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Fork 3.7k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Star 29.2k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Code https://github.com/simstudioai/sim
Issues 110 https://github.com/simstudioai/sim/issues
Pull requests 120 https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality 0 https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Code https://github.com/simstudioai/sim
Issues https://github.com/simstudioai/sim/issues
Pull requests https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
j15zhttps://github.com/j15z
staginghttps://github.com/simstudioai/sim/tree/staging
feat/function-code-formattinghttps://github.com/simstudioai/sim/tree/feat/function-code-formatting
Conversation 12 https://github.com/simstudioai/sim/pull/5742
Commits 5 https://github.com/simstudioai/sim/pull/5742/commits
Checks 18 https://github.com/simstudioai/sim/pull/5742/checks
Files changed https://github.com/simstudioai/sim/pull/5742/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
feat(mothership): format generated function code https://github.com/simstudioai/sim/pull/5742/files#top
Show all changes 5 commits https://github.com/simstudioai/sim/pull/5742/files
a5e1c3d feat(mothership): format generated function code j15z Jul 17, 2026 https://github.com/simstudioai/sim/pull/5742/commits/a5e1c3d87e0639fff6a24c350788b0c505134829
b820933 Address PR review feedback (#5742) j15z Jul 18, 2026 https://github.com/simstudioai/sim/pull/5742/commits/b820933a45ea9686d1e059a3a181f87555667340
a57e88a test(mothership): harden function formatter coverage j15z Jul 18, 2026 https://github.com/simstudioai/sim/pull/5742/commits/a57e88a71a9744f87df071735d854e48c34c25ca
b625977 fix(ci): avoid utility scanner false positive in formatter fixture j15z Jul 18, 2026 https://github.com/simstudioai/sim/pull/5742/commits/b62597702242376533ad509f4a2275c3f0575563
58209d5 fix(mothership): guard formatted function semantics j15z Jul 18, 2026 https://github.com/simstudioai/sim/pull/5742/commits/58209d59ce790db972658abd24dd7d7eca7dd9f8
Clear filters https://github.com/simstudioai/sim/pull/5742/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
engine.ts https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
function-code-formatting.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-86dff5c2df6614bf38e70a80bcc779c9d318cfbf31c3b4e73272ecc3d2c78007
function-code-formatting.ts https://github.com/simstudioai/sim/pull/5742/files#diff-9e9b35069d6849da41f2f2e933f543dc23ff55df3058fde65d67d93693473ae7
index.ts https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
operations.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-4b895edf4b099a62a07e253875e6ee09743e4bef7b84819c7c4ad5a659ae02ba
operations.ts https://github.com/simstudioai/sim/pull/5742/files#diff-a2a5b19c23834e6c05b3eb01063d8b975ad95484afe5f4626c8fd00c1bf1bae5
types.ts https://github.com/simstudioai/sim/pull/5742/files#diff-02bf4badeea020bbc0952f11cc5de828cb574fb87f825e409351fa324d02fc13
format-function-code.integration.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-f3017e09898fa65effc8eac60d0a9a6860af53e9f867911a914f3c199d8ea0cc
format-function-code.safety.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-0b7b541cfbac2931ca478e4259b4c64cd0407fd5e727a66053ba81f0ecc5eefa
format-function-code.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-258688ff9703ea537e82aff533f824a83e848113fd29c5ed5be9f7b53bf019d2
format-function-code.ts https://github.com/simstudioai/sim/pull/5742/files#diff-469005c18c4d1e1ad2c4a825ea5df9939a95dcd3fdd140d1c06386075bd45fc0
format-function-code.validation.test.ts https://github.com/simstudioai/sim/pull/5742/files#diff-5259617b1c881fbad83e20b5769401c1b981b3d5e0db6a9ddb4020e7c720500f
next.config.ts https://github.com/simstudioai/sim/pull/5742/files#diff-a2e0d564b8bf660a492f7abe431643db390b0f5696809465afc46475f552f15f
package.json https://github.com/simstudioai/sim/pull/5742/files#diff-43a1bb37ce68ac536b0a4ed9e973d9d52da3975d74b37865f591bb37e191be64
bun.lock https://github.com/simstudioai/sim/pull/5742/files#diff-bfd0ef82a01108fa1e836c2500b98b7de8a92bb1ae352a8efcbd9d6ffcaabd60
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/engine.tshttps://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
View file https://github.com/simstudioai/sim/blob/58209d59ce790db972658abd24dd7d7eca7dd9f8/apps/sim/lib/copilot/tools/server/workflow/edit-workflow/engine.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5742/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
https://github.com/simstudioai/sim/pull/5742/files#diff-8d53e73367adb6b2d6c50447790908fd5d00aa9edc69250222b3006668319972
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/function-code-formatting.test.tshttps://github.com/simstudioai/sim/pull/5742/files#diff-86dff5c2df6614bf38e70a80bcc779c9d318cfbf31c3b4e73272ecc3d2c78007
View file https://github.com/simstudioai/sim/blob/58209d59ce790db972658abd24dd7d7eca7dd9f8/apps/sim/lib/copilot/tools/server/workflow/edit-workflow/function-code-formatting.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5742/{{ revealButtonHref }}
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/function-code-formatting.tshttps://github.com/simstudioai/sim/pull/5742/files#diff-9e9b35069d6849da41f2f2e933f543dc23ff55df3058fde65d67d93693473ae7
View file https://github.com/simstudioai/sim/blob/58209d59ce790db972658abd24dd7d7eca7dd9f8/apps/sim/lib/copilot/tools/server/workflow/edit-workflow/function-code-formatting.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5742/{{ revealButtonHref }}
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/index.tshttps://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
View file https://github.com/simstudioai/sim/blob/58209d59ce790db972658abd24dd7d7eca7dd9f8/apps/sim/lib/copilot/tools/server/workflow/edit-workflow/index.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5742/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
https://github.com/simstudioai/sim/pull/5742/files#diff-0c96516faadf19e8b425e391376b453095aacafdfe6adaa40294695a3578783f
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5742/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.