Skip to content

Commit 771d681

Browse files
authored
Merge branch 'main' into fix-1191
2 parents 496b1e7 + 49813ed commit 771d681

5 files changed

Lines changed: 43 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ semver Intersection would incorrectly pass if an exact version is compared again
1313
no overlap.
1414
- #1077: Fixed error handling of dependency resolution to correctly report what the offending
1515
modules are.
16+
- #1187: Remove extra path entries in output of %IPM.Storage.ResourceReference:ResolveChildren() that broke unguarded downstream callers.
1617
- #1191: Fixed issue where configured Python version would not be used automatically during calls to pip
1718

1819
## [0.10.7] - 2026-05-29

src/cls/IPM/ResourceProcessor/Test.cls

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ Method OnResolveChildren(ByRef pResourceArray) As %Status
288288
set tResourceInfo("UnitTest") = 1
289289
set tResource = $case(..Package '= "", 1: ..Package, : ..Class)_..Extension
290290
// GetChildren has Output semantics — it kills its output array before populating it.
291-
// Using tClassArray (not pResourceArray directly) preserves any existing entries
292-
// in pResourceArray (e.g., the "/tests/" path entry added before this call).
291+
// Use tClassArray as the intermediate to avoid killing any existing entries in pResourceArray.
293292
kill tClassArray
294293
$$$ThrowOnError(##class(%IPM.Storage.ResourceReference).GetChildren(tResource,tModuleName,1,.tResourceInfo,.tClassArray))
295294
$$$ThrowOnError(..EmbeddedProcessor.OnResolveChildren(.tClassArray))

src/cls/IPM/Storage/Module.cls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,11 @@ Method GetResolvedReferences(
13711371
kill tempArray("Scope")
13721372
if ..HasScope(pPhases, resourceScope) && ..HasScope(pPhases, attrScope) {
13731373
merge pReferenceArray(..Name) = tempArray
1374+
// ResolveChildren does not emit path entries for document enumeration. Re-add here
1375+
// because ExportSingleModule needs the path entry to trigger its directory-copy branch.
1376+
if $extract(tResource.Name) = "/" {
1377+
set pReferenceArray(..Name, tResource.Name) = ..Name
1378+
}
13741379
}
13751380
if $$$ISERR(tSC) {
13761381
quit

src/cls/IPM/Storage/ResourceReference.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ClassMethod GetChildren(
193193
quit
194194
}
195195
} else {
196-
if pResourceName '= "" {
196+
if (pResourceName '= "") && ($extract(pResourceName) '= "/") {
197197
merge pResourceArray(pResourceName) = pResourceInfoArray
198198
}
199199

tests/integration_tests/Test/PM/Integration/IncludeTests.cls

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,39 @@ Method TestIncludeTestsModuleXml()
107107
}
108108
}
109109

110+
// Regression test: ResolveChildren must not return path entries (names starting with /)
111+
// as top-level keys. Path resources have no Studio document representation; returning them
112+
// as document names can crash callers.
113+
Method TestResolveChildrenNoPathEntries()
114+
{
115+
set status = $$$OK
116+
try {
117+
set testRoot = ##class(%File).NormalizeDirectory($get(^UnitTestRoot))
118+
set moduleDir = ##class(%File).NormalizeDirectory(##class(%File).GetDirectory(testRoot)_"/_data/test-output-format/")
119+
set status = ##class(%IPM.Main).Shell("load "_moduleDir)
120+
do $$$AssertStatusOK(status,"Loaded test-output-format module successfully.")
121+
122+
set module = ##class(%IPM.Storage.Module).NameOpen("test-output-format",,.status)
123+
do $$$AssertStatusOK(status,"Opened test-output-format module.")
124+
125+
set key = ""
126+
for {
127+
set tResource = module.Resources.GetNext(.key)
128+
quit:(key = "")
129+
kill tChildren
130+
do $$$AssertStatusOK(tResource.ResolveChildren(.tChildren),"ResolveChildren succeeded for "_tResource.Name)
131+
set childKey = ""
132+
for {
133+
set childKey = $order(tChildren(childKey))
134+
quit:(childKey = "")
135+
if $extract(childKey) = "/" {
136+
do $$$AssertTrue(0,"Path entry '"_childKey_"' found in ResolveChildren output for "_tResource.Name)
137+
}
138+
}
139+
}
140+
} catch e {
141+
do $$$AssertStatusOK(e.AsStatus(),"An exception occurred.")
142+
}
143+
}
144+
110145
}

0 commit comments

Comments
 (0)