maf-fan-out-validator
Skill14 starsChanged 4 months agoMITView on GitHub
Validates fan-out / fan-in workflow topology — detects the silent fan-in starvation pattern (handlers returning void / non-generic Task that produce no downstream message). Canonical rules + procedure for what the compiler cannot catch and the build cannot surface.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- cs0618-hunterSkill
- dotnet-inspectSkill
- maf-anti-pattern-scannerSkill
- maf-doctor-self-evolutionSkill
- maf-from-semantic-kernelSkill
- maf-issue-reporterSkill
- maf-migration-guideSkill
- maf-migration-plan-creatorSkill
- maf-migration-retrospectiveSkill
- maf-obsolete-api-registrySkill
- maf-release-watcherSkill
- maf-remediation-playbookSkill
- maf-workflow-smoke-testerSkill
- nuget-diff-analyzerSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
When the MCP tools are unavailable, walk every MethodDeclarationSyntax in the codebase that has [MessageHandler] and inspect its ReturnType.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
fan-out-validator — silent fan-in starvation detection
⚡ Prefer the MCP tools. The
maf-autopilotMCP server exposes:
MafValidateFanOut(repoPath)— Roslyn syntax walk; flags any[MessageHandler]returningvoid/ non-genericTask/ValueTask(the silent-starvation patterns).MafSimulateWorkflow(repoPath)— builds the full executor topology graph (fan-out + fan-in edges resolved through variable bindings), emits a Mermaid diagram, and gives an end-to-end completion forecast.Use both:
MafValidateFanOutfor per-handler verdicts,MafSimulateWorkflowfor "would this workflow complete?"This skill formerly had a sibling
fan-in-static-analyzerthat walked the same patterns by hand; both have been merged here now that the MCP tools cover the procedural work.
The bug class — "silent fan-in starvation"
A fan-out executor's [MessageHandler] method MUST return one of:
Task<TMessage>ValueTask<TMessage>IAsyncEnumerable<TMessage>(streaming)
A handler that returns void, Task, or ValueTask (non-generic) produces no output message. The fan-in barrier on the downstream edge then starves silently — the workflow exits cleanly but incompletely.
This is NOT a build error. dotnet build is clean. Tests that don't exercise the fan-in path are clean. The bug only surfaces in production traces (or with one of the tools above).
Return-type verdict table
| Return type | Verdict | Why |
Task<TMessage>, ValueTask<TMessage> | ✅ OK | Produces a downstream message |
IAsyncEnumerable<TMessage> | ✅ OK (streaming pattern) | Produces a stream of messages |
void | ❌ SILENT_STARVATION_RISK | No completion signal AND no message |
Task, ValueTask (non-generic) | ❌ SILENT_STARVATION_RISK | Completes but emits nothing |
int, string, raw concrete types | ⚠ LIKELY_INVALID | Cannot satisfy MAF's fan-out contract |
Fan-in argument-order rule
The canonical 1.3.0 form of AddFanInBarrierEdge is:
builder.AddFanInBarrierEdge(
new[] { sourceA, sourceB, sourceC }, // sources first (IEnumerable<ExecutorBinding>)
target); // target last (single ExecutorBinding)The legacy (target, sources) overload is [Obsolete] in 1.3.0 — triggers CS0618. The compiler catches that one. (See registry entry MAF130-FAN-IN-001.)
Manual fallback
When the MCP tools are unavailable, walk every MethodDeclarationSyntax in the codebase that has [MessageHandler] and inspect its ReturnType. Apply the verdict table above. Cross-reference each fan-out edge against the producing executor's handler.
Companion analyzer (write-time enforcement)
The maf-doctor.Analyzers NuGet package ships MAF001 (Error severity) for exactly this pattern — [MessageHandler] returning a non-generic awaitable. Add <PackageReference Include="maf-doctor.Analyzers" /> to your project to catch this at write-time, before commit.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

