Skip to content

Protect patch application consistency - #76

Closed
Alajmah wants to merge 5 commits into
mainfrom
lane64-audit-guard
Closed

Alajmah wants to merge 5 commits into
mainfrom
lane64-audit-guard

Conversation

@Alajmah

@Alajmah Alajmah commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a restore guard for patch application consistency.

Changes

  • Adds a patch-target snapshot helper.
  • Uses it in approval and auto-apply paths.
  • Adds regression tests for update, create, and auto-apply behavior.

Closes #64.

Validation

CI should run on this PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4ef4ea814

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +23 to +24
except Exception:
_restore_patch_target(snapshot)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore the Git index when rolling back a failed commit

If GitAudit.commit_paths() fails after its git add step (for example, because a commit hook rejects the commit), this handler restores only the working-tree file. The patched content remains staged in the Git index, so a later unrelated audit commit can silently commit the failed or still-pending patch. The rollback needs to restore both the target file and its prior index state.

Useful? React with 👍 / 👎.

@gitwire-hq

gitwire-hq Bot commented Jul 2, 2026

Copy link
Copy Markdown

⏰ GitWire Stale Warning

This pr has had no activity for 23 days.
It will be automatically closed in 7 days if no further activity occurs.

To keep it open, leave a comment or push an update.

@gitwire-hq

gitwire-hq Bot commented Aug 1, 2026

Copy link
Copy Markdown

🔒 GitWire Auto-Close: Stale pr

This pr has had no activity for 30 days and has been automatically closed.

If this was closed in error, leave a comment and a maintainer can reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protect vault writes from Git audit failure

1 participant