Skip to content

feat: add task status endpoint (ERA-12690)#44

Open
JoshuaVulcan wants to merge 4 commits intomainfrom
ERA-12690-impl
Open

feat: add task status endpoint (ERA-12690)#44
JoshuaVulcan wants to merge 4 commits intomainfrom
ERA-12690-impl

Conversation

@JoshuaVulcan
Copy link
Contributor

@JoshuaVulcan JoshuaVulcan commented Feb 11, 2026

Summary

Adds get_task_status(task_id) to both ERClient (sync) and AsyncERClient (async) for polling background task status.

  • Endpoint: core/taskstatus/{task_id}/ (GET)
  • Returns: dict with task_id, status (PENDING/STARTED/SUCCESS/FAILURE), result, and location
  • Enables tracking async operations like GPX uploads and data exports

Test plan

  • 6 new sync tests in tests/sync_client/test_task_status.py
  • 6 new async tests in tests/async_client/test_task_status.py
  • All 102 tests pass (12 new + 90 existing)
  • Tests cover all task states (PENDING, STARTED, SUCCESS, FAILURE)
  • Tests verify correct URL construction
  • Tests cover error handling (404 Not Found)

Related

  • Jira: ERA-12690

Add get_task_status(task_id) to both ERClient (sync) and AsyncERClient
(async) for polling the status of background tasks.

Endpoint: core/taskstatus/{task_id}/

Returns a dict with:
- task_id: the task identifier
- status: PENDING | STARTED | SUCCESS | FAILURE
- result: task result data (null while pending/started)
- location: relative URL to the status endpoint

This enables clients to track the progress of async operations like
GPX uploads and data exports.

Includes 12 new tests across sync and async test suites covering
all task states, URL construction, and error handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JoshuaVulcan JoshuaVulcan added autoreviewing PR is currently being auto-reviewed and removed autoreviewing PR is currently being auto-reviewed labels Feb 11, 2026
@JoshuaVulcan JoshuaVulcan requested a review from a team as a code owner February 12, 2026 01:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a get_task_status convenience API to both sync and async EarthRanger clients, along with new tests to validate status parsing, error handling, and URL construction.

Changes:

  • Add get_task_status(task_id) to ERClient and AsyncERClient.
  • Add sync tests covering PENDING/SUCCESS/FAILURE/STARTED, 404 handling, and URL construction.
  • Add async tests covering the same scenarios using respx/httpx.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
erclient/client.py Introduces get_task_status on both sync and async clients, delegating to existing _get logic.
tests/sync_client/test_task_status.py New sync unit tests using unittest.mock to validate request URL and returned data payload behavior.
tests/async_client/test_task_status.py New async unit tests using respx to validate request URL, response parsing, and NOT_FOUND error mapping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -0,0 +1,123 @@
"""Tests for get_task_status in the sync ERClient."""
import json
from unittest.mock import patch, MagicMock
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