Skip to content

fix(renderer): isolate compiler imports from CLI diagnostics - #418

Merged
tt-a1i merged 2 commits into
tt-a1i:devfrom
NaCr05:fix/workflow-import-isolation
Sep 16, 2026
Merged

tt-a1i merged 2 commits into
tt-a1i:devfrom
NaCr05:fix/workflow-import-isolation

Conversation

@NaCr05

@NaCr05 NaCr05 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem and value

Importing compileWorkflow() with ARCHIFY_DIAGNOSTIC_FORMAT=json installs a process-level exception handler through shared SVG helpers. A later exception belonging to the embedding host can then produce a renderer receipt and exit the process.

Install that boundary when loadDiagram() starts instead. Compiler imports preserve the host's exception policy; all five CLI entrypoints still establish diagnostics before reading or validating input.

Related to #222. This is the preparatory import-isolation fix, without introducing a public render API.

Stability impact

  • Shared behavior: diagnostic initialization used by all five renderer CLIs and indirectly imported by the workflow compiler.
  • Preserve CLI failure exits, machine-readable diagnostics, existing artifacts on failure, and successful HTML bytes.
  • Add regressions for host-owned exceptions and compiler calls with frozen inputs/prior results, alternating v1/v2 and configuration, and failure/success sequences.
  • Loader validation, brand preparation and environment-independent library configuration remain outside this change.

Tests run

Current base: d15010a2d49f93388820f8a3b7474b77aef60006. Current candidate: 8ae0d450b588fe5808959332f7296dfd7ae5ce5f.

This revision merges main's benchmark visual-defect validation fix (#402). It adds no further import-isolation changes: the four-file PR diff against current main is byte-for-byte identical to the original patch at 72deba7.

Fresh local checks use official Node 22.23.2. Linux checks run against the exact candidate source tree exported with git archive, with a temporary Git snapshot for tracked-file package checks and the committed ZIP unchanged.

Check Result
Linux full npm test 1333 passed, 0 failed, 48 conditional skips; generation checks and golden harness passed
Linux import/call contracts plus updated benchmark suite 32 passed, 0 failed, 0 skipped
Linux contracts with JSON diagnostics 13 passed, 0 failed, 0 skipped
Windows import/call contracts plus benchmark suite 24 passed, 8 failed, 0 skipped; all 13 import/call contracts passed
Same Windows benchmark suite on unchanged current main 11 passed, 8 failed, 0 skipped; the eight failure names exactly match the candidate
ZIP freshness Official Node 22.23.2 rebuild matches the committed archive byte-for-byte
Current-head hosted CI Success: 10 jobs passed (Node 18/20/22/24, three-platform package smoke, ZIP freshness, published manifest and real-browser checks); Pages deployment skipped

The Windows full suite was not rerun or claimed green. Its earlier run on 72deba7 had 1292 passed, 31 failed and 57 skipped; an aligned base replay reproduced 30 failures, and the remaining notifier timing case passed in isolation on both base and candidate.

Earlier reproduction evidence remains tied to base 30fd463: the new tests fail twice on that base and pass with the fix. Historical Windows/Linux extracted-package smoke and all 13 extracted-module contracts also passed. These results are reused because the renderer sources, new contract tests and ZIP are unchanged; they are not relabeled as new-head runs.

Reproduce focused checks from archify/:

node --test test/renderer-import-isolation.test.mjs test/workflow-compiler-call-contract.test.mjs test/ordinary-model-floor.test.mjs
ARCHIFY_DIAGNOSTIC_FORMAT=json node --test test/renderer-import-isolation.test.mjs test/workflow-compiler-call-contract.test.mjs

git diff --check passes; the working tree is clean.

Coordination with #396

Proposed merge order: land this independently useful import-isolation fix first, then update #396 while preserving boundary initialization in loadDiagram(). Its two standalone diagnostic probes need explicit boundary initialization because they bypass that loader. If the maintainer prefers #396 first, this PR can be adapted afterward.

At the unchanged #396 head 80187faf511740005c8982e4a2514f132e08e40b, the earlier local rehearsal passed all 28 targeted checks with those two probe adaptations and their assertions intact. Across the earlier main and #396 variants, 75 paired CLI comparisons preserved exit/stdout/stderr and all 15 successful HTML hash comparisons matched. This is historical compatibility evidence, not a full-suite or regenerated-package validation of #396 combined with today's main.

Keeping this PR in Draft pending maintainer confirmation of the order.

Visual evidence

Not applicable: this changes host/CLI initialization, not geometry or Viewer behavior. HTML byte comparisons establish compatibility, not perceptual approval. Local optional browser tests remain skips; hosted browser checks are reported in the linked CI run.

Generated artifacts

archify.zip was built with official Node 22.23.2 and verified byte-identical on Windows/Linux. A fresh official Node 22.23.2 Linux build after synchronization still matches it exactly. Of 79 entries, only archify/renderers/shared/cli.mjs changes content relative to main.

Archive SHA-256: c8dbcbb916e29f2e1f33d6b4473c7c4f5e303ad0e3705a17f3a3740fb80613d8. No Gallery or Viewer inputs changed.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tt-a1i

tt-a1i commented Sep 16, 2026

Copy link
Copy Markdown
Owner

The merge-order question is resolved: import isolation will be integrated before #396. I could not push the dev refresh to the fork branch (permission denied), so #441 preserves this PR's commits and adds the current dev base plus the canonical ZIP rebuild. Its focused tests pass (19/19); final CI is pending. Keeping this PR open until the integration replacement is accepted.

@tt-a1i
tt-a1i merged commit 1f64d8d into tt-a1i:dev Sep 16, 2026
12 checks passed
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