Skip to content

chore: update deno.lock and freeze install during build - #40038

Merged
dionisio-bot[bot] merged 3 commits into
developfrom
chore/update-deno-lock
Apr 9, 2026
Merged

chore: update deno.lock and freeze install during build#40038
dionisio-bot[bot] merged 3 commits into
developfrom
chore/update-deno-lock

Conversation

@d-gubert

@d-gubert d-gubert commented Apr 2, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

With the new upgrade of Deno, building the monorepo with yarn build (which causes the apps-engine to run deno cache to cache deno-runtime dependencies) with a different version during development would cause changes to the deno.lock file - this is not desireable. So we freeze the lock file, breaking the build if changes to it would occur.

Issue(s)

ARCH-2094

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Chores
    • Added automated Deno version validation that compares the repository-required and installed runtime, surfacing clear errors in CI and warnings locally on mismatch.
    • Improved messaging when the Deno runtime is unavailable to show a distinct "Could not execute deno" error.
    • Switched the setup to an install-based flow that enforces frozen installs in CI for reproducible runs.

@dionisio-bot

dionisio-bot Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Read required Deno version from .tool-versions, run deno --version to get installed version, parse X.Y.Z from both, enforce exact match (throw in CI, warn locally), improve command-not-found/error handling, and replace deno cache main.ts with deno install --entrypoint main.ts (add --frozen in CI).

Changes

Cohort / File(s) Summary
Deno Cache Script Update
packages/apps-engine/scripts/deno-cache.js
Add extractDenoVersion regex; read required version from .tool-versions; execute and parse deno --version; validate presence and format of versions; enforce exact match (CI: throw, local: warn); introduce SHELL_ERR_CMD_NOT_FOUND = 127 and improved error/cause logging; switch final command to deno install --entrypoint main.ts with --frozen when CI is set.

Sequence Diagram(s)

sequenceDiagram
  participant Script as Script (deno-cache.js)
  participant FS as File System
  participant Shell as Shell / CI
  participant Deno as Deno binary

  Script->>FS: read `.tool-versions`
  FS-->>Script: required Deno version string
  Script->>Shell: run `deno --version`
  Shell-->>Script: installed Deno output or error
  Script->>Script: extract versions (regex)
  alt deno executable missing (status 127)
    Script->>Shell: log "Could not execute deno" with cause / throw
  else versions parsed
    Script->>Script: compare required vs installed
    alt mismatch && CI
      Script->>Shell: throw "Incorrect deno version" / abort
    else mismatch && !CI
      Script->>Shell: console.warn
    end
    Script->>Deno: run `deno install --entrypoint main.ts` (add `--frozen` if CI)
    Deno-->>Script: success or error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

type: chore

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: update deno.lock and freeze install during build' accurately describes the main changes: updating deno.lock and adding frozen flag to deno install during CI builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@changeset-bot

changeset-bot Bot commented Apr 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5a2e805

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@codecov

codecov Bot commented Apr 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.53%. Comparing base (44938fd) to head (5a2e805).
⚠️ Report is 40 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40038      +/-   ##
===========================================
- Coverage    70.55%   70.53%   -0.02%     
===========================================
  Files         3271     3271              
  Lines       116782   116782              
  Branches     21090    21041      -49     
===========================================
- Hits         82393    82373      -20     
- Misses       32338    32359      +21     
+ Partials      2051     2050       -1     
Flag Coverage Δ
e2e 60.45% <ø> (-0.06%) ⬇️
e2e-api 48.10% <ø> (-0.03%) ⬇️
unit 70.98% <ø> (ø)

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.

@rc-layne

rc-layne Bot commented Apr 3, 2026

Copy link
Copy Markdown

⚠️ Layne — 2 warning(s)

Found 2 issue(s): 2 high.

@d-gubert

d-gubert commented Apr 6, 2026

Copy link
Copy Markdown
Member Author

/layne exception-approve LAYNE-1c1aef2d2ac310a3 LAYNE-139c7c3409afbe19 reason: Neither of the child process calls receive user input at all. Also, they're executed at build time, not run time

@d-gubert
d-gubert marked this pull request as ready for review April 6, 2026 12:43
@d-gubert
d-gubert requested a review from a team as a code owner April 6, 2026 12:43

@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.

No issues found across 2 files

