Skip to content

1.21.0 — enum fields that were never on the wire

Latest

Choose a tag to compare

@freitasjca freitasjca released this 20 Sep 21:49
· 10 commits to main since this release

Enum fields were silently dropped on the wire (ENUMRTTI-1)

A proto enum with non-contiguous values — 0,1,2,13,14 or 0,100,150,200, which
real schemas use constantly — produced a Pascal enum with no RTTI. The compiler
dropped the published property, so the codec never saw the field: neither encoded
nor decoded, and nothing raised.

Confirmed on both compilers. Neither Delphi 12 nor FPC trunk refuses the
declaration; both compile it and omit the property from RTTI. If you have a sparse
enum, you were losing that field on the wire regardless of toolchain.

Scale, and the layer that number describes: on the 7,301-schema googleapis corpus
this affected 1,405 schemas / 5,633 properties. All 1,405 still generated code
that compiles
— compiling was never what was broken, which is why no gate caught it.

Generated output moves

Two ways, and only where it must:

  • Enum members are emitted ordered by value. Each keeps its own number; only
    declaration order changes. Nothing on the wire changes.
  • A field whose enum is still non-contiguous after ordering is published as
    System.Int32 (TArray<System.Int32> when repeated). The enum type is still
    declared and still usable — it is the published property that changes type.
    Identical varint on the wire.

If your enums are contiguous, your generated code is unchanged and your working
build is safe.

Assigning an enum constant to an affected field now needs Ord(). Those are exactly
the fields that were never transmitted, so no working code depends on the old spelling.

Also in this release

  • TNghttp2Client.ConnectTimeoutMS — a bounded TCP connect. Without it an
    unreachable peer could stall ~127 s on Linux with no way to interrupt.
  • protoc-oracle.sh declared sint32/fixed32 unsupported for three releases
    after WIRE-FORM-1 made them selectable; the differential gate had been failing on
    a stale expectation.
  • ProtoOptionalProbe now pins non-contiguous enum behaviour on both compilers,
    so this cannot regress unnoticed.
  • Docs: architecture diagram, CONTRIBUTING.md, CHANGELOG.md, and a wiki at
    https://deepwiki.com/freitasjca/Delphi-nghttp2