Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
## 2024-05-24 - CLI Output Scannability and Human-Readability
**Learning:** In text-based CLI menus, using internal identifiers (like `lesson-1`) and verbose status strings (like `pending` or `completed`) makes lists hard to scan and feels too technical.
**Action:** When displaying lists of items with states, use familiar visual symbols (like `[x]` vs `[ ]`) and human-readable titles (like "Variables") to improve scannability and create a more friendly, intuitive interface.

## 2025-03-26 - Actionable Empty States in CLI

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the date. The year is set to 2025, which is in the future. Since this file acts as a log of learnings, this should likely be 2024.

Suggested change
## 2025-03-26 - Actionable Empty States in CLI
## 2024-03-26 - Actionable Empty States in CLI

**Learning:** Empty states (e.g., "No checkpoints found.") can feel like dead-ends to users who don't know how to create the missing resource.
**Action:** Always pair empty state messages with clear, actionable instructions or commands on how to create the missing resource to improve user experience and avoid dead-ends.
5 changes: 4 additions & 1 deletion src/python_learning_orchestrated/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def main(
if args.checkpoint_command == "list":
checkpoints = checkpoint_store.list_checkpoints()
if not checkpoints:
output_fn("No checkpoints found.")
output_fn(
"No checkpoints found. "
"Create one with: checkpoint create <name>"
)
return
output_fn(f"Checkpoints ({len(checkpoints)}):")
for checkpoint in checkpoints:
Expand Down
16 changes: 16 additions & 0 deletions tests/test_cli_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,19 @@ def test_cli_checkpoint_create_fails_on_existing_name(
)
else:
raise AssertionError("Expected SystemExit for duplicate checkpoint name")

def test_cli_checkpoint_list_empty_state_has_actionable_instructions(
tmp_path, capsys, monkeypatch
) -> None:
checkpoint_dir = tmp_path / "checkpoints"

checkpoint_store_class = cli_module.CheckpointStore
monkeypatch.setattr(
cli_module,
"CheckpointStore",
lambda: checkpoint_store_class(checkpoint_dir),
)

main(["checkpoint", "list"])
list_output = capsys.readouterr().out
assert "No checkpoints found. Create one with: checkpoint create <name>" in list_output

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The assertion using in is not very strict and could lead to false positives if other text is printed. To make the test more robust, it's better to assert for an exact match of the output string, including the newline character that print adds.

Suggested change
assert "No checkpoints found. Create one with: checkpoint create <name>" in list_output
assert list_output == "No checkpoints found. Create one with: checkpoint create <name>\n"

Loading