<@U06A03HV1> can an intrinsic depend on a type tha...
# development
h
@witty-crayon-22786 can an intrinsic depend on a type that gets computed via a rule inside Python? I'm not sure how to approach this graph failure https://github.com/pantsbuild/pants/pull/16791/commits/32fe6916406ea12798ea3c38ba4bc144105f3c93
w
yes, it should be able to as long as the
@rule
is installed in all cases where the intrinsic is also installed.
👍 1
are you failing to bootstrap, or is it a failure in a test?
h
failing to bootstrap
w
did you fix this queryrule:
Copy code
src/python/pants/backend/explorer/browser.py
53:        QueryRule(ProcessResult, (Process,)),
?
h
ahhhh thank you
w
don’t thank me yet… but let me know if it doesn’t work and i can take a look.
h
yeah not working yet. I'll push this update tho
👍 1
1
w
looking.
h
Ah hm, we already register
*environments.rules()
inside
engine_initializer.py
. I will try my approach of checking for rule graph cycles while you look: comment out
Gets
until it's as simple as possible
w
ok, so: one more technique that is useful when the error is small like this is to set
-ltrace --no-pantsd
, which will render a dot graph of the error
👍 1
doing that here, i see two errored QueryRules:
Copy code
Query(MaybeGitWorktree for (GitBinary, GitWorktreeRequest))
Query(GitBinary for GitBinaryRequest)
bootstrap-error.pdf
and yea, fixing both of those gets things running and failing at runtime
❤️ 1
h
also fyi removing
tgt: EnvironmentTarget
from
extract_process_config_from_environment
fixes the issue, when combined with your query rule fix. I'm gonna try narrowing down which
Get
breaks things
w
@hundreds-father-404: see above.
h
and failing at runtime
Which I just fixed locally. Bad
args.pop()
👍 1
awesome! mind sending the diff please?
w
Copy code
diff --git a/src/python/pants/init/specs_calculator.py b/src/python/pants/init/specs_calculator.py
index f69b9784aa..d3cd085728 100644
--- a/src/python/pants/init/specs_calculator.py
+++ b/src/python/pants/init/specs_calculator.py
@@ -104,6 +104,6 @@ def calculate_specs(
 def rules():
     return [
         QueryRule(ChangedAddresses, [ChangedRequest, EnvironmentName]),
-        QueryRule(GitBinary, [GitBinaryRequest]),
-        QueryRule(MaybeGitWorktree, [GitWorktreeRequest, GitBinary]),
+        QueryRule(GitBinary, [GitBinaryRequest, EnvironmentName]),
+        QueryRule(MaybeGitWorktree, [GitWorktreeRequest, GitBinary, EnvironmentName]),
     ]
❤️ 1
h
also fyi removing tgt: EnvironmentTarget
Ah and this is because the rule graph didn't know how to produce
EnvironmentTarget
as
EnvironmentName
wasn't provided, so
Name -> Target
failed. Cool. Thanks again!
w
sure thing. there is probably an intermediate step that we could do to improve error messages based on rendering the failing root(s) instead-of (some of…?) what we display. but would rather invest time in replacement of the algorithm
👍 1