-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
PR Review ChecklistDo not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed. Trivial Change
Code
Architecture
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic integration tests would benefit from being rewritten in a more clear way. Other than that, could do with some architectural changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The architecture seems solid, but there is still work to do before this can be merged.
tests/behaviour/util.rs
Outdated
.trim_end_matches(['}', ';', ' ']) | ||
.trim_start_matches("{") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the trimming here? Seems to leak the TypeQL internals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can almost remove trimming if we construct and parse the whole rule:
let rule = parse_rule(
format!(
"rule {}: when {} then {}",
answer_identifiers.get("label").unwrap(),
answer_identifiers.get("when").unwrap().trim_end_matches(";"),
answer_identifiers.get("then").unwrap(),
)
.as_str(),
)
.unwrap();
let RuleDefinition { label, when, then } = rule;
label.name == answer.label && when == answer.when && then == answer.then
Is it possible to parse it without trimming at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse_pattern
or parse_patterns
, depending on whether the then
has a trailing semicolon, should be able to parse the then
into a conjunction contatining a single variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse_patterns
works, trimming has been removed.
Co-authored-by: Dmitrii Ubskii <[email protected]>
Co-authored-by: Dmitrii Ubskii <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final polish, I expect, then you can pass it to Josh! I'd suggest running cargo clippy
so that it can catch the little things I may have missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only 1 major request! Good stuff guys!
|
||
impl IntoProto<RuleProto> for Rule { | ||
fn into_proto(self) -> RuleProto { | ||
let Self { label, when, then } = self; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the next piece of work can you introduce 'Label' to be sibling of 'ScopedLabel'? Then we can replace these usages of string labels with an actual Label struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!! Good job
What is the goal of this PR?
We implement
LogicManager
,Explanation
and corresponding tests.What are the changes implemented in this PR?
We implemented:
Rule
struct andLogicManager
(with BDD steps)Explanation
,Explainable
andExplainables
structs and addedexplainables
field toConceptMap
(with integration tests)