Skip to content

Trigger view refresh when a WASM procedure commits a transaction#4301

Open
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/procedures-dont-trigger-views
Open

Trigger view refresh when a WASM procedure commits a transaction#4301
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/procedures-dont-trigger-views

Conversation

@joshua-spacetime
Copy link
Collaborator

@joshua-spacetime joshua-spacetime commented Feb 15, 2026

Description of Changes

This PR fixes the bug where WASM procedures could commit a transaction without refreshing affected materialized views, which caused view-backed subscriptions to miss updates from procedure writes.

The equivalent changes for V8 will be made in a separate patch.

API and ABI breaking changes

None

Expected complexity level and risk

3

This was not a simple translation of the reducer code path, because reducers are run in a single transaction whereas procedures can have multiple transactions via with_tx and views must be refreshed with each transaction instead of once at the end of the procedure. This required refresh to be inserted into the syscall itself which required some extra plumbing. Mainly that we had to attach the validated ModuleDef to the WasmInstanceEnv. This should not affect hotswapping because we instantiate an entirely new WasmInstanceEnv in that case.

Testing

  • Added a regression test in the form of a smoketest that subscribes to a view and calls a procedure

.collect()
}

pub(crate) fn run_query_for_view(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No new code was added here. It was just extracted into a helper for reuse in procedure view refresh.

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.

Procedures don't trigger view changes

1 participant