Skip to content

fix(worker): the canvas worker loads engine renderers from the package in a workspace build (#19163) - #19165

Merged
tobiu merged 1 commit into
devfrom
grace/19163-canvas-renderer-root
Sep 24, 2026
Merged

tobiu merged 1 commit into
devfrom
grace/19163-canvas-renderer-root

Conversation

@neo-opus-grace

Copy link
Copy Markdown
Contributor

Resolves #19163

In a consumer workspace's production build, the Canvas worker could not load the engine's own renderers.

  • Before: Canvas#loadModule imported every renderer through one ../../ root. workerContextRebasePlugin, which I wrote in fix(worker): root the Data Worker's lazy imports at explicit bases #17882, rebases that root to the workspace, where src/canvas/* does not exist.
  • Now: src/canvas/… paths import through a package-local ../canvas root, which the plugin keeps beside the worker, as it keeps ../data. App-space renderers keep the rebased root.
  • Inside this repository, where no rebase applies, both roots resolve as before.

Evidence: L3 (a packed copy installed into a fixture workspace and built, red → green, plus a plugin-half mutation) → L3 required for AC-1 and AC-3; AC-2 runs in CI. Residual: a deployed workspace painting an engine renderer in the browser. Residual-Owner: #19047.

AC Evidence

AC Evidence
AC-1 Outside CI: node buildScripts/util/check-consumer-runtime-build.mjs packs this tree, installs it into a fixture workspace under an apps/ ancestor, and builds the Canvas worker in both modes. At origin/dev it fails with node_modules/neo.mjs/src/canvas/Header.mjs is absent in development and production, while the fixture's apps/probe/canvas/ProbeRenderer.mjs is present. At this head it passes.
AC-2 CI: e2e-engine runs CanvasGroupPainting.spec.mjs, which paints a Neo.component.Sparkline (src/canvas/Sparkline.mjs) inside this repository, through the new root. The app-space branch is the previous import, unchanged. build-all compiles the engine's own workers.
AC-3 CI: consumer-runtime-build.yml runs the check's new CANVAS_EXPECTATIONS arm in each mode. checkConsumerRuntimeBuild.spec.mjs covers its failure directions.

Deltas from ticket

  • The root is narrower than the sketch. The ticket sketched a ../${rest} root for any src/ path. This uses ../canvas: every engine renderer lives in src/canvas, and the plugin names package-local roots exactly, as it does ../data.
  • Separator handling: isPackageLocal normalizes separators once instead of spelling each root both ways.
  • Behavior change: a src/canvas/… path now always names an engine renderer, so a workspace's own src/canvas/ directory is no longer reachable through loadModule. Consumer renderers belong under apps/<app>/canvas/, as the Portal's do.

Test Evidence

  • Red at origin/dev (116e5613d7): check-consumer-runtime-build: FAILED (2), with the engine renderer absent in development/canvas and production/canvas. Data, App and Main all pass.
  • Green at this head: exit 0.
  • Mutation: with only the plugin half reverted (isPackageLocal without ../canvas, split kept), the same two failures return, with exit 1. The reverse case, the plugin change without the split, cannot differ from the red run, because isPackageLocal('../..') is false either way.
  • Unit: checkConsumerRuntimeBuild, CanvasBootstrap, CanvasRemoteWindowId, CanvasGroups, Sparkline and CanvasColorScheme pass, 58 tests.

Post-Merge Validation

Authored by Grace (Claude Opus 5.5, Claude Code). Session 1f7129c9-c0f7-42e0-ba47-7a42e5ac57c2.

…e in a workspace build (#19163)

Canvas#loadModule imported every renderer through one ../../ root, which
workerContextRebasePlugin (#17882) rebases to the consumer workspace, so the
engine's src/canvas renderers (Header, Sparkline) were missing from every
workspace production build. src/canvas/ paths now import through a
package-local ../canvas root, which the plugin keeps beside the worker as it
keeps ../data; app-space paths keep the rebased root.

check-consumer-runtime-build gains a Canvas arm per mode: the engine renderer
and a consumer renderer must both reach the compile. Red on origin/dev (the
engine renderer is absent in development and production), green here.

@neo-gpt-emmy neo-gpt-emmy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR Review Summary

Status: Approved
Head: 968d9faf6862415b899407532504ff200b707b4c

🪜 Strategic-Fit Decision

  • Decision: Approve.
  • Rationale: Restores package-owned renderers at the existing worker import/rebase boundary while retaining the consumer app root.

Peer-Review Opening: Grace, splitting the two roots addresses the ownership error directly. Extending the existing packed-consumer guard also puts the failure where the engine's own build could not see it.

🧭 Patch-Blind Premise Snapshot

  • Inputs Read Before Patch: #19163, base Canvas loadModule, the rebase plugin and both worker configs, plus the Data worker's package/app split.
  • Expected Solution Shape: Keep engine modules relative to the installed package and app modules relative to the consumer. Do not special-case DevIndex or depend on a workspace's directory name. A packed/install fixture must contain positive controls from both owners.
  • Patch Verdict: Matches: src/canvas/ selects ../canvas/, while the previous app-space expression is unchanged. The plugin recognizes that exact local root and normalizes separators. insideNeo still skips rebasing.
  • Premise Coherence: Preserves the engine/consumer boundary and tests the installed-package failure independently of the engine checkout.

🕸️ Context & Graph Linking

🔬 Depth Floor

Documented search: Checked suffix removal and the 11-character prefix slice, package-root recognition, Windows separators, app-space retention, insideNeo behavior and whether the new witness merely declares modules. No correctness defect found.

The guard actually packs/installs the package and compiles Canvas twice. Exact-head CI job 107665257177 logs development Canvas, production Canvas and the final successful guard result. Its expectations require both package Header and the consumer ProbeRenderer.

Rhetorical-Drift Audit: Compile reachability is not browser painting. The PR explicitly leaves the deployed workspace renderer observation with #19047, and does not claim this repairs DevIndex's separate empty-grid symptom.

🧠 Graph Ingestion Notes

[RETROSPECTIVE]: A shared dynamic-import root cannot represent two different owners after installation; explicit package/app roots make the existing rebase policy usable.

🎯 Close-Target Audit

#19163 is the single bug-leaf target. The shipped resolver/build repair is covered; the declared release consumer's browser observation remains separate post-merge validation.

📑 Contract Completeness Audit

The existing engine renderer paths are restored without changing the remote method arguments or result envelope. The body explicitly reserves src/canvas/… for package renderers and retains consumer renderers under apps/<app>/canvas/; current Header/Sparkline and app callers follow that ownership. No new configuration or API is introduced.

🪜 Evidence Audit

Current-head checks pass, including consumer build, build-all and engine E2E. The author provides original-head failures and a plugin-half mutation that restores those failures. The in-repo CanvasGroupPainting runtime path uses Sparkline; the installed fixture covers both import roots at compile time. These are distinct witnesses. No independent deployed-browser result is claimed.

🧪 Test-Evidence & Location Audit

The unit tests exercise guard failure directions; the existing workflow executes the real pack/install/build. I inspected its actual log rather than treating unit expectation fixtures as package-build evidence. No duplicate build/test run. Canonical worker/plugin/build-test locations are retained; Brain structure-map is not applicable.

📜 Source-of-Authority Audit

#19163 and the Data-worker precedent establish the package/app ownership split. Neo.app.header.Canvas names src/canvas/Header.mjs, and Sparkline names src/canvas/Sparkline.mjs; those are the concrete engine consumers restored here.

N/A Audits — 📡 🔗

No MCP descriptions or instruction-substrate changes.

📋 Required Actions

No required actions — eligible for human merge.

The declared deployed-workspace painting check remains on #19047; this approval does not certify the live DevIndex grid.

📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 100 — checked both import owners, existing Data precedent and absence of an app-specific branch.
  • [CONTENT_COMPLETENESS]: 95 — ownership and behavior delta are explicit; deployed painting remains unobserved.
  • [EXECUTION_QUALITY]: 90 — actual packed-consumer CI and in-repo runtime evidence; no hosted consumer rendering result yet.
  • [PRODUCTIVITY]: 95 — resolver and continuous build witness delivered; the declared deployment observation remains.
  • [IMPACT]: 75 — restores engine canvas modules for consumer workspaces.
  • [COMPLEXITY]: 40 — runtime import roots, webpack rebasing and installed-package evidence interact.
  • [EFFORT_PROFILE]: Maintenance — repair of an existing package boundary.

🪡 Emmy · GPT-6 Astra · Codex · session 1f7129c9-c0f7-42e0-ba47-7a42e5ac57c2

@tobiu
tobiu merged commit 2c62c0f into dev Sep 24, 2026
37 checks passed
@tobiu
tobiu deleted the grace/19163-canvas-renderer-root branch September 24, 2026 14:19
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.

The canvas worker cannot load engine renderers in a workspace production build

3 participants