8000 feat(dal): Allow arrays to subscribe to multiple values by jkeiser · Pull Request #6111 · systeminit/si · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(dal): Allow arrays to subscribe to multiple values #6111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025

Conversation

jkeiser
Copy link
Contributor
@jkeiser jkeiser commented May 14, 2025

This PR allows you to subscribe to multiple values from a single array, and will put them together into a single array. It has two specific changes:

  1. Allows multiple subscriptions to array values
    • Changes AttributeValue::subscribe() to AttributeValue::set_to_subscriptions(), setting multiple subscriptions at once
    • Adds keepExistingSubscriptions option to PUT /component/:componentId/attributes to make it easier for the "add subscription" button to be built for arrays
  2. Uses si:normalizeToArray instead of si:identity when the subscriber is an array, to uplevel single values

It will return an error if you attempt to assign multiple subscriptions to a non-array value.

Factor Budget

  • Made the tests super ergonomic with some attribute::value::set/subscribe/get helpers, letting you pass component names and attribute paths to reference things
  • AttributeValue::list_arguments_for_id -> list_arguments (there is no other variant)

Testing

  • Test that subscribing from an array to an array flows the values through
  • Test that subscribing to a single value from an array uplevels it to an array
  • Test that subscribing to multiple scalars flows the values through as an array
  • Manually test that subscriptions still work for current values

@jkeiser jkeiser requested a review from jhelwig May 14, 2025 00:48
@github-actions github-actions bot added A-sdf Area: Primary backend API service [Rust] A-dal A-web A-dal-test labels May 14, 2025
@jkeiser jkeiser force-pushed the jkeiser/append-subscriptions branch from f39c5c3 to 5dd2c40 Compare May 14, 2025 00:49
Copy link
github-actions bot commented May 14, 2025

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@jkeiser jkeiser force-pushed the jkeiser/append-subscriptions branch 2 times, most recently from c71870e to 8b8a9d3 Compare May 14, 2025 04:07
@jkeiser
Copy link
Contributor Author
jkeiser commented May 14, 2025

/try

Copy link
github-actions bot commented May 14, 2025

Okay, starting a try! I'll update this comment once it's running...\n
🚀 Try running here! 🚀

@jhelwig
Copy link
Contributor
jhelwig commented May 14, 2025

It's a bit difficult to find in the wall of output, but there's a failing test: integration_test::materialized_views::incoming_connections

The formatting doesn't copy well out of BuildKite...

Message:  assertion failed: `(left == right)`
--
 
Diff < left / right > :
[
Prop {
from_component_id: WeakReference {
kind: Component,
id: ReferenceId(
ComponentId(
<                    "01JV7P0XAWY6NBJ5JVSMDAH7Z8",
<                ),
<            ),
<            _kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
<        },
<        from_attribute_value_id: AttributeValueId(
<            "01JV7P0XGC86E6QGGK95BBNWKQ",
<        ),
<        from_attribute_value_path: "/si/name",
<        from_prop_id: PropId(
<            "01JV7NRZDMESFM62VHD1KCXW9H",
<        ),
<        from_prop_path: "/root/si/name",
<        to_component_id: WeakReference {
<            kind: Component,
<            id: ReferenceId(
<                ComponentId(
<                    "01JV7P0YMJJB7VSJD6GT94Y9P0",
<                ),
<            ),
<            _kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
<        },
<        to_prop_id: PropId(
<            "01JV7NRZDMESFM62VHD1KCXW9H",
<        ),
<        to_prop_path: "/root/si/name",
<        to_attribute_value_id: AttributeValueId(
<            "01JV7P0YMPCAZRRPWKD5KAJH5D",
<        ),
<        to_attribute_value_path: "/si/name",
<    },
<    Prop {
<        from_component_id: WeakReference {
<            kind: Component,
<            id: ReferenceId(
<                ComponentId(
"01JV7P0YHDBC81YQRJ2250XCJ0",
),
),
_kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
},
from_attribute_value_id: AttributeValueId(
"01JV7P0YJ933ZR5TNBYW4KTAWH",
),
from_attribute_value_path: "/domain/name",
from_prop_id: PropId(
"01JV7NRZKFKTB1PRJGJ5T2X241",
),
from_prop_path: "/root/domain/name",
to_component_id: WeakReference {
kind: Component,
id: ReferenceId(
ComponentId(
"01JV7P0YMJJB7VSJD6GT94Y9P0",
),
),
_kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
},
to_prop_id: PropId(
<            "01JV7NRZFFR8WG3AWQVH998Y72",
>            "01JV7NRZDMESFM62VHD1KCXW9H",
),
<        to_prop_path: "/root/domain/name",
>        to_prop_path: "/root/si/name",
to_attribute_value_id: AttributeValueId(
<            "01JV7P0YMR5EKPGJ2SHW7VHZA0",
>            "01JV7P0YMPCAZRRPWKD5KAJH5D",
),
<        to_attribute_value_path: "/domain/name",
>        to_attribute_value_path: "/si/name",
},
Socket {
from_component_id: WeakReference {
kind: Component,
id: ReferenceId(
ComponentId(
"01JV7P0YHDBC81YQRJ2250XCJ0",
),
),
_kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
},
from_attribute_value_id: AttributeValueId(
"01JV7P0YHDBC81YQRJ2250XCJ4",
),
from_attribute_value_path: "",
from_socket_id: OutputSocketId(
"01JV7NRZKWRXYJWF5E72013J0W",
),
from_socket_name: "one",
to_component_id: WeakReference {
kind: Component,
id: ReferenceId(
ComponentId(
"01JV7P0YMJJB7VSJD6GT94Y9P0",
),
),
_kind: PhantomData<si_frontend_mv_types::reference::weak::markers::Component>,
},
to_socket_id: InputSocketId(
"01JV7NRZG2GEM9A3ZWEG587GQV",
),
to_socket_name: "one",
to_attribute_value_id: AttributeValueId(
"01JV7P0YMK36A8TQX34T0YNKRY",
),
to_attribute_value_path: "",
},
]
 
 
Location: lib/dal/tests/integration_test/materialized_views.rs:403

@jkeiser jkeiser force-pushed the jkeiser/append-subscriptions branch from 8b8a9d3 to 0153657 Compare May 14, 2025 16:33
@jkeiser
Copy link
Contributor Author
jkeiser commented May 14, 2025

/try

Copy link
github-actions bot commented May 14, 2025

Okay, starting a try! I'll update this comment once it's running...\n
🚀 Try running here! 🚀

@jkeiser jkeiser force-pushed the jkeiser/append-subscriptions branch 2 times, most recently from 78f7787 to b1faaca Compare May 14, 2025 18:17
@jkeiser jkeiser force-pushed the jkeiser/append-subscriptions branch from b1faaca to 7d11b60 Compare May 14, 2025 21:45
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@vbustamante vbustamante added this pull request to the merge queue May 15, 2025
Merged via the queue into main with commit fc805aa May 15, 2025
11 checks passed
@vbustamante vbustamante deleted the jkeiser/append-subscriptions branch May 15, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dal A-dal-test A-sdf Area: Primary backend API service [Rust] A-web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0