Skip to content

A vec2 argument type: two numbers validated against their declared ranges - #17

Open
Jules-GP wants to merge 13 commits into
mainfrom
feat/vec2
Open

A vec2 argument type: two numbers validated against their declared ranges#17
Jules-GP wants to merge 13 commits into
mainfrom
feat/vec2

Conversation

@Jules-GP

Copy link
Copy Markdown
Collaborator

The server half of vec2 - two numbers set together, because they are one
position rather than two settings.

The client already renders it (a 2D pad plus two spin boxes, with drag, Ctrl for
a finer gesture, wheel and arrow keys) and nothing produced it. The generator
half is sadt-tools#24; this is what lets a schema declaring one load, and what
validates the value before run() sees it.

What it adds

  • VEC2_TYPE and _coerce_vec2 in base.py: a JSON array or the
    comma-separated shorthand, exactly like the list and multichoice types.
  • x_range/y_range on ArgSpec, and vec2 in the schema vocabulary.
  • x_labels/y_labels, which name the two ends of an axis: "0.8" says nothing
    about where that is in a mouth, and "mid"/"out" does.

The ranges are not presentation

They are the one layout key that reaches validate(). A request that skips the
panel would otherwise place a patch corner off the arch and be answered with a
success, which is the failure this repository keeps finding in other forms. A
mirrored axis is still written by inverting the range (x_range: [15, -15] puts
15 at the left end), and validation compares against the min and max rather than
the declared order - a test pins that.

Verified

An annotation through describe.py, the generated schema through
_argument_spec, and validate() refusing y = 9 on an axis declared
[-5, 5], naming the axis and the value. Then FlexReg's real schema through the
client's formgen: five pads built from the schema alone, with the right
ranges and no client-side code for it.

315 server tests.

Copilot AI lite review requested due to automatic review settings August 20, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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