Skip to content

Adding advanced debugging information on dll mismatch - #91

Merged
birkholz-cubert merged 5 commits into
developfrom
feature/expose_binding_diagnostics
Aug 19, 2026
Merged

Adding advanced debugging information on dll mismatch#91
birkholz-cubert merged 5 commits into
developfrom
feature/expose_binding_diagnostics

Conversation

@birkholz-cubert

@birkholz-cubert birkholz-cubert commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Adds a way to ask what the installed cuvis SDK actually provides, instead of finding out when a call fails. Pairs with cuvis.pyil#38, which is what supplies the underlying facts.

  • New cuvis.binding module reporting the compiled binding, the cuvis library loaded beside it, and the functions that library does not provide.
  • binding.info() returns a BindingInfo snapshot whose str() is a report fit for pasting into a bug report:
    cuvis binding
      built against : CUBERT SDK v. 3.5.3 build: 0f416fb6...
      loaded library: CUBERT SDK v. 3.4.1 build: d20de35f...
      library path  : /lib/cuvis/libcuvis.so
      status        : 3 function(s) not provided by this SDK
    
    Both sides are reported in the same form, because two libraries can share a version and still be different builds.
  • binding.available(*names) and binding.require(*names) let a feature check up front rather than failing deeper in. require raises UnavailableSDKFunction, which derives from both SDKException and RuntimeError, so one except covers it and the plain RuntimeError the binding layer raises when such a function is called directly.
  • Needs no cuvis.init(), so it can decide whether an operation is worth attempting at all.
  • Degrades to empty against an older cuvis_il wheel that cannot report any of this: info() says unknown, this binding does not report it rather than claiming everything is fine, missing_symbols() is empty and require() never raises. Absence of evidence, not evidence of absence.
  • CHANGELOG.md updated under Unreleased.

Verified

  • Windows and Linux (3.5.3 and 3.4.1 docker images): a 3.5.3-built binding on 3.4.1 reports exactly the 3 missing cuvis_acq_cont_dead_pixel_correction_* functions, is_complete is False, and both error paths name both libraries.
  • The old-binding contract checked against a real pre-feature cuvis_il 3.5.3.2 wheel, not a mock.
  • Test suite: 90 passed on both platforms. scripts/check_changelog.py passes.

The binding is compiled against one cuvis SDK and can run against another, since
the library is installed separately. When the installed one is older it may not
export everything the binding imports; the binding survives that and reports it,
but there was no clean way to ask about it from here.

cuvis.binding adds that: info() returns a BindingInfo with the version built
against, the version and path actually loaded and any functions the library does
not provide, and prints as a report fit for pasting into a bug report.
missing_symbols(), available() and require() cover the common checks, and
require() raises UnavailableSDKFunction, an SDKException, so an unavailable
function is caught as an ordinary cuvis error rather than a bare RuntimeError.

Degrades quietly against a binding too old to report any of this: everything
reads empty and available() stays true.
The module now carries full docstrings: what the feature is for, which error
each route raises, what every BindingInfo field means, and what each function
returns or raises, with short examples in the reST style the repo already uses
in doc.py.

Writing them turned up two things worth correcting rather than describing.

The module claimed that calling an unavailable function raises
UnavailableSDKFunction. It does not: the binding layer raises a plain
RuntimeError, and only require() raised the typed one, so the same condition
surfaced as two unrelated exception types. UnavailableSDKFunction now derives
from RuntimeError as well as SDKException, so one except clause covers either
route and the documented behaviour is true.

The report also printed "status: complete" for a binding too old to report
missing functions, asserting something it cannot know. It now says the status is
unknown, and is_complete documents that an empty list is all such a binding can
offer.
@birkholz-cubert
birkholz-cubert changed the base branch from main to develop August 19, 2026 13:00
@birkholz-cubert
birkholz-cubert merged commit 2295d17 into develop Aug 19, 2026
4 checks passed
@birkholz-cubert
birkholz-cubert deleted the feature/expose_binding_diagnostics branch August 19, 2026 13:16
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