Files
reverse-engineering-anything/src/application/ClientConfigurationTransaction.ts
T
42e1a17d6e fix(setup): preserve concurrent client configuration edits (#4855)
* fix(setup): preserve concurrent client configuration edits

* fix(setup): normalize configuration transaction queue paths

* fix(setup): report concurrent snapshot read conflicts

* test(setup): isolate Pi workflows from installed Hopper

* test: align inherited fixtures with current analysis contracts

* test(ida): assert search recovery instead of diagnostic prose

* fix(setup): share configuration queue keys across directory aliases

Resolve parent-directory aliases for regular and missing configuration
paths so a directory symlink and its real directory serialize setup
instead of racing the same file.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-10-23 05:06:13 +08:00

28 lines
738 B
TypeScript

import { resolve } from "node:path";
const activeTransactions = new Map<string, Promise<void>>();
/**
* Serialize the full read/merge/publish operation for one resolved
* configuration path.
*/
export const withClientConfigurationTransaction = async <Value>(
path: string,
operation: () => Promise<Value>,
): Promise<Value> => {
const key = resolve(path);
const previous = activeTransactions.get(key);
let release!: () => void;
const current = new Promise<void>((complete) => {
release = complete;
});
activeTransactions.set(key, current);
await previous;
try {
return await operation();
} finally {
release();
if (activeTransactions.get(key) === current) activeTransactions.delete(key);
}
};