@coderabbitai coderabbitai Bot removed the type: chore label Apr 6, 2026
@d-gubert
d-gubert force-pushed the chore/update-deno-lock branch from 14eff6f to e1d1feb Compare April 6, 2026 16:06

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/apps-engine/scripts/deno-cache.js (2)

68-70: Inconsistent error message check and unclear diagnostic logging.

The startsWith check uses 'Error: Incorrect deno version.' but the actual error message (line 48) starts with 'Incorrect Deno version' (different casing, no Error: prefix). Additionally, the check result is logged but never used for control flow, making this appear to be leftover debug code.

♻️ Proposed cleanup
 	} else {
-		console.error(e, e.message, e.message?.startsWith('Error: Incorrect deno version.'));
+		console.error(e);
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps-engine/scripts/deno-cache.js` around lines 68 - 70, The
console.error block is logging the raw error and a stray boolean check using
e.message?.startsWith('Error: Incorrect deno version.') which mismatches the
actual message and looks like leftover debug code; update the startsWith
comparison to match the real message prefix ("Incorrect Deno version") or remove
the boolean check entirely, and replace the noisy console.error(e, e.message,
...) with a clear diagnostic (e.g., console.error("Failed to cache Deno:",
e.message) or include e.stack) and, if this is a fatal condition, ensure proper
exit handling instead of merely logging; references: the console.error call, e,
e.message and the startsWith check.

79-80: Misleading comment: dev mode allows lockfile updates, not prevents them.

The comment says "don't update the lockfile" for dev envs, but without --frozen, deno install will update the lockfile if dependencies change. Consider clarifying the actual behavior.

📝 Suggested comment fix
-// In CI envs, break if lockfile changes; in dev envs, don't update the lockfile
+// In CI envs, break if lockfile changes; in dev envs, allow lockfile updates
 const commandLine = CI ? 'deno install --frozen --entrypoint main.ts' : 'deno install --entrypoint main.ts';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps-engine/scripts/deno-cache.js` around lines 79 - 80, The comment
above the commandLine declaration is misleading: CI uses '--frozen' to fail if
the lockfile changes, but the dev branch (commandLine when CI is falsy) does not
include '--frozen' and therefore may update the lockfile; update the comment to
state "in CI envs, break if lockfile changes; in dev envs, allow the lockfile to
be updated" (or alternatively add '--frozen' to the non-CI branch if you want to
prevent updates), referencing the CI variable and the '--frozen' flag used in
the commandLine assignment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 47-56: The constructed message string uses the expression '!CI &&
" The server will likely work..."' which inserts the boolean false into message
when CI is truthy; update the message construction in the block comparing
installedVersion and denoToolVersion to use a ternary (e.g. !CI ? " ..." : "")
instead of &&, and also fix the typo "do not to commit" → "do not commit";
ensure you update the local variable message referenced in the if (CI) throw and
console.warn branches.

---

Nitpick comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 68-70: The console.error block is logging the raw error and a
stray boolean check using e.message?.startsWith('Error: Incorrect deno
version.') which mismatches the actual message and looks like leftover debug
code; update the startsWith comparison to match the real message prefix
("Incorrect Deno version") or remove the boolean check entirely, and replace the
noisy console.error(e, e.message, ...) with a clear diagnostic (e.g.,
console.error("Failed to cache Deno:", e.message) or include e.stack) and, if
this is a fatal condition, ensure proper exit handling instead of merely
logging; references: the console.error call, e, e.message and the startsWith
check.
- Around line 79-80: The comment above the commandLine declaration is
misleading: CI uses '--frozen' to fail if the lockfile changes, but the dev
branch (commandLine when CI is falsy) does not include '--frozen' and therefore
may update the lockfile; update the comment to state "in CI envs, break if
lockfile changes; in dev envs, allow the lockfile to be updated" (or
alternatively add '--frozen' to the non-CI branch if you want to prevent
updates), referencing the CI variable and the '--frozen' flag used in the
commandLine assignment.
🪄 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: 14d77d3d-665f-4e9b-8417-70918f12183c

📥 Commits

Reviewing files that changed from the base of the PR and between 3bf2f62 and 14eff6f.

