Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
feat(tagging): gate workflow tagging UI behind WORKFLOW_TAGGING flag (frontend) (SKY-10683) (#6644)
Aaron Perezd78d78cc4625
diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.tsindex bf8988eb3..259519f7e 100644--- a/skyvern-frontend/src/api/types.ts+++ b/skyvern-frontend/src/api/types.ts@@ -447,6 +447,7 @@ export const ActionTypes = {LeftMouse: "left_mouse",GotoUrl: "goto_url",ClosePage: "close_page",+ ExecuteJs: "execute_js",} as const;export type ActionType = (typeof ActionTypes)[keyof typeof ActionTypes];@@ -475,7 +476,26 @@ export const ReadableActionTypes: {left_mouse: "Left Mouse",goto_url: "Goto URL",close_page: "Close Page",-};+ execute_js: "Execute JS",+};++// Recorded code-block actions can carry an action_type the readable map doesn't+// list yet (the runtime recorder maps more Playwright calls than the UI enumerates).+// Humanize unknown types instead of rendering a blank badge.+export function getReadableActionType(actionType: string): string {+ const known = ReadableActionTypes[actionType as ActionType];+ if (known) {+ return known;+ }+ if (!actionType) {+ return "Step";+ }+ return actionType+ .split("_")+ .filter(Boolean)+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))+ .join(" ");+}export type Option = {label: string;diff --git a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsxindex cf1d3bcd4..9ec0b7f41 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx@@ -81,7 +81,11 @@ import {useFeatureFlagVariantKey,} from "posthog-js/react";import { EXPERIMENT, isABVariant } from "@/util/onboarding/experimentConfig";-import { ANALYTICS_DASHBOARD_FLAG } from "@/util/featureFlags";+import {+ ANALYTICS_DASHBOARD_FLAG,+ WORKFLOW_TAGGING_FLAG,+} from "@/util/featureFlags";+import { useFeatureFlag } from "@/hooks/useFeatureFlag";import { useOnboardingStateOptional } from "@/store/onboarding/useOnboardingState";import { OnboardingEmptyState } from "@/components/onboarding/OnboardingEmptyState";@@ -129,13 +133,16 @@ function WorkflowPage() {workflowPermanentId,});+ // undefined (OSS / pre-load) shows tagging; only an explicit cloud `false` hides it.+ const taggingEnabled = useFeatureFlag(WORKFLOW_TAGGING_FLAG) !== false;const { data: workflowTagsMap = {} } = useWorkflowTagsBatchQuery(workflowPermanentId ? [workflowPermanentId] : [],+ { enabled: taggingEnabled },);const workflowTags = workflowPermanentId? workflowTagsMap[workflowPermanentId]: undefined;- const { data: tagKeys = [] } = useTagKeysQuery();+ const { data: tagKeys = [] } = useTagKeysQuery({ enabled: taggingEnabled });const tagDescriptions = useMemo(() =>new Map(@@ -168,7 +175,10 @@ function WorkflowPage() {</>)}</div>- {!workflowIsLoading && workflowTags && workflowTags.length > 0 ? (+ {taggingEnabled &&+ !workflowIsLoading &&+ workflowTags &&+ workflowTags.length > 0 ? (<TagChipListtags={workflowTags}descriptions={tagDescriptions}diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsxindex 2cca5ed0b..f17a4ba50 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx@@ -41,6 +41,8 @@ import {TooltipTrigger,} from "@/components/ui/tooltip";import { useCredentialGetter } from "@/hooks/useCredentialGetter";+import { useFeatureFlag } from "@/hooks/useFeatureFlag";+import { WORKFLOW_TAGGING_FLAG } from "@/util/featureFlags";import { basicTimeFormat, compactLocalDateTime } from "@/util/timeFormat";import {BULK_CONCURRENCY_LIMIT,@@ -181,7 +183,12 @@ function WorkflowsFlat() {() => parseTagFilter(tagFilterParam),[tagFilterParam],);- const serializedTagFilter = serializeTagFilter(tagFilters);+ // undefined (OSS / pre-load) shows tagging; only an explicit cloud `false` hides it.+ const taggingEnabled = useFeatureFlag(WORKFLOW_TAGGING_FLAG) !== false;+ // While tagging is hidden, ignore stale `?tags=` so the backend list isn't tag-filtered.+ const serializedTagFilter = taggingEnabled+ ? serializeTagFilter(tagFilters)+ : "";const setTagFilters = useCallback((terms: TagFilterTerm[]) => {@@ -394,7 +401,7 @@ function WorkflowsFlat() {// Tag-key registry: supplies chip-hover descriptions and the filter's key list.// Keyed with a Map so tag keys like "constructor"/"toString" can't resolve to// inherited Object prototype members when looked up.- const { data: tagKeys = [] } = useTagKeysQuery();+ const { data: tagKeys = [] } = useTagKeysQuery({ enabled: taggingEnabled });const tagDescriptions = useMemo(() =>new Map(@@ -411,7 +418,12 @@ function WorkflowsFlat() {() => workflows.map((workflow) => workflow.workflow_permanent_id),[workflows],);- const { data: workflowTagsMap = {} } = useWorkflowTagsBatchQuery(workflowIds);+ const { data: workflowTagsMap = {} } = useWorkflowTagsBatchQuery(+ workflowIds,+ {+ enabled: taggingEnabled,+ },+ );// Tags observed on the page for editor/filter suggestions: grouped values per// key plus standalone labels. Maps avoid prototype-key collisions.@@ -764,13 +776,15 @@ function WorkflowsFlat() {placeholder="Search by title or input..."className="w-48 lg:w-72"/>- <WorkflowTagFilter- tagKeys={tagKeys}- value={tagFilters}- onChange={setTagFilters}- labelSuggestions={labelSuggestions}- valueSuggestionsByKey={valueSuggestionsByKey}- />+ {taggingEnabled ? (+ <WorkflowTagFilter+ tagKeys={tagKeys}+ value={tagFilters}+ onChange={setTagFilters}+ labelSuggestions={labelSuggestions}+ valueSuggestionsByKey={valueSuggestionsByKey}+ />+ ) : null}</div><div className="flex items-center gap-4"><Link@@ -1014,7 +1028,9 @@ function WorkflowsFlat() {</TooltipProvider>)}</div>- {workflowTags && workflowTags.length > 0 ? (+ {taggingEnabled &&+ workflowTags &&+ workflowTags.length > 0 ? (<TagChipListtags={workflowTags}descriptions={tagDescriptions}@@ -1088,17 +1104,19 @@ function WorkflowsFlat() {</TooltipContent></Tooltip></TooltipProvider>- <WorkflowTagEditor- workflowPermanentId={- workflow.workflow_permanent_id- }- tags={workflowTags ?? []}- tagKeys={tagKeys}- labelSuggestions={labelSuggestions}- valueSuggestionsByKey={- valueSuggestionsByKey- }- />+ {taggingEnabled ? (+ <WorkflowTagEditor+ workflowPermanentId={+ workflow.workflow_permanent_id+ }+ tags={workflowTags ?? []}+ tagKeys={tagKeys}+ labelSuggestions={labelSuggestions}+ valueSuggestionsByKey={+ valueSuggestionsByKey+ }+ />+ ) : null}</>)}<TooltipProvider>@@ -1246,6 +1264,7 @@ function WorkflowsFlat() {})}onMoveToFolder={handleBulkMoveToFolder}+ taggingEnabled={taggingEnabled}tagKeys={tagKeys}labelSuggestions={labelSuggestions}valueSuggestionsByKey={valueSuggestionsByKey}diff --git a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsxindex 3035ea49e..de6e4681c 100644--- a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx+++ b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx@@ -41,6 +41,8 @@ type Props = {onClearSelection: () => void;onDeleteRequest: () => void;onMoveToFolder: (folderId: string | null) => Promise<void>;+ // Defaults to shown; only an explicit false (cloud flag off) hides tagging.+ taggingEnabled?: boolean;tagKeys: Array<TagKey>;labelSuggestions: Array<string>;valueSuggestionsByKey?: Map<string, Array<string>>;@@ -68,6 +70,7 @@ function BulkActionBar({onClearSelection,onDeleteRequest,onMoveToFolder,+ taggingEnabled = true,tagKeys,labelSuggestions,valueSuggestionsByKey,@@ -253,14 +256,16 @@ function BulkActionBar({</Button>}/>- <BulkTagPicker- bulkCount={count}- tagKeys={tagKeys}- labelSuggestions={labelSuggestions}- valueSuggestionsByKey={valueSuggestionsByKey}- disabled={isOperating}- onApplyTag={handleBulkTagApply}- />+ {taggingEnabled && (+ <BulkTagPicker+ bulkCount={count}+ tagKeys={tagKeys}+ labelSuggestions={labelSuggestions}+ valueSuggestionsByKey={valueSuggestionsByKey}+ disabled={isOperating}+ onApplyTag={handleBulkTagApply}+ />+ )}<DropdownMenu><DropdownMenuTrigger asChild><Button size="sm" variant="ghost" disabled={isOperating}>diff --git a/skyvern-frontend/src/routes/workflows/components/actionTypeIcons.tsx b/skyvern-frontend/src/routes/workflows/components/actionTypeIcons.tsxindex 0afef22d8..0da2df92b 100644--- a/skyvern-frontend/src/routes/workflows/components/actionTypeIcons.tsx+++ b/skyvern-frontend/src/routes/workflows/components/actionTypeIcons.tsx@@ -1,5 +1,6 @@import {CheckCircledIcon,+ CodeIcon,CrossCircledIcon,CursorArrowIcon,Cross2Icon,@@ -55,6 +56,7 @@ export const actionTypeIcons: Record<ActionType, ReactNode> = {<WorkflowBlockIcon workflowBlockType="goto_url" className="size-3.5" />),[ActionTypes.ClosePage]: <Cross2Icon className="size-3.5" />,+ [ActionTypes.ExecuteJs]: <CodeIcon className="size-3.5" />,};export function getActionTypeIcon(actionType: string): ReactNode {diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/CodeBlockPlainCard.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/CodeBlockPlainCard.test.tsxnew file mode 100644index 000000000..544a049ac--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/CodeBlockPlainCard.test.tsx@@ -0,0 +1,54 @@+// @vitest-environment jsdom++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import type { CodeBlockStep } from "@/routes/workflows/types/workflowTypes";++import { CodeBlockPlainCard } from "./CodeBlockPlainCard";++afterEach(() => {+ cleanup();+});++describe("CodeBlockPlainCard", () => {+ it("renders a page.evaluate step with the Execute JS label, not a dropped or blank step", () => {+ const steps: Array<CodeBlockStep> = [+ {+ action_type: "goto_url",+ description: "Open https://news.ycombinator.com/",+ line_start: 1,+ line_end: 1,+ },+ {+ action_type: "execute_js",+ description: "Run a script",+ line_start: 3,+ line_end: 3,+ },+ ];++ render(<CodeBlockPlainCard steps={steps} />);++ expect(screen.getByText("Goto URL")).toBeDefined();+ expect(screen.getByText("Execute JS")).toBeDefined();+ expect(screen.getByText("Run a script")).toBeDefined();+ // The evaluate step is the 2nd of 2 — the count must match the script, not drop it.+ expect(screen.getByText("2")).toBeDefined();+ });++ it("humanizes an unmapped step action type instead of rendering a blank label", () => {+ const steps: Array<CodeBlockStep> = [+ {+ action_type: "go_forward",+ description: "Go forward",+ line_start: 1,+ line_end: 1,+ },+ ];++ render(<CodeBlockPlainCard steps={steps} />);++ expect(screen.getByText("Go Forward")).toBeDefined();+ });+});diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/stepPresentation.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/stepPresentation.tsxindex 0b5dad62c..257b36c37 100644--- a/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/stepPresentation.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/CodeBlockNode/stepPresentation.tsx@@ -1,6 +1,6 @@import type { ReactNode } from "react";-import { type ActionType, ReadableActionTypes } from "@/api/types";+import { getReadableActionType } from "@/api/types";import { getActionTypeIcon } from "@/routes/workflows/components/actionTypeIcons";export function getStepIcon(actionType: string): ReactNode {@@ -8,7 +8,7 @@ export function getStepIcon(actionType: string): ReactNode {}export function getStepLabel(actionType: string): string {- return ReadableActionTypes[actionType as ActionType] ?? "Step";+ return getReadableActionType(actionType);}const chipTintByActionType: Record<string, string> = {@@ -23,6 +23,7 @@ const chipTintByActionType: Record<string, string> = {extract: "bg-emerald-500/10 text-emerald-300",verification_code: "bg-emerald-500/10 text-emerald-300",complete: "bg-emerald-500/10 text-emerald-300",+ execute_js: "bg-violet-500/10 text-violet-300",wait: "bg-amber-500/10 text-amber-300",solve_captcha: "bg-amber-500/10 text-amber-300",terminate: "bg-rose-500/10 text-rose-300",diff --git a/skyvern-frontend/src/routes/workflows/hooks/useTagKeysQuery.ts b/skyvern-frontend/src/routes/workflows/hooks/useTagKeysQuery.tsindex c68575701..7f75585b7 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useTagKeysQuery.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useTagKeysQuery.ts@@ -3,11 +3,12 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useQuery } from "@tanstack/react-query";import type { TagKey } from "../types/tagTypes";-function useTagKeysQuery() {+function useTagKeysQuery({ enabled = true }: { enabled?: boolean } = {}) {const credentialGetter = useCredentialGetter();return useQuery({queryKey: ["tag-keys"],+ enabled,queryFn: async () => {const client = await getClient(credentialGetter);return clientdiff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowTagsBatchQuery.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowTagsBatchQuery.tsindex e9e12b398..d984f736f 100644--- a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowTagsBatchQuery.ts+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowTagsBatchQuery.ts@@ -13,13 +13,16 @@ const BATCH_TAGS_MAX_WPIDS = 200;// One batch fetch for all visible workflows (avoids per-row N+1). Ids are sorted so// the query key is order-independent and identical sets share a cache entry.-function useWorkflowTagsBatchQuery(workflowPermanentIds: Array<string>) {+function useWorkflowTagsBatchQuery(+ workflowPermanentIds: Array<string>,+ { enabled = true }: { enabled?: boolean } = {},+) {const credentialGetter = useCredentialGetter();const sortedIds = [...workflowPermanentIds].sort();return useQuery({queryKey: ["workflow-tags", "batch", sortedIds],- enabled: sortedIds.length > 0,+ enabled: enabled && sortedIds.length > 0,queryFn: async () => {const client = await getClient(credentialGetter);const chunks: Array<Array<string>> = [];diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsxindex 6dc92abc2..822c524d6 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.test.tsx@@ -407,6 +407,70 @@ describe("WorkflowRunTimelineBlockItem", () => {).toBeTruthy();});+ it("labels a recorded page.evaluate action as Execute JS instead of a blank badge", () => {+ const block = buildBlock({+ workflow_run_block_id: "wrb_code_eval",+ block_type: "code",+ label: "run_script",+ actions: [+ {+ action_id: "wrb_code_eval_action_0",+ action_type: "execute_js",+ status: Status.Completed,+ reasoning: null,+ description: "page.evaluate () => document.title",+ output: { code_line: 3, duration_ms: 800 },+ created_by: null,+ confidence_float: null,+ },+ ] as unknown as WorkflowRunBlock["actions"],+ });++ render(+ <WorkflowRunTimelineBlockItem+ activeItem={block}+ block={block}+ subItems={[]}+ onActionClick={noop}+ onBlockItemClick={noop}+ />,+ );++ expect(screen.getByText("Execute JS")).toBeDefined();+ });++ it("humanizes an unmapped recorded action type rather than rendering a blank badge", () => {+ const block = buildBlock({+ workflow_run_block_id: "wrb_code_unmapped",+ block_type: "code",+ label: "run_script",+ actions: [+ {+ action_id: "wrb_code_unmapped_action_0",+ action_type: "go_forward",+ status: Status.Completed,+ reasoning: null,+ description: "page.go_forward",+ output: { code_line: 2, duration_ms: 100 },+ created_by: null,+ confidence_float: null,+ },+ ] as unknown as WorkflowRunBlock["actions"],+ });++ render(+ <WorkflowRunTimelineBlockItem+ activeItem={block}+ block={block}+ subItems={[]}+ onActionClick={noop}+ onBlockItemClick={noop}+ />,+ );++ expect(screen.getByText("Go Forward")).toBeDefined();+ });+it("labels the synthetic code error row as Error instead of Screenshot", () => {const block = buildBlock({workflow_run_block_id: "wrb_code_failed",diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsxindex 7b1d9b7ac..fa302bf58 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx@@ -10,7 +10,7 @@ import { useEffect, useMemo, useRef, useState } from "react";import {type ActionsApiResponse,ActionTypes,- ReadableActionTypes,+ getReadableActionType,Status,} from "@/api/types";import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible";@@ -171,7 +171,9 @@ function getCodeActionRowPresentation(const isCodeError =action.status === Status.Failed &&action.action_type === ActionTypes.NullAction;- const label = isCodeError ? "Error" : ReadableActionTypes[action.action_type];+ const label = isCodeError+ ? "Error"+ : getReadableActionType(action.action_type);const { codeLine, durationMs } = getRecordedActionMeta(action);const parts = [getActionSummary(action) ?? normalizeInlineText(action.description),@@ -459,7 +461,7 @@ function TimelineActionRows({const { label, summary } = isCodeBlock? getCodeActionRowPresentation(action): {- label: ReadableActionTypes[action.action_type],+ label: getReadableActionType(action.action_type),summary: getActionSummary(action),};diff --git a/skyvern-frontend/src/util/featureFlags.ts b/skyvern-frontend/src/util/featureFlags.tsindex 9aafb8bb6..0095f36d5 100644--- a/skyvern-frontend/src/util/featureFlags.ts+++ b/skyvern-frontend/src/util/featureFlags.ts@@ -15,6 +15,7 @@ export const ANALYTICS_DASHBOARD_FLAG = "ANALYTICS_DASHBOARD";* surfaces gate on a resolved variant (isABVariant), so 0% or rollback hides them.*/export const EDITOR_ONBOARDING_TOUR_FLAG = "EDITOR_ONBOARDING_TOUR";+export const WORKFLOW_TAGGING_FLAG = "WORKFLOW_TAGGING";// Opt-in (0% base rollout) preview gating the workflows directory-tree view.// Not enrolled reads as disabled, so the default stays the flat folders/list.diff --git a/skyvern/forge/sdk/copilot/code_block_steps.py b/skyvern/forge/sdk/copilot/code_block_steps.pyindex 05311eec7..ad9bf08b6 100644--- a/skyvern/forge/sdk/copilot/code_block_steps.py+++ b/skyvern/forge/sdk/copilot/code_block_steps.py@@ -17,6 +17,9 @@ LOG = structlog.get_logger()# Playwright/SkyvernPage method name -> step action_type (values are ActionType members;# kept as string literals so this module does not import skyvern.webeye, matching code_block_synthesis.py).+# Mirror the runtime recorder's maps (code_block_recorder._PAGE_ACTION_MAP / _LOCATOR_ACTION_MAP) so the+# static editor preview surfaces the same calls the timeline records — otherwise a recorded call (e.g.+# page.evaluate) renders in the timeline but is silently dropped from the editor step list._METHOD_ACTION_TYPES: dict[str, str] = {"goto": "goto_url","click": "click",@@ -30,8 +33,11 @@ _METHOD_ACTION_TYPES: dict[str, str] = {"press_sequentially": "input_text","select_option": "select_option","set_input_files": "upload_file",+ "hover": "hover","go_back": "go_back",+ "go_forward": "go_forward","reload": "reload_page",+ "evaluate": "execute_js","wait_for_timeout": "wait",}# Awaited calls that are sync/no-op helpers — never surfaced as their own step.@@ -126,6 +132,8 @@ def _describe(span: CodeActionSpan) -> str:return f"Open {value}" if value else "Open the page"if span.action_type == "click":return f"Click {_target_label(span.receiver, span.first_arg)}"+ if span.action_type == "hover":+ return f"Hover over {_target_label(span.receiver, span.first_arg)}"if span.action_type == "input_text":return f"Type into {_target_label(span.receiver, span.first_arg)}"if span.action_type == "select_option":@@ -139,8 +147,12 @@ def _describe(span: CodeActionSpan) -> str:return "Wait"if span.action_type == "go_back":return "Go back"+ if span.action_type == "go_forward":+ return "Go forward"if span.action_type == "reload_page":return "Reload the page"+ if span.action_type == "execute_js":+ return "Run a script"return "Run a step"diff --git a/tests/unit/test_code_block_steps.py b/tests/unit/test_code_block_steps.pyindex 4e63cd302..d7bbc688b 100644--- a/tests/unit/test_code_block_steps.py+++ b/tests/unit/test_code_block_steps.py@@ -32,6 +32,38 @@ def test_analyze_maps_playwright_calls_to_action_types_with_line_ranges():]+def test_analyze_maps_page_evaluate_and_other_recorder_calls_to_action_types():+ # The static editor preview must surface the same calls the runtime recorder+ # records (code_block_recorder._PAGE_ACTION_MAP / _LOCATOR_ACTION_MAP), so the+ # editor step count matches the timeline. page.evaluate was previously dropped.+ code = (+ "async def run(page):\n"+ " await page.goto('https://example.com/')\n"+ " await page.evaluate('() => document.title')\n"+ " await page.get_by_role('link', name='Docs').hover()\n"+ " await page.go_forward()\n"+ )+ spans = analyze_code_actions(code)+ assert [(s.action_type, s.line_start) for s in spans] == [+ ("goto_url", 2),+ ("execute_js", 3),+ ("hover", 4),+ ("go_forward", 5),+ ]+++def test_derive_steps_surfaces_page_evaluate_with_a_label():+ code = (+ "async def run(page):\n"+ " await page.goto('https://example.com/')\n"+ " await page.evaluate('() => document.title')\n"+ )+ steps = derive_code_block_steps(code)+ # Step count must match the number of actions actually in the script (2, not 1).+ assert [s["action_type"] for s in steps] == ["goto_url", "execute_js"]+ assert steps[1]["description"] # surfaced with a non-empty, human label, not dropped++def test_analyze_skips_noise_and_returns_empty_on_syntax_error():# wait_for_load_state is paired sync noise, never its own step.assert analyze_code_actions("async def run(page):\n await page.wait_for_load_state('load')\n") == []