Skip to content

Improve session management: fix quoting and add expiration validation#1559

Closed
stephdl wants to merge 1 commit intomainfrom
fix/session-management-improvements
Closed

Improve session management: fix quoting and add expiration validation#1559
stephdl wants to merge 1 commit intomainfrom
fix/session-management-improvements

Conversation

@stephdl
Copy link
Contributor

@stephdl stephdl commented Mar 5, 2026

Overview

Improvements and fixes to the session management logic that was introduced in PR #1542.

Changes

🐛 Bug Fixes

  1. Quote $session_start in expire command - Prevents word-splitting issues and ensures reliability with variable expansion
  2. Validate session before extend - Check that session hasn't already expired before allowing extension, preventing extend operations on dead sessions

✨ Enhancements

  1. Show session status after extend - Calls get_session_info after extend to provide immediate feedback on new expiration time
  2. Improved validation comments - Add clarity to the extend logic

Details

Fix 1: Quoting in expire

# Before
session_start_time=$(cat $session_start)

# After
session_start_time=$(cat "$session_start")

Fix 2: Expiration validation before extend

extend)
    # Added validation block that checks:
    # - Session files exist
    # - Session hasn't already expired
    # Only then allows the 7-day extension

Enhancement: Feedback after extend

# Show updated session info after successful extension
get_session_info

Testing

All existing tests from the original PR still apply. Additional test cases to verify:

  • ✅ Extend on expired session (should fail)
  • ✅ Extend shows new expiration status
  • ✅ All variables properly quoted

Related Issues

Fixes review feedback from PR #1542

- Fix: Quote $session_start variable in expire command to prevent word-splitting
- Fix: Validate session is not already expired before allowing extend
- Enhancement: Show session status after extend command
- Improve: Add validation comments

Fixes issues identified in review of PR #1542
@stephdl
Copy link
Contributor Author

stephdl commented Mar 5, 2026

closed by #1554

@stephdl stephdl closed this Mar 5, 2026
@Tbaile Tbaile deleted the fix/session-management-improvements branch March 6, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant