Repository navigation
feat(catalog): workflow activities with their kind and slots for lint rules (#1295) - #2164
Merged
Merged
Conversation
… rules (#1295) A lint rule could not ask which kind of workflow activity runs a microflow — "a system task's microflow is prefixed WF_SYS_", "a user task's targeting microflow WF_TGT_" — because refs records only that the workflow calls the microflow, and workflows_data only counts activities. CATALOG.WORKFLOW_ACTIVITIES holds one row per activity of a workflow, boundary-event paths and event sub-processes included, with its kind (MultiUserTask and AIAgentTask told apart from UserTask and CallMicroflow) and the microflow, page or workflow each slot names; an empty slot is NULL. It is written by every build. workflows() and workflow_activities() expose workflows_data and the new table to Starlark rules. Catalog schema 48. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1295 (mendixlabs#1269). This adds the workflow row of the issue's table. The published web services row is still open; see Not covered.
Problem
The issue's last row asks for a rule like "microflows used in workflows must use a prefix per role (user task, system task, …)". After the first round (#1314 and the workflow refs fix), the catalog still couldn't answer it:
refsrecords onlyWORKFLOW → MICROFLOW call, not which activity, or which slot of it, runs the microflow;workflows_dataonly counts activities;Change
CATALOG.WORKFLOW_ACTIVITIES(mdl/catalog/builder_workflow_activities.go): one row per activity, in walk order: the main flow, each activity followed by the paths of its boundary events, then the event sub-processes. This is the same walk the activity counts and refs use.ActivityType): the kindworkflows_datacounts. Two pairs that share a Go type are told apart:MultiUserTaskfromUserTask, andAIAgentTaskfromCallMicroflow.Microflow(system task, call microflow, AI agent task),UserSourceMicroflow,OnCreatedMicroflow,CompletionMicroflow,Page,UserTaskEntityandCalledWorkflow.''#2093).workflows_data; model-quality rules run on a fast catalog.mdl/linter):workflows()returns the user's workflows, with parameter entity and activity counts;workflow_activities()returns the activities above;--document;Evidence
Tests:
TestWorkflowActivityRows_KindAndSlots_Issue1295: runs on the fixture with a distinct target in every slot. The 12 rows come out in walk order, each kind and slot as expected, boundary-event paths and the event sub-process included.TestTestApp_WorkflowActivitiesInFastBuild_Issue1295: a real fast build of TestApp.workflow.UserTaskEventHandleis the on-created microflow of a user task; no slot stores''; and each workflow'sActivityCountequals its number of rows.TestWorkflowActivities_PrefixPerRole_Issue1295: the issue's rule, written in Starlark againstworkflows()andworkflow_activities(). It flags the system task'sBookOrderand the on-createdNotify, and passesWF_SYS_MailandWF_TGT_Managers.TestIterators_ExcludePlatformModules: now also covers both iterators. It includes its own control that the iterators return the user's rows.TestBuiltinModesCoverEveryPredeclared/TestDetectedModeMatchesBuiltinModespass.Control: with the builder call removed, the TestApp test fails with "no activity has workflow.UserTaskEventHandle as its on-created microflow".
On TestApp through the CLI:
select ActivityType, count(*) from CATALOG.WORKFLOW_ACTIVITIES group by ActivityTypegives:The user task shows
workflow.UserTaskPageand its on-created microflow, and each AI agent task itsworkflow.InvokeAgent.Docs:
docs-site/src/tools/catalog-tables.mdgains a section for the table, with an example query; the query runs on TestApp;catalog-tables.mddocuments theworkflowandworkflow_activityfields;Local checks:
make fmt-check lintpass.make ci-localpasses apart fromcheck-skill-pack-js, which needsnode(not installed here).check-skill-mdl,check-conformance,check-migration-referenceandcheck-mdlpass.Not covered
WebServices$PublishedWebService. The generated types exist (modelsdk/gen/webservices), but without a document Studio Pro wrote, I can't check what the reader would decode. A small.mpr, or a module export with one published web service of two operations, would unblock it.🤖 Generated with Claude Code