Skip to content

fix(sync): add missing record_usage to sync-local-files + deprecate v1 endpoint #7123

Closed

Description

@beastoin

Background

PR #5863 added record_usage(uid, transcription_seconds=...) to sync-local-files so that basic-plan users' DG transcription time counted toward their monthly limit (BASIC_TIER_MINUTES_LIMIT_PER_MONTH).

PR #5875 reverted #5863 entirely. PR #5878 re-added the fair_use gates (soft caps, DG budget, is_hard_restricted, should_lock) but did not re-add record_usage.

Impact

  • has_transcription_credits(uid) at sync.py:1100 checks transcription_seconds from Firestore hourly_usage
  • But sync endpoints never call record_usage() to increment that counter — only transcribe.py (streaming) writes to it
  • Result: sync-local-file usage is invisible to the subscription credit system
  • Example: SYNC#9 user on basic plan (80-hour limit on backend-sync) used ~309 hours in April with no throttling

Task 1: Add record_usage to sync endpoints

Add record_usage(uid, transcription_seconds=int(total_speech_seconds), speech_seconds=int(total_speech_seconds)) after successful segment processing in:

  • v1 sync_local_files() — after line 1225 (after record_dg_usage_ms block)
  • v2 _sync_v2_background_worker() — equivalent location after DG usage recording

Code ref: the original call was in #5863 (f592c25b1):

from utils.analytics import record_usage
# after processing:
if total_speech_seconds > 0:
    record_usage(uid, transcription_seconds=total_speech_seconds, speech_seconds=total_speech_seconds)

Task 2: Deprecate/remove v1 sync-local-files

Check whether the mobile app (Flutter) and desktop (macOS) clients still use POST /v1/sync-local-files:

  • Search app code for /v1/sync-local-files usage
  • Search desktop code for /v1/sync-local-files usage
  • If no clients use v1, remove the endpoint entirely
  • If some clients still use v1, add deprecation logging and plan removal with a minimum app version gate

Related

Activity

  1. added a commit that references this issue on May 2, 2026
    080b78b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions