Skip to content

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

Open
11suixing11 wants to merge 1 commit into
source-academy:conductor-migrationfrom
11suixing11:fix/rune-conductor-nitpicks
Open

fix(rune): address conductor migration nitpicks#835
11suixing11 wants to merge 1 commit into
source-academy:conductor-migrationfrom
11suixing11:fix/rune-conductor-nitpicks

Conversation

@11suixing11

Copy link
Copy Markdown

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 the first tab entry
  • share rune deserialisation through the bundle protocol and cover serialize/deserialize round trips

Tests

  • git diff --check
  • corepack yarn workspace @sourceacademy/bundle-rune test
  • corepack yarn workspace @sourceacademy/bundle-rune tsc
  • corepack yarn workspace @sourceacademy/bundle-rune lint
  • corepack yarn workspace @sourceacademy/bundle-rune compile
  • corepack yarn workspace @sourceacademy/tab-Rune tsc
  • corepack yarn workspace @sourceacademy/tab-Rune lint
  • corepack yarn workspace @sourceacademy/bundle-rune build
  • corepack yarn workspace @sourceacademy/tab-Rune build

Not run locally

  • corepack yarn workspace @sourceacademy/tab-Rune test: Playwright 1.59.1 rejects Chromium installation on ubuntu26.04-x64 in this environment

Addresses #827

@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.

@martin-henz
martin-henz requested a review from AaravMalani July 26, 2026 16:32
throw new GeneralRuntimeError('Rune channel is required but was not provided.');
}

super(conduit, [runeChannel], evaluator);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are there instances where an error is encountered without this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No observed user-facing runtime failure from this constructor ordering specifically. This one is a defensive/parity fix from the linked issue: with the old order, super(conduit, [runeChannel], evaluator) receives [undefined] before Rune gets a chance to throw its own "Rune channel is required" error. Moving the guard before super() keeps the invalid channel out of BaseModulePlugin entirely.


override async initialise() {
if (this.__initialised) return;
this.__initialised = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here, I'd love to hear the motivation behind this PR! Do you have a code sample out of curiosity?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I just noticed the attached issue, let me get home and review this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Quick concrete repro for the initialise() part: create a RuneModulePlugin, call await plugin.initialise(), then call it again. Before this change, the second call re-runs super.initialise() and re-pushes the exported methods/primitive runes, so plugin.exports.map(each => each.symbol) grows duplicates. The added initialise only exports primitive runes once test pins that behavior. The tab lookup part is similarly low-risk cleanup: createRunePlugin(["Other Tab", RUNE_TAB_NAME]) should load RUNE_TAB_NAME, not whatever happens to be at tabs[0].

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