[Review] @ts-nocheck opt-out on src/lib/intimate-state-engine.ts and src/vault/VaultStore.ts — type-safety hole in privacy subsystem #176
Labels
No labels
blocked:depends-p1
blocked:gate-research
blocked:lint-failed
blocked:needs-decision
blocked:needs-human
blocked:verify-failed
bug
data-loss
documentation
enhancement
feature-request
in-progress
needs-decompose
needs-triage
pwa
quickfix
security
security/high
security/medium
test
test-coverage
triage-approved
vault
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/kimi_agent_kin_app_sync#176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
Two large files added in #168/#169 ship with
// @ts-nocheckat the top:src/lib/intimate-state-engine.ts:1-2(540 lines)src/vault/VaultStore.ts:1-2(591 lines)The intimate-state engine is the public contract for the new UI. VaultStore is the privacy boundary — the literal code that gates sensitive fields behind
assertUnlocked(). Both are exactly the places type checking matters most.What this enables
BehaviorPatternInsight.categoryis a closed union insrc/lib/types.ts:902-912. PersonDetail.tsx filters visible insights bySENSITIVE_CATEGORIES.has(i.category)where the set is["mood","conflict","cycle","precursor","vulnerability"]. If a new sensitive category is added to the union (e.g."intimacy"), the PersonDetail filter set must be hand-updated in lockstep. With @ts-nocheck'd producers, the new category is silently accepted; the two lists can drift.confidence: "high" | "medium" | "low"— narrowings likeriskScore >= 4 ? "high" : "medium"are arithmetic-only, not type-narrowed. A typo ("hihg") compiles.as VaultMoodEntry/as Interactioncasts in VaultStore suggest the actual problem is a real type-definition gap (e.g. wanting to assignundefinedto a field whose zod schema requires a string). Disabling types papers over a legitimate schema/runtime mismatch rather than fixing it.Suggested fix
tsc -b --noEmit, fix the underlying errors. Expect:mood: undefinedassignment inmigrateSensitiveFieldsToVault(VaultStore.ts:529) conflicts with the zodmood: z.string()requirement onInteraction. The right fix is to mark these fields as optional in the Interaction schema (mood?: string) so the migration can clear them.as Personcasts inaddPerson/moveFromMainneed either a typed factory or explicit field-by-field assignment.vitest runstill passes (1214 tests).Severity
Medium-high. Not a runtime crash today, but a maintainability and contract-drift hazard in the privacy subsystem. Every future contributor touching these files can introduce type errors that compile but break the contract with PersonDetail.
Discovered by
Manual code review pass over #168/#169, 2026-09-14.