AToMPM / AToMPM/atompm

Overlapping matches aren't handled correctly

Open
#113 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
25
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## ISSUE
When running a rule that has overlapping matches as an FRule the frontend doesn't produce an error, making it look as if all is well. However, the transformation engine raises following exception:

```
Exception in thread Thread-18:
Traceback (most recent call last):
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\messages.py", line 241, in to_label_mapping
sourceNode = source_graph.get_node(self[label])
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\core\himesis.py", line 135, in get_node
raise KeyError('Node not found with specified id. Make sure to only create nodes via Himesis.add_node(): ' + str(guid))
KeyError: 'Node not found with specified id. Make sure to only create nodes via Himesis.add_node(): 1ce09e75-0052-4ece-89d0-acefa03f5ab0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Andrei\Downloads\atompm-portable\platform\WinPython\WPy32-3830\python-3.8.3\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\mtworker.py", line 26, in run
self._onmsg(self._msg)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\mtworker.py", line 217, in _onmessage
getattr(self._ptcal,mode.lower())()
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 986, in step
self._doWhenLastStepFeedbackReceived(self._step)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 169, in _doWhenLastStepFeedbackReceived
utils.doWhen(
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\utils.py", line 20, in doWhen
callback()
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 1089, in _step
(res,ai) = runRule(nr)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 1005, in runRule
self.packet = ar.packet_in(self.packet)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\rules\frule.py", line 42, in packet_in
packet = self.W.packet_in(packet)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\rewriter.py", line 46, in packet_in
mapping = match.to_label_mapping(packet.graph)
File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\messages.py", line 243, in to_label_mapping
raise Exception('The matched node %s does not exist' % label)
Exception: The matched node 2 does not exist
```

I think this should be handled by the pytcore's resolver?

## HOW TO REPRODUCE?

Reproduce using following example:

Create a rule that looks as follows:

![image](https://user-images.githubusercontent.com/8046595/104423700-b5d7ef80-557e-11eb-8045-15c5469cffeb.png)

Schedule it as an FRule:

![image](https://user-images.githubusercontent.com/8046595/104423869-ec156f00-557e-11eb-9f92-a755e445de65.png)

Apply the schedule to a model that has overlapping matches for aforementioned rule:

![image](https://user-images.githubusercontent.com/8046595/104423982-08b1a700-557f-11eb-9df5-3ebfa33c3091.png)

Observe as the rule is applied without producing an error in the frontend.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the overlapping-match FRule scenario, then trace the failure through mt/ptcal/pytcore/tcore/messages.py, tcore/rewriter.py, rules/frule.py, and mt/ptcal/ptcal.py. Compare the transformation-engine exception with the frontend's current handling; done means the invalid overlapping-match result is surfaced as an error rather than appearing successful.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.