📒 Files selected for processing (1)
  • packages/apps-engine/scripts/deno-cache.js
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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-engine/scripts/deno-cache.js
🧠 Learnings (3)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
📚 Learning: 2026-03-18T16:45:52.113Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:181-188
Timestamp: 2026-03-18T16:45:52.113Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, granting `--allow-read` to the full `this.tempFilePath` (entire temp directory) in the Deno subprocess spawn options is intentional. The `deno.jsonc` config file can affect path resolution in ways that require read access to the broader temp directory, not just the `deno-runtime` subdirectory symlink. Do not flag this as an overly broad permission grant.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-03-18T16:47:56.781Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:137-151
Timestamp: 2026-03-18T16:47:56.781Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, the `EEXIST` catch block in the `DenoRuntimeSubprocessController` constructor (around lines 144–151) intentionally skips validating the target of a pre-existing `deno-runtime` symlink in the temp directory. The rationale is that spoofing the symlink requires the attacker to already have system-level write access to the temp directory, which grants far greater control than the deno-runtime sandbox could provide. Do not flag this as a security issue in future reviews.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
🔇 Additional comments (3)
packages/apps-engine/scripts/deno-cache.js (3)

1-6: LGTM!

Constants and imports are correctly set up. Using 127 for command-not-found is the standard POSIX convention.


8-29: LGTM!

The regex is well-designed with appropriate negative lookbehinds to avoid false positives, and the JSDoc documentation is valuable for understanding this complex pattern.


75-77: LGTM!

Path setup is correct and allows DENO_DIR override via environment variable.

Comment thread packages/apps-engine/scripts/deno-cache.js

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/apps-engine/scripts/deno-cache.js (1)

47-52: ⚠️ Potential issue | 🟡 Minor

Template interpolation still appends false in CI.

Line 48 uses !CI && "..." inside a template literal, so a CI mismatch throws Incorrect Deno version...false. It also still leaves the do not to commit typo in that string.

