Currently, the limit of 10 changesets per batch change for unlicensed/free tier Sourcegraph instances is hardcoded into the TUI. There is no reason to assume this value will be static moving forward, and hardcoding it here means we are maintaining multiple sources of truth for the current static limit.
There are two ways we could address this:
- See how hard it is to just return a clear, legible error that includes the license limit when we can't create a batch spec due to hitting this limit. This would be the preferred method and would enable us to delete that extra TUI method entirely, but I'm not sure how easy it would be.
- Query
maxUnlicensedChangeset in the mutation where we create the batch spec and pass that to the TUI method, too. If we do still require special error handling here to make it clear it's a licensing error, this way the TUI method could use the value from the backend instead of its hardcoded one.