Skip to content

test(stand): assert metric-definitions listing exposes subject and tags - #2420

Closed
cyberantonz wants to merge 1 commit into
constructorfabric:mainfrom
cyberantonz:test/2344-subject-tags-stand
Closed

test(stand): assert metric-definitions listing exposes subject and tags#2420
cyberantonz wants to merge 1 commit into
constructorfabric:mainfrom
cyberantonz:test/2344-subject-tags-stand

Conversation

@cyberantonz

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2397 (merged), which added subject and tags to GET /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:

  • Every builtin definition carries a non-null subject that is a ^[a-z][a-z0-9_]*$ slug ≤64 chars (mirrors the VARCHAR(64) column and the registry invariant) — so a dropped subject on the reconcile write or the listing SELECT fails here.
  • tags on every definition are shaped, ≤64, and unique per metric.
  • At least one builtin carries a non-empty tags list — so an empty metric_definition_tags join (which the extra="forbid" schema alone would not catch, since tags may legitimately be empty) fails the contract.

Also exports MetricOrigin from tests/stand/api/schemas so the test can scope the subject assertion to builtins.

Refs #2344.

Testing

  • ruff check clean; pytest --collect-only discovers the case. Runs against a seeded stand in CI like the rest of tests/stand/api/.

🤖 Generated with Claude Code

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>
@cyberantonz
cyberantonz requested a review from a team as a code owner August 11, 2026 04:29
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@cyberantonz, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: db5fe6ab-ff24-4cc1-ad83-a8965d42cd2d

📥 Commits

Reviewing files that changed from the base of the PR and between 29e3c8b and 77132eb.

📒 Files selected for processing (2)
  • tests/stand/api/analytics/test_results.py
  • tests/stand/api/schemas/__init__.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cyberantonz

Copy link
Copy Markdown
Contributor Author

Folded into #2401 (rebased onto main, test commit cherry-picked on top of the feature commit) — the stand assertions depend on the schema fields #2401 introduces, so they ship together.

@cyberantonz
cyberantonz deleted the test/2344-subject-tags-stand branch August 11, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant