Skip to content

fix(apps): write Deno runtime config to temp directory#41338

Open
AlgoArtist06 wants to merge 3 commits into
RocketChat:developfrom
AlgoArtist06:fix/41006-deno-runtime-config-permissions
Open

fix(apps): write Deno runtime config to temp directory#41338
AlgoArtist06 wants to merge 3 commits into
RocketChat:developfrom
AlgoArtist06:fix/41006-deno-runtime-config-permissions

Conversation

@AlgoArtist06

@AlgoArtist06 AlgoArtist06 commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • write the generated Deno runtime config to a controller-specific directory under the host-provided temp path
  • resolve relative import-map targets against the installed static config before moving it
  • remove each controller’s runtime directory on construction failure or shutdown
  • add regression coverage for the writable location, import resolution, isolation, and cleanup

Closes #41006

Testing

  • ../../node_modules/.bin/tsc -p tsconfig.json --noEmit
  • ../../node_modules/.bin/eslint src/server/runtime/deno/AppsEngineDenoRuntime.ts tests/server/runtime/DenoRuntimeSubprocessController.test.ts
  • focused controller lifecycle smoke check for isolated config creation and cleanup

The full Deno runtime integration test could not complete locally because the environment has Deno 2.9.2 while the repository pins Deno 2.3.1; its shared startup hook timed out before the regression assertions ran.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved Deno app startup in non-root containers by writing the generated runtime configuration to a writable temporary directory.
    • Fixed generated Deno runtime configuration imports by properly resolving relative paths and normalizing them for consistent behavior.
    • Ensured each app run gets an isolated temporary runtime directory and that it’s cleaned up when the app stops.

@AlgoArtist06 AlgoArtist06 requested a review from a team as a code owner July 13, 2026 12:41
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfb2530

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rocket.chat/apps Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1ce06f9-03ca-43a9-b455-16099ef3b272

📥 Commits

Reviewing files that changed from the base of the PR and between a8b4e4e and cfb2530.

📒 Files selected for processing (1)
  • packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts
📜 Recent review details
⚠️ CI failures not shown inline (1)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 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/tests/server/runtime/DenoRuntimeSubprocessController.test.ts
🧠 Learnings (3)
📚 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/tests/server/runtime/DenoRuntimeSubprocessController.test.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/tests/server/runtime/DenoRuntimeSubprocessController.test.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/tests/server/runtime/DenoRuntimeSubprocessController.test.ts
🔇 Additional comments (1)
packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts (1)

85-90: LGTM!


Walkthrough

Deno runtime configuration generation now resolves relative imports and writes artifacts to isolated temporary directories. Controllers clean up these directories on failure and shutdown, with tests covering configuration contents, isolation, and removal. A changeset records the package patch release.

Changes

Deno runtime temporary configuration

Layer / File(s) Summary
Resolve ephemeral runtime imports
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Relative import targets are resolved against the static configuration directory and normalized, while non-relative targets remain unchanged.
Isolate and clean runtime artifacts
packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Each controller uses a unique temporary runtime directory for Deno artifacts and removes it after failures or stopApp().
Validate runtime cleanup and release metadata
packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts, .changeset/tidy-snails-smile.md
Tests verify generated configuration contents, isolated directories, and cleanup; the changeset records a patch release and non-root startup fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: bug

Suggested reviewers: d-gubert, ggazzo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving the Deno runtime config write location to a temp directory.
Linked Issues check ✅ Passed The changes address issue #41006 by writing the ephemeral Deno config to a writable temp directory so non-root containers can start apps.
Out of Scope Changes check ✅ Passed The path resolution and cleanup updates are supporting implementation details for the same Deno config write-location fix, with no unrelated changes apparent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@AlgoArtist06

Copy link
Copy Markdown
Author

The implementation and regression coverage have been locally verified (yarn jest packages/apps/tests/server/runtime/DenoRuntimeSubprocessController.test.ts --runInBand and yarn prettier --check on all changed files), and the available automated checks are passing. I cannot apply stat: QA assured: that label is reserved for company-insider approval, and the GitHub API returns HTTP 403 for my account. I also cannot assign an upstream milestone/project. Maintainers: please perform/confirm QA and assign the appropriate milestone or project when triaging this community PR.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.02%. Comparing base (edbaeef) to head (034c88a).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41338      +/-   ##
===========================================
- Coverage    69.04%   69.02%   -0.02%     
===========================================
  Files         3757     3757              
  Lines       147735   147735              
  Branches     26395    26355      -40     
===========================================
- Hits        102000   101973      -27     
- Misses       41234    41262      +28     
+ Partials      4501     4500       -1     
Flag Coverage Δ
unit 70.47% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apps fail to load with EACCES on deno.runtime.jsonc when running container as non-root (8.5.x regression)

1 participant