@tdd_issue @tdd_issue_989 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. The @tdd_expected_fail tag has been removed # because the bugfix for #989 is included in the same commit. The test now # verifies the corrected behavior: a CorruptRecordError is raised instead # of a raw JSONDecodeError. 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 Scenario: Bug #989 — corrupt guards_json also raises CorruptRecordError Given an automation profile repository row with corrupt guards_json for bug 989 When the corrupt guards automation profile is fetched by name for bug 989 Then a corruption-specific domain error should be raised for guards_json for bug 989 Scenario: Bug #989 — _from_domain raises CorruptRecordError for malformed safety Given a domain profile object with malformed safety data for bug 989 When _from_domain is called with the malformed profile for bug 989 Then a corruption-specific domain error should be raised for the serialization for bug 989