Merge a freshly built asset registry with the one already published
Source:R/publish.R
registry_merge.Rdnative_asset is a registry of what is published, but publish_native.qmd
assembles it from whatever a given run happened to build, then writes it with
overwrite = TRUE. A run that skips a build chunk (NATIVE_SKIP_PMTILES, or an
opt-in class such as PUBLISH_MERGED_COG left off) therefore rewrote the table
from its own products alone, silently deleting every row of the classes it did not
touch. That is exactly how all 2,234 vector-range PMTiles rows disappeared from the
published v8 registry while the tiles themselves sat untouched on S3 and the file
host: the species app stopped offering any range input, and the content-hash
checkpoint recorded the loss as a clean run (n_pmtiles_native: 0).
Usage
registry_merge(
new,
prior,
allow_shrink = FALSE,
key = c("ds_key", "asset_type", "representation")
)Value
new plus any carried-forward rows, with the carried class labels in the
"carried" attribute and the per-class counts in "classes"
Details
A class is one (ds_key, asset_type, representation) triple — the unit the app
actually reasons about, since that is what becomes an input layer. This function:
carries forward every prior class the new registry has no rows for at all (the skipped-chunk case: those assets are still published, the run just did not enumerate them); and
errors when a class the new registry does cover came back smaller than it was — a partial build masquerading as a complete one, which carrying forward would paper over with a mix of fresh and stale rows.
Deliberate removals stay possible but must be explicit: allow_shrink = TRUE
(wired to NATIVE_REGISTRY_REBUILD=1) writes exactly what the run produced.