lightningrodlabs / rea-playspace

Holochain app to play with REA accounting
32 stars 7 forks source link

Bug: Consume not decrementing in some cases #185

Closed fosterlynn closed 2 years ago

fosterlynn commented 2 years ago

Note: This test was not set up quite properly, and I haven't been able to re-test due to the reticulating splines issue. I'm filing it because I don't know when a release will be cut, and it may indicate something that needs attention. Possibly something about re-calculating current quantities from events? If it doesn't need attention or you just want to wait until I can re-test it, feel free to just close this.

Here is the context. Note on the left side, Bob's Bakery got some red fife flour directly transferred in. Bob's Bakery also got some butter transferred in, but also shipped. (The error in the test case is that the transfer should have been transferAllRights. Screenshot from 2022-10-30 10-24-08

Here is the resource list before those inputs got recorded (quite a bit earlier, sorry - but I do know that it said 20 after both the transfer and the dropoff). Screenshot from 2022-10-30 06-59-44

Here is the list after those inputs got recorded. Screenshot from 2022-10-30 10-23-19

The problem is that the flour decremented properly, but the butter did not decrement.

adaburrows commented 2 years ago

That's a fun bug. I have an idea of what's going on, but we're both not going to like that it takes implementing the full graph to fix it or ensuring everything is using fully implemented EconomicResources. It's entirely possible that this model end up creating a new virtual resource that is consumed during producing a pie, instead of decrementing the existing resource. I'd actually have to know exactly how everything was inventoried in order to reproduce this problem.

Basically, if the the transfer wasn't inventoried as a specific resource or the consume wasn't told to use a specific inventoried resource, then it probably took those 2 cups as an implicit transfer from Bob's Bakery and didn't use the existing resource, but rather assumed it was coming from "out of network".

This is another reason for making sure we have a distinction between ResourceSpecifications and specific EconomicResources in our visual language.

Let's check back in on it after #177 and #182 are done.

fosterlynn commented 2 years ago

Ack! Looks like user error! (which is a good thing, actually, one less confusing bug to fix)

I certainly meant to consume an actual resource on the butter, but it isn't in the record, so I probably botched it.

I'll try it again and double check, then close this.

(In the future, it will know the resource already, that is also good.)

fosterlynn commented 2 years ago

Yay, this was my fault, worked when I tried it again! Sorry for the mistake!