Files
temp/features/session_list_summary_dedup.feature
freemo 9210fbce33 refactor(cli): deduplicate session list summary logic in list_sessions
Refactor list_sessions to reuse the summary dict already computed by
_session_list_dict instead of recalculating total_msgs, sorted_sessions,
most_recent, and oldest independently.

The rich table summary panel now reads directly from data["summary"],
ensuring JSON and rich table output are always consistent and the
summary logic lives in exactly one place (_session_list_dict).

Add Behave feature (session_list_summary_dedup.feature) with 6 scenarios
verifying that JSON and rich table summary values are consistent across
all required fields: total, most_recent, oldest, total_messages, storage.

ISSUES CLOSED: #3046
2026-04-05 09:38:43 +00:00

45 lines
2.1 KiB
Gherkin

@tdd_issue @tdd_issue_3046
Feature: Session list summary consistency between JSON and rich table output
As a developer
I want the session list summary values to be consistent between JSON and rich table output
So that the deduplicated summary logic in _session_list_dict is the single source of truth
Background:
Given a session-list-summary mock service with two sessions
Scenario: JSON output summary matches rich table summary for total count
When I invoke session list with JSON format
And I invoke session list with rich format
Then the JSON summary total should match the rich table total
Scenario: JSON output summary matches rich table summary for total messages
When I invoke session list with JSON format
And I invoke session list with rich format
Then the JSON summary total_messages should match the rich table total messages
Scenario: JSON output summary matches rich table summary for most recent session
When I invoke session list with JSON format
And I invoke session list with rich format
Then the JSON summary most_recent should appear in the rich table summary panel
Scenario: JSON output summary matches rich table summary for oldest session
When I invoke session list with JSON format
And I invoke session list with rich format
Then the JSON summary oldest should appear in the rich table summary panel
Scenario: Rich table summary panel contains all required fields
When I invoke session list with rich format
Then the rich table output contains "Total:"
And the rich table output contains "Most Recent:"
And the rich table output contains "Oldest:"
And the rich table output contains "Total Messages:"
And the rich table output contains "Storage:"
Scenario: JSON output summary contains all required fields
When I invoke session list with JSON format
Then the JSON output has a summary key with total
And the JSON output has a summary key with most_recent
And the JSON output has a summary key with oldest
And the JSON output has a summary key with total_messages
And the JSON output has a summary key with storage