Skip to content

Persist host type update and honor stored value after restart#4549

Open
kim wants to merge 4 commits intomasterfrom
kim/core/stored-host-type
Open

Persist host type update and honor stored value after restart#4549
kim wants to merge 4 commits intomasterfrom
kim/core/stored-host-type

Conversation

@kim
Copy link
Contributor

@kim kim commented Mar 4, 2026

Fixes two issues that would prevent updating a database while also changing the host type:

  • We never actually updated the ModuleKind in st_module (hardcoded to wasm)
  • We never actually honored the value from st_module when instantiating a module

To do so, the Program type from the datastore crate now carries the ModuleKind, forcing call sites to make a decision.

Small adjustments to the smoketests / guard crate where made when writing the test for this.

Expected complexity level and risk

1

Testing

  • Added smoketest

@kim
Copy link
Contributor Author

kim commented Mar 4, 2026

Hm, we are also not updating the host type in the system table.

@joshua-spacetime
Copy link
Collaborator

TODO: Trying to understand how to publish a JS module from the new smoketests framework.

See

test.publish_typescript_module_source(
"views-subscribe-typescript",
"views-subscribe-typescript",
TS_VIEWS_SUBSCRIBE_MODULE,
)

@kim kim force-pushed the kim/core/stored-host-type branch from 825da6c to 9e464e3 Compare March 5, 2026 07:49
@kim kim changed the title core: Honor host type of stored module Persist host type update and honor stored value after restart Mar 5, 2026
@kim kim requested review from Centril, cloutiertyler and coolreader18 and removed request for Centril March 5, 2026 07:54
kim added 4 commits March 5, 2026 08:59
The host controller would use the host type as stored in the controldb
to try and instantiate a module. That fails, however, if the module was
updated while also changing the host type -- the controldb no longer has
correct data about the database's state.

Instead, hand out the module kind / host type when retrieving the
program from the database itself.

core, datastore: Persist host type / module kind

Require `Program` to carry the module kind, and properly update
`st_module` if a module update changes the host type.
@kim kim force-pushed the kim/core/stored-host-type branch from 9e464e3 to 3735d49 Compare March 5, 2026 07:59
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.

2 participants