Skip to content

GOATS-988: Finalize GPP serializers and tests.#469

Merged
davner merged 2 commits intomainfrom
GOATS-988/finalize-steps
Oct 25, 2025
Merged

GOATS-988: Finalize GPP serializers and tests.#469
davner merged 2 commits intomainfrom
GOATS-988/finalize-steps

Conversation

@davner
Copy link
Copy Markdown
Member

@davner davner commented Oct 25, 2025

  • Refactor GPP serializers to improve structure and maintainability.
  • Update and added unit tests to ensure comprehensive coverage of new serializers.
  • Handle omitted fields and nested structures in serializers for expected GPP API compliance.
  • Remove deprecated test files related to previous implementations.
  • Finish API workflow for GPP ToO creation and observation cloning.

Checklist

  • Added a release note in doc/changes using the PR number.

- Refactor GPP serializers to improve structure and maintainability.
- Update and added unit tests to ensure comprehensive coverage of new serializers.
- Handle omitted fields and nested structures in serializers for expected GPP API compliance.
- Remove deprecated test files related to previous implementations.
- Finish API workflow for GPP ToO creation and observation cloning.
@davner davner self-assigned this Oct 25, 2025
@davner davner requested a review from Copilot October 25, 2025 20:03
Copy link
Copy Markdown

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

This PR refactors GPP serializers to improve structure, maintainability, and API compliance. The refactoring introduces a new base class (_BaseGPPSerializer) with standardized format_gpp() and to_pydantic() methods, updates field types from CharField to appropriate typed fields (e.g., FloatField, IntegerField), and removes deprecated utility functions and test files. The changes also complete the API workflow for GPP ToO creation and observation cloning.

Key changes:

  • Introduced _BaseGPPSerializer base class with format_gpp() and to_pydantic() methods for consistent GPP output formatting
  • Refactored serializers to use proper field types instead of string-based parsing
  • Removed deprecated serializers (CloneTargetSerializer, CloneObservationSerializer) and utilities (utils.py)
  • Updated tests to validate new serializer structure and GPP formatting

Reviewed Changes

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

Show a summary per file
File Description
src/goats_tom/serializers/gpp/_base_gpp.py New base class providing format_gpp() and to_pydantic() interface
src/goats_tom/serializers/gpp/_base.py Removed old base serializer with normalization logic
src/goats_tom/serializers/gpp/utils.py Removed deprecated utility functions
src/goats_tom/serializers/gpp/workflow_state.py Changed field to required, updated to use _BaseGPPSerializer
src/goats_tom/serializers/gpp/sidereal.py Refactored to conditionally include optional fields in GPP output
src/goats_tom/serializers/gpp/exposure_mode.py Changed fields to typed fields, implemented format_gpp()
src/goats_tom/serializers/gpp/elevation_range.py Changed fields to FloatField, implemented format_gpp()
src/goats_tom/serializers/gpp/instruments/fields.py New custom field for comma-separated float parsing
src/goats_tom/serializers/gpp/instruments/gmos_*.py Updated to use CommaSeparatedFloatField and implement format_gpp()
src/goats_tom/serializers/gpp/source_profile/*.py Refactored to use _BaseGPPSerializer with nested validation
src/goats_tom/serializers/gpp/target.py New serializer combining sidereal and source profile data
src/goats_tom/serializers/gpp/observation.py New serializer combining observation-related serializers
src/goats_tom/serializers/gpp/pos_angle.py New serializer for position angle constraints
src/goats_tom/serializers/gpp/constraint_set.py New serializer for observation constraints
src/goats_tom/serializers/gpp/create_too.py New serializer for ToO creation workflow
src/goats_tom/api_views/gpp/toos.py Updated to use new serializers in ToO creation workflow
tests/goats_tom/serializers/gpp/test_*.py Updated tests to validate new serializer behavior and GPP formatting

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

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 92.29209% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.84%. Comparing base (8aa53b9) to head (551a6f6).
⚠️ Report is 81 commits behind head on main.

Files with missing lines Patch % Lines
src/goats_tom/api_views/gpp/toos.py 4.34% 44 Missing ⚠️
src/goats_tom/serializers/gpp/constraint_set.py 84.84% 0 Missing and 5 partials ⚠️
src/goats_tom/serializers/gpp/observation.py 87.80% 0 Missing and 5 partials ⚠️
src/goats_tom/serializers/gpp/elevation_range.py 86.66% 1 Missing and 3 partials ⚠️
...erializers/gpp/instruments/gmos_north_long_slit.py 82.35% 0 Missing and 3 partials ⚠️
...erializers/gpp/instruments/gmos_south_long_slit.py 82.35% 0 Missing and 3 partials ⚠️
src/goats_tom/serializers/gpp/exposure_mode.py 89.47% 1 Missing and 1 partial ⚠️
...rc/goats_tom/serializers/gpp/instruments/fields.py 80.00% 1 Missing and 1 partial ⚠️
src/goats_tom/serializers/gpp/sidereal.py 90.90% 0 Missing and 2 partials ⚠️
...ializers/gpp/source_profile/test_source_profile.py 97.01% 1 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   78.71%   78.84%   +0.13%     
==========================================
  Files         269      276       +7     
  Lines        8493     8810     +317     
  Branches      493      529      +36     
==========================================
+ Hits         6685     6946     +261     
- Misses       1718     1745      +27     
- Partials       90      119      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@davner davner merged commit d721577 into main Oct 25, 2025
6 checks passed
@davner davner deleted the GOATS-988/finalize-steps branch October 25, 2025 20:17
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