@tdd_issue @tdd_issue_989 @tdd_expected_fail
Feature: TDD Bug #989 — automation profile persistence crashes on corrupt JSON
  As a developer reading persisted automation profiles
  I want corrupt JSON payloads to be handled with a domain-specific error
  So that callers do not receive a raw JSONDecodeError crash

  # This test captures bug #989. It intentionally uses @tdd_expected_fail
  # until the bugfix for #989 is merged. The underlying assertion currently
  # fails (proving the bug exists) and the tag inversion makes CI pass.

  Scenario: Bug #989 — get_by_name should not leak JSONDecodeError for corrupt safety_json
    Given an automation profile repository row with corrupt safety_json for bug 989
    When the corrupt automation profile is fetched by name for bug 989
    Then a corruption-specific domain error should be raised instead of JSONDecodeError for bug 989
