Skip to content

feat: wire analysis_type, tags, and notify into pick_experiment runtime#32534

Closed
Copilot wants to merge 7 commits into
mainfrom
copilot/ab-advisor-improve-experiment-infrastructure
Closed

feat: wire analysis_type, tags, and notify into pick_experiment runtime#32534
Copilot wants to merge 7 commits into
mainfrom
copilot/ab-advisor-improve-experiment-infrastructure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 16, 2026

Three fields declared in ExperimentConfig (analysis_type, tags, notify) were fully typed but had no runtime effect. This wires all three into the step summary and OTEL telemetry.

analysis_type

  • Rendered in the Experiment Details summary section as **Analysis type:** \mann_whitney``
  • Emitted as experiment.<name>.analysis_type=<value> in OTEL_RESOURCE_ATTRIBUTES

tags

  • Rendered in the Experiment Details summary as **Tags:** \team:infra`, `q1-2026``
  • Emitted as experiment.<name>.tag.<tag>=true OTEL resource attributes

notify

When all variants reach min_samples (allReady):

  • Emits core.notice("EXPERIMENT_READY: name=<n> discussion=<N>") / issue=<N> — machine-readable marker for downstream notification workflows
  • Adds a 🔔 Notification will be sent to discussion/issue #N line in the step summary for both notify.discussion and notify.issue

Tests (pick_experiment.test.cjs)

  • Added notice: vi.fn() to mockCore
  • 11 new tests covering summary rendering, OTEL attribute inclusion/omission, core.notice firing on allReady, and the negative case (notice not emitted below min_samples)

Copilot AI and others added 3 commits May 16, 2026 02:46
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve experiment infrastructure for schema and reporting feat: wire analysis_type, tags, and notify into pick_experiment runtime May 16, 2026
Copilot AI requested a review from pelikhan May 16, 2026 02:52
@pelikhan pelikhan marked this pull request as ready for review May 16, 2026 02:57
Copilot AI review requested due to automatic review settings May 16, 2026 02:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Wires the previously-declared but unused analysis_type, tags, and notify fields of ExperimentConfig into the runtime of pick_experiment, surfacing them in the GitHub Actions step summary and in OTEL_RESOURCE_ATTRIBUTES, and emitting a core.notice marker when all variants reach min_samples.

Changes:

  • Render Analysis type and Tags in the Experiment Details section of the step summary, and add a 🔔 notification line when allReady and notify.discussion/notify.issue is configured.
  • Emit experiment.<name>.analysis_type=... and experiment.<name>.tag.<tag>=true resource attributes alongside the existing variant attribute, and call core.notice("EXPERIMENT_READY: ...") on readiness.
  • Add 11 new unit tests covering summary rendering, OTEL attribute inclusion/omission, and core.notice firing/non-firing.
Show a summary per file
File Description
actions/setup/js/pick_experiment.cjs Adds analysis_type/tags rendering, notification summary line + core.notice, and extends OTEL_RESOURCE_ATTRIBUTES with analysis_type and per-tag attributes.
actions/setup/js/pick_experiment.test.cjs Adds notice to mockCore and 11 new tests for the new summary, OTEL, and notice behaviours.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment on lines +441 to +444
const tagAttrs = Object.entries(configs)
.filter(([, cfg]) => cfg.tags?.length)
.flatMap(([name, cfg]) => (cfg.tags ?? []).map(t => `experiment.${name}.tag.${t}=true`))
.join(",");
Comment thread actions/setup/js/pick_experiment.cjs Outdated
Comment on lines +277 to +321
@@ -285,6 +295,10 @@ async function writeSummary(assignments, configs, state, core) {
lines.push("");
lines.push(`**Hypothesis:** ${hypothesis}`);
}
if (cfg?.analysis_type) {
lines.push("");
lines.push(`**Analysis type:** \`${cfg.analysis_type}\``);
}
if (guardrails && guardrails.length > 0) {
lines.push("");
lines.push("**Guardrail metrics:**");
@@ -300,6 +314,11 @@ async function writeSummary(assignments, configs, state, core) {
lines.push(`Tracking issue: #${issue}`);
}
}
const tags = cfg?.tags;
if (tags && tags.length > 0) {
lines.push("");
lines.push(`**Tags:** ${tags.map(t => `\`${t}\``).join(", ")}`);
}
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

…n summary

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 16, 2026

@copilot review all comments

Addressed both reviewer findings:

  1. Tag OTEL key sanitization (183108b line 441–444): Added a sanitizeOtelKey helper that replaces any character outside [a-zA-Z0-9_\-.] with _, so tags like team:infra become experiment.feat.tag.team_infra=true. Five unit tests cover the sanitizer directly.

  2. Comment vs. render order mismatch (183108b line 277–321): Moved the Tags block to render before the tracking issue link, and updated the comment to "description, hypothesis, analysis_type, guardrail metrics, issue link, and tags" — matching the actual code order.

Both fixed in commit $(git rev-parse --short HEAD).

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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.

[ab-advisor] Improve experiment infrastructure: schema, reporting & audit

3 participants