Files
g3/g3-plan/completed_todo_2025-12-11_10-05-08.md
Jochen 1a13fc5345 Add explicit flush to append_entry and strengthen commit ordering docs
Add file.flush() call in append_entry() to ensure planner history
entries are written to disk before git commits execute. While the
file handle drop should flush, explicit flush simplifies reasoning
about the ordering invariant.

Extend code comments in stage_and_commit() to document that the
write_git_commit-before-git::commit ordering has regressed multiple
times and must be preserved in any refactoring.

Requirements: completed_requirements_2025-12-11_10-05-08.md
2025-12-11 10:05:39 +11:00

1.2 KiB

TODO: Fix Planner History GIT COMMIT Ordering Bug

Phase 1: Investigation

  • Locate the current implementation of append_entry in g3-planner
  • Find stage_and_commit() and verify current ordering
  • Analyze git history for previous fix and regression
  • Identify what went wrong this time

Phase 2: Code Analysis and Fix

  • Verify if append_entry needs explicit flush
  • Add flush if necessary and document reasoning
  • Confirm write_git_commit is called before git::commit
  • Add/strengthen code comments about ordering invariant

Phase 3: End-to-End Verification

  • Create throwaway test repo at /tmp/commit_test
  • Run g3 in planning mode with test repo
  • Execute a minimal planning cycle with a commit
  • Verify planner_history.txt has COMMIT as last entry
  • Document test commands and results

Phase 4: Strengthen Guardrails

  • Update comments in stage_and_commit() to reference multiple regressions
  • Ensure test exists that verifies ordering
  • Document findings in code comments

Phase 5: Documentation

  • Update investigation notes with regression analysis
  • Create verification artifact showing test results
  • Final summary