Skip to content

Condition::ClassReference + lutaml-model migration plan (TODO 19)#17

Merged
ronaldtse merged 1 commit into
mainfrom
feat/condition-classref-lutaml-plan
Jul 23, 2026
Merged

Condition::ClassReference + lutaml-model migration plan (TODO 19)#17
ronaldtse merged 1 commit into
mainfrom
feat/condition-classref-lutaml-plan

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements TODO 19 from the cdd-data 2026-07-23 session.

Item 1: Condition grammar — ClassReference subclass (code)

IEC 62683 stores property conditions as bare class-reference sets like
{0112/2///62683#ACE132}, which Opencdd::Condition.parse previously
rejected. The workaround in Property#condition rescued ArgumentError
and returned nil — silently dropping the data.

This PR adds Opencdd::Condition::ClassReference per the approved
grammar:

condition       := expression | class_reference
expression      := identifier OP (literal | set)
class_reference := irdi | set
set             := "{" element ("," element)* "}"
element         := irdi | identifier

Files changed:

  • lib/opencdd/condition.rb — new ClassReference subclass; parse
    dispatches bare IRDI / bare set to it. Malformed input (e.g.
    "no operator here") still raises ArgumentError.
  • lib/opencdd/property.rb — removed the rescue ArgumentError;
    class references now parse instead of becoming nil.
  • lib/opencdd/validator/condition_rule.rb — comment clarification;
    existing !parse(value).nil? already accepts ClassReference.
  • spec/condition_spec.rb — 14 new cases (bare IRDI, bare set,
    satisfaction, round-trip, equality, cross-type comparison).
  • spec/validator_spec.rb — 2 new R11 cases for class references.

Item 2: lutaml-model migration — full phased plan (docs)

Expands the TODO 19 Item 2 summary into a fully-decisioned plan with
all three user decisions applied:

  1. Per-item + single-file layouts coexist (per-item default).
  2. YAML default, JSON as format: override.
  3. Multilingual fields as nested maps in YAML/JSON; flat only in Parcel xlsx.

Files added:

  • TODO.final/19b-lutaml-model-migration.md — full plan for Phases
    2.1 (done) → 2.5, with files-to-change, acceptance criteria, risks,
    and how each decision shows up per phase.
  • TODO.final/19-condition-grammar-and-lutaml-migration.md — pointer
    from the proposal summary to the detailed plan.

Pending-spec cleanup (drive-by)

  • spec/database/public_api_coverage_spec.rbfind_by_name was
    perpetually skipped; added MDC_P004.en to the fixture's klass
    and wrote 4 real cases.
  • spec/parcel/round_trip_matrix_spec.rb — removed the
    CDDAL→JSON→CDDAL placeholder; replaced with a comment deferring to
    Phase 2.5 (which makes the round-trip implementable).

Test plan

  • bundle exec rspec spec/condition_spec.rb — 31 examples, 0 failures
  • bundle exec rspec spec/validator_spec.rb -e "R11" — 4 examples, 0 failures
  • bundle exec rspec (full suite) — 930 examples, 0 failures, 0 pending
  • No new def to_h / from_h / to_hash introduced
  • No AI attribution in commit message

Adds Condition::ClassReference subclass supporting bare IRDI and bare
set conditions per the approved grammar. Removes the rescue
ArgumentError from Property#condition that was silently dropping
IEC 62683 class-reference data.

Includes the full phased lutaml-model migration plan (Phases 2.1-2.5)
with all 3 user decisions applied: per-item + single-file coexist,
YAML default, nested multilingual maps.

Drive-by: fixes 2 perpetual skips. find_by_name gets real coverage
after setting preferred_name on the fixture; the CDDAL->JSON->CDDAL
placeholder is removed (deferred to Phase 2.5).

930 specs, 0 failures, 0 pending.
@ronaldtse
ronaldtse merged commit bae0c56 into main Jul 23, 2026
1 check passed
@ronaldtse
ronaldtse deleted the feat/condition-classref-lutaml-plan branch July 23, 2026 15:59
ronaldtse added a commit that referenced this pull request Jul 24, 2026
… 1 shipped

Moves the IEC 62656-1 column-name to property-ID table from
entity/name_synthesizer.rb into Opencdd::PropertyIds::IEC_COLUMN_NAMES
(the lint-exempt SSOT). name_synthesizer.rb now holds a one-line
alias; no public-API change. CI lint-no-raw-mdc passes.

Also adds a Status header to TODO.final/19 marking Item 1
(ClassReference) as shipped in commit bae0c56 / PR #17, since the
TS team had no signal that this was real API and not a proposal.

930 specs, 0 failures, lint green.
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.

1 participant