Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(owners): render owner rows and profiles from the previous release's payloads (#4303)
Raghav Chamadiyaef2d360812ff
diff --git a/packages/api-client/src/types/ownership.ts b/packages/api-client/src/types/ownership.tsindex 498761322..f2e39025c 100644--- a/packages/api-client/src/types/ownership.ts+++ b/packages/api-client/src/types/ownership.ts@@ -8,7 +8,7 @@ export interface OwnerListEntry {key: string;name: string;email: string | null;- kind: IdentityKind;+ kind?: IdentityKind;files_owned: number;hotspots_owned: number;silo_modules: number;@@ -47,8 +47,8 @@ export interface OwnerProfileResponse {key: string;name: string;email: string | null;- kind: IdentityKind;- aliases: OwnerAliases;+ kind?: IdentityKind;+ aliases?: OwnerAliases;files_owned: number;hotspots_owned: number;silo_modules: number;diff --git a/packages/types/src/owners.ts b/packages/types/src/owners.tsindex cd31803ae..bf7bbfa58 100644--- a/packages/types/src/owners.ts+++ b/packages/types/src/owners.ts@@ -11,7 +11,8 @@ export interface OwnerListEntry {key: string;name: string;email: string | null;- kind: IdentityKind;+ /** Absent on payloads from before identities were classified: unknown, not "human". */+ kind?: IdentityKind;files_owned: number;hotspots_owned: number;silo_modules: number;@@ -63,8 +64,10 @@ export interface OwnerProfile {key: string;name: string;email: string | null;- kind: IdentityKind;- aliases: OwnerAliases;+ /** Absent on payloads from before identities were classified: unknown, not "human". */+ kind?: IdentityKind;+ /** Absent on payloads from before aliases were folded in. */+ aliases?: OwnerAliases;files_owned: number;hotspots_owned: number;silo_modules: number;diff --git a/packages/ui/__tests__/owners/owner-labels.test.tsx b/packages/ui/__tests__/owners/owner-labels.test.tsxindex 09668a91e..fbe2251e8 100644--- a/packages/ui/__tests__/owners/owner-labels.test.tsx+++ b/packages/ui/__tests__/owners/owner-labels.test.tsx@@ -1,7 +1,8 @@import { describe, expect, it } from "vitest";-import { render, screen } from "@testing-library/react";+import { fireEvent, render, screen } from "@testing-library/react";import type { OwnerListEntry, OwnerProfile } from "@repowise-dev/types/owners";+import { OwnerDirectory } from "../../src/owners/owner-directory";import { OwnerProfileView } from "../../src/owners/owner-profile";import { OwnerTable } from "../../src/owners/owner-table";@@ -81,3 +82,42 @@ describe("ownership labels on the person page and the people table", () => {expect(screen.getByText("Files owned")).toBeTruthy();});});++describe("payloads and callers from the previous release", () => {+ it("renders a profile with no kind, no aliases and no dependsOn", () => {+ const { kind: _k, aliases: _a, ...older } = profile;+ render(<OwnerProfileView owner={older} base="/repos/1" />);+ expect(screen.queryByText("What depends on them")).toBeNull();+ expect(screen.queryByText("Also commits as")).toBeNull();+ expect(screen.getByText("Where they work")).toBeTruthy();+ });++ it("shows no kind badge when the row carries no kind", () => {+ const { kind: _k, ...older } = owner;+ render(<OwnerTable owners={[older]} sort="files_owned" />);+ expect(screen.getByText("renovate[bot]")).toBeTruthy();+ expect(screen.queryByText("Bot")).toBeNull();+ expect(screen.queryByText("Person")).toBeNull();+ });++ it("accepts the older directory props and still loads more", () => {+ let loads = 0;+ render(+ <OwnerDirectory+ owners={[owner]}+ distributionOwners={[owner]}+ base="/repos/1"+ isLoading={false}+ isValidating={false}+ total={40}+ hasMore+ filters={{ q: "", sort: "files_owned" }}+ onFiltersChange={() => {}}+ onLoadMore={() => (loads += 1)}+ onSelect={() => {}}+ />,+ );+ fireEvent.click(screen.getByText("Show all 40 people"));+ expect(loads).toBe(1);+ });+});diff --git a/packages/ui/src/owners/owner-directory.tsx b/packages/ui/src/owners/owner-directory.tsxindex 1ea63c101..83b6b55d6 100644--- a/packages/ui/src/owners/owner-directory.tsx+++ b/packages/ui/src/owners/owner-directory.tsx@@ -17,7 +17,7 @@ export interface OwnerDirectoryFilters {q: string;sort: OwnerSortKey;/** List bots and coding agents beside people. Off by default. */- includeAutomation: boolean;+ includeAutomation?: boolean;}export interface OwnerDirectoryProps {@@ -29,7 +29,9 @@ export interface OwnerDirectoryProps {filters: OwnerDirectoryFilters;onFiltersChange: (next: OwnerDirectoryFilters) => void;/** Load every remaining row; offered while `hasMore`. */- onShowAll: () => void;+ onShowAll?: () => void;+ /** @deprecated Use `onShowAll`; used only when `onShowAll` is absent. */+ onLoadMore?: () => void;onSelect: (owner: OwnerListEntry) => void;/** Bot and agent identities in the index; the toggle shows only when there are some. */automationCount?: number;@@ -39,6 +41,12 @@ export interface OwnerDirectoryProps {/** Rendered in place of the table when the list could not load. */error?: React.ReactNode;labels?: Partial<OwnershipLabels> | undefined;+ /**+ * Accepted and ignored, for callers that still pass them: the distribution+ * bar and the section links moved to `OwnershipLede`.+ */+ distributionOwners?: OwnerListEntry[];+ base?: string;}/**@@ -55,6 +63,7 @@ export function OwnerDirectory({filters,onFiltersChange,onShowAll,+ onLoadMore,onSelect,automationCount = 0,hrefFor,@@ -63,7 +72,7 @@ export function OwnerDirectory({labels: overrides,}: OwnerDirectoryProps) {const labels = React.useMemo(() => ownershipLabels(overrides), [overrides]);- const all = filters.includeAutomation;+ const all = filters.includeAutomation ?? false;return (<OverviewSectiontitle={labels.everyone}@@ -88,7 +97,7 @@ export function OwnerDirectory({{automationCount > 0 && (<label className="flex items-center gap-2 text-xs text-[var(--color-text-secondary)]"><Switch- checked={filters.includeAutomation}+ checked={all}onCheckedChange={(includeAutomation) => onFiltersChange({ ...filters, includeAutomation })}/>{labels.showAutomation(automationCount)}@@ -133,7 +142,7 @@ export function OwnerDirectory({{hasMore && (<buttontype="button"- onClick={onShowAll}+ onClick={onShowAll ?? onLoadMore}disabled={isValidating}className="self-start text-xs text-[var(--color-accent-primary)] hover:underline disabled:text-[var(--color-text-tertiary)] disabled:no-underline">diff --git a/packages/ui/src/owners/owner-identity.tsx b/packages/ui/src/owners/owner-identity.tsxindex e2fc71b61..f34550e0d 100644--- a/packages/ui/src/owners/owner-identity.tsx+++ b/packages/ui/src/owners/owner-identity.tsx@@ -25,10 +25,8 @@ function activityLine(owner: OwnerProfile, labels: OwnershipLabels): string | nu/** Every folded-in name and address other than the ones the page already shows. */function otherIdentities(owner: OwnerProfile): string[] {- return [- ...owner.aliases.names.filter((n) => n !== owner.name),- ...owner.aliases.emails.filter((e) => e !== owner.email),- ];+ const { names = [], emails = [] } = owner.aliases ?? {};+ return [...names.filter((n) => n !== owner.name), ...emails.filter((e) => e !== owner.email)];}export function OwnerIdentity({ owner, labels }: { owner: OwnerProfile; labels: OwnershipLabels }) {diff --git a/packages/ui/src/owners/owner-profile.tsx b/packages/ui/src/owners/owner-profile.tsxindex ab0d5c58c..9e6814147 100644--- a/packages/ui/src/owners/owner-profile.tsx+++ b/packages/ui/src/owners/owner-profile.tsx@@ -35,8 +35,8 @@ export interface OwnerProfileViewProps {owner: OwnerProfile;/** `/repos/{id}` — the prefix for every drill-in on this page. */base: string;- /** "What depends on them": the host's single-person off-boarding view. */- dependsOn: React.ReactNode;+ /** "What depends on them": the host's single-person off-boarding view. Absent hides the section. */+ dependsOn?: React.ReactNode;credit?: OwnerCredit | undefined;hrefForFile?: ((filePath: string) => string) | undefined;hrefForModule?: ((modulePath: string) => string) | undefined;@@ -65,18 +65,20 @@ export function OwnerProfileView({<div className="flex flex-col gap-6 sm:gap-8"><OwnerIdentity owner={owner} labels={labels} />- <OverviewSection- flush- title={labels.dependsTitle}- description={labels.dependsDescription}- action={- <SectionLink href={`${base}/owners`} LinkComponent={LinkComponent}>- {labels.ownershipLink}- </SectionLink>- }- >- {dependsOn}- </OverviewSection>+ {dependsOn !== undefined && (+ <OverviewSection+ flush+ title={labels.dependsTitle}+ description={labels.dependsDescription}+ action={+ <SectionLink href={`${base}/owners`} LinkComponent={LinkComponent}>+ {labels.ownershipLink}+ </SectionLink>+ }+ >+ {dependsOn}+ </OverviewSection>+ )}<OwnerFootprintmodules={owner.modules}diff --git a/packages/ui/src/owners/owner-table.tsx b/packages/ui/src/owners/owner-table.tsxindex 95d3f724a..09391b2c4 100644--- a/packages/ui/src/owners/owner-table.tsx+++ b/packages/ui/src/owners/owner-table.tsx@@ -156,7 +156,7 @@ export function OwnerTable({{displayName}</span>)}- {o.kind !== "human" && (+ {o.kind && o.kind !== "human" && (<span className="mt-0.5 block font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">{kindLabel(o.kind, labels)}</span>