- Notifications
You must be signed in to change notification settings - Fork925
fix: do not warn on valid known experiments#18514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -972,7 +972,7 @@ func New(options *Options) *API { | ||
}) | ||
r.Route("/experiments",func(r chi.Router) { | ||
r.Use(apiKeyMiddleware) | ||
r.Get("/available",handleExperimentsAvailable) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Kinda unfortunate we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Yeah I considered also returning all available experiments here but elected to keep the scope of this PR small. | ||
r.Get("/",api.handleExperimentsGet) | ||
}) | ||
r.Get("/updatecheck",api.updateCheck) | ||
@@ -1895,7 +1895,9 @@ func ReadExperiments(log slog.Logger, raw []string) codersdk.Experiments { | ||
exps=append(exps,codersdk.ExperimentsSafe...) | ||
default: | ||
ex:=codersdk.Experiment(strings.ToLower(v)) | ||
if!slice.Contains(codersdk.ExperimentsKnown,ex) { | ||
log.Warn(context.Background(),"ignoring unknown experiment",slog.F("experiment",ex)) | ||
}elseif!slice.Contains(codersdk.ExperimentsSafe,ex) { | ||
Comment on lines +1898 to +1900 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. 👍. | ||
log.Warn(context.Background(),"🐉 HERE BE DRAGONS: opting into hidden experiment",slog.F("experiment",ex)) | ||
} | ||
exps=append(exps,ex) | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import{API}from"api/api"; | ||
import{typeExperiment,Experiments}from"api/typesGenerated"; | ||
importtype{MetadataState}from"hooks/useEmbeddedMetadata"; | ||
import{cachedQuery}from"./util"; | ||
constexperimentsKey=["experiments"]asconst; | ||
exportconstexperiments=(metadata:MetadataState<Experiment[]>)=>{ | ||
returncachedQuery({ | ||
metadata, | ||
queryKey:experimentsKey, | ||
@@ -19,3 +19,7 @@ export const availableExperiments = () => { | ||
queryFn:async()=>API.getAvailableExperiments(), | ||
}; | ||
}; | ||
exportconstisKnownExperiment=(experiment:string):boolean=>{ | ||
returnExperiments.includes(experimentasExperiment); | ||
}; | ||
Comment on lines +23 to +25 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Alternatively, we could have the FE return the list of known experiments, but it seems silly to do this when we can just use the auto-generated type. |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -30,7 +30,7 @@ const meta: Meta<typeof OverviewPageView> = { | ||
description: | ||
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.", | ||
flag:"experiments", | ||
value:["example"], | ||
flag_shorthand:"", | ||
hidden:false, | ||
}, | ||
@@ -82,8 +82,8 @@ export const allExperimentsEnabled: Story = { | ||
hidden:false, | ||
}, | ||
], | ||
safeExperiments:["example"], | ||
invalidExperiments:[], | ||
}, | ||
}; | ||
@@ -118,7 +118,7 @@ export const invalidExperimentsEnabled: Story = { | ||
hidden:false, | ||
}, | ||
], | ||
safeExperiments:["example"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. review: using the "example" experiment enum here instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Makes sense to me. Using a consistent experiment that we don't need to keep changing. I wonder if
| ||
invalidExperiments:["invalid"], | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
importAlertTitlefrom"@mui/material/AlertTitle"; | ||
importtype{ | ||
DAUsResponse, | ||
Experiment, | ||
SerpentOption, | ||
}from"api/typesGenerated"; | ||
import{Link}from"components/Link/Link"; | ||
@@ -22,8 +22,8 @@ import { UserEngagementChart } from "./UserEngagementChart"; | ||
typeOverviewPageViewProps={ | ||
deploymentOptions:SerpentOption[]; | ||
dailyActiveUsers:DAUsResponse|undefined; | ||
readonlyinvalidExperiments:readonlystring[]; | ||
Comment on lines 23 to +25 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. review: this has to be a string because it might not be an Experiment | ||
readonlysafeExperiments:readonlyExperiment[]; | ||
}; | ||
exportconstOverviewPageView:FC<OverviewPageViewProps>=({ | ||
Uh oh!
There was an error while loading.Please reload this page.