Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-catalog): enforce concise metric descriptions (#78873)

Thiago Salvatoredcff200814a6
diff --git a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
index 079c82435f34..c74ea0186840 100644
--- a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
@@ -80,7 +80,7 @@ import {
QueryBasedInsightModel,
} from '~/types'
-import { validateMetricName } from 'products/data_catalog/frontend/common'
+import { validateMetricDescription, validateMetricName } from 'products/data_catalog/frontend/common'
import {
dataCatalogMetricsCreate,
dataCatalogMetricsPartialUpdate,
@@ -2591,7 +2591,8 @@ export const sqlEditorLogic = kea<sqlEditorLogicType>([
),
errors: {
name: (name) => validateMetricName(name?.trim() || ''),
- description: (description) => (!description?.trim() ? 'Add a description' : undefined),
+ description: (description) =>
+ !description?.trim() ? 'Add a description' : validateMetricDescription(description.trim()),
},
onSubmit: async ({ name, description }) =>
actions.saveAsMetricSubmit(name.trim(), description.trim(), selectedRef.current),
diff --git a/products/data_catalog/backend/logic/metrics.py b/products/data_catalog/backend/logic/metrics.py
index 8d6e9ab11264..74690203f28c 100644
--- a/products/data_catalog/backend/logic/metrics.py
+++ b/products/data_catalog/backend/logic/metrics.py
@@ -34,7 +34,7 @@ from .analytics import (
)
from .drift import canonical_query_hash, compute_drift, effective_insight_query, fetch_insight
from .exceptions import MetricDrifted, SourceInsightUnavailable
-from .validation import validate_metric_definition
+from .validation import validate_description, validate_metric_definition
if TYPE_CHECKING:
from rest_framework.request import Request
@@ -211,6 +211,7 @@ def upsert_metric(
raise ValidationError(
{"name": "Name must start with a letter and contain only letters, numbers, and underscores."}
)
+ validate_description(description)
fields: dict[str, object] = {"description": description}
for key, value in (
@@ -266,6 +267,8 @@ def update_metric(
"""Partially update a metric. Name is write-once; editing an approved definition resets approval."""
if "name" in fields:
raise ValidationError({"name": "Metric name is write-once and cannot be changed."})
+ if "description" in fields:
+ validate_description(fields["description"])
# Route definition / insight-link through the same resolver as create, so a PATCH honors the
# definition-XOR-insight rule, snapshots (and validates) on relink, and drops the hash on unlink.
diff --git a/products/data_catalog/backend/logic/validation.py b/products/data_catalog/backend/logic/validation.py
index 2be934139df8..51bb52bf0768 100644
--- a/products/data_catalog/backend/logic/validation.py
+++ b/products/data_catalog/backend/logic/validation.py
@@ -39,6 +39,9 @@ _SUPPORTED_KINDS = {HOGQL_DEFINITION_KIND, *_NODE_MODELS, *_INSIGHT_MODELS}
# A markdown definition is a bounded blob; keep it small so it stays a definition, not a document.
MAX_MARKDOWN_DEFINITION_LENGTH = 20_000
+# A description is a few sentences of business meaning; a narrated query walkthrough blows past this.
+MAX_DESCRIPTION_LENGTH = 1_000
+
# HogQLQuery carries fields that would let a caller bypass team query controls (a raw ClickHouse
# passthrough, an arbitrary DB connection). A metric definition may only set these.
_HOGQL_ALLOWED_KEYS = {"kind", "query", "values"}
@@ -91,6 +94,17 @@ def _fail(error: str, hint: str) -> NoReturn:
raise ValidationError({"definition": f"{error} {hint}"})
+def validate_description(description: str) -> None:
+ """Reject a description too long to be a summary. Raises keyed by the ``description`` field."""
+ if len(description) > MAX_DESCRIPTION_LENGTH:
+ raise ValidationError(
+ {
+ "description": f"Description is too long. State what the metric means and what it serves in 1-3 "
+ f"sentences (under {MAX_DESCRIPTION_LENGTH} characters), and put query rationale in 'reasoning'."
+ }
+ )
+
+
def validate_metric_definition(definition: dict, team: Team, user: Optional[User] = None) -> tuple[dict, list[str]]:
"""Validate a metric definition and return ``(canonical_definition, referenced_table_names)``.
diff --git a/products/data_catalog/backend/migrations/0005_alter_metric_description.py b/products/data_catalog/backend/migrations/0005_alter_metric_description.py
new file mode 100644
index 000000000000..ef7caac76a30
--- /dev/null
+++ b/products/data_catalog/backend/migrations/0005_alter_metric_description.py
@@ -0,0 +1,19 @@
+# Generated by Django 5.2.14 on 2026-08-05 19:08
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("data_catalog", "0004_tablecertification_proposed_status"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="metric",
+ name="description",
+ field=models.TextField(
+ help_text="What the metric means and what it serves, in 1-3 short sentences. The load-bearing text. Query mechanics live in the definition; query rationale in reasoning."
+ ),
+ ),
+ ]
diff --git a/products/data_catalog/backend/migrations/max_migration.txt b/products/data_catalog/backend/migrations/max_migration.txt
index c6dcdaf65d3a..d26a5011866b 100644
--- a/products/data_catalog/backend/migrations/max_migration.txt
+++ b/products/data_catalog/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0004_tablecertification_proposed_status
+0005_alter_metric_description
diff --git a/products/data_catalog/backend/models/metric.py b/products/data_catalog/backend/models/metric.py
index a42142105d6b..4599fcb5800e 100644
--- a/products/data_catalog/backend/models/metric.py
+++ b/products/data_catalog/backend/models/metric.py
@@ -42,7 +42,10 @@ class Metric(
help_text="Identifier-safe run handle, unique per team and reserved forever. Write-once.",
)
display_name = models.CharField(max_length=255, blank=True, help_text="Human-friendly label. Mutable, unlike name.")
- description = models.TextField(help_text="What the metric means and how to interpret it. The load-bearing text.")
+ description = models.TextField(
+ help_text="What the metric means and what it serves, in 1-3 short sentences. The load-bearing text. "
+ "Query mechanics live in the definition; query rationale in reasoning."
+ )
unit = models.CharField(max_length=64, blank=True, help_text="Unit of the result, e.g. usd, percent, cents.")
owner = models.ForeignKey(
"posthog.User",
diff --git a/products/data_catalog/backend/presentation/serializers.py b/products/data_catalog/backend/presentation/serializers.py
index 3796460a379c..962cef61b2fc 100644
--- a/products/data_catalog/backend/presentation/serializers.py
+++ b/products/data_catalog/backend/presentation/serializers.py
@@ -15,6 +15,7 @@ from posthog.schema_enums import IntervalType
from ..facade import api
from ..facade.enums import CreatedSource
from ..facade.models import Metric, RelationshipProposal, TableCertification
+from ..logic.validation import MAX_DESCRIPTION_LENGTH
@extend_schema_field(OpenApiTypes.OBJECT)
@@ -158,7 +159,12 @@ class MetricSerializer(serializers.ModelSerializer):
"Set to null to unlink. Mutually exclusive with definition.",
},
"display_name": {"help_text": "Human-friendly label. Mutable, unlike name."},
- "description": {"help_text": "What the metric means and how to interpret it."},
+ "description": {
+ "help_text": "What the metric means and what it serves, in 1-3 short sentences: the business "
+ "meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the "
+ "query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
+ "max_length": MAX_DESCRIPTION_LENGTH,
+ },
"unit": {"help_text": "Unit of the result, e.g. usd, percent, cents."},
"ai_model": {"help_text": "Model that generated the metric, if AI-authored."},
"confidence": {
diff --git a/products/data_catalog/backend/tests/test_api.py b/products/data_catalog/backend/tests/test_api.py
index 0ed932810aa6..3b93eb67f231 100644
--- a/products/data_catalog/backend/tests/test_api.py
+++ b/products/data_catalog/backend/tests/test_api.py
@@ -54,6 +54,11 @@ class TestMetricAPI(APIBaseTest):
assert response.json()["status"] == MetricStatus.PROPOSED
assert response.json()["approved_at"] is None
+ def test_overlong_description_rejected(self) -> None:
+ response = self.client.post(self.url, {"name": "mrr", "description": "x" * 1_001}, format="json")
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["attr"] == "description"
+
def test_create_is_upsert_on_name(self) -> None:
self.client.post(self.url, {"name": "mrr", "description": "v1"}, format="json")
response = self.client.post(self.url, {"name": "mrr", "description": "v2"}, format="json")
diff --git a/products/data_catalog/backend/tests/test_logic.py b/products/data_catalog/backend/tests/test_logic.py
index b9d4bf958b72..6ffb9538fafd 100644
--- a/products/data_catalog/backend/tests/test_logic.py
+++ b/products/data_catalog/backend/tests/test_logic.py
@@ -17,7 +17,7 @@ from products.data_catalog.backend.logic.metrics import (
update_metric,
upsert_metric,
)
-from products.data_catalog.backend.logic.validation import validate_metric_definition
+from products.data_catalog.backend.logic.validation import MAX_DESCRIPTION_LENGTH, validate_metric_definition
from products.data_catalog.backend.models import Metric
from products.product_analytics.backend.models.insight import Insight
@@ -74,6 +74,12 @@ class TestMetricUpsert(BaseTest):
with self.assertRaises(ValidationError):
self._upsert(name)
+ def test_description_capped_at_max_length(self) -> None:
+ self._upsert("mrr", description="x" * MAX_DESCRIPTION_LENGTH)
+ with self.assertRaises(ValidationError) as ctx:
+ self._upsert("arr", description="x" * (MAX_DESCRIPTION_LENGTH + 1))
+ assert "description" in ctx.exception.detail
+
def test_concurrent_create_retries_to_single_row(self) -> None:
# Simulate the race: the pre-check misses, create hits the unique constraint (IntegrityError),
# and the retry finds and refines the row the other writer created. Guards the except branch.
@@ -102,6 +108,12 @@ class TestMetricUpdate(BaseTest):
with self.assertRaises(ValidationError):
update_metric(metric, team=self.team, user=self.user, name="arr")
+ def test_update_rejects_overlong_description(self) -> None:
+ metric = upsert_metric(team=self.team, user=self.user, name="mrr", description="v1")
+ with self.assertRaises(ValidationError) as ctx:
+ update_metric(metric, team=self.team, user=self.user, description="x" * (MAX_DESCRIPTION_LENGTH + 1))
+ assert "description" in ctx.exception.detail
+
def test_update_definition_reextracts_tables(self) -> None:
metric = upsert_metric(team=self.team, user=self.user, name="mrr", description="v1")
updated = update_metric(
diff --git a/products/data_catalog/evals/constants.py b/products/data_catalog/evals/constants.py
index f3bc18ad0ab8..9c35ae305bd8 100644
--- a/products/data_catalog/evals/constants.py
+++ b/products/data_catalog/evals/constants.py
@@ -10,6 +10,13 @@ from __future__ import annotations
# The catalog table every scorer greps agent SQL for.
METRICS_CATALOG_MARKER = "information_schema.metrics"
+METRIC_CREATE_TOOL = "data-catalog-metric-create"
+METRIC_UPDATE_TOOL = "data-catalog-metric-update"
+
+# Deliberately tighter than the server cap (validation.MAX_DESCRIPTION_LENGTH = 1000): the eval
+# catches verbosity the hard cap would still admit.
+EVAL_DESCRIPTION_CHAR_LIMIT = 500
+
TOP_CUSTOMERS_METRIC_NAME = "top_customers_mrr_by_business_model"
TOP_CUSTOMERS_METRIC_DISPLAY_NAME = "Top B2C customers by revenue"
TOP_CUSTOMERS_METRIC_DESCRIPTION = (
diff --git a/products/data_catalog/evals/eval_metric_authoring.py b/products/data_catalog/evals/eval_metric_authoring.py
new file mode 100644
index 000000000000..83d27f4e434e
--- /dev/null
+++ b/products/data_catalog/evals/eval_metric_authoring.py
@@ -0,0 +1,64 @@
+"""Metric-authoring evals for the sandboxed agent.
+
+Each case asks the agent to save a metric to the governed catalog and grades the write itself:
+the ``description`` must stay a 1-3 sentence statement of business meaning (checked both by a
+deterministic length bar and a judge that rejects query narration). The markdown-definition case
+is the strongest verbosity temptation: a multi-step calculation invites restating the steps in
+the description instead of leaving them in the definition.
+
+No seeder: creation runs against the plain per-case Hedgebox team.
+
+To run a single case::
+
+ flox activate -- bash -c "hogli evals eval_metric_authoring --eval metric_create_concise_description"
+"""
+
+from __future__ import annotations
+
+from products.data_catalog.evals.constants import METRIC_CREATE_TOOL
+from products.data_catalog.evals.scorers import MetricDescriptionConcise, MetricDescriptionQuality
+from products.posthog_ai.eval_harness.base import SandboxedPublicEval
+from products.posthog_ai.eval_harness.config import SandboxedEvalCase
+from products.posthog_ai.eval_harness.harness.context import EvalContext
+from products.posthog_ai.eval_harness.scorers import RequiredToolCall
+
+
+async def eval_metric_authoring(ctx: EvalContext) -> None:
+ """When the agent writes a metric, is the description concise business meaning, not query narration?"""
+ cases: list[SandboxedEvalCase] = [
+ SandboxedEvalCase(
+ name="metric_create_concise_description",
+ prompt=(
+ "We've agreed on an official MRR definition: the sum of paid_bill amount_usd over the "
+ "trailing 30 days, excluding bills on the 'personal/free' plan. Save it to the data "
+ "catalog as a governed metric so everyone uses the same definition."
+ ),
+ expected={
+ "metric_description_concise": {},
+ "metric_description_quality": {},
+ },
+ ),
+ SandboxedEvalCase(
+ name="metric_create_markdown_definition",
+ prompt=(
+ "Catalog an activation rate metric: the share of newly signed-up users who uploaded a "
+ "file and upgraded their plan within 30 days of signup. The calculation takes several "
+ "steps, so capture it however fits best."
+ ),
+ expected={
+ "metric_description_concise": {},
+ "metric_description_quality": {},
+ },
+ ),
+ ]
+
+ await SandboxedPublicEval(
+ experiment_name="sandboxed-metric-authoring-cli",
+ cases=cases,
+ scorers=[
+ RequiredToolCall([METRIC_CREATE_TOOL], name="metric_create_called"),
+ MetricDescriptionConcise(),
+ MetricDescriptionQuality(),
+ ],
+ ctx=ctx,
+ )
diff --git a/products/data_catalog/evals/scorers.py b/products/data_catalog/evals/scorers.py
index 17e19443a718..3f099330efb9 100644
--- a/products/data_catalog/evals/scorers.py
+++ b/products/data_catalog/evals/scorers.py
@@ -15,10 +15,18 @@ from typing import Any
from products.data_catalog.evals.constants import (
DEPRECATION_CANONICAL_SOURCE_NAME,
DEPRECATION_STALE_SOURCE_NAME,
+ EVAL_DESCRIPTION_CHAR_LIMIT,
+ METRIC_CREATE_TOOL,
+ METRIC_UPDATE_TOOL,
METRICS_CATALOG_MARKER,
)
from products.posthog_ai.eval_harness.log_parser import LogParser, ToolCall
-from products.posthog_ai.eval_harness.scorers import GRADED_ALIGNMENT_CHOICE_SCORES, JUDGE_MODEL, JudgedScorer
+from products.posthog_ai.eval_harness.scorers import (
+ BINARY_CHOICE_SCORES,
+ GRADED_ALIGNMENT_CHOICE_SCORES,
+ JUDGE_MODEL,
+ JudgedScorer,
+)
from products.posthog_ai.eval_harness.scorers.contract import Score, Scorer
__all__ = [
@@ -26,6 +34,8 @@ __all__ = [
"DeprecationProposed",
"SemanticMetadataQueried",
"SemanticTrustDecisionCorrectness",
+ "MetricDescriptionConcise",
+ "MetricDescriptionQuality",
"MetricsCatalogQueried",
"MetricsCatalogBeforeAnswer",
"MetricsCatalogBeforeDataDiscovery",
@@ -361,6 +371,127 @@ class DeprecationProposed(Scorer):
return Score(name=self._name(), score=1.0, metadata={"stale_source": stale_name})
+def _description_writes(parser: LogParser) -> list[ToolCall]:
+ """Successful metric writes carrying a string description, in call order.
+
+ Update calls count too, so a case cannot pass by writing a short, meaningful description and
+ then PATCHing a long or query-narrating one over it. The last entry is what ends up stored.
+ """
+ calls: list[ToolCall] = []
+ for tool in (METRIC_CREATE_TOOL, METRIC_UPDATE_TOOL):
+ calls.extend(
+ c
+ for c in parser.get_tool_calls(tool)
+ if not c.is_error and isinstance(c.input, dict) and isinstance(c.input.get("description"), str)
+ )
+ return sorted(calls, key=lambda c: c.position)
+
+
+def _written_descriptions(parser: LogParser) -> list[tuple[str, str]]:
+ """``(tool_name, description)`` for every successful metric write carrying a description."""
+ return [(call.name, call.input["description"]) for call in _description_writes(parser)]
+
+
+def _latest_field(calls: list[ToolCall], field: str, expected_type: type) -> Any:
+ """The value of ``field`` from the last call that supplied it with the expected type."""
+ return next((c.input[field] for c in reversed(calls) if isinstance(c.input.get(field), expected_type)), None)
+
+
+class MetricDescriptionConcise(Scorer):
+ """Binary: every metric description the agent wrote stays under the conciseness bar."""
+
+ def _name(self) -> str:
+ return "metric_description_concise"
+
+ def _run_eval_sync(self, output: dict | None, expected: dict | None = None, **kwargs) -> Score:
+ if not _requested(expected, self._name()):
+ return Score(name=self._name(), score=None, metadata={"reason": "not requested"})
+ parser = _parser_for(output)
+ if parser is None:
+ return Score(name=self._name(), score=None, metadata={"reason": "No raw log"})
+ descriptions = _written_descriptions(parser)
+ if not descriptions:
+ # Whether a metric write happened at all is RequiredToolCall's job.
+ return Score(name=self._name(), score=None, metadata={"reason": "no metric write with a description"})
+ over_limit = [
+ {"tool": tool, "length": len(description), "description": description[:200]}
+ for tool, description in descriptions
+ if len(description) > EVAL_DESCRIPTION_CHAR_LIMIT
+ ]
+ return Score(
+ name=self._name(),
+ score=0.0 if over_limit else 1.0,
+ metadata={
+ "limit": EVAL_DESCRIPTION_CHAR_LIMIT,
+ "lengths": [len(description) for _, description in descriptions],
+ "over_limit": over_limit,
+ },
+ )
+
+
+METRIC_DESCRIPTION_QUALITY_PROMPT = """\
+You are grading the 'description' an agent wrote when saving a metric to a governed catalog.
+
+A good description states, in 1-3 sentences, what the metric means and what it serves: the
+business meaning plus any load-bearing inclusions/exclusions or grain. It must not narrate or
+restate the query or calculation steps - those live in the metric's definition, and the agent's
+rationale belongs in the separate 'reasoning' field.
+
+The description to grade:
+<description>{{output.description}}</description>
+
+The metric's definition, for reference, to spot narration:
+<definition>{{output.definition}}</definition>
+
+The agent's reasoning field:
+<reasoning>{{output.reasoning}}</reasoning>
+
+Answer "yes" only if the description is 1-3 sentences stating meaning and purpose without walking
+through the query or calculation steps. Answer "no" if it narrates the query, restates SQL or
+step-by-step mechanics, or pads beyond 3 sentences."""
+
+
+class MetricDescriptionQuality(JudgedScorer):
+ """Binary LLM judge: does the description state meaning, rather than narrate the query?"""
+
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="metric_description_quality",
+ prompt_template=METRIC_DESCRIPTION_QUALITY_PROMPT,
+ choice_scores=BINARY_CHOICE_SCORES,
+ model=JUDGE_MODEL,
+ max_completion_tokens=512,
+ **kwargs,
+ )
+
+ def _prepare(self, output, expected) -> dict[str, Any] | Score:
+ if not _requested(expected, self._name()):
+ return Score(name=self._name(), score=None, metadata={"reason": "not requested"})
+ parser = _parser_for(output)
+ if parser is None:
+ return Score(name=self._name(), score=None, metadata={"reason": "No raw log"})
+ writes = _description_writes(parser)
+ if not writes:
+ return Score(name=self._name(), score=0.0, metadata={"reason": "no successful metric write"})
+ # Grade the description that ends up stored, so a compliant create followed by a
+ # query-narrating update is judged on the update.
+ last = writes[-1]
+ # An update usually omits definition and reasoning, so take each from the most recent
+ # write that supplied it. The judge needs the definition to tell meaning from narration.
+ definition = _latest_field(writes, "definition", dict)
+ reasoning = _latest_field(writes, "reasoning", str)
+ definition_text = json.dumps(definition) if definition is not None else ""
+ if len(definition_text) > _JUDGE_OUTPUT_CHAR_LIMIT:
+ definition_text = definition_text[:_JUDGE_OUTPUT_CHAR_LIMIT] + " …[truncated]"
+ return {
+ "output": {
+ "description": last.input["description"],
+ "definition": definition_text,
+ "reasoning": reasoning or "",
+ }
+ }
+
+
class MetricsCatalogNotQueried(Scorer):
"""Binary inverse: ordinary exploration must not detour through the metrics catalog."""
diff --git a/products/data_catalog/frontend/DataCatalogMetricScene.tsx b/products/data_catalog/frontend/DataCatalogMetricScene.tsx
index d9f2e1360f17..708d126a29a1 100644
--- a/products/data_catalog/frontend/DataCatalogMetricScene.tsx
+++ b/products/data_catalog/frontend/DataCatalogMetricScene.tsx
@@ -32,7 +32,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ScenePanel, ScenePanelActionsSection, ScenePanelInfoSection } from '~/layout/scenes/SceneLayout'
import { InsightShortId } from '~/types'
-import { humanizeDefinitionKind } from './common'
+import { humanizeDefinitionKind, METRIC_DESCRIPTION_MAX_LENGTH } from './common'
import {
dataCatalogMetricSceneLogic,
DataCatalogMetricSceneLogicProps,
@@ -209,6 +209,7 @@ export function DataCatalogMetricScene({ name }: DataCatalogMetricSceneLogicProp
canEdit
onNameChange={(value) => updateMetric({ display_name: value })}
onDescriptionChange={(value) => confirmAndUpdate({ description: value })}
+ descriptionMaxLength={METRIC_DESCRIPTION_MAX_LENGTH}
renameDebounceMs={0}
saveOnBlur
/>
diff --git a/products/data_catalog/frontend/common.ts b/products/data_catalog/frontend/common.ts
index 8843fdb49b15..361c192518de 100644
--- a/products/data_catalog/frontend/common.ts
+++ b/products/data_catalog/frontend/common.ts
@@ -22,3 +22,13 @@ export function validateMetricName(name: string): string | undefined {
}
return undefined
}
+
+// Mirrors MAX_DESCRIPTION_LENGTH enforced in products/data_catalog/backend/logic/validation.py.
+export const METRIC_DESCRIPTION_MAX_LENGTH = 1000
+
+export function validateMetricDescription(description: string): string | undefined {
+ if (description.length > METRIC_DESCRIPTION_MAX_LENGTH) {
+ return `Keep the description under ${METRIC_DESCRIPTION_MAX_LENGTH} characters. Say what the metric means in a few sentences.`
+ }
+ return undefined
+}
diff --git a/products/data_catalog/frontend/components/MetricFromInsightModal.tsx b/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
index 22c5e7a10ca8..126c85f8ae20 100644
--- a/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
+++ b/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
@@ -10,7 +10,7 @@ import { Link } from 'lib/lemon-ui/Link'
import { slugify } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
-import { validateMetricName } from '../common'
+import { validateMetricDescription, validateMetricName } from '../common'
import { metricsLogic } from '../metricsLogic'
export interface MetricFromInsightModalProps {
@@ -34,13 +34,16 @@ export function MetricFromInsightModal({ insightShortId, insightName }: MetricFr
? allMetrics.filter((metric) => metric.source_insight_short_id === insightShortId)
: []
+ const descriptionError = validateMetricDescription(description)
const submitDisabledReason = !insightShortId
? 'Save the insight first'
: nameError
? nameError
: !description.trim()
? 'Add a description'
- : undefined
+ : descriptionError
+ ? descriptionError
+ : undefined
const handleClose = (): void => {
setName('')
@@ -109,7 +112,11 @@ export function MetricFromInsightModal({ insightShortId, insightName }: MetricFr
<LemonInput value={displayName} onChange={setDisplayName} placeholder="Monthly active users" />
</LemonField.Pure>
- <LemonField.Pure label="Description">
+ <LemonField.Pure
+ label="Description"
+ error={descriptionError}
+ info="1-3 sentences: what the metric means and what it serves."
+ >
<LemonInput
value={description}
onChange={setDescription}
diff --git a/products/data_catalog/frontend/components/NewMetricModal.tsx b/products/data_catalog/frontend/components/NewMetricModal.tsx
index 1caf215fe592..e52667ed26c5 100644
--- a/products/data_catalog/frontend/components/NewMetricModal.tsx
+++ b/products/data_catalog/frontend/components/NewMetricModal.tsx
@@ -10,7 +10,7 @@ import { LemonSegmentedButton } from 'lib/lemon-ui/LemonSegmentedButton'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
import { LemonTextAreaMarkdown } from 'lib/lemon-ui/LemonTextArea/LemonTextAreaMarkdown'
-import { validateMetricName } from '../common'
+import { validateMetricDescription, validateMetricName } from '../common'
import { metricsLogic, NewMetricDefinitionType } from '../metricsLogic'
// The Text (markdown) option is hidden until its editor UI is polished.
@@ -26,17 +26,20 @@ export function NewMetricModal(): JSX.Element {
useActions(metricsLogic)
const nameError = validateMetricName(newMetricForm.name.trim())
+ const descriptionError = validateMetricDescription(newMetricForm.description)
const submitDisabledReason = nameError
? nameError
: !newMetricForm.description.trim()
? 'Add a description'
- : newMetricForm.definitionType === 'sql'
- ? 'Create SQL metrics from the SQL editor'
- : newMetricForm.definitionType === 'insight' && !newMetricForm.sourceInsightShortId
- ? 'Choose an insight'
- : newMetricForm.definitionType === 'markdown' && !newMetricForm.markdown.trim()
- ? 'Add the markdown definition'
- : undefined
+ : descriptionError
+ ? descriptionError
+ : newMetricForm.definitionType === 'sql'
+ ? 'Create SQL metrics from the SQL editor'
+ : newMetricForm.definitionType === 'insight' && !newMetricForm.sourceInsightShortId
+ ? 'Choose an insight'
+ : newMetricForm.definitionType === 'markdown' && !newMetricForm.markdown.trim()
+ ? 'Add the markdown definition'
+ : undefined
return (
<LemonModal isOpen={newMetricModalOpen} onClose={closeNewMetricModal} width={640} title="New metric">
@@ -63,7 +66,11 @@ export function NewMetricModal(): JSX.Element {
/>
</LemonField.Pure>
- <LemonField.Pure label="Description">
+ <LemonField.Pure
+ label="Description"
+ error={descriptionError}
+ info="1-3 sentences: what the metric means and what it serves."
+ >
<LemonTextArea
value={newMetricForm.description}
onChange={(description) => setNewMetricForm({ description })}
diff --git a/products/data_catalog/frontend/generated/api.schemas.ts b/products/data_catalog/frontend/generated/api.schemas.ts
index 7aea4dc23acf..1d11d6864e19 100644
--- a/products/data_catalog/frontend/generated/api.schemas.ts
+++ b/products/data_catalog/frontend/generated/api.schemas.ts
@@ -166,7 +166,10 @@ export interface DataCatalogMetricApi {
* @maxLength 255
*/
display_name?: string
- /** What the metric means and how to interpret it. */
+ /**
+ * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 1000
+ */
description: string
/**
* Unit of the result, e.g. usd, percent, cents.
@@ -263,7 +266,10 @@ export interface PatchedDataCatalogMetricApi {
* @maxLength 255
*/
display_name?: string
- /** What the metric means and how to interpret it. */
+ /**
+ * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 1000
+ */
description?: string
/**
* Unit of the result, e.g. usd, percent, cents.
diff --git a/products/data_catalog/frontend/generated/api.zod.ts b/products/data_catalog/frontend/generated/api.zod.ts
index b69faf9093ca..11531f216f35 100644
--- a/products/data_catalog/frontend/generated/api.zod.ts
+++ b/products/data_catalog/frontend/generated/api.zod.ts
@@ -39,6 +39,8 @@ export const dataCatalogMetricsCreateBodyNameMax = 128
export const dataCatalogMetricsCreateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsCreateBodyDisplayNameMax = 255
+export const dataCatalogMetricsCreateBodyDescriptionMax = 1000
+
export const dataCatalogMetricsCreateBodyUnitMax = 64
export const dataCatalogMetricsCreateBodySourceInsightShortIdMax = 12
@@ -59,7 +61,12 @@ export const DataCatalogMetricsCreateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsCreateBodyDisplayNameMax)
.optional()
.describe('Human-friendly label. Mutable, unlike name.'),
- description: zod.string().describe('What the metric means and how to interpret it.'),
+ description: zod
+ .string()
+ .max(dataCatalogMetricsCreateBodyDescriptionMax)
+ .describe(
+ "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ ),
unit: zod
.string()
.max(dataCatalogMetricsCreateBodyUnitMax)
@@ -105,6 +112,8 @@ export const dataCatalogMetricsUpdateBodyNameMax = 128
export const dataCatalogMetricsUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsUpdateBodyDisplayNameMax = 255
+export const dataCatalogMetricsUpdateBodyDescriptionMax = 1000
+
export const dataCatalogMetricsUpdateBodyUnitMax = 64
export const dataCatalogMetricsUpdateBodySourceInsightShortIdMax = 12
@@ -125,7 +134,12 @@ export const DataCatalogMetricsUpdateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsUpdateBodyDisplayNameMax)
.optional()
.describe('Human-friendly label. Mutable, unlike name.'),
- description: zod.string().describe('What the metric means and how to interpret it.'),
+ description: zod
+ .string()
+ .max(dataCatalogMetricsUpdateBodyDescriptionMax)
+ .describe(
+ "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ ),
unit: zod
.string()
.max(dataCatalogMetricsUpdateBodyUnitMax)
@@ -171,6 +185,8 @@ export const dataCatalogMetricsPartialUpdateBodyNameMax = 128
export const dataCatalogMetricsPartialUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsPartialUpdateBodyDisplayNameMax = 255
+export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 1000
+
export const dataCatalogMetricsPartialUpdateBodyUnitMax = 64
export const dataCatalogMetricsPartialUpdateBodySourceInsightShortIdMax = 12
@@ -192,7 +208,13 @@ export const DataCatalogMetricsPartialUpdateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsPartialUpdateBodyDisplayNameMax)
.optional()
.describe('Human-friendly label. Mutable, unlike name.'),
- description: zod.string().optional().describe('What the metric means and how to interpret it.'),
+ description: zod
+ .string()
+ .max(dataCatalogMetricsPartialUpdateBodyDescriptionMax)
+ .optional()
+ .describe(
+ "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ ),
unit: zod
.string()
.max(dataCatalogMetricsPartialUpdateBodyUnitMax)
diff --git a/products/data_catalog/mcp/tools.yaml b/products/data_catalog/mcp/tools.yaml
index 7b7dd8f98790..5ee8e5f5bffd 100644
--- a/products/data_catalog/mcp/tools.yaml
+++ b/products/data_catalog/mcp/tools.yaml
@@ -109,7 +109,9 @@ tools:
definition when the calculation needs judgment or multiple steps. Only propose a definition that was
explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off
queries. If you derived a number and no metric exists for it, offer to save the derivation as a proposed
- metric. There is no list tool: discover existing metrics with execute-sql over
+ metric. Keep 'description' to 1-3 sentences saying what the metric means and what it serves - never a
+ walkthrough of the query or calculation steps (the definition carries those); put rationale for the chosen
+ definition in 'reasoning'. There is no list tool: discover existing metrics with execute-sql over
system.information_schema.metrics.
exclude_params:
- created_source
@@ -148,7 +150,8 @@ tools:
title: Update a catalog metric
description: >
Update a metric's fields. Editing an approved metric's definition, description, or unit resets it to
- 'proposed' (it must be re-approved by a human).
+ 'proposed' (it must be re-approved by a human). When editing 'description', keep it to 1-3 sentences of
+ business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.
exclude_params:
- created_source
inject_body:
diff --git a/products/data_catalog/skills/setting-up-data-catalog/SKILL.md b/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
index db00e9c9f7e7..9ca4932613ad 100644
--- a/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
+++ b/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
@@ -48,10 +48,13 @@ Work top-down, stopping at `proposed` for everything (a human promotes later):
detection.
4. **Add remaining metrics above the bar.** Propose any other metric that was asked for or that you
- have seen reused at least twice. Give each a clear `description` (the load-bearing field), a `unit`,
- and a definition when one exists. A definition can be an executable query, or - when the
- calculation needs judgment or steps that don't reduce to a single query - an agent-calculated
- markdown definition (`{kind: 'MarkdownDefinition', markdown: '<numbered steps>'}`).
+ have seen reused at least twice. Give each a `description` (the load-bearing field) of 1-3 sentences
+ stating what the metric means and what it serves - the business meaning plus any load-bearing
+ inclusions/exclusions or grain, never a narration of the query. Query rationale goes in `reasoning`,
+ the mechanics in the definition. Also give a `unit`, and a definition when one exists. A definition
+ can be an executable query, or - when the calculation needs judgment or steps that don't reduce to a
+ single query - an agent-calculated markdown definition
+ (`{kind: 'MarkdownDefinition', markdown: '<numbered steps>'}`).
## Flow 2 — Maintenance (reviewing the queue)
diff --git a/products/posthog_ai/eval_harness/test/test_data_catalog_scorers.py b/products/posthog_ai/eval_harness/test/test_data_catalog_scorers.py
index 4e007d3ffb32..fb6d7e28f8cc 100644
--- a/products/posthog_ai/eval_harness/test/test_data_catalog_scorers.py
+++ b/products/posthog_ai/eval_harness/test/test_data_catalog_scorers.py
@@ -5,10 +5,18 @@ from typing import Any
from parameterized import parameterized
-from products.data_catalog.evals.constants import DEPRECATION_CANONICAL_SOURCE_NAME, DEPRECATION_STALE_SOURCE_NAME
+from products.data_catalog.evals.constants import (
+ DEPRECATION_CANONICAL_SOURCE_NAME,
+ DEPRECATION_STALE_SOURCE_NAME,
+ EVAL_DESCRIPTION_CHAR_LIMIT,
+ METRIC_CREATE_TOOL,
+ METRIC_UPDATE_TOOL,
+)
from products.data_catalog.evals.scorers import (
CanonicalMetricRun,
DeprecationProposed,
+ MetricDescriptionConcise,
+ MetricDescriptionQuality,
MetricsCatalogBeforeDataDiscovery,
SemanticMetadataQueried,
)
@@ -404,6 +412,7 @@ def test_deprecation_proposed(
(MetricsCatalogBeforeDataDiscovery(), "metrics_catalog_before_data_discovery"),
(CanonicalMetricRun(), "canonical_metric_run"),
(DeprecationProposed(), "deprecation_proposed"),
+ (MetricDescriptionConcise(), "metric_description_concise"),
]
)
def test_new_catalog_scorers_self_skip_when_not_requested(scorer: Any, scorer_name: str) -> None:
@@ -411,3 +420,72 @@ def test_new_catalog_scorers_self_skip_when_not_requested(scorer: Any, scorer_na
assert score.name == scorer_name
assert score.score is None
+
+
+_SHORT_DESCRIPTION = "Canonical MRR over the trailing 30 days, excluding personal/free plans."
+_LONG_DESCRIPTION = "x" * (EVAL_DESCRIPTION_CHAR_LIMIT + 1)
+
+
+ [
+ (
+ "short_create_passes",
+ [(METRIC_CREATE_TOOL, {"name": "mrr", "description": _SHORT_DESCRIPTION}, "completed")],
+ 1.0,
+ ),
+ (
+ "long_create_fails",
+ [(METRIC_CREATE_TOOL, {"name": "mrr", "description": _LONG_DESCRIPTION}, "completed")],
+ 0.0,
+ ),
+ (
+ "short_create_then_long_update_fails",
+ [
+ (METRIC_CREATE_TOOL, {"name": "mrr", "description": _SHORT_DESCRIPTION}, "completed"),
+ (METRIC_UPDATE_TOOL, {"name": "mrr", "description": _LONG_DESCRIPTION}, "completed"),
+ ],
+ 0.0,
+ ),
+ (
+ "failed_long_create_ignored",
+ [(METRIC_CREATE_TOOL, {"name": "mrr", "description": _LONG_DESCRIPTION}, "failed")],
+ None,
+ ),
+ (
+ "no_metric_write",
+ [("execute-sql", {"query": CATALOG_QUERY}, "completed")],
+ None,
+ ),
+ ]
+)
+def test_metric_description_concise(
+ _name: str,
+ calls: list[tuple[str, dict[str, Any], str]],
+ expected_score: float | None,
+) -> None:
+ score = MetricDescriptionConcise()._run_eval_sync(
+ {"raw_log": _tool_log(calls)},
+ {"metric_description_concise": {}},
+ )
+
+ assert score.score == expected_score
+
+
+def test_metric_description_quality_judges_the_stored_description() -> None:
+ narrating_update = "First it sums amount_usd, then it filters to the last 30 days, then it groups by plan."
+ calls: list[tuple[str, dict[str, Any], str]] = [
+ (
+ METRIC_CREATE_TOOL,
+ {"name": "mrr", "description": _SHORT_DESCRIPTION, "definition": {"kind": "HogQLQuery"}},
+ "completed",
+ ),
+ (METRIC_UPDATE_TOOL, {"name": "mrr", "description": narrating_update}, "completed"),
+ ]
+
+ prepared = MetricDescriptionQuality()._prepare(
+ {"raw_log": _tool_log(calls)},
+ {"metric_description_quality": {}},
+ )
+
+ assert prepared["output"]["description"] == narrating_update
+ assert prepared["output"]["definition"] == json.dumps({"kind": "HogQLQuery"})
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index b32993a6ea94..6d4e5d81d0d1 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -2302,7 +2302,7 @@
"feature_flag": "product-data-catalog"
},
"data-catalog-metric-create": {
- "description": "Create a canonical metric, or refine the one already holding this name (upsert on name; always lands 'proposed'). The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number and no metric exists for it, offer to save the derivation as a proposed metric. There is no list tool: discover existing metrics with execute-sql over system.information_schema.metrics.",
+ "description": "Create a canonical metric, or refine the one already holding this name (upsert on name; always lands 'proposed'). The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number and no metric exists for it, offer to save the derivation as a proposed metric. Keep 'description' to 1-3 sentences saying what the metric means and what it serves - never a walkthrough of the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. There is no list tool: discover existing metrics with execute-sql over system.information_schema.metrics.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Create or refine a catalog metric",
@@ -2332,7 +2332,7 @@
"feature_flag": "product-data-catalog"
},
"data-catalog-metric-update": {
- "description": "Update a metric's fields. Editing an approved metric's definition, description, or unit resets it to 'proposed' (it must be re-approved by a human).",
+ "description": "Update a metric's fields. Editing an approved metric's definition, description, or unit resets it to 'proposed' (it must be re-approved by a human). When editing 'description', keep it to 1-3 sentences of business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Update a catalog metric",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 33cf627a3e1b..e9cf14cf8985 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -2317,7 +2317,7 @@
"feature_flag": "product-data-catalog"
},
"data-catalog-metric-create": {
- "description": "Create a canonical metric, or refine the one already holding this name (upsert on name; always lands 'proposed'). The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number and no metric exists for it, offer to save the derivation as a proposed metric. There is no list tool: discover existing metrics with execute-sql over system.information_schema.metrics.",
+ "description": "Create a canonical metric, or refine the one already holding this name (upsert on name; always lands 'proposed'). The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number and no metric exists for it, offer to save the derivation as a proposed metric. Keep 'description' to 1-3 sentences saying what the metric means and what it serves - never a walkthrough of the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. There is no list tool: discover existing metrics with execute-sql over system.information_schema.metrics.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Create or refine a catalog metric",
@@ -2347,7 +2347,7 @@
"feature_flag": "product-data-catalog"
},
"data-catalog-metric-update": {
- "description": "Update a metric's fields. Editing an approved metric's definition, description, or unit resets it to 'proposed' (it must be re-approved by a human).",
+ "description": "Update a metric's fields. Editing an approved metric's definition, description, or unit resets it to 'proposed' (it must be re-approved by a human). When editing 'description', keep it to 1-3 sentences of business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Update a catalog metric",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 849399187bd9..83fc61958715 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -17624,7 +17624,10 @@ export namespace Schemas {
* @maxLength 255
*/
display_name?: string;
- /** What the metric means and how to interpret it. */
+ /**
+ * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 1000
+ */
description: string;
/**
* Unit of the result, e.g. usd, percent, cents.
@@ -52085,7 +52088,10 @@ export namespace Schemas {
* @maxLength 255
*/
display_name?: string;
- /** What the metric means and how to interpret it. */
+ /**
+ * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 1000
+ */
description?: string;
/**
* Unit of the result, e.g. usd, percent, cents.
diff --git a/services/mcp/src/generated/data_catalog/api.ts b/services/mcp/src/generated/data_catalog/api.ts
index ef314c326c9d..f66744e7efac 100644
--- a/services/mcp/src/generated/data_catalog/api.ts
+++ b/services/mcp/src/generated/data_catalog/api.ts
@@ -78,6 +78,8 @@ export const dataCatalogMetricsCreateBodyNameMax = 128
export const dataCatalogMetricsCreateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsCreateBodyDisplayNameMax = 255
+export const dataCatalogMetricsCreateBodyDescriptionMax = 1000
+
export const dataCatalogMetricsCreateBodyUnitMax = 64
export const dataCatalogMetricsCreateBodySourceInsightShortIdMax = 12
@@ -98,7 +100,12 @@ export const DataCatalogMetricsCreateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsCreateBodyDisplayNameMax)
.optional()
.describe('Human-friendly label. Mutable, unlike name.'),
- description: zod.string().describe('What the metric means and how to interpret it.'),
+ description: zod
+ .string()
+ .max(dataCatalogMetricsCreateBodyDescriptionMax)
+ .describe(
+ "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ ),
unit: zod
.string()
.max(dataCatalogMetricsCreateBodyUnitMax)
@@ -146,6 +153,8 @@ export const dataCatalogMetricsPartialUpdateBodyNameMax = 128
export const dataCatalogMetricsPartialUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsPartialUpdateBodyDisplayNameMax = 255
+export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 1000
+
export const dataCatalogMetricsPartialUpdateBodyUnitMax = 64
export const dataCatalogMetricsPartialUpdateBodySourceInsightShortIdMax = 12
@@ -167,7 +176,13 @@ export const DataCatalogMetricsPartialUpdateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsPartialUpdateBodyDisplayNameMax)
.optional()
.describe('Human-friendly label. Mutable, unlike name.'),
- description: zod.string().optional().describe('What the metric means and how to interpret it.'),
+ description: zod
+ .string()
+ .max(dataCatalogMetricsPartialUpdateBodyDescriptionMax)
+ .optional()
+ .describe(
+ "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ ),
unit: zod
.string()
.max(dataCatalogMetricsPartialUpdateBodyUnitMax)