Skip to content

FIO-9783: refactor, make dumber#58

Merged
lane-formio merged 13 commits intomainfrom
FIO-9783
May 15, 2025
Merged

FIO-9783: refactor, make dumber#58
lane-formio merged 13 commits intomainfrom
FIO-9783

Conversation

@brendanbond
Copy link
Copy Markdown
Collaborator

@brendanbond brendanbond commented Apr 22, 2025

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-9783

Description

We've identified a bottleneck in the way we perform form validation in our Enterprise Server - creating VM contexts per request and executing the entire form orchestration pipeline in those contexts turns out to be kind of slow and expensive.

To mitigate this, I've changed the way the vm library is constructed. Rather than opinionated functions that execute certain concrete evaluations that are tightly coupled to other modules (e.g. formio-server) this library now will only provide a stable API for safely sandboxing and executing code. Gone now will be the days of @formio/vm managing its own dependencies - a game that is difficult to play during development (where you have to ensure that the vm dependencies match the upstream consumers) - and being responsible for things like email rendering (which happens in only one place, formio, and should be managed there).

Breaking Changes / Backwards Compatibility

Yeah, this is definitely a major version of this library. The hope is that it will be relatively stable now, and we won't have to make form.io specific changes here (e.g. to things like email rendering, which belong elsewhere) and can just focus on its job - providing an interface with which to sandbox and execute javascript code.

Dependencies

n/a

How has this PR been tested?

I wrote some new automated tests to cover the new interfaces.

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@brendanbond brendanbond marked this pull request as ready for review May 2, 2025 21:02
Copy link
Copy Markdown
Member

@travist travist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nicely done @brendanbond!

@lane-formio lane-formio merged commit d524dae into main May 15, 2025
5 checks passed
@brendanbond brendanbond mentioned this pull request May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants