Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(reference): retain unknown kind for unsupported source entries

morlutoada133c256a3
diff --git a/src/application/ReferenceSourceImportEntries.test.ts b/src/application/ReferenceSourceImportEntries.test.ts
index 387e2b70c..e0fbf2434 100644
--- a/src/application/ReferenceSourceImportEntries.test.ts
+++ b/src/application/ReferenceSourceImportEntries.test.ts
@@ -6,6 +6,64 @@ import { parseReferenceSourceEntries } from "./ReferenceSourceImportEntries.js";
import { historicalSourceLanguages } from "../domain/referenceSourceGraph.js";
import type { ReferenceSourceRead } from "../reference/ReferenceSourceReaderTypes.js";
+it("projects an unsupported non-regular entry as unknown kind instead of file", () => {
+ const read: ReferenceSourceRead = {
+ root: "/selected/source",
+ entries: [
+ {
+ status: "failed",
+ kind: "other",
+ path: "src/pipe",
+ code: "unsupported",
+ message: "Entry is not a regular file",
+ size: 0,
+ },
+ ],
+ bytesRead: 0,
+ limitations: [],
+ };
+ const parsed = parseReferenceSourceEntries(read, new Set());
+ expect(parsed.entries).toContainEqual({
+ path: "src/pipe",
+ kind: "unknown",
+ classifications: ["unknown"],
+ limitations: [
+ "Entry is not a regular file Exclude this entry or replace it with a regular file.",
+ ],
+ });
+ expect(parsed.entries.some((entry) => entry.kind === "file")).toBe(false);
+});
+
+it("keeps a failed regular file as file kind", () => {
+ const read: ReferenceSourceRead = {
+ root: "/selected/source",
+ entries: [
+ {
+ status: "failed",
+ kind: "file",
+ path: "src/broken.ts",
+ code: "io",
+ message: "Entry could not be read",
+ },
+ ],
+ bytesRead: 0,
+ limitations: [],
+ };
+ const parsed = parseReferenceSourceEntries(read, new Set());
+ expect(parsed.entries).toContainEqual({
+ path: "src/broken.ts",
+ kind: "file",
+ sha256: null,
+ size: null,
+ language: null,
+ classifications: ["source"],
+ content_state: "unreadable",
+ limitations: [
+ "Entry could not be read This file could not be read. Check its permissions, then try again.",
+ ],
+ });
+});
+
it("retains Kotlin source identity and language across the inventory projection", () => {
const files = [
[
diff --git a/src/application/ReferenceSourceImportEntries.ts b/src/application/ReferenceSourceImportEntries.ts
index 29dbef356..d2602df04 100644
--- a/src/application/ReferenceSourceImportEntries.ts
+++ b/src/application/ReferenceSourceImportEntries.ts
@@ -75,7 +75,7 @@ const failedEntry = (
classifications,
limitations: [limitation],
};
- if (entry.kind === "unknown")
+ if (entry.kind === "unknown" || entry.kind === "other")
return {
path: entry.path,
kind: "unknown",