mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
e07b81649e
* fix(hopper): report unavailable procedure body coverage * refactor!: simplify runtime tools and remove replay engines Keep direct inspection, capture, and comparison tools. Bind handlers to named contracts and let agents compose experiments with commands and local fixture servers. BREAKING CHANGE: Remove controlled replay, Node characterization, finite replay-machine, managed runtime planning, and redundant string-tracing tools. Retire process replay, shims, reactive scenarios, custom checkpoints, and active browser replay and origin-scope inputs.
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import type {
|
|
FileState,
|
|
FilesystemCheckpoint,
|
|
} from "../domain/processCapture.js";
|
|
|
|
/** Classify path-stable filesystem effects between two bounded states. */
|
|
export const classifyFilesystemEffects = (
|
|
before: readonly FileState[],
|
|
after: readonly FileState[],
|
|
): FilesystemCheckpoint["effects"] => {
|
|
const beforeByPath = new Map(before.map((file) => [file.path, file]));
|
|
const afterByPath = new Map(after.map((file) => [file.path, file]));
|
|
return [...new Set([...beforeByPath.keys(), ...afterByPath.keys()])]
|
|
.sort()
|
|
.map((path) => {
|
|
const beforeFile = beforeByPath.get(path) ?? null;
|
|
const afterFile = afterByPath.get(path) ?? null;
|
|
if (beforeFile === null) {
|
|
if (afterFile === null)
|
|
throw new TypeError(`Filesystem effect ${path} has no file state`);
|
|
return {
|
|
path,
|
|
status: "created",
|
|
before: null,
|
|
after: afterFile,
|
|
} as const;
|
|
}
|
|
if (afterFile === null)
|
|
return {
|
|
path,
|
|
status: "deleted",
|
|
before: beforeFile,
|
|
after: null,
|
|
} as const;
|
|
return {
|
|
path,
|
|
status:
|
|
JSON.stringify(beforeFile) === JSON.stringify(afterFile)
|
|
? "unchanged"
|
|
: "modified",
|
|
before: beforeFile,
|
|
after: afterFile,
|
|
} as const;
|
|
});
|
|
};
|