Hey folks, hoping to get some help with a rule gra...
# development
b
Hey folks, hoping to get some help with a rule graph error in my Pants fork that I’ve been chasing down. From searching the Slack this appears to be a common source of frustration, particularly when using union types 🙂 Here’s the error itself: https://github.com/pantsbuild/pants/pull/20411#discussion_r1452635584 I see that from prior art,
EnvironmentName
is something to look for on the union declaration: https://pantsbuild.slack.com/archives/C01CQHVDMMW/p1681168250323909?thread_ts=1680666837.974579&cid=C01CQHVDMMW Are there any other common rule graph errors that come up with adding new types to a union, or things that I should be looking for?
c
I can't explain it really well, but it's like the error is applied to the "complement" of whatever is link is actually missing. My mental model is that a projection to all members of the Union fails, so Pants expects these to be provided directly, and that's why there are so many errors. For example, parent P; children C0, C1 with union rules; existing rules R0=(C0->T) and R1=(C1->T), and a Get(T, P), this works: Pants finds P-[union]->C0-[R0]->T, P-[union]->C1-[R1]->T. We now add C2 and union to P, but no new rule. Imagine that pants is trying to complete the graph (no isolated pieces). Before, Pants used Get(T, P) to connect the vertexes C0 and C1 to a call site. But now that fails because there is no rule R2=(C2->T). So the graph looks like there's just C0 and C1 starting randomly, and Pants says "No installed rules return the type C0, and it was not provided by potential callers of R0". The error kindof tells you that you need to implement an R*, and if you've just added *2, you can guess that it's R2. But it gets pretty unhelpful pretty quickly, especially as many backends chain these rules. So if you have C1-[R1a]->T1a-[R1b]->T1b-[R1c]->T , then you'll get a bunch of functions which might not be the totality of the chain you wanted to implement. This is just what I've been working out, I'd appreciate if someone with actual knowledge or understanding would chime in.
🙌 2
You might be able to narrow down the missing rule by turning off backends
b
Thanks, this is really helpful advice. I was a little overwhelmed when starting out because there were so many unrelated items getting flagged, but I think I probably just have to keep commenting out code / disabling backends till I find the issue