发布

  • [OPIK-6741] [BE][FE] feat: add EvalTriggerScope to evaluation rules (#7439)

    frostbyte_neo 发布于 2026-07-22 12:16:03 +00:00

    • [OPIK-6741] [BE][FE] feat: add EvalTriggerScope to evaluation rules

    Add a trigger_scope field (PRODUCTION / EXPERIMENT / BOTH) to online
    evaluation rules so they can fire on experiment traces, production
    traces, or both. Existing rules default to PRODUCTION (backward
    compatible). Clients that omit trigger_scope get PRODUCTION silently.

    BE: New EvalTriggerScope enum, DB migration 000090, field threaded
    through all model/DAO/service/mapper layers, OnlineScoringSampler
    now lets experiment traces through and filters per-evaluator based
    on trigger scope. Null-safe defaulting in service and sampler.

    FE: ToggleGroup control on the v2 rule create/edit dialog for
    selecting trigger scope, wired into form schema and API payload.

    Tests: 3 dedicated TriggerScope unit tests, TracesUpdated path
    coverage for EXPERIMENT source, updated existing sampler and
    integration tests.

    • fix(evaluators): null-safe triggerScope default + review fixes
    • Add withTriggerScope to AutomationRuleEvaluatorModel interface + 6 records
    • Default null triggerScope to PRODUCTION in service save path
    • Add --comment to migration 000090
    • Fix DisabledRulesTest by setting explicit triggerScope on test rules
    • Add triggerScope to update test expected builder
    • Revision 2: hide trigger scope toggle for thread/span rules

    Thread and span evaluators have separate scoring paths that don't
    check triggerScope, so the toggle is a no-op for those rule types.
    Hide it in the FE to avoid user confusion.

    下载附件