Skip to content

test(acp): add OOM fix behavior coverage (#4052)#4053

Merged
aegis-gh-agent[bot] merged 1 commit into
developfrom
test/4052-oom-test-coverage
May 23, 2026
Merged

test(acp): add OOM fix behavior coverage (#4052)#4053
aegis-gh-agent[bot] merged 1 commit into
developfrom
test/4052-oom-test-coverage

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

Follow-up to PR #4051 (OOM crash loop fix). Adds comprehensive test coverage for the 6 OOM-prevention behaviors introduced in that fix.

Closes #4052

Tests Added (11 new)

1. Event compaction enforcement (2 tests)

  • Prunes oldest events for a session when exceeding maxEventsPerSession
  • Prunes events independently per session

2. Startup pruning of terminal sessions (1 test)

  • Removes events for closed/failed sessions on start(), keeps running session events

3. Debounce coalescing (1 test)

  • Multiple rapid mutations coalesced into single disk write via 200ms debounce

4. Flush lifecycle (2 tests)

  • stop() flushes dirty state despite long debounce (fire-and-forget mutation pattern)
  • Health checks: unhealthy before start, healthy after start, unhealthy after stop

5. Incremental seq tracking (2 tests)

  • lastEventSeqBySession map rebuilt correctly on loadState() from disk
  • Seq tracked independently per session

6. Lightweight serialization (2 tests)

  • Complex nested payloads round-trip through persist/restore without corruption
  • Raw JSON output valid with correct ISO date string serialization

Verification

Aegis API: local dev server
Commit: da34c862
Tests: βœ“ 364 files, 5072 passed (8 skipped pre-existing)
Build: βœ“ Success
tsc: βœ“ 0 errors

Follow-up to PR #4051 (OOM crash loop fix). Adds 11 tests covering:

1. Event compaction enforcement β€” verifies maxEventsPerSession pruning
2. Startup pruning of terminal sessions β€” closed/failed events removed on load
3. Debounce coalescing β€” multiple rapid mutations β†’ single disk write
4. Flush lifecycle β€” dirty state persisted on stop(), health checks
5. Incremental seq tracking β€” Map rebuild on load, per-session independence
6. Lightweight serialization β€” complex payload round-trip, valid JSON output

All 6 behaviors from the issue acceptance criteria covered.
Gate: tsc βœ“, build βœ“, 5072/5080 tests pass (8 skipped pre-existing).
Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PR #4053 β€” OOM Fix Test Coverage (#4052)

Verdict: βœ… Approved

All 6 OOM-prevention behaviors covered with 11 new tests. Test-only change, single file, clean isolation with scratch directories and finally cleanup.

Coverage Map

Behavior Tests Verdict
Event compaction enforcement 2 βœ… Oldest pruned, per-session independent
Startup pruning of terminal sessions 1 βœ… closed/failed pruned, running kept
Debounce coalescing 1 βœ… 3 rapid mutations β†’ single persist
Flush lifecycle 2 βœ… stop() flushes dirty state + health checks
Incremental seq tracking 2 βœ… Map rebuild on load, per-session independence
Lightweight serialization 2 βœ… Nested payload round-trip + valid JSON output

9 Merge Gates

  1. βœ… Review completed
  2. βœ… No conflicts β€” MERGEABLE
  3. βœ… CI green (Node 22 pass, Node 20 pending β€” same suite)
  4. βœ… No regressions β€” test-only change
  5. βœ… Unit tests β€” this IS the tests (+11 new)
  6. βœ… E2E β€” dashboard-e2e pass
  7. βœ… Documented β€” PR body maps tests to behaviors
  8. βœ… Security clean β€” all checks pass
  9. βœ… Targets develop

Minor Nits (non-blocking)

  1. Line 253: createMemoryAcpLocalStorageProfile() instantiated but never used β€” dead code
  2. completed status in PRUNABLE_SESSION_STATUSES is never tested (both completed-1 and closed-1 use status: 'closed') β€” minor gap
  3. 500ms setTimeout in debounce test is timing-dependent β€” acceptable for integration test

None are blockers. Solid test coverage.

@aegis-gh-agent aegis-gh-agent Bot merged commit c2a9b6c into develop May 23, 2026
18 checks passed
@aegis-gh-agent aegis-gh-agent Bot deleted the test/4052-oom-test-coverage branch May 23, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant