fix: hooks/agents managed-block uninstall, real git hooks dir resolution, install backups (closes #415, closes #438)#449
Open
0xLeif wants to merge 2 commits into
Open
Conversation
…les section (closes #438)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
❌ Corvin says...
_
<(;\ .oO(oh no...)
|/(\
\(\\
" "\\
"Even the dumpster of code seems empty today."
CI Summary
| Check | Status |
|---|---|
| Validate action.yml | ✅ Passed |
| Packaged Action Consumer | ✅ Passed |
| Dependency Audit | ✅ Passed |
| Code Coverage | ✅ Passed |
| Format Check | ❌ failure |
| Docs Site | ✅ Passed |
| Spec Validation | ❌ failure |
| Tests (build, test, clippy) | ✅ Passed |
| VS Code Extension | ✅ Passed |
📋 Spec Validation Details
❌ SpecSync: Failed
| Metric | Value |
|---|---|
| Specs checked | 62 |
| Passed | 62 |
| Errors | 1 |
| Warnings | 0 |
| File coverage | 100% (105/105) |
| LOC coverage | 100% (87261/87261) |
Errors
- meaningful changed paths are not covered by an active change: src/agents.rs, src/hooks.rs
Action Items
- Review and fix -- meaningful changed paths are not covered by an active change: src/agents.rs, src/hooks.rs
Generated by specsync · Run specsync check --format github to reproduce
Powered by corvid-pet
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.
Problem
#415 (data loss):
specsync hooks uninstall --pre-commitdeleted the user's ENTIRE pre-existing.git/hooks/pre-commit(a 3-line user hook + appended specsync block = <35 lines starting with#!/bin/shand containing "specsync check" →fs::remove_file). Also, the specsync block was appended AFTER an existing hook'sexit 0— dead code that never ran.#438 (lies):
hooks installin a nested project root (repo/packages/app) created a fake.git/hooks/pre-commit(green ✓ but git never runs it); install in a non-git directory fabricated.git/hooksand reported success;core.hooksPathwas ignored;agents installsilently overwrote user-customized skill files with no warning or backup; the installed SKILL.md had an empty## Companion filessection.Repro (v5.2.0)
After:
Root cause / fix
# >>> specsync:pre-commit … >>>/# <<< specsync:pre-commit <<<sentinels (same managed-block strategy as the markdown companions). Uninstall removes exactly the block — legacy ≤5.2.0 marker blocks and whole-file stock installs are also recognized and removed precisely — and the file is deleted only when nothing but our content remains. A hook with any user content is never deleted; a partial/corrupted marker set errors instead of guessing.exit 0instead of appending dead code after it.git rev-parse --git-path hooks, which handles nested project roots, linked worktrees/submodules (.gitas file), andcore.hooksPath. Non-git directories now fail loudly with remediation instead of fabricating a.git/hookstree git would never read.agents installbacks up any differing pre-existing file to<name>.specsync-backupand prints a warning before overwriting; SKILL.md's## Companion filessection now actually contains the companion-files guidance (it was an empty heading).Scope notes
--format jsonbeing ignored onagents install/statusis a cross-command formatting concern, explicitly out of scope here.agents uninstallintentionally does NOT delete.specsync-backupfiles (user data).Tests
New regression tests —
src/hooks.rs:install_precommit_errors_in_non_git_dir,install_precommit_wraps_block_in_sentinels,install_precommit_inserts_before_trailing_exit_0,install_precommit_resolves_nested_project_root_via_git,install_precommit_honors_core_hooks_path,uninstall_precommit_removes_only_managed_block,uninstall_precommit_deletes_file_that_is_purely_ours,uninstall_precommit_leaves_user_hook_untouched,uninstall_precommit_removes_legacy_appended_block,uninstall_precommit_removes_legacy_whole_file_hook.src/agents.rs:install_backs_up_user_customized_skill,install_backs_up_user_customized_command,skill_md_companion_files_section_is_not_empty.Full suite green (plus the one known pre-existing root-only failure in
change::tests);cargo clippy -- -D warningsclean; all repros re-verified end-to-end with the patched binary.Closes #415
Closes #438