Skip to content

[dotnet-code] Extract portable builtin decode helper #839

Description

@github-actions

Summary

Extracted delayed portable-value builtin decoding into a small unexported helper. This keeps builtin/system type normalization separate from runtime type lookup, matching the structure of the .NET portable value normalization path and making future .NET-to-Go ports easier to compare without changing behavior.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/PortableValueExtensions.cs - separates portable value normalization for system primitives from other value shapes before evaluation.

Public API and Behavior

No public Go API changed. No intentional behavior change was made.

Tests

  • go test ./workflow

Notes

Rejected candidates:

  • dotnet/src/Microsoft.Agents.AI.Hosting/NoopAgentSessionStore.cs - no small corresponding Go session-store cleanup was available without introducing new API or behavior.
  • dotnet/src/Microsoft.Agents.AI.Abstractions/AIAgentMetadata.cs - Go already exposes provider naming through existing agent internals; adding metadata would affect public API shape.
  • dotnet/src/Microsoft.Agents.AI.Declarative/Extensions/McpServerToolExtensions.cs - the Go hosted MCP mapping was already localized in provider conversion code, and further changes risked provider behavior churn.

Generated by .NET-to-Go Code Portability Refactoring Agent · gpt55 · 92 AIC · ⌖ 16.2 AIC · ⊞ 23.2K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-code-portable-decode-helper-d706ecd2d2045d82.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (103 of 103 lines)
From ab7fcee5ce43313e53ed55ab2c4771cf02ded2fe Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 12 Aug 2026 22:35:44 +0000
Subject: [PATCH] Extract portable builtin decode helper

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/portable.go | 71 +++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 31 deletions(-)

diff --git a/workflow/portable.go b/workflow/portable.go
index 05bd5c02a..885de2284 100644
--- a/workflow/portable.go
+++ b/workflow/portable.go
@@ -74,37 +74,8 @@ func (v *PortableValue) Any() any {
 }
 
 func decodeKnownPortableType(typeID TypeID, raw json.RawMessage) (any, bool) {
-	if typeID.PackageName == "" {
-		switch typeID.TypeName {
-		case "string":
-			return decodePortableJSON[string](raw)
-		case "bool":
-			return decodePortableJSON[bool](raw)
-		case "int":
-			return decodePortableJSON[int](raw)
-		case "int8":
-			return decodePortableJSON[int8](raw)
-		case "int16":
-			return decodePortableJSON[int16](raw)
-		case "int32":
-			return decodePortableJSON[int32](raw)
-		case "int64":
-			return decodePortableJSON[int64](raw)
-		case "uint":
-			return decodePortableJSON[uint](raw)
-		case "uint8":
-			return decodePortableJSON[uint8](raw)
-		case "uint16":
-			return decodePortableJSON[uint16](raw)
-		case "uint32":
-			return decodePortableJSON[uint32](raw)
-		case "uint64":
-			return decodePortableJSON[uint64](raw)
-		case "float32":
-			return decodePortableJSON[float32](raw)
-		case "float64":
-			return decodePortableJSON[float64](raw)
-		}
+	if decoded, ok := decodeBuiltinPortableType(typeID, raw); ok {
+		return decoded, true
 	}
 	if typ, ok := runtimeTypeForTypeID(typeID); ok {
 		if decoded, ok := decodePortableJSONType(typ, raw); ok {
@@ -114,6 +85,44 @@ func decodeKnownPortableType(typeID TypeID, raw json.RawMessage) (any, bool) {
 	return nil, false
 }
 
+func decodeBuiltinPortableType(typeID TypeID, raw j
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions