You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prototype explicit emit-null vs omit-when-empty policy for optional and nullable fields #102
What first-class rfl::Nullable<T> wrapper or processor policy cleanly distinguishes "omit key when absent" (std::optional<T>) from "always emit "field": null when empty while accepting omitted/null/value on read and emitting valid Draft 2020-12 nullable JSON Schema"?
solidity Yul AST:YulVariableDeclaration::value and YulAssignment::value required a custom DefaultVal<Nullable<YulExpression>> + Reflector workaround to always serialize "value": null, accept omitted/null/object on input, and emit valid Draft 2020-12 JSON Schema.
Prototype & Measurement Plan
Prototype on:showcase/all-lanes — prototype rfl::Nullable<T> (and/or an explicit emit-null processor) covering read, write, and Draft 2020-12 JSON Schema generation.
Measure against real Showcase Migration: Validate against solidity Yul AST by deleting the custom DefaultVal<Nullable<...>> + Reflector workaround on YulVariableDeclaration::value / YulAssignment::value and verifying AST round-trips and schema output.
Judges & landing: Run Judges (gemini-4-neon + claude-opus-5-5 high via antigravity delegates) on the prototype diff and measurements; if green, hand to coordinator to land on showcase/all-lanes.
JSON-RPC 2.0 requires distinguishing omitted "id" (notification) from explicit "id": null (null request ID). Because std::optional<T> collapses omitted and explicit null into std::nullopt, transmission#1 had to write a ~55-line custom Parser<R, W, RequestId> + DefaultVal<RequestId> workaround.
Prototype scope extension: Cover both halves cohesively in this ticket — write-side explicit emit-null vs omit (solidity#3) and read-side tri-state field presence (omitted vs explicit null vs value, transmission#1) — and validate by deleting rpc-schema.h's custom RequestId parser alongside solidity#3's YulVariableDeclaration::value workaround.
rfl::json::read_into currently lacks field-presence / explicit-null tracking, so layered config loading cannot distinguish a field omitted across all layers from one explicitly set to null or its default value — one of the two blockers that prevented adopting #81 (read_into) in Config.cpp.
Together with clockblocker/transmission#1 (JSON-RPC 2.0 tri-state "id"), this confirms tri-state presence (omitted vs explicit null vs value) should work cleanly across both read and read_into (as well as write + Draft 2020-12 JSON Schema).
Landed on showcase/all-lanes at 2b1fdb9b (62649db6 + 6280453b + 2b1fdb9b), approved by dual independent Judges (claude-opus-5-5 high + gemini-4-neon high, both APPROVE WITH NITS after resolving all initial blockers and nits).
Always serializes explicitly ("field": null when empty, "field": <value> when present), unlike std::optional<T> which omits empty keys.
Accepts omitted key, explicit null, or value on read, preserves base when omitted and overrides with null on explicit null in read_into, and emits Draft 2020-12 nullable JSON Schema (anyOf: [<T>, {"type": "null"}], not required unless NoOptionals).
Distinguishes State::omitted (default-constructed; omitted on write), State::null (std::nullopt; emits "field": null), and State::value across read, read_into (layered config overlay + recursive nested struct overlay), write, and Draft 2020-12 JSON Schema.
Strong exception safety in emplace and operator=, conditional explicit(!std::is_convertible_v<U&&, T>), bool optional-like conversion guard, constrained copy/move members for move-only T.
Write-side processor emitting "field": null for empty optional/nullable fields without making them mandatory on read, while preserving TriState::omitted and non-nullable empty containers in XML/env.
Full ecosystem wiring: is_required.hpp, is_nullable.hpp, is_empty.hpp, check_default_value.hpp, NamedTupleParser.hpp, Parser_default.hpp, cli/options.hpp, cli/read.hpp, cli/usage.hpp, is_attribute.hpp, and field_aliases.hpp.
Activity
clockblocker commentedon Nov 27, 2026
Additional Showcase Requirement — Tri-State Field Presence on Read (clockblocker/transmission#1,
6478ae0d0):transmission/libtransmission/rpc-schema.h(lines75–113,735–787)."id"(notification) from explicit"id": null(null request ID). Becausestd::optional<T>collapses omitted and explicitnullintostd::nullopt,transmission#1had to write a ~55-line customParser<R, W, RequestId>+DefaultVal<RequestId>workaround.solidity#3) and read-side tri-state field presence (omittedvs explicitnullvs value,transmission#1) — and validate by deletingrpc-schema.h's customRequestIdparser alongsidesolidity#3'sYulVariableDeclaration::valueworkaround.clockblocker commentedon Nov 27, 2026
Additional Active Regression Harness Requirement (clockblocker/slang-server#1,
bf857f4):slang-server/src/Config.cpp:130-163(buildPatternExplicit/flagsByFile).rfl::json::read_intocurrently lacks field-presence / explicit-nulltracking, so layered config loading cannot distinguish a field omitted across all layers from one explicitly set tonullor its default value — one of the two blockers that prevented adopting#81(read_into) inConfig.cpp.clockblocker/transmission#1(JSON-RPC 2.0 tri-state"id"), this confirms tri-state presence (omittedvs explicitnullvs value) should work cleanly across bothreadandread_into(as well as write + Draft 2020-12 JSON Schema).feat(#102,#74): add rfl::Nullable<T>, rfl::TriState<T>, rfl::AddNullF…
fix(#102,#74): address dual-Judge blockers (per-branch causes groupin…
chore(#102,#74): polish Judge nits (validator_code per-detail prefix,…
clockblocker commentedon Nov 27, 2026
Landed on
showcase/all-lanesat2b1fdb9b(62649db6+6280453b+2b1fdb9b), approved by dual independent Judges (claude-opus-5-5high +gemini-4-neonhigh, bothAPPROVE WITH NITSafter resolving all initial blockers and nits).Implemented
rfl::Nullable<T>(include/rfl/Nullable.hpp,include/rfl/parsing/ParserNullable.hpp):"field": nullwhen empty,"field": <value>when present), unlikestd::optional<T>which omits empty keys.null, or value onread, preserves base when omitted and overrides with null on explicitnullinread_into, and emits Draft 2020-12 nullable JSON Schema (anyOf: [<T>, {"type": "null"}], not required unlessNoOptionals).rfl::TriState<T>+rfl::omitted(include/rfl/TriState.hpp,include/rfl/parsing/ParserTriState.hpp):State::omitted(default-constructed; omitted on write),State::null(std::nullopt; emits"field": null), andState::valueacrossread,read_into(layered config overlay + recursive nested struct overlay),write, and Draft 2020-12 JSON Schema.emplaceandoperator=, conditionalexplicit(!std::is_convertible_v<U&&, T>),booloptional-like conversion guard, constrained copy/move members for move-onlyT.rfl::AddNullFields(include/rfl/AddNullFields.hpp,include/rfl/internal/add_null_fields_v.hpp):"field": nullfor empty optional/nullable fields without making them mandatory on read, while preservingTriState::omittedand non-nullable empty containers in XML/env.is_required.hpp,is_nullable.hpp,is_empty.hpp,check_default_value.hpp,NamedTupleParser.hpp,Parser_default.hpp,cli/options.hpp,cli/read.hpp,cli/usage.hpp,is_attribute.hpp, andfield_aliases.hpp.tests/json/test_nullable_and_tristate.cppcovering JSON,read_intolayered overlay, Generic, nlohmann, XML, CLI, aliases, wrappers, move-only/non-default-constructible types, and Draft 2020-12 schema — 1,106/1,106 CTests passing, 0 warnings (-Wall -Werror,REFLECTCPP_STRICT_WARNINGS=ON).