fix: infer optimistic constants from flat domain events - #230
Open
patrickleet wants to merge 1 commit into
Open
Conversation
Implements [[tasks/distributed-flat-event-preview-1]]
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Why
Flat domain events should drive optimistic UI just as snapshot events do. A transition that records
"approved"already defines the result; application authors should not repeat it in a preview declaration or client-side status mapping.What changes
#[sourced]now derives known event-body values from literal arguments to directdomain = eventrecorder calls. The existing typed command and projection pipeline carries those constants into generated client slots. No new public configuration, event shape, or storage format is required.Before: a command selecting
domain_commands::Approveexported an unknown status.After: a projection consuming that field receives the known
"approved"constant without an additional preview declaration.Inference stays deliberately conservative: computed IDs, clocks, arbitrary calls, variables, and conflicting recorder arguments remain unknown. Numeric literals retain their recorder parameter type. Optional literals require fully qualified standard constructors so locally shadowed
Some/Noneare not mistaken for values. Server authorization and confirmed projection events remain authoritative.Two existing macro Clippy findings were corrected without suppressions while validating the change.
Verification
cargo test --test sourced --test sourced_snapshot --features graphql,sqlite --offline --quiet: 27 + 15 pass, including flat event payload parity, conflicting/dynamic arguments, shadowed constructors, and generated client projection slots.cargo test --lib --features graphql,sqlite --offline --quiet: 994 pass.cargo test --test typed_commands --features graphql,sqlite --offline --quiet: 27 pass.cargo test -p distributed_macros --offline --quiet: unit and compile-fail suites pass.cargo test --offline --quiet: default-feature library and integration suites pass (761 library tests; pre-existing ignored documentation examples remain ignored).UI copy
No application UI or user-facing copy changes.
"approved"above is a domain-value example in documentation and tests, not new rendered interface copy.Implements the flat-event-preview specification and
tasks/distributed-flat-event-preview-1.