Closed stuhlmueller closed 6 years ago
Here's a minimal example for reproducing the None
:
Start: python3.6 -m patchwork.main new.db
What is your root question?
> what is the sum of list [[6] []]<Enter>
#
What is your root question?
> what is the sum of list [[6] []]
Question: [$1: what is the sum of list $3]
Scratchpad: [$2: ]
Subquestions:
> unlock $3<Enter>
#
Question: [$1: what is the sum of list [$3: $4 [$2: ]]]
Scratchpad: [$2: ]
Subquestions:
> reply 6<Enter>
#
The initial context was:
Question: [$1: what is the sum of list $3]
Scratchpad: [$2: ]
Subquestions:
The final answer is:
[6]
Restart 1
What is your root question?
> what is the sum of list [[6] []]<Enter>
#
What is your root question?
> what is the sum of list [[6] []]
That question has already been answered:
[6]
Restart 2
What is your root question?
> what is the sum of list [[6] [[7] []]]<Enter>
#
What is your root question?
> what is the sum of list [[6] [[7] []]]
None
> ask Why None?
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/erle/repos/patchwork/patchwork/main.py", line 37, in <module>
main(sys.argv)
File "/home/erle/repos/patchwork/patchwork/main.py", line 30, in main
ui.cmdloop()
File "/usr/lib/python3.6/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python3.6/cmd.py", line 217, in onecmd
return func(arg)
File "/home/erle/repos/patchwork/patchwork/interface.py", line 60, in do_ask
return self._do("ask", AskSubquestion(arg))
File "/home/erle/repos/patchwork/patchwork/interface.py", line 40, in _do
result = self.session.act(action)
File "/home/erle/repos/patchwork/patchwork/scheduling.py", line 239, in act
resulting_context = self.sched.resolve_action(self.current_context, action)
File "/home/erle/repos/patchwork/patchwork/scheduling.py", line 142, in resolve_action
assert starting_context in self.active_contexts
AssertionError
Restart 1 is probably not necessary for reproducing the failure. The last query was just to see what happens.
Of course it would be tedious to type those commands over and over again during debugging. So here's a stupid-but-useful driver script that does the typing for us: https://gist.github.com/rmoehn/76ad05167f5e41197803f5fd5e6caac7
This unittest
test might be even more useful than the driver.
That's it from me for today.
Example:
I'm attaching the zipped store.
store.db.zip