Merged
Conversation
Each recipe now records a 16-char hex hash of the prompt templates used to generate it. This enables comparing recipe quality across prompt versions and knowing which recipes used old vs new prompts. Changes: - Add PromptVersion() hash function in config/prompts.go - Add PromptVersion field to Recipe model (optional, GORM auto-migrates) - Add PromptVersion to RecipeResult in ai/provider.go - Stamp prompt version in all 5 Anthropic recipe methods - Flow prompt version through service layer (chat, regen, fork, import) - Update extractFromURL and createImportedRecipe signatures - Update repository UpdateRecipeDef to persist PromptVersion - Fix all test call sites for updated signatures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 609381b3df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PromptVersion now hashes only RecipePrompts instead of the entire Prompts struct, so unrelated prompt changes (voice, allergen, etc.) no longer rotate the recipe version stamp. Canonical records now store and forward prompt_version so cache-hit imports retain the version from the original extraction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep middleware wrapping from main (R5) and add PromptVersion stamping from prompt-versioning (R10) inside each runWithMiddleware closure. Applies to all 5 recipe-generating methods: GenerateRecipe, RegenerateRecipe, ForkRecipe, ExtractRecipeFromText, ExtractRecipeFromImage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
PromptVersionfield to theRecipemodel that stores a 16-char SHA-256 hash of the prompt templates used to generate the recipeGenerateRecipe,RegenerateRecipe,ForkRecipe,ExtractRecipeFromText,ExtractRecipeFromImage)PromptVersionnow hashes onlyRecipePromptsinstead of the entirePromptsstruct, so unrelated prompt changes (voice, allergen, interview) no longer rotate the version stampprompt_versionand forward it on cache hits, so imports of previously-extracted URLs retain the original extraction's version metadataHow it works
config.PromptVersion()serializesprompts.Recipeto JSON and computes a SHA-256 hash, returning the first 16 hex charactersCanonicalRecipemodel now includesPromptVersion, persisted on upsert and forwarded on cache-hit imports (ImportFromURL,ImportFromCanonical,PreviewFromURL)omitemptywith GORMsize:16, so existing recipes are unaffected and no migration is neededTest plan
go test ./...)extractFromURL(5 return values) andcreateImportedRecipe(8 params)PromptVersionis populated on a newly generated recipePromptVersionis empty for manually entered recipesprompts.yamlcontent produces different hashes🤖 Generated with Claude Code