proposal: stable codes for spec rules, in a shared registry?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- documentation
Research direction
Start by comparing the linked ngff-zarr rule-reference table with yaozarrs’ prototype rules.toml and its cited test_rules.py check. The issue leaves the registry’s home, format, and governance open; done would mean agreeing on those choices and a small pilot area, with clear guidance for adding and retiring stable codes.
Written by the indexing model from the issue text.
Description
hey folks, I've been working on something in yaozarrs that seems like it could be useful more broadly, so I wanted to float it (I mentioned this briefly on the pre-hackathon zoom 2 days ago).
I'd like to propose a shared set of stable codes for the normative statements in the spec and schemas .. that any implementation or test case could use. (I wasn't able to find any prior discussion of this, so apologies if I missed it)
My goal in yaozarrs was to raise a ValidationError for each normative statement or rule in the spec or schema, with a code that links to a URL on my documentation page, which in turn links to the exact line in the spec or schema that mandates it... kinda like a linter would. I think it would immediately help clarify confusion about where/why a given thing is invalid or not.
In [1]: v06.WellDef.model_validate({"images": [{"path": "0"}, {"path": "0", "acquisition": 1}]})
ValidationError: 1 validation error for WellDef
Field of view paths must be unique. Duplicates: ['0']
See https://imaging-formats.github.io/yaozarrs/rules/NGFF-WL-002/ [type=NGFF-WL-002, ...]
(those docs pages aren't published yet, it's still on a branch)
It seems like other projects are running into similar issues. German-BioImaging/oztest#46 is asking for descriptions of why a test case is invalid, and on German-BioImaging/oztest#50 it wasn't clear which rule a couple of cases were meant to test. ngff-zarr has something similar too... @thewtex has a table of 15 structural rules with stable identifiers like axis-count, shared between the python and typescript ports. So we're already starting to grow separate vocabularies for the same statements, and it seems like a good moment to see if we can share one.
I have a working prototype on this branch with 170 rules (164 from the spec and schemas for v0.4 to v0.6, plus 6 that are yaozarrs-specific), and I'm happy with it. A rule looks like this:
[rules.NGFF-WL-002]
slug = 'field-path-unique'
level = 'MUST'
summary = 'Field of view `path`s must be unique within a well.'
introduced = '0.4'
[[rules.NGFF-WL-002.sources]]
quote = 'MUST NOT be a duplicate of any other `path` in the `images` list.'
# where that quote appears in each spec version: [first line, last line]
lines = { "0.4" = [605, 606], "0.5" = [540, 541], "0.6" = [1680, 1680] }
A code stays the same across spec versions for as long as the requirement does. If the requirement changes, the old code gets retired and a new one gets added (e.g. v0.6 relaxed the allowed characters in a field of view path, so NGFF-WL-001 became NGFF-WL-010). Spec files are pinned to a commit and vendored, and a test checks that each quote is still at those lines.
I think the rules themselves could live in a structured file (toml, json, whatever) somewhere outside of yaozarrs... possibly here, or in ngff-spec, or in oztest (German-BioImaging/oztest#28 makes me think those may end up close together anyway). Implementations could then share the codes, and oztest cases could say which rule they test. There would be clear and simple guides about how a rule gets added, when a code has to change, permanence, etc. (what I have so far is a Claude skill, and I could imagine agentic skills like that helping with this too... e.g. proposing rule updates when a new spec version comes out)
Each rule on my branch also has a minimal failing example, but we could leave those out of a shared file and have each rule point at the oztest cases that exercise it instead.
My rules file only covers what yaozarrs checks so far. For a shared file, I think we'd want every normative statement that can be violated, even if nothing checks it yet (with stuff about reader/writer behavior marked as such). A test could flag any line with a keyword that isn't cited by a rule or explicitly skipped. None of this has merged, so the names and numbering are all up for grabs.
Thoughts? Where do you think this sort of thing would/should live? (here or related seems most natural) The upcoming Zurich hackathon seems like a good place to work on this together, and I'm happy to put together a PR for one small area beforehand if that makes it easier to look at.
cc @clbarnes @joshmoore @jo-mueller @kevinyamauchi @DragaDoncila
- Dominant language
- Python
- Stars
- 180
- Forks
- 81
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ome/ngff
-
feature request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
leftover mention of `path` in v0.6 scale/translation transforms?Possibly taken @tlambert03 claimed this 1 day ago. Open0.6 post-release patch bug
Difficulty 1/5 Under an hour Newbie friendliness 72/100
ome/ngff#661 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
0.6 post-release patch bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
should byDimension inputAxes/outputAxes be "integer" in the schemaPossibly taken @tlambert03 claimed this 1 day ago. Open0.6 post-release patch bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
0.6 post-release patch
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ome/ngff#634 · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned sessionPossibly taken @bodapatisaikrishna claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
external
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
langchain-ai/docs#7652 ·
Maintainers usually reply within 1 day
-
[oblt-aw][autodoc] Document new e2e-secret-leak-artifacts workflow and update e2e-all leaf listOpen
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
elastic/oblt-aw#2513 · 1 comment ·
Maintainers usually reply within 1 day
-
bug p2
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 75/100
NCAR/CLM-Tutorial#113 · 1 comment ·
Maintainers usually reply within 1 day