fix(setup): preserve Cordis ownership across uncertain patch structure

Separate stable registration ownership from setup editability. Keep group-owned rows removable, retain expression-backed structures without edits, and reject malformed literal patches before setup writes. Preserve foreign rows and backups during uninstall.

Correct stale alias fixtures to use valid Harness patch rows and remove redundant alias coverage. Validation: 78 configuration boundary tests, 6 public setup/uninstall CLI tests, full static checks, and docs checks passed. Harness behavior was verified from pinned source; no real Harness runtime verification is claimed.
This commit is contained in:
morluto
2026-10-12 11:59:23 +08:00
parent b7f563e15f
commit 21eff3bae1
6 changed files with 310 additions and 75 deletions
+18 -6
View File
@@ -59,6 +59,13 @@ const configureClientDocument = async (
throwCleanupFailure(files.error);
return { status: "failed", reason: "readback" };
}
const existing = files.value.at(-1);
const editabilityError =
existing?.dialect === "dsh"
? dshDocument(existing.document).editabilityError
: undefined;
if (editabilityError !== undefined)
return { status: "failed", reason: "readback" };
const policy = await readClientPolicyBlock(
client,
undefined,
@@ -284,15 +291,20 @@ export const inspectClientConfiguration = async (
remediation: files.error.detail,
};
}
const existing = files.value.at(-1);
const editabilityError =
existing?.dialect === "dsh"
? dshDocument(existing.document).editabilityError
: undefined;
if (editabilityError !== undefined)
return {
status: "invalid",
remediation: editabilityError.message,
};
const policy = await readClientPolicyBlock(
client,
undefined,
clientConfigurationDesired(
client,
providerEnvironment,
command,
files.value.at(-1),
),
clientConfigurationDesired(client, providerEnvironment, command, existing),
);
if (!policy.ok) {
throwCleanupFailure(policy.error);