refactor(usage): close out round-5 nits on PR #871
Non-blocking follow-ups from the merge-ready review: - semantic.py: bound the doc_types copied into embeddings_queries metadata to _USAGE_METADATA_MAX_DOC_TYPES (16). doc_types is caller-supplied with no max_length on the tool signature; capping the stored copy keeps one JSONB row from ballooning (not a billing/injection risk — CP ignores metadata, binds are parameterized). - migration: note that `metric` is intentionally unconstrained Text and that adding a third metric requires keeping the CP-side catalog in sync, else the rollup silently ignores the new rows. 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
9c2f9fac46
commit
c89f724585
@@ -55,7 +55,11 @@ def upgrade() -> None:
|
||||
postgresql.TIMESTAMP(timezone=True) if is_pg else sa.TIMESTAMP(),
|
||||
nullable=False,
|
||||
),
|
||||
# Catalog metric: 'embeddings_queries' or 'pages_chunks'.
|
||||
# Catalog metric: 'embeddings_queries' or 'pages_chunks'. Deliberately
|
||||
# an unconstrained Text (no CHECK/enum) — the metric catalog lives in
|
||||
# control-plane config, not the app-DB schema. If a third metric is
|
||||
# ever added, the CP-side catalog must learn it too, or its rollup will
|
||||
# silently ignore the new rows; keep the two in sync.
|
||||
sa.Column("metric", sa.Text(), nullable=False),
|
||||
sa.Column("value", sa.BigInteger(), nullable=False),
|
||||
# Rawest unit per request (provider, model, tokens, doc_type, ...).
|
||||
|
||||
Reference in New Issue
Block a user