In JavaScript, what does `${!process.env.CI && " warning"}` render inside a template literal when `process.env.CI` is set to a non-empty string?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps-engine/scripts/deno-cache.js` around lines 47 - 52, The
template literal building message when installedVersion !== denoToolVersion
incorrectly uses `${!CI && " ... "}` which inserts "false" in CI and contains
the typo "do not to commit"; change that expression to a ternary so it yields an
empty string in CI and the full warning otherwise (e.g. `${CI ? "" : " The
server will likely work, but it may cause your deno.lock to change - do not
commit it. Make sure your Deno version matches the required one so you don't see
this message again."}`), updating the text to fix the "do not to commit" typo;
update the message variable near installedVersion and denoToolVersion
accordingly.
🧹 Nitpick comments (1)
packages/apps-engine/scripts/deno-cache.js (1)

8-29: Prefer explicit parsing over documenting this regex.

Lines 8-28 add a long implementation comment just to make the helper readable. Since both inputs have rigid formats, parsing them line-by-line would be simpler to maintain and avoids carrying explanatory comments in the JS implementation. As per coding guidelines, "Avoid code comments in the implementation".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps-engine/scripts/deno-cache.js` around lines 8 - 29, The current
implementation of extractDenoVersion embeds a complex regex and a long
explanatory comment; replace that with explicit, line-by-line parsing to make it
simpler and comment-free: remove the multi-line comment and the large
single-regex use in extractDenoVersion, split the input into lines, iterate
lines and for each line check that it contains the token "deno"
(case-insensitive) as a standalone token (e.g., match /\b[Dd]eno\b/ or ensure
surrounding characters are not word/dot/dash), then search that same line for a
semver-like version using /(\d+\.\d+\.\d+)/ and return the first captured
version (or undefined if none); keep the function name extractDenoVersion and
its external behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 79-80: The current commandLine sets '--frozen' only when CI is
true but the comment and intent say dev should not update deno.lock either;
update the assignment for commandLine so the deno install invocation includes
'--frozen' in the non-CI path as well (or remove the CI conditional and always
use '--frozen'), referencing the commandLine variable and the deno install
invocation so the developer ensures deno won't alter deno.lock during local
runs.

---

Duplicate comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 47-52: The template literal building message when installedVersion
!== denoToolVersion incorrectly uses `${!CI && " ... "}` which inserts "false"
in CI and contains the typo "do not to commit"; change that expression to a
ternary so it yields an empty string in CI and the full warning otherwise (e.g.
`${CI ? "" : " The server will likely work, but it may cause your deno.lock to
change - do not commit it. Make sure your Deno version matches the required one
so you don't see this message again."}`), updating the text to fix the "do not
to commit" typo; update the message variable near installedVersion and
denoToolVersion accordingly.

---

Nitpick comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 8-29: The current implementation of extractDenoVersion embeds a
complex regex and a long explanatory comment; replace that with explicit,
line-by-line parsing to make it simpler and comment-free: remove the multi-line
comment and the large single-regex use in extractDenoVersion, split the input
into lines, iterate lines and for each line check that it contains the token
"deno" (case-insensitive) as a standalone token (e.g., match /\b[Dd]eno\b/ or
ensure surrounding characters are not word/dot/dash), then search that same line
for a semver-like version using /(\d+\.\d+\.\d+)/ and return the first captured
version (or undefined if none); keep the function name extractDenoVersion and
its external behavior unchanged.
🪄 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: 25c25ffc-b8e4-46cd-bf3a-1fdcd39c5269

📥 Commits

Reviewing files that changed from the base of the PR and between 14eff6f and e1d1feb.

⛔ Files ignored due to path filters (1)
  • packages/apps-engine/deno-runtime/deno.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • packages/apps-engine/scripts/deno-cache.js
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
🧰 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-engine/scripts/deno-cache.js
🧠 Learnings (4)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:137-151
Timestamp: 2026-03-18T16:47:56.781Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, the `EEXIST` catch block in the `DenoRuntimeSubprocessController` constructor (around lines 144–151) intentionally skips validating the target of a pre-existing `deno-runtime` symlink in the temp directory. The rationale is that spoofing the symlink requires the attacker to already have system-level write access to the temp directory, which grants far greater control than the deno-runtime sandbox could provide. Do not flag this as a security issue in future reviews.
📚 Learning: 2026-03-18T16:45:52.113Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:181-188
Timestamp: 2026-03-18T16:45:52.113Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, granting `--allow-read` to the full `this.tempFilePath` (entire temp directory) in the Deno subprocess spawn options is intentional. The `deno.jsonc` config file can affect path resolution in ways that require read access to the broader temp directory, not just the `deno-runtime` subdirectory symlink. Do not flag this as an overly broad permission grant.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-03-18T16:47:56.781Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:137-151
Timestamp: 2026-03-18T16:47:56.781Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, the `EEXIST` catch block in the `DenoRuntimeSubprocessController` constructor (around lines 144–151) intentionally skips validating the target of a pre-existing `deno-runtime` symlink in the temp directory. The rationale is that spoofing the symlink requires the attacker to already have system-level write access to the temp directory, which grants far greater control than the deno-runtime sandbox could provide. Do not flag this as a security issue in future reviews.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js

Comment thread packages/apps-engine/scripts/deno-cache.js Outdated
@coderabbitai coderabbitai Bot removed the type: chore label Apr 6, 2026
@d-gubert
d-gubert force-pushed the chore/update-deno-lock branch from 2978955 to 70dabb2 Compare April 6, 2026 17:52

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/apps-engine/scripts/deno-cache.js (1)

47-56: ⚠️ Potential issue | 🟡 Minor

Bug: && operator produces false in the output string when CI is set.

When CI is truthy, !CI && "..." evaluates to the boolean false, causing the message to include the literal string "false" instead of nothing. Use a ternary operator instead. Also fix the typo "do not to commit" → "do not commit".

🐛 Proposed fix
 	if (installedVersion !== denoToolVersion) {
-		const message = `Incorrect Deno version. Required '${denoToolVersion}', found '${installedVersion}'.${!CI && " The server will likely work, but it may cause your deno.lock to change - do not to commit it. Make sure your Deno version matches the required one so you don't see this message again."}`;
+		const message = `Incorrect Deno version. Required '${denoToolVersion}', found '${installedVersion}'.${!CI ? " The server will likely work, but it may cause your deno.lock to change - do not commit it. Make sure your Deno version matches the required one so you don't see this message again." : ""}`;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps-engine/scripts/deno-cache.js` around lines 47 - 56, The
constructed message uses "!CI && '...'" which evaluates to false when CI is
truthy, injecting "false" into the string; update the message assembly in the
block that compares installedVersion and denoToolVersion (the variable names
installedVersion, denoToolVersion and the CI flag) to use a ternary like CI ? ""
: " ..." instead of &&, and also fix the typo "do not to commit" → "do not
commit" so the warning reads correctly when CI is false.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 68-70: The current check uses e.message?.startsWith('Error:
Incorrect deno version.') which will never match because Error.message lacks the
"Error: " prefix and also logs a stray boolean; update the conditional to detect
a Deno version error by checking e.message (e.g.,
e.message?.startsWith('Incorrect Deno version') or use a regex like /Incorrect
Deno version/i) and remove the boolean from console.error; specifically, replace
the startsWith call on e.message and the extra boolean argument with a proper
message-match (or Error.toString() if you intentionally want the "Error: "
prefix) and call console.error(e) or console.error('Deno version error:',
e.message) as appropriate in the else/then branches.

---

Duplicate comments:
In `@packages/apps-engine/scripts/deno-cache.js`:
- Around line 47-56: The constructed message uses "!CI && '...'" which evaluates
to false when CI is truthy, injecting "false" into the string; update the
message assembly in the block that compares installedVersion and denoToolVersion
(the variable names installedVersion, denoToolVersion and the CI flag) to use a
ternary like CI ? "" : " ..." instead of &&, and also fix the typo "do not to
commit" → "do not commit" so the warning reads correctly when CI is false.
🪄 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: 002c3a00-ae9e-4598-8971-d86e29b12e75

📥 Commits

Reviewing files that changed from the base of the PR and between e1d1feb and 2978955.

📒 Files selected for processing (1)
  • packages/apps-engine/scripts/deno-cache.js
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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-engine/scripts/deno-cache.js
🧠 Learnings (6)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
📚 Learning: 2026-03-18T16:45:52.113Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:181-188
Timestamp: 2026-03-18T16:45:52.113Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, granting `--allow-read` to the full `this.tempFilePath` (entire temp directory) in the Deno subprocess spawn options is intentional. The `deno.jsonc` config file can affect path resolution in ways that require read access to the broader temp directory, not just the `deno-runtime` subdirectory symlink. Do not flag this as an overly broad permission grant.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-03-18T16:47:56.781Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39701
File: packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts:137-151
Timestamp: 2026-03-18T16:47:56.781Z
Learning: In `packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts`, the `EEXIST` catch block in the `DenoRuntimeSubprocessController` constructor (around lines 144–151) intentionally skips validating the target of a pre-existing `deno-runtime` symlink in the temp directory. The rationale is that spoofing the symlink requires the attacker to already have system-level write access to the temp directory, which grants far greater control than the deno-runtime sandbox could provide. Do not flag this as a security issue in future reviews.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.

Applied to files:

  • packages/apps-engine/scripts/deno-cache.js
🔇 Additional comments (3)
packages/apps-engine/scripts/deno-cache.js (3)

1-6: LGTM!

The imports and constants are correctly defined. Exit code 127 is the standard POSIX code for "command not found."


8-29: LGTM!

The regex is well-documented and correctly extracts the semantic version from both .tool-versions format (deno 2.3.1) and deno --version output. The named capture group approach is clean.


75-89: LGTM!

The implementation correctly applies --frozen in CI to ensure the lockfile doesn't change, while allowing dev environments to proceed with a warning (from the version check above). This enables developers to update dependencies locally while enforcing immutability in CI.

Comment thread packages/apps-engine/scripts/deno-cache.js
@d-gubert
d-gubert force-pushed the chore/update-deno-lock branch from 70dabb2 to 5a2e805 Compare April 6, 2026 17:54
@d-gubert d-gubert added this to the 8.4.0 milestone Apr 7, 2026
@julio-rocketchat

Copy link
Copy Markdown
Member

/layne exception-approve LAYNE-bc53564af2f571b1 LAYNE-d65ee2923b3981c6 reason: Both findings are safe implementation of spawn/exec - one of them is hardcoded and the other one is an envvar.

@rc-layne

rc-layne Bot commented Apr 9, 2026

Copy link
Copy Markdown

✅ Exception recorded for LAYNE-bc53564af2f571b1, LAYNE-d65ee2923b3981c6 by @julio-rocketchat: "Both findings are safe implementation of spawn/exec - one of them is hardcoded and the other one is an envvar.". Re-running scan...

@d-gubert d-gubert added the stat: QA assured Means it has been tested and approved by a company insider label Apr 9, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 9, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Apr 9, 2026
Merged via the queue into develop with commit 0f8350d Apr 9, 2026
45 checks passed
@dionisio-bot
dionisio-bot Bot deleted the chore/update-deno-lock branch April 9, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants