Stop recipe_update reporting photos and topics as lost - #501
Merged
Conversation
Editing a recipe through the tool answered with `photos: []` and a
`topics: []`, and the model read both as data loss - it told the user
its edit had probably dropped three photos and every topic tag. Neither
had been touched.
The photo list was a literal. recipe_update never sets the photo set, so
the RPC inherits the previous version's links onto the new version, and
the tool asserted an empty array instead of looking. It now reads the
post-write link set back the same way recipe_get does; the shared read
moved into _recipe_helpers.ts so the two answer photo questions
identically. The header comment justifying the shortcut ("the photo
tools aren't ported for v1") had outlived the port.
The topics array was true but meaningless. Any content edit fires the
re-queue trigger, which empties the column so the curation unit re-tags
the recipe, and the RPC reads the row back after that trigger runs - so
the field is always empty on this path, whatever the recipe was tagged
with a second earlier and will be tagged with again within the hour. It
is bookkeeping, not the recipe's tags, so the tool strips it rather than
echoing a number that can only mislead. recipe_save's `photos: []` is a
different case and stays honest: a create links no images.
The user doc gained the missing consequence - an edited recipe really
does sit under "untagged" until the worker's next sweep - and the dev
doc's file list, which pointed at browser-side tool paths that have been
schema-only since the function port, now points where the code is.
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.
SYNOPSIS
recipe_updateanswered every edit with an empty photo list and anempty topic list. Neither was true. It now reads the photo set back
and drops the topics field.
PURPOSE
A recipe edit through the tool came back reporting zero photos and
zero topics, so the model warned the user its edit had probably
dropped three photos and every tag. Nothing had been dropped - the
photos were still on the recipe, and the tags came back on their own 43
minutes later.
The cost is trust in the edit path. A tool that cries data-loss on a
clean write teaches the user to distrust every edit, and teaches the
model to hedge every confirmation.
DESCRIPTION
How it behaved. Two fields, two different failure modes.
recipe_updatenever sets the photo set, so it passesp_set_image_ids: falseand the RPC inherits the previousversion's links onto the new version. The tool then returned
photos: []as a literal, never looking at what it had carriedforward. A header comment justified this ("the recipe-photo
manipulation tools aren't ported for v1") - the port landed, the
comment didn't move.
clear_recipe_topics_on_changetrigger emptiesthe column on any content edit, which is how the recipe-topics
curation unit knows to re-tag the row. The RPC's
return queryreads the row back after that trigger fires, so the field was
structurally always
[]on this path.What changes.
asserting a shape. The "newest version's links" query moved out of
recipe_getinto_recipe_helpers.ts::readRecipePhotoMeta, so bothtools answer photo questions from one read and can't drift.
bookkeeping, not the recipe's tags, and the only number it can ever
carry is a misleading zero.
recipe_getis the read-back path oncethe unit has caught up.
recipe's current photo list and that this tool never edits it.
tests/recipe_update.test.ts, 6x cases: photos reported +position-sorted, topics absent, empty and no-version-row branches,
p_set_image_idsstill false, and the empty-patch rejection.How that closes it. The response now describes state the tool
actually read, so a clean edit reads as a clean edit.
Notes for reviewers:
recipe_save'sphotos: []is deliberately left alone. A createpasses
p_image_ids: null, so the recipe genuinely has no photos yettopicsfrom the response is an intentional shapechange, not an oversight. Adding it back only re-arms the false alarm.
only the reporting of it changed.
docs/dev/cookbook.md's file list pointed atsrc/lib/tools/recipe_*.ts,which have been schema-only since the function-side port, and at a
notifyCookbookChanged()contract that no longer exists. Bothcorrected while in the area.
docs/user/cookbook.mdgains the missing consequence: an editedrecipe really does sit under untagged until the hourly sweep.
Generated by Claude Code