tableau icon indicating copy to clipboard operation
tableau copied to clipboard

protogen: guarantee message field's Tag Number compatibility

Open wenchy opened this issue 9 months ago • 1 comments

See https://protobuf.dev/best-practices/dos-donts/

Don’t Re-use a Tag Number Never re-use a tag number. It messes up deserialization. Even if you think no one is using the field, don’t re-use a tag number. If the change was live ever, there could be serialized versions of your proto in a log somewhere. Or there could be old code in another server that will break.

To guarantee both backward and forward compatibility, the field's tag number should be fixed (specified explicitly), to avoid frequent changes (due to column additions/deletions) if auto generated by tableau protogen.

wenchy avatar Apr 15 '25 06:04 wenchy

Maybe need to be discussed deeply, as https://github.com/tableauio/tableau/pull/230#issuecomment-3048158503 points out:

It's too verbose to specify field number for each column.

Another solution is automation (auto keep compatibilty), when compared with the old protoconf file:

Auto keep field number by unique column name. If new field name occured, then assign the the max field number plus 1 in the same level. This can avoid field number overwriting for different column names.

wenchy avatar Aug 26 '25 09:08 wenchy