fix(journal): read-path non-mutation + CLI hardening + finite createServer defaults#115
Merged
fix(journal): read-path non-mutation + CLI hardening + finite createServer defaults#115
Conversation
commit: |
7cc17e6 to
b2df584
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up polish to v1.14.1's journal OOM fix (#114). Three independent improvements surfaced by CR:
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 publicgetFixtureMatchCountsForTest(returns transient empty Map on miss) and privategetOrCreateFixtureMatchCountsForTest(insert+evict write path used only byincrementFixtureMatchCount).CLI validation hardening.
--journal-max -5was silently treated as unbounded; now rejected with a clear error. Same for the new--fixture-counts-maxflag.createServer()default flip.journalMaxEntries(1000) andfixtureCountsMaxTestIds(500) now default to finite caps for programmatic callers — long-running embedders no longer inherit the original leak. Tests usingnew Journal()directly remain unbounded by default (back-compat). Opt in to unbounded viajournalMaxEntries: 0.Test plan
fixtureCountsMaxTestIdscap FIFO evictionBreaking change note
The
createServer()default flip is a behavioral change for programmatic embedders that relied on unbounded journal retention. Opt back in withcreateServer({ journalMaxEntries: 0 })if needed. Documented intypes.tsJSDoc.