fix(apps): write ephemeral Deno config to writable runtime directory#41322
fix(apps): write ephemeral Deno config to writable runtime directory#41322iamtanishqjain wants to merge 2 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
|
WalkthroughThe Deno runtime now places its generated ephemeral configuration at a deterministic path inside the temporary runtime directory rather than deriving the path from the packaged Deno configuration file. ChangesDeno runtime configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts`:
- Around line 70-74: The ephemeral config path in AppsEngineDenoRuntime still
traverses the deno-runtime symlink into the read-only package directory. Update
denoEphemeralConfigPath to a writable location outside the symlinked
deno-runtime directory, and ensure its parent directory exists before the write
performed by the runtime configuration setup near the symlink creation logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b152b0e-8b0a-45e8-8410-5ca7547ff3ea
📒 Files selected for processing (1)
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: CodeRabbit
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
🧠 Learnings (4)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2026-05-11T21:46:23.471Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 40463
File: packages/apps/src/lib/SecureFields.ts:17-19
Timestamp: 2026-05-11T21:46:23.471Z
Learning: In Rocket.Chat’s `packages/apps/tsconfig.json`, TypeScript `"strict"` is set to `false`, which disables strict type-checking (including `noImplicitAny`) for `packages/apps`. When reviewing, do not flag TS7053 (and similar strict-mode indexing/type errors) in files under `packages/apps/src/` that are a consequence of this relaxed strictness—e.g., patterns like indexing an `unknown`/`object` via optional chaining such as `object?.[kSecureFields]`.
Applied to files:
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
| this.denoEphemeralConfigPath = path.join( | ||
| this.tempFilePath, | ||
| 'deno-runtime', | ||
| 'deno.runtime.jsonc', | ||
| ); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
The ephemeral config still resolves to the read-only package directory through the symlink.
Line 82 creates a symlink: this.tempFilePath/deno-runtime/ → path.dirname(this.denoConfigPath) (the package's Deno config directory, which is read-only on Snap). The new denoEphemeralConfigPath at lines 70-74 is this.tempFilePath/deno-runtime/deno.runtime.jsonc, which resolves through that symlink to path.dirname(this.denoConfigPath)/deno.runtime.jsonc — the same read-only location the old code wrote to. The fs.writeFileSync at line 45 (invoked via line 90) will still fail with EROFS on Snap deployments, so this PR does not achieve its stated objective.
The fix is to place the ephemeral config in a directory that is not covered by the symlink:
🐛 Proposed fix: write ephemeral config outside the symlinked directory
this.denoRuntimePath = path.join(this.tempFilePath, 'deno-runtime', 'main.ts');
- this.denoEphemeralConfigPath = path.join(
- this.tempFilePath,
- 'deno-runtime',
- 'deno.runtime.jsonc',
- );
+ this.denoEphemeralConfigPath = path.join(this.tempFilePath, 'deno-runtime-config', 'deno.runtime.jsonc');Then ensure the parent directory exists before writing (add before line 90):
+ fs.mkdirSync(path.dirname(this.denoEphemeralConfigPath), { recursive: true });
generateEphemeralDenoConfig(this.denoEphemeralConfigPath, this.denoConfigPath, this.appsEnginePath);This keeps the ephemeral config in the writable temp directory while the symlink at deno-runtime/ continues to expose only the runtime script (main.ts) and other static files from the package.
Also applies to: 82-90
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts` around lines
70 - 74, The ephemeral config path in AppsEngineDenoRuntime still traverses the
deno-runtime symlink into the read-only package directory. Update
denoEphemeralConfigPath to a writable location outside the symlinked
deno-runtime directory, and ensure its parent directory exists before the write
performed by the runtime configuration setup near the symlink creation logic.
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts">
<violation number="1" location="packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts:70">
P0: Writing ephemeral config to `<tempFilePath>/deno-runtime/deno.runtime.jsonc` goes through the symlink back to the read-only package directory, so the EROFS error on Snap deployments persists — the fix doesn't reach writable storage. The constructor creates a 'dir' symlink at `<tempFilePath>/deno-runtime` → `<packageDir>/deno-runtime/` before the config write. Write the ephemeral config to a path that does not traverse the symlink, e.g. `path.join(this.tempFilePath, 'deno.runtime.jsonc')`, and update `generateEphemeralDenoConfig` and the `--config` arg accordingly.</violation>
<violation number="2" location="packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts:70">
P3: Indentation is inconsistent with the rest of the constructor body. The surrounding code uses two tabs for statements inside the constructor, but the new lines use only one tab. Consider aligning the indentation to match the file's convention (two tabs for constructor-body statements).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| this.denoRuntimePath = path.join(this.tempFilePath, 'deno-runtime', 'main.ts'); | ||
| this.denoEphemeralConfigPath = this.denoConfigPath.replace('.jsonc', '.runtime.jsonc'); | ||
| this.denoEphemeralConfigPath = path.join( |
There was a problem hiding this comment.
P0: Writing ephemeral config to <tempFilePath>/deno-runtime/deno.runtime.jsonc goes through the symlink back to the read-only package directory, so the EROFS error on Snap deployments persists — the fix doesn't reach writable storage. The constructor creates a 'dir' symlink at <tempFilePath>/deno-runtime → <packageDir>/deno-runtime/ before the config write. Write the ephemeral config to a path that does not traverse the symlink, e.g. path.join(this.tempFilePath, 'deno.runtime.jsonc'), and update generateEphemeralDenoConfig and the --config arg accordingly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts, line 70:
<comment>Writing ephemeral config to `<tempFilePath>/deno-runtime/deno.runtime.jsonc` goes through the symlink back to the read-only package directory, so the EROFS error on Snap deployments persists — the fix doesn't reach writable storage. The constructor creates a 'dir' symlink at `<tempFilePath>/deno-runtime` → `<packageDir>/deno-runtime/` before the config write. Write the ephemeral config to a path that does not traverse the symlink, e.g. `path.join(this.tempFilePath, 'deno.runtime.jsonc')`, and update `generateEphemeralDenoConfig` and the `--config` arg accordingly.</comment>
<file context>
@@ -67,7 +67,12 @@ export class DenoRuntimeSubprocessController extends BaseRuntimeSubprocessContro
this.denoRuntimePath = path.join(this.tempFilePath, 'deno-runtime', 'main.ts');
- this.denoEphemeralConfigPath = this.denoConfigPath.replace('.jsonc', '.runtime.jsonc');
+ this.denoEphemeralConfigPath = path.join(
+ this.tempFilePath,
+ 'deno-runtime',
</file context>
| this.denoEphemeralConfigPath = path.join( | ||
| this.tempFilePath, | ||
| 'deno-runtime', | ||
| 'deno.runtime.jsonc', |
There was a problem hiding this comment.
P3: Indentation is inconsistent with the rest of the constructor body. The surrounding code uses two tabs for statements inside the constructor, but the new lines use only one tab. Consider aligning the indentation to match the file's convention (two tabs for constructor-body statements).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts, line 70:
<comment>Indentation is inconsistent with the rest of the constructor body. The surrounding code uses two tabs for statements inside the constructor, but the new lines use only one tab. Consider aligning the indentation to match the file's convention (two tabs for constructor-body statements).</comment>
<file context>
@@ -67,7 +67,12 @@ export class DenoRuntimeSubprocessController extends BaseRuntimeSubprocessContro
this.denoRuntimePath = path.join(this.tempFilePath, 'deno-runtime', 'main.ts');
- this.denoEphemeralConfigPath = this.denoConfigPath.replace('.jsonc', '.runtime.jsonc');
+ this.denoEphemeralConfigPath = path.join(
+ this.tempFilePath,
+ 'deno-runtime',
</file context>
| this.denoEphemeralConfigPath = path.join( | |
| this.tempFilePath, | |
| 'deno-runtime', | |
| 'deno.runtime.jsonc', | |
| this.denoEphemeralConfigPath = path.join( | |
| this.tempFilePath, | |
| 'deno-runtime', | |
| 'deno.runtime.jsonc', | |
| ); |
Summary
This PR proposes Related to #41015.
Currently, the runtime generates
deno.runtime.jsoncalongside the bundleddeno.jsonc. On Snap deployments, the package directory is mounted read-only, causingEROFSwhen the runtime attempts to create the generated configuration.This change updates the generated runtime configuration path to use the existing temporary
deno-runtimedirectory instead of deriving it from the bundled configuration path.Motivation
The runtime already executes from a temporary
deno-runtimedirectory. Generating the ephemeral configuration in the same writable runtime location avoids writes to the immutable Snap package directory.Fixes #41015
Summary by CodeRabbit