Skip to content

Only accept integer literals in max_chars #2802

@iker-barriocanal

Description

@iker-barriocanal

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

Metadata

Metadata

Labels

fillerRequires little effort to resolve. Ready to be picked up anytime.
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions