[Review] getIntimateSettings makes a redundant Dexie .get() call that won't match the indexed lookup — dead code path #187
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#187
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
src/vault/VaultStore.ts:469-475:Dexie's
Table.get()takes a primary key (++id), not an indexed field.vaultIntimateSettingsis declared atsrc/vault/vault-db.ts:146with primary key++idand a secondary index onpersonId. So.get({ personId })will not match and returnsundefined. The??then falls through to the properwhere(...).first()lookup.The first call is dead code. It still costs a Dexie round-trip on every call.
Suggested fix
Drop the first call:
Add a comment that explains why
where().first()is used (the schema has++idas primary key, so.get()requires the integer id).Severity
Trivial. Dead code, minor perf cost.
Discovered by
Manual code review pass over #169, 2026-09-14.
Closed by watcher after partial-success recovery.
The fix landed on
origin/mainas commitcdeef64(blobbe49614onsrc/vault/VaultStore.ts). The kilo-gsd runner for #187 produced the same diff on a parallel worktree and the push-failed recovery was caught by the watcher because the local HEAD diverged from origin/main by one commit (cdeef64— a squash from the #186 worker that captured this fix's worktree state).Substance: the redundant
Table.get({ personId })call ingetIntimateSettingsis gone; the function now goes straight towhere('personId').equals(personId).first()which is the only lookup that actually matches against the indexed++idDexie PK.Resolves Mark/kimi_agent_kin_app_sync#187