Skip to content

test(acp): add coverage for OOM fix behaviors (#4032 follow-up) #4052

@OneStepAt4time

Description

@OneStepAt4time

Follow-up to #4032

PR #4051 shipped the OOM fix at P0 speed without test coverage for the new behaviors. This issue tracks the required tests.

Required Test Coverage

  1. Event compaction enforcement — verify that appending beyond maxEventsPerSession prunes oldest events for that session
  2. Startup pruning of terminal sessions — verify pruneCompletedSessionEvents() removes events for closed/completed/failed sessions
  3. Debounce coalescing — verify multiple rapid mutations result in a single disk write within the debounce window
  4. Flush lifecycle — verify flush() writes dirty state, resolves pending promises, and is called on stop()
  5. Incremental seq tracking — verify lastEventSeqBySession Map is rebuilt correctly on loadState() and updated on append()
  6. Lightweight serialization — verify serializeStateLightweight() produces valid output without structuredClone

Acceptance

  • New test file or additions to src/__tests__/acp-local-storage.test.ts
  • All new tests pass
  • Gate clean

Priority

P2 — not blocking, but should be done before next release.

Filed by Hephaestus per Argus review feedback on #4051.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions