Repository navigation
feat(cli): add health metrics to fossel doctor - #53
Merged
Merged
Conversation
Extend the doctor report with per-repo health metrics: live vs superseded counts, a stale ratio (never-accessed memories older than 90 days), and coverage of the embedding / entity / file-ref side tables. Logic lives in a new src/lib/stats.ts (gatherHealthMetrics) so it is unit testable; the doctor just renders the result. Every optional metric is computed defensively and returns null if its column/table is absent, so the report degrades gracefully on older databases. Stale and coverage lines are only shown when there are live memories to report on. Covered by tests for the live/superseded split, stale detection (and that accessing a memory clears it), side-table coverage, and the fail-soft null path when a table is dropped.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33.
Problem
fossel doctorreported repo keys, duplicate clusters, stale-alias mentions, and detected MCP config - but nothing about the actual health of the stored memories, even though access-tracking and validity columns now exist.Fix
Extend the doctor report with per-repo health metrics:
access_count = 0) and older than 90 days, shown as a fraction + percentage of liveThe logic lives in a new
src/lib/stats.ts(gatherHealthMetrics) so it is unit-testable; the doctor command just renders it (thin-logic convention per AGENTS.md).Fails soft: every optional metric is computed in a
try/catchand returnsnullif its column or side table is absent (older db, or a feature never enabled), rather than throwing - matching the existing report-gathering style. Stale and coverage lines are only shown when there are live memories to report on.Example added lines:
Tests
tests/stats.test.ts: live/superseded split (and that other repos do not leak), stale detection (and that accessing a memory clears it), side-table coverage, and the fail-softnullpath when a table is dropped.Verification
npm run typecheckclean; full suite 256/256 pass;npm run buildsucceeds; verified thedoctorcommand renders the new lines end-to-end.