mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 16:59:43 +02:00
fix(cases): keep deleted workspaces deleted, cap pastCap, scope stalls to network mounts
- applyWorkspaceHooks: an "unknown" probe that is not near a stalled path (refused by the stall cap, or an unexpected stat error) no longer reads as "go ahead". It checks existence with pathExistsForWrite first, so a deleted workspace is not recreated by the mkdir -p in ensureCodemanHooks. - pastCap gets a hard ceiling, PATH_PROBE_STALL_CEILING = UV_THREADPOOL_SIZE (default 4) minus one, so explicit requests against several dead paths can never take the last libuv worker. The bulk cap now defaults to one below the ceiling (2 with the default pool), leaving a slot for an explicit request. - A stall widens to its mount only for network and FUSE filesystem types read from /proc/self/mounts; on a local mount (a path typed under a local /home that reaches a NAS through a symlink) it narrows to the stalled path. - GET /api/cases/:name probes CLAUDE.md with pastCap, like the folder probe. - Comment in config/path-probe.ts describes the mount-scoped stall.
This commit is contained in:
@@ -79,8 +79,21 @@ describe('workspace helpers while other mounts are unreachable', () => {
|
||||
expect(readFileSync(settings, 'utf-8')).toContain('/api/hook-event');
|
||||
});
|
||||
|
||||
it('installs hooks in a healthy workspace while two unrelated paths are stalled', async () => {
|
||||
await stallUnrelatedMounts(2);
|
||||
it('keeps a deleted workspace deleted while the stall cap is engaged', async () => {
|
||||
// The cap refuses the probe ("unknown" without a stat), which must not read as
|
||||
// "go ahead": installing would mkdir -p the deleted repo back into existence.
|
||||
await stallUnrelatedMounts(MAX_STALLED_PATH_PROBES);
|
||||
const workspace = join(root, 'deleted-repo');
|
||||
expect(await probePath(workspace)).toBe('unknown');
|
||||
|
||||
await applyWorkspaceHooks(workspace, true);
|
||||
await applyWorkspaceHooks(workspace, false);
|
||||
|
||||
expect(existsSync(workspace)).toBe(false);
|
||||
});
|
||||
|
||||
it('installs hooks in a healthy workspace while fewer unrelated paths are stalled than the cap', async () => {
|
||||
await stallUnrelatedMounts(MAX_STALLED_PATH_PROBES - 1);
|
||||
const workspace = join(root, 'healthy-b');
|
||||
mkdirSync(workspace);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user