fix: restore value_map for empty-element preservation across metadata classes - #56
Merged
Merged
Conversation
… classes PR #55 fixed the cardinality bug in NisoSts metadata classes (MetadataIso, MetadataStd, RegMeta, NatMeta) but applied the value_map workaround inconsistently: - MetadataIso: comm-ref had value_map, secretariat did NOT (regression) - MetadataStd: both had value_map (correct) - RegMeta: neither had value_map (regression) - NatMeta: neither had value_map (regression) The cardinality work in PR #55 kept comm_ref and secretariat as singular attributes (sacrificing schema-conformance) to preserve empty elements in real fixtures via value_map: { to: { empty: :empty } }. The trade-off was only fully applied to MetadataStd; three of four metadata classes silently dropped empty <comm-ref/> and <secretariat/> elements on round-trip. This restores the value_map on all four classes uniformly: - lib/sts/niso_sts/metadata_iso.rb: secretariat (added) - lib/sts/niso_sts/reg_meta.rb: comm-ref, secretariat (both added) - lib/sts/niso_sts/nat_meta.rb: comm-ref, secretariat (both added) Adds a regression spec covering all four classes — discovered by the round-trip audit when validating BUGREPORT.metadata-iso-collection-types.md. Verification: with all four classes preserving both empty elements, the following round-trip works: <iso-meta><comm-ref/><secretariat/></iso-meta> -> MetadataIso.from_xml(...).to_xml -> <iso-meta><comm-ref/><secretariat/></iso-meta> 5202 examples, 0 failures (was 5198; +4 new cross-class regression specs). Rubocop clean.
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.
Summary
Validating
BUGREPORT.metadata-iso-collection-types.mdagainst current main (sts 0.6.10) revealed a regression from PR #55: thevalue_map: { to: { empty: :empty } }workaround that preserves empty<comm-ref/>and<secretariat/>elements was applied inconsistently across the four NisoSts metadata classes.Validation results (before this PR):
MetadataIsoMetadataStdRegMetaNatMetaFix
Restored
value_map: { to: { empty: :empty } }uniformly:lib/sts/niso_sts/metadata_iso.rb: secretariat (added)lib/sts/niso_sts/reg_meta.rb: comm-ref, secretariat (both added)lib/sts/niso_sts/nat_meta.rb: comm-ref, secretariat (both added)Regression spec
spec/niso_sts/metadata_cardinality_spec.rb— 4 new specs (one per metadata class) asserting both<comm-ref/>and<secretariat/>survive a parse → serialise round-trip. The specs would have failed the original PR #55 — caught during this validation.BUGREPORT validation verdict
The original BUGREPORT claims are fully addressed by PR #55 + this follow-up:
comm_ref/secretariat)doc_ident,doc_ref,page_count,pub_date,std_ident) stay singularmeta.std_ref = [sr1, sr2]andmeta.title_wrap = [tw1, tw2]) now serialise distinct entries<comm-ref/>and<secretariat/>round-trip cleanly through all four metadata classesTest plan
bundle exec rspec— 5202 examples, 0 failures (+4 cross-class regression)bundle exec rubocop— clean (537 files)<iso-meta><comm-ref/><secretariat/></iso-meta>round-trips for all 4 metadata classes