[dotnet-code] Consolidate truncation removable count#396
Conversation
Reuse the message index helper for counting included non-system groups before truncation and add a preservation test for skipped system and pre-excluded groups. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns Go truncation compaction internals with the existing “included non-system groups” concept (matching the .NET reference noted in #379) by reusing the shared message-index helper for removable-group counting, and adds a regression test to ensure truncation preserves system groups and respects pre-excluded groups.
Changes:
- Replaced truncation’s inline removable-group counting loop with
MessageIndex.IncludedNonSystemGroupCount(). - Added
TestTruncationStrategy_SkipsPreExcludedAndSystemGroupsto validate behavior around system groups, pre-excluded groups, and the minimum-preserved floor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| agent/compaction/truncation.go | Reuses the shared index helper to compute removable non-system group count, reducing duplicated logic. |
| agent/compaction/compaction_test.go | Adds a focused test ensuring truncation skips system and pre-excluded groups while still excluding the oldest eligible group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cross-Repo API Consistency ReviewResult: ✅ No parity issues — internal refactor only. Both changed files are out of scope for public-contract parity review:
Upstream alignment note: The .NET No inline comments needed.
|
Reuse the message index helper for counting included non-system groups before truncation and add a preservation test for skipped system and pre-excluded groups.