Skip to content

fix(server): count sibling read-model slices in information completeness - #205

Merged
yordis merged 4 commits into
TrogonStack:mainfrom
enilsen16:enilsen16/fix-completeness-sibling-slices
Oct 20, 2026
Merged

yordis merged 4 commits into
TrogonStack:mainfrom
enilsen16:enilsen16/fix-completeness-sibling-slices

Conversation

@enilsen16

@enilsen16 enilsen16 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

CheckInformationCompleteness checks each upsert read-model slice against every field of its read model. When several slices feed one read model, each slice supplies only part of it. So each field that a sibling slice supplies is reported as KIND_MISSING_SOURCE, and the score goes down, although every field has a source.

Change

  • For an upsert read-model slice, the downstream fields now exclude a field when both of these are true:
    • the slice's own upstream (source events and lane state) does not carry it,
    • another upsert slice that feeds the same read model carries it in its source events.
  • Delete slices do not supply fields, so they are not counted as siblings.
  • The scan for the slices that feed a read model moves into slices_feeding. delete_only_sources and the new sibling check both use it.
  • A field that no slice supplies is still reported by each slice that lacks it.

This applies in all scopes, because the sibling scan reads the whole store, the same as delete_only_sources.

Open question

RM_SOURCE_EVENT_FIELD_NOT_PROJECTED still requires each read model fed from a lane to carry every lane state field. This PR does not change that rule. With this fix, authors no longer need lane state as a workaround for completeness. Do you want the rule to stay as it is, or to become less strict (for example, a warning)?

Test

  • upsert_slice_does_not_require_fields_a_sibling_slice_supplies: the issue's repro (summary-on-placed and summary-on-shipped feed order-summary). Event-model scope gives no gaps and a score of 1.0.
  • field_no_slice_supplies_is_still_missing_with_siblings: a read-model field that no event carries is still MissingSource.
  • delete_sibling_does_not_supply_fields: a delete slice does not hide a missing field.
  • cargo test -p trogon-atlas-server and cargo clippy -p trogon-atlas-server --all-targets -- -D warnings pass.

Closes #126


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 792b311a-68fe-4231-808e-1e87ead0bd4a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@enilsen16
enilsen16 marked this pull request as ready for review October 20, 2026 15:19
@cursor

cursor Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes completeness scoring and gap detection for read-model slice flows across the store; incorrect sibling/version logic could hide real missing sources or leave false positives.

Overview
Fixes information completeness when multiple upsert read-model slices project into one read model: each slice no longer gets MissingSource for read-model fields that only a sibling upsert slice supplies via its source events.

Flow building for upsert read-model slices now drops those sibling-covered fields from the slice’s downstream read-model field list (using a new sibling_supplied_fields scan over the full entity store, with latest slice version and read-model identity by namespace/slug). Delete projection slices do not count as suppliers. Shared slices_feeding refactors the existing delete-only-source logic.

Adds regression tests for multi-slice ordering scenarios, version bumps, slices moved to another read model, undeclared-field edge cases, and delete siblings.

Reviewed by Cursor Bugbot for commit 48a315f. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread rsworkspace/crates/trogon-atlas-server/src/analysis.rs Outdated
…odel slices

Signed-off-by: Erik Nilsen <enilsen16@live.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread rsworkspace/crates/trogon-atlas-server/src/analysis.rs
… bumps

Signed-off-by: Erik Nilsen <enilsen16@live.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0191cea. Configure here.

Comment thread rsworkspace/crates/trogon-atlas-server/src/analysis.rs Outdated
…pply every field

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@yordis
yordis merged commit db14a26 into TrogonStack:main Oct 20, 2026
27 checks passed
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.

Information completeness checks each read-model slice alone, and its lane-state fix fails validation

2 participants