Skip to content

fix(rune): address conductor migration nitpicks - #866

Open
martin-henz wants to merge 1 commit into
masterfrom
replace-pr-835
Open

fix(rune): address conductor migration nitpicks#866
martin-henz wants to merge 1 commit into
masterfrom
replace-pr-835

Conversation

@martin-henz

Copy link
Copy Markdown
Member

Re-opens #835, which was automatically closed (not merged) when its base branch conductor-migration was deleted after being merged into master via #680. This branch cherry-picks the original commit from @11suixing11 unchanged, onto current master.

Summary

  • validate the rune channel before calling the base plugin constructor
  • make rune initialisation idempotent so primitive rune exports are not duplicated
  • load the host tab by the shared Rune tab name instead of by the first tab entry
  • share rune deserialisation through the bundle protocol and cover serialize/deserialize round trips

Addresses #827

Motivation

This PR follows #827, which came from checking which CSG conductor-migration review findings also apply to Rune. It is scoped to the four Rune items from that issue and intentionally does not address the separate duplicate-delivery or js-slang error-shape issues tracked in #823 and #825.

Concrete Cases

  • Constructor guard: the old constructor passed [undefined] into BaseModulePlugin before throwing Rune's own missing-channel error. Moving the guard before super(...) keeps invalid channel state out of the base plugin.
  • Initialisation idempotency: calling await plugin.initialise() twice re-ran super.initialise() and re-pushed method and primitive-rune exports. The new guard wraps the full method so repeated initialisation leaves the export list stable.
  • Tab lookup: __loadRuneTab() previously used tabs[0]. Looking up RUNE_TAB_NAME keeps the tab contract explicit if the host ever provides more than one tab.
  • Protocol round trip: the tab previously had its own local deserializeRune. Sharing it from protocol.ts lets the bundle test the same serialization/deserialization path used by the tab.

Testing (from original PR, re-verify on CI)

  • yarn workspace @sourceacademy/bundle-rune test (47 passed)
  • yarn workspace @sourceacademy/bundle-rune tsc
  • yarn workspace @sourceacademy/bundle-rune lint
  • yarn workspace @sourceacademy/tab-Rune test (3 passed in Chromium)
  • yarn workspace @sourceacademy/tab-Rune tsc

Original author: @11suixing11

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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