Skip to content

Use the declaring assembly to attribute a versioning finding - #22

Open
sakanni wants to merge 1 commit into
developfrom
feat/runner-read-asm
Open

sakanni wants to merge 1 commit into
developfrom
feat/runner-read-asm

Conversation

@sakanni

@sakanni sakanni commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Issues addressed by this PR

Refs BHoM/internal-tickets#35

The versioning check has to decide which repository a finding belongs to. For an object record it has only a type name, so it infers ownership from the namespace. Namespaces are shared, so it gets it wrong:

  • BHoM/BHoM_Adapter run 31844962538 reported 1,056 failures, none of them that repository's.
  • BHoM/BHoM run 33849699768 reported 145 findings, all 145 attributed by namespace guess and none by evidence.

Method records do not have this problem, because a method's declaring type is serialised assembly-qualified. This teaches the runner to read a declaring assembly for object records too, when one is recorded, and to fall back to today's behaviour when it is not.

Test files

163 tests pass, of which 135 are pre-existing and unmodified. Four mutation checks were run against the new behaviour, including reverting the message format to an earlier one; each failed tests and reverted clean.

Changelog

ci-versioning attributes an object-record finding by its declaring assembly when the dataset records one, instead of inferring ownership from the namespace.

Additional comments

This is inert on its own. The runner's only view of the dataset is the TestResult tree. Nothing emits the new field yet, so the new parser matches nothing and every existing path is unchanged. The field is added to the dataset, and emitted into the result, by separate changes on BHoM/Versioning_Toolkit.

The contract, which is the thing worth scrutinising. Versioning_Toolkit must emit exactly this, or the field is unreadable:

Object <FullTypeName> declared in "<AssemblyName>"

This is the only interface between the two changes, and getting it wrong fails silently: attribution just returns to guessing.

The quoted part holds the assembly alone, deliberately. An earlier version also put the type there, which cannot represent a closed generic, because those type names contain commas. Measured over the 9.2 dataset, that form parsed 1,690 of 1,713 records and silently lost 23. One of the 23 is declared by a different repository than its namespace suggests, so it stayed misattributed. An assembly name can never contain a quote, so the assembly-only form is unambiguous and covers all 1,713.

What changed

  • ParseObjectEventAssembly, new. Read only when the Method event yields nothing, so the method path is untouched.
  • ProbeTypeCandidates, new. Reports when more than one loaded assembly declares a type, so an ambiguous attribution is counted rather than silently resolved.
  • AttributeWholeClosure, extracted. The no-subject-list path had two call sites with a duplicated predicate; one was uncovered.
  • ExtractFilteredResult gains one optional parameter. Null keeps existing behaviour.

Unchanged: AttributeToSubject, IsFromSubjectAssembly, StripConfigSuffix, ProbeDeclaringType, the ambiguity metric, and every dataset, workflow and action.

Year-insensitive comparison of Revit per-year assemblies was already implemented by StripConfigSuffix, so this adds tests for it rather than code.

Object records carry a type name and nothing else, so attribution has always
had to guess ownership from the namespace prefix. Namespaces are shared, so
that guess cannot be made correct at any precision. The dataset's new `_asm`
field closes the gap; this is the runner half that consumes it.

Three changes:

- `ParseObjectEventAssembly` reads the declaring assembly and type from a new
  event shape, consulted only when the Method event yielded nothing so the
  method path is untouched.
- `ProbeTypeCandidates` collects every loaded assembly declaring a given type,
  so an object record whose type is declared more than once is counted by the
  existing ambiguity metric instead of being normalised away silently.
- No change to year handling. `StripConfigSuffix` already collapses the Revit
  `_20NN` suffix and `IsFromSubjectAssembly` already compares on it, so this
  adds tests rather than code.

Inert until Versioning_Toolkit emits the event: the runner's only view of the
dataset is the TestResult tree, so with nothing emitting, every path is
unchanged. The existing 135 tests pass unmodified.
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