Add configurable compatibility allowances to thrift audit - #3689
Conversation
Client: cpp Generated-by: OpenAI Codex (GPT-5)
But you are aware that this breaks your contract? IOW that is what audit is designed to check. |
Hi Jens I was using thrift as the internal RPC implementation of a micro-service, for this scenario, the contract is the client API of our micro-service, not the thrift definition itself. I found audit to be externally helpful to prevent issues on wire protocol incompatibility, it is used as part of a check-in gate. However, over the years, things have changed enough that we have to remove some optional and slowly deprecate some required fields. The current audit mode doesn’t provide the flexibility and we also definitely don’t want to drop audit entirely in the check-in gate. So I suppose if these relaxations are behind some command line option and is default to off, it should be safe for all existing users while still provide flexibility? Thanks |
Summary
--audit-allow-optional-field-removalso explicit optional fields can be removed when intentionally enabled--audit-allow-required-field-to-defaultso required fields can move to default requiredness when intentionally enabled.thriftfixturesCompatibility validation
Generated separate C++ bindings for required and default requiredness and tested both directions with the binary protocol:
8675309recovered8675309recoveredThis confirms that removing explicit
requiredwhile retaining default requiredness is wire-compatible for this transition.Regression proof
In a disposable WSL2 checkout, I temporarily weakened the optional-removal guard so the option also allowed removal of a default-requiredness field. The registered CMake
ThriftAuditTestfailed on the intended negative case:After restoring the committed implementation, the same test passed.
Validation
ctest: 18/18 passedThriftAuditTest: passedmake check: passed, includingtest/auditperl -c test/audit/thrift_audit_test.pl: passedgit diff --check: passedChecklist
AI assistance
Generated-by: OpenAI Codex (GPT-5)