# These tests target bug #523 and are expected to fail until the fix is applied.
# bootstrap_builtin_types() is never called during initialization, so the
# built-in fs-directory resource type is not seeded into the database.

Feature: Built-in fs-directory Resource Type Bootstrap
  As a CleverAgents user
  I want the built-in fs-directory resource type to be available after initialization
  So that I can run "agents resource add fs-directory" without "Resource type not found"

  # ── Bug reproduction: init path does NOT call bootstrap ────
  # This scenario is the TDD failing test.  It creates a registry WITHOUT
  # calling bootstrap_builtin_types() and asserts fs-directory exists.
  # It will fail until the fix integrates bootstrap into the init path.
  #
  # NOTE FOR FIX AUTHOR: If the chosen fix is to call bootstrap inside
  # init_command() / initialize_project() rather than in
  # ResourceRegistryService.__init__(), you will need to update the Given
  # step to exercise the init path instead of constructing a bare service.

  @tdd_issue @tdd_issue_523 @tdd_issue_4178
  Scenario: fs-directory type exists after init without explicit bootstrap call
    Given a fresh in-memory resource registry without bootstrap
    When I query the fs bootstrap resource type registry for "fs-directory"
    Then the bootstrap fs resource type "fs-directory" should exist

  # ── Regression: bootstrap function itself works correctly ──

  @tdd_issue @tdd_issue_523 @tdd_issue_4178
  Scenario: After initialization fs-directory type exists in the registry
    Given a fresh in-memory resource registry with bootstrap
    When I query the fs bootstrap resource type registry for "fs-directory"
    Then the bootstrap fs resource type "fs-directory" should exist
    And the bootstrap fs resource type kind should be "physical"
    And the bootstrap fs resource type sandbox_strategy should be "copy_on_write"

  # ── CLI add command ────────────────────────────────────────

  @tdd_issue @tdd_issue_523 @tdd_issue_4178
  Scenario: resource add fs-directory succeeds after bootstrap
    Given a fresh in-memory resource registry with bootstrap
    When I run resource add for type "fs-directory" named "local/test" with path "/tmp/test"
    Then the resource add command should succeed
    And the resource add output should contain "Added resource"
    And the resource add output should not contain "Resource type not found"
