Skip to content

chore: disable lifecycle hooks - #4664

Merged
arpl merged 1 commit into
developfrom
chore/disable-lifecycle-hook
Sep 22, 2025
Merged

arpl merged 1 commit into
developfrom
chore/disable-lifecycle-hook

Conversation

@arpl

@arpl arpl commented Sep 22, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Introduced .npmrc with ignore-scripts=true to prevent lifecycle hooks. The rest of the changes are to accommodate isolated-vm manual build as well as Dockerfile adjustments to manually call npm run prepare which builds isolated-vm from source.

@coderabbitai

coderabbitai Bot commented Sep 22, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores

    • Standardized dependency installs to run prepare explicitly, improving reliability across CI and Docker.
    • Removed legacy skip mechanism; adopted ignore-scripts for safer, consistent installs.
    • Optimized production images (omit dev deps, no audit) and added Swagger setup in development images.
    • Minor cleanup in release notifications.
  • Tests

    • CI pipelines (unit tests, coverage, verification, commit lint, allure, release) now run prepare after clean installs, enhancing reproducibility and stability.

Summary by CodeRabbit

  • Chores
    • Standardized CI to run npm ci followed by npm run prepare across workflows.
    • Simplified Docker builds by removing the skip script, running prepare explicitly, and aligning dev/prod paths.
    • Added Swagger setup during development image build.
    • Enforced ignore-scripts in npm configuration for more consistent installs.
    • Minor cleanup in release workflow action reference.
    • Improved reliability of unit test, verification, and reporting pipelines with unified preparation steps.

Walkthrough

Replaces the skipPrepareScript approach with an explicit prepare phase: adds ignore-scripts=true to .npmrc, updates CI workflows to run npm ci && npm run prepare, and modifies Dockerfiles to use npm ci --ignore-scripts followed by explicit npm run prepare (plus cleanup and swagger setup). Removes scripts/skipPrepareScript.js.

Changes

Cohort / File(s) Summary of changes
CI workflows
/.github/workflows/verify.yml, /.github/workflows/allure-test-reporter.yml, /.github/workflows/commitlint.yml, /.github/workflows/dt-test-and-report-code-coverage.yml, /.github/workflows/publish-new-release.yml, /.github/workflows/ut-tests.yml, /.github/workflows/verify-server-start.yml
Change "Install Dependencies" steps to run npm ci && npm run prepare. Minor whitespace tweak in one Slack action reference.
NPM config
/.npmrc
Add ignore-scripts=true to disable lifecycle scripts during npm installs.
Docker build files
/Dockerfile, /Dockerfile-ut-func
Remove copying/usage of scripts/skipPrepareScript.js and SKIP_PREPARE_SCRIPT env; use npm ci --ignore-scripts flows, then explicit npm run prepare (dev) and consolidate prod install with --omit=dev + npm run clean:node; add npm run setup:swagger in dev build.
Removed helper script
/scripts/skipPrepareScript.js
Delete script that conditionally exited based on SKIP_PREPARE_SCRIPT.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer/CI
  participant CI as CI workflow
  participant NPM as npm
  note over CI,NPM: .npmrc sets ignore-scripts=true

  Dev->>CI: trigger job
  CI->>NPM: npm ci
  Note right of NPM: lifecycle scripts skipped
  CI->>NPM: npm run prepare
  NPM-->>CI: prepare completes
  CI-->>Dev: continue pipeline
