Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added filtering to get experiments endpoints#6418

Open
Auz wants to merge 4 commits into
maingrowthbook/growthbook:mainfrom
gm/experiment-api-filtersgrowthbook/growthbook:gm/experiment-api-filtersCopy head branch name to clipboard
Open

Added filtering to get experiments endpoints#6418
Auz wants to merge 4 commits into
maingrowthbook/growthbook:mainfrom
gm/experiment-api-filtersgrowthbook/growthbook:gm/experiment-api-filtersCopy head branch name to clipboard

Conversation

@Auz

@Auz Auz commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Also updated skills so that agents can use the new endpoint options.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy preview for docs ready!

✅ Preview
https://docs-3tkkfi308-growthbook.vercel.app

Built with commit b83b746.
This pull request is being automatically deployed with vercel-action

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

This is close, but the remaining filter validation issue should be fixed before merging.

  • The main experiments endpoint now aligns much better with the documented constrained CSV filters.
  • The metric experiments endpoint can still accept an unsupported type value and return an over-broad list.
  • Fixing the metric endpoint validator should make the filter contract consistent across both endpoints.

packages/back-end/src/api/metrics/listMetricExperiments.ts and its query validator

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/back-end/src/api/metrics/listMetricExperiments.ts:42-43
**Invalid Types Widen Results**

This mapping still lets invalid `type` filter tokens reach the metric experiment filter path. The metric endpoint validator accepts `type` as any string, so a request like `GET /api/v1/metrics/<id>/experiments?type=banana` passes validation, then `normalizeExperimentFilters` drops the unknown token and applies no implementation-type filter. Callers receive a broader experiment list instead of a 400 for an unsupported constrained value. The metric endpoint needs the same constrained CSV validation as the main experiments endpoint before this mapping runs.

Reviews (3): Last reviewed commit: "Addressed Luke's comments" | Re-trigger Greptile

Comment thread packages/back-end/src/agent/skills/experiments/SKILL.md Outdated
Comment thread packages/back-end/generated/spec.yaml Outdated
@Auz

Auz commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread packages/shared/src/validators/experiments.ts Outdated
.optional(),
result: csvQueryField(
experimentResultsType,
"Filter by comma-separated results (won, lost, inconclusive, dnf). Only stopped experiments carry a result",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like we don't actually validate that it is only stopped experiments. If you switch a status back to running manually a result can still exist on the model. So we either need to add that check or clean up this language here and in filterExperiments to make sure it's totally clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is feature compatible with the front end. I'm not sure we should have different experiments returned by the same query.

@Auz

Auz commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review again

Comment on lines +42 to +43
// these are implementation types (feature | visualChange | redirect)
implementationTypes: splitCsv(req.query.type),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Invalid Types Widen Results

This mapping still lets invalid type filter tokens reach the metric experiment filter path. The metric endpoint validator accepts type as any string, so a request like GET /api/v1/metrics/<id>/experiments?type=banana passes validation, then normalizeExperimentFilters drops the unknown token and applies no implementation-type filter. Callers receive a broader experiment list instead of a 400 for an unsupported constrained value. The metric endpoint needs the same constrained CSV validation as the main experiments endpoint before this mapping runs.

Knowledge Base Used: The shared package

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/back-end/src/api/metrics/listMetricExperiments.ts
Line: 42-43

Comment:
**Invalid Types Widen Results**

This mapping still lets invalid `type` filter tokens reach the metric experiment filter path. The metric endpoint validator accepts `type` as any string, so a request like `GET /api/v1/metrics/<id>/experiments?type=banana` passes validation, then `normalizeExperimentFilters` drops the unknown token and applies no implementation-type filter. Callers receive a broader experiment list instead of a 400 for an unsupported constrained value. The metric endpoint needs the same constrained CSV validation as the main experiments endpoint before this mapping runs.

**Knowledge Base Used:** [The `shared` package](https://app.greptile.com/growthbook/-/custom-context/knowledge-base/growthbook/growthbook/-/docs/shared-package.md)

How can I resolve this? If you propose a fix, please make it concise.

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.