Skip to content

Bug in subinterface query - #607

Merged
jeremydmiller merged 2 commits into
JasperFx:masterfrom
lngr:bug/query_by_subinterface
Nov 2, 2016
Merged

Bug in subinterface query#607
jeremydmiller merged 2 commits into
JasperFx:masterfrom
lngr:bug/query_by_subinterface

Conversation

@lngr

@lngr lngr commented Nov 2, 2016

Copy link
Copy Markdown
Contributor

If an IPapaSmurf is queried, SubClassDocumentStorage would try to deserialize to objects of type IPapaSmurf instead of the actual types.

This bug was not triggered by the ST test case in the documentation because .Count() does not actually instantiate the classes.

The attached commits borrows the type resolving from HierarchicalResolver by delegating to SubClassMapping. (I've seen the TODOs in SubClassDocumentStorage.cs but that's a larger architectural change that's currently beyond my abilities in the Marten codebase :) )

Note: A plethora of tests fails on my local machine mainly due to (appearently) broken PLV8 extension on my dev machine. I could therefore not reliably confirm that the change breaks no other tests.

@jeremydmiller
jeremydmiller merged commit 36c5179 into JasperFx:master Nov 2, 2016
@jeremydmiller

Copy link
Copy Markdown
Member

@lngr Got it, and everything passes just fine. Code looks good and thank you for doing this.

I did add another UT that just exercised the async path from your test. This will be in 1.2.

@jeremydmiller jeremydmiller added this to the 1.2 milestone Nov 2, 2016
@lngr

lngr commented Nov 2, 2016

Copy link
Copy Markdown
Contributor Author

@jeremydmiller lightning fast, as usual :)

jeremydmiller added a commit that referenced this pull request Aug 2, 2026
JasperFx.Events.ComplianceTests shipped in the 2.37.1 line (#607), so
the local prerelease pin used during development is replaced by the real
version, and the rest of the JasperFx packages move with it to keep the
dependency graph on one line.

EventSourcingTests net9.0 against the published packages: 1613 passed, 0 failed,
7 skipped.
jeremydmiller added a commit that referenced this pull request Aug 2, 2026
…5116) (#5122)

* Cross-store event sourcing compliance library, first cut (#5111, #5112, #5113)

Phase 3 of the test harness standardization program (#5119, epic #5110).
Lifts behavioral event sourcing tests out of Marten's own test project and into
suites written once against a store-neutral seam, so Marten, Polecat and the
planned Sqlite minimal store assert the same behavior instead of hand-mirroring
each other's files.

P3.1a -- the seam (src/Marten.Testing/Compliance/, namespace
JasperFx.Events.ComplianceTests so extraction to the source-only package is a
file move):

- EventStoreComplianceFixture<TOperations, TQuerySession> mirroring JasperFx's
  own IEventStore<,> closure. Marten closes it <IDocumentOperations,
  IQuerySession>; Polecat will close it <IDocumentSession, IQuerySession>.
  Everything portable flows through the shared JasperFx surfaces; the fixture
  only absorbs what no shared interface declares -- store construction,
  session acquisition, SaveChangesAsync, document load-back, batched DCB
  queries, daemon plumbing and teardown.
- ComplianceStoreConfig + IComplianceStoreRegistrar: store-neutral config
  replayed through recorded generic closures, so nothing here needs reflection
  or InternalsVisibleTo.
- IComplianceBatch for the batched-DCB accessor divergence
  (batch.Events.EventsExist vs batch.EventsExist) until #5115 lands.
- EventStoreComplianceSuite<TFixture, TOperations, TQuerySession> owning the
  fixture lifecycle, so enrolling a suite is a one-line empty subclass.
- MartenComplianceFixture, Marten's ~120-line implementation.

P3.1b/P3.1c -- four suites (42 tests) and Marten's enrollment:
SelfAggregatingEvolveCompliance, DcbTagQueryAndConsistencyCompliance,
AssignTagWhereCompliance, AsyncDaemonCompliance.

Strongest assertion wins where the Marten and Polecat copies had drifted:

- Inline snapshot cases assert the *persisted* document through
  LoadDocumentAsync. The Polecat mirror read back via AggregateStreamAsync, so
  it would have passed with a broken inline projection.
- assign_tag_where_by_stream_id keeps Marten's e.StreamId == stream1 assertion
  rather than Polecat's weakened Data-type check.
- Adopts two tests Marten never had, both from the Polecat side and both green
  here on day one: can_query_events_across_distinct_tag_types_with_or (the
  OR-across-distinct-tag-types INNER JOIN regression guard) and
  fetch_for_writing_appends_to_existing_tag_derived_stream_without_collision.

Retirements: self_aggregating_evolve_method.cs and assign_tag_where_tests.cs
are gone; dcb_tag_query_and_consistency_tests.cs is reduced to
dcb_documentation_samples.cs, which keeps the eleven sample_marten_dcb_*
snippet blocks docs/events/dcb.md pulls from plus the tag/event/aggregate types
the HStore-specific fixtures share. Doc snippets stay repo-owned deliberately:
after extraction the suite sources no longer live in this repo.

EventSourcingTests net9.0: 1613 passed, 0 failed, 7 skipped.

* Consume the compliance suites from JasperFx.Events.ComplianceTests (#5116)

Second half of the extraction: the seam and the four suites now live in the
jasperfx repo and arrive here as a source-only NuGet package, so Marten's copy
under src/Marten.Testing/Compliance is deleted.

What stays Marten-side is exactly what should: MartenComplianceFixture (the
concrete seam implementation), the ComplianceQuerySession global alias binding
the shared aggregates' EvolveAsync parameter to Marten's IQuerySession, and the
empty enrollment subclasses in EventSourcingTests/Compliance.

Both Marten.Testing and EventSourcingTests reference the package, because the
harness assembly compiles MartenComplianceFixture and the test assembly needs
the suites compiled in it for the aggregate source generator to bind Marten's
session types.

Pinned to a locally packed 2.37.0-compliance.2 for now; this moves to the
published version when the package ships.

EventSourcingTests net9.0 compliance suites: 42 passed, 0 failed.

* Pin to the published JasperFx 2.37.1

JasperFx.Events.ComplianceTests shipped in the 2.37.1 line (#607), so
the local prerelease pin used during development is replaced by the real
version, and the rest of the JasperFx packages move with it to keep the
dependency graph on one line.

EventSourcingTests net9.0 against the published packages: 1613 passed, 0 failed,
7 skipped.
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.

2 participants