mdl_id is the compact partition key of the serving surface
(serve/model_cell/mdl_id={id}/), so a titiler tile is a partition-pruned point
read. The stable public identifier stays mdl_key: titiler resolves
mdl_key -> mdl_id from the published model registry, so mdl_id never
appears in a URL.
Details
That indirection has a sharp edge. A plain dense_rank(mdl_key) is a
deterministic function of the model set, which means adding any model
renumbers every model sorted after it. Ingesting gm + nc into a released
version's dist/ — registered but deliberately not merged — moved 45,499 of
v8's 80,261 mdl_ids, and nothing would have failed: the registry and the
serve/ partitions would simply disagree, and titiler would serve the wrong
species' distribution for every model past ch_nmfs.
So ids are assigned against the published registry when one exists: a
mdl_key already published keeps its id, and new keys are appended above the
current maximum in sorted order. Deterministic given
(published registry, model set), and it can never invalidate a published
partition. With published = NULL (a version that has never shipped) it falls
back to dense_rank over the sorted keys, which is what produced the ids of
every release to date.
Examples
assign_mdl_id(c("b", "a", "c")) # 2 1 3
#> [1] 2 1 3
assign_mdl_id(c("b", "a", "c"),
data.frame(mdl_key = c("a", "c"), mdl_id = c(1L, 2L))) # 3 1 2
#> [1] 3 1 2