Skip to content

feat: add analyzers, choices, buoy/gear CRUD, and reports methods (ERA-12682)#41

Open
JoshuaVulcan wants to merge 6 commits intomainfrom
ERA-12682-impl
Open

feat: add analyzers, choices, buoy/gear CRUD, and reports methods (ERA-12682)#41
JoshuaVulcan wants to merge 6 commits intomainfrom
ERA-12682-impl

Conversation

@JoshuaVulcan
Copy link
Copy Markdown
Contributor

@JoshuaVulcan JoshuaVulcan commented Feb 11, 2026

Summary

Implements client methods for miscellaneous DAS app endpoints in both ERClient (sync) and AsyncERClient (async):

  • Analyzers: get_analyzers_spatial(), get_analyzers_subject() — list spatial and subject analyzers
  • Choices: get_choices(), get_choice(id), download_choice_icons() — list/retrieve choice sets and download icons
  • Buoy/Gear CRUD: get_gear_list(), get_gear(id), post_gear(), patch_gear(), delete_gear() — full CRUD
  • Reports/Tableau: get_sitrep(), get_tableau_views(), get_tableau_view(id) — situation report and Tableau views

Also adds _delete() async helper to AsyncERClient.

Test plan

  • 13 new sync tests in tests/sync_client/test_analyzers_choices_gear_reports.py
  • 18 new async tests in tests/async_client/test_analyzers_choices_gear_reports.py
  • All 118 tests pass (31 new + 87 existing)
  • Tests cover happy paths for all new endpoints
  • Tests verify correct URL construction and parameter passing
  • Tests confirm proper response data extraction

Related

  • Jira: ERA-12682

@JoshuaVulcan JoshuaVulcan added autoreviewing PR is currently being auto-reviewed and removed autoreviewing PR is currently being auto-reviewed labels Feb 11, 2026
JoshuaVulcan added a commit that referenced this pull request Feb 11, 2026
- Add AsyncERClient._get_raw() to return raw httpx.Response for binary endpoints
- Use _get_raw in async download_choice_icons() and get_sitrep() so callers
  get response.content / stream instead of broken JSON parse
- Update async tests to mock binary content and assert on response.content

Addresses ER_CLIENT_PR_REVIEWS.md: PR #41 dependency check and get_sitrep
binary response. Self-contained (no dependency on PR #42 _get_response).

Co-authored-by: Cursor <cursoragent@cursor.com>
JoshuaVulcan and others added 2 commits February 11, 2026 10:19
…A-12682)

Add read-only and CRUD endpoints for miscellaneous DAS apps to both
ERClient (sync) and AsyncERClient (async):

Analyzers:
- get_analyzers_spatial() - list spatial analyzers
- get_analyzers_subject() - list subject analyzers

Choices:
- get_choices() - list all choice sets
- get_choice(id) - get a single choice set
- download_choice_icons() - download choice icons zip

Buoy/Gear CRUD:
- get_gear_list() - list gear items
- get_gear(id) - get single gear item
- post_gear(payload) - create gear item
- patch_gear(id, payload) - update gear item
- delete_gear(id) - delete gear item

Reports/Tableau:
- get_sitrep() - download situation report (.docx)
- get_tableau_views() - list Tableau views
- get_tableau_view(id) - get single Tableau view

Also adds async _delete() helper to AsyncERClient.
Includes 31 new tests across sync and async test suites.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add AsyncERClient._get_raw() to return raw httpx.Response for binary endpoints
- Use _get_raw in async download_choice_icons() and get_sitrep() so callers
  get response.content / stream instead of broken JSON parse
- Update async tests to mock binary content and assert on response.content

Addresses ER_CLIENT_PR_REVIEWS.md: PR #41 dependency check and get_sitrep
binary response. Self-contained (no dependency on PR #42 _get_response).

Co-authored-by: Cursor <cursoragent@cursor.com>
@JoshuaVulcan JoshuaVulcan requested a review from a team as a code owner February 12, 2026 02:28
Copy link
Copy Markdown
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 client support (sync + async) for several DAS “misc” endpoints—analyzers, choices, buoy/gear CRUD, and reports/Tableau—along with new unit tests to validate URL construction and response handling.

Changes:

  • Added ERClient and AsyncERClient methods for analyzers, choices (incl. icon download), buoy/gear CRUD, and sitrep/Tableau report endpoints.
  • Introduced an async raw-download helper (_get_raw) for binary GET responses (icons zip, sitrep docx).
  • Added new sync and async test modules covering the new endpoints.

Reviewed changes

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

File Description
erclient/client.py Adds the new sync/async endpoint methods and introduces _get_raw for async binary downloads.
tests/sync_client/test_analyzers_choices_gear_reports.py New sync tests for analyzers/choices/gear/reports client methods.
tests/async_client/test_analyzers_choices_gear_reports.py New async tests for analyzers/choices/gear/reports, including error-path coverage.

💡 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.

Comment on lines 1894 to 1899
async def _delete(self, path, params=None, base_url=None):
"""Perform an async DELETE request. Delegates to _call (204/no body handled there)."""
return await self._call(
path=path, payload=None, method="DELETE", params=params, base_url=base_url
)

Comment on lines +6 to +8
import pytest


Comment on lines +254 to +262
# DELETE returns None from _call (no json body on 204)
# The async client raises on non-200 via raise_for_status, but 204 is ok.
# However our _call tries response.json() which will fail on 204.
# Let's mock a 200 with empty body instead:
route = m.delete(f"buoy/gear/{GEAR_ID}").respond(httpx.codes.OK, json={})

result = await er_client.delete_gear(GEAR_ID)

assert route.called
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