Specifying max_chars equal to some string representation (i.e. environment) is confusing and obscures the intent of the operation. It's not immediately clear what a max_chars of environment means without introspecting the metastructure macro.
Defining max_chars limits to be associated to a particular field's limits leads to brittle code. Presumably the environment max_chars value could change if the internal representation of the environment column changes. But my environment field (or any field which relies on the environment max_chars value) may not change and so we would expect things to break in unexpected ways.
Additionally, adding more enumerations which are static and represent common length values (i.e. limit32, limit64, limit128) is unnecessarily constraining and still presents a risk of breakage if un-careful programmers change these values.
By allowing the programmer to specify an integer literal you ensure that that programmer is in complete control of their implementation and is at minimal risk of breakage from other programmers changing their implementations. New integer literals can be added without the programmer needing to make changes to the MaxChars enumeration. This improves the velocity of development and removes the barrier of introducing new validation limits.
### Tasks
- [x] https://github.com/getsentry/relay/pull/2587 (background)
- [ ] https://github.com/getsentry/relay/pull/2887
- [ ] https://github.com/getsentry/relay/pull/3422
- [ ] https://github.com/getsentry/relay/pull/3706
Specifying
max_charsequal to some string representation (i.e.environment) is confusing and obscures the intent of the operation. It's not immediately clear what amax_charsofenvironmentmeans without introspecting themetastructuremacro.Defining
max_charslimits to be associated to a particular field's limits leads to brittle code. Presumably theenvironmentmax_charsvalue could change if the internal representation of theenvironmentcolumn changes. But my environment field (or any field which relies on theenvironmentmax_charsvalue) may not change and so we would expect things to break in unexpected ways.Additionally, adding more enumerations which are static and represent common length values (i.e.
limit32,limit64,limit128) is unnecessarily constraining and still presents a risk of breakage if un-careful programmers change these values.By allowing the programmer to specify an integer literal you ensure that that programmer is in complete control of their implementation and is at minimal risk of breakage from other programmers changing their implementations. New integer literals can be added without the programmer needing to make changes to the
MaxCharsenumeration. This improves the velocity of development and removes the barrier of introducing new validation limits.