fix(web): optional fs stat outside workspace returns exists:false

Graceful probe: an optional stat of a config/backup path outside the active
workspace now reports exists:false instead of 400, so boot-time probes don't
surface console errors for a check that was never mandatory.
This commit is contained in:
2026-08-16 16:29:25 +00:00
parent 3800c84948
commit 3b3799f79e
2 changed files with 74 additions and 0 deletions
+8
View File
@@ -752,6 +752,14 @@ export const registerFsRoutes = (app, dependencies) => {
openchamberUserConfigRoot,
});
if (!resolved.ok) {
// An `optional` stat is a graceful probe — the caller only wants to
// know whether a path resolves to a readable file, and treats both
// "missing" and "outside the active workspace" as absent. Without this,
// boot-time probes of config/backup paths outside the workspace 400 and
// surface as console errors for a check that was never mandatory.
if (optional && resolved.error === 'Path is outside of active workspace') {
return res.json({ path: filePath, exists: false });
}
if (req.query?.allowOutsideWorkspace === 'true') {
console.warn(`Rejected outside-workspace stat: ${resolved.error}`);
}