Skip to content

Record the declaring assembly on captured object records - #553

Open
sakanni wants to merge 1 commit into
developfrom
internal-tickets-#35-CaptureDeclaringAssembly
Open

sakanni wants to merge 1 commit into
developfrom
internal-tickets-#35-CaptureDeclaringAssembly

Conversation

@sakanni

@sakanni sakanni commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Issues addressed by this PR

Object records say what a type is called, not where it is declared. Anything working out which repository a record belongs to has to guess from the namespace, and namespaces are shared, so it guesses wrong. Method records are fine, because a method's declaring type is serialised assembly-qualified. This adds an _asm field naming the declaring assembly. It has to happen at capture, because that is the only point in the chain where a live object still exists.

9.3's dataset will need the declaring assembly backfilled by hand, as 9.2's did. That is expected. This change is what stops it repeating from 10.0 onward.

Two things it cannot disturb, both checked. The merge step keys on assembly and type name rather than on the record text, so adding a field cannot change what merges with what. BHoMBot does not read record contents: its only contact with datasets selects files by name and passes a path.

Not verified: the capture pipeline itself, which needs Grasshopper and two Rhino versions to run, and the worker process the checks hand off to.

Test files

TryToJsonAndFromJsonAndCheckIfEqual over 400 dummied object types, this branch against develop: tuple width, all eight output counts and their membership identical, and with _asm removed the 400 records are byte-identical. Helpers.DescriptionFromJson output unchanged on all 400. No existing test is modified.

Changelog

Captured object records carry _asm, naming the assembly that declares the object's type.

Additional comments

Nothing reads _asm until BHoM/CI_Toolkit#22 lands, and existing readers ignore it, because the deserialiser skips any field whose name begins with an underscore.

The field is added after ToJson, FromJson and IsEqual have run and only to the successful list, so this method's own verdict cannot change. The output tuple is unchanged, content-only inside output 0, because the capture scripts bind to these outputs by position and had to be rebound by hand the last time it widened. The field sits immediately before _bhomVersion, which Versioning_Engine appends last, keeping it clear of the fixed quote-delimited indices Helpers.DescriptionFromJson reads.

Method records are skipped on their top-level type being System.Reflection.MethodBase. That one rests on the code path rather than the measurement, which contains no MethodBase. A type whose assembly cannot be named is left untouched rather than guessed.

…ecords

Object records in the versioning test datasets record what a type is called
but not where it is declared, so a consumer reading one has only a type name.
Method records do not have this problem: a method's declaring type is
serialised assembly-qualified.

Adds an `_asm` field naming the assembly the object's type came from. One
property read, one field written, on the successful records only.

The field is added after the ToJson, FromJson and IsEqual checks, so those
run on the record as serialised and the method's verdict is unchanged. The
output tuple is unchanged. Method records are skipped. The field is placed
immediately before `_bhomVersion` so it sits past the positional indices
Helpers.DescriptionFromJson reads.

Inert to existing readers: the deserialiser skips fields whose name begins
with an underscore.
@sakanni
sakanni marked this pull request as ready for review September 14, 2026 14:27
@sakanni
sakanni requested review from a team, adecler and peterjamesnugent and removed request for adecler and peterjamesnugent September 14, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant