Files
rea/src/native/AppleDispatchMetadata.failure.test.ts
T
Kaoru0822andClaude Opus 5.5 b869fa762a test: align stale fixtures with recent native and launcher contracts (#6945)
* test(native): expect artifact_changed when a bound metadata target is lost

41e10b240 made a bound metadata target that fails the source boundary
(`path`) or disappears (`ENOENT`) report AnalysisArtifactChangedError, as
its comment and docs/testing.md state, but left the module test expecting
AnalysisInputError. The test now asserts the shipped contract, so main's
Test shard and Portable tests lanes pass again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(package): ship the CLI process environment owner in launcher fixtures

c2caae88f moved launcher environment preparation into
scripts/lib/cli-process-environment.mjs, made scripts/rea.mjs import it and
made verifyPackagePack require it in the packed listing, and updated the
dispatcher fixtures, but two other fixtures still omit it:

- packageTarListing's fake tar listing, so every case stops at "package
  omitted the CLI process environment owner" before its own assertion;
- deferredRuntime's copied compiled package, so the copied launcher fails
  to resolve its import instead of reporting the corrupted catalog.

Both fixtures now include the module, as the package ships it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(native): expect XML plist validation in typed-value provenance

9f5dd56e2 records a successful `plutil -lint` of an XML plist source in
provenance, as docs/native-investigation.md states, but the macOS typed-value
CLI test still expected only the `file` step for both formats. XML sources now
expect the lint step; binary sources are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 05:08:18 +00:00

31 lines
1.1 KiB
TypeScript

import { expect, it } from "vitest";
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
import { appleDispatchMetadataFailure } from "./AppleDispatchMetadata.js";
// The metadata target is already bound, so losing it is a change to that artifact rather than a new input error.
it.each(["integrity", "path"] as const)(
"reports a %s source-read refusal as a change to the bound target, not a provider failure",
(reason) => {
const cause = new ArtifactReaderFailure(reason, "source boundary refused");
expect(appleDispatchMetadataFailure(cause, "/selected")._tag).toBe(
"AnalysisArtifactChangedError",
);
},
);
it.each(["EACCES", "EPERM", "ENOENT"])(
"preserves the filesystem outcome %s for a bound metadata target",
(code) => {
const physical = Object.assign(new Error("selected read refused"), {
code,
});
const cause = new ArtifactReaderFailure("io", "could not read", {
cause: physical,
});
expect(appleDispatchMetadataFailure(cause, "/selected")._tag).toBe(
code === "ENOENT"
? "AnalysisArtifactChangedError"
: "AnalysisAccessDeniedError",
);
},
);