Files
cleveragents-core/features/session_cli_coverage_boost.feature
HAL9000 195fbac109
CI / lint (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m29s
CI / security (pull_request) Successful in 1m28s
CI / push-validation (pull_request) Successful in 20s
CI / unit_tests (pull_request) Successful in 5m8s
CI / docker (pull_request) Successful in 1m27s
CI / integration_tests (pull_request) Successful in 8m39s
CI / coverage (pull_request) Successful in 11m1s
CI / status-check (pull_request) Successful in 3s
fix: add required @a2a, @session, @cli tags to BDD feature files
Add domain-scenario Gherkin tags to all A2A, session, and CLI feature
files (30 files) so tests can be filtered individually via behave.

- 8 A2A feature files: @a2a tag
- 7 session feature files: @session tag
- 15 CLI feature files: @cli tag

ISSUES CLOSED: #9124
2026-06-02 15:41:06 -04:00

267 lines
14 KiB
Gherkin

@session
Feature: Session CLI Coverage Boost
Additional scenarios that exercise previously uncovered code paths
in the session.py CLI commands module.
Background:
Given the session CLI coverage boost module is set up
# ---------------------------------------------------------------
# create command
# ---------------------------------------------------------------
Scenario: create command succeeds with rich format
Given session coverage boost a mock service that creates a session
When session coverage boost I invoke the create command with rich format
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Session created"
Scenario: create command succeeds with JSON format
Given session coverage boost a mock service that creates a session
When session coverage boost I invoke the create command with json format
Then session coverage boost the exit code is 0
Scenario: create command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on create
When session coverage boost I invoke the create command with rich format
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
# ---------------------------------------------------------------
# list command
# ---------------------------------------------------------------
Scenario: list command succeeds with sessions in rich format
Given session coverage boost a mock service that lists sessions
When session coverage boost I invoke the list command with rich format
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Sessions"
Scenario: list command succeeds with sessions in JSON format
Given session coverage boost a mock service that lists sessions
When session coverage boost I invoke the list command with json format
Then session coverage boost the exit code is 0
Scenario: list command with no sessions in rich format
Given session coverage boost a mock service that lists empty sessions
When session coverage boost I invoke the list command with rich format
Then session coverage boost the exit code is 0
And session coverage boost the output contains "No sessions found"
Scenario: list command with no sessions in JSON format
Given session coverage boost a mock service that lists empty sessions
When session coverage boost I invoke the list command with json format
Then session coverage boost the exit code is 0
Scenario: list command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on list
When session coverage boost I invoke the list command with rich format
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
# ---------------------------------------------------------------
# show command
# ---------------------------------------------------------------
Scenario: show command with cost budget having a max cost
Given session coverage boost a mock service returning a session with cost budget max 10
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Cost Budget"
Scenario: show command with cost budget unlimited
Given session coverage boost a mock service returning a session with unlimited cost budget
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 0
And session coverage boost the output contains "unlimited"
Scenario: show command with messages and linked plans in rich format
Given session coverage boost a mock service returning a session with messages and plans
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Recent Messages"
And session coverage boost the output contains "Linked Plans"
Scenario: show command with JSON format
Given session coverage boost a mock service returning a session with messages and plans
When session coverage boost I invoke the show command with json format
Then session coverage boost the exit code is 0
Scenario: show command catches SessionNotFoundError
Given session coverage boost a mock service that raises SessionNotFoundError on get
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Session not found"
Scenario: show command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on get
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
# ---------------------------------------------------------------
# delete command
# ---------------------------------------------------------------
Scenario: delete command succeeds with --yes flag
Given session coverage boost a mock service for delete
When session coverage boost I invoke the delete command with yes
Then session coverage boost the exit code is 0
And session coverage boost the output contains "deleted"
Scenario: delete command aborted by user
Given session coverage boost a mock service for delete
When session coverage boost I invoke the delete command without yes answering no
Then session coverage boost the output contains "Aborted"
Scenario: delete command catches SessionNotFoundError
Given session coverage boost a mock service that raises SessionNotFoundError on get
When session coverage boost I invoke the delete command with yes
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Session not found"
Scenario: delete command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on delete
When session coverage boost I invoke the delete command with yes
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
# ---------------------------------------------------------------
# export command
# ---------------------------------------------------------------
Scenario: export command to stdout
Given session coverage boost a mock service for export
When session coverage boost I invoke the export command to stdout
Then session coverage boost the exit code is 0
@tdd_issue @tdd_issue_4268 @tdd_expected_fail
Scenario: export command to file
Given session coverage boost a mock service for export
And session coverage boost a temporary directory for export
When session coverage boost I invoke the export command to a file
Then session coverage boost the exit code is 0
And session coverage boost the output contains "exported"
Scenario: export command to existing file without force
Given session coverage boost a mock service for export
And session coverage boost a temporary directory with existing file
When session coverage boost I invoke the export command to existing file without force
Then session coverage boost the exit code is 1
And session coverage boost the output contains "File already exists"
Scenario: export command catches SessionNotFoundError
Given session coverage boost a mock service that raises SessionNotFoundError on export
When session coverage boost I invoke the export command to stdout
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Session not found"
Scenario: export command catches SessionExportError
Given session coverage boost a mock service that raises SessionExportError on export
When session coverage boost I invoke the export command to stdout
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Export error"
Scenario: export command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on export
When session coverage boost I invoke the export command to stdout
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
Scenario: export command DatabaseError handler emits debug log
Given session coverage boost a mock service that raises DatabaseError on export
When session coverage boost I invoke the export command to stdout with log capture
Then session coverage boost the debug log "session export failed" was emitted
# ---------------------------------------------------------------
# import command
# ---------------------------------------------------------------
Scenario: import command succeeds
Given session coverage boost a mock service for import
And session coverage boost a temporary import file with valid JSON
When session coverage boost I invoke the import command
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Session Import"
And session coverage boost the output contains "Import completed"
Scenario: import command with missing file
When session coverage boost I invoke the import command with missing file
Then session coverage boost the exit code is 1
And session coverage boost the output contains "File not found"
Scenario: import command with invalid JSON file
Given session coverage boost a temporary import file with invalid JSON
When session coverage boost I invoke the import command with invalid json
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Invalid JSON"
Scenario: import command catches SessionImportError
Given session coverage boost a mock service that raises SessionImportError on import
And session coverage boost a temporary import file with valid JSON
When session coverage boost I invoke the import command expecting import error
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Import error"
Scenario: import command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on import
And session coverage boost a temporary import file with valid JSON
When session coverage boost I invoke the import command expecting database error
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
Scenario: import command DatabaseError handler emits debug log
Given session coverage boost a mock service that raises DatabaseError on import
And session coverage boost a temporary import file with valid JSON
When session coverage boost I invoke the import command expecting database error with log capture
Then session coverage boost the debug log "session import failed" was emitted
# ---------------------------------------------------------------
# tell command
# ---------------------------------------------------------------
Scenario: tell command succeeds without streaming
Given session coverage boost a mock service for tell
When session coverage boost I invoke the tell command without stream
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Acknowledged"
Scenario: tell command succeeds with streaming
Given session coverage boost a mock service for tell
When session coverage boost I invoke the tell command with stream
Then session coverage boost the exit code is 0
And session coverage boost the output contains "Acknowledged"
Scenario: tell command with actor override
Given session coverage boost a mock service for tell
When session coverage boost I invoke the tell command with actor override
Then session coverage boost the exit code is 0
And session coverage boost the output contains "openai/gpt-4"
Scenario: tell command catches SessionNotFoundError
Given session coverage boost a mock service that raises SessionNotFoundError on append
When session coverage boost I invoke the tell command without stream
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Session not found"
Scenario: tell command catches DatabaseError
Given session coverage boost a mock service that raises DatabaseError on append
When session coverage boost I invoke the tell command without stream
Then session coverage boost the exit code is 1
And session coverage boost the output contains "Database unavailable"
Scenario: tell command DatabaseError handler emits debug log
Given session coverage boost a mock service that raises DatabaseError on append
When session coverage boost I invoke the tell command without stream with log capture
Then session coverage boost the debug log "session tell failed" was emitted
# ---------------------------------------------------------------
# show command with long message content truncation
# ---------------------------------------------------------------
Scenario: show command truncates long message content
Given session coverage boost a mock service returning a session with a long message
When session coverage boost I invoke the show command
Then session coverage boost the exit code is 0
And session coverage boost the output contains truncated message indicator