Skip to content

syncrule: a numeric errorOnFailure is EMPTY:0000435 with a quantity - #408

Merged
jesshaley merged 2 commits into
V2from
claude/error-on-failure-numeric
Nov 6, 2026
Merged

jesshaley merged 2 commits into
V2from
claude/error-on-failure-numeric

Conversation

@jesshaley

Copy link
Copy Markdown
Collaborator

Fixes the one DID-matlab test that fails on did-schema #292's registry:
did2.unittest.testMigratorsJClockAlignment/testAnUnreadParameterBecomesAMethodParameter (numeric case).

Root cause

A numeric errorOnFailure is not read by failureFlag (logical only), so it fell to
unreadParameters -> jParameterList -> jLabel -> did2.convert.registeredTerm('', 'errorOnFailure').
registeredTerm (src/did/+did2/+convert/registeredTerm.m:35-37) looks a name up by
did2.schema.termNameKey (src/did/+did2/+schema/termNameKey.m:21: lowercased, spaces,
underscores and hyphens removed; [term names match ignoring spacing], Jess Haley, 2026-10-29).
'errorOnFailure' and 'error on failure' share the key erroronfailure, so once #292
registers EMPTY:0000435 the "own name" path resolves to the term. On did-schema main (no row) it
stays errorOnFailure. Removing the synonym in did-schema fd807349 could not help: the match is by
name key, not synonym (termIndex.m:79-80).

Choice for the numeric case: the term, with a quantity

  • Keeping the v1 name would fight the decided lookup rule. An entry {node '', name 'errorOnFailure'}
    is refused by did2.schema.termRegistered once the term is registered ("registered with node
    EMPTY:0000435; give the node", termRegistered.m:50-51). It would also need a bypass of
    jLabel/registeredTerm for one name.
  • Writing EMPTY:0000435 'error on failure' with the number as a quantity is what the code already
    produced on testMigratorsJ: an openMINDS id that does not rebuild, now that C. elegans's does #292's registry. The round trip (did2.convert.roundtrip.syncrule) already maps
    'error on failure' back to errorOnFailure, and entryValue rebuilds the type from the value form:
    logical gives a logical, quantity gives a number. So it is lossless for both.
  • The migrator now writes the numeric case itself (failureValue: one logical, or one finite real
    number), so the output no longer depends on whether the registry holds the row. A non-finite number
    still carries the rule as v1, and any other value type still goes through jParameterList.

Test change, and why

The numeric expectation ("one parameter named 'errorOnFailure'") was written against a registry
without the EMPTY:0000435 row. Under the decided name-key lookup, the name cannot survive once the
term is registered. The test now expects 'error on failure', node EMPTY:0000435, quantity.value 1,
and no 'errorOnFailure'. Added testRawV1RoundTripDaq/testANumericErrorOnFailureRoundTrips, which
checks that the v1 rule with errorOnFailure = 1 round-trips.

How this was tested

I did not run anything locally; MATLAB is not available here. This PR's CI runs against did-schema
main, where the migrator writes the term node as given. It runs against #292's registry only when
did-schema #292's own "DID-matlab V2 quick tests on this schema" job is re-run after this merges.


Generated by Claude Code

…tity

Root cause of the did-schema #292 failure in
testAnUnreadParameterBecomesAMethodParameter: a numeric errorOnFailure fell
to unreadParameters -> jParameterList -> jLabel -> did2.convert.registeredTerm('',
'errorOnFailure'), which looks the name up by did2.schema.termNameKey
(lowercased, spaces/underscores/hyphens removed). 'errorOnFailure' and
'error on failure' share the key 'erroronfailure', so once #292 registers
EMPTY:0000435 the own-name path resolves to the term; on did-schema main
(no row) it stays 'errorOnFailure'. The output depended on the registry.

The migrator now writes a finite numeric errorOnFailure itself as
EMPTY:0000435 'error on failure' with its number as a quantity (a logical
stays `logical`), so the result is the same with or without the registry
row and the round trip rebuilds the type from the value form. The test
expected the v1 name, which the decided lookup rule ([term names match
ignoring spacing]) cannot keep once the term is registered; it now expects
the term with a quantity. Adds a round-trip test for the numeric case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
@jesshaley
jesshaley marked this pull request as ready for review November 6, 2026 19:17
@jesshaley
jesshaley merged commit 20b2756 into V2 Nov 6, 2026
11 checks passed
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (edda1cd) to head (c4d50d8).
⚠️ Report is 7 commits behind head on V2.

Additional details and impacted files
@@    Coverage Diff    @@
##   V2   #408   +/-   ##
=========================
=========================

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jesshaley
jesshaley deleted the claude/error-on-failure-numeric branch November 25, 2026 21:46
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