Skip to content

feat: tighter validation on depends_on targets#71

Merged
jokasimr merged 3 commits into
mainfrom
transformations-are-nxnumber
Jun 25, 2026
Merged

feat: tighter validation on depends_on targets#71
jokasimr merged 3 commits into
mainfrom
transformations-are-nxnumber

Conversation

@jokasimr

Copy link
Copy Markdown
Contributor

This PR implements tighter validation on depends_on targets, and verifies children of transformation groups are NX_NUMBER.

Supersedes #70

@jokasimr jokasimr force-pushed the transformations-are-nxnumber branch from a090a74 to b594984 Compare June 25, 2026 09:53
Comment thread src/chexus/validators.py Outdated
)

def validate(self, node: Dataset | Group) -> Violation | None:
if not node.attrs.get("NX_class") == "NXlog":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this do nothing if node is a Dataset?

Also, do you think it is worth validating the dtype of the Dataset (same above in is_complete_transformation).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not very clear maybe but the validator does not apply to datasets.

Also, do you think it is worth validating the dtype of the Dataset (same above in is_complete_transformation).

I don't think so. I can add it if you want but it seems like a unlikely error.

@SimonHeybrock SimonHeybrock Jun 25, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not very clear maybe but the validator does not apply to datasets.

Are you sure? It says in def applies_to(self, node: Dataset | Group) -> bool: that it applies to everything in NXtransformations parent groups?

@jokasimr jokasimr Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The condition in applies_to was isinstance(node, Group) before.

I've now changed it so that it applies to both groups and datasets.

Comment thread tests/validators_test.py
)
bad = chexus.Group(
name="transformations/bad", attrs={"NX_class": "NXcollection"}, parent=parent
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing good and bad datasets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added a good dataset test, but there is no bad dataset case for this validator because we don't check dtype.

@jokasimr jokasimr requested a review from SimonHeybrock June 25, 2026 10:02
@jokasimr jokasimr merged commit 875519e into main Jun 25, 2026
4 checks passed
@jokasimr jokasimr deleted the transformations-are-nxnumber branch June 25, 2026 11: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