Skip to content

Commit b5b0ef2

Browse files
committed
refactor(stats): convert all Korean comments to English
1 parent 50f1d5c commit b5b0ef2

13 files changed

Lines changed: 405 additions & 404 deletions

File tree

packages/types/src/usage-stats.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import { z } from "zod"
22

33
// ── Enums ──────────────────────────────────────────────────────────────────
44

5-
/** LLM API 호출의 최종 상태 */
5+
/** Final status of an LLM API call */
66
export const UsageEventStatus = z.enum(["completed", "failed", "cancelled"])
77
export type UsageEventStatus = z.infer<typeof UsageEventStatus>
88

9-
/** 토큰 사용량 값의 출처 */
9+
/** Source of a token usage value */
1010
export const UsageValueSource = z.enum(["provider", "estimated", "backfilled"])
1111
export type UsageValueSource = z.infer<typeof UsageValueSource>
1212

13-
/** 토큰 중복 계산 여부 (예: cacheRead이 inputTokens에 포함되어 있는지) */
13+
/** Whether a token field is double-counted (e.g. cacheRead included in inputTokens) */
1414
export const InclusionRule = z.enum(["included", "excluded", "unknown"])
1515
export type InclusionRule = z.infer<typeof InclusionRule>
1616

1717
// ── SourcedNumber ──────────────────────────────────────────────────────────
1818

19-
/** 값과 그 출처를 함께 표현 */
19+
/** A numeric value paired with its source */
2020
export const SourcedNumber = z.object({
2121
value: z.number(),
2222
source: UsageValueSource,
@@ -26,11 +26,11 @@ export type SourcedNumber = z.infer<typeof SourcedNumber>
2626
// ── UsageEventV1 ────────────────────────────────────────────────────────────
2727

2828
/**
29-
* 단일 LLM API 호출의 사용량 이벤트.
30-
* schemaVersion 1 — 향후 스키마 변경 시 버전을 올립니다.
29+
* A usage event for a single LLM API call.
30+
* schemaVersion 1 — bump when the schema changes.
3131
*
32-
* 보안: prompt 본문, response 본문, API key, workspace path는
33-
* 이 스키마에 절대 포함하지 않습니다.
32+
* Security: prompt bodies, response bodies, API keys, and workspace paths
33+
* must never be included in this schema.
3434
*/
3535
export const UsageEventV1 = z.object({
3636
schemaVersion: z.literal(1),
@@ -65,7 +65,7 @@ export type UsageEventV1 = z.infer<typeof UsageEventV1>
6565

6666
// ── StatsQuery ──────────────────────────────────────────────────────────────
6767

68-
/** 통계 조회 쿼리 */
68+
/** Statistics query */
6969
export const StatsQuery = z.object({
7070
from: z.string().optional(), // ISO 8601
7171
to: z.string().optional(),
@@ -78,7 +78,7 @@ export type StatsQuery = z.infer<typeof StatsQuery>
7878

7979
// ── StatsBucket ──────────────────────────────────────────────────────────────
8080

81-
/** 그룹화된 통계 버킷 */
81+
/** Grouped statistics bucket */
8282
export const StatsBucket = z.object({
8383
key: z.record(z.string()),
8484
events: z.number(),
@@ -98,7 +98,7 @@ export type StatsBucket = z.infer<typeof StatsBucket>
9898

9999
// ── StatsSnapshot ────────────────────────────────────────────────────────────
100100

101-
/** 통계 조회 결과 스냅샷 */
101+
/** Statistics query result snapshot */
102102
export const StatsSnapshot = z.object({
103103
query: StatsQuery,
104104
generatedAt: z.string(),

src/core/task/Task.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
273273
private readonly globalStoragePath: string
274274

275275
/**
276-
* Usage 이벤트 기록기. API attempt의 terminal finalize에서만 호출된다.
277-
* store 초기화 실패 시 null이며, 이 경우 기록을 조용히 건너뛴다.
278-
* (아키텍처 보고서 섹션 5.5-5.8, rollback: writer를 optional service로 주입)
276+
* Usage event recorder. Called only at terminal finalize of API attempts.
277+
* Null if store initialization failed; in that case recording is silently skipped.
278+
* (Architecture report section 5.5-5.8, rollback: writer injected as optional service)
279279
*/
280280
private readonly usageRecorder: UsageRecorder | null = null
281281

src/core/task/__tests__/Task.usage-stats.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// npx vitest core/task/__tests__/Task.usage-stats.spec.ts
22
//
3-
// Commit 3 테스트: API attempt 최종 usage 계측 검증.
4-
// - chunk별 기록이 없고 terminal finalize에서만 기록
5-
// - completed/failed/cancelled partial usage 구분
6-
// - idempotency key가 동일 terminal path 중복 호출 차단
7-
// - store 오류가 기존 task 결과에 영향을 주지 않음
3+
// Commit 3 test: verify final usage recording for each API attempt.
4+
// - No per-chunk recording; only terminal finalize records events
5+
// - Distinguish completed/failed/cancelled partial usage
6+
// - Idempotency key blocks duplicate calls on the same terminal path
7+
// - Store errors do not affect existing task results
88

99
import * as os from "os"
1010
import * as path from "path"

0 commit comments

Comments
 (0)