Definition changes
Configuration changes apply at restart. Census must never serve values computed under the old definition as valid under the new one, and should not fetch from every source for a change that stored data can answer. It decides with two hashes, computed from the configuration and stored in the cache.
Two hashes
| Hash | Computed from | When it changes |
|---|---|---|
| Collection hash, one per contribution | connection, the connection's type and endpoint, object_types, hfid, the attributes paths, the location paths | The stored records were collected with other settings and may lack data Census now needs. Census deletes the contribution's records and sets its snapshot to none; the refresh at startup collects them again. |
| Resolution hash, one per inventory | The fields (types, vocabularies, defaults, priorities), priority, freshness, the location levels, locations and priority, and each contribution's values, defaults and location_values | The stored observations are enough. Census marks the inventory rebuilding, normalizes every observation again from its original value, recomputes every entity, then marks it ready. |
Settings in neither hash, such as description, entity_kind, refresh_interval,
credentials, webhook_secret, external_base_url and external_base_url_fallback, apply with no data change.
Order at startup
apply_definitions (crates/sync/src/redefine.rs) runs before any refresh:
- Deletes every inventory that the configuration no longer has.
- For each inventory, under its writer lock, deletes the records of contributions whose collection hash changed or that the configuration no longer has.
- If the resolution hash changed, or a previous rebuild did not finish, stores the status
rebuildingand starts the rebuild in a background task. The rebuild holds the writer lock, so refreshes and webhooks for that inventory wait until it ends. - Otherwise, if records were deleted, recomputes the inventory's entities.
While an inventory is rebuilding, its entity, lookup, location and diagnostics routes
answer 503 inventory-rebuilding. Other inventories are served as usual.
Branch views left from a previous run are deleted at startup, before this comparison.
Cache layout version
A third check covers changes to Census itself. The cache stores a layout version. When the
build's version differs, ensure_ready deletes every node, and the cache refills from the
sources. This replaces data migrations.
Background: research decisions D4 and D20 in
specs/008-named-inventory-federation/research.md.