sync local pi changes

This commit is contained in:
alex wiesner
2026-04-09 23:14:57 +01:00
parent 18245c778e
commit ec378ebd28
128 changed files with 22510 additions and 3436 deletions

View File

@@ -0,0 +1,35 @@
# Context Manager Task 2 Snapshot Fix Report
## Status
Completed.
## Changes
- Updated `.pi/agent/extensions/context-manager/src/ledger.ts` so affected ledger slots are normalized after merges instead of preserving same-slot insertion order.
- Added deterministic slot ordering by:
- newer `timestamp` first,
- existing exact-timestamp tie-break fields (`text`, `sourceType`, `sourceEntryId`, then `confidence`) for same-timestamp candidates.
- Reassigned same-slot same-timestamp IDs from that canonical order, so `:2` / `:3` suffixes no longer depend on input order.
- Recomputed slot-level `active`, `freshness`, and `supersedesId` from the canonical slot order so forward vs reversed tie merges produce the same stored snapshot and lineage.
- Strengthened `.pi/agent/extensions/context-manager/src/ledger.test.ts` to compare the resulting ledger snapshot, not only the active winner text.
- Updated the existing same-timestamp ID test to assert lineage against the archived tied item rather than insertion position.
## Tests
- `cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npx tsx --test src/ledger.test.ts`
- Result: 6/6 tests passed.
- `cd /home/alex/dotfiles/.worktrees/context-manager-extension/.pi/agent/extensions/context-manager && npm test`
- Result: 11/11 tests passed.
## Files Changed
- `.pi/agent/extensions/context-manager/src/ledger.ts`
- `.pi/agent/extensions/context-manager/src/ledger.test.ts`
- `.pi/reviews/context-manager-task2-snapshot-fix-report.md`
## Self-Review Findings
- Scope stayed inside the requested ledger merge path and regression tests.
- Public function signatures and exported types remain unchanged.
- The deterministic normalization preserves the earlier out-of-order timestamp protection while also making stored tie snapshots replay-stable.
- Regression coverage now locks the exact stored state for the tied slot, including IDs and `supersedesId` values.
## Concerns
- None blocking.
- I attempted to invoke the requested code-review subagent workflow, but no `code-reviewer` agent is available in this harness, so this pass relied on direct verification plus self-review.