What happened
Following the framework-mode guidance ("plugin source imports agent-bundle/meta instead of maintaining a hand-written src/lib/version.ts"), cargo-hauler moved its daemon version constant to:
import { version } from 'agent-bundle/meta';
in src/daemon/main.ts. Outside a compiled surface, node_modules/agent-bundle/dist/meta.js initializes every binding through throwUnavailableEntrypoint(), so importing the module throws at evaluation:
agent-bundle/meta is available only inside a surface Agent Bundle compiles; a plugin module reached it outside the compiler.
Consequences:
- Every plain
rstest unit test that imports the daemon (directly or transitively: tests/harness.ts, lifecycle, ensure-daemon, broker, query, …) fails at import.
- The framework's own
agentBundleRstest() route-unit preset does not alias it either. renderRoute('tool:hauler/hauler_status') and invokeCli(['daemon','status']) both fail with the same error as soon as the route reaches the daemon module (error load file dist/.rstest-temp/src_daemon_main_ts-effect_Schedule.mjs failed).
Workaround in use
A package.json-backed stand-in plus an alias in both rstest configs:
// tests/fixtures/agent-bundle-meta.ts
import type { AgentBundleMeta } from 'agent-bundle/meta';
import pkg from '../../package.json' with { type: 'json' };
export const version: AgentBundleMeta['version'] = pkg.version;
// ...
// rstest.config.ts and rstest.route-unit.config.ts
resolve: { alias: { 'agent-bundle/meta': fileURLToPath(new URL('./tests/fixtures/agent-bundle-meta.ts', import.meta.url)) } }
Ask
Either of:
- A non-throwing development fallback for
agent-bundle/meta that reads the nearest package.json when no compiled surface replaced the module (the value is knowable; only the compile-time inlining is not), or
agentBundleRstest() (and agent-bundle/test) aliasing agent-bundle/meta to such a fallback automatically, with the docs blurb updated to say how unit tests are expected to load a module that imports it.
Pin: agent-bundle@105c65d8f (pkg.pr.new), @rstest/core@0.11.11.
What happened
Following the framework-mode guidance ("plugin source imports
agent-bundle/metainstead of maintaining a hand-writtensrc/lib/version.ts"),cargo-haulermoved its daemon version constant to:in
src/daemon/main.ts. Outside a compiled surface,node_modules/agent-bundle/dist/meta.jsinitializes every binding throughthrowUnavailableEntrypoint(), so importing the module throws at evaluation:Consequences:
rstestunit test that imports the daemon (directly or transitively:tests/harness.ts, lifecycle, ensure-daemon, broker, query, …) fails at import.agentBundleRstest()route-unit preset does not alias it either.renderRoute('tool:hauler/hauler_status')andinvokeCli(['daemon','status'])both fail with the same error as soon as the route reaches the daemon module (error load file dist/.rstest-temp/src_daemon_main_ts-effect_Schedule.mjs failed).Workaround in use
A package.json-backed stand-in plus an alias in both rstest configs:
Ask
Either of:
agent-bundle/metathat reads the nearestpackage.jsonwhen no compiled surface replaced the module (the value is knowable; only the compile-time inlining is not), oragentBundleRstest()(andagent-bundle/test) aliasingagent-bundle/metato such a fallback automatically, with the docs blurb updated to say how unit tests are expected to load a module that imports it.Pin:
agent-bundle@105c65d8f(pkg.pr.new),@rstest/core@0.11.11.