Repository navigation
fix(get_prototype_recipe): return crafting time, category and enabled state - #435
Open
hashbender wants to merge 1 commit into
Open
hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
… state serialize_recipe already sends energy, category and enabled, but the client built Recipe(name, ingredients, products) only, so every recipe came back as energy=0, category=None, enabled=False. The category is what says which machine makes a recipe (e.g. engine-unit is advanced-crafting, so it cannot be hand-crafted), and the manual promises "crafting time and category". Pass the three fields through. Tests: server-free unit tests with a stubbed reply, and a server test for iron-gear-wheel and engine-unit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
storage.utils.serialize_recipealready returns each recipe'senergy,categoryandenabled. The client drops all three:So every recipe comes back as
energy=0,category=None,enabled=False, which are the model's defaults. The manual promises "Additional metadata like crafting time and category". The category is the only field that says which machine makes a recipe:smeltingmeans a furnace;advanced-crafting(for exampleengine-unit) can't be hand-crafted;chemistrymeans a chemical plant.Without it, an agent can't tell any of this from the tool.
enabledis the only way to see whether a recipe is unlocked.Reported as item 9 of #418.
Fix
Pass
energy,categoryandenabledfrom the reply intoRecipe(...). TheRecipemodel already has these fields, so nothing else changes.Testing
tests/unit/test_get_prototype_recipe_fields.py(server-free, 2 tests): stubsexecutewith the reply shapeserialize_recipeproduces (numbers as strings) and checks the three fields. Both fail onmainand pass here.tests/unitpasses (6 tests).test_get_recipe_time_category_and_enabledintests/actions/test_get_prototype_recipe.py: iron-gear-wheel is 0.5 s /crafting/ enabled, and engine-unit is 10 s /advanced-crafting(from the 2.0.73recipe.lua). It needs a server; I haven't run it.🤖 Generated with Claude Code