Skip to content

Document experiment decorator system for human-readable arm labels #18

Description

@jjroelofs

Summary

The RL module has an experiment decorator system (ExperimentDecoratorManager) that allows modules to provide human-readable labels for experiment arms in reports. However, this system is not documented, making it difficult for module developers to use.

Problem

When viewing experiment reports at /admin/reports/rl/experiment/{experiment_id}, arm IDs are shown as raw values (e.g., node IDs like "42", "87") instead of human-readable labels (e.g., "My Blog Post Title").

Current Architecture

The decorator system already exists:

  1. ExperimentDecoratorManager collects decorator services tagged with rl_experiment_decorator
  2. Decorators implement ExperimentDecoratorInterface with decorateExperiment() and decorateArm() methods
  3. ReportsController::experimentDetail() already calls decorateArm() but falls back to raw arm ID when no decorator is registered

Requested Documentation

Add documentation (README or inline) explaining:

  1. How to create a decorator class implementing ExperimentDecoratorInterface
  2. How to register the decorator service with the rl_experiment_decorator tag
  3. Example decorator implementation

Example Service Registration

mymodule.experiment_decorator:
  class: Drupal\mymodule\Decorator\MyExperimentDecorator
  arguments: ['@entity_type.manager']
  tags:
    - { name: rl_experiment_decorator }

Related

  • See ai_sorting module issue for implementing a decorator for Views-based experiments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions