Skip to content

feat: add SHOW ACCESS ON NANOFLOW and DESCRIBE MERMAID for nanoflows#9

Closed
retran wants to merge 3 commits intopr5-nanoflows-call-grantfrom
pr6-nanoflows-show-mermaid
Closed

feat: add SHOW ACCESS ON NANOFLOW and DESCRIBE MERMAID for nanoflows#9
retran wants to merge 3 commits intopr5-nanoflows-call-grantfrom
pr6-nanoflows-show-mermaid

Conversation

@retran
Copy link
Copy Markdown
Owner

@retran retran commented Apr 23, 2026

Summary

  • Add SHOW ACCESS ON NANOFLOW Module.Name — displays allowed module roles table (mirrors microflow pattern)
  • Add DESCRIBE MERMAID NANOFLOW Module.Name — renders nanoflow as Mermaid flowchart
  • Refactor renderMicroflowMermaidrenderFlowMermaid accepting *MicroflowObjectCollection to share rendering between microflows and nanoflows

Why

Completes the nanoflow feature surface for the CLI. Without SHOW ACCESS, users cannot inspect nanoflow security grants. Without DESCRIBE MERMAID, nanoflow visualization is unavailable — both are already supported for microflows and pages.

Changes

  • Grammar: Added SHOW ACCESS ON NANOFLOW qualifiedName rule
  • AST: Added ShowAccessOnNanoflow enum constant
  • Visitor: Added NANOFLOW branch in ACCESS dispatch
  • Executor: Added listAccessOnNanoflow (cmd_security.go), nanoflowToMermaid + shared renderFlowMermaid (cmd_mermaid.go)
  • Test: Updated unsupported-type test to use "workflow" instead of "nanoflow"

9 files changed. make build && make test && make lint-go pass.

Copilot AI review requested due to automatic review settings April 23, 2026 16:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the CLI’s nanoflow feature set to match existing microflow/page capabilities by adding nanoflow security inspection and Mermaid visualization, and refactors Mermaid rendering to share flowchart generation logic.

Changes:

  • Added grammar + AST + visitor + executor support for SHOW ACCESS ON NANOFLOW Module.Name.
  • Added DESCRIBE MERMAID NANOFLOW Module.Name with a new nanoflowToMermaid executor path.
  • Refactored microflow Mermaid rendering into a shared renderFlowMermaid that operates on an object collection.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mdl/grammar/MDLParser.g4 Adds SHOW/LIST ACCESS ON NANOFLOW qualifiedName grammar rule.
mdl/visitor/visitor_query.go Adds NANOFLOW dispatch for SHOW ACCESS statement building.
mdl/ast/ast_query.go Adds ShowAccessOnNanoflow enum + string name.
mdl/executor/executor_query.go Routes new show object type to listAccessOnNanoflow.
mdl/executor/cmd_security.go Implements listAccessOnNanoflow (mirrors microflow/page access listing).
mdl/executor/cmd_mermaid.go Adds nanoflow Mermaid support and refactors to shared flow renderer.
mdl/executor/cmd_mermaid_mock_test.go Updates unsupported-type test now that nanoflow Mermaid is supported.
Comments suppressed due to low confidence (1)

mdl/executor/cmd_mermaid.go:289

  • renderFlowMermaid builds an activityMap but then immediately assigns it to '_' and never reads it. This is dead code and adds unnecessary work; either remove the map entirely or use it where intended (e.g., for lookups in label/detail generation).
	activityMap := make(map[model.ID]microflows.MicroflowObject)
	var startID model.ID

	for _, obj := range allObjects {
		activityMap[obj.GetID()] = obj
		if _, ok := obj.(*microflows.StartEvent); ok {
			startID = obj.GetID()
		}
	}
	_ = activityMap // used for reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +404 to +408
// listAccessOnNanoflow handles SHOW ACCESS ON NANOFLOW Module.NF.
func listAccessOnNanoflow(ctx *ExecContext, name *ast.QualifiedName) error {
if name == nil {
return mdlerrors.NewValidation("nanoflow name required")
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listAccessOnNanoflow introduces a new SHOW ACCESS code path but there is no corresponding mock test (cmd_security_mock_test.go covers microflow/page/workflow). Please add tests for JSON + text output and the not-found case to prevent regressions.

Copilot uses AI. Check for mistakes.
Comment on lines +333 to +337
} else if ctx.NANOFLOW() != nil {
b.statements = append(b.statements, &ast.ShowStmt{
ObjectType: ast.ShowAccessOnNanoflow,
Name: &name,
})
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this new NANOFLOW branch, the inline comment above the ACCESS handler still says it only supports MICROFLOW|PAGE. Please update that comment to include NANOFLOW (and any other supported types) so it matches the actual dispatch logic.

Copilot uses AI. Check for mistakes.
Comment on lines +238 to +246
// Build entity name lookup
entityNames := make(map[model.ID]string)
domainModels, _ := ctx.Backend.ListDomainModels()
for _, dm := range domainModels {
modName := h.GetModuleName(dm.ContainerID)
for _, entity := range dm.Entities {
entityNames[entity.ID] = modName + "." + entity.Name
}
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nanoflowToMermaid duplicates the entity name lookup logic used in microflowToMermaid. Consider extracting a shared helper (e.g., buildEntityNames(ctx,h)) to avoid divergence and keep behavior consistent across flow types.

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +41
case "nanoflow":
return nanoflowToMermaid(ctx, qn)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new nanoflow Mermaid support is not covered by tests in cmd_mermaid_mock_test.go (there are already mock tests for domainmodel/microflow). Please add a mock test for describeMermaid("nanoflow", "Module.Name") similar to the microflow test to validate the new code path.

Copilot uses AI. Check for mistakes.
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 2dee3d2 to 54a9353 Compare April 23, 2026 16:50
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from 9b468e7 to 5c414e7 Compare April 23, 2026 19:35
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 82247b4 to 2183899 Compare April 23, 2026 19:42
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from 5c414e7 to f048afd Compare April 23, 2026 19:42
@retran retran requested a review from Copilot April 23, 2026 19:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +238 to +242
// Build entity name lookup
entityNames := make(map[model.ID]string)
domainModels, _ := ctx.Backend.ListDomainModels()
for _, dm := range domainModels {
modName := h.GetModuleName(dm.ContainerID)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx.Backend.ListDomainModels() errors are being ignored here, which can hide backend failures and lead to incomplete entity name resolution in the rendered diagram. Handle the error and return a backend error (consistent with other backend calls in this function).

Copilot uses AI. Check for mistakes.
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 2183899 to bcb19c0 Compare April 23, 2026 20:11
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from f048afd to 48101b5 Compare April 23, 2026 20:11
@retran retran force-pushed the pr5-nanoflows-call-grant branch from bcb19c0 to dd4df09 Compare April 23, 2026 20:28
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch 2 times, most recently from 3fbc371 to 3eff26d Compare April 24, 2026 08:34
@retran retran force-pushed the pr5-nanoflows-call-grant branch 2 times, most recently from 8193fb6 to eafe7cb Compare April 24, 2026 08:41
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from 3eff26d to 9472857 Compare April 24, 2026 08:41
@retran retran force-pushed the pr5-nanoflows-call-grant branch from eafe7cb to 802ca63 Compare April 24, 2026 08:44
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from 9472857 to 613df56 Compare April 24, 2026 08:44
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 802ca63 to 6c052e2 Compare April 24, 2026 08:58
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch 2 times, most recently from c35f9e7 to 987d208 Compare April 24, 2026 09:21
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 6c052e2 to 638be11 Compare April 24, 2026 09:21
@retran retran force-pushed the pr5-nanoflows-call-grant branch from 638be11 to ca2a5b6 Compare April 24, 2026 09:37
@retran retran force-pushed the pr6-nanoflows-show-mermaid branch from 987d208 to 43f3066 Compare April 24, 2026 09:37
@retran
Copy link
Copy Markdown
Owner Author

retran commented Apr 24, 2026

Superseded by #10 (consolidated nanoflow PR)

@retran retran closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants