Repository navigation
Run hooks from entangled.toml when there are multiple files - #110
Merged
Merged
Conversation
Document started with a default Context, and setting its config did not create the hooks enabled there. With a single input file the context was replaced while loading, but with more files on_tangle only ran for the default hooks, so e.g. REPL session files were not written and then deleted as orphans. Co-Authored-By: Claude Opus 5.5 <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
In a project with more than one Markdown file, hooks enabled in
entangled.tomlnever ranon_tangle. For example, thereplhook never wrote its session file, andentangled syncthen deleted the file as an orphan. Thebreiandbuildhooks were affected the same way.The cause:
Documentstarts with a defaultContext, whose hooks are onlyshebang.__post_init__sets the config fromentangled.tomlthrough theconfigsetter, which changedcontext.configwithout creating the hooks that config enables.load()replaces the context, which hid the problem.tangle()runson_tangleon the document's own hooks.The setter now builds a new
Context. That creates the hooks for the new config and shares their state with the hooks used while reading.Tests
test_session_with_multiple_filestangles two pages, one with a REPL session, and checks the session file. It fails without the fix.🤖 Generated with Claude Code