Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

feat(context): take a compact summary's repository path when the backend sends it

KageBinaryd5924d74368d
diff --git a/ix-cli/src/cli/__tests__/context-evidence-locations.test.ts b/ix-cli/src/cli/__tests__/context-evidence-locations.test.ts
index bea5cdb2..e030bd2d 100644
--- a/ix-cli/src/cli/__tests__/context-evidence-locations.test.ts
+++ b/ix-cli/src/cli/__tests__/context-evidence-locations.test.ts
@@ -117,6 +117,29 @@ describe("ix context evidence says where things are", () => {
expect(b.truncation.entitiesTruncated).toBe(4);
});
+ it("takes a compact summary's repository path, and still its sourceUri from older backends", () => {
+ const b = buildBundle({
+ resolved: { id: FILE, name: "config.ts", kind: "file", resolutionMode: "exact" },
+ facts: facts({ memberRefs: [], members: [], topDependentRefs: [], topDependents: [] }),
+ context: {
+ claims: [], conflicts: [], decisions: [], intents: [], nodes: [], edges: [],
+ nodeSummaries: [
+ { id: "s-new", kind: "function", name: "fromNew", rev: 1, sourceUri: null, path: "src/new.ts" },
+ { id: "s-old", kind: "function", name: "fromOld", rev: 1, sourceUri: "src/old.ts" },
+ ],
+ edgeSummaries: [],
+ metadata: { query: "", seedEntities: [], hopsExpanded: 1, asOfRev: 1 },
+ } as never,
+ provenance: {},
+ budgets: { maxEntities: 50, maxRelationships: 100, maxEvidence: 25, maxChars: 12000 },
+ isStale: () => false,
+ });
+
+ const paths = Object.fromEntries(b.entities.map((e) => [e.name, e.path]));
+ expect(paths.fromNew).toBe("src/new.ts");
+ expect(paths.fromOld).toBe("src/old.ts");
+ });
+
it("reads provenance from the chain /v1/provenance actually returns", () => {
const b = bundle({
provenance: {
diff --git a/ix-cli/src/cli/commands/context.ts b/ix-cli/src/cli/commands/context.ts
index 1c06f884..43335b9b 100644
--- a/ix-cli/src/cli/commands/context.ts
+++ b/ix-cli/src/cli/commands/context.ts
@@ -1441,7 +1441,7 @@ export function buildBundle(input: BuildInput): ContextBundle {
id: node.id,
name: node.name,
kind: node.kind,
- path: node.sourceUri ?? undefined,
+ path: node.path ?? node.sourceUri ?? undefined,
}));
for (const node of orderedNodes(contextNodes)) {
if (seen.has(node.id)) continue;
diff --git a/ix-cli/src/client/types.ts b/ix-cli/src/client/types.ts
index c48afef6..46277405 100644
--- a/ix-cli/src/client/types.ts
+++ b/ix-cli/src/client/types.ts
@@ -107,7 +107,14 @@ export interface NodeSummary {
kind: string;
name: string;
rev: number;
+ /** A connector's citation id. Absent on repository nodes. */
sourceUri?: string | null;
+ /**
+ * The repository file a code, config, doc, test or schema node was parsed
+ * from. Sent by backends that have ix-infrastructure/Ix-memory#210; older
+ * ones leave repository summaries without any location.
+ */
+ path?: string | null;
}
export interface EdgeSummary {