Repository navigation
feat(#640): stats --label and --since filters for cohort measurement - #642
Merged
admarble merged 4 commits intoMay 14, 2026
Merged
Conversation
- Filter applied after parseLogFile, before calculateStats / calculateDetailedAnalytics - Forces log-mode (bypasses metrics-first path) when either filter set; metrics schema carries only issue numbers, so per-label filtering is impossible there - Zero-match emits 'No matching runs' in the active output format (JSON/CSV/human) - Invalid --since exits 1 with a clear error, matching the locks.ts pattern - 5 new tests: label match, label miss, --since cutoff, composed AND, invalid date - Documented in README + docs/reference/analytics.md
…-detailed+filter test, README cleanup - Strict YYYY-MM-DD regex before Date.parse for --since validation. Rejects 2026/01/01, 2026-1-1, Jan 1 2026, 2026-13-45 — all of which Date.parse would otherwise accept with engine-dependent UTC interpretation. Error message 'Expected YYYY-MM-DD' is now honest. - Positive AND-composed unit test: --label bug --since 2026-02-01 against the Jan/Mar fixture survives one run (mar). Complements the existing zero-match composition test. - New --detailed + filter test: --detailed --label nonexistent emits 'No matching runs' and does NOT show QA Verdicts / Weekly Trends / Success by Label sections, proving the human-path short-circuit runs before the --detailed block. - README: cohort-filtering example moved out of the code block into a standalone sentence with a deep link to docs/reference/analytics.md.
…s-add-label-and-since-filters-for-coh
admarble
deleted the
feature/640-feat-stats-add-label-and-since-filters-for-coh
branch
May 14, 2026 02:53
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.
Summary
Add
--label <name>and--since <YYYY-MM-DD>tosequant statsfor cohort measurement. Both filters apply to every output mode (table,--json,--csv,--detailed) and compose with AND. Obsoletes the manualjqworkflow from #462's closeout.filterLogs(logs, { label, since })helper runs afterparseLogFile, beforecalculateStats/calculateDetailedAnalytics. A run is kept iff some issue inlog.issues[]carries the label (mirrors the existing label-segment scan atstats.ts:744-761) andlog.startTime >= <since>T00:00:00Z.MetricRun.issues: number[]schema has no per-issue labels, so per-label filtering against metrics is impossible — documented inline.emitNoMatchingRuns(parallel shapes: JSON{error,runs:[]}, header-only CSV, headerBox + warning for human).--sinceexits code 1 with aconsole.errormatching thelocks.tspattern.AC Coverage
--labelfilters table /--json/--csv/--detailed--since YYYY-MM-DDfilters bystartTime(UTC midnight cutoff)--labeland--sincecompose (AND)--sincecutoff, composed AND, invalid datebin/cli.tsregisters both flags; README +docs/reference/analytics.mddocumentedFiles Changed
src/commands/stats.ts—filterLogs+emitNoMatchingRunshelpers; gate wired into 4 output branchesbin/cli.ts— register.option("--label")+.option("--since")src/commands/stats.test.ts— 5 new tests (18/18 total pass)README.md+docs/reference/analytics.md— docsCHANGELOG.md—[Unreleased] / AddedTest plan
npx vitest run src/commands/stats.test.ts→ 18/18 passnpm run build→ cleannpm run lint→ clean--helpshows both flagsCloses #640