Audit A2 + A3: delete dead format_set, preserve strings in Parcel writer - #24
Merged
Conversation
A2 — delete dead code in CDDAL serializer:
format_set() and set_like() in lib/opencdd/cddal/serializer.rb were
unreachable. format_value() calls string_literal?() first, which
returns true for any string not matching UNQUOTED_VALUE_RE — and
that regex excludes parenthesized lists, so set_like?() could never
be reached. Removed both methods; format_value now does
quote-or-pass-through only.
A3 — preserve leading-zero strings through xlsx round-trip:
Parcel::Writer::add_data_sheets now passes types: :string to
ws.add_row. Previously caxlsx auto-typed numeric-looking strings
("001", "01") as Integer cells; roo read them back as 1, 1,
breaking semantically_equal?. Now all property values survive as
the strings they were stored as.
New spec/parcel_string_preservation_spec.rb verifies version="001"
and revision="01" survive a write → reload cycle.
import_pipeline_spec.rb scenario 3's TODO comment is updated: the
value-normalization gap is fixed for the specific case it described,
but a full semantically_equal? round-trip is still blocked by a
separate multilingual key normalization gap (MDC_P004_1 vs
MDC_P004.en) — flagged as a separate follow-up.
931 specs pass, 0 failures.
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.
Two audit findings from
data-private/TODO.full-cdd/17-architecture-audit-2026-06-25.md:A2 — Dead
format_setin CDDAL serializer (lib/opencdd/cddal/serializer.rb)format_setandset_like?were defined but unreachable.format_valuechecksstring_literal?first, andstring_literal?returnstruefor any string that doesn't matchUNQUOTED_VALUE_RE. The regex excludes(, so any parenthesized set-like string already gets routed toquote_stringbeforeset_like?is consulted.Removed both methods.
format_valuenow does quote-or-pass-through only.A3 — Parcel writer normalizes
"001"→"1"(lib/opencdd/parcel/writer.rb)Parcel::Writer#add_data_sheetswas callingws.add_row(row)without type hints. caxlsx auto-typed numeric-looking strings ("001","01") as Integer cells; roo read them back as1, breakingDatabase#semantically_equal?for any round-trip involving version/revision codes.Fix: pass
types: :stringtoadd_row. All property values are strings per IEC 61360 wire format, so this is correct semantically — not just a workaround.New spec
spec/parcel_string_preservation_spec.rbverifiesversion="001"andrevision="01"survive a write → reload cycle.Verification
import_pipeline_spec.rbgot its TODO updated — the value-normalization gap is fixed for the described case, but a fullsemantically_equal?round-trip is still blocked by a separate multilingual key normalization gap (MDC_P004_1vsMDC_P004.en). That's a different audit item; flagged in the spec comment.Not in scope
export_DETCLASSIFICATION_*.xlsfiles useCLASS_ID:=IECCDD_001(a non-standard supplier scheme, not an MDC_CNNN meta-class IRDI). Making the importer accept this needs a "synthesize IRDIs from non-standard supplier codes" path that doesn't exist yet. Separate PR.MDC_P023vsMDC_P021alias conflict) — needs VBA lookup to disambiguate. Separate PR.