Skip to content

did2: daqmetadatareader migrator preserves tab_separated_file_parameter#135

Merged
stevevanhooser merged 2 commits into
V2from
claude/did-schema-50-preserve-tsv-field
May 21, 2026
Merged

did2: daqmetadatareader migrator preserves tab_separated_file_parameter#135
stevevanhooser merged 2 commits into
V2from
claude/did-schema-50-preserve-tsv-field

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Companion to waltham-data-science/did-schema#51 (which restores daqmetadatareader.tab_separated_file_parameter in V_delta as an optional pass-through field).

Summary

Update the daqmetadatareader migrator to preserve a populated v1 tab_separated_file_parameter value rather than silently dropping it. Real v1 corpora populate this "lazy hook" for TSV-per-epoch metadata sources; round-trip preservation lets them migrate cleanly without needing to synthesize a daqmetadatareader_tsv subclass per document.

What changed

  • src/did/+did2/+convert/+migrators/daqmetadatareader.m — when the v1 block carries tab_separated_file_parameter, copy it into the V_delta newBlock under the same key. Idempotent if the v1 source lacks the field (the V_delta schema declares it mustBeNonEmpty: false, so absent is also valid). Docstring updated to reference the V_delta schema decision.

  • tests/+did2/+unittest/testMigrators.m:

    • testDaqmetadatareaderRenamesReaderClass — updated to assert tab_separated_file_parameter is now preserved (previously asserted dropped). The reader_class rename and ndi_daqmetadatareader_class drop assertions are unchanged.
    • testDaqmetadatareaderTabSeparatedHookAbsentStaysAbsent — new: a v1 body without the optional hook does not gain an empty one in V_delta.
    • testDaqmetadatareaderTabSeparatedHookRoundtripsAlreadyVDelta — new: a body already in V_delta shape (with both reader_class and tab_separated_file_parameter) passes through unchanged.

CI dependency on did-schema#51

The validator at src/did/+did2/+schema/cache.m::validateDocument enforces a strict-fields check that raises did2:validation:undeclaredField for any property-block field not declared by the class schema. Until did-schema#51 merges to main (which this repo's CI workflow checks out at ref: main in .github/workflows/test-code.yml), the V_delta daqmetadatareader schema does not declare tab_separated_file_parameter, so any corpus test that runs a v1 doc with the TSV hook populated through did2.convert.v1_to_v2(..., Validate=true) will fail here.

Expected merge order: merge did-schema#51 first, then this PR will go green.

The migrator-level tests added here do not validate (they call did2.convert.migrators.daqmetadatareader and universalRenames directly), so they pass independently of the schema state. The risk is only in the larger end-to-end corpus tests (PRED, 20211116) if any of those v1 docs populate the TSV hook.

Test plan

CI will tell us. Local environment has no MATLAB per AGENTS.md.


Generated by Claude Code

claude added 2 commits May 21, 2026 11:27
Companion to did-schema#51 (closed by waltham-data-science PR #51):
V_delta restores tab_separated_file_parameter as an optional
pass-through field. Update the migrator to preserve a populated
v1 value rather than silently dropping it. Existing v1 corpora
that populate the TSV hook now roundtrip cleanly.

Changes:
- src/did/+did2/+convert/+migrators/daqmetadatareader.m: when the
  v1 block carries tab_separated_file_parameter, copy it into the
  V_delta newBlock under the same key. Idempotent if the v1
  source lacks the field (the V_delta schema declares it
  mustBeNonEmpty: false, so absent is also valid). Documentation
  rewritten to reference the V_delta schema decision and
  did-schema#50.

- tests/+did2/+unittest/testMigrators.m:
  * testDaqmetadatareaderRenamesReaderClass updated to assert
    tab_separated_file_parameter is now preserved (was previously
    asserted dropped). The reader_class rename and
    ndi_daqmetadatareader_class drop are unchanged.
  * testDaqmetadatareaderTabSeparatedHookAbsentStaysAbsent --
    new test: a v1 body without the optional hook does not gain
    an empty one in V_delta.
  * testDaqmetadatareaderTabSeparatedHookRoundtripsAlreadyVDelta
    -- new test: a body already in V_delta shape (with both
    reader_class and tab_separated_file_parameter) passes
    through unchanged.

Dependency: did-schema#51 must merge first so the validator
accepts the field in the property block (V_delta's strict-fields
check would otherwise raise
did2:validation:undeclaredField against any preserved value).
CI on this PR will fail until that merge completes.
@stevevanhooser stevevanhooser merged commit b524299 into V2 May 21, 2026
3 of 4 checks passed
@stevevanhooser stevevanhooser deleted the claude/did-schema-50-preserve-tsv-field branch May 21, 2026 13:59
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