OrionBelt converter drops a field's logical datatype in both directions
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 82/100
Research direction
Start in ossie_to_obml.py and obml_to_ossie.py, focusing on _convert_field and _convert_column. Read tests/test_ossie_metric_no_silent_loss.py and run the suggested explicit datatype round-trip test. Done means spec datatype values map correctly in both directions and the canonical datatype field is emitted, while existing tests remain green.
Written by the indexing model from the issue text.
Description
Summary
Neither conversion direction carries a field's logical type through the
canonical spec datatype field:
- Ossie->OBML ignores the declared
datatypeand derives OBML
abstractTypefrom a column-name heuristic, so aStringfield can be
emitted as numeric and vice-versa (wrong type). - OBML->Ossie never writes the spec
datatypefield at all - the type is
stashed only inside an OrionBeltcustom_extensionsblob (missing type).
A round-trip appears lossless only because the converter is self-consistent
with its own non-spec key; any other spec-compliant tool sees wrong or absent
types.
Root cause
Ossie->OBML (ossie_to_obml.py):
ossie_type = field.get("data_type", "") # (1) wrong key
if ossie_type and ossie_type in OSSIE_TO_OBML_TYPE: # (2) wrong-cased map
abstract_type = OSSIE_TO_OBML_TYPE[ossie_type]
else:
abstract_type = self._infer_obml_type(field)
- Wrong key. The spec field is
datatype, no underscore, so the branch is dead - Wrong-cased map. The spec enum is capitalized, but
OSSIE_TO_OBML_TYPEis keyed lowercase with different terms.
Even after fixing the key, case-normalizing is not enough:
DateTime/DateTimeTz/Decimal/Floathave no key - so case-normalizing is not enough
OBML->Ossie: canonical field never written (obml_to_ossie.py).
The type goes only into a vendor extension, under the non-spec key
data_type with a lowercase value; field["datatype"] is not set.
Illustrative Repro
# Ossie -> OBML: declared datatype ignored
for f, want in [({"name": "total_amount", "datatype": "String"}, "string"),
({"name": "customer_id", "datatype": "Integer"}, "int")]:
_, col = OssietoOBML(ossie={})._convert_field(dict(f))
got = col["abstractType"]
print(f"fwd {f['datatype']:8} -> {got:8} (want {want}) [{'OK' if got==want else 'BUG'}]")
# OBML -> Ossie: canonical datatype never emitted
field = OBMLtoOssie(obml={})._convert_column("customer_id", {"code": "customer_id",
"abstractType": "int"}, "Orders", {})
print("rev canonical 'datatype' present?", "datatype" in field, "[BUG]" if "datatype" not in field else "")
Why this survived
The existing fixtures (test_ossie_converter_vendors, test_ossie_metric_no_silent_loss)
use the same wrong key data_type, so the suite stays green with the bug present.
Drop-in test (currently fails). Suggested home:
tests/test_ossie_metric_no_silent_loss.py, which already guards this "no
silent loss on field conversion" path.
def test_explicit_datatype_roundtrips():
_, col = OssietoOBML(ossie={})._convert_field({"name": "total_amount", "datatype": "String"})
assert col["abstractType"] == "string" # fwd: currently 'float'
field = OBMLtoOssie(obml={})._convert_column("total_amount",
{"code": "total_amount", "abstractType": "string"}, "Orders", {})
assert field.get("datatype") == "String" # rev: currently missing
Suggested fix
- Ossie->OBML: read
field.get("datatype")(fix the comment); rebuild
OSSIE_TO_OBML_TYPEon the spec enum - OBML->Ossie: set the canonical
field["datatype"](capitalized enum value)
in addition to any extension bookkeeping.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 280
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/ossie
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·