Repository navigation
FE-1895: Load Flow definitions from the graph in the frontend - #10073
Conversation
…d a run's workflow from its entity
…so its workflow id
…e code only the flow ids
…ted, so a retry or reset executes the edition the run is drawn with
…her than each place handling the separator itself
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Workflow execution is aligned with that UI: Call sites that only needed stable IDs now import
Flow run UI status handling is updated so multiple runs per step inside a Reviewed by Cursor Bugbot for commit 4cabb0a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #10073 +/- ##
==========================================
- Coverage 68.13% 68.13% -0.01%
==========================================
Files 1995 1997 +2
Lines 205555 205567 +12
Branches 8707 8711 +4
==========================================
+ Hits 140065 140071 +6
- Misses 63826 63833 +7
+ Partials 1664 1663 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🔵 Needs a closer look
Historical-edition consistency across workflow retries, resets, graph queries, and frontend rendering needs final human verification.
No open issues 🎉
What changed in this PR
Builds on #10057 by replacing frontend hardcoded flow definitions with graph-backed definitions and selecting historical editions for runs.
Changes:
- Loads current definitions for browsing and historical definitions for execution and visualization.
- Centralizes seeded flow IDs and per-item step-run ID helpers.
- Aggregates
for-eachstep statuses and adds focused tests.
| File | Description |
|---|---|
libs/@local/hash-isomorphic-utils/src/flows/validate-flow-definition.test.ts |
Updates definition imports. |
libs/@local/hash-isomorphic-utils/src/flows/step-run-id.ts |
Adds shared step-run ID helpers. |
libs/@local/hash-isomorphic-utils/src/flows/flow-definition-schema.ts |
Uses the shared ID separator. |
libs/@local/hash-isomorphic-utils/src/flows/flow-definition-ids.ts |
Centralizes seeded flow IDs. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/integration-flow-definitions.ts |
Uses centralized aviation flow IDs. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/goal-flow-definitions.ts |
Uses the centralized goal ID. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/ftse-investors-flow-definition.ts |
Uses the centralized fixture ID. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/frontend-flow-definitions.ts |
Uses centralized dashboard flow IDs. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/file-flow-definitions.ts |
Uses the centralized document flow ID. |
libs/@local/hash-isomorphic-utils/src/flows/definitions/browser-plugin-flow-definitions.ts |
Uses centralized browser flow IDs. |
libs/@local/hash-backend-utils/src/flows/shared/get-flow-definition-entity-by-id.ts |
Supports historical definition queries. |
libs/@local/hash-backend-utils/src/flows/process-flow-workflow/pass-outputs-to-unprocessed-steps.ts |
Uses shared branch ID parsing. |
libs/@local/hash-backend-utils/src/flows/process-flow-workflow/get-step-definition-from-flow.ts |
Uses shared step-run ID parsing. |
libs/@local/hash-backend-utils/src/flows/process-flow-workflow/common-activities/get-flow-definition-activity.ts |
Loads definitions at a supplied timestamp. |
libs/@local/hash-backend-utils/src/flows/process-flow-workflow.ts |
Supplies workflow start time and uses ID helpers. |
libs/@local/hash-backend-utils/src/flows/payload-storage.test.ts |
Constructs test IDs with shared helpers. |
apps/plugin-browser/src/scripts/background/infer-entities.ts |
Uses centralized inference flow IDs. |
apps/plugin-browser/src/pages/popup/popup-contents/action-center/shared/use-flow-runs.ts |
Filters runs using centralized IDs. |
apps/plugin-browser/src/pages/popup/popup-contents/action-center/history/shared/table-label.tsx |
Builds links using centralized IDs. |
apps/plugin-browser/src/pages/popup/popup-contents/action-center/history/manually-triggered.tsx |
Uses the centralized manual flow ID. |
apps/plugin-browser/src/pages/popup/popup-contents/action-center/history/automatically-triggered.tsx |
Uses the centralized automatic flow ID. |
apps/hash-frontend/src/pages/workers.page/flow-run-table.tsx |
Updates the goal identification import. |
apps/hash-frontend/src/pages/shared/use-flow-definitions.ts |
Adds current and historical graph-loading hooks. |
apps/hash-frontend/src/pages/shared/flow-runs-context.ts |
Aggregates per-item step statuses. |
apps/hash-frontend/src/pages/shared/flow-runs-context.test.ts |
Tests aggregation and displayed-run selection. |
apps/hash-frontend/src/pages/shared/flow-definitions-context.ts |
Documents graph-backed context data. |
apps/hash-frontend/src/pages/shared/flow-definitions-context-provider.tsx |
Provides graph results and loading state. |
apps/hash-frontend/src/pages/goals/new.page.tsx |
Starts goals using the centralized ID. |
apps/hash-frontend/src/pages/goals.page/goals-list.tsx |
Updates the goal identification import. |
apps/hash-frontend/src/pages/flows.page.tsx |
Updates the goal identification import. |
apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-config.ts |
Starts dashboard flows using centralized IDs. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/swimlane.tsx |
Supplies parent IDs for status aggregation. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/outputs.tsx |
Updates the goal identification import. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/flow-run-sidebar/group-status.tsx |
Includes parent steps in group status inputs. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/flow-run-sidebar.tsx |
Updates goal helper and type imports. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/dag-slide.tsx |
Updates the goal identification import. |
apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer.tsx |
Draws runs using historical definitions. |
apps/hash-api/src/graphql/resolvers/knowledge/file/shared.ts |
Starts document flows using the centralized ID. |
apps/hash-api/src/graph/ensure-system-graph-is-initialized/migrate-ontology-types/seeded-flows.ts |
Updates relocated seed definition imports. |
apps/hash-api/src/graph/ensure-system-graph-is-initialized/migrate-ontology-types/seeded-flows.test.ts |
Updates relocated test imports. |
apps/hash-api/src/graph/ensure-system-graph-is-initialized/migrate-ontology-types/dev-flows.ts |
Updates relocated development flow imports. |
apps/hash-api/src/ai/infer-entities-websocket/handle-infer-entities-request.ts |
Uses centralized inference flow IDs. |
apps/hash-ai-worker-ts/src/activities/shared/get-flow-context.ts |
Updates the goal input type import. |
apps/hash-ai-worker-ts/src/activities/flow-activities/generate-flow-run-name-activity.ts |
Uses centralized flow identification. |
Review effort: Balanced
… so for scheduled runs
…into cm/fe-1895-load-flow-definitions-from-graph
…into cm/fe-1895-load-flow-definitions-from-graph
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 22fcdc7. Configure here.
…ow-definitions-from-graph # Conflicts: # libs/@local/hash-backend-utils/src/flows/process-flow-workflow.ts
…sed by its runs per item
…graph # Conflicts: # libs/@local/hash-isomorphic-utils/src/flows/flow-definition-schema.ts

🌟 Purpose
We started storing Flow Definitions in the Graph in #10057, but the frontend is still reading the seeded system/example flows from code. This PR fixes that to make the FE load them from the Graph instead.
Flow Definitions can also change over time, and the latest definition may not be the one a run used. So we load definitions both in the FE and when fetching them in workflows as they were at the time that the workflow run started (i.e. the entity edition current at the time of workflow start).
Somewhat tangentially the PR also fixes:
~, but this was scattered across the codebase.forEachsteps in flow runs🔍 Changes
Key changes.
pages/shared/use-flow-definitions.tsflow-definitions-context-provider.tsxflow-visualizer.tsxget-flow-definition-activity.ts,process-flow-workflow.tsflow-runs-context.ts,swimlane.tsx,group-status.tsx,flows/step-run-id.tsfor-each, whose runs are named per item, with shared helpers for those names.libs/@local/hash-isomorphic-utils/src/flows/step-run-id.ts/flows, because it isn't seeded: it's a test fixture forforEachsteps. The aviation flows are only listed in development, where the API seeds them.for-eachstep's own box in the swimlane shows no status. We will be replacing this UI anyway and will account for it then.