https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

09/07/2022, 8:13 PM
@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

witty-crayon-22786

09/07/2022, 8:22 PM
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

hundreds-father-404

09/07/2022, 8:24 PM
failing to bootstrap
w

witty-crayon-22786

09/07/2022, 8:25 PM
did you fix this queryrule:
Copy code
src/python/pants/backend/explorer/browser.py
53:        QueryRule(ProcessResult, (Process,)),
?
h

hundreds-father-404

09/07/2022, 8:25 PM
ahhhh thank you
w

witty-crayon-22786

09/07/2022, 8:26 PM
don’t thank me yet… but let me know if it doesn’t work and i can take a look.
h

hundreds-father-404

09/07/2022, 8:27 PM
yeah not working yet. I'll push this update tho
👍 1
1
w

witty-crayon-22786

09/07/2022, 8:29 PM
looking.
h

hundreds-father-404

09/07/2022, 8:29 PM
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

witty-crayon-22786

09/07/2022, 8:32 PM
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

hundreds-father-404

09/07/2022, 8:37 PM
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

witty-crayon-22786

09/07/2022, 8:37 PM
@hundreds-father-404: see above.
h

hundreds-father-404

09/07/2022, 8:37 PM
and failing at runtime
Which I just fixed locally. Bad
args.pop()
👍 1
awesome! mind sending the diff please?
w

witty-crayon-22786

09/07/2022, 8:37 PM
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

hundreds-father-404

09/07/2022, 8:41 PM
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

witty-crayon-22786

09/07/2022, 8:43 PM
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