async def get_status(
        self, source_connection: SourceConnection, latest_sync_job: Optional[SyncJob] = None
    ) -> SourceConnectionStatus:
        """Determine the ephemeral status of a source connection based on its sync job status.

        Args:
            source_connection: The source connection
            latest_sync_job: Optional pre-fetched latest sync job

        Returns:
            The derived ephemeral status
        """
        # When no sync job exists yet
        if not source_connection.sync_id or not latest_sync_job:
            return SourceConnectionStatus.ACTIVE

        # Map sync job status to source connection status
        if latest_sync_job.status == SyncJobStatus.FAILED:
            return SourceConnectionStatus.FAILING
        elif latest_sync_job.status == SyncJobStatus.IN_PROGRESS:
            return SourceConnectionStatus.IN_PROGRESS
        else:
            return SourceConnectionStatus.ACTIVE
Determine the ephemeral status of a source connection based on its sync job status.

        Args:
            source_connection: The source connection
            latest_sync_job: Optional pre-fetched latest sync job

        Returns:
            The derived ephemeral status
        
backend/airweave/crud/crud_source_connection.py