refactor(usage): address round-2 review on PR #871
- remove accidentally-committed .claude/scheduled_tasks.lock (Claude Code runtime artifact swept in by `git add -A`) and gitignore it; the rest of .claude/ stays tracked. - store: cache UsageEventStore.shared() as a process-wide instance so the hot search path doesn't allocate a fresh wrapper per metered query (the wrapper is stateless beyond its storage handle). - hooks: pass enabled=True directly (the outer guard already confirmed the flag) instead of re-reading settings.usage_metering_enabled. - migration: document the no-TTL retention design (control-plane rollup owns the lifecycle; the data plane only appends). - tests: assert the best-effort error path logs at WARNING (observability contract). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
702f66e6b1
commit
2bbf4ed967
@@ -839,9 +839,10 @@ async def _index_document(
|
||||
"user_id": doc_task.user_id,
|
||||
"total_chars": total_chars,
|
||||
},
|
||||
# Pass the already-resolved flag so the store doesn't
|
||||
# rebuild Settings here (ADR-024).
|
||||
enabled=settings.usage_metering_enabled,
|
||||
# The outer guard already confirmed the flag, so pass
|
||||
# enabled=True directly — the store then skips a second
|
||||
# uncached Settings build here (ADR-024).
|
||||
enabled=True,
|
||||
)
|
||||
except Exception:
|
||||
# Reached only when shared()/store construction itself
|
||||
|
||||
Reference in New Issue
Block a user