Repository navigation
Rust #325: validate query arguments against their durable contract - #850
Conversation
|
Sonar's two
Behavior is unchanged. A new unit test, |
a0d0a71 to
5f6832d
Compare
|
At
Concrete admission cases:
The same distinction matters inside a valid named-argument map. I ran the published Core codec and
Please preserve this map-adapter distinction in admission, type checks and named variadic expansion, replace the contrary Verification scope: the executed controls used exact Core Additional key-casting control: on PHP 8.3.36 with 64-bit integers, There is also a positional-order correction for ordinary string-keyed maps used as named variadics. At this same head, I executed that PHP round-trip/contract control against exact Core One refinement to the documented Re-review at Additional default-conversion case on Related controls under the same Core Re-review of exact There is a new complexity correction in |
5f6832d to
d376fe6
Compare
|
Addressed Cloud's What changed in
Differential cases added to the fixture, recorded against published 2.11.5:
Verification on the Rust host. The fixture passes against published 2.11.5 (fresh state) and against a native image built from this head, 18/18 cases each. SQLite execution 623 and lib 353 pass. |
afa2adb to
bc2b1cf
Compare
|
Pushed
|
bc2b1cf to
d85908c
Compare
|
Pushed
Recorded locally on an image built from this head: published 2.11.5 and native both pass all 22 cases. The suite results are in the PR body. |
|
Re-review of exact One targeted regression-probe gap remains. I executed the exact fixture's PHP loader-to-JSON path on PHP 8.3.36: The documented registered-default ordering limitations remain unfinished #325 parity work. This source review does not establish full default/cutover or published-image acceptance. The author's 22-case and library results remain attributed evidence; the reported load-sensitive execution failure is still tracked by #851. Update for exact The author's corrected published/native recording and old-head counterfactual are retained in the qualification receipt. Those executions remain attributed; this re-review performed no Rust or installed Server execution. No targeted source-review finding remains for this slice. Normal exact-head CI and the broader unfinished parity/release requirements still apply. |
Published Server checks a declared query's arguments with Workflow's
WorkflowQueryContract::validatedArgumentsForRun: a string-keyed map is
taken as named arguments, positional ones are matched in order, defaults
are filled in and variadics collected, and each violation is reported
with its own message under validation_errors ("argument validation
failed"). The worker receives the normalized positional list, encoded
again. A declared query without a parameter contract takes a list as given
and refuses named arguments.
Native checked positional arguments only, refused a map, reported every
violation as a bare invalid_query_arguments and refused some contracts as
unsupported. query_contract.rs ports the normalization and PHP's declared
type rules; the query-contract-arguments fixture records twelve cases
against published Server 2.11.5. Found in review of #849.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d85908c to
dbcde57
Compare
|
Pushed
|
|



Part of #325. Follows #849, and closes the named-argument gap its review found.
What changes
For a declared query, published Server checks the arguments with Workflow's
WorkflowQueryContract::validatedArgumentsForRun:AvroMapValueobject, not an array. At the top level it is refused with "must decode to an array"; nested, it failsarray, passesobject, and stays one variadic argument.int,float(accepts int),string,bool,array,iterable,scalar,true,false,null,mixed,objector a class name. A null must be allowed.422 invalid_query_arguments, with "Workflow query [] argument validation failed." andvalidation_errorsby argument.query_default_unencodable, naming the parameter.Before this change native:
invalid_query_arguments;unsupported_query_contract;Native now:
query_contract.rs;check_query_contract;query_attempt;codec::OrderedValue). PHP spreads a variadic named map's values in wire order, and Apache's generic reader keeps maps in a hash map.codec/wire_order.rsreads the datum that the public reader has already validated a second time, through a private binding schema. That schema spells the map as an array of{key, value}records, as PHP'sValueDatumWriterdoes: the same bytes, and Apache still owns every primitive and block. Writing goes through the same binding, under the public header, and the result is checked again by the public reader.Kept, and documented in the checkpoint:
callablematches nothing. Neither map adapter is invokable, and PHP'sis_callablealso accepts strings naming functions, which a native server cannot resolve.{"1":"a","0":"b"}is a list on native, where PHP fails to encode it.Contract
The new
query-contract-argumentsfixture runs over raw HTTP on protocol 1.20 in a fresh namespace. The worker declaresstate(string $prefix),greet(string $prefix = 'dflt')andplain. Twenty-two cases are recorded against published 2.11.5:state,greetwith nothing (default filled), namedgreet, and a list toplain.plain.{"0":"ok"}and a mixed-key map are refused as not arrays. A nested empty map is refused byarr(array), but routed whole byobj(object)and the variadicrest(mixed ...).{value: {z: 20, a: 10}}reachesrestas[20, 10].{"0":"x","1":"y"}reaches the worker as[["x","y"]].{"0":"x","k":"y"}and{"1":"x"}answer 500; the contract pins only that status, since PHP's body is the generic "Server Error".Embedded applications have no worker protocol, so the case is explicitly inapplicable there. Contract:
query-contract-arguments-contract.mjs. Its unit test is registered inserver-parity.yml. The port log's open "Named and validated query arguments" entry from #849 is closed.Verification (run locally on the Rust dev host)
cargo test --test execution: 623 passed, 1 failed. The failure isupdates_have_no_lifetime_cap_and_preserve_accepted_work_after_wait_timeout, which ran while an image build loaded the host. It lacks a worker heartbeat and outlasts the staleness window under load; Rust #325: accept completions and parallel groups over 100 #851 fixes the test. It passes alone and does not use the changed code.cargo test --lib: 358 passed, including round trips of 7 published blobs byte for byte, a repeated-key test and the default-shape test.query_contract_arguments.rs(normalized routing; refusals with messages) fails on Rust #325: route query arguments the server cannot decode #849's source.query_contract.rsunit tests cover the type rules and integer-keyed maps. The existing query tests pass (32).Checkpoint:
docs/rust-server-port-checkpoints/2026-10-28-query-contract-arguments.md.🤖 Generated with Claude Code