Skip to content

Validate frontend API and enum contracts - #169

Open
izkgao wants to merge 6 commits into
devfrom
zhenkai/157_validate_enums
Open

Validate frontend API and enum contracts#169
izkgao wants to merge 6 commits into
devfrom
zhenkai/157_validate_enums

Conversation

@izkgao

@izkgao izkgao commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #157, #162, and #177.

Blocked by companion frontend PR: CARTAvis/carta-frontend#2922 (merged)

This PR aligns carta-python with the CARTA frontend's renamed boolean and validation properties and adds machine-checkable API and enum contracts for development-time compatibility checks.

What is implemented:

  • Update wrapper property paths and region handling to match the current frontend contract, including validation for unsupported annulus operations.
  • Add source-aware enum registries plus API and enum manifest extractors, with unit coverage for extraction, aliases, and duplicate registrations.
  • Document the API contract workflow and add a dev CI job that checks generated carta-python manifests against carta-frontend.

Checklist

For linked issues (if any):

  • assignee and labels added
  • GitHub Project estimate added

For the pull request:

  • reviewers and assignee added
  • GitHub Project estimate added
  • tests added or updated / no tests needed
  • documentation updated / no documentation update needed

For dependencies and compatibility:

  • companion frontend or backend PRs linked / no companion PRs needed
  • pyproject.toml and uv.lock updated / no dependency changes
  • CARTA compatibility table updated when the minimum CARTA series changes
    or dev starts a new carta-python major/minor series
    / no compatibility
    change

For pull requests targeting main:

  • VERSION.txt finalized for the release
  • final compatibility entry matches the release major/minor version and
    minimum supported CARTA series

@izkgao izkgao added this to the v6-beta2 milestone Apr 30, 2026
@izkgao
izkgao requested review from confluence and kswang1029 April 30, 2026 05:09
@izkgao izkgao added awaiting code review For pull requests that require code review awaiting testing For pull requests that require testing blocked For issues/PRs that are blocked, either by other issues/PRs, or by external dependencies labels Apr 30, 2026
@izkgao
izkgao marked this pull request as ready for review April 30, 2026 05:12
@izkgao izkgao assigned confluence and unassigned kswang1029 Aug 18, 2026

@confluence confluence left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm going to wait until the other PRs have been resolved before doing a final review, but I have an alternative suggestion for specifying the links to protobuf and frontend enums:

  • Create mix-in classes called FrontendEnum and ProtobufEnum.
  • For each of these, implement a registration mechanism for subclasses (similar to the region and view mechanism), which:
    • Checks the subclass for an optional snapshot_name class attribute (maybe this should be called something like external_name or reference_name -- and it should probably be in all caps for style consistency)
    • Updates a class dict that maps snapshot names to enum subclasses (if no custom snapshot_name is provided, the name of the class is used by default)
  • Make each class that is linked to a frontend or protobuf enum inherit one of these mixins.

Now by default enums won't be linked to anything, and you can access the mappings of the mixins to get the lists of frontend- and protobuf-linked enums (instead of having to tag every enum and parse them all manually), and you don't have to provide external names explicitly unless the class name is different.

@izkgao izkgao removed the blocked For issues/PRs that are blocked, either by other issues/PRs, or by external dependencies label Aug 18, 2026
@izkgao

izkgao commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

I removed the unrelated code changes from zhenkai/check_version branch so it can be reviewed independently.

@izkgao izkgao added awaiting code changes For pull requests that require code changes and removed awaiting code review For pull requests that require code review awaiting testing For pull requests that require testing labels Aug 19, 2026
@izkgao

izkgao commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

I found that it would be better to make it work without launching CARTA. I will make a script in frontend to generate a list of enum and use it for validation.

@izkgao
izkgao marked this pull request as draft August 25, 2026 09:37
@izkgao
izkgao force-pushed the zhenkai/157_validate_enums branch from 437faa6 to 1a7f2d7 Compare August 26, 2026 08:23
@izkgao izkgao changed the title Validate enums Validate API and enum Aug 26, 2026
@izkgao izkgao changed the title Validate API and enum Validate frontend API and enum contracts Aug 26, 2026
@izkgao izkgao mentioned this pull request Aug 26, 2026
4 tasks
@izkgao
izkgao marked this pull request as ready for review September 4, 2026 08:58
@izkgao izkgao added awaiting code review For pull requests that require code review awaiting testing For pull requests that require testing and removed awaiting code changes For pull requests that require code changes labels Sep 4, 2026
@izkgao
izkgao requested a review from confluence September 4, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting code review For pull requests that require code review awaiting testing For pull requests that require testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update stale frontend API paths and enums after API changes Add CI check for frontend API compatibility Revise colormap code

3 participants