fix(FN-2148): use hash cache-busting and fix store teardown
- Switch PluginLoader bypass-cache imports from a query string to a hash fragment for reload-safe module differentiation - Update inline documentation to reflect hash-based cache busting semantics in Node ESM imports - Close AgentStore in the affected agent-store test afterEach hook to ensure cleanup alongside TaskStore teardown
This commit is contained in:
@@ -1508,6 +1508,7 @@ describe("AgentStore", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
store.close();
|
||||||
taskStore.close();
|
taskStore.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -269,9 +269,9 @@ export class PluginLoader extends EventEmitter<{
|
|||||||
// Dynamic import - use cache-busting for reload scenarios
|
// Dynamic import - use cache-busting for reload scenarios
|
||||||
let mod: unknown;
|
let mod: unknown;
|
||||||
if (bypassCache) {
|
if (bypassCache) {
|
||||||
// Use cache-busting with timestamp for ESM modules
|
// Use a hash fragment for cache differentiation without affecting path resolution
|
||||||
// This ensures Node.js re-imports the module even if it has it cached
|
// Node treats each distinct URL as a fresh import while resolving the same file path
|
||||||
const bustedPath = `${path}?reload=${Date.now()}`;
|
const bustedPath = `${path}#${Date.now()}`;
|
||||||
mod = await import(bustedPath);
|
mod = await import(bustedPath);
|
||||||
} else {
|
} else {
|
||||||
mod = await import(path);
|
mod = await import(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user