capi: list-valued request options - #11
Open
christopherthompson81 wants to merge 1 commit into
Open
christopherthompson81 wants to merge 1 commit into
christopherthompson81 wants to merge 1 commit into
Conversation
The model spec has declared `string_list` / `float_list` / `path_list` /
`audio_path_list` option types since schema v1, and the schema validates their
declarations — but nothing carries one at run time. Options are string -> string
from the ABI down to TaskRequest::options, so a family wanting a list had no
transport, and no spec has ever used the types. This adds the missing half.
audiocpp_request_set_option_array(request, key, values, count)
Values are copied, a second call with the same key REPLACES the list (matching
set_option's assignment semantics), count 0 sets an empty list — distinct from
never setting the key — and a null element is rejected before anything is
written, so a bad element cannot leave the option half-assigned.
Lists live in their own map, TaskRequest::option_arrays, so a family reading
single-valued options cannot see a half-formed list and vice versa; which one a
family reads is declared by the type in its spec.
validate_spec_backed_request_options gains an overload that checks array keys
against the same contract, so an undeclared list key is rejected exactly as an
undeclared scalar one is. Every existing call site is untouched.
⚠ build_preparation_request carries the new map too. Preparation decides how
graphs are sized, and a family whose work depends on a list option would
otherwise prepare itself against a different request than the one run() is
handed — and worse, fall back to whatever it does when the option is absent.
ABI minor 1 -> 2, and the minor now MEANS that. It has never moved, including
across 0xShug0#544, which added four entry points; a three-field version where two
fields never change cannot answer the question a caller has. Minor increments
when entry points are added — nothing is removed or changed, so a caller built
against a lower minor keeps working, and one that needs a newer entry point can
require a minimum. Patch is behaviour only and must not be gated on.
A C caller can of course resolve the symbol and test for NULL, which is exact
and needs no version at all. The field is for the callers that cannot: a binding
declaring its imports up front binds on first use and raises a missing-symbol
error from inside the call, which is a poor way to find out a library is too old.
⚠ Recorded rather than papered over: 0.1 covers two different surfaces, because
0xShug0#544's entry points shipped without a bump. From 0.2 the minor is the answer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review copy on the fork. Framework only — no model family is touched, and nothing uses this yet. The consumer is a separate PR.
It completes something already half-designed
The model spec has declared
string_list/float_list/path_list/audio_path_listsince schema v1, andschema.cppvalidates their declarations — but nothing carries one at run time. Options arestring -> stringfrom the ABI down toTaskRequest::options, so a family wanting a list has no transport, and no spec has ever used the types.set_option.count == 0sets an empty list — distinct from never setting the key.TaskRequest::option_arrays), so a family reading single-valued options cannot see a half-formed list; which one it reads is declared by the type in its spec.validate_spec_backed_request_optionsgains an overload — an undeclared list key is rejected exactly as an undeclared scalar one is, and every existing call site is untouched.⚠
build_preparation_requestcarries the new map too. Preparation decides how graphs are sized, so a family whose work depends on a list option would otherwise prepare against a different request than the onerun()is handed — and, worse, fall back to whatever it does when the option is absent. That was not hypothetical: it cost a whole language in testing before it was caught.ABI minor 1 → 2, and the minor now means that
It has never moved, including across 0xShug0#544, which added four entry points. A three-field version where two fields never change cannot answer the question a caller has.
Minor increments when entry points are added — nothing is removed or changed, so a caller built against a lower minor keeps working, and one that needs a newer entry point can require a minimum. Patch is behaviour-only and must not be gated on.
docs/c_api.mdsays so now.A C caller can of course resolve the symbol and test for NULL, which is exact and needs no version at all. The field is for the callers that cannot: a binding declaring its imports up front — C#, JNA, ctypes with prototypes — binds on first use and raises a missing-symbol error from inside the call, which is a poor way to find out a library is too old.
⚠ Recorded rather than papered over:
0.1covers two different surfaces, because 0xShug0#544's entry points shipped without a bump. From0.2the minor is the answer.🤖 Generated with Claude Code
https://claude.ai/code/session_01EkxqpYvUbjCpRDnFiNiVfx