github drallgood/audiobookshelf-hardcover-sync v1.6.1
v1.6.1 - 🚨 CRITICAL: Complete Data Loss Prevention Fix

latest releases: v3.0.0, v2.1.0, v2.0.1...
4 months ago

🚨 CRITICAL SECURITY/DATA INTEGRITY FIX

This is an urgent hotfix that prevents critical data loss in user reading history. Deploy immediately.

🔥 Critical Issue Fixed

Hardcover's GraphQL update_user_book_read mutation was setting unmentioned fields to NULL, causing complete data loss of:

  • progress_seconds ⏱️
  • started_at 📅
  • finished_at
  • edition_id 📚
  • reading_format_id 🎧

🛠️ Comprehensive Solution Implemented

Enhanced Data Retrieval

  • Modified checkExistingUserBookRead(): Now retrieves ALL existing fields before updates
  • New Data Structure: ExistingUserBookReadData struct for complete field management
  • Enhanced GraphQL Queries: Include edition_id and reading_format_id in both primary and fallback queries

Comprehensive Field Preservation

  • Smart Update Logic: Preserves ALL existing fields during progress updates
  • Fallback Protection: Enhanced both primary and fallback query paths
  • No Data Loss: Guarantees no fields are set to NULL during updates

Quality Assurance

  • Comprehensive Test Coverage: New test suite verifies data loss prevention
  • Backwards Compatible: No breaking changes to existing functionality
  • Production Ready: Thoroughly tested and validated
  • Build Fixed: Resolved package conflicts in debug scripts

📊 Impact

  • Prevents reading history loss - User progress data is preserved
  • Protects metadata integrity - Edition and format data maintained
  • Maintains sync accuracy - Start/finish dates preserved
  • Zero breaking changes - Existing functionality unchanged

🚀 Deployment Priority

HIGH PRIORITY: This fix prevents user data loss and should be deployed immediately to protect user accounts.

📝 Technical Details

  • Root Cause: GraphQL partial updates causing NULL overwrites
  • Solution: Complete field preservation during all update operations
  • Files Modified: hardcover.go, sync.go, enhanced test coverage
  • Build Fix: Reorganized debug scripts to prevent package conflicts
  • Version: v1.6.1

🔍 Verification

Run the included test suite to verify the fix:

go test -v -run TestDataLossFixImplementation

📚 Documentation

  • Complete technical documentation in docs/DATA_LOSS_FIX_COMPLETE.md
  • Test coverage in data_loss_fix_test.go
  • Debug utilities in debug/fix_null_editions_preserve_data/

🏗️ Docker Images

  • Latest Release: ghcr.io/drallgood/audiobookshelf-hardcover-sync:v1.6.1
  • Beta/Main: ghcr.io/drallgood/audiobookshelf-hardcover-sync:beta

🔒 Security

  • Trivy Security Scan: No HIGH/CRITICAL vulnerabilities
  • Go 1.24.4: Latest security patches applied
  • Alpine Base: Minimal attack surface

Don't miss a new audiobookshelf-hardcover-sync release

NewReleases is sending notifications on new releases.