fix(raijin): enforce ESM runtime boundaries#797
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70af4237e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 350996f4ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
raijin/yarn/raijin/src/initializer/project.ts
Lines 63 to 64 in 6f68c5b
When an existing project already has the current packageManager (for example, rerunning raijin init in a project created before this change), this early return skips adding type: 'module'. The same patch now makes the service build and TypeScript loaders require an ESM package boundary, so those projects remain un-normalized and can still fail the new checks immediately after initialization; include manifest.type === 'module' in the no-op condition or rewrite the manifest when it is missing.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88edb7e5a2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 849b0ae848
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9ac356f to
07e8edc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07e8edc36f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec44fb8fb0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7152a3cb84
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b7d1a5f8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc8b83a649
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0c3bbe2b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ddf26ac10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3765f8a3d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Task
Scope
This hotfix restores the Raijin contract after the public package-surface collapse from the last known working
@atls/raijin@0.5.2line.The scope covers two connected regression classes:
@atls/raijinpackage.this.context.cwd/process.cwd()independently instead of going through one owned project/workspace context boundary.Release window:
@atls/raijin@0.5.2was the reference release before the package-surface collapse.@atls/raijin@0.6.0and collapsed the public npm surface to@atls/raijin.@atls/raijin@0.6.1and restored the public initializer artifact path.@atls/raijin@0.6.2and attempted to restore consumer build/start paths.Findings and audit inputs that define this PR:
src/.next/standalone/<absolute project path>/srcinstead of the real standalone root.Runtime boundary scope:
startcommands run built entrypoints through the owned Raijin PnP/runtime boundary;require.resolvepackage subpaths;type: moduleeven whenpackageManageris already current;@atls/raijinrelease boundary.Command context refactor scope:
@atls/yarn-plugin-tools/command-context;workspace.cwdfor package-local files and child process cwd;project.cwd/ top-level workspace state;renderer build,renderer start,renderer devservice build,service dev,service startlibrary buildui icons generateimage packlint,format,check,checks lintbadges generate.How to verify
Before the fix
Build or start an ESM service that statically imports a manifest dependency and dynamically imports an optional dependency.
Expected result: static dependency externals can be emitted through a broken async/CommonJS boundary, while optional dependencies can be resolved too early.
Start existing Serenity or Pathfinder services/renderers with the published
@atls/raijin@0.6.2runtime.Expected result: Raijin runtime can fail before the consumer application boundary because the runtime contract was changed away from the ESM-only path.
Run workspace-targeted explicit test files.
Expected result: root-relative explicit paths and workspace ignore configuration can be resolved from the wrong cwd.
Re-run
raijin initin an already-current project.Expected result:
package.jsonmay keep a missing or CommonJStypevalue.Run commit-msg checks for merge/revert commits, long footers, or multi-scope commit subjects.
Expected result: the hand-rolled path can diverge from the previous commitlint behavior.
Build a clean single-project Next application with
type: moduleandoutput: 'standalone'.Expected result: Next build completes, then Raijin fails while copying standalone files or later starts the Next standalone CommonJS server file as ESM.
Run workspace commands from a nested directory inside a workspace.
Expected result: commands that should operate on the containing workspace can read package-local files,
src,dist,icons,package.json, orREADME.mdfrom the nested directory instead of the workspace root.Import a package whose conditional exports select a missing ESM
importtarget while a CommonJSrequiretarget exists.Expected result: the current loader can mask the selected ESM failure by resolving the CommonJS branch through
require.resolve.After the fix
service startandrenderer startexecute built entrypoints under the owned Raijin PnP/runtime boundary.--require .pnp.cjsand remove only.pnp.loader.mjsstate.type: modulefor current projects.@atls/raijinand explicitly declines modified internal workspaces.Proofs
Final branch commits:
b38bcead7centralizes project/workspace/current-cwd command context.7c50d8ffpreserves the renderer standalone ESM start path.2fc67000resolves import-sort workspace context from nested cwd.f244b6c5restores service ESM webpack dependency boundaries.2da5a366rebuilds the standard runtime bundle.05ce688arestores the official commitlint parser path for breaking shorthand and parser parity.a4239790declines modified internal command plugin workspaces through the Yarn deferred version boundary.a2b41ebb2resolves ESLint runtime imports through the nearest Raijin package boundary.52f1588c2preserves patched TypeScript descriptors when the normalized range already matches.a58c00047keeps workspace peer dependencies local before service externalization.601bb614fcompletes internal workspace version decisions.eff526473runsrenderer devfrom thesrcNext app directory.Local proof before push:
Follow-up remediation proof for review findings 3 and 4:
Latest current-head remediation proof:
Consumer smoke from packed
/tmp/atls-raijin-pr797.tgz:head_1.default.rewind is not a function.class-validator, missing@nestjs/platform-express, thenrxjs.lastValueFromafter adding smoke-only deps in the temporary worktree.ExplorerService/ModulesContainer.No remaining observed failure in these smokes is a Raijin cwd, ESM loader, webpack externals, PnP hook, import-meta, or runtime entrypoint failure.