2.1 KiB
2.1 KiB
Context Manager Task 2 Snapshot Fix Report
Status
Completed.
Changes
- Updated
.pi/agent/extensions/context-manager/src/ledger.tsso affected ledger slots are normalized after merges instead of preserving same-slot insertion order. - Added deterministic slot ordering by:
- newer
timestampfirst, - existing exact-timestamp tie-break fields (
text,sourceType,sourceEntryId, thenconfidence) for same-timestamp candidates.
- newer
- Reassigned same-slot same-timestamp IDs from that canonical order, so
:2/:3suffixes no longer depend on input order. - Recomputed slot-level
active,freshness, andsupersedesIdfrom 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.tsto 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
supersedesIdvalues.
Concerns
- None blocking.
- I attempted to invoke the requested code-review subagent workflow, but no
code-revieweragent is available in this harness, so this pass relied on direct verification plus self-review.