Skip to content

Add DCB exists/count read-option overloads and pin write-path limitations - #216

Closed
johanhaleby wants to merge 1 commit into
johan/dcb-starter-combined-mode-testfrom
johan/dcb-review-followups
Closed

Add DCB exists/count read-option overloads and pin write-path limitations#216
johanhaleby wants to merge 1 commit into
johan/dcb-starter-combined-mode-testfrom
johan/dcb-review-followups

Conversation

@johanhaleby

@johanhaleby johanhaleby commented Jun 22, 2026

Copy link
Copy Markdown
Owner

What

Follow-ups from the deep review of the DCB write path. The two correctness findings, the unconditional-append skew and the read-watermark overshoot, already landed in the write-path PR. This one cleans up the smaller items.

  • DcbEventStore.exists and count now have DcbReadOptions overloads, so you can ask "does anything match in this window" the same way read already scopes by position. The Spring Mongo store answers them with a direct exists or count query. The in-memory store uses the read-based default.
  • DcbReadOptions.between now names its parameters afterSequencePosition and upToSequencePosition to match the rest of the type. The exclusive and inclusive semantics stay in the javadoc.
  • Two tests pin behavior that was only documented before: the position-window overloads, and the MatchAll concurrency limitation. The MatchAll test shows that a MatchAll condition does not detect a concurrent tag-scoped append, so a later change cannot quietly weaken it.
  • ADR 0021 now spells out that markers are not reclaimed automatically, and how an operator can prune them safely during quiescence.

Two items I left alone, with reasons

The review also flagged the Kotlin DcbExecuteOptions<*> cast and the decider DSL not taking DcbExecuteOptions. Both rest on the premise that the stream side does it differently. It does not.

  • The stream Kotlin extensions use the exact same @Suppress("UNCHECKED_CAST") over ExecuteOptions<*> with an as ExecuteOptions<E> cast. The DCB code mirrors it on purpose. A variance-based fix is reasonable, but it belongs on both at once, not on DCB alone where it would drift from the established pattern.
  • The stream decider extensions do not take ExecuteOptions either. Adding options only to the DCB decider DSL would create the asymmetry the finding wanted to remove, not fix it.

I would rather keep DCB consistent with the stream DSL than half-apply either change. Happy to do both as a separate cross-cutting pass if you want the variance cleanup.

Tests

All green: DcbApiTest 15, InMemoryEventStoreDcbTest 20, SpringMongoEventStoreDcbTest 16, including the new position-window and MatchAll-limitation tests.

@github-actions

Copy link
Copy Markdown

Qodana Community for JVM

74 new problems were found

Inspection name Severity Problems
Kotlin Maven Plugin misconfigured 🔶 Warning 27
Constant values 🔶 Warning 25
Nullability and data flow problems 🔶 Warning 14
'Optional' used as field or parameter type 🔶 Warning 2
Pointless boolean expression 🔶 Warning 2
'equals()' called on classes which don't override it 🔶 Warning 1
Result of method call ignored 🔶 Warning 1
Function or property has platform type ◽️ Notice 2
View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from daf4efb to 3393a5e Compare June 24, 2026 15:12
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch 2 times, most recently from 5d3901c to ace109d Compare June 24, 2026 17:52
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from 3393a5e to 7920fbf Compare June 24, 2026 17:52
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from ace109d to adb1154 Compare June 25, 2026 05:07
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from 7920fbf to fcdab40 Compare June 25, 2026 05:07
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from adb1154 to cbe3408 Compare June 25, 2026 12:05
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from fcdab40 to 6c8056f Compare June 25, 2026 12:05
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from cbe3408 to ac92420 Compare June 26, 2026 10:31
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch 2 times, most recently from 863bedd to 9a36a55 Compare June 26, 2026 10:36
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from ac92420 to fcbc091 Compare June 26, 2026 10:36
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from 9a36a55 to 8c30fb6 Compare June 26, 2026 11:22
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from fcbc091 to b55c310 Compare June 26, 2026 11:22
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from 8c30fb6 to c447058 Compare June 26, 2026 11:37
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from b55c310 to 6f56899 Compare June 26, 2026 11:37
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from c447058 to ff27fbb Compare June 29, 2026 06:30
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from 6f56899 to bc17321 Compare June 29, 2026 06:30
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from ff27fbb to f7630cd Compare June 29, 2026 09:59
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from bc17321 to d959949 Compare June 29, 2026 09:59
…ions

Review follow-ups for the DCB write path. The two correctness findings
(unconditional-append skew and read-watermark overshoot) landed in the
write-path PR; this covers the smaller items.

- DcbEventStore.exists/count gain DcbReadOptions overloads that scope the
  check to a position window. The Spring Mongo store answers them with a
  direct exists/count query; the in-memory store uses the read-based default.
- Rename DcbReadOptions.between parameters to the type's vocabulary
  (afterSequencePosition/upToSequencePosition), semantics kept in the javadoc.
- Pin the position-window overloads and the MatchAll concurrency limitation
  (a MatchAll condition does not detect a tag-scoped append) with tests.
- Document marker-collection growth and safe pruning in ADR 0021.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@johanhaleby
johanhaleby force-pushed the johan/dcb-review-followups branch from d959949 to 812f460 Compare June 29, 2026 10:12
@johanhaleby
johanhaleby force-pushed the johan/dcb-starter-combined-mode-test branch from f7630cd to 42e4596 Compare June 29, 2026 10:12
@johanhaleby

Copy link
Copy Markdown
Owner Author

Landed via the consolidated #234.

@johanhaleby
johanhaleby deleted the johan/dcb-review-followups branch June 29, 2026 12:04
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