Feature: ResourceTypeSpec inheritance cycle detection for multi-level cycles
  ADR-042 defines single-inheritance for resource types.
  The validation should detect not only direct self-inheritance (A→A)
  but also multi-level cycles (A→B→A, A→B→C→A, etc.)

  Background:
    Given a resource type registry for cycle detection

  # ── Direct self-inheritance (existing behavior) ──────────────────────────

  Scenario: Direct self-inheritance is rejected
    When I create a ResourceTypeSpec with name "acme/looper" inheriting "acme/looper"
    Then the creation should fail with "cannot inherit from itself"

  # ── Two-level cycles (new behavior) ──────────────────────────────────────

  Scenario: Two-level cycle A→B→A is detected
    Given a registered type "acme/alpha" inheriting from "acme/beta"
    When I create a ResourceTypeSpec with name "acme/beta" inheriting "acme/alpha"
    Then the creation should fail with either "circular" or "cycle"

  # ── Three-level cycles (new behavior) ────────────────────────────────────

  Scenario: Three-level cycle A→B→C→A is detected
    Given a registered type "acme/alpha" inheriting from "acme/beta"
    And a registered type "acme/beta" inheriting from "acme/gamma"
    When I create a ResourceTypeSpec with name "acme/gamma" inheriting "acme/alpha"
    Then the creation should fail with either "circular" or "cycle"

  # ── Valid multi-level inheritance (should succeed) ──────────────────────

  Scenario: Valid three-level chain A→B→C succeeds
    Given a registered type "acme/alpha" inheriting from "acme/beta"
    And a registered type "acme/beta" inheriting from "acme/gamma"
    When I create a ResourceTypeSpec with name "acme/gamma" inheriting nothing
    Then the creation should succeed

  Scenario: Valid two-level chain A→B succeeds
    Given a registered type "acme/alpha" inheriting from "acme/beta"
    When I create a ResourceTypeSpec with name "acme/beta" inheriting nothing
    Then the creation should succeed

  # ── Depth limit (DoS guard) ───────────────────────────────────────────────

  Scenario: Inheritance chain exceeding the depth limit is rejected
    When I create a ResourceTypeSpec whose ancestry chain exceeds the depth limit
    Then the creation should fail with "exceeds"
