The dashboard did not reflect CLI progress for users across Windows and Ubuntu. Three independent client defects, now fixed: 1. Automatic sync was silently skipped on any non-TTY shell. _trigger_submission gated on `not sys.stdin.isatty()`, which is False on Windows Git Bash/MinTTY and many IDE terminals even when interactive, so `tito module complete` updated local progress.json but never uploaded, with no message. Decouple "should we sync" (logged-in and not CI) from "should we prompt" (needs a TTY): non-interactive real users now sync without a prompt instead of being skipped. 2. A 2xx response with synced_modules null/0 was reported as success using the local count, hiding backend failures. sync_progress now returns a SyncResult and reports an honest accepted-but-unconfirmed warning when the server does not confirm persistence. 3. No standalone resync path and login did not sync, so modules completed before logging in never reached the dashboard. Add `tito community sync` and an offer to sync existing progress after login. The sync trigger decision now lives in one shared helper (auto_sync_after_completion) used by the module, milestone, and login paths, plus a small core/runtime.py that owns is_ci()/is_interactive(). Adds tests/cli/test_progress_sync.py (15 tests) covering the non-TTY regression, the CI/not-logged-in branches, honest 2xx interpretation, and the new command.
CLI Test Suite
Comprehensive test suite for the TinyTorch CLI (tito). Ensures all commands are properly registered, documented, and executable.
Test Files
1. test_cli_registry.py - Command Registration Tests
Validates the command registry in tito/main.py:
-
TestCLIRegistry: Core registry validation
- All commands inherit from
BaseCommand - All commands have descriptions (>10 chars)
- All commands implement
execute()andadd_arguments() - Parser creation succeeds
- No duplicate command names
- Help text accessible for all commands
- All commands inherit from
-
TestCommandFiles: File system consistency
- All registered commands have corresponding files
- No orphaned command files (files without registration)
- Detects commands that need cleanup
-
TestEpilogDocumentation: Help text consistency
- Epilog mentions all registered command groups
- No outdated references
2. test_cli_execution.py - Command Execution Tests
Smoke tests for actual command execution:
-
TestCommandExecution: Basic execution
- Bare
titocommand shows welcome screen tito -hshows helptito --versionworks- All 18 commands can show help (
tito <cmd> -h) - All subcommands can show help
- Bare
-
TestCommandGrouping: Discoverability
- Student-facing commands visible in welcome screen
- Developer commands documented in help
-
TestErrorMessages: Error handling
- Invalid commands show helpful errors
- Missing subcommands show help
3. test_cli_help_consistency.py - Help Text Quality
Ensures help text is consistent and complete:
-
TestHelpConsistency: Formatting consistency
- All command helps mention 'tito'
- Bare
titovstito -hserve different purposes - No references to removed commands
-
TestWelcomeScreen: Welcome screen quality
- Shows Quick Start section
- Organizes commands into groups
- Includes example commands
-
TestCommandDocumentation: Documentation completeness
- All registered commands documented
- Checkpoint command specifically validated
Running the Tests
Run all CLI tests:
pytest tests/cli/ -v
Run specific test file:
pytest tests/cli/test_cli_registry.py -v
Run with output:
pytest tests/cli/ -v -s
What These Tests Catch
✅ Prevents
- Orphaned Commands: Command files that aren't registered
- Missing Documentation: Commands without descriptions
- Broken Help: Commands that crash when showing help
- Inconsistent UX: Different help formats across commands
- Stale References: Help text mentioning removed commands
✅ Validates
- Registration: All commands in
TinyTorchCLI.commandsdict - Implementation: All commands inherit from
BaseCommand - Documentation: All commands have clear descriptions
- Execution: All commands can run without crashing
- Discoverability: Key commands visible to users
Test Coverage
52 tests covering:
- 18 registered commands
- 8 subcommand groups
- Registry validation
- Execution smoke tests
- Help text consistency
- Welcome screen UX
How Modern CLIs Handle Testing
These tests follow industry best practices from tools like:
- Click (Python): Command registration validation
- Git: Comprehensive help text testing
- Docker: Smoke tests for each command
- kubectl: Subcommand hierarchy validation
Key patterns used:
- Registry-based validation: Single source of truth in code
- Smoke tests: Don't test functionality, just "does it run?"
- Help text parsing: Ensure documentation stays current
- Snapshot testing: Compare outputs (could be added later)
Maintenance
When adding a new command:
- Add to
TinyTorchCLI.commandsdict in tito/main.py - Create command file in
tito/commands/ - Add to epilog if it's a major command group
- Tests will automatically validate it!
When removing a command:
- Remove from
TinyTorchCLI.commandsdict - Delete command file OR add to
known_internalin tests - Update epilog/welcome screen
Future Enhancements
Consider adding:
- Snapshot tests: Save known-good help output, compare changes
- Integration tests: Test actual command workflows
- Performance tests: Ensure CLI startup is fast
- Completion tests: Validate shell completion scripts
- Config tests: Test config file parsing and validation