fix(workflows): retain staged output ownership and cancellation semantics
Give atomic Evidence and snapshot writes an explicit resource owner, preserve primary failures and completed publication receipts, and retry retained staging cleanup at the owning lifecycle. Verify inode identity before publishing or deleting; unknown path disappearance remains a cleanup failure. Keep snapshot admission reusable when a session closes and reopens. Consolidate JavaScript source-scope classification so cancellation cannot fabricate failures for unselected files. Classify configuration failures as invalid input. Remove stale assertions and reuse shared test cleanup ownership. Validation: 266 focused tests before final ownership tightening, 108 affected tests afterward, static and documentation checks, actual invalid-configuration CLI behavior, and isolated test temporary-directory hygiene. Refs #1968
This commit is contained in:
@@ -25,6 +25,38 @@ import { ProviderSelectionError } from "./providerSelectionError.js";
|
||||
import { analysisErrorProjectionSchema } from "../contracts/errorSchemas.js";
|
||||
import { nativeCallPartialObservationSchema } from "./native/nativeCallPartialObservation.js";
|
||||
|
||||
it("projects a published file receipt alongside retained cleanup failure", () => {
|
||||
const projected = projectAnalysisError(
|
||||
new EvidenceFileError("write", "io", {
|
||||
path: "/tmp/evidence.json",
|
||||
published: { path: "/tmp/evidence.json", bytes: 42 },
|
||||
cleanup: {
|
||||
reason: "staging directory is still owned",
|
||||
resources: ["/tmp/.rea-write-abc"],
|
||||
},
|
||||
cause: new Error("cleanup incomplete"),
|
||||
}),
|
||||
);
|
||||
expect(projected).toMatchObject({
|
||||
code: "cleanup_incomplete",
|
||||
message:
|
||||
"The output file was published, but staging cleanup remains incomplete.",
|
||||
remediation: {
|
||||
action:
|
||||
"Use the published file at details.published_path and resolve the reported staging cleanup failure.",
|
||||
},
|
||||
details: {
|
||||
operation: "write",
|
||||
path: "/tmp/evidence.json",
|
||||
published: true,
|
||||
published_path: "/tmp/evidence.json",
|
||||
bytes: 42,
|
||||
resources: ["/tmp/.rea-write-abc"],
|
||||
},
|
||||
});
|
||||
expect(analysisErrorProjectionSchema.safeParse(projected).success).toBe(true);
|
||||
});
|
||||
|
||||
const nativeCallPartialObservation = nativeCallPartialObservationSchema.parse({
|
||||
kind: "native-call-observation",
|
||||
target: {
|
||||
|
||||
Reference in New Issue
Block a user