Skip to content

[dotnet-port-api] Support optional workflow orphan validation - #1272

Merged
Quim Muntal (qmuntal) merged 3 commits into
mainfrom
dotnet-port-build-validation-20261009-a78aeaf68156c0b4
Oct 9, 2026
Merged

Quim Muntal (qmuntal) merged 3 commits into
mainfrom
dotnet-port-build-validation-20261009-a78aeaf68156c0b4

Conversation

@microsoft-agent-framework-for-go

Copy link
Copy Markdown
Contributor

Summary

Port the assessed partial Microsoft.Agents.AI.Workflows.WorkflowBuilder.Build(bool validateOrphans = true) capability. Go Builder.Build now preserves default orphan validation, accepts an optional false value to skip only orphan checks, and reports an explicit error for more than one argument. Focused tests cover both the opt-out and invalid argument count.

Ported .NET PRs

None. The contract was verified directly from pinned .NET source at 0c9944cc9f577d51277ac7c55dbc388b60a577af (Microsoft.Agents.AI.Workflows catalog version 1.22.0.0, informational version 1.22.0+0c9944cc9f577d51277ac7c55dbc388b60a577af). The pinned implementation documents Build(bool validateOrphans = true) and routes the flag to validation.

Breaking Changes

None intended. Existing Build() calls retain the default validation behavior. The compatible variadic Go signature additionally supports Build(false) and rejects multiple validation arguments explicitly.

Tests and Examples

  • go test ./workflow
  • go test ./workflow/...
  • gofmt -w workflow/builder.go workflow/builder_test.go
  • git diff --check

Notes

  • Exact catalog leaf: Microsoft.Agents.AI.Workflows.WorkflowBuilder.Build(bool) -> Workflow, assessed partial; expected post-merge assessment is mapped/covered.
  • Inventory scope reviewed against the pinned catalog report: 90 assessed gaps total (36 partial, 54 unmapped), with no unreviewed placeholders.
  • The selected candidate's fixed duplicate issue query (repo:microsoft/agent-framework-go WorkflowBuilder Build validate orphans orphan executors) and PR query (repo:microsoft/agent-framework-go WorkflowBuilder Build validateOrphans orphan executors) were run before editing and repeated before publication; both returned no results.
  • A separate edge-kind candidate was excluded because closed microsoft/agent-framework-go#1265 claims the exact public capability. An older related reference was integrity-filtered and was not used to justify this selected change.
  • The upstream declarations are not marked experimental. No catalog or mapping-guide files were changed.

Warning

Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • proxy.golang.org
  • storage.googleapis.com
  • sum.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"
    - "storage.googleapis.com"
    - "sum.golang.org"

See Network Configuration for more information.

Generated by .NET to Go API Porting Agent · copilot · gpt56 · 6.15 AIC · ⌖ 0.7 AIC · ⊞ 24.8K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added area:workflow Changes files in the workflow area size:medium At most 100 changed lines across at most 5 files kind:code Changes production behavior or code kind:tests Changes tests, fixtures, or test infrastructure labels Oct 9, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs labels Oct 9, 2026
Comment thread workflow/builder.go Outdated
// Build validates the assembled graph and returns the immutable [Workflow].
// By default, Build checks for orphaned executors. Pass false to skip that
// check while retaining all other validation.
func (wb *Builder) Build(validateOrphans ...bool) (*Workflow, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't like variadic args just to express one optional argument. Better keep Build() as is, and add a new method BuildWithOptions(opts BuildOptions). And fow now define type BuildOptions{ValidateOrphans bool}. Make Build call BuildWithOptions(BuildOptions{ValidateOrphans : true}).

@qmuntal

Copy link
Copy Markdown
Member

Copilot fix comments.

Co-authored-by: qmuntal <3747816+qmuntal@users.noreply.github.com>
@qmuntal
Quim Muntal (qmuntal) marked this pull request as ready for review October 9, 2026 06:51
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner October 9, 2026 06:51
Copilot AI balanced review requested due to automatic review settings October 9, 2026 06:51
@github-actions github-actions Bot added size:small At most 30 changed lines across at most 2 files and removed size:medium At most 100 changed lines across at most 5 files labels Oct 9, 2026

Copilot AI commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Copilot fix comments.

Updated in commit d6c4bd4: Build() retains default orphan validation, and BuildWithOptions(BuildOptions) controls it without variadic arguments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Disabling orphan checks also bypasses type-compatibility validation, and the public API differs from the PR description.

1 open finding
What changed in this PR

Adds configurable orphan validation while preserving Build() defaults.

Changes:

  • Adds BuildOptions and BuildWithOptions.
  • Tests orphan-validation opt-out behavior.
File Description
workflow/​builder.go Adds configurable validation.
workflow/​builder_test.go Tests skipping orphan checks.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread workflow/builder.go
Co-authored-by: qmuntal <3747816+qmuntal@users.noreply.github.com>
@github-actions github-actions Bot added size:medium At most 100 changed lines across at most 5 files and removed size:small At most 30 changed lines across at most 2 files labels Oct 9, 2026
@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

API consistency review

Result Scope
aligned public API

Changed Go contract

workflow.Builder.Build() (*Workflow, error) is unchanged in signature and default behavior (orphan validation still runs). A new BuildOptions struct (DisableOrphanValidation bool) and Builder.BuildWithOptions(BuildOptions) (*Workflow, error) method were added. Build() now delegates to BuildWithOptions(BuildOptions{}), so the zero-value default (DisableOrphanValidation: false) preserves orphan-executor validation. Passing BuildOptions{DisableOrphanValidation: true} skips only the orphan-reachability check; unbound-executor, output-executor, and type-compatibility validation still run unconditionally in all cases.

Upstream evidence reviewed

Implementation Source Contract checked
.NET WorkflowBuilder.Build(bool validateOrphans = true) and Validate(bool validateOrphans) (same file, ~L543) Default-on orphan validation (validateOrphans = true), explicit opt-out via false, and that unbound-executor checks and other validation run regardless of the flag

No Python WorkflowBuilder/graph-builder equivalent with a validate_orphans-style parameter was found, consistent with this being a .NET-only pinned port with no Python counterpart.

Assessment

This revision supersedes the earlier variadic-...bool design (flagged for fix-up by the maintainer) with an explicit BuildOptions struct and BuildWithOptions method — a pattern consistent with existing Go option-struct conventions in this package (e.g. TelemetryOptions). The zero-value struct correctly maps to .NET's validateOrphans: true default, so Build() callers see no behavior change, and BuildWithOptions(BuildOptions{DisableOrphanValidation: true}) is the faithful equivalent of Build(validateOrphans: false). All other validation remains unconditional on both sides. Build and tests (go build ./..., go test ./workflow/...) pass; gofmt/go vet are clean. No parity issues found.

Warning

Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • proxy.golang.org
  • storage.googleapis.com
  • sum.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"
    - "storage.googleapis.com"
    - "sum.golang.org"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent for #1272 · copilot · auto · 102.7 AIC · ⌖ 9.59 AIC · ⊞ 13.9K · ◷

Merged via the queue into main with commit 5a63321 Oct 9, 2026
28 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the dotnet-port-build-validation-20261009-a78aeaf68156c0b4 branch October 9, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workflow Changes files in the workflow area kind:code Changes production behavior or code kind:tests Changes tests, fixtures, or test infrastructure parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs size:medium At most 100 changed lines across at most 5 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants