test(stand): assert metric-definitions listing exposes subject and tags - #2420
test(stand): assert metric-definitions listing exposes subject and tags#2420cyberantonz wants to merge 1 commit into
Conversation
GET /v1/metric-definitions is now asserted to POPULATE the new fields end-to-end against a live stand, not just carry them in the schema: every builtin definition has a shaped subject, tags are shaped and unique, and at least one builtin carries tags — so a dropped subject on the reconcile/listing path or an empty metric_definition_tags join fails the contract test. Refs constructorfabric#2344 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anton Zelenov <antonz@constructor.tech>
|
Warning Review limit reached
Next review available in: 43 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Follow-up to #2397 (merged), which added
subjectandtagstoGET /v1/metric-definitions. That PR shipped Rust unit coverage (registry invariants + row→view mapping) and regenerated the stand schema, but no deployed-stand test asserted the fields are actually populated end-to-end. This adds it.tests/stand/api/analytics/test_results.py::test_metric_definitions_expose_subject_and_tags:subjectthat is a^[a-z][a-z0-9_]*$slug ≤64 chars (mirrors theVARCHAR(64)column and the registry invariant) — so a dropped subject on the reconcile write or the listingSELECTfails here.tagson every definition are shaped, ≤64, and unique per metric.tagslist — so an emptymetric_definition_tagsjoin (which theextra="forbid"schema alone would not catch, sincetagsmay legitimately be empty) fails the contract.Also exports
MetricOriginfromtests/stand/api/schemasso the test can scope the subject assertion to builtins.Refs #2344.
Testing
ruff checkclean;pytest --collect-onlydiscovers the case. Runs against a seeded stand in CI like the rest oftests/stand/api/.🤖 Generated with Claude Code