hundreds-father-404
03/17/2020, 3:58 PMX -> Z
A -> X -> Z
B -> X -> Z
Specifically:
StripSnapshotRequest -> SourceRootStrippedSources
StripSourcesFieldRequest -> StripSnapshotRequest -> SourceRootStrippedSources
LegacyStripTargetRequest -> StripSnapshotRequest -> SourceRootStrippedSources
aloof-angle-91616
03/17/2020, 3:59 PMA -> X -> Z
not just call the same function used in X -> Z
?hundreds-father-404
03/17/2020, 4:00 PMA -> X -> Z
ends with the line return await Get[Z](X, x)
Specifically, return await Get[SourceRootStrippedSources](StripSnapshotRequest(..))
B -> X -> Z
. (I need both A
and B
to be able to incrementally roll out the target API)aloof-angle-91616
03/17/2020, 4:02 PMaverage-vr-56795
03/17/2020, 4:05 PMhundreds-father-404
03/17/2020, 4:06 PMaloof-angle-91616
03/17/2020, 4:08 PMx = await Get[SourceRootStrippedSources](...)
return x
?Get
types might need to be fixed to recognized return await Get(...)
statements, not surehundreds-father-404
03/17/2020, 4:09 PMdoes the same thing happen if you doIt does, same error. Good intuition though - thanks!
aloof-angle-91616
03/17/2020, 4:10 PMhundreds-father-404
03/17/2020, 4:10 PMstrip_source_roots_from_sources_field
and there’s no more ambiguityaloof-angle-91616
03/17/2020, 4:10 PMhundreds-father-404
03/17/2020, 4:11 PMX -> Z
B -> X -> Z
The issue is adding A -> X -> Z
aloof-angle-91616
03/17/2020, 4:11 PMRuleIndex
, look for rules that create this B -> X -> Z
ambiguity, and introduce intermediate anonymous `@rule`s to disambiguateTaskRule
created by e.g. strip_source_roots_from_snapshot
, and make it return an anonymous @dataclass
which wraps SourceRootStrippedSources
, and then add a rule to convert that anonymous @dataclass
into SourceRootStrippedSources
average-vr-56795
03/17/2020, 4:17 PMaloof-angle-91616
03/17/2020, 4:17 PMaverage-vr-56795
03/17/2020, 4:17 PMaloof-angle-91616
03/17/2020, 4:18 PMRuleIndex
hundreds-father-404
03/17/2020, 4:19 PMA -> X -> Z
and B -> X -> Z
creates ambiguity, though?
For now, I think I can resolve this by creating a new type LegacyStrippedSourceFiles
, i.e.
X -> Z
A -> X -> Z
B -> X -> Z -> M
That might not actually work, but I think I can find a way to hack it through new typesaverage-vr-56795
03/17/2020, 4:19 PMhundreds-father-404
03/17/2020, 4:19 PMaloof-angle-91616
03/17/2020, 4:20 PMX -> Z
A -> M
M -> X
B -> N
N -> X
where M and N are wrapper typesShould I open a ticket about this?yes!
Do you understand what the root cause of the problem is here? It feels like introducing intermediate rules wouldn’t fundamentally change anything
hundreds-father-404
03/17/2020, 4:24 PMaloof-angle-91616
03/17/2020, 4:25 PMwitty-crayon-22786
03/17/2020, 4:46 PMhundreds-father-404
03/17/2020, 4:55 PMcurrently we're "failing slow" with regard to errors, but also rendering not just what is probably the root cause, but everything above itThat’d be wonderful! We’re hoping to very soon get some users writing their own V2 plugins (roughly once the dust settles on the target API), so we’re very eager to improve the rule authoring experience.
witty-crayon-22786
03/17/2020, 5:12 PMAmbiguous rules to compute Get[SourceRootStrippedSources](StripSnapshotRequest) with parameter type LegacyStripTargetRequest:
@rule(LegacyStripTargetRequest) -> SourceRootStrippedSources,
gets=[Get[SourceRootStrippedSources](StripSnapshotRequest)]
pants.rules.core.strip_source_roots:166:legacy_strip_source_roots_from_target
for ()
@rule(StripSourcesFieldRequest) -> SourceRootStrippedSources,
gets=[
Get[SourcesResult](SourcesRequest)
Get[SourceRootStrippedSources](StripSnapshotRequest),
]
...what we are rendering now post http://github.com/pantsbuild/pants/pull/7024 ...? oof