From d071f65c5b3f62ffbea7929e17ffb0d81022e723 Mon Sep 17 00:00:00 2001 From: jariy17 Date: Sat, 22 Aug 2026 15:17:25 +0000 Subject: [PATCH 1/2] feat(eval): online-insight update (P2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `eval online-insight update` + updateOnlineInsight client method: merges over the current config, sets insights/clusteringConfig (never evaluators), repoints the data source, and keeps the execution role caller-supplied (no re-scope machinery — insight configs are BYO-only). --- src/core/eval.tsx | 62 ++++++++++ src/handlers/eval/online-insight/index.tsx | 2 + .../online-insight/online-insight.test.tsx | 1 + .../eval/online-insight/update/index.tsx | 110 ++++++++++++++++++ src/handlers/eval/types.tsx | 18 +++ src/testing/TestCoreClient.tsx | 11 ++ 6 files changed, 204 insertions(+) create mode 100644 src/handlers/eval/online-insight/update/index.tsx diff --git a/src/core/eval.tsx b/src/core/eval.tsx index 3171aacc3..e82b58de0 100644 --- a/src/core/eval.tsx +++ b/src/core/eval.tsx @@ -102,6 +102,7 @@ import type { CreateDatasetInput, CreateOnlineEvalInput, CreateOnlineInsightInput, + UpdateOnlineInsightInput, EvaluateInput, EvaluateResult, GetBatchEvaluationResult, @@ -581,6 +582,67 @@ export class EvalClient implements CoreEvalClient { return control.send(command); } + async updateOnlineInsight( + id: string, + update: UpdateOnlineInsightInput, + options: CoreOptions, + ): Promise { + const control = this.clients.control(toClientConfig(options)); + const current = await control.send( + new GetOnlineEvaluationConfigCommand({ onlineEvaluationConfigId: id }), + ); + + const samplingPercentage = + update.samplingRate ?? current.rule?.samplingConfig?.samplingPercentage; + const sessionTimeoutMinutes = + update.sessionTimeoutMinutes ?? current.rule?.sessionConfig?.sessionTimeoutMinutes; + const filters = update.filters ?? current.rule?.filters; + + const insights = + update.insightIds !== undefined + ? update.insightIds.map((insightId) => ({ insightId })) + : current.insights; + const clusteringConfig = update.clusteringConfig ?? current.clusteringConfig; + + let dataSourceConfig = current.dataSourceConfig; + if (update.dataSourceConfig !== undefined) { + dataSourceConfig = update.dataSourceConfig; + } else if (update.agent !== undefined) { + dataSourceConfig = await agentDataSource( + update.agent, + update.clearEndpoint ? DEFAULT_ENDPOINT_QUALIFIER : update.endpoint, + this.clients, + options, + ); + } else if (update.clearEndpoint || update.endpoint !== undefined) { + const currentLogGroup = + current.dataSourceConfig && "cloudWatchLogs" in current.dataSourceConfig + ? current.dataSourceConfig.cloudWatchLogs?.logGroupNames?.[0] + : undefined; + const runtimeId = currentLogGroup ? runtimeIdFromLogGroup(currentLogGroup) : undefined; + if (!runtimeId) { + throw new InputValidationError( + `Online insight config "${id}" was not created from an agent; ` + + `pass --agent or --data-source-config to repoint it`, + { meta: { onlineEvaluationConfigId: id } }, + ); + } + const endpoint = update.clearEndpoint ? DEFAULT_ENDPOINT_QUALIFIER : update.endpoint; + dataSourceConfig = await agentDataSource(runtimeId, endpoint, this.clients, options); + } + + return control.send( + new UpdateOnlineEvaluationConfigCommand({ + onlineEvaluationConfigId: id, + rule: toRule(samplingPercentage, sessionTimeoutMinutes, filters), + dataSourceConfig, + insights, + clusteringConfig, + evaluationExecutionRoleArn: update.evaluationExecutionRoleArn, + }), + ); + } + getOnlineInsight(id: string, options: CoreOptions): Promise { return this.getOnlineEvaluationConfig(id, options); } diff --git a/src/handlers/eval/online-insight/index.tsx b/src/handlers/eval/online-insight/index.tsx index 3931ac8ae..b9a3c5108 100644 --- a/src/handlers/eval/online-insight/index.tsx +++ b/src/handlers/eval/online-insight/index.tsx @@ -4,6 +4,7 @@ import type { Core } from "../../types"; import { createCreateOnlineInsightHandler } from "./create"; import { createGetOnlineInsightHandler } from "./get"; import { createListOnlineInsightHandler } from "./list"; +import { createUpdateOnlineInsightHandler } from "./update"; import { createPauseOnlineInsightHandler } from "./pause"; import { createResumeOnlineInsightHandler } from "./resume"; import { createDeleteOnlineInsightHandler } from "./delete"; @@ -13,6 +14,7 @@ export function createOnlineInsightHandler(core: Core, io: AppIO): Router { .handler(createCreateOnlineInsightHandler(core, io)) .handler(createGetOnlineInsightHandler(core)) .handler(createListOnlineInsightHandler(core)) + .handler(createUpdateOnlineInsightHandler(core, io)) .handler(createPauseOnlineInsightHandler(core)) .handler(createResumeOnlineInsightHandler(core)) .handler(createDeleteOnlineInsightHandler(core)); diff --git a/src/handlers/eval/online-insight/online-insight.test.tsx b/src/handlers/eval/online-insight/online-insight.test.tsx index 90602b79f..9191825b9 100644 --- a/src/handlers/eval/online-insight/online-insight.test.tsx +++ b/src/handlers/eval/online-insight/online-insight.test.tsx @@ -84,6 +84,7 @@ describe("eval online-insight command hierarchy", () => { "create", "get", "list", + "update", "pause", "resume", "delete", diff --git a/src/handlers/eval/online-insight/update/index.tsx b/src/handlers/eval/online-insight/update/index.tsx new file mode 100644 index 000000000..cf3d4c346 --- /dev/null +++ b/src/handlers/eval/online-insight/update/index.tsx @@ -0,0 +1,110 @@ +import z from "zod"; +import type { DataSourceConfig, Filter } from "@aws-sdk/client-bedrock-agentcore-control"; +import { createHandler, flag } from "../../../../router"; +import { InputValidationError } from "../../../../errors"; +import { JsonRendererKey } from "../../../../tui"; +import { SourceResolver, type AppIO } from "../../../../io"; +import type { Core } from "../../../types"; +import { coreOptsFromCtx, parseJsonFlag } from "../../../utils"; + +const BUILTIN_INSIGHT_PREFIX = "Builtin.Insight."; +const ARN_PREFIX = "arn:"; + +export const createUpdateOnlineInsightHandler = (core: Core, io: AppIO) => + createHandler({ + name: "update", + description: "update an online insight config", + flags: [ + flag("id", "the ID of the online insight config to update", z.string().optional()), + flag( + "sampling-rate", + "percentage of sessions to sample (0.01-100)", + z.number().min(0.01).max(100).optional(), + ), + flag( + "session-timeout-minutes", + "minutes of inactivity before a session is considered complete (1-1440)", + z.number().int().min(1).max(1440).optional(), + ), + flag( + "filters", + "trace filters (JSON Filter[]; inline, file://, or - for stdin)", + z.string().optional(), + ), + flag( + "insight", + "insight ID(s) to apply (replaces the existing list): Builtin.Insight.* or ARN", + z.array(z.string()).optional(), + ), + flag( + "clustering-frequency", + "insight clustering cadence(s) (replaces the existing set): DAILY, WEEKLY, MONTHLY", + z.array(z.enum(["DAILY", "WEEKLY", "MONTHLY"])).optional(), + ), + flag("agent", "repoint at a different runtime ID", z.string().optional()), + flag( + "endpoint", + "re-scope monitoring to a different agent endpoint qualifier", + z.string().optional(), + ), + flag( + "clear-endpoint", + "reset the endpoint scope to the default qualifier (pass true)", + z.enum(["true", "false"]).optional(), + ), + flag( + "data-source-config", + "replace the traces to evaluate (JSON DataSourceConfig; inline, file://, or - for stdin)", + z.string().optional(), + ), + flag("role-arn", "replace the IAM role the online insight assumes", z.string().optional()), + ], + handle: async (ctx, flags) => { + if (!flags["id"]) throw new InputValidationError("required option '--id ' not specified"); + if (flags["endpoint"] && flags["clear-endpoint"] === "true") + throw new InputValidationError( + "'--endpoint' and '--clear-endpoint' are mutually exclusive", + ); + if (flags["data-source-config"] && flags["agent"]) + throw new InputValidationError( + "'--agent' and '--data-source-config' are mutually exclusive", + ); + if (flags["data-source-config"] && (flags["endpoint"] || flags["clear-endpoint"] === "true")) + throw new InputValidationError( + "'--endpoint' cannot be combined with '--data-source-config'", + ); + + for (const id of flags["insight"] ?? []) { + if (!id.startsWith(BUILTIN_INSIGHT_PREFIX) && !id.startsWith(ARN_PREFIX)) + throw new InputValidationError( + `invalid insight "${id}": must be a ${BUILTIN_INSIGHT_PREFIX}* identifier or a full ARN`, + ); + } + + const source = new SourceResolver({ stdin: io.stdin }); + const frequencies = flags["clustering-frequency"]; + const response = await core.eval.updateOnlineInsight( + flags["id"], + { + samplingRate: flags["sampling-rate"], + sessionTimeoutMinutes: flags["session-timeout-minutes"], + filters: parseJsonFlag( + "filters", + await source.resolveText("filters", flags["filters"]), + ), + insightIds: flags["insight"], + clusteringConfig: frequencies ? { frequencies } : undefined, + agent: flags["agent"], + endpoint: flags["endpoint"], + clearEndpoint: flags["clear-endpoint"] === "true", + dataSourceConfig: parseJsonFlag( + "data-source-config", + await source.resolveText("data-source-config", flags["data-source-config"]), + ), + evaluationExecutionRoleArn: flags["role-arn"], + }, + coreOptsFromCtx(ctx), + ); + ctx.require(JsonRendererKey).renderJson(response); + }, + }); diff --git a/src/handlers/eval/types.tsx b/src/handlers/eval/types.tsx index 50340aa6f..468f78977 100644 --- a/src/handlers/eval/types.tsx +++ b/src/handlers/eval/types.tsx @@ -161,6 +161,19 @@ export type CreateOnlineInsightInput = { | { agent?: undefined; endpoint?: undefined; dataSourceConfig: DataSourceConfig } ); +export type UpdateOnlineInsightInput = { + samplingRate?: number; + sessionTimeoutMinutes?: number; + filters?: Rule["filters"]; + insightIds?: string[]; + clusteringConfig?: { frequencies: ("DAILY" | "WEEKLY" | "MONTHLY")[] }; + agent?: string; + endpoint?: string; + clearEndpoint?: boolean; + dataSourceConfig?: DataSourceConfig; + evaluationExecutionRoleArn?: string; +}; + // UpdateOnlineEvalInput carries the fields a caller may change on an online // evaluation config. Undefined fields are left untouched by Core (merged over // the current config, since UpdateOnlineEvaluationConfig replaces the whole @@ -363,6 +376,11 @@ export interface CoreEvalClient { input: CreateOnlineInsightInput, options: CoreOptions, ): Promise; + updateOnlineInsight( + id: string, + update: UpdateOnlineInsightInput, + options: CoreOptions, + ): Promise; getOnlineInsight(id: string, options: CoreOptions): Promise; listOnlineInsights( nextToken: string | undefined, diff --git a/src/testing/TestCoreClient.tsx b/src/testing/TestCoreClient.tsx index a4495da0c..bf73537ea 100644 --- a/src/testing/TestCoreClient.tsx +++ b/src/testing/TestCoreClient.tsx @@ -130,6 +130,7 @@ import type { CreateDatasetInput, CreateOnlineEvalInput, CreateOnlineInsightInput, + UpdateOnlineInsightInput, DatasetUpdateResult, DatasetUpdateProgressEvent, EvaluateInput, @@ -1797,6 +1798,16 @@ export class TestEvalClient implements CoreEvalClient { return this.onlineEvalCreateResponse; } + async updateOnlineInsight( + id: string, + update: UpdateOnlineInsightInput, + options: CoreOptions, + ): Promise { + this.calls.push({ method: "updateOnlineInsight", args: [id, update, options] }); + if (this.error) throw this.error; + return this.onlineEvalUpdateResponse; + } + async getOnlineInsight( id: string, options: CoreOptions, From d71c985646e99be2b73c3480b87fa743b1b33f42 Mon Sep 17 00:00:00 2001 From: jariy17 Date: Sat, 22 Aug 2026 15:26:43 +0000 Subject: [PATCH 2/2] test(online-insight): record update golden; real-deploy bug bash --- ...uationConfigCommand.38066f8427f9fba0.json} | 8 ++-- ...luationConfigCommand.f2bd996df96c167.json} | 4 +- ...luationConfigCommand.f2bd996df96c167.json} | 15 ++++--- ...uationConfigsCommand.23f97c9dcdd6350b.json | 10 ++--- ...ationConfigsCommand.7111ef3d40a7ed07.json} | 2 +- ...uationConfigsCommand.7d2e22c637f6b633.json | 2 +- ...uationConfigCommand.80fc0aa0a8e9aee0.json} | 6 +-- ...luationConfigCommand.87c6e8413385c6e.json} | 6 +-- ...luationConfigCommand.cb95017af873cad6.json | 9 ++++ .../__fixtures__/create.golden.json | 8 ++-- .../__fixtures__/delete.golden.json | 4 +- .../__fixtures__/get.golden.json | 15 ++++--- .../__fixtures__/list-page-1.golden.json | 2 +- .../__fixtures__/list-page-2.golden.json | 2 +- .../__fixtures__/list.golden.json | 10 ++--- .../__fixtures__/pause.golden.json | 6 +-- .../__fixtures__/resume.golden.json | 6 +-- .../__fixtures__/update.golden.json | 7 ++++ .../online-insight/online-insight.test.tsx | 42 +++++++++++++++---- 19 files changed, 105 insertions(+), 59 deletions(-) rename src/handlers/eval/online-insight/__fixtures__/{CreateOnlineEvaluationConfigCommand.571c17181e8993e5.json => CreateOnlineEvaluationConfigCommand.38066f8427f9fba0.json} (74%) rename src/handlers/eval/online-insight/__fixtures__/{DeleteOnlineEvaluationConfigCommand.85b6716a8b666253.json => DeleteOnlineEvaluationConfigCommand.f2bd996df96c167.json} (82%) rename src/handlers/eval/online-insight/__fixtures__/{GetOnlineEvaluationConfigCommand.85b6716a8b666253.json => GetOnlineEvaluationConfigCommand.f2bd996df96c167.json} (78%) rename src/handlers/eval/online-insight/__fixtures__/{ListOnlineEvaluationConfigsCommand.784737470547e001.json => ListOnlineEvaluationConfigsCommand.7111ef3d40a7ed07.json} (58%) rename src/handlers/eval/online-insight/__fixtures__/{UpdateOnlineEvaluationConfigCommand.60b23c41862d8b7c.json => UpdateOnlineEvaluationConfigCommand.80fc0aa0a8e9aee0.json} (76%) rename src/handlers/eval/online-insight/__fixtures__/{UpdateOnlineEvaluationConfigCommand.21c73944c2015d66.json => UpdateOnlineEvaluationConfigCommand.87c6e8413385c6e.json} (76%) create mode 100644 src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.cb95017af873cad6.json create mode 100644 src/handlers/eval/online-insight/__fixtures__/update.golden.json diff --git a/src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.571c17181e8993e5.json b/src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.38066f8427f9fba0.json similarity index 74% rename from src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.571c17181e8993e5.json rename to src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.38066f8427f9fba0.json index c89867964..73511e2f6 100644 --- a/src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.571c17181e8993e5.json +++ b/src/handlers/eval/online-insight/__fixtures__/CreateOnlineEvaluationConfigCommand.38066f8427f9fba0.json @@ -1,14 +1,14 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "createdAt": { - "$date": "2026-08-22T15:09:11.820Z" + "$date": "2026-08-22T15:24:25.366Z" }, "status": "CREATING", "executionStatus": "DISABLED", "outputConfig": { "cloudWatchConfig": { - "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-ybMHPI7ui3" + "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-fTLcLgFC8K" } } } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.85b6716a8b666253.json b/src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.f2bd996df96c167.json similarity index 82% rename from src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.85b6716a8b666253.json rename to src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.f2bd996df96c167.json index c95c493eb..b8d1815f1 100644 --- a/src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.85b6716a8b666253.json +++ b/src/handlers/eval/online-insight/__fixtures__/DeleteOnlineEvaluationConfigCommand.f2bd996df96c167.json @@ -1,5 +1,5 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "status": "DELETING" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.85b6716a8b666253.json b/src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.f2bd996df96c167.json similarity index 78% rename from src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.85b6716a8b666253.json rename to src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.f2bd996df96c167.json index 1eace4cf7..457226427 100644 --- a/src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.85b6716a8b666253.json +++ b/src/handlers/eval/online-insight/__fixtures__/GetOnlineEvaluationConfigCommand.f2bd996df96c167.json @@ -1,10 +1,13 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "onlineEvaluationConfigName": "agentcore_cli_online_insight_fixture", "rule": { "samplingConfig": { - "samplingPercentage": 10 + "samplingPercentage": 25 + }, + "sessionConfig": { + "sessionTimeoutMinutes": 30 } }, "dataSourceConfig": { @@ -20,10 +23,10 @@ "status": "ACTIVE", "executionStatus": "DISABLED", "createdAt": { - "$date": "2026-08-22T15:09:11.820Z" + "$date": "2026-08-22T15:24:25.366Z" }, "updatedAt": { - "$date": "2026-08-22T15:09:12.022Z" + "$date": "2026-08-22T15:24:26.213Z" }, "evaluators": [], "insights": [ @@ -33,7 +36,7 @@ ], "outputConfig": { "cloudWatchConfig": { - "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-ybMHPI7ui3" + "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-fTLcLgFC8K" } }, "evaluationExecutionRoleArn": "arn:aws:iam::725476964917:role/AgentCoreEvalsSDK-us-west-2-a6864eb339" diff --git a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.23f97c9dcdd6350b.json b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.23f97c9dcdd6350b.json index 51caef74b..523a1496e 100644 --- a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.23f97c9dcdd6350b.json +++ b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.23f97c9dcdd6350b.json @@ -274,16 +274,16 @@ } }, { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "onlineEvaluationConfigName": "agentcore_cli_online_insight_fixture", - "status": "CREATING", + "status": "ACTIVE", "executionStatus": "DISABLED", "createdAt": { - "$date": "2026-08-22T15:09:11.820Z" + "$date": "2026-08-22T15:24:25.366Z" }, "updatedAt": { - "$date": "2026-08-22T15:09:11.820Z" + "$date": "2026-08-22T15:24:25.581Z" }, "insights": [ { diff --git a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.784737470547e001.json b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7111ef3d40a7ed07.json similarity index 58% rename from src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.784737470547e001.json rename to src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7111ef3d40a7ed07.json index 2e52b7702..f02ba63f5 100644 --- a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.784737470547e001.json +++ b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7111ef3d40a7ed07.json @@ -14,5 +14,5 @@ } } ], - "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAGLk59iR2ZuyIwqJvoOOfSKAAABLTCCASkGCSqGSIb3DQEHBqCCARowggEWAgEAMIIBDwYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAxXCy3KLqyS52zCnWMCARCAgeEluEX/bJ0iVrlzeNF36Ljphp15ybvPCs7096T8JI9Z9f/watuBwOrVGD9y0d+6c2TejHblL3fal/VAvuswS6Rv8RDmuvrIY/VzAkmOvuX3CNYbWUaOzsYxYrxTNC5ozK7DgRejtsAP5nOAWvy8rlik3cBQoRuL23yD5FFlOoKg6cE70CcsQg9wBOkn9ImR0Luh/7+f7RZpFGm7v6adK209ZjRzJ+saUqjZowqbh9D2i6qG/PJmYzjFmSsQAmaOsttZpajSLo14wo8glgE3AxV8LsGWQfYCAdf9/9pp0PrDm+Q=" + "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAGZ0nsv7FY8nzUaUIuxl4Q9AAABLTCCASkGCSqGSIb3DQEHBqCCARowggEWAgEAMIIBDwYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAw+bFIgwvCuFK9bgwUCARCAgeHa5NsJ+CzSAnOdcs0yTiUeZ/987yxIUFASOi2Sl1lyv9bb0969tpioyRaSiXi8wGTZoEJsQhjsAMIUPmYwwIE/2alYtbfqXNXZRGmoVqBUuN8Y3wIuh/f/wjwNS0rqSS/XfYjtz6uYeOdLiIriXN7xPAmLGrxkHa5X4/PvWCcMdXdCV/NiWoQ3vlOGjNg0KQoUawEherIb078Ygu3viZMkLtBoQZ03OUVdnp4uk3Q9aW+QTyLAECYRObKrJ5q/Lg57hbKQC3WH/1ovd0Fmyt4H0WsgDqHUC9NG5DrngMTMZ5I=" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7d2e22c637f6b633.json b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7d2e22c637f6b633.json index e6d791d15..b2092da6c 100644 --- a/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7d2e22c637f6b633.json +++ b/src/handlers/eval/online-insight/__fixtures__/ListOnlineEvaluationConfigsCommand.7d2e22c637f6b633.json @@ -14,5 +14,5 @@ } } ], - "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAHS5pIaHJusDcJMahiIVyUIAAABKjCCASYGCSqGSIb3DQEHBqCCARcwggETAgEAMIIBDAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAzVFhbXdksKx2UQ8bYCARCAgd5kgZswjRNA8eS0/H5aIL2+AzD60pHCrIClfPbmyeFmLMiWmkRKRsCLbd0thl2zxJ/uyolMa2jdONNzbq0YAyKkT0fnRa8P7USPIQt4f/+bNtG3Axi5y4t3yWC/icBXF80icPKmE9yADJxh7mjztXlTl37ZadrtgBmB5ATUrkacCyszJ8tsSCclWLP+eI4yehksQ2M0p/9nTWKm5hzBk10oRtrBrWp+epAG2zuMgsX6T6hzEVkmaG2UQLojnLk3jFWVhALIvrFaNhFbg/7B+G+NUYUtacuXfd1Ez2oBDK8=" + "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAHUExFkErNtSvYUJNcKQAQ3AAABKjCCASYGCSqGSIb3DQEHBqCCARcwggETAgEAMIIBDAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAw7jt0rqfUcDA8QJOUCARCAgd7gH+AQsXQKoBQm9zwycDDAfHIGe3wKiHemPcHu+uFCwfiTwkSNlfie4JHnpnXVUaOmLIbOXmO7tFrEX0MUssIwL3CFND86xUwmSRAl8XWsOwDDQ7vAuMNWybqHlNSRCRUpd+oN3DEtr04YEXRXZ7StqhA7a8Qh/qYVisfK8H7z5X/1eNKUHYBM1TflQ/L3WICKustFnikElEoe6UaLGaGa5UFXFD9YOj/20zV/KXFj1SPyELDIKfn0sRICPRKbzdc/gc6X4KFAnWS440xdZC6IRednvtmUxQX2Uk0AB1c=" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.60b23c41862d8b7c.json b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.80fc0aa0a8e9aee0.json similarity index 76% rename from src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.60b23c41862d8b7c.json rename to src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.80fc0aa0a8e9aee0.json index a5ccf7200..364db3ec8 100644 --- a/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.60b23c41862d8b7c.json +++ b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.80fc0aa0a8e9aee0.json @@ -1,8 +1,8 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "updatedAt": { - "$date": "2026-08-22T15:09:12.639Z" + "$date": "2026-08-22T15:24:26.498Z" }, "status": "UPDATING", "executionStatus": "ENABLED" diff --git a/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.21c73944c2015d66.json b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.87c6e8413385c6e.json similarity index 76% rename from src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.21c73944c2015d66.json rename to src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.87c6e8413385c6e.json index 22d01db09..a8a7a7b85 100644 --- a/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.21c73944c2015d66.json +++ b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.87c6e8413385c6e.json @@ -1,8 +1,8 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "updatedAt": { - "$date": "2026-08-22T15:09:17.878Z" + "$date": "2026-08-22T15:24:31.721Z" }, "status": "UPDATING", "executionStatus": "DISABLED" diff --git a/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.cb95017af873cad6.json b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.cb95017af873cad6.json new file mode 100644 index 000000000..a63f512ca --- /dev/null +++ b/src/handlers/eval/online-insight/__fixtures__/UpdateOnlineEvaluationConfigCommand.cb95017af873cad6.json @@ -0,0 +1,9 @@ +{ + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "updatedAt": { + "$date": "2026-08-22T15:24:26.213Z" + }, + "status": "ACTIVE", + "executionStatus": "DISABLED" +} \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/create.golden.json b/src/handlers/eval/online-insight/__fixtures__/create.golden.json index 0a247b055..8a2b685ec 100644 --- a/src/handlers/eval/online-insight/__fixtures__/create.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/create.golden.json @@ -1,12 +1,12 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "createdAt": "2026-08-22T15:09:11.820Z", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "createdAt": "2026-08-22T15:24:25.366Z", "status": "CREATING", "executionStatus": "DISABLED", "outputConfig": { "cloudWatchConfig": { - "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-ybMHPI7ui3" + "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-fTLcLgFC8K" } } } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/delete.golden.json b/src/handlers/eval/online-insight/__fixtures__/delete.golden.json index c95c493eb..b8d1815f1 100644 --- a/src/handlers/eval/online-insight/__fixtures__/delete.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/delete.golden.json @@ -1,5 +1,5 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "status": "DELETING" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/get.golden.json b/src/handlers/eval/online-insight/__fixtures__/get.golden.json index 83e07f5d1..c813c1648 100644 --- a/src/handlers/eval/online-insight/__fixtures__/get.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/get.golden.json @@ -1,10 +1,13 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "onlineEvaluationConfigName": "agentcore_cli_online_insight_fixture", "rule": { "samplingConfig": { - "samplingPercentage": 10 + "samplingPercentage": 25 + }, + "sessionConfig": { + "sessionTimeoutMinutes": 30 } }, "dataSourceConfig": { @@ -19,8 +22,8 @@ }, "status": "ACTIVE", "executionStatus": "DISABLED", - "createdAt": "2026-08-22T15:09:11.820Z", - "updatedAt": "2026-08-22T15:09:12.022Z", + "createdAt": "2026-08-22T15:24:25.366Z", + "updatedAt": "2026-08-22T15:24:26.213Z", "evaluators": [], "insights": [ { @@ -29,7 +32,7 @@ ], "outputConfig": { "cloudWatchConfig": { - "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-ybMHPI7ui3" + "logGroupName": "/aws/bedrock-agentcore/evaluations/results/agentcore_cli_online_insight_fixture-fTLcLgFC8K" } }, "evaluationExecutionRoleArn": "arn:aws:iam::725476964917:role/AgentCoreEvalsSDK-us-west-2-a6864eb339" diff --git a/src/handlers/eval/online-insight/__fixtures__/list-page-1.golden.json b/src/handlers/eval/online-insight/__fixtures__/list-page-1.golden.json index 4ef90dcfd..47429ee0d 100644 --- a/src/handlers/eval/online-insight/__fixtures__/list-page-1.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/list-page-1.golden.json @@ -10,5 +10,5 @@ "updatedAt": "2026-06-17T22:10:11.792Z" } ], - "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAHS5pIaHJusDcJMahiIVyUIAAABKjCCASYGCSqGSIb3DQEHBqCCARcwggETAgEAMIIBDAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAzVFhbXdksKx2UQ8bYCARCAgd5kgZswjRNA8eS0/H5aIL2+AzD60pHCrIClfPbmyeFmLMiWmkRKRsCLbd0thl2zxJ/uyolMa2jdONNzbq0YAyKkT0fnRa8P7USPIQt4f/+bNtG3Axi5y4t3yWC/icBXF80icPKmE9yADJxh7mjztXlTl37ZadrtgBmB5ATUrkacCyszJ8tsSCclWLP+eI4yehksQ2M0p/9nTWKm5hzBk10oRtrBrWp+epAG2zuMgsX6T6hzEVkmaG2UQLojnLk3jFWVhALIvrFaNhFbg/7B+G+NUYUtacuXfd1Ez2oBDK8=" + "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAHUExFkErNtSvYUJNcKQAQ3AAABKjCCASYGCSqGSIb3DQEHBqCCARcwggETAgEAMIIBDAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAw7jt0rqfUcDA8QJOUCARCAgd7gH+AQsXQKoBQm9zwycDDAfHIGe3wKiHemPcHu+uFCwfiTwkSNlfie4JHnpnXVUaOmLIbOXmO7tFrEX0MUssIwL3CFND86xUwmSRAl8XWsOwDDQ7vAuMNWybqHlNSRCRUpd+oN3DEtr04YEXRXZ7StqhA7a8Qh/qYVisfK8H7z5X/1eNKUHYBM1TflQ/L3WICKustFnikElEoe6UaLGaGa5UFXFD9YOj/20zV/KXFj1SPyELDIKfn0sRICPRKbzdc/gc6X4KFAnWS440xdZC6IRednvtmUxQX2Uk0AB1c=" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/list-page-2.golden.json b/src/handlers/eval/online-insight/__fixtures__/list-page-2.golden.json index add563343..232a9d73b 100644 --- a/src/handlers/eval/online-insight/__fixtures__/list-page-2.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/list-page-2.golden.json @@ -10,5 +10,5 @@ "updatedAt": "2026-06-17T22:10:12.095Z" } ], - "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAGLk59iR2ZuyIwqJvoOOfSKAAABLTCCASkGCSqGSIb3DQEHBqCCARowggEWAgEAMIIBDwYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAxXCy3KLqyS52zCnWMCARCAgeEluEX/bJ0iVrlzeNF36Ljphp15ybvPCs7096T8JI9Z9f/watuBwOrVGD9y0d+6c2TejHblL3fal/VAvuswS6Rv8RDmuvrIY/VzAkmOvuX3CNYbWUaOzsYxYrxTNC5ozK7DgRejtsAP5nOAWvy8rlik3cBQoRuL23yD5FFlOoKg6cE70CcsQg9wBOkn9ImR0Luh/7+f7RZpFGm7v6adK209ZjRzJ+saUqjZowqbh9D2i6qG/PJmYzjFmSsQAmaOsttZpajSLo14wo8glgE3AxV8LsGWQfYCAdf9/9pp0PrDm+Q=" + "nextToken": "AQICAHg005/7fkIBR7tGFhppNaSDRXSe8ajCw8sa0ZnYTqa1SAGZ0nsv7FY8nzUaUIuxl4Q9AAABLTCCASkGCSqGSIb3DQEHBqCCARowggEWAgEAMIIBDwYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAw+bFIgwvCuFK9bgwUCARCAgeHa5NsJ+CzSAnOdcs0yTiUeZ/987yxIUFASOi2Sl1lyv9bb0969tpioyRaSiXi8wGTZoEJsQhjsAMIUPmYwwIE/2alYtbfqXNXZRGmoVqBUuN8Y3wIuh/f/wjwNS0rqSS/XfYjtz6uYeOdLiIriXN7xPAmLGrxkHa5X4/PvWCcMdXdCV/NiWoQ3vlOGjNg0KQoUawEherIb078Ygu3viZMkLtBoQZ03OUVdnp4uk3Q9aW+QTyLAECYRObKrJ5q/Lg57hbKQC3WH/1ovd0Fmyt4H0WsgDqHUC9NG5DrngMTMZ5I=" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/list.golden.json b/src/handlers/eval/online-insight/__fixtures__/list.golden.json index 8b0d91f89..01fce0c58 100644 --- a/src/handlers/eval/online-insight/__fixtures__/list.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/list.golden.json @@ -190,13 +190,13 @@ "updatedAt": "2026-07-06T18:21:28.312Z" }, { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", "onlineEvaluationConfigName": "agentcore_cli_online_insight_fixture", - "status": "CREATING", + "status": "ACTIVE", "executionStatus": "DISABLED", - "createdAt": "2026-08-22T15:09:11.820Z", - "updatedAt": "2026-08-22T15:09:11.820Z", + "createdAt": "2026-08-22T15:24:25.366Z", + "updatedAt": "2026-08-22T15:24:25.581Z", "insights": [ { "insightId": "Builtin.Insight.FailureAnalysis" diff --git a/src/handlers/eval/online-insight/__fixtures__/pause.golden.json b/src/handlers/eval/online-insight/__fixtures__/pause.golden.json index f9b5382cc..9dd4cd9e6 100644 --- a/src/handlers/eval/online-insight/__fixtures__/pause.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/pause.golden.json @@ -1,7 +1,7 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "updatedAt": "2026-08-22T15:09:17.878Z", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "updatedAt": "2026-08-22T15:24:31.721Z", "status": "UPDATING", "executionStatus": "DISABLED" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/resume.golden.json b/src/handlers/eval/online-insight/__fixtures__/resume.golden.json index 40626d90c..afc35e7fd 100644 --- a/src/handlers/eval/online-insight/__fixtures__/resume.golden.json +++ b/src/handlers/eval/online-insight/__fixtures__/resume.golden.json @@ -1,7 +1,7 @@ { - "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-ybMHPI7ui3", - "updatedAt": "2026-08-22T15:09:12.639Z", + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "updatedAt": "2026-08-22T15:24:26.498Z", "status": "UPDATING", "executionStatus": "ENABLED" } \ No newline at end of file diff --git a/src/handlers/eval/online-insight/__fixtures__/update.golden.json b/src/handlers/eval/online-insight/__fixtures__/update.golden.json new file mode 100644 index 000000000..73ece56f0 --- /dev/null +++ b/src/handlers/eval/online-insight/__fixtures__/update.golden.json @@ -0,0 +1,7 @@ +{ + "onlineEvaluationConfigArn": "arn:aws:bedrock-agentcore:us-west-2:725476964917:online-evaluation-config/agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "onlineEvaluationConfigId": "agentcore_cli_online_insight_fixture-fTLcLgFC8K", + "updatedAt": "2026-08-22T15:24:26.213Z", + "status": "ACTIVE", + "executionStatus": "DISABLED" +} \ No newline at end of file diff --git a/src/handlers/eval/online-insight/online-insight.test.tsx b/src/handlers/eval/online-insight/online-insight.test.tsx index 9191825b9..25a17be36 100644 --- a/src/handlers/eval/online-insight/online-insight.test.tsx +++ b/src/handlers/eval/online-insight/online-insight.test.tsx @@ -108,6 +108,8 @@ describe("online-insight CRUDL", () => { FIXTURE_INSIGHT_ID, "--sampling-rate", "10", + "--session-timeout-minutes", + "30", "--enable-on-create", "false", ]); @@ -147,19 +149,41 @@ describe("online-insight CRUDL", () => { expect(JSON.parse(secondPage).onlineEvaluationConfigs).toHaveLength(1); }); - test("gets the config, exposing the insight, no evaluators, and the custom role", async () => { - const stdout = await run(["eval", "online-insight", "get", "--id", configId]); - matchGolden(FIXTURES, "get.golden.json", stdout); + // update merges over the current config because UpdateOnlineEvaluationConfig + // replaces the whole `rule`; this asserts the unset fields survive the round trip. + test("updates only the sampling rate, preserving the timeout, insight, and role", async () => { + const stdout = await run([ + "eval", + "online-insight", + "update", + "--id", + configId, + "--sampling-rate", + "25", + ]); - const detail = JSON.parse(stdout); - expect(detail.onlineEvaluationConfigName).toBe(CONFIG_NAME); - expect(detail.insights.map((i: { insightId: string }) => i.insightId)).toContain( + matchGolden(FIXTURES, "update.golden.json", stdout); + + // `get` is asserted here rather than in its own test: fixtures are keyed by + // request input, so a second `get` of this id would share (and disagree with) + // this one's recording. + const getStdout = await run(["eval", "online-insight", "get", "--id", configId]); + matchGolden(FIXTURES, "get.golden.json", getStdout); + + const after = JSON.parse(getStdout); + expect(after.onlineEvaluationConfigName).toBe(CONFIG_NAME); + expect(after.rule.samplingConfig.samplingPercentage).toBe(25); + // `update` replaces the whole `rule`, and --session-timeout-minutes was never + // passed to it, so the value set at create must survive the merge. + expect(after.rule.sessionConfig.sessionTimeoutMinutes).toBe(30); + // online-insight carries an insight list, never evaluators; the sampling-only + // update must leave both untouched. + expect(after.insights.map((i: { insightId: string }) => i.insightId)).toContain( FIXTURE_INSIGHT_ID, ); - // create passed --insight, never --evaluator, so the evaluator list stays empty. - expect(detail.evaluators ?? []).toEqual([]); + expect(after.evaluators ?? []).toEqual([]); // --role-arn is used verbatim; online-insight never provisions a role. - expect(detail.evaluationExecutionRoleArn).toBe(FIXTURE_ROLE_ARN); + expect(after.evaluationExecutionRoleArn).toBe(FIXTURE_ROLE_ARN); }); // resume and pause are asserted in one test because the service rejects an