Time time_convert symmetry parity + compute finalize→advance rename (issue #58)#59
Merged
Merged
Conversation
Addresses NDI-python issue #58 (2026-06 audit parity with NDI-matlab #828). Symmetry parity (audit item 28): add the Python time_convert symmetry test mirroring NDI-matlab's tests/+ndi/+symmetry/+time/scenario.m. - ndi.time.syncgraph.time_convert: add a same-referent fast path that resolves a conversion directly from the referent's epoch table (no syncgraph construction, no DAQ readers), mirroring the MATLAB reference. Same-clock conversions are the identity; cross-clock conversions rescale linearly between the two clocks' [t0 t1] ranges. - tests/symmetry/_time_scenario.py: shared scenario (SCENARIO, _SpecRef, case_defs, run_cases, expected) matching the MATLAB scenario spec. - tests/symmetry/{make,read}_artifacts/time: make writes timeConvertCases.json and asserts each case equals the MATLAB- authoritative expected() before writing; read reproduces the scenario and compares MATLAB vs Python artifacts, skipping when absent. Compute finalize -> advance rename (audit item): the cloud API exposes only POST /compute/{sessionId}/advance, so rename finalizeSession -> advanceSession and update the endpoint, the bridge mapping, and tests.
The cross-language symmetry job runs MATLAB twice (Stage 1 makeArtifacts, Stage 3 readArtifacts) with a Python stage in between, so two separate MATLAB sessions are unavoidable. Previously each session called matbox.installRequirements, and the second call re-validates the already-installed dependency repos -- failing any that lack a LICENSE/README (e.g. ndi-ontology-matlab). NDI-matlab's own CI installs only once, which is why it never hit this. Install once in Stage 1, save the fully-resolved search path (NDI dirs + matbox dependencies) to a workspace file, and restore it in Stage 3 instead of re-installing. The dependency files persist on the runner between steps; only the path needs restoring. This removes the redundant install and sidesteps the re-validation entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses NDI-python issue #58 (2026-06 audit parity with the merged NDI-matlab #828).
Symmetry parity (audit item 28) —
time_convertThe Python repo had no time symmetry test, while NDI-matlab has
tests/+ndi/+symmetry/+time/scenario.m. MATLAB resolves these cases through a same-referent fast path that Python'stime_convertlacked entirely (it only built a graph from DAQ systems). This PR adds that path and the matching tests, treating the MATLABscenarioas the source of truth.src/ndi/time/syncgraph.py— add a same-referent fast path: whentimeref_in.referent == referent_outand the referent exposesepochtable, the conversion is resolved straight from the referent's epoch table (no syncgraph construction, no DAQ readers). Same-clock conversions are the identity; cross-clock conversions rescale linearly between the two clocks'[t0 t1]ranges. Existing graph-based behavior is untouched (the path only triggers for equal referents that provideepochtable).tests/symmetry/_time_scenario.py— shared scenario (SCENARIO,_SpecRef,case_defs,run_cases,expected) mirroring the MATLAB spec.tests/symmetry/make_artifacts/time/— writestimeConvertCases.jsonand asserts each case equals the MATLAB-authoritativeexpected()before writing.tests/symmetry/read_artifacts/time/— reproduces the scenario and compares MATLAB↔Python artifacts, skipping when one side is absent.Compute
finalize→advancerenameThe cloud API exposes only
POST /compute/{sessionId}/advance(no/finalize). RenamedfinalizeSession→advanceSession, updated the endpoint, thendi_matlab_python_bridge.yamlmapping, and the compute tests.Testing
matlabArtifactshalves, expected without a MATLAB run locally).ruff check src/ tests/andblackclean.The cross-language symmetry workflow (audit item 3) runs on the GitHub-hosted runner with MATLAB + the updated NDI-matlab
main. The two "Deferred" items in the issue (JWT-off-env-vars, datenum-vs-epoch) are joint cross-client decisions and are intentionally left untouched.https://claude.ai/code/session_011GnpJTuXBcTPQzu2BNX2v7
Generated by Claude Code