Skip to content

Prototype recursive rfl::TaggedUnion $defs cycle-breaking in JSON Schema #103

Done

Description

@clockblocker

Question

How should rfl::json::to_schema break $defs recursion cycles for recursive rfl::TaggedUnion types (such as AST nodes referencing themselves via rfl::Box<T> or indirect containers) without requiring manual ReflectionType wrapper structs?

Evidence & Context

Prototype & Measurement Plan

  • Prototype on: showcase/all-lanes — emit cycle-safe $ref entries in $defs for recursive rfl::TaggedUnion graphs.
  • Measure against real Showcase Migrations: Verify recursive TaggedUnion schema generation cleanly emits valid Draft 2020-12 $defs without manual ReflectionType wrapper structs (validating against solidity#3 Yul AST fixtures).
  • Judges & landing: Run Judges (gemini-4-neon + claude-opus-5-5 high via antigravity delegates) on the prototype diff and measurements; if green, coordinator's call to land on showcase/all-lanes.

Activity

  1. added
    wayfinder:prototype
    on Nov 27, 2026
  2. clockblocker commented on Nov 27, 2026

    @clockblocker
    OwnerAuthor

    Delta & Scope Split (solidity#3, osmium-tool#3):

  3. changed the title [-]Prototype move-only rfl::Box inside recursive rfl::TaggedUnion and evaluate cross-field struct invariants[/-] [+]Prototype recursive rfl::TaggedUnion $defs cycle-breaking in JSON Schema[/+] on Nov 27, 2026
  4. clockblocker commented on Nov 27, 2026

    @clockblocker
    OwnerAuthor

    Landed on showcase/all-lanes at b73c8aea (dual-Judge approved by claude-opus-5-5 high + gemini-4-neon high; 467/467 targets 0 warnings, 1,129/1,129 CTests).

    • Implemented JSON Schema $defs cycle-breaking for recursive rfl::TaggedUnion in Parser_default.hpp (named subclasses & annotated/SchemaName-overridden bare aliases via ParserTaggedUnion::to_schema_body) and ParserTaggedUnion.hpp (bare recursive aliases via (_definitions, name)-keyed thread_local active set with noexcept iterator RAII guard; non-recursive bare TaggedUnion stays inline).
    • Verified with direct recursion (rfl::Box & std::vector), mutual recursion (Stmt <-> ValueExpr), named subclasses with SchemaName, annotated bare aliases, and non-recursive inline preservation in tests/json/test_schema_ext_and_recursive_tu.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wayfinder:prototype

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions