Skip to content

Conversation

@krishnangovindraj
Copy link
Member

@krishnangovindraj krishnangovindraj commented Sep 23, 2025

Usage and product changes

Adds test for the query structure and annotations returned by the analyze endpoint


Scenario: Errors in the query are returned as errors
Given connection open read transaction for database: typedb
When typeql analyze query; parsing fails
Copy link
Member

Choose a reason for hiding this comment

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

I think Cole's commentary is reflecting something accurate: analyze() shouldn't throw an error, but it should return an error. I think we do unify this in the service layer anyway right? So this could be generically "fails with message containing..."?

Comment on lines +273 to +274
[thing([person])],
stream([thing([name])]),
Copy link
Member

Choose a reason for hiding this comment

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

looks gud

Copy link
Member

Choose a reason for hiding this comment

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

if we introduce polymorphic/inferred function argument annotations this will also work nicely

"""
{
name: [string],
ref: [integer]
Copy link
Member

Choose a reason for hiding this comment

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

Im guessing these are all representing optionals right? Eg could be name-string or missing

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that's still a list of types. I haven't actually considered optionals because type-inference doesn't either.
It's not even returned by the analyze endpoint.

"""
Pipeline([
Match([
Isa($p, person),
Copy link
Member

Choose a reason for hiding this comment

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

It would match the 'Annotations' to call this 'Trunk' (though my other comment suggests "And" or "Constraints" or "Statements"!)

Copy link
Member Author

Choose a reason for hiding this comment

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

We encode Or, Not, Try as constraints, so here we don't need that.

Copy link
Member

@flyingsilverfin flyingsilverfin left a comment

Choose a reason for hiding this comment

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

Approved, but please do check the 1 naming change before merging anything!

@krishnangovindraj krishnangovindraj changed the title Add query structure BDD Add analyze BDD Oct 21, 2025
@krishnangovindraj krishnangovindraj merged commit 9376d69 into typedb:master Oct 21, 2025
1 check passed
krishnangovindraj added a commit to typedb/typedb that referenced this pull request Oct 21, 2025
## Product change and motivation
Tests the query structure returned by the analyze endpoint (and used by studios' graph visualizer)

## Implementation
* Implements steps & functor encoding used in typedb/typedb-behaviour#381
* Small fixes around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants