Skip to content

Record the rect axis order [y, x] and the length-unit catalog; conformance data, validator and tests - #115

Merged
guijacquemet merged 3 commits into
mainfrom
claude/conformance-decisions
Oct 12, 2026
Merged

guijacquemet merged 3 commits into
mainfrom
claude/conformance-decisions

Conversation

@guijacquemet

@guijacquemet guijacquemet commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Docs, data and tests, plus the validator for the new catalog. No other production code of Tools changes.

Decisions recorded (SPEC_WRONG_SCIENCE section 8, "Decided (user, 12 Oct)")

  1. The axis order of a rect region is [y, x], like the image arrays; protocol shapes stay [x, y] (GeoJSON). The fixtures say which pairs are [width, height] (server_wh) and which are [rows, columns].
  2. The length-unit names are a catalog in conformance.json, edited by data change (replaces the strict list of the first version of this PR). Match rule: symbols (m, nm, um, mm, cm, the micro signs U+00B5 / U+03BC, the Angstrom signs U+00C5 / U+212B) are exact, case-sensitive, untrimmed; words are matched case-insensitively after trimming surrounding whitespace. Anything not in the catalog is unknown calibration. The 72 / 96 dpi and INCH / CENTIMETER rules are unchanged.

What changed

  • labconstrictor_tools/conformance.json:
    • calibration.length_units replaces length_units_um: canonical unit -> {um_per_unit, symbols, words} for nm, um (micron(s), micrometer(s), micrometre(s), um, µm, μm), mm, cm, m (each with its -meter/-metre words and plurals) and angstrom (Å, Å, angstrom(s), 0.0001).
    • calibration.unit_match holds the rule and the base unit; calibration.unit_match_refused the pinned unknown names (case variants and spaced forms of symbols, plurals of symbols, words split by a space, inch, pixel, kilometer, a damaged micro sign).
    • CAL-01, 08, 10, 17 are back to micrometer / micron / Angstrom; CAL-19 (refused names unknown) and the new CAL-20 (words are case-insensitive and trimmed).
    • coordinate.axis_order and server_shape_yx (additive next to server_wh) stay.
  • labconstrictor_tools/conformance.py (the only production file touched): _length_units validates the catalog: positive um_per_unit, symbol / word lists, a name owned by two units, a word not lower case or not trimmed, a symbol that is also a word of another unit, a name starting with U+FFFD, and a missing base unit (unit_match.canonical, factor 1.0). It replaces the old length_units_um check.
  • docs/SPEC_WRONG_SCIENCE.md: section 8, 2.1.4 and the CAL table follow the catalog.
  • docs/CONFORMANCE.md: layout table; new "How to add a unit" (one data line, one test row in CalibrationData.ORACLE, which hosts change: all of them load the catalog); rect axis order and length units removed from the Gaps list.
  • tests/test_conformance.py: every catalog name converts to the factor of a hand-written oracle (symbols exact, words any case and trimmed, no space inside a word); the same length written in every unit agrees; every refused name stays unknown; the validator rejects each kind of malformed catalog (duplicate symbol, duplicate word in another case, non-positive factor, names not a list, untrimmed or non-lower-case names, a symbol that is a word of another unit, damaged sign, unknown or non-base canonical unit, missing catalog); a new unit or alias added as data validates and resolves with no code change; plus the rect [y, x] and [width, height] tests from before.
  • tests/test_sabotage.py: rows that break the table (millimetre factor, inch as a word of the metre, UM as a symbol), the validator (duplicate name, missing base unit) and the rect / CF-09 data.
  • origin/main merged in (plain merge; the notebook sabotage rows of Notebook form: refuse an integer beyond 2^53-1 with the sentence of spec 6.2 (NUM-02, NUM-03) #116 and mine are both kept).

Contradictions with production code

None in Tools production code: Tools converts no units and has no rect code. Hosts must change once to read the catalog instead of their own list (other repositories, not touched): Napari reads units through pint (any pint unit, e.g. inch, also accepted), so it contradicts the catalog; Fiji and QuPath were not checked. HOST_PARITY C18 (an audit table) lists the old set and is left as history.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN


Generated by Claude Code

…sions; conformance data, tests and sabotage rows follow

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN

Copy link
Copy Markdown
Contributor Author

Local full suite as the non-root user tester, private TMPDIR (cleaned up afterwards): all tests pass except 2 in test_tools_features (test_register_writes_them_into_the_entry_and_the_cached_schema, test_doctor_prints_them_and_does_not_call_an_upgrade_stale). Those fail only in this sandbox, unrelated to this PR: the app interpreter /usr/bin/python imports an old editable install of Tools from /tmp/wt_versions (no retention_prune feature). CI is green on every job.


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
…validator, tests, sabotage rows and 'How to add a unit'

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
@guijacquemet guijacquemet changed the title Record the rect axis order [y, x] and the accepted length-unit names; conformance data and tests Record the rect axis order [y, x] and the length-unit catalog; conformance data, validator and tests Oct 12, 2026
@guijacquemet
guijacquemet merged commit dd81801 into main Oct 12, 2026
6 checks passed
@guijacquemet
guijacquemet deleted the claude/conformance-decisions branch October 14, 2026 16:10
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