Skip to content

fix: copy _memoryFiltering.js in setup-hooks (#547)#550

Open
mvanhorn wants to merge 1 commit into
EvoMap:mainfrom
mvanhorn:fix/547-copy-memory-filtering-helper
Open

fix: copy _memoryFiltering.js in setup-hooks (#547)#550
mvanhorn wants to merge 1 commit into
EvoMap:mainfrom
mvanhorn:fix/547-copy-memory-filtering-helper

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented May 27, 2026

Summary

Generated evolver-session-start.js requires ./_memoryFiltering at the top of the file, but copyHookScripts was never updated to copy the helper alongside it. A fresh setup-hooks --platform=codex produced a hook that crashed immediately with MODULE_NOT_FOUND. This adds _memoryFiltering.js to both the copy list and the cleanup list. Closes #547.

What changed

  • src/adapters/hookAdapter.js: add _memoryFiltering.js to copyHookScripts and removeHookScripts so the install/uninstall manifests cover every runtime dependency of the generated session hooks.
  • test/adapters.test.js: bump the copyHookScripts count assertion from 4 to 5, add a _memoryFiltering.js presence assertion mirroring the existing _runtimePaths.js regression test, and update the removeHookScripts fixture to include the new file.

How to test

# Run the modified suite
node --test test/adapters.test.js

# End-to-end: clean fresh install path
rm -rf /tmp/evolver-547 && mkdir /tmp/evolver-547
node -e "
const hookAdapter = require('./src/adapters/hookAdapter');
const path = require('path');
const copied = hookAdapter.copyHookScripts('/tmp/evolver-547/hooks', path.join(__dirname, 'src', 'adapters'));
console.log('copied:', copied.length); // 5
require('child_process').spawnSync('node', ['/tmp/evolver-547/hooks/evolver-session-start.js'], { input: '{}', stdio: 'inherit' });
"
# Expected: exit 0, no MODULE_NOT_FOUND

Risk

Low. The change is two string entries added to two const scripts = [...] arrays. Both lists are explicit allowlists, so callers depending on the prior length (4 entries) would need to fail closed; the only such caller in-repo is the copyHookScripts test, which is updated in this PR.

Self-check

  • No new runtime dependencies added.
  • Tests added or updated to cover the new behavior.
  • Not adding a new source file under src/.
  • Not adding or modifying a schema factory.
  • Not using Object.assign({}, DEFAULTS, ...).
  • Not adding a new module-level constant from process.env.

Related

Closes #547


Note

Low Risk
Two allowlist entries in install/uninstall helpers; behavior matches the existing _runtimePaths.js pattern with updated tests only.

Overview
Fixes fresh setup-hooks installs where evolver-session-start.js fails immediately with MODULE_NOT_FOUND because it require('./_memoryFiltering') but that helper was never copied into the platform hooks directory.

copyHookScripts and removeHookScripts now include _memoryFiltering.js in the same allowlist as _runtimePaths.js, so install/uninstall ship and clean every runtime dependency of the generated session hooks.

Tests expect 5 copied/removed scripts and add a presence check for _memoryFiltering.js, parallel to the existing _runtimePaths.js regression.

Reviewed by Cursor Bugbot for commit 092334a. Bugbot is set up for automated code reviews on this repo. Configure here.

…rt works (EvoMap#547)

evolver-session-start.js requires ./_memoryFiltering, but
copyHookScripts copied only _runtimePaths.js and the three entry
scripts. A fresh `setup-hooks --platform=codex` left the destination
without _memoryFiltering.js, so the generated hook crashed with
MODULE_NOT_FOUND on first run.

Add _memoryFiltering.js to both copyHookScripts and removeHookScripts
so a clean install/uninstall stays in sync with the runtime require
graph of the copied hooks. Extend the existing copyHookScripts /
removeHookScripts tests to cover the new file, and add a regression
test asserting _memoryFiltering.js lands in the destination directory
alongside the entry scripts.

Smoke-tested locally by running setup-hooks against a fresh tmpdir
and invoking the copied evolver-session-start.js with `{}` on stdin
— now exits 0 instead of MODULE_NOT_FOUND on `./_memoryFiltering`.
@autogame-17
Copy link
Copy Markdown
Collaborator

Thanks for the clean diagnosis and fix, @mvanhorn — root cause is exactly right, and the install/uninstall symmetry is the right pattern.

We have an internal patch already in flight that lands the same change plus a broader regression guard: it scans every require('./_*') in the adapter scripts and asserts both copyHookScripts and removeHookScripts cover them, so the next helper added but forgotten will fail loud instead of silently shipping broken. We'll ship the consolidated patch through our usual release pipeline shortly, and credit you in the release notes + contributors.

If you have an EvoMap account, could you drop the registered email here (or DM if you prefer)? We'd like to add your avatar to the public-repo contributors panel and send a small thank-you your way.

@autogame-17
Copy link
Copy Markdown
Collaborator

Update: shipped in v1.87.1 — npm @evomap/evolver@latest is now 1.87.1 with the fix on board. Released about 30 minutes ago.

The release notes credit your independent diagnosis on this PR alongside @rendigua's reproduction. If you have an EvoMap account, drop the registered email here when you have a moment and we'll get the contributor entry + thank-you sorted.

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.

setup-hooks --platform=codex does not copy _memoryFiltering.js, so session-start fails with MODULE_NOT_FOUND

2 participants