Skip to content

Conversation

@bokelley
Copy link
Contributor

Overview

Adds real-time phase-by-phase progress tracking to inventory sync, replacing generic "Syncing..." with specific phase info and item counts.

Features

1. Phase-by-Phase Progress (6 phases)

  • Phase 1: Discovering Ad Units
  • Phase 2: Discovering Placements
  • Phase 3: Discovering Labels
  • Phase 4: Discovering Targeting Keys
  • Phase 5: Discovering Audience Segments
  • Phase 6: Saving to Database

2. Real-Time Item Counts

Button shows: ⏳ Discovering Ad Units: 243 items (1/6)

  • Phase name
  • Item count discovered
  • Progress (current phase / total phases)

3. "Navigate Away" Message

Shows info alert: "💡 Tip: Feel free to navigate away - the sync continues in the background!"

4. Polling Updates Every 2 Seconds

Frontend polls status endpoint and updates button text in real-time

Technical Implementation

Database:

  • Added progress JSONB column to sync_jobs table
  • Migration: ed7d05fea3be_add_progress_tracking_to_sync_jobs.py

Backend (gam.py):

  • Replace single sync_all() call with phase-by-phase discovery
  • Update SyncJob.progress after each phase completion
  • Helper function: update_progress(phase, phase_num, total_phases, count)

Frontend (tenant_settings.js):

  • Parse progress object from status endpoint
  • Update button text with phase info and counts
  • Show/hide "navigate away" message
  • Clear progress message on completion/error

Status Endpoint:

  • Include progress field in response if available
  • Format: {"phase": "...", "phase_num": 1, "total_phases": 6, "count": 243}

UX Improvements

Before:

⏳ Syncing...

After:

⏳ Discovering Ad Units: 243 items (1/6)
⏳ Discovering Placements: 67 items (2/6)
⏳ Discovering Labels: 12 items (3/6)
⏳ Discovering Targeting Keys: 145 items (4/6)
⏳ Discovering Audience Segments: 23 items (5/6)
⏳ Saving to Database: 243 items (6/6)

Plus info message: "💡 Feel free to navigate away - the sync continues in the background!"

Testing Notes

  • Tested with AccuWeather sync (running in production now)
  • Progress updates visible every 2 seconds
  • No breaking changes to existing sync functionality
  • Migration is additive (new nullable column)

Related

Follow-up to PR #507 (background sync with polling)

🤖 Generated with Claude Code

Features:
1. **Phase-by-phase progress**: Shows current phase (1-6) with descriptive names
   - Phase 1: Discovering Ad Units
   - Phase 2: Discovering Placements
   - Phase 3: Discovering Labels
   - Phase 4: Discovering Targeting Keys
   - Phase 5: Discovering Audience Segments
   - Phase 6: Saving to Database

2. **Item counts**: Shows discovered item count per phase
   - Example: "Discovering Ad Units: 243 items (1/6)"

3. **Navigate away message**: Informs users they can leave while sync continues

4. **Real-time updates**: Button text updates every 2 seconds with progress

Changes:
- models.py: Add progress JSONB field to SyncJob
- Migration: Add progress column (nullable)
- gam.py: Update progress after each discovery phase
- tenant_settings.js: Show phase, count, and "navigate away" message
- Status endpoint: Include progress in response

UX improvements:
- ✅ Users see exactly what's happening ("Discovering Ad Units")
- ✅ Users see how much has been discovered (243 items)
- ✅ Users see overall progress (phase 1 of 6)
- ✅ Users know they can navigate away
- ✅ No more generic "Syncing..." - specific phase info instead

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit 0421af6 into main Oct 19, 2025
8 checks passed
EmmaLouise2018 pushed a commit that referenced this pull request Oct 24, 2025
Features:
1. **Phase-by-phase progress**: Shows current phase (1-6) with descriptive names
   - Phase 1: Discovering Ad Units
   - Phase 2: Discovering Placements
   - Phase 3: Discovering Labels
   - Phase 4: Discovering Targeting Keys
   - Phase 5: Discovering Audience Segments
   - Phase 6: Saving to Database

2. **Item counts**: Shows discovered item count per phase
   - Example: "Discovering Ad Units: 243 items (1/6)"

3. **Navigate away message**: Informs users they can leave while sync continues

4. **Real-time updates**: Button text updates every 2 seconds with progress

Changes:
- models.py: Add progress JSONB field to SyncJob
- Migration: Add progress column (nullable)
- gam.py: Update progress after each discovery phase
- tenant_settings.js: Show phase, count, and "navigate away" message
- Status endpoint: Include progress in response

UX improvements:
- ✅ Users see exactly what's happening ("Discovering Ad Units")
- ✅ Users see how much has been discovered (243 items)
- ✅ Users see overall progress (phase 1 of 6)
- ✅ Users know they can navigate away
- ✅ No more generic "Syncing..." - specific phase info instead

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
)

Features:
1. **Phase-by-phase progress**: Shows current phase (1-6) with descriptive names
   - Phase 1: Discovering Ad Units
   - Phase 2: Discovering Placements
   - Phase 3: Discovering Labels
   - Phase 4: Discovering Targeting Keys
   - Phase 5: Discovering Audience Segments
   - Phase 6: Saving to Database

2. **Item counts**: Shows discovered item count per phase
   - Example: "Discovering Ad Units: 243 items (1/6)"

3. **Navigate away message**: Informs users they can leave while sync continues

4. **Real-time updates**: Button text updates every 2 seconds with progress

Changes:
- models.py: Add progress JSONB field to SyncJob
- Migration: Add progress column (nullable)
- gam.py: Update progress after each discovery phase
- tenant_settings.js: Show phase, count, and "navigate away" message
- Status endpoint: Include progress in response

UX improvements:
- ✅ Users see exactly what's happening ("Discovering Ad Units")
- ✅ Users see how much has been discovered (243 items)
- ✅ Users see overall progress (phase 1 of 6)
- ✅ Users know they can navigate away
- ✅ No more generic "Syncing..." - specific phase info instead

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants