diff --git a/src/smorg/integrations/linear/source.py b/src/smorg/integrations/linear/source.py index 0f69c97..9ecb9a7 100644 --- a/src/smorg/integrations/linear/source.py +++ b/src/smorg/integrations/linear/source.py @@ -567,12 +567,9 @@ def _estimate_of(raw: dict[str, Any]) -> str: estimate = raw.get("estimate") if estimate is None: return "" - if isinstance(estimate, bool) or not isinstance(estimate, (int, float)): - raise Malformed(f"'estimate' was {type(estimate).__name__}, expected a number") - is_whole = float(estimate).is_integer() - if is_whole: - return str(int(estimate)) - return str(estimate) + if not isinstance(estimate, dict): + raise Malformed(f"'estimate' was {type(estimate).__name__}, expected an object") + return optional_string(estimate, "name") def _due_date_of(raw: dict[str, Any]) -> str: diff --git a/tests/integrations/linear/fixtures/linear_issue_detail.json b/tests/integrations/linear/fixtures/linear_issue_detail.json index 5fd27e3..3ecf8a6 100644 --- a/tests/integrations/linear/fixtures/linear_issue_detail.json +++ b/tests/integrations/linear/fixtures/linear_issue_detail.json @@ -15,7 +15,7 @@ "project": "Improve Redis Scalability", "projectMilestone": {"id": "m1", "name": "Reduce forever data"}, "dueDate": "2026-09-30", - "estimate": 3, + "estimate": {"value": 3, "name": "M"}, "parentId": "ENG-0", "attachments": [ {"id": "a1", "title": "chore: widen the column", "subtitle": null, "url": "https://github.com/x/y/pull/12"}, diff --git a/tests/integrations/linear/test_source.py b/tests/integrations/linear/test_source.py index 8e83676..cdd6b9c 100644 --- a/tests/integrations/linear/test_source.py +++ b/tests/integrations/linear/test_source.py @@ -768,7 +768,7 @@ def test_detail_maps_every_property_and_sub_list(): assert detail.project == "Improve Redis Scalability" assert detail.milestone == "Reduce forever data" assert detail.due_date == "2026-09-30" - assert detail.estimate == "3" + assert detail.estimate == "M" assert (detail.parent.id, detail.parent.title) == ("ENG-0", "the parent epic") assert detail.parent.status_type == "started" @@ -874,15 +874,6 @@ def test_an_unparseable_due_date_is_malformed(): issue_detail_with(detail_handler({"issue": issue})) -def test_a_fractional_estimate_is_kept_and_a_whole_float_reads_as_an_integer(): - fractional = json.loads(json.dumps(DETAIL["issue"])) | {"estimate": 3.5} - detail = issue_detail_with(detail_handler({"issue": fractional})) - assert detail.estimate == "3.5" - whole = json.loads(json.dumps(DETAIL["issue"])) | {"estimate": 3.0} - detail = issue_detail_with(detail_handler({"issue": whole})) - assert detail.estimate == "3" - - def test_a_pull_request_tag_unwraps_like_an_issue_tag(): issue = json.loads(json.dumps(DETAIL["issue"])) | { "description": 'closed as '