Skip to content

GEOPY-2739: Accept BaseUIJson in the start of driver#860

Open
domfournier wants to merge 46 commits intofeature/uijsonfrom
GEOPY-2739
Open

GEOPY-2739: Accept BaseUIJson in the start of driver#860
domfournier wants to merge 46 commits intofeature/uijsonfrom
GEOPY-2739

Conversation

@domfournier
Copy link
Copy Markdown
Contributor

@domfournier domfournier commented Mar 21, 2026

GEOPY-2739 - Accept BaseUIJson in the start of driver

Copilot AI review requested due to automatic review settings March 21, 2026 15:23
@github-actions github-actions bot changed the title GEOPY-2739 GEOPY-2739: Accept BaseUIJson in the start of driver Mar 21, 2026
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

This PR updates the UI JSON model naming by renaming the core BaseUIJson class to UIJson, and adjusts tests/imports accordingly to match the new API surface.

Changes:

  • Rename BaseUIJson to UIJson in geoh5py.ui_json.ui_json.
  • Update UI JSON tests to subclass/use UIJson instead of BaseUIJson.
  • Update the geoh5py.ui_json package export to re-export UIJson.

Reviewed changes

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

File Description
geoh5py/ui_json/ui_json.py Renames the core model class and updates read() logic/type hints to reference UIJson.
geoh5py/ui_json/init.py Switches the package-level export from BaseUIJson to UIJson.
tests/ui_json/uijson_test.py Updates tests to use UIJson for subclassing/reading.
tests/ui_json/forms_test.py Updates helper test model to subclass UIJson.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 88.69565% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.18%. Comparing base (f5eca37) to head (3503943).

Files with missing lines Patch % Lines
geoh5py/ui_json/ui_json.py 87.57% 13 Missing and 7 partials ⚠️
geoh5py/ui_json/validation.py 81.81% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #860      +/-   ##
===========================================
- Coverage    91.23%   91.18%   -0.05%     
===========================================
  Files          112      112              
  Lines        10369    10402      +33     
  Branches      1908     1916       +8     
===========================================
+ Hits          9460     9485      +25     
- Misses         481      487       +6     
- Partials       428      430       +2     
Files with missing lines Coverage Δ
geoh5py/shared/utils.py 91.11% <100.00%> (-0.27%) ⬇️
geoh5py/shared/validators.py 93.90% <ø> (+1.04%) ⬆️
geoh5py/ui_json/__init__.py 100.00% <100.00%> (ø)
geoh5py/ui_json/annotations.py 100.00% <100.00%> (ø)
geoh5py/ui_json/forms.py 95.28% <100.00%> (+0.03%) ⬆️
geoh5py/ui_json/input_file.py 86.34% <100.00%> (+0.04%) ⬆️
geoh5py/ui_json/validation.py 85.85% <81.81%> (-1.85%) ⬇️
geoh5py/ui_json/ui_json.py 86.72% <87.57%> (-2.78%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@MatthieuCMira MatthieuCMira left a comment

Choose a reason for hiding this comment

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

ok with the changes.

only typical docstrings comments

Still, that's a lot of function's names changes. Isn't it a bit dangerous to add it to 4.8?

Copy link
Copy Markdown
Contributor

@MatthieuCMira MatthieuCMira left a comment

Choose a reason for hiding this comment

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

check for the Form accepting multiselect, and accept list of expected values

@domfournier
Copy link
Copy Markdown
Contributor Author

@copilot

- Add type annotations and docstring to str2none in utils.py
- Improve UIJson.infer docstring with params and return docs
- Change DataForm.value to OptionalUUIDList to support list of UUIDs when multiselect is True
- Add test for DataForm with list of UUIDs

Agent-Logs-Url: https://github.com/MiraGeoscience/geoh5py/sessions/59d9d0e9-5ed8-44ad-b621-90e66658a9e9

Co-authored-by: domfournier <55204635+domfournier@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@MatthieuCMira MatthieuCMira left a comment

Choose a reason for hiding this comment

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

give me a new error:

Image

pulling the string:

    1. because, in form dependency, if a dependency is set latter in the form, it's not in the dictionary you created.
    1. because dependencies comes from non active fields (use flatten active_only=False)



def parent_validation(name: str, data: dict[str, Any], json_dict: dict[str, Any]):
def parent_validation(name: str, data: dict[str, Any], ui_json: UIJson):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this gave me an error because if child is in list, it raises an error!

isinstance(child, Data) and parent.get_entity(child.uid)[0] is None
):
raise UIJsonError(f"{name} data is not a child of {form['parent']}.")
if not isinstance(parent, ObjectBase) or (child not in parent.children):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not isinstance(parent, ObjectBase) or (child not in parent.children):
child = child if isinstance(child, list) else [child]
missing_children = len(list(set(child) - set(parent.children))) > 0
if not isinstance(parent, ObjectBase) or missing_children:

@domfournier domfournier changed the base branch from develop to feature/uijson April 7, 2026 16:46
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.

4 participants