Skip to content

Commit 84675e5

Browse files
mpstatonclaude
andcommitted
fix(org-relations): directional kinds read from the focused org's seat — funded_by appears
Operator catch: NextLadder's card showed its investors as "funder_of", reading as if NextLadder were the funder. Directional kinds are authored from the edge's in side (ballmer-group funder_of nextladder — storage is correct and untouched); the read now inverts known directional pairs (funder_of ↔ funded_by, funds → funded_by) when the focused org sits on the out side, so every card speaks from its own seat: NextLadder shows "ballmer-group (funded_by …me)", Ballmer shows "nextladder (funder_of)". Read-time projection, exactly like rel itself. Files changed: - services/record-surrealdb-resolver/src/org-relations.ts Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RW28dw3kQAKXr2ZNefCukE
1 parent ce51eb7 commit 84675e5

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

services/record-surrealdb-resolver/src/org-relations.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ export type OrgRelationsResult = {
170170

171171
type RelRow = Record<string, unknown>;
172172

173+
// Directional kinds are authored from the edge's `in` side ("ballmer-group
174+
// funder_of nextladder"). Reading from the `out` side inverts the label so
175+
// each card tells the truth from its own perspective (operator catch
176+
// 2026-07-28: NextLadder's card said "ballmer-group (funder_of)" when it
177+
// meant funded_by). Storage is untouched — this is read-time projection,
178+
// like rel itself.
179+
const KIND_INVERSE: Record<string, string> = {
180+
funder_of: 'funded_by',
181+
funded_by: 'funder_of',
182+
funds: 'funded_by',
183+
};
184+
173185
function shapeRelated(
174186
r: RelRow,
175187
prefix: 'in' | 'out',
@@ -181,11 +193,17 @@ function shapeRelated(
181193
(r[`${prefix}_complete_name`] as string) ??
182194
(r[`${prefix}_conventional_name`] as string) ??
183195
String(slug);
196+
// prefix names the side being DISPLAYED (the other org). When we display
197+
// the `out` side, the focused org is `in` — the authored direction reads
198+
// correctly. When we display the `in` side, the focused org is `out` —
199+
// invert directional kinds.
200+
const rawKind = (r.kind as string) ?? null;
201+
const kind = prefix === 'in' && rawKind ? (KIND_INVERSE[rawKind] ?? rawKind) : rawKind;
184202
return {
185203
slug: String(slug),
186204
display_name: display,
187205
rel,
188-
kind: (r.kind as string) ?? null,
206+
kind,
189207
description: (r.description as string) ?? null,
190208
};
191209
}

0 commit comments

Comments
 (0)