Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enforces configuration-time mutual exclusion between local writers (.source(), .transform()) and inbound connectors (.link_from()) so a record can’t be configured with multiple competing producers that would otherwise degrade to last-writer-wins.
Changes:
- Added symmetric config-time panics to prevent mixing
.link_from()with.source()or.transform(). - Added builder-level pre-check in inbound connector
.finish()to produce a URL-bearing panic message. - Added unit tests covering the new exclusivity rules and confirming multiple
.link_from()calls remain allowed.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| CHANGELOG.md | Notes the new writer-exclusivity validation behavior at the repo level. |
| aimdb-core/src/typed_record.rs | Adds defense-in-depth exclusivity checks in set_producer_service, set_transform, and add_inbound_connector. |
| aimdb-core/src/typed_api.rs | Adds builder-level exclusivity checks in inbound connector finish() and adds tests for the new behavior. |
| aimdb-core/CHANGELOG.md | Documents the feature addition in the crate changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #89.
Summary
.link_from()enforced at config time..source(),.transform(), and.link_from()all push into the same buffer; combining any two on a single record was previously accepted and silently degraded to last-writer-wins onlatest_snapshot. The configuration now panics with a clear message instead. Extends the existing.source()↔.transform()check (aimdb-core/src/typed_record.rs:638,726) to cover the inbound side, closing the gap called out in the issue.set_producer_serviceandset_transformpanic ifinbound_connectorsis non-empty;add_inbound_connectorpanics if a source or transform is registered. Samecfg(feature = "std")lock pattern as the existing checks.LinkFromBuilder::finish()runs the same check via the existinghas_transform()/has_producer_service()accessors before callingadd_inbound_connector, so the panic message includes the offending URL (e.g.Record already has a .source(); cannot also have a .link_from() for mqtt://broker/topic). The record-level check remains the source of truth..link_from()on the same record stays allowed. Fan-in (redundant brokers, multi-source ingestion) is a legitimate pattern; only mixing inbound with local writers is rejected.Tests
Added 5 tests in
aimdb-core/src/typed_api.rs:link_from_after_source_panics,link_from_after_transform_panics— exercise the URL-bearing panic fromLinkFromBuilder::finish().source_after_link_from_panics,transform_after_link_from_panics— exercise the record-level panic fromset_producer_service/set_transform.multiple_link_from_allowed— confirms fan-in is still permitted (twolink_fromcalls, assertsinbound_connectors().len() == 2).