Repository navigation
test: HowToSubscribeRealModel replayed earlier runs — LiteDbFactory left LiteDB's journal behind; in-memory assertion db + own-row bounded counts - #43
Merged
Conversation
…teDbFactory left LiteDB's journal (test_N-log.db) behind and the next process replayed it; the assertion db is now in-memory, and both HowTo real-model rows count their own reservation after a bounded wait Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; say why the own-row count stays (rev-reach 6646ada65) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CLEAN bin (CI: the file factory creates test_1.db) and a DIRTY one (reused names, modified) (rev-reach 5d04e884e) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e no-file row guards both bins Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Card
microplumberd-howto-subscribe-realmodel-absolute-count.HowTo.PlumberMethodsTests.HowToSubscribeRealModelfailed on master:The cause was not the shared event store; it was a LiteDB journal from EARLIER PROCESSES
LiteDbFactory.Get()made a "fresh" database by deleting./test_{n}.dband opening it. LiteDB also writes a journal,./test_{n}-log.db. The journal survived and was replayed on the next open, so each later test process started with every earlier run's reservations already in the model. The counts grew run on run (2, 6, 10), and the row passed only where the journal had been checkpointed away or the bin was clean.The evidence:
10: Golden Eye ×6plus fourGolden Eye <guid>. The plain "Golden Eye" rows can only come from the old test body in earlier processes: this branch's rows write unique names.test_3-log.db(200 KB) beside an 8 KBtest_3.db.StartInDockerrestarts the in-memory store. The card's hypothesis (other rows'TicketReservedin the shared store) was ruled out by this mutant, not assumed.The fix
LiteDbFactory.Get()returns an in-memory LiteDB (new LiteDatabase(new MemoryStream()); the file is already namedInMemoryAssertionDb). Nothing is left on disk for a later run to replay. Its only callers are the two HowTo real-model rows.HowToSubscribeRealModeland its sibling…WithHost, which had the same shape and passed only by circumstance):Task.Delay(1000);Rows (
Unit/LiteDbFactoryTests, new)EachAssertionDb_StartsEmpty: a reservation written to one assertion db is not seen by the next.AnAssertionDb_LeavesNoFileBehind_ForALaterRunToReplay: no new*.dbfile appears in the working directory. On a bin that already holdstest_*.dbfiles this row can't see the old factory (the files pre-exist);StartsEmptyis the one that discriminates there.Mutants (messages read)
EachAssertionDb_StartsEmptyred, "Expected next.Reservations().Count() to be 0, but found 11". The leftover journal was replayed into a "fresh" db: the defect, reproduced at its seam.ABSOLUTE 10: …, the names above;Suite
MicroPlumberd.Testsat the tip (21af5dd): 193/199, 16 m 3 s, exit 1, no FATAL or crash, and no refused/409 line. It was the only MP process on the host. The 6 failures are exactly the long-standing set:GrpcApiTests.ApiInvocationWithProcessorCorrelation,ApiHandingExceptionInvocation,ApiSuccessfulInvocation;ProcessManagerSourceGenerationTests.CommandTypes;SubscriptionRunnerStateTests.ThrowsWrongExpectedVersionExceptionWhenOnDoubleChange,…WhenStreamAlreadyExists.HowToSubscribeRealModelpasses.🤖 Generated with Claude Code