Feature: Actor context commands – additional coverage (r3)
  Exercise uncovered helper functions and edge-case branches
  in actor_context.py (lines 41, 47, 53-58, 151-152, 155-160,
  201-202, 209-210, 386, 390, 392, 395-396, 402).

  Background:
    Given accov3 a temporary context directory

  # ── Helper: _default_context_base (line 41) ────────────────

  Scenario: Default context base returns home path when context_dir is None
    When accov3 I call _default_context_base with None
    Then accov3 the result should be the home cleveragents context path

  # ── Helper: _list_context_names (line 47) ───────────────────

  Scenario: Listing context names for non-existent directory returns empty
    When accov3 I call _list_context_names with a non-existent path
    Then accov3 the result should be an empty list

  # ── Helper: _context_size_kb (lines 53-58) ──────────────────

  Scenario: Context size computation for a populated context
    Given accov3 a context named "sizable" with some file content
    When accov3 I call _context_size_kb for "sizable"
    Then accov3 the size should be a non-negative number

  # ── Remove --all on empty dir (lines 151-152) ──────────────

  Scenario: Remove --all with no existing contexts prints message
    When accov3 I run remove --all --yes on empty context dir
    Then accov3 the result exit code should be 0
    And accov3 the output should contain "No contexts found to remove"

  # ── Remove --all without --yes, user cancels (lines 155-160) ─

  Scenario: Remove --all prompts and user cancels
    Given accov3 a context named "keepme" exists
    When accov3 I run remove --all without --yes and answer no
    Then accov3 the result exit code should be 0
    And accov3 the output should contain "Remove cancelled"
    And accov3 the context "keepme" should still exist

  # ── Remove single without --yes, user cancels (lines 201-202) ─

  Scenario: Remove single context prompts and user cancels
    Given accov3 a context named "precious" exists
    When accov3 I run remove "precious" without --yes and answer no
    Then accov3 the result exit code should be 0
    And accov3 the output should contain "Remove cancelled"
    And accov3 the context "precious" should still exist

  # ── Remove single with remaining contexts (lines 209-210) ──

  Scenario: Remove single context computes remaining size from others
    Given accov3 a context named "ctx-a" exists
    And accov3 a context named "ctx-b" exists
    When accov3 I run remove "ctx-a" with --yes
    Then accov3 the result exit code should be 0
    And accov3 the context "ctx-b" should still exist

  # ── Import YAML file (line 386) ─────────────────────────────

  Scenario: Import a context from a YAML file
    Given accov3 a valid YAML context file named "from-yaml.yaml"
    When accov3 I run import "yamlctx" from the YAML file
    Then accov3 the result exit code should be 0
    And accov3 the context "yamlctx" should still exist

  # ── Import JSON-decode error falls back to YAML (lines 390, 392) ─

  Scenario: Import a .json file with YAML content falls back to YAML parser
    Given accov3 a .json file containing valid YAML but invalid JSON
    When accov3 I run import "fallback" from the bad-json file
    Then accov3 the result exit code should be 0
    And accov3 the context "fallback" should still exist

  # ── Import non-dict data (lines 394-396) ────────────────────

  Scenario: Import a file containing a non-dict value fails
    Given accov3 a .json file containing a JSON list
    When accov3 I run import "listctx" from the list file
    Then accov3 the result exit code should be 1
    And accov3 the output should contain "must contain a JSON/YAML object"

  # ── Import infers name from filename stem (line 402) ────────

  Scenario: Import infers context name from filename when not in file data
    Given accov3 a .json file named "stemname.json" without context_name key
    When accov3 I run import without name from the stemname file
    Then accov3 the result exit code should be 0
    And accov3 the context "stemname" should still exist
