Skip to content

Time time_convert symmetry parity + compute finalize→advance rename (issue #58)#59

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/dazzling-ramanujan-n3fhsd
Jun 15, 2026
Merged

Time time_convert symmetry parity + compute finalize→advance rename (issue #58)#59
stevevanhooser merged 2 commits into
mainfrom
claude/dazzling-ramanujan-n3fhsd

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Addresses NDI-python issue #58 (2026-06 audit parity with the merged NDI-matlab #828).

Symmetry parity (audit item 28) — time_convert

The 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's time_convert lacked entirely (it only built a graph from DAQ systems). This PR adds that path and the matching tests, treating the MATLAB scenario as the source of truth.

  • src/ndi/time/syncgraph.py — add a same-referent fast path: when timeref_in.referent == referent_out and the referent exposes epochtable, 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 provide epochtable).
  • tests/symmetry/_time_scenario.py — shared scenario (SCENARIO, _SpecRef, case_defs, run_cases, expected) mirroring the MATLAB spec.
  • tests/symmetry/make_artifacts/time/ — writes timeConvertCases.json and asserts each case equals the MATLAB-authoritative expected() before writing.
  • tests/symmetry/read_artifacts/time/ — reproduces the scenario and compares MATLAB↔Python artifacts, skipping when one side is absent.

Compute finalizeadvance rename

The cloud API exposes only POST /compute/{sessionId}/advance (no /finalize). Renamed finalizeSessionadvanceSession, updated the endpoint, the ndi_matlab_python_bridge.yaml mapping, and the compute tests.

Testing

  • Python symmetry suite: 35 passed, 22 skipped (skips are the matlabArtifacts halves, expected without a MATLAB run locally).
  • Full suite: 1568 passed. The only failures are 2 live ontology lookups (external NCBI/cell-ontology APIs, sandbox-blocked) and 2 pre-existing license-guard collection errors — all unrelated to this change.
  • ruff check src/ tests/ and black clean.

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

claude added 2 commits June 15, 2026 15:57
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.
@stevevanhooser stevevanhooser merged commit ed78f8b into main Jun 15, 2026
5 checks passed
@stevevanhooser stevevanhooser deleted the claude/dazzling-ramanujan-n3fhsd branch June 15, 2026 20:00
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