← Back to Pull requests

Accept integers for float attributes in the YAML frontend #1068

Open
unknown opened this pull request with 260 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 14, 2026 19:11 UTC
Author

Description

In YAML launch files, a float attribute written as a whole number fails to parse. period: 5 on a timer raises TypeError: Attribute 'period' of Entity 'timer' expected to be of type '<class 'float'>', got '<class 'int'>', and sigterm_timeout, sigkill_timeout and respawn_delay on executable fail the same way (#1067). YAML loads 5 as an int, and Entity.get_attr in launch_yaml checks it with is_instance_of(data, float), which rejects ints. The XML frontend converts the attribute string, and period="5" works there.

This PR converts a plain int to float in launch_yaml's Entity.get_attr when data_type is float. The check is type(data) is int, which keeps rejecting bool values such as period: true. is_instance_of is unchanged, since test_type_utils.py asserts that it rejects ints for floats. The get_attr docstring, which says launch_yaml does not apply type coercion, now names this exception.

Fixes #1067

Is this user-facing behavior change?

Yes. YAML launch files can give period, sigterm_timeout, sigkill_timeout and respawn_delay as whole numbers such as 5. Before this change they needed a decimal point, as in 5.0.

Did you use Generative AI?

Yes. Claude Code (Claude Opus 5.5) found the bug, wrote the change and the test, and ran the tests below. I reviewed the diff and the test results before opening this pull request.

Additional Information

The new launch_yaml/test/launch_yaml/test_timer.py is the YAML version of the XML test_timer, with period: 5. It fails on rolling without the fix.

Tested with launch, launch_xml and launch_yaml from source in a Python 3.12 venv:

  • launch_yaml: 30 passed and launch_xml: 62 passed, including their flake8, pep257 and copyright tests. ament_xmllint was not installed.

  • launch: 295 passed. test_mypy and test_xmllint did not run without ament_mypy and ament_xmllint. This PR does not change the launch package.
  • The Python API is unchanged: TimerAction(period=5) still raises a TypeError.

    Diff: 260 lines (+195 / -65) across 3 files Reviewer: fujitatomoya Review duration: 4085m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 260 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.333
    Real PR Conversation Timeline
    1 comments
    "Review active on #1068"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.9% · Safe to merge
    20.9%
    Repository