feat(tag-vocab): telemetryStats — hit/miss 누적 + summary 적중률 (#3 v0.2.3)

- DailyRow +2 cols (tag_vocab_hit, tag_vocab_miss)
- accumulators + branches
- table 컬럼 +2
- summary "- 태그 vocab: hit/miss = N/M (적중률 X%)" 또는 "(데이터 없음)"
- 단위 +2 cases

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-02 12:27:22 +09:00
parent b81fc82621
commit 973cb1d08d
2 changed files with 44 additions and 4 deletions

View File

@@ -164,3 +164,27 @@ describe('aggregateStats — ai_retry_manual', () => {
expect(r.md).toMatch(/AI 수동 재시도.*2회.*10건/);
});
});
describe('aggregateStats — tag_vocab hit/miss', () => {
it('aggregates tag_vocab hit/miss with success rate', () => {
const events: TelemetryEvent[] = [
e('2026-05-02T00:00:00Z', 'tag_vocab_hit', { tagId: 1, vocabSize: 10 }),
e('2026-05-02T00:00:01Z', 'tag_vocab_hit', { tagId: 2, vocabSize: 10 }),
e('2026-05-02T00:00:02Z', 'tag_vocab_hit', { tagId: 3, vocabSize: 10 }),
e('2026-05-02T00:00:03Z', 'tag_vocab_hit', { tagId: 4, vocabSize: 10 }),
e('2026-05-02T00:00:04Z', 'tag_vocab_hit', { tagId: 5, vocabSize: 10 }),
e('2026-05-02T00:00:05Z', 'tag_vocab_miss', { vocabSize: 10 }),
e('2026-05-02T00:00:06Z', 'tag_vocab_miss', { vocabSize: 10 }),
e('2026-05-02T00:00:07Z', 'tag_vocab_miss', { vocabSize: 10 })
];
const r = aggregateStats(events, new Date('2026-05-03T00:00:00Z'));
expect(r.md).toContain('태그 vocab: hit/miss = 5/3');
expect(r.md).toContain('적중률 62.5%');
});
it('태그 vocab summary shows 데이터 없음 when no events', () => {
const r = aggregateStats([], new Date('2026-05-03T00:00:00Z'));
expect(r.md).toContain('태그 vocab');
expect(r.md).toContain('데이터 없음');
});
});