add recipes to source packaging tests to avoid undesired transmutation #617
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I figured out why tests in #613 failed. After playing with it a bit, I kept getting results where the number of packaged resources was twice the number of transactions, which didn't make sense (every packaged resource should only be packaged in order to fulfill one transaction).
Then I realized that my tests didn't include an outrecipe, and the Mock Sink in the Mock Sim was for some reason requesting a different mock composition. So, immediately before trading, the Source transmuted the composition to the request composition, which creates a new line in the resource table, because the composition id (QualId I think) changed.
This is exactly the kind of extra and confusing resource database entries I mentioned above!
However, I still think it makes sense that resource should only be transmuted after they are packaged and ready to go, because we don't want to do transmuting until we're sure that the packaging will work. Which it normally will, but this keeps coming back to the challenge of requesting agents accepting partial-sized bids, which creates the chance of a failed trade by being an unpackagable amount.
In this case, I solved the issue by creating an outrecipe in my tests.