Skip to content

id: design: hot-swap alternatives — Wasm-component instantiation vs process restart with compile cache vs interpreted behavior layer #5996

Closed

Description

@dezren39

Part of the worlds design program: #5955. Wave-2 follow-up from the prior-art research (Lane B item 6); parent topic issue: #5964. Research source: workspace/scratch/worlds-capabilities-brief-2026-11-04/prior-art-research.md.

Scope

Roc itself offers no runtime module hot-swap (see the shared-library reality-check follow-up under #5955). Compare the three mechanisms that can deliver per-tick user-function switching for #5964, and pick the v1 mechanism:

  1. Wasm target + component-model dynamic instantiation — components import only declared WIT interfaces (link/instantiation error on mismatch). Caveat from the research: in practice most tooling statically links components before shipping; dynamic hot-load/link of arbitrary components remains immature (Bytecode Alliance WASI 0.3-era discussion: https://news.ycombinator.com/item?id=48504063). Schedule risk is real.
  2. Process-per-world (or per-function) restart with a warm compile cache — boring, robust; cost is restart latency, bounded by the compile-cache identity scheme (compile-economics child of id: design program: worlds — advanced Roc libraries, capabilities, permissions, dynamic user functions, licensing (2026-11-04 brief) #5955).
  3. Data-driven behavior layer — user behavior expressed as interpreted data/scripts inside a compiled world (the pattern every interpreted programmable world used: MOO verbs, LSL script replacement).

Evaluation axes

Swap latency at tick boundary; isolation strength; metering compatibility (per-function gas/timeout research under #5955); determinism for replay; implementation cost against the current host (pkgs/id/src/world_compile.rs, pkgs/id/src/world_session/).

Done looks like

A decision doc naming the v1 mechanism, the rejected alternatives with reasons, and what would trigger revisiting the decision.

Activity

  1. added
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 5, 2026
  2. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor
  3. added
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Nov 5, 2026
  4. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    Ruling — C3/C4 pillar affirmation applies to this alternatives exploration (Drew, 2026-11-04 23:57 CST; primary record on #5964).

    User-code handling is one of the two platform pillars ("very big parts of making this a platform that other people can build on top of, interact with, and reason about" — the other is fuel budgets, #5966). Evaluate the alternatives here under the iteration doctrine: thorough research, test findings, hunt for holes and gaps, and expect multiple reworks/rebuilds before the right solution lands. A candidate that only works as a test-environment, us-only mechanism is acceptable for now; a candidate that is an architectural dead end for later high user-friendliness is not.

  5. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 5, 2026
  6. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    Triage — task 10362 (lane code-e, 2026-11-05)

    Verdict: well-formed, tightly scoped decision-design ticket — stays OPEN. Its whole remaining work is the one decision doc it names; no split needed, no implementation in scope.

    Verified fresh this pass:

    Ordering / inputs the decision doc must consume (recorded so the pass doesn't start cold):

    1. id: research: per-function gas metering, timeouts, and the multithreading question for user functions #5966 (per-function gas metering / timeout / multithreading research) — the metering-compatibility axis cannot be scored without it.
    2. id: design: compile economics — compiled-world/DLL caching, compile-cost penalties, premium gating #5965 (compile economics) — option 2's cost is bounded by its compile-cache identity scheme; the cache design lands first or the restart option is scored on a guess.
    3. id: design: dynamic user functions — server-compiled DLLs, hot-swap into running worlds without world recompile #5964's own design framing (server-compiled DLLs + hot-swap) — this ticket picks the mechanism for that design; if id: design: dynamic user functions — server-compiled DLLs, hot-swap into running worlds without world recompile #5964's framing changes, this decision re-opens.

    Design path scoped: one decision doc naming the v1 mechanism, rejected alternatives with reasons, and explicit revisit triggers (the issue's "Done looks like"), written against the five stated axes (swap latency at tick boundary, isolation, metering compatibility, replay determinism, implementation cost vs the current host). Any implementation follows as separate tickets filed from that doc — none spawned now (premature: the decision is the work).

    Queue: task 10362 completes as triaged.

  7. 14 remaining items

  8. added this to the ID platform program milestone on Nov 12, 2026
  9. added a commit that references this issue on Nov 16, 2026
  10. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    PR shepherd — PR #7637 (task 17307, lane code-i, 2026-11-16)

    • Action: merged (d63abfeb, merge commit, 2026-11-16 10:56Z). Docs-only: one new file, doc/2026-11-08T10-26-00Z_design_id5996_hot_swap_decision/…md (66 added lines, 0 deletions).
    • State check before merge: PR OPEN, not a draft, MERGEABLE, no held / user/owned / do-not-merge / do-not-auto-edit labels, no review decision blocking, no competing decision record on main (no other doc mentions instance-per-function).
    • The failing check is stale, not caused by this PR: basic: scripts-test (3.12 and 3.14) failed in a run from 2026-11-09 against an older base; scripts-test on main has completed green repeatedly since (most recent completed run before the merge: 2026-11-16 09:53Z, success). A docs-only addition cannot regress that suite.
    • Drift worth a follow-up (not blocking the decision): the record cites pkgs/id/src/world_compile.rs and pkgs/id/src/sandbox.rs at evidence baseline 0865aad9; after the id crate split those now live at pkgs/id/crates/id-worlds/src/world_compile.rs and …/sandbox.rs. The decision itself is unaffected — the mechanism it picks (instance-per-function restart with snapshot handoff) is still the current host's shape — but a reader following the paths at HEAD will not find them.
    • Issue id: design: hot-swap alternatives — Wasm-component instantiation vs process restart with compile cache vs interpreted behavior layer #5996 remains OPEN and status:in-review: the decision is recorded; implementation of the chosen mechanism is filed from id: design: dynamic user functions — server-compiled DLLs, hot-swap into running worlds without world recompile #5964 per the record's own scope.
  11. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. added a commit that references this issue on Nov 17, 2026
  13. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — decision recorded, drift corrected, closing

  14. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (already_done)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)epic/id-programReprioritization program epic (2026-11-12)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingpriority/normalOrdinary priority (the default)status:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions