Skip to content

fix: backward-compat for ESM etherpad#90

Merged
SamTV12345 merged 1 commit into
mainfrom
fix/esm-compat
May 25, 2026
Merged

fix: backward-compat for ESM etherpad#90
SamTV12345 merged 1 commit into
mainfrom
fix/esm-compat

Conversation

@SamTV12345
Copy link
Copy Markdown
Member

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") to ep_plugin_helpers/logger

This change is backward-compatible with the current CJS etherpad release.

- 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-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Migrate to ep_plugin_helpers for ESM compatibility

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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"]

Loading

File Changes

1. index.js ✨ Enhancement +2/-2

Replace log4js with ep_plugin_helpers logger

• Replace require('ep_etherpad-lite/node_modules/log4js') with
 require('ep_plugin_helpers/logger')
• Update logger initialization from log4js.getLogger() to createLogger()
• Maintains same logger functionality with improved module resolution

index.js


2. package.json Dependencies +4/-1

Add ep_plugin_helpers dependency and bump version

• Bump version from 1.0.53 to 1.0.54
• Add ep_plugin_helpers ^0.6.7 as a dependency
• Ensures required logger helper is available at runtime

package.json


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented May 25, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1)

Grey Divider


Action required

1. No regression test for logger 📘 Rule violation ☼ Reliability
Description
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.
Code

index.js[R16-19]

Evidence
PR Compliance ID 1 requires a regression test to accompany bug-fix changes. The PR introduces the
compatibility fix by switching to createLogger() and adding ep_plugin_helpers as a dependency,
but no corresponding test change is included to lock in the behavior.

AGENTS.md: Every Bug Fix Must Include a Regression Test in the Same Commit
index.js[16-19]
package.json[37-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Lockfile missing new dependency 🐞 Bug ☼ Reliability
Description
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.
Code

package.json[R37-39]

Evidence
The PR adds a new dependency in package.json, but the lockfile’s importer section lists only
devDependencies, indicating it was not regenerated. The publish workflow runs pnpm with
--frozen-lockfile, which will error on this mismatch.

package.json[33-40]
pnpm-lock.yaml[7-20]
.github/workflows/npmpublish.yml[66-73]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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



Advisory comments

3. Helper docs now incorrect 🐞 Bug ⚙ Maintainability
Description
AGENTS.md explicitly states ep_plugin_helpers is not a dependency, but this PR adds it to
package.json. This documentation mismatch will mislead future contributors about available helpers.
Code

package.json[R37-39]

Evidence
AGENTS.md says ep_plugin_helpers is not a dependency, but package.json now declares it under
dependencies, so the documentation is factually wrong after this change.

AGENTS.md[27-30]
package.json[37-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AGENTS.md` claims `ep_plugin_helpers` is not a dependency, but `package.json` now includes it. This doc drift can cause confusion during future maintenance.

## Issue Context
The PR’s intent is to adopt `ep_plugin_helpers/logger`, so the agent guide should reflect that helpers are now in use.

## Fix
Update the AGENTS.md "Helpers used" section to reflect the new dependency (and optionally mention the specific helper: `ep_plugin_helpers/logger`).

## Fix Focus Areas
- AGENTS.md[27-30]
- package.json[37-39]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread index.js
Comment on lines +16 to +19
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');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

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

Comment thread package.json
Comment on lines +37 to 39
"dependencies": {
"ep_plugin_helpers": "^0.6.7"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

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

@SamTV12345 SamTV12345 merged commit 39d3689 into main May 25, 2026
3 checks passed
@SamTV12345 SamTV12345 deleted the fix/esm-compat branch May 25, 2026 16:01
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.

1 participant