Loading
sequenceDiagram
  autonumber
  participant Builder as Docker build
  participant DevStage as dev stage
  participant ProdStage as prodDepsBuilder
  participant NPM as npm
  note over Builder: Dockerfiles use --ignore-scripts then explicit prepare

  Builder->>DevStage: RUN npm ci --ignore-scripts --no-audit --cache .npm
  DevStage->>NPM: npm run prepare
  DevStage->>NPM: npm run setup:swagger
  DevStage-->>Builder: dev prepared

  Builder->>ProdStage: RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm
  ProdStage->>NPM: npm run clean:node
  ProdStage-->>Builder: prod deps ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sivashanmukh
  • koladilip
  • utsabc
  • vinayteki95

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description states the core change (adding .npmrc ignore-scripts=true and manually building isolated-vm via npm run prepare) but does not follow the repository template: it omits the "Related Linear task" (Resolves INT-XXX), the structured "Please explain the objectives" section with dependent changes, and required details such as behavioral/capability impacts, new dependencies, testing steps, and the developer checklist. Because those template fields are mandatory or important for reviewer context and tracking, the description is incomplete for this repo's standards. Consequently the description check fails. Update the PR description to match the repository template: include "Resolves INT-XXX" with the related Linear task, expand the "Please explain the objectives" section to list any dependent changes and whether behavior/capabilities change, explicitly state new dependencies or build steps (e.g., isolated-vm manual build), add testing steps and docs/CI implications, and confirm the developer checklist items. Once those sections are completed the description will meet the template requirements and be easier to review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "chore: disable lifecycle hooks" is concise and directly describes the primary intent of this changeset — disabling npm lifecycle hooks via .npmrc and adjusting build/workflow/Docker steps to manually run npm run prepare for isolated-vm; it is specific and clear for someone scanning history. The phrasing is short, uses the conventional "chore:" type, and does not include noisy file lists or emojis. This meets the repository's title guidelines.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/disable-lifecycle-hook

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c69c803 and 2d58a41.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !**/*.json
📒 Files selected for processing (11)
  • .github/workflows/allure-test-reporter.yml (1 hunks)
  • .github/workflows/commitlint.yml (1 hunks)
  • .github/workflows/dt-test-and-report-code-coverage.yml (1 hunks)
  • .github/workflows/publish-new-release.yml (2 hunks)
  • .github/workflows/ut-tests.yml (1 hunks)
  • .github/workflows/verify-server-start.yml (1 hunks)
  • .github/workflows/verify.yml (1 hunks)
  • .npmrc (1 hunks)
  • Dockerfile (2 hunks)
  • Dockerfile-ut-func (2 hunks)
  • scripts/skipPrepareScript.js (0 hunks)
💤 Files with no reviewable changes (1)
  • scripts/skipPrepareScript.js
🚧 Files skipped from review as they are similar to previous changes (8)
  • .github/workflows/dt-test-and-report-code-coverage.yml
  • .github/workflows/commitlint.yml
  • .npmrc
  • .github/workflows/allure-test-reporter.yml
  • Dockerfile-ut-func
  • .github/workflows/verify.yml
  • .github/workflows/ut-tests.yml
  • .github/workflows/verify-server-start.yml
⏰ 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). (9)
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: UT Tests
  • GitHub Check: Code Coverage
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (4)
.github/workflows/publish-new-release.yml (2)

167-170: Action pin looks good.

Pinned to a specific commit of slackapi/slack-github-action; good supply‑chain hygiene. No change requested.


45-50: Drop npm run prepare from the release workflow — use npm ci --ignore-scripts

Release job only creates/tags a GitHub Release; running the repo’s prepare script compiles native deps and introduces avoidable toolchain/network flakes (contrary to .npmrc ignore-scripts intent). File: .github/workflows/publish-new-release.yml (lines 45–50).

-          npm ci && npm run prepare
+          npm ci --ignore-scripts

Ran checks: scripts/create-github-release.js calls gh release and no dist/build references were found; package.json was not present in the sandbox so the prepare script could not be inspected. Confirm that prepare does not perform a build or install native modules (or share package.json/'prepare' contents) before merging.

Dockerfile (2)

27-29: Replace brittle npm run prepare with an explicit isolated‑vm rebuild

At this Dockerfile stage only package*.json may be present; npm run prepare can fail if it references repository source files. Build isolated‑vm directly to retain layer caching and avoid depending on copied sources.

File: Dockerfile — lines 27–29

-RUN npm ci --ignore-scripts --no-audit --cache .npm && \
-    npm run prepare
+RUN npm ci --ignore-scripts --no-audit --cache .npm && \
+    npm rebuild isolated-vm --build-from-source

Verification: I couldn't find package.json at the repo root when checking — confirm whether a prepare script exists and references repo files by running:

rg -n '"prepare"\s*:\s*".*"' **/package.json

50-51: Rebuild native modules in prod image — cannot verify (no package.json found)

  • Problem: Dockerfile runs npm ci --ignore-scripts and copies node_modules; native modules (e.g., isolated-vm) will not be built and can crash at runtime. Automated check found no package.json in the repo so I could not confirm whether isolated-vm or other native modules are present (Dockerfile: lines 50–51).
  • Suggested change (apply if isolated-vm or other native modules exist):
-RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \
-    npm run clean:node
+RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \
+    npm rebuild isolated-vm --build-from-source && \
+    npm run clean:node
  • Verify locally: locate package.json (find . -name package.json) and search those files for "isolated-vm" and other native deps (rg -n 'isolated-vm' $(find . -name package.json) || rg -n 'isolated-vm' .). If package.json is generated at build time, either rebuild native modules in the final image or install without --ignore-scripts in the builder stage.

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.

@arpl
arpl force-pushed the chore/disable-lifecycle-hook branch from 87595ea to 5ae580e Compare September 22, 2025 09:43
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Sep 22, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.78%. Comparing base (bde0785) to head (2d58a41).
⚠️ Report is 10 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4664   +/-   ##
========================================
  Coverage    91.78%   91.78%           
========================================
  Files          642      642           
  Lines        33974    33979    +5     
  Branches      8037     8047   +10     
========================================
+ Hits         31184    31189    +5     
  Misses        2560     2560           
  Partials       230      230           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@arpl
arpl force-pushed the chore/disable-lifecycle-hook branch from 5ae580e to c69c803 Compare September 22, 2025 09:51
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@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: 0

🧹 Nitpick comments (2)
.github/workflows/publish-new-release.yml (1)

