Skip to content

docs(query-language): add normative Query Evaluation Semantics#585

Open
aorzelskiGH wants to merge 1 commit intoIDTA-01002-3-2_workingfrom
docs/query-evaluation-semantics
Open

docs(query-language): add normative Query Evaluation Semantics#585
aorzelskiGH wants to merge 1 commit intoIDTA-01002-3-2_workingfrom
docs/query-evaluation-semantics

Conversation

@aorzelskiGH
Copy link
Copy Markdown
Contributor

Summary

Add a normative "Query Evaluation Semantics" clause to query-language.adoc so that parse, field resolution, casting, list handling and interaction with Access Rules (IDTA-01004) behave deterministically across implementations.

Problem

The query language currently leaves several runtime questions implicit:

  • what happens when a FieldIdentifier does not resolve on a candidate?
  • what is the HTTP mapping of a parse error vs. an unsupported operator combination?
  • how do queries behave on a profile that does not expose a given FieldIdentifier prefix?
  • what is the interaction with access rules that are "not applicable" for a candidate?

Implementations disagree (some 500, some 200/empty, some 400), which blocks interoperability and conformance testing.

Solution

Introduce a new section Query Evaluation Semantics (normative) just before the JSON Schema clause. It specifies:

  • parse errors => 400 Bad Request; unsupported combinations => 422 Unprocessable Entity;
  • unresolved FieldIdentifier on a candidate excludes the candidate without raising an error;
  • non-applicable prefix (per the profile applicability table added in docs(profiles): add FieldIdentifier applicability table per profile #584) behaves like "field not present";
  • list-valued FieldIdentifiers use existential (any-element) matching unless an index is provided;
  • casting errors exclude the candidate;
  • when Access Rules are enforced (IDTA-01004), "not applicable" rules do not fail the query.

Affected files

  • documentation/IDTA-01002-3/modules/ROOT/pages/query-language.adoc

Review notes

  • Paired Security PR admin-shell-io/aas-specs-security#... adds the equivalent Evaluation Semantics section for the Access Rule Model and mirrors the error-handling conventions.
  • No grammar or schema changes.

Refs: Review Finding T-15

Specify how AAS queries MUST be evaluated, covering:

- parse and schema validation (400 / 422 mapping),
- behaviour of FieldIdentifiers that do not resolve on the target
  (candidate excluded, no error),
- behaviour under profile restrictions (non-applicable prefix is
  treated like "field not present"),
- semantics of list-valued FieldIdentifiers (existential match),
- behaviour on casting errors (candidate excluded, query stays green),
- interaction with Access Rules (IDTA-01004): applicable ALLOW rules
  filter the candidate set; "not applicable" rules do not fail the
  query.

Refs: Review Finding T-15
Made-with: Cursor
=== Evaluation of FieldIdentifiers

* A FieldIdentifier that does not resolve to any value on a candidate object (because the field does not exist on that target) produces *no comparison match*: the candidate is excluded from the result set. This MUST NOT raise an error.
* A FieldIdentifier that is not applicable for the active profile (see xref:http-rest-api/service-specifications-and-profiles.adoc#fieldidentifier-applicability[FieldIdentifier Applicability per Profile]) is treated like "field does not exist": the candidate is excluded, no error is raised.
=== Casting Errors

* An explicit cast that fails on the current candidate (e.g. `num("abc")`) MUST exclude the candidate from the result set; it MUST NOT fail the whole query.
* Implicit casts between the types listed in clause xref:_casting[] follow the same rule.

=== Combination with Access Rules

When a query is evaluated by a service that also enforces Access Rules (see IDTA-01004), the query's candidate set MUST be filtered through the applicable access rules before being returned. Access rules that evaluate to `not applicable` for a candidate (e.g. because a referenced FieldIdentifier does not exist in the current profile) MUST NOT cause the query to fail; such rules simply do not contribute an ALLOW for the candidate.
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