fix(sync): run pre_sync before source discovery - #72
Open
srnnkls wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to hook ordering, is consistent with documented behavior, and is covered by targeted new regression tests.
Pull request overview
This PR changes sync execution order so the existing global pre_sync hook runs before source parsing/resolution and discovery, enabling hooks to generate local source directories/files that can be deployed in the same sync. It also documents the new hook ordering and adds regression tests covering both the “generated source” and “failed pre_sync aborts early” cases.
Changes:
- Run global
pre_syncimmediately after config merge/validation and abort early on failure (preserving existing locks and skipping recovery/deploy/prune). - Add tests ensuring
pre_synccan generate a local link-deployed source before capture/discovery and that a failingpre_syncaborts before missing-source resolution. - Update README hook documentation to describe
pre_syncordering and failure semantics.
File summaries
| File | Description |
|---|---|
src/sync/mod.rs |
Moves pre_sync execution earlier in sync_core and returns early on hook failure before any source resolution or recovery/deploy phases. |
src/sync/tests.rs |
Adds regression tests for pre-sync-generated local sources and for early abort behavior on failing pre_sync. |
README.md |
Documents pre_sync order (before source resolution/selection) and clarifies what is skipped/preserved on hook failure. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Run the existing global pre_sync hook before source capture and projection so generated local files deploy in the same sync. Failed hooks preserve existing locks and stop before recovery or deployment.
Adds missing/empty source and failed-hook regressions, plus hook-order documentation.
Validation: full cargo test passed; cargo fmt --check passed; strict Clippy passed on project Rust 1.96. Rust 1.98 Clippy flags two unchanged locations in src/digest.rs and src/source/mod.rs.