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
31 lines
1.2 KiB
Markdown
31 lines
1.2 KiB
Markdown
# TODO: Fix Planner History GIT COMMIT Ordering Bug
|
|
|
|
## Phase 1: Investigation
|
|
- [x] Locate the current implementation of `append_entry` in g3-planner
|
|
- [x] Find `stage_and_commit()` and verify current ordering
|
|
- [x] Analyze git history for previous fix and regression
|
|
- [x] Identify what went wrong this time
|
|
|
|
## Phase 2: Code Analysis and Fix
|
|
- [x] Verify if `append_entry` needs explicit flush
|
|
- [x] Add flush if necessary and document reasoning
|
|
- [x] Confirm `write_git_commit` is called before `git::commit`
|
|
- [x] Add/strengthen code comments about ordering invariant
|
|
|
|
## Phase 3: End-to-End Verification
|
|
- [x] Create throwaway test repo at `/tmp/commit_test`
|
|
- [x] Run g3 in planning mode with test repo
|
|
- [x] Execute a minimal planning cycle with a commit
|
|
- [x] Verify planner_history.txt has COMMIT as last entry
|
|
- [x] Document test commands and results
|
|
|
|
## Phase 4: Strengthen Guardrails
|
|
- [x] Update comments in `stage_and_commit()` to reference multiple regressions
|
|
- [x] Ensure test exists that verifies ordering
|
|
- [x] Document findings in code comments
|
|
|
|
## Phase 5: Documentation
|
|
- [x] Update investigation notes with regression analysis
|
|
- [x] Create verification artifact showing test results
|
|
- [x] Final summary
|