Reject mismatched scalar values in set_message_fields #42
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.43) × (1 − Review Confidence (0.41)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 189 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.314
Real PR Conversation Timeline
1 comments
"Review active on #42"
general
weight: 0.35
dlanov
Description
set_message_fields()currently falls back to calling the target Python type as a constructor when the supplied value has a different type. For primitive scalar fields, this can silently change the value instead of raising the documentedTypeError, for example:bool("false")becomesTruebool(-1)becomesTrueint(1.5)becomes1str(True)becomes"True"This change rejects unsafe cross-type coercions while preserving compatible scalar inputs that previously worked.
Compatible inputs include:
numpy.float64 -> float,numpy.int64 -> int, andnumpy.bool_ -> boolBoolean values are explicitly excluded from integer and float fields even though Python treats
boolas a subclass ofint.Container, nested-message, NumPy array, buffer,
Header: auto, andTime: nowhandling are unchanged.Fixes #41
Testing
test/rosidl_runtime_py/test_set_message.py: 15 passedgit diff --checkpassedLocal testing required a temporary
PYTHONPATHstub for the missingrosidl_bufferpackage in the WSL environment; the same import failure reproduces on a clean checkout and no environment workaround is included in this change.