Phase 3 Complete: Journey Session Management

Today we completed a major milestone in Aditi’s development - implementing comprehensive session management for the journey command. This addresses a critical user experience issue where canceling a journey would lose all progress.

The Problem

Previously, when users ran aditi journey and chose to cancel at any point (by answering “No” to “Continue with next rule?”), the session would be cleared and all progress lost. Users would have to start completely over, reprocessing rules they had already completed.

The Solution

We implemented a complete session management system with these key features:

1. True Pause/Resume Functionality

  • Session state is preserved when users cancel
  • Journey resumes from the exact rule where it was paused
  • Shows progress summary: “Resuming from rule 5/27”
  • Displays completed rules and next rule to process

2. Session Backup System

  • Automatic backups when starting fresh journey
  • Rotates backups (keeps last 5) in ~/aditi-data/session-backups/
  • Timestamped backup files for easy identification

3. Enhanced Command Interface

  • aditi journey --status - View current session without starting
  • aditi journey --clear - Explicitly clear session with confirmation
  • aditi journey --dry-run - Preview without making changes

4. Session Validation

  • Checks if repository path still exists
  • Validates selected directories are still available
  • Warns if current directory differs from session repository
  • Alerts for sessions older than 7 days

5. Rich Progress Tracking

  • Tracks current rule being processed
  • Records session start and last update timestamps
  • Counts total rules vs completed rules
  • Shows repository and directory information

Technical Implementation

Enhanced SessionState Model

class SessionState(BaseModel):
    # ... existing fields ...
    current_rule: Optional[str] = None
    total_rules: Optional[int] = None
    files_fixed_by_rule: Dict[str, int] = Field(default_factory=dict)
    session_started: Optional[str] = None
    last_updated: Optional[str] = None

User Experience Flow

  1. First Run: aditi journey starts normally
  2. Cancellation: Session preserved with current progress
  3. Resume: Next run shows session info and offers to resume
  4. Fresh Start: User can choose to backup and start over

Example Session Display

đź“‹ Found existing journey session (2 hours old)
   Repository: /home/user/my-docs
   Progress: 3 of 27 rules completed
   Last rule: EntityReference

Resume from where you left off? (Y/n)

Impact on User Workflow

This implementation transforms the user experience:

  • Before: Losing progress was frustrating and time-consuming
  • After: Users can confidently pause and resume complex document processing

The session management supports real-world usage patterns where users may need to:

  • Take breaks during long processing sessions
  • Handle interruptions or system restarts
  • Review changes before continuing
  • Switch between different repositories

Next Steps

With Phase 3 complete, we’re ready to move toward Phase 4 (Reporting and Distribution). The journey command now provides a robust, user-friendly experience for preparing AsciiDoc files for DITA migration.

The session management foundation also enables future enhancements like:

  • Progress reports and analytics
  • Batch processing across multiple repositories
  • Integration with CI/CD pipelines

Code Quality

All changes include:

  • Comprehensive error handling
  • Type hints and documentation
  • Backward compatibility with existing sessions
  • Unit test coverage for session operations

This completes our Phase 3 CLI experience goals, delivering a production-ready interactive workflow for AsciiDoc to DITA preparation.


Copyright © 2025 Aditi. Distributed under the MIT License.