051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
Added 52 new .feature files and corresponding _steps.py files targeting previously uncovered code paths in the following areas: - TUI layer: app, commands, persona (state/schema/registry), widgets, input (shell_exec, reference_parser) - Application services: plan lifecycle/service/executor, session, project, repo indexing, correction, checkpoint, actor, llm_actors, strategy coordinator, resource file watcher, service retry wiring - CLI commands: session, resource, repl, plan, db, automation_profile - Domain models: retry_policy, resource_type, cost_budget, docker_compose_analyzer, detail_level, _sql_string_aware, _postgresql_helpers - Core: circuit_breaker, retry_service_patterns - Infrastructure: repositories, transaction_sandbox, strategy_registry, plugins/loader, container - Config: settings - Agents: plan_generation, context_analysis, auto_debug - A2A: facade All new tests follow the Behave/Gherkin BDD standard. Resolved step definition collisions with unique prefixes. Fixed Alembic fileConfig logger disabling issue (disable_existing_loggers=False). ISSUES CLOSED: #1068
191 lines
7.5 KiB
Gherkin
191 lines
7.5 KiB
Gherkin
Feature: REPL CLI Coverage Boost
|
|
Additional scenarios that exercise previously uncovered code paths
|
|
in the cleveragents.cli.commands.repl module.
|
|
|
|
Background:
|
|
Given the repl module is imported
|
|
|
|
# --- _build_reference_catalog: file limit break (line 222) ---
|
|
|
|
Scenario: Reference catalog stops collecting after MAX_REFERENCE_FILES
|
|
Given a temporary directory with more files than the reference limit
|
|
When I build the reference catalog from that directory
|
|
Then the catalog file list should be capped at the maximum
|
|
|
|
# --- _expand_references: category match but no fuzzy match (lines 331-332) ---
|
|
|
|
Scenario: Expand references with known category but no matching value
|
|
Given a reference catalog with an empty actor list
|
|
When I expand the reference "@actor:nonexistent" using that catalog
|
|
Then the token should remain unchanged as "@actor:nonexistent"
|
|
|
|
# --- _reference_suggestions: empty raw token (line 360) ---
|
|
|
|
Scenario: Reference suggestions skip bare at-sign tokens
|
|
Given a reference catalog with some files
|
|
When I request suggestions for a line containing only "@"
|
|
Then no suggestions should be returned
|
|
|
|
# --- _print_persona_list: empty list (lines 423-424) ---
|
|
|
|
Scenario: Persona list prints warning when no personas exist
|
|
Given a mock persona registry that returns no personas
|
|
When I call print persona list
|
|
Then the output should contain a no-personas warning
|
|
|
|
# --- _parse_persona_create: unknown flags skipped (line 467) ---
|
|
|
|
Scenario: Parse persona create skips unknown flags
|
|
When I parse persona create with tokens "create mybot --actor ns/bot --unknown-flag val"
|
|
Then the resulting persona should have name "mybot" and actor "ns/bot"
|
|
|
|
# --- _parse_persona_create: missing --actor (line 469) ---
|
|
|
|
Scenario: Parse persona create raises when actor is missing
|
|
When I parse persona create with tokens "create mybot --description hello"
|
|
Then a ValueError about missing actor should be raised
|
|
|
|
# --- _parse_persona_create: too few tokens (line 434) ---
|
|
|
|
Scenario: Parse persona create raises when too few tokens given
|
|
When I parse persona create with only two tokens
|
|
Then a ValueError about usage should be raised
|
|
|
|
# --- _parse_persona_create: --cycle-order invalid (lines 463-464) ---
|
|
|
|
Scenario: Parse persona create rejects non-integer cycle-order
|
|
When I parse persona create with a non-integer cycle-order
|
|
Then a ValueError about cycle-order should be raised
|
|
|
|
# --- /persona set missing name (lines 506-507) ---
|
|
|
|
Scenario: Slash command persona set without a name shows error
|
|
Given a mock persona registry for slash commands
|
|
When I handle slash command "persona set"
|
|
Then the repl slash exit code should be 2
|
|
|
|
# --- /persona pick with no personas (lines 529-530) ---
|
|
|
|
Scenario: Slash command persona pick with no personas shows warning
|
|
Given a mock persona registry that returns no personas for slash commands
|
|
When I handle slash command "persona pick"
|
|
Then the repl slash exit code should be 1
|
|
|
|
# --- /persona delete without name (lines 558-559) ---
|
|
|
|
Scenario: Slash command persona delete without a name shows error
|
|
Given a mock persona registry for slash commands
|
|
When I handle slash command "persona delete"
|
|
Then the repl slash exit code should be 2
|
|
|
|
# --- /persona delete not found (lines 566-567) ---
|
|
|
|
Scenario: Slash command persona delete for nonexistent persona
|
|
Given a mock persona registry that cannot delete for slash commands
|
|
When I handle slash command "persona delete ghostbot"
|
|
Then the repl slash exit code should be 1
|
|
|
|
# --- /persona export without name (lines 579-580) ---
|
|
|
|
Scenario: Slash command persona export without a name shows error
|
|
Given a mock persona registry for slash commands
|
|
When I handle slash command "persona export"
|
|
Then the repl slash exit code should be 2
|
|
|
|
# --- /persona export not found (lines 584-585) ---
|
|
|
|
Scenario: Slash command persona export for nonexistent persona
|
|
Given a mock persona registry that cannot find persona for slash commands
|
|
When I handle slash command "persona export ghostbot"
|
|
Then the repl slash exit code should be 1
|
|
|
|
# --- _run_shell_command empty (line 386-387) ---
|
|
|
|
Scenario: Shell command with empty text returns error code
|
|
When I run a shell command with empty text
|
|
Then the shell exit code should be 2
|
|
|
|
# --- _run_shell_command disabled (lines 388-389) ---
|
|
|
|
Scenario: Shell command when shell mode is disabled
|
|
Given shell mode is disabled via environment
|
|
When I run a shell command with text "echo hello"
|
|
Then the shell exit code should be 2
|
|
And the shell mode disabled message is shown
|
|
|
|
# --- _run_shell_command timeout (lines 404-408) ---
|
|
|
|
Scenario: Shell command that times out returns exit code 124
|
|
When I run a shell command that will time out
|
|
Then the shell exit code should be 124
|
|
|
|
# --- _compose_prompt formats correctly ---
|
|
|
|
Scenario: Compose prompt includes session and persona info
|
|
When I compose a prompt with base "agents" and session "s1" and persona "coder"
|
|
Then the prompt should contain session and persona markers
|
|
|
|
# --- _get_prompt_context with project and plan ---
|
|
|
|
Scenario: Prompt context includes project and plan
|
|
Given rclcb CLEVERAGENTS_PROJECT is set to "myproj"
|
|
And CLEVERAGENTS_PLAN is set to "myplan"
|
|
When I get the prompt context
|
|
Then the prompt context should contain "myproj/myplan"
|
|
|
|
# --- _get_prompt_context with neither ---
|
|
|
|
Scenario: Prompt context defaults when no env vars set
|
|
Given CLEVERAGENTS_PROJECT is not set
|
|
And CLEVERAGENTS_PLAN is not set
|
|
When I get the prompt context
|
|
Then the prompt context should be the default "agents> "
|
|
|
|
# --- _find_reference_candidates with empty query ---
|
|
|
|
Scenario: Find reference candidates with empty query returns first items
|
|
Given a list of reference options
|
|
When I find candidates with an empty query
|
|
Then the first items from the list should be returned
|
|
|
|
# --- _best_fuzzy_match substring branch ---
|
|
|
|
Scenario: Best fuzzy match returns substring match when no prefix match
|
|
Given a list of options including "my-long-name"
|
|
When I fuzzy match with query "long"
|
|
Then the match should be "my-long-name"
|
|
|
|
# --- _best_fuzzy_match difflib fallback ---
|
|
|
|
Scenario: Best fuzzy match falls back to difflib close matches
|
|
Given a list of options including "controller"
|
|
When I fuzzy match with query "contrlr"
|
|
Then the match should be "controller"
|
|
|
|
# --- _best_fuzzy_match no match ---
|
|
|
|
Scenario: Best fuzzy match returns None when nothing matches
|
|
Given a list of options including "alpha"
|
|
When I fuzzy match with query "zzzzzzz"
|
|
Then the match should be None
|
|
|
|
# --- _reference_suggestions with category prefix ---
|
|
|
|
Scenario: Reference suggestions with category-prefixed token
|
|
Given a reference catalog with actors "ns/bot1" and "ns/bot2"
|
|
When I request suggestions for a line containing "@actor:bot"
|
|
Then suggestions should include actor-prefixed candidates
|
|
|
|
# --- _expand_references with escaped at-sign ---
|
|
|
|
Scenario: Expand references preserves escaped at-sign
|
|
Given a reference catalog with some files
|
|
When I expand a line containing a backslash-escaped at-sign token
|
|
Then the escaped at-sign should be stripped to a bare at-sign
|
|
|
|
# --- _parse_persona_create with all optional flags ---
|
|
|
|
Scenario: Parse persona create with all optional flags
|
|
When I parse persona create with all flags
|
|
Then the persona should have description icon greeting and cycle-order set
|