Skip to main content

Module authored_dump

Module authored_dump 

Source
Expand description

Coverage audit: record which entity types are actually constructed.

Off unless the authored-dump feature is on and AUTHORED_DUMP names a directory, so an --all-features build pays one relaxed atomic load per entity and nothing else.

§Why this exists

Static scanning of writer call sites cannot answer “is this entity authorable”. A type name reaches crate::Entity::new through a const, a catalogue row, or a match arm returning it into a tuple, so a scan both misses real writers and counts names that are only mentioned. Recording what is built during a test run answers it directly.

§Origins

Three call sites, because “an entity of this type exists” and “a writer can produce one” are different claims:

  • create: crate::Transaction::create, the authoring path. The only origin that proves a writer exists.
  • insert: crate::Model::insert, where every entity actually lands – committed transactions, crate::Model::push, and codec loads all funnel through it. The chokepoint, so nothing enters a model unseen.
  • retype: Model::retype, which changes a type name in place and can therefore produce a type no writer ever constructed.

An earlier version hooked create and push only. That missed Transaction::stage(Edit::Create { .. }), which builds an entity without going through create, and missed retype entirely.

§Usage

AUTHORED_DUMP=/tmp/dump \
  cargo test --workspace --all-features --features ifc-model/authored-dump
python3 scripts/authored-coverage.py /tmp/dump

Functions§

record
Record one type name against the path that produced it.
recording
Whether recording is on, reading the environment at most once.