Open
Conversation
Replace manual precedent/successor ordering logic in add_repo() with pipeweld's Adder algorithm. This uses the Series-Parallel graph model to determine the correct insertion position based on prerequisites and postrequisites derived from _HOOK_ORDER. Add _get_predecessor_from_solution() and _linearize() helper functions to extract a linear hook ordering from pipeweld's solution pipeline. Within parallel groups, existing hooks maintain their original order and the new hook is placed after them. Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/babc26ed-68ad-44e8-8a8c-00c72d32ddba Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/babc26ed-68ad-44e8-8a8c-00c72d32ddba Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix handling of pre-commit repos using pipeweld
Use pipeweld to insert pre-commit hooks
Mar 27, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
|
@copilot static checks are failing |
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/a1927db8-7b00-4ea4-b7a8-23c4626ad979 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Contributor
Author
nathanjmcdougall
requested changes
Mar 29, 2026
…linear setting Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/17dc4709-1485-40c9-916d-b68f146ec22f Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/17dc4709-1485-40c9-916d-b68f146ec22f Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.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.
Hook insertion in
add_repo()used hand-rolled precedent/successor logic against a static_HOOK_ORDERlist. This replaces it with pipeweld'sAdder, which models the same ordering constraints as a series-parallel graph — laying groundwork for repo-aware insertion and prek priority support.Changes
func.py—Adder: Addedforce_linearsetting that post-processes the solution to flatten anyParallelnodes into a deterministic linearSeries. Added_extract_ordered_steps()and_linearize_component()helpers internal to the pipeweld layer.hooks.py—add_repo(): Build aSeriespipeline from existing hook IDs, deriveprerequisites/postrequisitessets from_HOOK_ORDER, and delegate insertion positioning toAdder.add()withforce_linear=True. The predecessor is read directly from the flat solution.test_func.py: Unit tests for_extract_ordered_steps,_linearize_component, andAdderwithforce_linear=True(16 new tests)test_hooks.py: Integration tests exercising pipeweld-based insertion (prerequisite present, postrequisite only, mixed non-dependent/postrequisite)Before/After
All existing tests pass unchanged — behavioral compatibility is preserved for current hook orderings.
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.