Skip to content

Comments

Basic pwa management#4

Merged
bigr merged 4 commits intomainfrom
klinger-basic-pwa-management
Oct 22, 2025
Merged

Basic pwa management#4
bigr merged 4 commits intomainfrom
klinger-basic-pwa-management

Conversation

@bigr
Copy link
Owner

@bigr bigr commented Oct 22, 2025

No description provided.

bigr added 4 commits October 22, 2025 20:24
Implemented:
• Registry class with thread-safe CRUD operations for apps and handlers
• File-based locking using fcntl for concurrent access protection
• JSON-based storage with version field
• Comprehensive error handling (AppNotFoundError, AppExistsError, RegistryError)
• Full test coverage (24 tests, 96% coverage)

Tests verify:
• Adding, updating, removing, and listing apps
• Adding, removing, and listing URL scheme handlers
• Duplicate detection for apps and handlers
• Registry persistence across instances
• Corrupted JSON handling
• Concurrent access locking

Closes registry management checklist items in Phase 2.
Implemented:
• URL validation with format checking and optional connectivity verification
• Localhost URL detection with warnings
• App ID generation from names (lowercase, alphanumeric, hyphens)
• App ID format validation
• WMClass generation for window manager integration (CamelCase)
• Name extraction from URLs (subdomain/domain extraction)
• Full test coverage (50 tests, 85% coverage)

Tests verify:
• URL validation for various formats (http/https, localhost, invalid)
• ID generation from names with special characters and spaces
• ID validation against format rules
• WMClass generation in CamelCase format
• Name extraction from URLs with various structures

Closes URL validation checklist items in Phase 2.
Implemented complete PWA management commands:

Add command:
• Full URL validation with localhost detection
• Automatic name and ID generation from URL
• WMClass generation for window manager integration
• Profile directory creation with proper permissions
• Wrapper script generation from Jinja2 templates
• Desktop file generation with proper categories
• Icon handling (copy from source path)
• YAML manifest creation with full metadata
• Registry integration and desktop database updates
• Dry-run mode support for safe testing
• Browser executable detection from config and known paths
• Comprehensive error handling with AddCommandError

List command:
• Table format with aligned columns (ID, Name, URL, Status)
• JSON and YAML output format support
• Verbose mode showing all app details
• Empty registry handling

Remove command:
• Safe file deletion with validation
• Optional profile directory removal
• Optional icon removal
• Keep-userdata flag to preserve browser profile
• Manifest file cleanup
• Registry update and desktop database refresh
• Dry-run mode support
• Error handling with RemoveCommandError

Infrastructure updates:
• Added Config properties for easy path access (desktop_dir, icons_dir, etc.)
• Added render_template() convenience function to templates module
• Updated CLI to wire up all commands with proper error handling
• Color output support with --no-color flag
• Comprehensive exit codes (0=success, 1=error)

Tests:
• Updated CLI tests to match implemented behavior
• All tests passing (127 tests, 73% coverage)

Closes all checklist items in Phase 2.
Added comprehensive integration tests for Phase 2:

Test coverage:
• End-to-end PWA lifecycle (add → list → remove workflows)
• File artifact creation (profiles, wrappers, desktop files, manifests)
• Registry persistence across operations
• Icon handling and copying
• YAML manifest format validation
• JSON registry format validation
• Dry-run mode behavior
• Error cases (duplicate IDs, non-existent apps)
• Profile deletion options
• Template rendering to actual files

Infrastructure:
• Created IsolatedConfig class for test isolation
• Each test uses unique temporary directories
• Registry file properly isolated per test
• No test interference or shared state

Bug fixes discovered by integration tests:
• Fixed remove command not preserving profile when remove_profile=False
  (manifest parent directory was being deleted prematurely)
• Added proper directory cleanup logic that checks if manifest dir is profile dir

Results:
• 12 new integration tests, all passing
• Total test count: 179 tests (127 unit + 12 integration + 40 other)
• Code coverage increased: 73% → 87%
• All tests isolated with no shared state
• Real file system operations verified
@bigr bigr merged commit 4e43544 into main Oct 22, 2025
4 checks passed
bigr added a commit that referenced this pull request Oct 23, 2025
- Add PATH search using shutil.which() for browser executables
- Supports non-standard install locations (Snap, Flatpak, custom paths)
- Falls back to PATH search after configured and known paths
- Add comprehensive unit tests for browser detection logic
- Update E2E test to mock shutil.which() for failure scenarios
- Resolves user testing issue #4 (hard-coded browser paths)
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