fix: backward-compat for ESM etherpad#95
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/logger for ESM compatibility
WalkthroughsDescription• Migrate log4js from direct node_modules path to ep_plugin_helpers/logger • Ensures ESM etherpad compatibility with stricter exports resolution • Maintains backward compatibility with current CJS etherpad release • Add ep_plugin_helpers dependency to package.json Diagramflowchart LR
A["Direct log4js require<br/>ep_etherpad-lite/node_modules/log4js"] -->|Migrate| B["ep_plugin_helpers/logger<br/>createLogger function"]
B -->|Compatible with| C["ESM etherpad<br/>stricter exports"]
B -->|Compatible with| D["CJS etherpad<br/>current release"]
File Changes1. index.js
|
Code Review by Qodo
1. No regression test for logger change
|
| const {createLogger} = require('ep_plugin_helpers/logger'); | ||
|
|
||
| const logger = log4js.getLogger('ep_headerauth'); | ||
| const logger = createLogger('ep_headerauth'); |
There was a problem hiding this comment.
1. No regression test for logger change 📘 Rule violation ☼ Reliability
This PR changes runtime behavior by switching logging from log4js to ep_plugin_helpers/logger, but it does not add or update any automated regression test to verify the compatibility fix. Without a test, the backward-compat behavior can silently break in future refactors or dependency updates.
Agent Prompt
## Issue description
The PR introduces a bug fix/compatibility change (logger import + logger creation) but does not include a regression test that would fail before the change and pass after it.
## Issue Context
`index.js` now uses `ep_plugin_helpers/logger` instead of requiring Etherpad's bundled `log4js`. Add a backend test that loads the plugin and exercises at least one exported hook to ensure the module loads and runs successfully with the new logger dependency.
## Fix Focus Areas
- index.js[18-20]
- static/tests/backend/specs/[add new spec file to cover plugin load + basic hook execution]
ⓘ 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. Stale pnpm lockfile 🐞 Bug ☼ Reliability
package.json adds ep_plugin_helpers but pnpm-lock.yaml is not updated, so `pnpm i --frozen-lockfile` will fail and block CI/release installs. This can prevent publishing and/or running workflows that enforce lockfile consistency.
Agent Prompt
## Issue description
A new dependency (`ep_plugin_helpers`) was added to `package.json`, but `pnpm-lock.yaml` was not regenerated. Workflows that run `pnpm i --frozen-lockfile` will fail because the lockfile no longer matches `package.json`.
## Issue Context
This repo uses pnpm and has a committed `pnpm-lock.yaml`. The release workflow explicitly enforces lockfile consistency.
## Fix
- Run `pnpm install` (or `pnpm i`) in the repo root to regenerate `pnpm-lock.yaml`.
- Commit the updated `pnpm-lock.yaml` alongside `package.json`.
## Fix Focus Areas
- package.json[35-40]
- pnpm-lock.yaml[1-40]
- .github/workflows/npmpublish.yml[61-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.