Repository navigation
feat(verify): bind the in parameters of a constraint or requirement at check time - #1036
Conversation
…t check time VerifyConstraint and VerifyRequirement take positional and named arguments, as RunAnalysis binds a case's inputs, under the verification_arguments capability. The runtime binds them in declaration order or by name and leaves the verdict undecided on an unknown name, an arity overrun, a parameter with neither an argument, a default nor a same-named value on the checked object, or a value of the wrong type; holds and satisfiable refuse arguments. The CLI and REPL accept the invocation grammar -analysis uses (-requirement 'P::R(limit = 5) P::t', %constraint C(3.0) t), and every client binds through the same option. Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Recorded runtime testing of verification arguments on 645df3d (CLI, interactive REPL, Python over gRPC). CLI, REPL, and Python/gRPC verification
Compatibility and diagnostic observationsBinaries built from the parent commit 83a7824 matched four no-argument default/fallback cases: CLI output and status were byte-identical, and Python verdict/error fields matched with bindings omitted or explicitly empty. CLI/REPL decimal literals report Not exercised: Connect over HTTP and the non-Python wrappers beyond their unit and integration suites. |
…thon stub at the pinned grpcio-tools version Co-Authored-By: jason.han <hanhuijun@gmail.com>
…binding check arguments; never share verdicts of checks with arguments Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
What and why
A
constraint deforrequirement defmay declareinparameters its condition reads (requirement def Under { subject s : Thing; in limit : Integer; require constraint { s.v < limit } }). Until now only a verification case could supply them, throughRunAnalysis'sarguments/named_arguments; asking the requirement directly left the parameter unbound and the condition failed over an empty value with a misleading type error. Workflows that gate a step on a requirement about the run's own values (a stereo pair's acquisition ids, a pod's thread count) had to wrap every such requirement in a case.VerifyConstraintandVerifyRequirementnow take the same bindingsRunAnalysisdoes:Context.CheckConstraintWith/CheckRequirementWith(sym, scope, self, CheckArgs{Positional, Named})bind the element'sinparameters (inherited and redeclared ones included) positionally in declaration order or by name, and type-check each value against the parameter. The verdict is undecided, naming the fault, on a name no parameter has, more positional values than open parameters, a parameter left with neither an argument, a default nor a same-named value on the checked object (the existing fallback a constraint usage on a part relies on), or a value of the wrong type. A bareinparameter is required; one declared[0..1]may go unbound. The oldCheckConstraintOn/CheckRequirementOnremain as the no-argument form.VerifyConstraintRequestandVerifyRequirementRequestgainrepeated Value arguments = 6andmap<string, Value> named_arguments = 7, advertised by the newverification_argumentscapability. A request without bindings never needs the capability. Only the evaluate question takes bindings:holdsandsatisfiablewith any argument areINVALID_ARGUMENT, since the solver decides the parameters' values there.-requirement 'P::R(limit = 5) P::t',-constraint 'P::C(3.0)',%requirement R(limit = 5) t,%constraint C(3.0, high = 9): the invocation grammar-analysis/%analysisalready use. Usage text and manual pages updated.VerifyArguments(...),VerifyArgument(name, v)), Python (arguments=,named_arguments=), Node (VerifyOptions.arguments/namedArguments), Java (VerifyOptions.withArguments/withNamedArguments), Rust (VerifyOptions { arguments, named_arguments, .. }), Julia (arguments=,named_arguments=), MATLAB (arguments,namedArguments). Each requiresverification_argumentsonly when it binds something; the service'sINVALID_ARGUMENTon a symbolic question with arguments surfaces through every client's usual status mapping.The requirement path also fixes a package-level
requirement defwith an explicitsubjectnot receiving the object a check supplies for it.Specification basis
KerML 1.0 §7.4.9 / SysML v2 1.0 §7.18 (constraint and requirement definitions are predicates whose
inparameters are bound at evaluation); no row ofdocs/project/spec-compliance.mdmoves — this widens the API over an already-implemented rule.How it was verified
internal/exec/runtime/check_args_test.go: named, positional and mixed bindings, defaults,[0..1]optionality, unknown name, arity, missing required, type mismatch, subject + arguments, requirement usage on a bound subject, and the existingTestUnboundParameterFallsBackToInstanceFeatureValuestill passing.internal/frontend/grpc/verify_arguments_test.goandrobustness_verify_arguments_test.go(TestGRPCRobustnessVerifyArguments): service paths, capability refusal, proof-question refusal.internal/frontend/repl/check_args_test.go) and CLI (cmd/sysml/check_test.go) argument grammar incl. malformed lists.client/opensysml), Python (tests/test_verification_arguments.py), Node (test/verify.test.ts), Java (ApiIntegrationTest), Julia (extended_client.jl), MATLAB live tests, Rust library tests.go build ./...,go vet ./...,gofmt -l .(empty),go test ./...all pass;make man-check,python3 scripts/changelog.py check,python3 scripts/check-doc-ids.pyclean.Checklist
make testandmake lintpass locallychanges/unreleased/verify-arguments.added.mdmake docs-countsrun if a gate count moved — no gate count movedLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/4b750d3541e349aea211b5a469cfe882
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/4b750d3541e349aea211b5a469cfe882?variant=devin
Requested by: @HuiJun