I second the ideas in this post.
Here's my recommendation, as a software engineer and also a user of accounting software:
Brew log:
At the start of brewing a recipe, the brew log gets a copy of that recipe. Session data you capture gets attached to that log copy. The ingredients in that log copy become a permanent part of the inventory history. You can edit the brew log recipe independently of the "master" recipe from which it was copied, in order to make corrections from what you planned to do on brew day vs. what you actually did. You can use the same feature before you start brewing, in order to make substitutions (because you don't have Perle hops on hand...) for this brew, without changing the master recipe.
Inventory history:
Instead of there being "an inventory" that is simply a database of what you have on hand, the inventory is a history of additions and removals. Current inventory is the sum of all additions minus the sum of all removals. You can edit the history if needed, to correct it, and also to establish the "initial balance' of each inventory item. Brew log recipes are part of the history of removals. Inventory addition transactions can record things like "On this date, I added 55lb of Marris Otter pale malt, 1lb of Centennial hops, etc. Because of the history, it's possible to see what your inventory was at any time, not just what it is now. And all history entries are editable, so you can correct mistakes ("I forgot I also bought 5lb flaked maize that day...").
This approach also gives, for free, the ability to make substitutions that apply to this brewing session, while not changing the master recipe, in cases where you're not wanting to evolve the recipe, you're just wanting to brew something close to it using what you have on hand.