prompt_bundle: key the extracted tree on the bundle content - #467
Open
ftabba wants to merge 1 commit into
Open
Conversation
The extraction root was named by third_party/prompts/REVISION, which records the upstream revision the bundle was copied from. A local edit to a vendored prompt does not bump it, so an install with a persistent HOME keeps serving the tree extracted before the edit until someone passes --force. build.rs now hashes the bundle itself: for each file in sorted order, the relative path, a NUL, the length as a little-endian u64, and the bytes. The result is emitted as PROMPT_BUNDLE_DIGEST and names the extraction root, so any change to the bundle extracts to a new tree. REVISION keeps its other two jobs, the upstream pin and the content of the marker an extracted tree carries to record where it came from. Each distinct bundle content now leaves its own tree under sashiko/prompts, and nothing removes the older ones. A retention policy over that directory is a separate change. sha2 is added as a build-dependency at the version already in dependencies, so Cargo.lock does not move. Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
ftabba
force-pushed
the
pr/prompt-bundle-content-key
branch
from
September 6, 2026 17:39
aba1a95 to
9228fcf
Compare
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
prompt_bundle_root()names the extracted prompt tree afterthird_party/prompts/REVISION, which records the upstream revision the bundlewas vendored from. Editing a vendored prompt does not move it, and
install_prompt_bundle()returns early whenever the completion marker insidethat tree exists, so a rebuild after a prompt edit keeps serving the tree
extracted before the edit. Anyone iterating on the prompts hits this until they
remember
--force.This keys the root on a sha256 over the bundle content instead, computed in
build.rsand emitted asPROMPT_BUNDLE_DIGEST.REVISIONkeeps its other twojobs, the upstream pin and the content of the marker file an extracted tree
carries.
One open question
Keying on content means each distinct bundle leaves its own tree under
$XDG_DATA_HOME/sashiko/prompts/, and nothing removes the older ones. Theyaccumulate fastest for the workflow this fixes, someone editing a prompt and
rebuilding. I have not picked a retention policy because I am not sure which one
you would want: drop anything that is not current, keep the last N, or prune only
on an explicit
init --prompts. Happy to add whichever you prefer, here or as afollow-up.
Testing
make check-prpasses, with the exception of yamllint, which is not installed onthis machine. This change touches no YAML.
One new test recomputes the hash over
PROMPT_BUNDLE_FILESand asserts itmatches the generated
PROMPT_BUNDLE_DIGEST. The existing root test now assertsthe root is named by the digest. End to end, editing a vendored prompt with
REVISIONuntouched changes the digest, and restoring the file changes it back.