Skip to content

land kanban 584 - #408

Merged
StevenTCramer merged 6 commits into
feature/generator-fixes-2026-11-14from
task/585-anonymous-type-handler-return-breaks-the-build-in
Nov 14, 2026
Merged

StevenTCramer merged 6 commits into
feature/generator-fixes-2026-11-14from
task/585-anonymous-type-handler-return-breaks-the-build-in

Conversation

@StevenTCramer

Copy link
Copy Markdown
Contributor

Summary

Anonymous-type handler results now build and print through ToString().

  • source/timewarp-nuru-analyzers/generators/models/result-value-kind.cs: new ResultValueKind.Anonymous,
    set by ResultValueKinds.Of when the symbol is or contains an anonymous type (type argument, array
    element, containing type; semantic check via ITypeSymbol.IsAnonymousType). CanBeNull keeps the null
    guard for it.
  • handler-extractor.method-symbols.cs: one ValueReturnType helper for method symbols and inferred lambda
    returns. An anonymous result's type name becomes global::System.Object (Task when async), so the
    local function, the result local and the __invocation.Result cast all compile (object accepts the value).
  • handler-invoker-emitter.output.cs: GetOutputStrategy returns Raw for Anonymous (ToString(), no JSON
    try/catch); capabilities describe the return as System.Object, kind Primitive (same strategy call).
  • GenerateNuruJsonContextTask.Extraction.cs: GetReturnTypeName returns null for Anonymous, so no
    [JsonSerializable] is written for it (the root cause of the reported CS1001/CS1525 cascade).
  • documentation/user/features/output-handling.md: the note now says new { ... } builds and prints via
    ToString(); return a named record or class for JSON.
  • Test: tests/timewarp-nuru-tests/routing/routing-40-anonymous-type-results.cs (runs in the CI multi-mode
    assembly, which also runs the JSON context MSBuild task): sync query, async block body, List<anon>,
    command, and a null anonymous result.
  • Known limits: a List<anon> prints its CLR type name (List1[...]), as ToString()` does; JSON output still
    needs a named type.

    Gates

    • ./bin/dev build — pass (Build completed successfully).
    • ./bin/dev test — pass (runfile cache cleared first; 4705 tests passed, 0 failed, standalone phase 0 failed;
      routing-40 5/5).
    • ganda repo audit — pass after ganda repo audit --fix for the advisory vscode-window-icon warning
      (git-ignored file only); rerun: "Repository passes all audit checks." The commit-hook attest then failed
      runfile-executable (routing-40 lacked the executable bit); set it, and ganda repo audit passes again.

    Test plan

    Smoke:

    ganda runfile cache --clear
    (cd tests/timewarp-nuru-tests/routing && dotnet run routing-40-anonymous-type-results.cs)

    Expect: the file builds (no CS1001/CS1525 from NuruUserTypesJsonContext.g.cs or NuruGenerated.g.cs), and
    all 5 tests pass; atr-info prints { Name = MyApp, Version = 1.0.0 }, atr-async 2 prints { Count = 2 },
    atr-cmd prints { Ok = True }, and atr-none prints nothing.

    Kanban task 585
    Session: 1411579

StevenTCramer and others added 6 commits November 14, 2026 14:03
Land-Holder: cramer
A handler returning new { ... } wrote the anonymous display name into the
generated NuruUserTypesJsonContext and into the invoker's result local and
local-function return type, so the consumer build failed (CS1001, CS1525).

ResultValueKind.Anonymous marks a result that is or contains an anonymous
type. The extractor names it object, the invoker prints it via ToString(),
and the JSON context task skips it. Docs and routing-40 cover it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@StevenTCramer
StevenTCramer merged commit 7e6fcd8 into feature/generator-fixes-2026-11-14 Nov 14, 2026
7 checks passed
@StevenTCramer
StevenTCramer deleted the task/585-anonymous-type-handler-return-breaks-the-build-in branch November 14, 2026 07:43
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.

1 participant