There is inconsistent release ordering in error response hints depending if the error is revision-not-found or invalid-charm-base.
Ordering of invalid-charm-base is preferred, as the first choice is what is preferred.
Ordering in revision-not-found starts with the oldest release of ubuntu and goes to the newest.
Having a consistent order is needed for juju. Grouping the charm channels supported by a base channel is fine. We'd want the top of the release list to be the preferred base.
curl -X POST https://api.snapcraft.io/v2/charms/refresh -d '{"context":[],"actions":[{"action":"install","instance-key":"a5d51df0-c3d6-4fce-88dd-5b554e5f6e87","name":"ubuntu","channel":"stable","base":{"architecture":"amd64","name":"NA","channel":"NA"}}]}' -H "User-Agent: charm-testing" -H "Content-Type: app[D[Dlication/json"
{"error-list":[],"results":[{"charm":null,"error":{"code":"invalid-charm-base","extra":{"default-bases":[{"architecture":"amd64","channel":"20.04","name":"ubuntu"},{"architecture":"amd64","channel":"18.04","name":"ubuntu"},{"architecture":"amd64","channel":"16.04","name":"ubuntu"},{"architecture":"amd64","channel":"20.10","name":"ubuntu"}]},"message":"Instance key 'a5d51df0-c3d6-4fce-88dd-5b554e5f6e87' invalid 'base' in 'install' for charm_id=DksXQKAQTZfsUmBAGanZAhpoS4dpmXel name=ubuntu"},"id":"DksXQKAQTZfsUmBAGanZAhpoS4dpmXel","instance-key":"a5d51df0-c3d6-4fce-88dd-5b554e5f6e87","name":"ubuntu","released-at":null,"result":"error"}]}
curl -X POST https://api.snapcraft.io/v2/charms/refresh -d '{"context":[],"actions":[{"action":"install","instance-key":"a5d51df0-c3d6-4fce-88dd-5b554e5f6e87","name":"ubuntu","channel":"stable","base":{"architecture":"amd64","name":"ubuntu","channel":"21.10"}}]}' -H "User-Agent: charm-testing" -H "Content-Type: app[D[Dlication/json"
{"error-list":[],"results":[{"charm":{"id":"DksXQKAQTZfsUmBAGanZAhpoS4dpmXel","license":"","name":"ubuntu","publisher":{"display-name":"charmers","id":"K08R1CtJYwkNQlpljSBruPKfHgTtAKFK","username":"charmers","validation":"unproven"},"summary":"A pristine Ubuntu Server","type":"charm"},"error":{"code":"revision-not-found","extra":{"releases":[{"base":{"architecture":"amd64","channel":"12.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"12.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"12.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"12.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"14.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"14.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"14.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"14.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"15.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"15.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"15.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"15.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"16.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"16.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"16.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"16.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"17.10","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"17.10","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"17.10","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"17.10","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"18.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"18.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"18.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"18.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"18.10","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"18.10","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"18.10","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"18.10","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"19.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"19.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"19.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"19.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"20.04","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"20.04","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"20.04","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"20.04","name":"ubuntu"},"channel":"edge"},{"base":{"architecture":"amd64","channel":"20.10","name":"ubuntu"},"channel":"stable"},{"base":{"architecture":"amd64","channel":"20.10","name":"ubuntu"},"channel":"candidate"},{"base":{"architecture":"amd64","channel":"20.10","name":"ubuntu"},"channel":"beta"},{"base":{"architecture":"amd64","channel":"20.10","name":"ubuntu"},"channel":"edge"}]},"message":"No revision was found in the Store."},"id":"DksXQKAQTZfsUmBAGanZAhpoS4dpmXel","instance-key":"a5d51df0-c3d6-4fce-88dd-5b554e5f6e87","name":"ubuntu","released-at":null,"result":"error"}]}
One place this is a challenge for juju is when a user deploys a charm to a series not supported by the charm. Which juju allows with a --force flag.