Skip to content

fix(journal): read-path non-mutation + CLI hardening + finite createServer defaults#115

Merged
jpr5 merged 3 commits intomainfrom
fix/journal-polish
Apr 17, 2026
Merged

fix(journal): read-path non-mutation + CLI hardening + finite createServer defaults#115
jpr5 merged 3 commits intomainfrom
fix/journal-polish

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented Apr 17, 2026

Summary

Follow-up polish to v1.14.1's journal OOM fix (#114). Three independent improvements surfaced by CR:

  1. Read-path non-mutation bug fix. Journal.getFixtureMatchCount(fixture, testId) was a read method that silently inserted an empty Map + triggered FIFO eviction for unknown testIds. Reads could evict live testIds. Now split into a read-only public getFixtureMatchCountsForTest (returns transient empty Map on miss) and private getOrCreateFixtureMatchCountsForTest (insert+evict write path used only by incrementFixtureMatchCount).

  2. CLI validation hardening. --journal-max -5 was silently treated as unbounded; now rejected with a clear error. Same for the new --fixture-counts-max flag.

  3. createServer() default flip. journalMaxEntries (1000) and fixtureCountsMaxTestIds (500) now default to finite caps for programmatic callers — long-running embedders no longer inherit the original leak. Tests using new Journal() directly remain unbounded by default (back-compat). Opt in to unbounded via journalMaxEntries: 0.

Test plan

  • 3 new tests: read-non-mutation, CLI negative rejection, fixtureCountsMaxTestIds cap FIFO eviction
  • Full suite: 2461 tests pass
  • Lint + build + prettier clean
  • CR R2 on combined diff: 0 blocking bugs

Breaking change note

The createServer() default flip is a behavioral change for programmatic embedders that relied on unbounded journal retention. Opt back in with createServer({ journalMaxEntries: 0 }) if needed. Documented in types.ts JSDoc.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 17, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@115

commit: b2df584

@jpr5 jpr5 force-pushed the fix/journal-polish branch from 7cc17e6 to b2df584 Compare April 17, 2026 17:21
@jpr5 jpr5 merged commit a415eeb into main Apr 17, 2026
22 checks passed
@jpr5 jpr5 deleted the fix/journal-polish branch April 17, 2026 17:26
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