fix: backward-compat for ESM etherpad#90
Conversation
- Migrate log4js to ep_plugin_helpers/logger Backward-compatible with current CJS etherpad release; also compatible with the upcoming ESM etherpad branch which has stricter exports map resolution.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoMigrate to ep_plugin_helpers for ESM compatibility
WalkthroughsDescription• Migrate log4js from direct node_modules path to ep_plugin_helpers • Ensures ESM compatibility with upcoming Etherpad branch • Maintains backward compatibility with current CJS releases • Add ep_plugin_helpers dependency to package.json Diagramflowchart LR
A["Direct log4js require<br/>ep_etherpad-lite/node_modules/log4js"] -->|"Migrate to"| B["ep_plugin_helpers/logger<br/>createLogger API"]
B -->|"Supports"| C["ESM Etherpad<br/>Stricter exports"]
B -->|"Supports"| D["CJS Etherpad<br/>Current releases"]
File Changes1. index.js
|
Code Review by Qodo
1. No regression test for logger
|
| const {createLogger} = require('ep_plugin_helpers/logger'); | ||
| const padMessageHandler = require('ep_etherpad-lite/node/handler/PadMessageHandler'); | ||
|
|
||
| const logger = log4js.getLogger('ep_chat_log_join_leave'); | ||
| const logger = createLogger('ep_chat_log_join_leave'); |
There was a problem hiding this comment.
1. No regression test for logger 📘 Rule violation ☼ Reliability
This PR changes the logging implementation to fix ESM/CJS compatibility, but it does not add or update any automated regression test to validate the fix. This increases the risk of the compatibility issue reoccurring unnoticed in future changes.
Agent Prompt
## Issue description
A bug-fix change was made (logger import migration for ESM/CJS compatibility), but the PR does not include a regression test that would fail before the fix and pass after.
## Issue Context
The change migrates logging from `log4js` to `ep_plugin_helpers/logger`, intended to be backward-compatible while also working with the upcoming ESM Etherpad branch.
## Fix Focus Areas
- index.js[16-19]
- static/tests/frontend-new/specs/smoke.spec.ts[1-24]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| "dependencies": { | ||
| "ep_plugin_helpers": "^0.6.7" | ||
| } |
There was a problem hiding this comment.
2. Lockfile missing new dependency 🐞 Bug ☼ Reliability
package.json adds ep_plugin_helpers but pnpm-lock.yaml is not updated, so pnpm i --frozen-lockfile will fail. This breaks the automated release/version-bump workflow and blocks publishing.
Agent Prompt
## Issue description
`package.json` adds a new dependency (`ep_plugin_helpers`), but `pnpm-lock.yaml` was not updated. The repo’s release workflow runs `pnpm i --frozen-lockfile`, which fails when the lockfile does not match `package.json`.
## Issue Context
The release pipeline uses frozen lockfiles for reproducible installs, so dependency changes must be accompanied by a lockfile update.
## Fix
1. Run `pnpm install` (or `pnpm i`) in the repo root.
2. Commit the resulting `pnpm-lock.yaml` changes.
## Fix Focus Areas
- package.json[33-40]
- pnpm-lock.yaml[7-20]
- .github/workflows/npmpublish.yml[66-73]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This PR makes the plugin backward-compatible with the upcoming ESM etherpad branch (ether/etherpad#7605).
Change: Migrate log4js from
require("ep_etherpad-lite/node_modules/log4js")toep_plugin_helpers/loggerThis change is backward-compatible with the current CJS etherpad release.