feat(viewer): erDiagram shows real column types when present; ArtifactView accepts a {content} sql wrapper

erDiagram reads data_type/type from the candidate (top-level or signals),
falling back to the generic 'col' token Mermaid needs — real types render as
soon as schema_linking.json carries them. ArtifactView gains a defensive
{content} fallback for sql-kind artifacts, verified against real session shapes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 14:13:02 +02:00
co-authored by Claude Opus 4.8
parent c3e8f14ad9
commit e4ada07dab
4 changed files with 33 additions and 1 deletions
@@ -97,3 +97,16 @@ test("(e) buildErDiagram emits entities, attributes and a relation", () => {
expect(def).toContain("col id");
expect(def).toContain("orders }o--o{ customers : join");
});
test("(f) buildErDiagram uses a column's real type when the data carries one", () => {
const def = buildErDiagram(
[
{ kind: "table", name: "orders", decision: "promoted" },
{ kind: "column", name: "orders.total", decision: "promoted", signals: { data_type: "numeric" } },
{ kind: "column", name: "orders.id", decision: "promoted" }, // no type -> generic "col"
],
[],
);
expect(def).toContain("numeric total");
expect(def).toContain("col id");
});