Skip to content

fix(validation): classify every level, and cite the coverage rule - #131

Open
simontaurus wants to merge 1 commit into
mainfrom
fix/level-vocabulary-and-citation
Open

fix(validation): classify every level, and cite the coverage rule#131
simontaurus wants to merge 1 commit into
mainfrom
fix/level-vocabulary-and-citation

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

The two items https://github.com/OO-LD/oold-schema/releases/tag/v1.0.0-rc.3 unblocked. Closes the remaining half of #120 and item 4 of #125.

severity() no longer guesses

return FAIL if rule.level in _MUST_LEVELS else WARN treated every unrecognised level as advice. That is silent and wrong in one direction: a level the specification adds later is demoted to a warning without anyone noticing.

Not hypothetical - NOT RECOMMENDED entered the vocabulary in v1.0.0-rc.3, and the old reading would have absorbed it without a word. It happens to be advice, so the outcome was right by luck rather than by construction.

  • _ADVICE_LEVELS is now listed rather than inferred, and an unrecognised level raises, naming the rule and the level.
  • test_the_severity_split_covers_the_whole_level_vocabulary ties both sets to the level enum of every tracked version, so a vocabulary that grows upstream fails at vendoring time rather than at runtime, and asserts the two sets are disjoint and that it checked something.

Raising is the right default here precisely because neither fallback is safe: as advice it demotes a requirement, as a failure it invents one.

context.coverage cites its rule

OOLD-SCH-21d7 (SHOULD - a schema should offer at least one complete mapping) arrived in rc.3, so the check no longer needs a severity chosen in code. WARN now follows from the catalogue's level, the way every other rule-backed finding does, with --strict as the opt-in override.

Citing it is additive rather than gating, checked against both versions:

1.0.0-rc.2   WARN context.coverage        property with no @context term...
1.0.0-rc.3   WARN OOLD-SCH-21d7 context.coverage   property with no @context term...

An older meta version keeps the warning and simply cites nothing, rather than skipping the check.

Verified

555 tests pass, make check exits 0.

- severity() treated anything not a MUST as advice, so a level added
  upstream was silently demoted; unrecognised levels now raise
- _ADVICE_LEVELS is listed rather than inferred, and a test ties both
  sets to the level enum of every tracked version
- context.coverage cites OOLD-SCH-21d7, so its warning is the
  catalogue's severity rather than one chosen in code
@github-actions

Copy link
Copy Markdown
Contributor

Release preview

Merging this PR would release v0.17.1 (current: v0.17.0).

Changelog preview (truncated)
## v0.17.1 (2026-08-23)

### Bug Fixes

- **validation**: Classify every level, and cite the coverage rule
  ([`ceab451`](https://github.com/OO-LD/oold-python/commit/ceab451d408a10d822d7b2c4da1c785787339bb7))

### Chores

- **meta**: Vendor oold-schema v1.0.0-rc.3
  ([`2485f98`](https://github.com/OO-LD/oold-python/commit/2485f98c6b5edb4a0af580f4c5be54f98e3a794a))

Preview via python-semantic-release and conventional commits.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Click to see benchmark comparison
📊 Benchmark Comparison (threshold: 1.3x)
============================================================

➖ Unchanged (within threshold):
  ➖ test_simple_dict_document_store: 0.0016s → 0.0016s (+0.2%)
  ➖ test_sqlite_document_store: 0.0017s → 0.0017s (-0.5%)
  ➖ test_local_sparql_store: 0.0371s → 0.0372s (+0.4%)
  ➖ test_oneof_subschema: 0.0567s → 0.0570s (+0.5%)
  ➖ test_enum_docstrings: 0.0470s → 0.0496s (+5.6%)
  ➖ test_subclass_inheritance: 0.0505s → 0.0507s (+0.4%)
  ➖ test_class_hierarchy: 0.0486s → 0.0484s (-0.3%)
  ➖ test_core[v1]: 0.0361s → 0.0368s (+1.9%)
  ➖ test_core[v2]: 0.0410s → 0.0414s (+1.0%)
  ➖ test_schema_generation[v1]: 0.0015s → 0.0015s (+1.0%)
  ➖ test_schema_generation[v2]: 0.0026s → 0.0026s (+1.0%)
  ➖ test_simple_json: 0.0006s → 0.0006s (-1.5%)
  ➖ test_complex_graph: 0.0014s → 0.0014s (-0.2%)

============================================================
Summary: 0 regressions, 0 improvements, 13 unchanged
============================================================

✅ No significant performance regressions

Threshold: 1.3x (30% slower triggers a regression warning)

Note: Benchmarks are informational only and won't fail the build.

💡 Tip: Download the benchmark-results artifact for detailed JSON data

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/oold/validation/check_registry.py 66.6% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant