Preserve planner history ordering and add regression guardrails
Ensure planner writes GIT COMMIT entry before invoking git commit. Keep history entry even when git commit fails, matching summary text. Document invariant in code comment above write_git_commit call. Add lightweight test to assert history write precedes git::commit using test doubles instead of a real git repository. Investigate git history to find regression and its prior fix, and record a short root-cause summary outside the codebase. Reference completed_requirements_2025-12-10_16-55-05.md for details. Reference completed_todo_2025-12-10_16-55-05.md for task tracking.
This commit is contained in:
@@ -481,7 +481,15 @@ pub fn stage_and_commit(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Log commit to history BEFORE making the commit (provides audit trail even if commit fails)
|
||||
// CRITICAL INVARIANT: Write GIT COMMIT entry to planner_history.txt BEFORE executing git commit.
|
||||
// This ordering is essential for several reasons:
|
||||
// 1. Provides an audit trail even if the git commit fails (e.g., due to git config errors)
|
||||
// 2. Allows post-mortem analysis when commits fail
|
||||
// 3. Ensures the history file accurately reflects all attempted commits, not just successful ones
|
||||
//
|
||||
// NOTE: This invariant was accidentally violated in commit ff8b3e7 (2025-12-09) where the history
|
||||
// write was placed AFTER the commit, then corrected in commit 633da0d the same day.
|
||||
// DO NOT move this call to after git::commit() during refactoring.
|
||||
history::write_git_commit(&config.plan_dir(), summary)?;
|
||||
|
||||
// Make commit
|
||||
|
||||
Reference in New Issue
Block a user