Scope information in output array of BuildDependencyGraph()#1153
Conversation
isc-dchui
left a comment
There was a problem hiding this comment.
Can I ask what the context of this change is? What is the bigger picture change that this enables? (And why not bundle this change with that one?)
Great question! The bigger picture is to allow a user who calls BuildDependencyGraph() to see at a glance which transitive dependencies are scoped and what their scope is (if one exists). The rest of the change isn't within IPM code itself but rather a different application that makes use of IPM (hence not bundling the change in this PR). |
isc-jili
left a comment
There was a problem hiding this comment.
One typo found but otherwise looks great! @isc-cborbonm
isc-kiyer
left a comment
There was a problem hiding this comment.
@isc-cborbonm just the one small note. Looks good!
There was a problem hiding this comment.
Oh one more thing, to get GitHub to auto-link the issue, you must put the issue number immediately after the magic closing word, e.g. Closes #1152. ("Addresses" is not one of these magic words unfortunately.)
Of course, you're free to manually link the issue instead.
|
|
||
| set pDependencyGraph(pDep.Name) = $listbuild( | ||
| pDepth, qualifiedReference.ServerName, moduleObj.VersionString, qualifiedReference.Deployed, qualifiedReference.PlatformVersion,pDep.DisplayName | ||
| pDepth, qualifiedReference.ServerName, moduleObj.VersionString, qualifiedReference.Deployed, qualifiedReference.PlatformVersion,pDep.DisplayName,pDep.Scope |
There was a problem hiding this comment.
Wait, why does this setting of pDependencyGraph have an extra argument of deployed in there? I know this predates your change, but I'm a bit confused by it.
There was a problem hiding this comment.
absolutely no clue 😃
There was a problem hiding this comment.
So I asked Claude to do some investigative journalism and here's what it found:
Dependency graph format inconsistency in
BuildDependencyGraphThe
pDependencyGrapharray written byBuildDependencyGraphhas three different
entry formats depending on which code path populated it:
Path $list(data,1)$list(data,2)$list(data,3)$list(data,4)$list(data,5)$list(data,6)Already installed (line 1145) depth ""version DisplayName — — Exact-match from repo (line 1206) depth serverName version Deployed PlatformVersion DisplayName Fuzzy-match from repo (line 1241) depth serverName version DisplayName — — Root cause
This is a remnant of the iterative BFS rewrite in #975. The exact-match path was
ported from the old recursive implementation, which embeddedDeployedand
PlatformVersionin the graph for downstream consumption. The new iterative design
no longer reads those positions back out of the graph (the inverted graph pipeline
only reads positions 2–3), so they became dead weight — but the format was never
cleaned up, leavingDisplayNameat position 4 on two paths and position 6 on the
third.Current impact
No active bug:
ConstructInvertedDependencyGraphonly reads$list(data, 2, 3), so
nothing downstream is broken today. However, any code added to readDisplayName
from the graph would silently get aDeployedboolean (0/1) for exact-match
dependencies.
@isc-kiyer what's your sense of the best thing to do here? This path-dependent inconsistency smells like a footgun and we should probably fully normalize it. Right now the caller has to know which path has been taken to know what the actual format will be.
There was a problem hiding this comment.
@isc-dchui @isc-cborbonm Yeah I agree we should normalize it. I don't know anything downstream using the platform version and deployed flags but things are using display name. I would vote to remove those
There was a problem hiding this comment.
thanks @isc-kiyer ! updated the review to delete platform version and deployed flags
… only there in one code path and not others, so removal standardizes the graph
isc-dchui
left a comment
There was a problem hiding this comment.
Looks good! Thanks for addressing all the issues that popped up!
Description
Testing
a. checks that non-scoped dependencies have an empty string in the dependency info list
b. checks that scoped dependencies see their scope (namely, "test" for this example) in the dependency info list