fix(cli): exclude imported sessions from stats by default#316
Open
WqyJh wants to merge 1 commit into
Open
Conversation
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.
Issue for this PR
Closes XiaomiMiMo#494
Type of change
What does this PR do?
mimo statswas counting imported Claude Code sessions in all metrics. This change filters them out by default usingWHERE id NOT IN (SELECT session_id FROM claude_import)-- a subquery against the import tracking table rather than version-string matching, so any future importer is automatically excluded.Added
--allflag to include imported sessions when needed.Related to XiaomiMiMo#377 (stop auto-import on startup) -- that PR removes the auto-import trigger so new sessions aren't pulled in on every CLI invocation. This PR handles the stats side: even if users manually run
import-claude, stats stays clean by default. The two are complementary and independent.How did you verify your code works?
Built and ran from source against a DB with 204 imported + 13 native sessions:
mimo stats-> Sessions: 13 (native only), Days: 1mimo stats --all-> Sessions: 217 (all), Days: 32Unit tests:
bun test test/cli/stats-exclude-imported.test.ts-- 1 passbun test test/cli/import.test.ts-- 5 pass (existing tests unaffected)Checklist
Mirrored from XiaomiMiMo/MiMo-Code#492 — original author @llupRisinglll.