Catalog follow-ups: total_activity_count in Starlark, one workflow walk, commit ref kind (#963) - #964
Merged
Merged
Conversation
…structure and the catalog (#963) list workflows and show structure recursed over outcome flows only and skipped boundary-event flows and event sub-processes, so TestApp Workflow1 listed 5 activities where the catalog counted 8. The catalog's walk moves to wfnames.WalkActivities/CountActivities and all three use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g create/change (#963) commit $Order on a loop variable wrote no refs row because refs had no commit kind. A commit action, or a create/change with commit Yes/YesWithoutEvents, now emits FLOW -> ENTITY 'commit', resolved through the same intra-flow variable map as change/delete. It stays out of the analysis graph and the caller kinds. The ref_kind skill test now reads every RefKind constant, so a new kind cannot ship undocumented. Catalog schema version 19. 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.
Closes #963 — all three items.
1.
total_activity_countin StarlarkThe microflow struct
microflows()yields (microflows, nanoflows and rules share it) gainstotal_activity_count, the catalog'sTotalActivityCount(loop bodies included, since #940).activity_countis unchanged and now says in the skill that a loop counts as one. Documented inwrite-lint-rules/SKILL.md(the coverage test enforces it). The hand-builtmicroflowstables in four linter tests gained the column.2. One workflow walk for
list workflows,show structureand the catalogThe catalog's walk (#937) moves to
mdl/backend/wfnamesasWalkActivities/CountActivities. Both catalog and executor already import that package, so there is no cycle.countFlowActivities(cmd_workflows.go) andcountStructureFlowActivities(cmd_structure.go) are gone. Each had its own recursion over outcomes only, which skipped boundary-event flows and event sub-processes. TestAppWorkflow1now lists 8 activities (it listed 5);Workflow1_2, which has no boundary events, still lists 4.3. Decision:
commitbelongs in refs → newcommitref kindReasoning.
refsalready records how a flow acts on an entity:create,retrieve,change,delete. Commit is the remaining data action, and it is the one the lint asks in mendixlabs#1266 / mendixlabs#1267 start from ("which flows commit entity X", commit in a loop, commit without events). Without an edge,refs_to("M.Order")cannot answer that question, and the only workaround is joiningactivitiesto a variable's type, which the catalog does not store. The variable→entity resolutionchange/deleteuse already exists (loop iterators included, per mendixlabs#1266), socommitgets it at no extra cost.What is emitted.
commit(FLOW → ENTITY) comes from:Yes/YesWithoutEvents.For a committing create or change, the
commitedge is added beside itscreate/changeedge, not instead of it, so existingcreate/changequeries are unchanged. A variable whose entity the flow cannot tell gets no edge, as for change and delete.Consumers checked:
show callersexcludes it. Commit is a use of a type, not an invocation, like create/change/delete; the comment incmd_search.gonow says so.graph_dead_assetsgains inbound edges to entities, which is correct: a committed entity is in use.graphRefKindsexcludes it. The committed variable comes from a parameter, create or retrieve that already links the flow to the entity, so including it would mostly double edge weights and shift communities and centrality.Docs. The skill's
ref_kindrow and thecatalog-schema.mdRefKind table are updated.TestSkillDocumentsRealRefKindsnow reads everyRefKind*constant frombuilder_references.goand requires each one to be documented. It previously checked only that the documented kinds exist, so a new kind could ship undocumented. Catalog schema version 19,19 (commit refs):.Test plan
go test ./mdl/catalog/... ./mdl/linter/... ./mdl/backend/wfnames/ ./mdl/executor/ ./cmd/mxcli/: all okmake build,make lint(Go + TS),make check-conformance,make check-findings: passItem 1:
TestStarlarkTotalActivityCountuses a microflow, nanoflow and rule with loops (total > top level) and a flat microflow as the control (equal). Revert check: without the struct field the rule fails with"microflow" struct has no .total_activity_count attribute. Removing the skill line failsTestLintSkillDocuments*. End to end, I ran a custom.starrule throughmxcli linton a TestApp copy withLp.MF_Loop(top=1 total=3) andLp.MF_Flat(top=2 total=2).Item 2:
TestCountWorkflowActivities_BoundaryAndEventSubProcessuses a hand-built workflow with a boundary event and an ESP, plus an outcomes-only control.TestCountWorkflowActivities_TestAppWorkflow1checks that Workflow1 = 8 and that the counts agree for every workflow. Both written first: before the fix they failed with(2,1,1)andWorkflow1 activities = 5, while the control passed.mxcli list workflowson a TestApp copy shows 8 / 4.Item 3:
TestCommitEmitsCommitRefsruns a full catalog build over a mock backend and covers:YesWithoutEventson an iteratorNo(it keeps create/change edges and gets no commit edge)Revert check: with the emit line stubbed out, the test fails and lists only the create/change rows. End to end, on a TestApp copy, a
.starrule callingrefs_to("Lp.Item")throughmxcli lintshowsLp.MF_CommitEach commit Lp.Item(loop $It in $Items begin commit $It; end loop;); the non-committingchangeflows get no commit row.Findings appended to
mdl-executor.jsonl(item 2, a duplicate-resolver-drift instance) andmdl-other.jsonl(item 3). CHANGELOG entries are under Unreleased.🤖 Generated with Claude Code