Conversation
There was a problem hiding this comment.
I tried to review this PR, but unfortunately I don't quite follow it, so I have some questions:
- Can you explain what the purpose of
resourcesForInferredRefis? I’m trying to wrap my head around it, but not quite getting it (like, why can’t it just loop overRefsto check?) - Did you consider manipulating
rawRefsinstead ofRefs? Or maybe only allowing a hook to rewrite raw refs and nothing else (to make it safe to run repeatedly). - About the issue you raised here. Could it be fixed by integrating with
inferUnspecifiedRefs? Since I believe it already has logic for propagating when inferred refs change.
This is just to make sure that hooks are processed fast. Since all the hooks for all nodes are processed after any resource is updated I felt it necessary to create a lookup. A simple loop can also be added if you feel otherwise.
Not sure I fully understand this. The
Yeah sorry it was more about should we do this i.e. if a connector is removed should the model continue to work fine. Should this be extended to all connectors ? |
Actually, it gets processed into So So what I was wondering was if
Okay. This is also something Lines 501 to 534 in 21a4347 |
| } | ||
| } | ||
| } | ||
| // ... any unchanged resource that might have a ref to a newly inserted connector |
There was a problem hiding this comment.
Why does this existing case not already handle this? It's generic for all resources, so would expect it to also work for connector refs.
// ... any unchanged resource that might have an unspecified ref (previously unmatched) that now matches a newly inserted resource
There was a problem hiding this comment.
It only iterates over the resources that has refs to ResourceKindUnspecified:
Lines 524 to 527 in 49df2c2
I modified it slightly to handle both connector and ResourceKindUnspecified.
| } | ||
|
|
||
| // inferUnspecifiedRefs populates r.Refs with a) all explicit refs from r.rawRefs, and b) any implicit refs that we can infer from context. | ||
| // inferUnspecifiedRefs populates r.Refs with |
There was a problem hiding this comment.
- It looks like the logic in here can be simplified quite a bit by removing the
ResourceKindSourcelogic (since that resource type is never emitted anymore, it's dead code anyway) - "Unspecified" is not really the right word anymore, since e.g. connectors are explicitly specified, they just may not necessarily exist. Maybe rename the function to
inferAmbiguousRefs?
There was a problem hiding this comment.
- Done. Also modified the index a bit to handle the above comment.
Co-authored-by: Benjamin Egelund-Müller <b@egelund-muller.com>
closes https://linear.app/rilldata/issue/PLAT-30/updating-connector-yaml-files-or-variables-should-restart-the
Checklist: