Files
rea/src/domain/mobileApplicationGraphProjection.test.ts
T
morluto a425b3e528 fix(mobile): classify authenticated file occurrences as components
Select file and slice identity once before Android, Apple and Harmony
classification. Keep directory/link facts in source inventory and Apple
anatomy rather than deriving code roles, runtime hints or bridges from them.
Preserve occurrence order, multiplicity and existing unavailable facts.

Adapt @flyl1u's proposal and public CLI/stdio MCP controls from PR #3830,
extending the controls and structural fix to Apple and slice/link semantics.

Validation: 80 focused checks, build, check:fast and docs:check pass.
Four package controls fail before the fix. 72 tiny completed source cost
tasks preserve all regular-file control replies and projection IDs byte
for byte. No heavy profiling, target or real deep-provider execution;
full agent/public-task costs and published npm package unverified.

Fixes #3349
2026-10-17 19:58:18 +08:00

53 lines
1.4 KiB
TypeScript

import { expect, it } from "vitest";
import {
projectedFileComponents,
type ProjectedInventoryEntry,
} from "./mobileApplicationGraphProjection.js";
it("selects authenticated file and slice facts without reordering or deduplicating occurrences", () => {
const file: ProjectedInventoryEntry = {
path: "member",
kind: "file",
unavailable: undefined,
component: {
path: "member",
artifact_id: `art_${"a".repeat(64)}`,
sha256: "b".repeat(64),
format: "file",
},
};
const slice: ProjectedInventoryEntry = {
...file,
kind: "slice",
component: { ...file.component, path: "member/arm64", format: "mach-o" },
path: "member/arm64",
};
const unread: ProjectedInventoryEntry = {
path: "unread",
kind: "file",
component: undefined,
unavailable: {
path: "unread",
artifact_id: null,
sha256: null,
format: "file",
encrypted: false,
limitations: ["Content was not read."],
},
};
const entries = Object.freeze([
{ ...file, kind: "directory" as const },
file,
{ ...file, kind: "symlink" as const },
slice,
unread,
file,
]);
const result = projectedFileComponents(entries);
expect(result).toEqual([file.component, slice.component, file.component]);
expect(result[0]).toBe(file.component);
expect(result[1]).toBe(slice.component);
expect(entries[4]).toBe(unread);
});