fix(types): remove duplicate source field in RetentionScore (closes #277)#326
Conversation
) cl0ckt0wer reported in #277 that RetentionScore declared source twice (src/types.ts:835 and :842), both as ?"episodic" | "semantic". TS silently accepts duplicate property declarations when types are identical; runtime treats the second as the canonical declaration, which means the documented JSDoc on the FIRST one (referring to #124, pre-0.8.10 rows, scope probing semantics) was effectively dead code to anyone reading the type definition. Verified across src/ that no code path WRITES to source twice: grep returned zero callers setting source on RetentionScore, so removing the duplicate is a no-op at runtime. The kept copy retains the #124-referencing JSDoc so callers still see the back-compat note. Test impact: none (type-only). Full suite 877/877 unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe ChangesRetentionScore Type Extension
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ardening Three landed PRs since v0.9.11: - #327 (#295) — BM25 tokenizer now accepts non-ASCII (Greek, accented Latin, Hebrew, Arabic, Cyrillic), VectorIndex.add now actually called at runtime via vectorIndexAddGuarded helper with dim guard + input clip, migrateVectorIndex for dim migrations. - #326 (#277) — RetentionScore type no longer declares source twice; JSDoc back-compat note no longer shadowed. - #335 (#323) — viewer drops Google Fonts <link> (CSP-blocked), loadDashboard now surfaces load errors inline instead of sticking on "Loading dashboard…". Bumping 0.9.11 -> 0.9.12 across the 9 standard files: - package.json - packages/mcp/package.json - plugin/.claude-plugin/plugin.json - plugin/.codex-plugin/plugin.json - src/version.ts - src/types.ts (ExportData.version literal) - src/functions/export-import.ts (supportedVersions) - test/export-import.test.ts (round-trip expectation) - CHANGELOG.md (new 0.9.12 entry) 886 / 886 tests pass. Build clean.
…ardening (#337) Three landed PRs since v0.9.11: - #327 (#295) — BM25 tokenizer now accepts non-ASCII (Greek, accented Latin, Hebrew, Arabic, Cyrillic), VectorIndex.add now actually called at runtime via vectorIndexAddGuarded helper with dim guard + input clip, migrateVectorIndex for dim migrations. - #326 (#277) — RetentionScore type no longer declares source twice; JSDoc back-compat note no longer shadowed. - #335 (#323) — viewer drops Google Fonts <link> (CSP-blocked), loadDashboard now surfaces load errors inline instead of sticking on "Loading dashboard…". Bumping 0.9.11 -> 0.9.12 across the 9 standard files: - package.json - packages/mcp/package.json - plugin/.claude-plugin/plugin.json - plugin/.codex-plugin/plugin.json - src/version.ts - src/types.ts (ExportData.version literal) - src/functions/export-import.ts (supportedVersions) - test/export-import.test.ts (round-trip expectation) - CHANGELOG.md (new 0.9.12 entry) 886 / 886 tests pass. Build clean.
Verified bug
src/types.ts:835and:842both declaredsource?: "episodic" | "semantic"onRetentionScore. TypeScript silently accepts duplicate property declarations when types are identical — but the documented JSDoc on the first declaration (referencing #124 / pre-0.8.10 row back-compat) was effectively shadowed.Verified safe to remove
grep -rn "\.source\s*=\|source:" src/ | grep -i retentionreturned zero writers settingsourceonRetentionScore. No path could plausibly write to both shadowed declarations. Single source of truth restored, JSDoc back-compat note preserved.Test plan
npm test— 877 / 877.npm run build— tsdown clean.Closes #277. Thanks @cl0ckt0wer for the precise file:line trace.
Summary by CodeRabbit