45-49: Make npm install invocation consistent across workflows

  • Most workflows already use "npm ci && npm run prepare": .github/workflows/ut-tests.yml, dt-test-and-report-code-coverage.yml, allure-test-reporter.yml, verify.yml, verify-server-start.yml, publish-new-release.yml, commitlint.yml.
  • .github/workflows/draft-new-release.yml uses only "npm ci" — change it to "npm ci && npm run prepare" (or confirm the omission is intentional).
  • No other legacy patterns (e.g., skipPrepareScript or npm install ... scripts) were found.
Dockerfile-ut-func (1)

34-36: Consider adding comments to document the manual prepare step.

While the implementation is correct, consider adding inline comments to document why the manual npm run prepare step is necessary after --ignore-scripts. This would help future maintainers understand the build process, especially since this pattern deviates from standard npm install behavior.

 # Install dependencies without running lifecycle scripts, then manually run prepare
-RUN npm ci --ignore-scripts --no-audit --cache .npm && \
+RUN npm ci --ignore-scripts --no-audit --cache .npm && \
+    # Manually run prepare to build isolated-vm and other native dependencies
     npm run prepare

Apply similar documentation to the production stage as well.

Also applies to: 54-57

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87595ea and c69c803.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !**/*.json
📒 Files selected for processing (11)
  • .github/workflows/allure-test-reporter.yml (1 hunks)
  • .github/workflows/commitlint.yml (1 hunks)
  • .github/workflows/dt-test-and-report-code-coverage.yml (1 hunks)
  • .github/workflows/publish-new-release.yml (2 hunks)
  • .github/workflows/ut-tests.yml (1 hunks)
  • .github/workflows/verify-server-start.yml (1 hunks)
  • .github/workflows/verify.yml (1 hunks)
  • .npmrc (1 hunks)
  • Dockerfile (2 hunks)
  • Dockerfile-ut-func (2 hunks)
  • scripts/skipPrepareScript.js (0 hunks)
💤 Files with no reviewable changes (1)
  • scripts/skipPrepareScript.js
🚧 Files skipped from review as they are similar to previous changes (8)
  • .github/workflows/verify.yml
  • .github/workflows/dt-test-and-report-code-coverage.yml
  • .npmrc
  • Dockerfile
  • .github/workflows/ut-tests.yml
  • .github/workflows/verify-server-start.yml
  • .github/workflows/allure-test-reporter.yml
  • .github/workflows/commitlint.yml
⏰ 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). (6)
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Code Coverage
  • GitHub Check: test_and_publish
🔇 Additional comments (5)
.github/workflows/publish-new-release.yml (2)

49-49: LGTM! Consistent with the lifecycle hook management strategy.

The addition of npm run prepare after npm ci aligns with the PR's objective to disable automatic lifecycle hooks via .npmrc and manually execute the prepare script. This ensures that the isolated-vm package is properly built from source during the release process.


169-169: Minor formatting improvement applied.

The Slack action reference appears to have had extra whitespace removed while maintaining the same version tag (v2.1.1). This is a minor formatting improvement that enhances readability.

Dockerfile-ut-func (3)

34-36: LGTM! Clean consolidation of npm install and prepare steps.

The consolidation of npm installation and prepare steps into a single RUN command is well-executed. Using --ignore-scripts followed by explicit npm run prepare provides better control over the build process and aligns with the repository-wide changes to disable lifecycle hooks.


54-57: LGTM! Production dependencies handling is correct.

The production dependencies stage properly handles the new build approach by:

  • Installing dependencies with --ignore-scripts --omit=dev to skip development dependencies and lifecycle hooks
  • Explicitly running npm run prepare to build necessary native modules
  • Running npm run clean:node to remove unnecessary files

This approach provides better control and transparency in the build process.


34-36: Verify native modules are built (Dockerfile-ut-func lines 34–36, 54–57)

Verification aborted: package.json not found at repo root. Confirm that npm run prepare actually builds native modules (e.g., isolated-vm, node-gyp-based deps) and that built artifacts are present in the final image. Quick checks to run locally or provide outputs for:

  • Confirm prepare script: jq '.scripts.prepare // "MISSING"' path/to/package.json
  • List potential native deps: jq -r '(.dependencies + .optionalDependencies + .devDependencies) // {} | to_entries[] | select(.key | test("isolated-vm|node-gyp|nan|bindings|prebuild|prebuild-install")) | "(.key): (.value)"' path/to/package.json
  • Find native build files: rg -n '(binding.gyp|.gyp$|.cc$|.cpp$)' || fd -e gyp -e cc -e cpp
  • Ensure prepare runs in a stage with build tools (python/make/g++/node-gyp) or that prebuilt binaries are fetched and copied into the production stage.

Provide the package.json path or outputs from the commands above to complete verification.

Comment thread package.json Resolved
vinayteki95
vinayteki95 previously approved these changes Sep 22, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

@arpl
arpl requested a review from vinayteki95 September 22, 2025 10:51
@arpl
arpl enabled auto-merge September 22, 2025 10:51
@arpl
arpl merged commit ee98910 into develop Sep 22, 2025
@arpl
arpl deleted the chore/disable-lifecycle-hook branch September 22, 2025 10:55
@coderabbitai coderabbitai Bot mentioned this pull request Sep 23, 2025
10 tasks
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.

3 participants