Skip to content

ADD: publish a number's min, max and step so a tool can ask for a slider - #105

Merged
Jules-GP merged 1 commit into
DCBIA-OrthoLab:mainfrom
Jules-GP:feat/slider-bounds
Nov 30, 2026
Merged

Jules-GP merged 1 commit into
DCBIA-OrthoLab:mainfrom
Jules-GP:feat/slider-bounds

Conversation

@Jules-GP

Copy link
Copy Markdown
Collaborator

A tool can now ask for a slider on a number, and the server carries its bounds to the clients.

What changes

  • ArgSpec gains min, max and step, read from the tool's schema (_ARGUMENT_KEYS and _PRESENTATION_KEYS name them, as the module requires of every key).
  • GET /tools publishes them only where a tool declared them, so the published shape of every other tool is unchanged byte for byte (the golden fixture is untouched).
  • ui: "slider" becomes a legal layout for an int or a float.
  • check_schema refuses at boot what a client could not honour: a slider without both bounds, min not below max, a non-positive step, a non-number, bounds on a text or choice argument, and fractional bounds on an int.

They are presentation only, like section or ui: validate() ignores them and the tool's own check is what refuses a value. That keeps a direct API call exactly as before.

Why

The clients already draw ui: "slider" with min/max/step (the Slicer form generator does), but nothing published the bounds, so a tool could not ask for one. TMJ_Crop's crop size is the first user (SADT-VISOR and the Slicer extension have matching PRs). Until this is deployed, an older server drops the keys and the panel shows a plain number field.

Tests

server/tests/test_schema_registry.py: the bounds reach the spec, they reach the wire only where declared, and each refused case. The full suite passes except test_dev_mounts, which fails identically on upstream/main here, and one run of test_nested_admission that failed once in the full suite and passed on rerun.

@Jules-GP
Jules-GP merged commit 154d0e1 into DCBIA-OrthoLab:main Nov 30, 2026
9 checks passed
@Jules-GP
Jules-GP deleted the feat/slider-bounds branch December 1, 2026 14:33
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