Skip to content

Conversation

@havok2063
Copy link
Contributor

This PR adds support for IPL-4 into valis.

@havok2063 havok2063 self-assigned this Oct 17, 2025
@havok2063 havok2063 added the enhancement New feature or request label Oct 17, 2025
@havok2063 havok2063 requested a review from Copilot October 23, 2025 19:45
@havok2063 havok2063 marked this pull request as ready for review October 23, 2025 19:45
Copy link

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 adds support for IPL-4 by implementing dynamic Astra schema selection based on data release versions. The key changes include updating schema mapping logic to handle the new IPL-4 version (0.8.0) while maintaining backward compatibility with DR19/IPL-3 (0.5.0, 0.6.0).

  • Implemented dynamic Astra schema selection in database connection logic
  • Enhanced query functions with proper documentation and simplified logic
  • Updated data model to make certain fields optional for compatibility

Reviewed Changes

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

File Description
python/valis/db/db.py Added dynamic Astra schema selection based on release version in database connection dependency
python/valis/db/queries.py Simplified Apogee target retrieval, added comprehensive docstrings, and enhanced schema validation
python/valis/db/models.py Made several AstraSource fields optional to accommodate schema variations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if not vastra or vastra not in ("0.5.0", "0.6.0"):
print('astra only supports DR19 / IPL3 = version 0.5.0, 0.6.0')
vastra = "0.5.0" if vastra in ("0.5.0", "0.6.0") else vastra
if vastra.replace('.', '') not in astra.Source._meta.schema:
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The condition vastra.replace('.', '') not in astra.Source._meta.schema will fail when vastra is None (returned by get_software_tag when release is invalid). This will cause an AttributeError. Add a check for None before calling .replace().

Suggested change
if vastra.replace('.', '') not in astra.Source._meta.schema:
if vastra is None or vastra.replace('.', '') not in astra.Source._meta.schema:

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +98
vastra = "0.5.0" if vastra in ("0.5.0", "0.6.0") else vastra
schema = f"astra_{vastra.replace('.', '')}"
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

[nitpick] The version mapping logic vastra = \"0.5.0\" if vastra in (\"0.5.0\", \"0.6.0\") else vastra is duplicated in both get_pw_db and get_astra_target. Consider extracting this logic into a shared utility function to improve maintainability.

Copilot uses AI. Check for mistakes.
@havok2063 havok2063 merged commit f081ff4 into main Nov 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants