@delmaredigital/payload-experiments 0.4.0-rc.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -8
- package/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +75 -29
- package/dist/admin/blocks/model.js +5 -4
- package/dist/admin/copy/blocks.d.ts +14 -11
- package/dist/admin/copy/blocks.js +33 -22
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +10 -7
- package/dist/admin/copy/newTest.js +14 -7
- package/dist/admin/copy/status.d.ts +1 -1
- package/dist/admin/copy/status.js +2 -1
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/placementStatus.model.js +5 -3
- package/dist/admin/status.model.d.ts +1 -0
- package/dist/admin/status.model.js +2 -1
- package/dist/admin/surface/ResultsRoute.js +4 -8
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +28 -3
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +4 -3
- package/dist/admin/surface/TestsHome.js +186 -47
- package/dist/admin/surface/TestsSurface.js +2 -1
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -198
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +15 -8
- package/dist/admin/surface/home.model.js +22 -18
- package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
- package/dist/admin/surface/newTest/NewTest.js +156 -96
- package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
- package/dist/admin/surface/newTest/PageWizard.js +93 -68
- package/dist/admin/surface/newTest/newTest.css +28 -11
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +90 -63
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.js +46 -38
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/admin/views/buildSurfaceProps.js +18 -66
- package/dist/arms/copy.d.ts +13 -3
- package/dist/arms/copy.js +5 -4
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +1 -1
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/serialize.js +3 -2
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +414 -0
- package/dist/endpoints/editorSurface.js +1 -1
- package/dist/endpoints/index.js +20 -0
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +1 -0
- package/dist/endpoints/results.js +3 -0
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +4 -5
- package/dist/exports/index.d.ts +1 -1
- package/dist/goals/picker/copy.js +1 -1
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/labels/arms.d.ts +3 -0
- package/dist/labels/arms.js +8 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +18 -2
- package/dist/plugin.js +56 -2
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +36 -26
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +219 -106
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +2 -2
- package/dist/puck/editor/QuickTestActions.js +44 -34
- package/dist/puck/editor/ResultsReadout.d.ts +3 -1
- package/dist/puck/editor/ResultsReadout.js +28 -16
- package/dist/puck/editor/VersionBuilder.d.ts +4 -2
- package/dist/puck/editor/VersionBuilder.js +42 -63
- package/dist/puck/editor/armWrites.js +1 -1
- package/dist/puck/editor/copy.d.ts +10 -6
- package/dist/puck/editor/copy.js +22 -12
- package/dist/puck/editor/editor.chrome.css +9 -8
- package/dist/puck/editor/editor.css +14 -9
- package/dist/puck/editor/placementsCache.d.ts +1 -1
- package/dist/puck/editor/placementsCache.js +9 -17
- package/dist/puck/editor/usePageSaveReadiness.d.ts +1 -4
- package/dist/puck/editor/usePageSaveReadiness.js +18 -21
- package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
- package/dist/puck/editor/usePlacementNotice.js +4 -5
- package/dist/puck/nestedTestCopy.js +2 -2
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/verdict.d.ts +4 -4
- package/dist/results/verdict.js +13 -10
- package/dist/server/runResults.js +2 -1
- package/dist/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +7 -4
- package/dist/testSurface/actions/DecideDialog.js +71 -59
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.js +1 -1
- package/dist/testSurface/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +75 -22
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/api.d.ts +4 -1
- package/dist/testSurface/api.js +22 -14
- package/dist/testSurface/copy/actions.d.ts +36 -14
- package/dist/testSurface/copy/actions.js +39 -17
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +6 -6
- package/dist/testSurface/copy/common.js +6 -6
- package/dist/testSurface/copy/metrics.d.ts +6 -0
- package/dist/testSurface/copy/metrics.js +8 -0
- package/dist/testSurface/copy/pages.d.ts +67 -7
- package/dist/testSurface/copy/pages.js +74 -7
- package/dist/testSurface/copy/readiness.d.ts +8 -6
- package/dist/testSurface/copy/readiness.js +19 -10
- package/dist/testSurface/copy/recommendation.d.ts +1 -22
- package/dist/testSurface/copy/recommendation.js +2 -22
- package/dist/testSurface/copy/results.d.ts +16 -10
- package/dist/testSurface/copy/results.js +19 -11
- package/dist/testSurface/copy/review.d.ts +13 -10
- package/dist/testSurface/copy/review.js +14 -10
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.d.ts +11 -2
- package/dist/testSurface/copy/surface.js +14 -11
- package/dist/testSurface/copy/testPage.d.ts +16 -10
- package/dist/testSurface/copy/testPage.js +24 -18
- package/dist/testSurface/format/date.d.ts +5 -2
- package/dist/testSurface/format/date.js +24 -8
- package/dist/testSurface/format/roundProgress.d.ts +6 -0
- package/dist/testSurface/format/roundProgress.js +15 -0
- package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
- package/dist/testSurface/format/useDateFormatter.js +8 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/readPreflight.d.ts +0 -1
- package/dist/testSurface/readPreflight.js +0 -1
- package/dist/testSurface/results/CiChart.js +2 -1
- package/dist/testSurface/results/DataTable.d.ts +1 -1
- package/dist/testSurface/results/DataTable.js +4 -3
- package/dist/testSurface/results/VerdictHero.d.ts +1 -1
- package/dist/testSurface/results/legacy.d.ts +0 -5
- package/dist/testSurface/results/legacy.js +0 -14
- package/dist/testSurface/results/results.css +2 -2
- package/dist/testSurface/results/results.model.d.ts +8 -3
- package/dist/testSurface/results/results.model.js +25 -21
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +6 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +1 -1
- package/dist/testSurface/surface/editorPlacement.js +1 -1
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
- package/dist/testSurface/surface/pageBlock/parts.js +25 -12
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +298 -209
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +5 -3
- package/dist/testSurface/surface/readiness/ActionDialogs.js +213 -207
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +109 -148
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
- package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +14 -5
- package/dist/testSurface/surface/readiness/readiness.model.js +62 -12
- package/dist/testSurface/surface/readiness/useTransition.d.ts +3 -1
- package/dist/testSurface/surface/readiness/useTransition.js +49 -8
- package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -3
- package/dist/testSurface/surface/results/ReleasePages.js +41 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +7 -2
- package/dist/testSurface/surface/results/ResultsBody.js +170 -110
- package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
- package/dist/testSurface/surface/results/recommendation.model.js +15 -59
- package/dist/testSurface/surface/results/useResults.d.ts +6 -2
- package/dist/testSurface/surface/setting/parts.js +31 -28
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +5 -1
- package/dist/testSurface/surface/test/DeleteTest.js +63 -55
- package/dist/testSurface/surface/test/GoalSection.js +11 -11
- package/dist/testSurface/surface/test/LengthSection.js +21 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +7 -7
- package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +7 -2
- package/dist/testSurface/surface/test/TestSurface.js +17 -43
- package/dist/testSurface/surface/test/VersionsSection.js +93 -70
- package/dist/testSurface/surface/test/fields.d.ts +4 -3
- package/dist/testSurface/surface/test/fields.js +10 -16
- package/dist/testSurface/surface/test/pageParts.js +13 -7
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/useTestDocument.d.ts +1 -3
- package/dist/testSurface/surface/useTestDocument.js +110 -52
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/testSurface/useApi.d.ts +3 -0
- package/dist/transitions/addMetric.d.ts +1 -1
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/kernel.d.ts +2 -0
- package/dist/transitions/kernel.js +1 -1
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.d.ts +1 -1
- package/dist/transitions/preflightData.js +10 -2
- package/dist/transitions/start.d.ts +1 -1
- package/dist/transitions/start.js +8 -5
- package/dist/types/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +11 -1
- package/dist/types/endpoints.d.ts +38 -9
- package/dist/types/endpoints.js +1 -1
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/Dialog.d.ts +21 -2
- package/dist/ui/Dialog.js +101 -4
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +5 -1
- package/package.json +2 -2
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { theme } from '../../theme.js';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
6
|
import { Select } from '../../../ui/Inputs.js';
|
|
7
|
-
import { RESULTS_COPY as C } from '../../copy/results.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { RESULTS_COPY as C, daysOfPlan, percentileCapHelp, revenueCapHelp } from '../../copy/results.js';
|
|
8
|
+
import { relativeTime } from '../../format/date.js';
|
|
9
|
+
import { roundProgress } from '../../format/roundProgress.js';
|
|
10
|
+
import { useDateFormatter } from '../../format/useDateFormatter.js';
|
|
11
|
+
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
12
|
+
import { LifecycleButton } from '../../actions/LifecycleAction.js';
|
|
13
|
+
import { percentileTail } from '../../copy/metrics.js';
|
|
11
14
|
import { API_MESSAGES } from '../../copy/common.js';
|
|
12
15
|
import { armLabel } from '../../labels.js';
|
|
13
16
|
import { PreviewLinks } from '../../PreviewLinks.js';
|
|
@@ -15,18 +18,19 @@ import { actionablePreviewPages } from '../../previewLinks.model.js';
|
|
|
15
18
|
import { VerdictHero } from '../../results/VerdictHero.js';
|
|
16
19
|
import { StatTile } from '../../results/StatTile.js';
|
|
17
20
|
import { DataTable, Swatch } from '../../results/DataTable.js';
|
|
18
|
-
import {
|
|
19
|
-
import { formatCount, formatPercent } from '../../results/format.js';
|
|
21
|
+
import { formatCount, formatCurrency, formatPercent } from '../../results/format.js';
|
|
20
22
|
import { DataQualityPanel } from '../../results/DataQualityPanel.js';
|
|
21
23
|
import { CiChart } from '../../results/CiChart.js';
|
|
22
|
-
import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, verdictCard } from '../../results/results.model.js';
|
|
24
|
+
import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, runningPlanLine, verdictCard } from '../../results/results.model.js';
|
|
25
|
+
import { hasMissingRolloutWinner } from '../../results/snapshot.js';
|
|
23
26
|
import { recommendation } from './recommendation.model.js';
|
|
24
27
|
import { useResults } from './useResults.js';
|
|
25
28
|
import { DecideDialog } from '../../actions/DecideDialog.js';
|
|
26
29
|
import { Banner } from '../../../ui/Banner.js';
|
|
27
|
-
import {
|
|
30
|
+
import { availableActions } from '../../actions/actions.model.js';
|
|
28
31
|
import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
|
|
29
32
|
import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
|
|
33
|
+
import { notifyTestDocument } from '../watchTestDocument.js';
|
|
30
34
|
export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
|
|
31
35
|
// A different test owns an independent selection and action lifecycle.
|
|
32
36
|
return /*#__PURE__*/ _jsx(ResultsContent, {
|
|
@@ -41,8 +45,10 @@ export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged,
|
|
|
41
45
|
}, `${surface.apiRoute}/${id}`);
|
|
42
46
|
}
|
|
43
47
|
function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
|
|
48
|
+
const formatDate = useDateFormatter();
|
|
44
49
|
const results = useResults(id, surface, documentVersion);
|
|
45
50
|
const { api, doc, round, phases, state, data } = results;
|
|
51
|
+
const managerDoc = liveDocument ?? doc;
|
|
46
52
|
const manage = surface.canManage && surface.canReadResults;
|
|
47
53
|
const [placements, setPlacements] = useState(null);
|
|
48
54
|
const [checks, setChecks] = useState([]);
|
|
@@ -53,6 +59,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
53
59
|
const mounted = useRef(true);
|
|
54
60
|
const [actionError, setActionError] = useState(null);
|
|
55
61
|
const [deciding, setDeciding] = useState(null);
|
|
62
|
+
const previewId = useId();
|
|
56
63
|
const [releasing, setReleasing] = useState(null);
|
|
57
64
|
useEffect(()=>{
|
|
58
65
|
mounted.current = true;
|
|
@@ -99,7 +106,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
99
106
|
if (mounted.current) setBusy(false);
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
|
-
const phase =
|
|
109
|
+
const phase = phases.find((phase)=>phase.phase === round);
|
|
103
110
|
const snapshot = data?.snapshot;
|
|
104
111
|
const newestRound = defaultRound({
|
|
105
112
|
phases,
|
|
@@ -107,18 +114,24 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
107
114
|
});
|
|
108
115
|
const latestPhase = phases.find((phase)=>phase.phase === newestRound);
|
|
109
116
|
const decision = data?.decision ?? doc?.decision;
|
|
110
|
-
const status =
|
|
117
|
+
const status = managerDoc?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
|
|
111
118
|
// ADM-06b: an older round never inherits the live test's running status.
|
|
112
119
|
const lineStatus = !statusReadPending && status === 'running' && round === newestRound ? 'running' : 'stopped';
|
|
113
120
|
const isDecidedTestRound = status === 'decided' && phase?.phaseKind === 'test' && decision?.phase === round;
|
|
114
121
|
const showingDecision = isDecidedTestRound && Boolean(data?.decisionSnapshot);
|
|
115
122
|
const shown = showingDecision ? data.decisionSnapshot : snapshot;
|
|
116
123
|
const winner = phase?.arms.find((arm)=>arm.key === decision?.winnerArm)?.label ?? armLabel(decision?.winnerArm ?? 'control');
|
|
124
|
+
const control = phase?.arms.find((arm)=>arm.kind === 'control') ?? phases.find((item)=>item.phase === decision?.phase)?.arms.find((arm)=>arm.kind === 'control');
|
|
125
|
+
const planned = phase?.plannedDurationDays ?? (phase?.phaseKind === 'test' && lineStatus === 'running' ? managerDoc?.analysis?.plannedDurationDays : undefined);
|
|
126
|
+
const progress = roundProgress(phase?.startedAt ?? shown?.window.from, planned, lineStatus === 'running' ? Date.now() : Date.parse(shown?.window.to ?? ''));
|
|
127
|
+
const planLine = shown && lineStatus === 'running' ? runningPlanLine(shown, progress, formatDate) : null;
|
|
117
128
|
const card = shown ? verdictCard({
|
|
118
129
|
snapshot: shown,
|
|
119
130
|
decisionSnapshot: data?.decisionSnapshot,
|
|
120
131
|
isDecidedTestRound,
|
|
121
|
-
winnerLabel: winner
|
|
132
|
+
winnerLabel: winner,
|
|
133
|
+
controlLabel: control?.label,
|
|
134
|
+
keepRunningAction: planLine
|
|
122
135
|
}) : null;
|
|
123
136
|
const placementLabels = usePlacementLabels({
|
|
124
137
|
details: shown?.health?.filter((item)=>item.code === 'placement-unchecked').map((item)=>item.detail) ?? [],
|
|
@@ -144,91 +157,119 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
144
157
|
latestActivity
|
|
145
158
|
]
|
|
146
159
|
} : shown;
|
|
160
|
+
const qualityItems = phase && qualitySnapshot ? dataQuality(qualitySnapshot, context) : [];
|
|
147
161
|
const primary = phase?.metrics.find((metric)=>metric.role === 'primary');
|
|
148
162
|
// The endpoint decides the current round; historical rounds are read-only.
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
const lifecycle = managerDoc || data ? availableActions({
|
|
164
|
+
...managerDoc,
|
|
165
|
+
status,
|
|
166
|
+
kind: managerDoc?.kind ?? 'block',
|
|
167
|
+
decision: managerDoc?.decision,
|
|
168
|
+
canManage: surface.canManage,
|
|
169
|
+
canReadResults: surface.canReadResults
|
|
170
|
+
}) : [];
|
|
171
|
+
const decisionRound = phase?.phaseKind === 'test' && round === newestRound && (liveDocument?.phase == null || liveDocument.phase === round) ? phase : !phases.length && liveDocument?.phase != null ? {
|
|
172
|
+
phase: liveDocument.phase
|
|
173
|
+
} : null;
|
|
174
|
+
const canRelease = lifecycle.some((action)=>action.id === 'release-pages');
|
|
175
|
+
function refreshDocument(transition) {
|
|
176
|
+
if (transition && !onChanged) notifyTestDocument(surface.apiRoute, id);
|
|
159
177
|
results.reload();
|
|
160
|
-
onChanged?.();
|
|
178
|
+
onChanged?.(transition);
|
|
179
|
+
}
|
|
180
|
+
const roundActions = {};
|
|
181
|
+
for (const action of lifecycle){
|
|
182
|
+
if (statusReadPending) break;
|
|
183
|
+
if (action.id === 'decide' && (decisionRound || state !== 'loading')) roundActions.decide = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
184
|
+
action: action,
|
|
185
|
+
reason: decisionRound ? undefined : C.previousRound,
|
|
186
|
+
disabled: busy || !!releasing,
|
|
187
|
+
onClick: ()=>{
|
|
188
|
+
if (decisionRound) setDeciding({
|
|
189
|
+
...decisionRound,
|
|
190
|
+
results: data && round === decisionRound.phase && 'arms' in decisionRound && (state === 'ready' || state === 'empty') ? data : undefined
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
if (action.id === 'release-pages') roundActions['release-pages'] = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
195
|
+
action: action,
|
|
196
|
+
disabled: busy || !!deciding,
|
|
197
|
+
onClick: ()=>{
|
|
198
|
+
setActionError(null);
|
|
199
|
+
setReleasing({
|
|
200
|
+
phase: managerDoc?.phase
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
161
204
|
}
|
|
162
|
-
const
|
|
205
|
+
const pages = manage && placements ? actionablePreviewPages(placements, doc?.flagPoint) : [];
|
|
206
|
+
const editorUrls = [
|
|
207
|
+
...new Set(pages.flatMap((page)=>page.editorUrl ? [
|
|
208
|
+
page.editorUrl
|
|
209
|
+
] : []))
|
|
210
|
+
];
|
|
211
|
+
const editOnPage = editorUrls.length ? /*#__PURE__*/ _jsx(Button, {
|
|
212
|
+
size: "sm",
|
|
213
|
+
href: editorUrls.length === 1 ? editorUrls[0] : `#${previewId}`,
|
|
214
|
+
children: TEST_PAGE.editOnPage
|
|
215
|
+
}) : null;
|
|
216
|
+
// A decided round displays the frozen snapshot used for the decision.
|
|
217
|
+
const refresh = manage && !showingDecision ? /*#__PURE__*/ _jsxs("div", {
|
|
218
|
+
className: "xp-results-refresh",
|
|
163
219
|
children: [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
children: ACTIONS_COPY.decide
|
|
170
|
-
}) : null,
|
|
171
|
-
canRelease && !statusReadPending ? /*#__PURE__*/ _jsx(Button, {
|
|
172
|
-
variant: "secondary",
|
|
173
|
-
disabled: busy || !!deciding || !!releasing,
|
|
220
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
221
|
+
size: "sm",
|
|
222
|
+
busy: busy,
|
|
223
|
+
disabled: !!deciding || !!releasing,
|
|
174
224
|
onClick: ()=>{
|
|
175
|
-
|
|
176
|
-
setReleasing({
|
|
177
|
-
phase: releaseDoc.phase
|
|
178
|
-
});
|
|
225
|
+
void recompute();
|
|
179
226
|
},
|
|
180
|
-
children: C.
|
|
227
|
+
children: busy ? C.recomputing : C.recompute
|
|
228
|
+
}),
|
|
229
|
+
snapshot?.computedAt ? /*#__PURE__*/ _jsx("span", {
|
|
230
|
+
className: "xp-ui-help",
|
|
231
|
+
children: C.updated(relativeTime(snapshot.computedAt, undefined, formatDate))
|
|
181
232
|
}) : null
|
|
182
233
|
]
|
|
183
|
-
});
|
|
234
|
+
}) : null;
|
|
184
235
|
// Release details come only from the manager's own document, never the results response.
|
|
185
|
-
const
|
|
186
|
-
|
|
236
|
+
const releaseDecision = managerDoc?.decision;
|
|
237
|
+
const released = manage && releaseDecision?.pagesReleasedAt ? /*#__PURE__*/ _jsx(PagesReleased, {
|
|
238
|
+
decision: releaseDecision,
|
|
187
239
|
apiRoute: surface.apiRoute,
|
|
188
240
|
userId: surface.userId,
|
|
189
241
|
userCollection: surface.userCollection
|
|
190
242
|
}) : null;
|
|
191
|
-
const meta = /*#__PURE__*/
|
|
192
|
-
children:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}),
|
|
222
|
-
manage && !showingDecision ? /*#__PURE__*/ _jsx(Button, {
|
|
223
|
-
variant: "quiet",
|
|
224
|
-
size: "sm",
|
|
225
|
-
disabled: busy || !!deciding || !!releasing,
|
|
226
|
-
onClick: ()=>{
|
|
227
|
-
void recompute();
|
|
228
|
-
},
|
|
229
|
-
children: busy ? C.recomputing : C.recompute
|
|
230
|
-
}) : null
|
|
231
|
-
]
|
|
243
|
+
const meta = /*#__PURE__*/ _jsx(_Fragment, {
|
|
244
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
245
|
+
className: "xp-round-meta",
|
|
246
|
+
children: [
|
|
247
|
+
phases.length > 0 ? /*#__PURE__*/ _jsx(Select, {
|
|
248
|
+
id: "xp-results-round",
|
|
249
|
+
label: C.round,
|
|
250
|
+
disabled: !!deciding || !!releasing,
|
|
251
|
+
value: round ?? '',
|
|
252
|
+
onChange: (event)=>results.setRound(Number(event.target.value)),
|
|
253
|
+
children: roundOptions(phases).map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
254
|
+
value: option.value,
|
|
255
|
+
children: option.label
|
|
256
|
+
}, option.value))
|
|
257
|
+
}) : null,
|
|
258
|
+
manage && shown ? /*#__PURE__*/ _jsxs("span", {
|
|
259
|
+
children: [
|
|
260
|
+
"· ",
|
|
261
|
+
C.methods[shown.method]
|
|
262
|
+
]
|
|
263
|
+
}) : null,
|
|
264
|
+
showingDecision ? /*#__PURE__*/ _jsxs("span", {
|
|
265
|
+
className: "xp-results-as-of",
|
|
266
|
+
children: [
|
|
267
|
+
manage ? '· ' : '',
|
|
268
|
+
C.asOfDecision(formatDate(data.decisionSnapshot.computedAt))
|
|
269
|
+
]
|
|
270
|
+
}) : null
|
|
271
|
+
]
|
|
272
|
+
})
|
|
232
273
|
});
|
|
233
274
|
const leader = shown?.verdict.recommendedArm;
|
|
234
275
|
const leadingComparison = shown?.metrics.find((metric)=>metric.role === 'primary')?.comparisons.find((item)=>item.arm === leader);
|
|
@@ -236,8 +277,6 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
236
277
|
'collecting',
|
|
237
278
|
'rollout-collecting'
|
|
238
279
|
].includes(shown.verdict.code) ? leadingComparison?.chanceToWin : undefined;
|
|
239
|
-
const days = shown ? Math.max(0, Math.floor((Date.parse(shown.window.to) - Date.parse(phase?.startedAt ?? shown.window.from)) / 86400000)) : undefined;
|
|
240
|
-
const planned = doc?.analysis?.plannedDurationDays;
|
|
241
280
|
const content = /*#__PURE__*/ _jsxs("div", {
|
|
242
281
|
className: "xp-results",
|
|
243
282
|
style: {
|
|
@@ -250,9 +289,13 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
250
289
|
}) : null,
|
|
251
290
|
!renderPage ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
252
291
|
children: [
|
|
253
|
-
/*#__PURE__*/
|
|
292
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
254
293
|
className: "xp-ui-button-group",
|
|
255
|
-
children:
|
|
294
|
+
children: [
|
|
295
|
+
editOnPage,
|
|
296
|
+
refresh,
|
|
297
|
+
Object.values(roundActions)
|
|
298
|
+
]
|
|
256
299
|
}),
|
|
257
300
|
released
|
|
258
301
|
]
|
|
@@ -287,14 +330,14 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
287
330
|
snapshot: shown,
|
|
288
331
|
phase,
|
|
289
332
|
status: lineStatus,
|
|
290
|
-
|
|
333
|
+
isDecidedTestRound
|
|
291
334
|
}),
|
|
292
335
|
guardrails: guardrailChips(shown),
|
|
293
336
|
power: powerLine({
|
|
294
337
|
snapshot: shown,
|
|
295
338
|
phaseKind: phase.phaseKind,
|
|
296
339
|
status: lineStatus
|
|
297
|
-
}),
|
|
340
|
+
}, planLine),
|
|
298
341
|
collecting: collectingLine({
|
|
299
342
|
snapshot: shown,
|
|
300
343
|
phaseKind: phase.phaseKind,
|
|
@@ -315,9 +358,9 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
315
358
|
}),
|
|
316
359
|
/*#__PURE__*/ _jsx(StatTile, {
|
|
317
360
|
label: C.days,
|
|
318
|
-
value:
|
|
361
|
+
value: progress.plannedDays === null ? formatCount(progress.day) : daysOfPlan(formatCount(progress.day), formatCount(progress.plannedDays))
|
|
319
362
|
}),
|
|
320
|
-
/*#__PURE__*/ _jsx(StatTile, {
|
|
363
|
+
shown.method === 'bayesian' ? /*#__PURE__*/ _jsx(StatTile, {
|
|
321
364
|
label: C.chanceToWin,
|
|
322
365
|
value: formatPercent(chance),
|
|
323
366
|
detail: chance != null && leader ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -328,7 +371,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
328
371
|
phase.arms.find((arm)=>arm.key === leader)?.label ?? armLabel(leader)
|
|
329
372
|
]
|
|
330
373
|
}) : undefined
|
|
331
|
-
})
|
|
374
|
+
}) : null
|
|
332
375
|
]
|
|
333
376
|
}),
|
|
334
377
|
phase.metrics.filter((metric)=>metric.role === 'primary').map((metric)=>/*#__PURE__*/ _jsx(MetricTable, {
|
|
@@ -355,10 +398,10 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
355
398
|
shown.goalFairnessNotice ? /*#__PURE__*/ _jsx("p", {
|
|
356
399
|
children: shown.goalFairnessNotice
|
|
357
400
|
}) : null,
|
|
358
|
-
/*#__PURE__*/ _jsx(DataQualityPanel, {
|
|
401
|
+
qualityItems.length > 0 || !hasMissingRolloutWinner(shown) ? /*#__PURE__*/ _jsx(DataQualityPanel, {
|
|
359
402
|
problem: shown.verdict.code === 'data-problem',
|
|
360
|
-
items:
|
|
361
|
-
}),
|
|
403
|
+
items: qualityItems
|
|
404
|
+
}) : null,
|
|
362
405
|
[
|
|
363
406
|
'guardrail',
|
|
364
407
|
'secondary'
|
|
@@ -376,7 +419,8 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
376
419
|
}) : null
|
|
377
420
|
]
|
|
378
421
|
}),
|
|
379
|
-
|
|
422
|
+
placements && pages.length > 0 && (editorUrls.length !== 1 || pages.some((page)=>page.url)) ? /*#__PURE__*/ _jsxs("section", {
|
|
423
|
+
id: previewId,
|
|
380
424
|
className: "xp-results-block",
|
|
381
425
|
children: [
|
|
382
426
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -386,6 +430,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
386
430
|
})
|
|
387
431
|
}),
|
|
388
432
|
/*#__PURE__*/ _jsx(PreviewLinks, {
|
|
433
|
+
showEditLinks: editorUrls.length !== 1 || !renderPage,
|
|
389
434
|
apiRoute: surface.apiRoute,
|
|
390
435
|
experimentId: id,
|
|
391
436
|
flagPoint: doc?.flagPoint,
|
|
@@ -406,14 +451,14 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
406
451
|
})
|
|
407
452
|
]
|
|
408
453
|
}) : null,
|
|
409
|
-
releasing
|
|
454
|
+
releasing ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
|
|
410
455
|
id: id,
|
|
411
|
-
|
|
456
|
+
name: managerDoc?.name,
|
|
457
|
+
disabled: statusReadPending || !canRelease || managerDoc?.phase !== releasing.phase,
|
|
412
458
|
phase: releasing.phase,
|
|
413
459
|
apiRoute: surface.apiRoute,
|
|
414
460
|
onClose: ()=>setReleasing(null),
|
|
415
|
-
onRefusal: (
|
|
416
|
-
setActionError(message);
|
|
461
|
+
onRefusal: (status)=>{
|
|
417
462
|
if ([
|
|
418
463
|
401,
|
|
419
464
|
403,
|
|
@@ -422,7 +467,9 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
422
467
|
422
|
|
423
468
|
].includes(status)) refreshDocument();
|
|
424
469
|
},
|
|
425
|
-
onSuccess: refreshDocument
|
|
470
|
+
onSuccess: (doc)=>refreshDocument({
|
|
471
|
+
doc
|
|
472
|
+
})
|
|
426
473
|
}) : null
|
|
427
474
|
]
|
|
428
475
|
});
|
|
@@ -431,23 +478,29 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
431
478
|
children: [
|
|
432
479
|
renderPage ? renderPage({
|
|
433
480
|
children: content,
|
|
434
|
-
|
|
481
|
+
roundActions,
|
|
482
|
+
editOnPage,
|
|
483
|
+
refresh,
|
|
435
484
|
released,
|
|
436
485
|
data
|
|
437
486
|
}) : content,
|
|
438
487
|
deciding && manage ? /*#__PURE__*/ _jsx(DecideDialog, {
|
|
439
488
|
apiRoute: surface.apiRoute,
|
|
440
489
|
id: id,
|
|
490
|
+
name: managerDoc?.name ?? data?.experiment?.name,
|
|
441
491
|
phase: deciding.phase,
|
|
442
492
|
arms: deciding.arms,
|
|
493
|
+
results: deciding.results,
|
|
443
494
|
checks: checks,
|
|
444
|
-
|
|
495
|
+
pending: statusReadPending,
|
|
496
|
+
unavailable: !lifecycle.some((action)=>action.id === 'decide') || liveDocument?.phase != null && liveDocument.phase !== deciding.phase,
|
|
445
497
|
onClose: ()=>setDeciding(null),
|
|
446
|
-
onRefusal: refreshDocument,
|
|
498
|
+
onRefusal: ()=>refreshDocument(),
|
|
447
499
|
onSuccess: onChanged ? (doc)=>{
|
|
448
500
|
setDeciding(null);
|
|
449
|
-
|
|
450
|
-
|
|
501
|
+
refreshDocument({
|
|
502
|
+
doc
|
|
503
|
+
});
|
|
451
504
|
} : undefined
|
|
452
505
|
}) : null
|
|
453
506
|
]
|
|
@@ -463,6 +516,15 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
463
516
|
const notices = [
|
|
464
517
|
...new Set(rows.map((row)=>row.capped.notice).filter(Boolean))
|
|
465
518
|
];
|
|
519
|
+
if (metric.kind === 'revenue' && !notices.length) {
|
|
520
|
+
const cap = snapshot.params.caps[metric.metricId];
|
|
521
|
+
if (cap?.resolvedCap === null || !cap && metric.capNotice === 'no-history') notices.push(C.noCap);
|
|
522
|
+
else if (cap?.type === 'percentile') notices.push(percentileCapHelp(percentileTail(cap.value)));
|
|
523
|
+
else {
|
|
524
|
+
const threshold = cap?.value ?? metric.resolvedCap;
|
|
525
|
+
if (threshold != null) notices.push(revenueCapHelp(formatCurrency(threshold)));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
466
528
|
return /*#__PURE__*/ _jsxs("section", {
|
|
467
529
|
className: "xp-results-block",
|
|
468
530
|
children: [
|
|
@@ -496,12 +558,10 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
496
558
|
primary: metric.role === 'primary',
|
|
497
559
|
leader: leader
|
|
498
560
|
}),
|
|
499
|
-
|
|
500
|
-
METRICS_COPY.revenueHint
|
|
501
|
-
]).map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
561
|
+
notices.map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
502
562
|
className: "xp-results-cap-help",
|
|
503
563
|
children: notice
|
|
504
|
-
}, notice))
|
|
564
|
+
}, notice))
|
|
505
565
|
]
|
|
506
566
|
});
|
|
507
567
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { PhaseSummary } from '../../../types/endpoints.js';
|
|
2
2
|
import type { Status } from '../../../types/contracts.js';
|
|
3
|
-
import type { VerdictCode } from '../../../types/snapshot.js';
|
|
4
3
|
import { type DisplaySnapshot } from '../../results/snapshot.js';
|
|
5
|
-
|
|
4
|
+
/** Add guidance only when it gives the editor information the verdict does not. */
|
|
5
|
+
export declare function recommendation({ snapshot, phase, status, isDecidedTestRound }: {
|
|
6
6
|
snapshot: DisplaySnapshot;
|
|
7
|
-
phase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
/** Select stored findings and format them; never run inference in the admin. */
|
|
12
|
-
export declare const RECOMMENDATION: Record<VerdictCode, (ctx: RecommendationContext) => string>;
|
|
13
|
-
export declare const recommendation: (ctx: RecommendationContext) => string;
|
|
7
|
+
phase: PhaseSummary;
|
|
8
|
+
status: Status;
|
|
9
|
+
isDecidedTestRound: boolean;
|
|
10
|
+
}): string | null;
|
|
@@ -1,62 +1,18 @@
|
|
|
1
|
-
import { formatDate } from '../../format/date.js';
|
|
2
1
|
import { armLabel } from '../../labels.js';
|
|
3
|
-
import { formatCount
|
|
2
|
+
import { formatCount } from '../../results/format.js';
|
|
3
|
+
import { collectingRecommendation, noDifferenceRecommendation } from '../../copy/recommendation.js';
|
|
4
4
|
import { RESULTS_COPY } from '../../copy/results.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
|
|
5
|
+
import { hasMissingRolloutWinner } from '../../results/snapshot.js';
|
|
6
|
+
/** Add guidance only when it gives the editor information the verdict does not. */ export function recommendation({ snapshot, phase, status, isDecidedTestRound }) {
|
|
7
|
+
if (hasMissingRolloutWinner(snapshot)) return `${RESULTS_COPY.missingWinner} ${RESULTS_COPY.missingWinnerNext}`;
|
|
8
|
+
if (isDecidedTestRound) return null;
|
|
9
|
+
if (snapshot.verdict.code === 'collecting' && status === 'running' && snapshot.power.exposuresNeededPerArm != null) {
|
|
10
|
+
const groups = phase.arms.filter((arm)=>arm.kind !== 'holdout').length;
|
|
11
|
+
return collectingRecommendation(formatCount(Math.round(snapshot.power.exposuresNeededPerArm * groups)));
|
|
12
|
+
}
|
|
13
|
+
if (snapshot.verdict.code === 'no-difference') {
|
|
14
|
+
const control = phase.arms.find((arm)=>arm.kind === 'control');
|
|
15
|
+
return noDifferenceRecommendation(control?.label.trim() || armLabel('control'));
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
17
18
|
}
|
|
18
|
-
const primary = ({ snapshot })=>snapshot.metrics.find((metric)=>metric.role === 'primary');
|
|
19
|
-
const worse = (ctx)=>primary(ctx)?.comparisons.find((comparison)=>comparison.significant === 'worse' && ctx.phase?.arms.some((arm)=>arm.key === comparison.arm && arm.kind === 'variant'))?.arm;
|
|
20
|
-
const rolloutWinner = (ctx)=>isLegacySnapshot(ctx.snapshot) ? legacyRecommendationWinner(ctx.snapshot, ctx.phase) : {
|
|
21
|
-
key: ctx.snapshot.winnerArm,
|
|
22
|
-
label: label(ctx, ctx.snapshot.winnerArm)
|
|
23
|
-
};
|
|
24
|
-
/** Select stored findings and format them; never run inference in the admin. */ export const RECOMMENDATION = {
|
|
25
|
-
unavailable: ()=>C.unavailable,
|
|
26
|
-
'data-problem': ()=>C.dataProblem,
|
|
27
|
-
'guardrail-failing': (ctx)=>{
|
|
28
|
-
const guardrail = ctx.snapshot.guardrails.find((guardrail)=>guardrail.status === 'failing');
|
|
29
|
-
const metric = ctx.snapshot.metrics.find((metric)=>metric.metricId === guardrail?.metricId);
|
|
30
|
-
// Guardrail safety uses one-sided tests, distinct from comparison significance.
|
|
31
|
-
// Select the group the server named; do not re-infer harm from the table.
|
|
32
|
-
const group = ctx.phase?.arms.find((arm)=>ctx.snapshot.verdict.finding === storedGuardrailFinding(arm.label.trim() || armLabel(arm.key), metric?.name ?? C.guardrail));
|
|
33
|
-
return guardrailRecommendation(label(ctx, ctx.snapshot.verdict.worstArm ?? group?.key), metric?.name ?? C.guardrail);
|
|
34
|
-
},
|
|
35
|
-
collecting: (ctx)=>{
|
|
36
|
-
if (ctx.status === 'stopped') return C.stoppedCollecting;
|
|
37
|
-
const needed = ctx.snapshot.power.exposuresNeededPerArm;
|
|
38
|
-
const groups = ctx.phase?.arms.filter((arm)=>arm.kind !== 'holdout').length ?? ctx.snapshot.k + 1;
|
|
39
|
-
return needed === null ? C.collecting : collectingRecommendation(formatCount(Math.round(needed * groups)));
|
|
40
|
-
},
|
|
41
|
-
'original-better': ()=>C.originalBetter,
|
|
42
|
-
'worse-none-better': (ctx)=>worseRecommendation(label(ctx, worse(ctx))),
|
|
43
|
-
winner: (ctx)=>winnerRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm)),
|
|
44
|
-
mixed: (ctx)=>mixedRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm), label(ctx, worse(ctx))),
|
|
45
|
-
'keep-running': (ctx)=>{
|
|
46
|
-
// Same condition as the server's long-duration branch (src/results/verdict.ts).
|
|
47
|
-
const power = ctx.snapshot.power;
|
|
48
|
-
if (!power.feasible || power.daysRemaining !== null && power.daysRemaining > 90) return C.longDuration;
|
|
49
|
-
const days = ctx.plannedDurationDays;
|
|
50
|
-
const start = Date.parse(ctx.phase?.startedAt ?? '');
|
|
51
|
-
const end = days != null && Number.isFinite(days) && days > 0 ? start + days * 86_400_000 : NaN;
|
|
52
|
-
return Number.isFinite(end) ? runningRecommendation(formatDate(end)) : C.keepRunning;
|
|
53
|
-
},
|
|
54
|
-
'no-difference': ()=>C.noDifference,
|
|
55
|
-
'rollout-collecting': (ctx)=>rolloutCollectingRecommendation(rolloutWinner(ctx).label),
|
|
56
|
-
'rollout-readout': (ctx)=>rolloutReadoutRecommendation(rolloutWinner(ctx).label, formatPercent(primary(ctx)?.comparisons.find((comparison)=>comparison.arm === rolloutWinner(ctx).key)?.lift, true))
|
|
57
|
-
};
|
|
58
|
-
export const recommendation = (ctx)=>{
|
|
59
|
-
if (!isLegacySnapshot(ctx.snapshot) && ctx.snapshot.phaseKind === 'rollout' && ctx.snapshot.winnerArm === null) return RESULTS_COPY.missingWinner;
|
|
60
|
-
const sentence = RECOMMENDATION[ctx.snapshot.verdict.code];
|
|
61
|
-
return sentence(ctx);
|
|
62
|
-
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { DocId, Status } from '../../../types/contracts.js';
|
|
1
|
+
import type { DocId, ExperimentKind, Status } from '../../../types/contracts.js';
|
|
2
2
|
import type { PhaseSummary, ResultsResponse } from '../../../types/endpoints.js';
|
|
3
3
|
import { type ApiResult } from '../../api.js';
|
|
4
4
|
import type { PageReleaseDecision } from '../../results/releasePages.model.js';
|
|
5
5
|
export interface ResultsDocument {
|
|
6
|
+
name?: string;
|
|
6
7
|
flagPoint?: string;
|
|
7
|
-
kind?:
|
|
8
|
+
kind?: ExperimentKind;
|
|
8
9
|
status: Status;
|
|
9
10
|
phase?: number;
|
|
10
11
|
arms: Array<{
|
|
@@ -45,7 +46,10 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
|
|
|
45
46
|
q?: string;
|
|
46
47
|
path?: string;
|
|
47
48
|
page?: number;
|
|
49
|
+
mode?: "block";
|
|
48
50
|
}, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").PagesResult>>;
|
|
51
|
+
previewPageCopy: (id: DocId, arm: string, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPagePlan>>;
|
|
52
|
+
makePageCopy: (id: DocId, arm: string, plan: import("../../../types/endpoints.js").CopyPagePlan) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPageResult>>;
|
|
49
53
|
placementStatus: (body: import("../../../types/endpoints.js").PlacementStatusBody) => Promise<ApiResult<import("../../../types/endpoints.js").PlacementStatusResult>>;
|
|
50
54
|
start: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
51
55
|
allocate: (id: DocId, body: import("../../../types/endpoints.js").AllocateBody, options?: {
|