Skip to content

Candidate v0.4.0: spec-compliant rewrite with typed API#22

Merged
jonnew merged 1 commit into
mainfrom
0.4.0
Jul 16, 2026
Merged

Candidate v0.4.0: spec-compliant rewrite with typed API#22
jonnew merged 1 commit into
mainfrom
0.4.0

Conversation

@jonnew

@jonnew jonnew commented Jun 23, 2026

Copy link
Copy Markdown
Member

Library rewrite to bring it into alignment with probeinterface spec 0.3.x and to replace weakly-typed, mutation-heavy API with an immutable, strongly-typed design.

Breaking API changes

  • Contact changed from readonly struct to sealed class; PosX/PosY changed from float to double; PosZ (double?) added for 3D probe support
  • Contact.DeviceId and Contact.Index removed; channel mapping now lives exclusively on Probe.ChannelMap via ChannelWiring
  • Contact.ContactId/ShankId are now nullable (string?)
  • ContactAnnotations.cs removed; contact_annotations is now backed by an internal ContactAnnotationStore shared across all contacts on a probe
  • Contact now has GetAnnotation, SetAnnotation, RemoveAnnotation for per-contact typed annotation access
  • Probe parallel-array properties (ContactPositions, ContactPlaneAxes, ContactShapes, ContactShapeParams, DeviceChannelIndices, ContactIds, ShankIds) removed; all per-contact data is now accessed via Probe.Contacts
  • Probe static factory helpers (DefaultContactShapes, DefaultCircleParams, etc.) removed
  • ProbeAnnotations.Name renamed to ModelName to match JSON key "model_name"
  • ProbeAnnotations.AdditionalProperties made private; typed access via GetAnnotation, SetAnnotation, RemoveAnnotation, AnnotationKeys
  • ContactShapeParam shape properties changed from float? to double?; null shape params omitted from JSON (NullValueHandling.Ignore)
  • ProbeGroup.Validate() now only throws; it no longer mutates data
  • ProbeGroup.Normalize() removed; optional fields such as contact_plane_axes, device_channel_indices, contact_ids, and shank_ids are omitted from JSON when absent rather than defaulted
  • ProbeGroup.ForceContactIdsToZeroIndexed() removed; contact IDs are labels, not indices, and forcing them corrupted valid data
  • ProbeGroup.SetDefaultDeviceChannelIndicesIfMissing() removed; device_channel_indices is optional per the spec
  • ProbeGroup.GetContactIds(), GetDeviceChannelIndices(), GetContacts() removed

New API Surface

  • ChannelWiring static class: WireChannels, WireChannel, UnwireChannel, UnwireChannels with cross-probe uniqueness validation and rollback
  • ProbeGroup.GetChannelMap() returns a global channel -> (probe, contact) map
  • Probe.GetContactAnnotation, SetContactAnnotation, RemoveContactAnnotation for bulk parallel-array annotation access
  • Probe.ContactAnnotationKeys enumerates defined annotation keys
  • Probe.ChannelMap exposes the contact→channel mapping as a read-only dictionary; null means no channels assigned

Test Infrastructure

  • Test project, generated using claude code, added tests covering round-trips against all probeinterface_library fixtures, schema validation, channel wiring, probe/contact annotation API, and spec validation edge cases
  • probeinterface_library added as a git submodule for real-world round-trip and schema tests
  • probe.json.schema bundled as an embedded resource for schema validation
  • generate_fixtures.py added for regenerating synthetic test fixtures

Library rewrite to bring it into alignment with probeinterface
spec 0.3.x and to replace weakly-typed, mutation-heavy API with
an immutable, strongly-typed design.

Breaking API changes
- Contact changed from readonly struct to sealed class; PosX/PosY changed
  from float to double; PosZ (double?) added for 3D probe support
- Contact.DeviceId and Contact.Index removed; channel mapping now lives
  exclusively on Probe.ChannelMap via ChannelWiring
- Contact.ContactId/ShankId are now nullable (string?)
- ContactAnnotations.cs removed; contact_annotations is now backed by an
  internal ContactAnnotationStore shared across all contacts on a probe
- Contact now has GetAnnotation<T>, SetAnnotation<T>, RemoveAnnotation for
  per-contact typed annotation access
- Probe parallel-array properties (ContactPositions, ContactPlaneAxes,
  ContactShapes, ContactShapeParams, DeviceChannelIndices, ContactIds,
  ShankIds) removed; all per-contact data is now accessed via Probe.Contacts
- Probe static factory helpers (DefaultContactShapes, DefaultCircleParams,
  etc.) removed
- ProbeAnnotations.Name renamed to ModelName to match JSON key "model_name"
- ProbeAnnotations.AdditionalProperties made private; typed access via
  GetAnnotation<T>, SetAnnotation<T>, RemoveAnnotation, AnnotationKeys
- ContactShapeParam shape properties changed from float? to double?;
  null shape params omitted from JSON (NullValueHandling.Ignore)
- ProbeGroup.Validate() now only throws; it no longer mutates data
- ProbeGroup.Normalize() removed; optional fields such as contact_plane_axes,
  device_channel_indices, contact_ids, and shank_ids are omitted from JSON
  when absent rather than defaulted
- ProbeGroup.ForceContactIdsToZeroIndexed() removed; contact IDs are labels,
  not indices, and forcing them corrupted valid data
- ProbeGroup.SetDefaultDeviceChannelIndicesIfMissing() removed;
  device_channel_indices is optional per the spec
- ProbeGroup.GetContactIds(), GetDeviceChannelIndices(), GetContacts() removed

New API Surface
- ChannelWiring static class: WireChannels, WireChannel, UnwireChannel,
  UnwireChannels with cross-probe uniqueness validation and rollback
- ProbeGroup.GetChannelMap() returns a global channel -> (probe, contact) map
- Probe.GetContactAnnotation<T>, SetContactAnnotation<T>,
  RemoveContactAnnotation for bulk parallel-array annotation access
- Probe.ContactAnnotationKeys enumerates defined annotation keys
- Probe.ChannelMap exposes the contact→channel mapping as a read-only
  dictionary; null means no channels assigned

Test Infrastructure
- Test project, generated using claude code, added tests covering round-trips against all
  probeinterface_library fixtures, schema validation, channel wiring,
  probe/contact annotation API, and spec validation edge cases
- probeinterface_library added as a git submodule for real-world round-trip
  and schema tests
- probe.json.schema bundled as an embedded resource for schema validation
- generate_fixtures.py added for regenerating synthetic test fixtures
@jonnew
jonnew requested a review from bparks13 June 23, 2026 13:22
@jonnew jonnew added this to the 0.4.0 milestone Jun 23, 2026
@jonnew
jonnew merged commit 78f9de9 into main Jul 16, 2026
9 checks passed
@jonnew
jonnew deleted the 0.4.0 branch July 16, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant