0c0101c368
Cover the two uncovered code paths introduced by the session create
JSON envelope fix:
1. `_resolve_actor_details(None)` → early `return None` (no actor bound)
2. Actor found in registry path (lines 271-297) — two scenarios:
- Full config actor (options.temperature + direct context_window)
- Graph descriptor actor (graph_descriptor.context_window)
Also remove dead redundant isinstance checks:
- `config_blob.get("options") if isinstance(config_blob, dict) else None`
simplified to `config_blob.get("options")` since config_blob is always
a dict (assigned on the previous line via ternary with {} fallback).
- Outer `if isinstance(config_blob, dict):` wrapper around context_window
logic removed for the same reason.
ISSUES CLOSED: #6441
245 lines
11 KiB
Gherkin
245 lines
11 KiB
Gherkin
@coverage_boost
|
|
Feature: Coverage boost for security template branch
|
|
As a developer ensuring 97%+ test coverage
|
|
I want to exercise uncovered code paths across the codebase
|
|
So that the coverage threshold is comfortably met
|
|
|
|
# =========================================================================
|
|
# skills/registry.py — validate_skill with tool registry, inline tools,
|
|
# and includes (lines 200-213)
|
|
# =========================================================================
|
|
|
|
@tdd_issue @tdd_issue_4267 @tdd_expected_fail
|
|
Scenario: Validate skill with tool registry reports missing tool refs
|
|
Given a skill registry with a mock tool registry
|
|
And a skill definition with tool ref "nonexistent-tool"
|
|
When I validate the skill definition via the registry
|
|
Then the skill validation errors should mention "not found in tool registry"
|
|
|
|
Scenario: Validate skill with inline tool missing description
|
|
Given a skill registry with no tool registry
|
|
And a skill definition with an inline tool missing its description
|
|
When I validate the skill definition via the registry
|
|
Then the skill validation errors should mention "missing a description"
|
|
|
|
Scenario: Validate skill referencing unknown included skill
|
|
Given a skill registry with no tool registry
|
|
And a skill definition that includes "unknown/skill"
|
|
When I validate the skill definition via the registry
|
|
Then the skill validation errors should mention "is not registered"
|
|
|
|
Scenario: Validate skill with all valid references
|
|
Given a skill registry with no tool registry
|
|
And a skill definition with no tool refs or includes
|
|
When I validate the skill definition via the registry
|
|
Then the skill validation errors should be empty
|
|
|
|
# =========================================================================
|
|
# cli/formatting.py — format_output_session, _format_table edge cases
|
|
# (lines 121, 128, 197, 231-236)
|
|
# =========================================================================
|
|
|
|
Scenario: Format output with color format type
|
|
Given sample formatting data with key "status" and value "ok"
|
|
When I format the data with format type "color"
|
|
Then the formatted output should contain "status"
|
|
|
|
Scenario: Format output session with list of dicts
|
|
Given sample formatting data as a list of two items
|
|
When I format the data via format_output_session with format "plain"
|
|
Then the formatted session output should not be empty
|
|
|
|
Scenario: Format output session with dict input
|
|
Given sample formatting data with key "name" and value "test"
|
|
When I format the data via format_output_session with format "json"
|
|
Then the formatted session output should contain "name"
|
|
|
|
Scenario: Format table with rows having extra keys
|
|
Given sample formatting data as a list with mismatched keys
|
|
When I format the data with format type "table"
|
|
Then the formatted output should contain "extra_col"
|
|
|
|
Scenario: Format table with empty list
|
|
Given sample formatting data as an empty list
|
|
When I format the data with format type "table"
|
|
Then the formatted output should be "(empty)"
|
|
|
|
# =========================================================================
|
|
# cli/commands/system.py — health check functions
|
|
# (lines 108-118, 146-147, 174-175, 193-194, 258-278, 325-334)
|
|
# =========================================================================
|
|
|
|
Scenario: Check config file when it exists and is readable
|
|
Given a system health check environment
|
|
And a config file that exists and is readable
|
|
When I run the config file health check
|
|
Then the health check status should be "ok"
|
|
And the health check details should be "readable"
|
|
|
|
Scenario: Check data dir when it does not exist
|
|
Given a system health check environment
|
|
And a data dir that does not exist
|
|
When I run the data dir health check
|
|
Then the health check status should be "warn"
|
|
And the health check details should contain "missing"
|
|
|
|
Scenario: Check disk space with plenty of space
|
|
Given a system health check environment
|
|
When I run the disk space health check
|
|
Then the health check status should be "ok"
|
|
|
|
Scenario: Check git availability
|
|
Given a system health check environment
|
|
When I run the git availability health check
|
|
Then the health check status should be "ok"
|
|
|
|
Scenario: Check file permissions on writable data dir
|
|
Given a system health check environment
|
|
And a writable data dir
|
|
When I run the file permissions health check
|
|
Then the health check status should be "ok"
|
|
And the health check details should be "data dir r/w"
|
|
|
|
Scenario: Check file permissions on nonexistent data dir
|
|
Given a system health check environment
|
|
And a data dir that does not exist
|
|
When I run the file permissions health check
|
|
Then the health check status should be "warn"
|
|
And the health check details should contain "does not exist"
|
|
|
|
Scenario: Build info data with existing database file
|
|
Given a system health check environment
|
|
And a database file that exists
|
|
When I build info data
|
|
Then the info data should contain a db_size value
|
|
|
|
Scenario: Build info data with log directory
|
|
Given a system health check environment
|
|
And a log directory with files
|
|
When I build info data
|
|
Then the info data should contain a logs value
|
|
|
|
# =========================================================================
|
|
# cli/commands/session.py — session CLI commands
|
|
# (lines 56-69, 75, 157-159, 267, 277-278, 320-323, 381-382, 482-485)
|
|
# =========================================================================
|
|
|
|
Scenario: Get session service lazily initialises from container
|
|
Given a session CLI test environment
|
|
When I call get_session_service
|
|
Then a session service should be returned
|
|
|
|
Scenario: Reset session service clears the cached instance
|
|
Given a session CLI test environment
|
|
When I call reset_session_service
|
|
Then the session service cache should be cleared
|
|
|
|
Scenario: Session create with non-rich format outputs formatted data
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a created session
|
|
When I invoke session create with format "json"
|
|
Then the covboost session output should contain "data"
|
|
|
|
Scenario: Session create with no actor skips actor_details in payload
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a created session with no actor
|
|
When I invoke session create with format "json"
|
|
Then the covboost session output should contain "data"
|
|
|
|
Scenario: Session create with full config actor found in registry
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a created session
|
|
When I invoke session create with full config registry actor and format "json"
|
|
Then the covboost session output should contain "provider"
|
|
|
|
Scenario: Session create with graph descriptor actor found in registry
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a created session
|
|
When I invoke session create with graph descriptor registry actor and format "json"
|
|
Then the covboost session output should contain "data"
|
|
|
|
Scenario: Session create error shows session not found message
|
|
Given a session CLI test environment
|
|
And a mock session service that raises SessionNotFoundError on create
|
|
When I invoke session create expecting an error
|
|
Then the session CLI should have exited with error
|
|
|
|
Scenario: Session list with no sessions shows empty message
|
|
Given a session CLI test environment
|
|
And a mock session service that returns no sessions
|
|
When I invoke session list with format "rich"
|
|
Then the covboost session output should contain "No sessions found"
|
|
|
|
Scenario: Session delete without confirmation aborts
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a session
|
|
When I invoke session delete without confirming
|
|
Then the session CLI should have been aborted
|
|
|
|
Scenario: Session delete with yes flag succeeds
|
|
Given a session CLI test environment
|
|
And a mock session service that returns a session
|
|
When I invoke session delete with yes flag
|
|
Then the covboost session output should contain "deleted"
|
|
|
|
Scenario: Session export to stdout outputs JSON
|
|
Given a session CLI test environment
|
|
And a mock session service that can export
|
|
When I invoke session export to stdout
|
|
Then the covboost session output should contain "session_id"
|
|
|
|
Scenario: Session export to file that exists without force fails
|
|
Given a session CLI test environment
|
|
And a mock session service that can export
|
|
And a temporary output file that already exists
|
|
When I invoke session export to that file without force
|
|
Then the session CLI should have exited with error
|
|
|
|
# =========================================================================
|
|
# cli/commands/cleanup.py — error handling paths
|
|
# (lines 49-58, 94, 129-131)
|
|
# =========================================================================
|
|
|
|
Scenario: Active plan detection with OSError returns empty set
|
|
Given a cleanup CLI test environment
|
|
And a cleanup service that raises OSError on sandbox scan
|
|
When I detect active plans
|
|
Then the active plans set should be empty
|
|
|
|
Scenario: Cleanup prune command runs successfully
|
|
Given a cleanup CLI test environment
|
|
And a mock cleanup service
|
|
When I invoke cleanup prune
|
|
Then the cleanup should have run without error
|
|
|
|
# =========================================================================
|
|
# cli/commands/audit.py — audit service creation
|
|
# (lines 29-32, 110-111)
|
|
# =========================================================================
|
|
|
|
Scenario: Audit service is created from settings
|
|
Given an audit CLI test environment
|
|
When I create the audit service
|
|
Then an audit service instance should be returned
|
|
|
|
Scenario: Audit list command with no entries
|
|
Given an audit CLI test environment
|
|
And a mock audit service with no entries
|
|
When I invoke audit list
|
|
Then the covboost audit output should contain "No audit"
|
|
|
|
# =========================================================================
|
|
# application/container.py — container init paths
|
|
# (lines 66-69, 125-130)
|
|
# =========================================================================
|
|
|
|
Scenario: Container initialises database from settings
|
|
Given a container test environment
|
|
When I get the application container
|
|
Then the container should provide a database session
|
|
|
|
Scenario: Container clears its singleton on reset
|
|
Given a container test environment
|
|
When I reset the container singleton
|
|
Then the container cache should be cleared
|