[Review] BehaviorPatternInsight.category union and PersonDetail SENSITIVE_CATEGORIES set can drift — no shared constant #183

Closed
opened 2026-09-14 14:07:30 +00:00 by Mark · 1 comment
Owner

Finding

Two parallel lists must stay in sync:

  1. InsightCategory union in src/lib/types.ts:902-912:

    export type InsightCategory =
      | "initiate" | "conflict" | "follow-through" | "vulnerability"
      | "present" | "mood" | "excitement" | "precursor" | "cycle";
    
  2. PersonDetail.tsx SENSITIVE_CATEGORIES set (around line 3042):

    const SENSITIVE_CATEGORIES = new Set([
      "mood", "conflict", "cycle", "precursor", "vulnerability",
    ]);
    

The vault-gate filter at PersonDetail.tsx removes insights whose category is in this set when vaultLocked === true. If a future contributor adds "intimacy" to the union, they must remember to also add it to PersonDetail's set — and there's nothing in the type system or build that enforces this.

intimate-state-engine.ts is @ts-nocheck'd, so the producers (lines 265, 277, 287, 367, 463, 491, etc.) silently accept any category string. Once #176 removes the pragma, the producer-side typing should help, but the consumer side (PersonDetail) is still free to drift.

Suggested fix

Export a single SENSITIVE_CATEGORIES: readonly InsightCategory[] from src/lib/types.ts and import it in PersonDetail.tsx. Then add a comment on InsightCategory instructing future contributors to update the constant when adding a new sensitive category.

Severity

Medium. Drift hazard, not a current bug. Becomes a bug the moment someone adds a new category.

Discovered by

Manual code review pass over #168/#169, 2026-09-14.

## Finding Two parallel lists must stay in sync: 1. `InsightCategory` union in `src/lib/types.ts:902-912`: ```ts export type InsightCategory = | "initiate" | "conflict" | "follow-through" | "vulnerability" | "present" | "mood" | "excitement" | "precursor" | "cycle"; ``` 2. PersonDetail.tsx SENSITIVE_CATEGORIES set (around line 3042): ```ts const SENSITIVE_CATEGORIES = new Set([ "mood", "conflict", "cycle", "precursor", "vulnerability", ]); ``` The vault-gate filter at PersonDetail.tsx removes insights whose `category` is in this set when `vaultLocked === true`. If a future contributor adds `"intimacy"` to the union, they must remember to also add it to PersonDetail's set — and there's nothing in the type system or build that enforces this. `intimate-state-engine.ts` is `@ts-nocheck`'d, so the producers (lines 265, 277, 287, 367, 463, 491, etc.) silently accept any category string. Once #176 removes the pragma, the producer-side typing should help, but the consumer side (PersonDetail) is still free to drift. ## Suggested fix Export a single `SENSITIVE_CATEGORIES: readonly InsightCategory[]` from `src/lib/types.ts` and import it in PersonDetail.tsx. Then add a comment on `InsightCategory` instructing future contributors to update the constant when adding a new sensitive category. ## Severity Medium. Drift hazard, not a current bug. Becomes a bug the moment someone adds a new category. ## Discovered by Manual code review pass over #168/#169, 2026-09-14.
Mark 2026-09-14 14:30:59 +00:00
Author
Owner

Closing as already-fixed.

Commit 4d07260 (fix(#183): share SENSITIVE_CATEGORIES constant between types and PersonDetail) landed on main at 2026-09-14 (today, before this triage session reviewed the file).

The chat-agent code review read against a stale HEAD and reported this issue as open. The fix was already in place when the review started — the agent failed to re-check HEAD between reads.

No work to do.

Closing as already-fixed. Commit `4d07260` (`fix(#183): share SENSITIVE_CATEGORIES constant between types and PersonDetail`) landed on `main` at 2026-09-14 (today, before this triage session reviewed the file). The chat-agent code review read against a stale HEAD and reported this issue as open. The fix was already in place when the review started — the agent failed to re-check HEAD between reads. No work to do.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#183
No description provided.