Skip to content

feat(extension_types): support SpikeInterface BaseSorting objects (ITL-468)#205

Merged
eywalker merged 11 commits into
mainfrom
eywalker/itl-468-support-spikeinterface-basesorting-objects
Jul 2, 2026
Merged

feat(extension_types): support SpikeInterface BaseSorting objects (ITL-468)#205
eywalker merged 11 commits into
mainfrom
eywalker/itl-468-support-spikeinterface-basesorting-objects

Conversation

@kurodo3

@kurodo3 kurodo3 Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds LogicalSISorting logical type mapping spikeinterface.core.BaseSorting ↔ Arrow large_string via SpikeInterface's to_dict() JSON dump, mirroring the existing LogicalSIRecording pattern
  • Adds SISortingHandler for SHA-256 content hashing of sortings (phase 1)
  • Extends register_spikeinterface_types() to also wire in LogicalSISorting and SISortingHandler (idempotent, same pattern as recording registration)
  • Exports LogicalSISorting from extension_types/__init__.py
  • Auto-registers both types in v0.1.json with _optional: true — activates automatically when spikeinterface is installed
  • Clear ValueError for in-memory NumpySorting in both serialization and hashing paths, with save instructions

Tests

  • test_logical_si_sorting_importable — extension name, python_type, Arrow storage type
  • test_in_memory_sorting_raises — NumpySorting raises ValueError with "not JSON-serializable" and "file-backed"
  • test_folder_sorting_round_trip — numpy_folder-backed round-trip via get_unit_spike_train
  • test_zarr_sorting_round_trip — zarr-backed round-trip
  • test_si_sorting_handler_hash_stability — same sorting → same ContentHash
  • test_si_sorting_handler_hash_changes_with_content — different sortings → different hashes
  • test_si_sorting_handler_in_memory_raises — ValueError for in-memory sorting
  • test_register_spikeinterface_types_includes_sorting — full context integration: type lookup, handler lookup, round-trip

Full test suite: 4028 passed, 56 skipped, 6 xfailed — zero failures

Closes ITL-468

🤖 Generated with Claude Code

kurodo3 Bot and others added 11 commits July 2, 2026 07:03
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ITL-468

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds SISortingHandler class between SIRecordingHandler and
register_spikeinterface_types, mirroring the recording handler pattern.
Hashes BaseSorting via SHA-256 of its JSON dump; raises ValueError for
in-memory sortings. Includes three new tests covering hash stability,
content sensitivity, and in-memory rejection.
…mpy_recording (ITL-468)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tests (ITL-468)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eSorting (ITL-468)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/orcapod/extension_types/spikeinterface_types.py 88.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class orcapod support for SpikeInterface BaseSorting objects by introducing a new logical type + hashing handler, wiring them into the default context (optionally, when spikeinterface is installed), and extending the SpikeInterface extension test suite to cover round-trips and hash behavior.

Changes:

  • Implemented LogicalSISorting (Arrow large_string JSON envelope via to_dict()/load()), and SISortingHandler (SHA-256 over the same JSON bytes).
  • Extended register_spikeinterface_types() and default context config (v0.1.json) to register sorting support alongside recording support (optional, idempotent).
  • Added comprehensive tests for sorting serialization, round-trip, handler hashing, and context integration; added accompanying design spec + implementation plan docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/orcapod/extension_types/spikeinterface_types.py Adds LogicalSISorting + SISortingHandler; extends SI registration to include sortings.
src/orcapod/extension_types/__init__.py Exports LogicalSISorting conditionally when SpikeInterface is available.
src/orcapod/contexts/data/v0.1.json Auto-registers sorting logical type + handler via _optional: true; adds changelog entry.
tests/test_extension_types/test_spikeinterface_types.py Adds sorting-focused test coverage (importability, errors, round-trips, hashing, registration integration).
superpowers/specs/2026-07-02-si-sorting-logical-type-design.md Design spec documenting goals, architecture, error behavior, and tests for SI sorting support.
superpowers/plans/2026-07-02-si-sorting-logical-type.md Step-by-step implementation plan for adding SI sorting support (tasks, commands, expected outcomes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eywalker eywalker merged commit a050ae4 into main Jul 2, 2026
12 checks passed
@eywalker eywalker deleted the eywalker/itl-468-support-spikeinterface-basesorting-objects branch July 2, 2026 17:32
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.

2 participants