@codeyam/codeyam-cli 0.1.0-staging.483fdc2 → 0.1.0-staging.62d4615

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +3 -3
  4. package/analyzer-template/packages/ai/package.json +2 -2
  5. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +9 -1
  6. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +154 -1
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +11 -2
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +2 -2
  11. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +70 -1
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +20 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +84 -19
  15. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  16. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +14 -0
  17. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  18. package/analyzer-template/packages/analyze/index.ts +2 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +51 -3
  20. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -0
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  22. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +4 -0
  23. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +9 -1
  24. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +194 -15
  25. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +260 -22
  26. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  27. package/analyzer-template/packages/database/package.json +1 -1
  28. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  29. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  30. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  31. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  32. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  33. package/analyzer-template/project/constructMockCode.ts +36 -1
  34. package/analyzer-template/project/writeMockDataTsx.ts +111 -17
  35. package/analyzer-template/project/writeScenarioComponents.ts +60 -12
  36. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  37. package/background/src/lib/virtualized/project/constructMockCode.js +30 -1
  38. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  39. package/background/src/lib/virtualized/project/writeMockDataTsx.js +95 -13
  40. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  41. package/background/src/lib/virtualized/project/writeScenarioComponents.js +60 -15
  42. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  43. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  44. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  45. package/codeyam-cli/scripts/apply-setup.js +43 -9
  46. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  47. package/codeyam-cli/src/commands/memory.js +12 -21
  48. package/codeyam-cli/src/commands/memory.js.map +1 -1
  49. package/codeyam-cli/src/utils/backgroundServer.js +4 -0
  50. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  51. package/codeyam-cli/src/utils/install-skills.js +23 -0
  52. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  53. package/codeyam-cli/src/utils/queue/job.js +4 -0
  54. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  55. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  56. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  57. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +128 -0
  58. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  59. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  60. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  61. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  62. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  63. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  64. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  65. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  66. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  67. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
  68. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  69. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +285 -0
  70. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  71. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +83 -0
  72. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  73. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  74. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  75. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  76. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  77. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +96 -0
  78. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  79. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  80. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  81. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +33 -0
  82. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  83. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  84. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  85. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  86. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  87. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  88. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  89. package/codeyam-cli/src/utils/rules/index.js +1 -0
  90. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  91. package/codeyam-cli/src/utils/rules/parser.js +0 -28
  92. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  93. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  94. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  95. package/codeyam-cli/src/utils/rules/staleness.js +14 -9
  96. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
  97. package/codeyam-cli/src/webserver/app/lib/database.js +1 -0
  98. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  99. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
  100. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-B86KKU7e.js} +1 -1
  101. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
  102. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
  103. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
  105. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
  106. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
  107. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
  108. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-C6PKeMYR.js} +3 -8
  109. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
  110. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-BNLaXBHR.js} +2 -2
  111. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
  112. package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
  113. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-DD1r_QU0.js} +6 -11
  114. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +11 -0
  115. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  116. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  117. package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
  118. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
  119. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
  120. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
  121. package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
  122. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
  123. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BBnGWYga.js → dev.empty-C5lqplTC.js} +1 -1
  124. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-n38keI1k.js} +10 -10
  125. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
  126. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
  127. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
  128. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
  129. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
  130. package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-Dk8wkAS7.js} +1 -1
  131. package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-DXnyr8uP.js} +1 -1
  132. package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +1 -0
  133. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CcsFv748.js} +1 -1
  134. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
  135. package/codeyam-cli/src/webserver/build/client/assets/labs-BUvfJMNR.js +1 -0
  136. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
  137. package/codeyam-cli/src/webserver/build/client/assets/manifest-d4e77269.js +1 -0
  138. package/codeyam-cli/src/webserver/build/client/assets/memory-DCHBwHou.js +76 -0
  139. package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
  140. package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +62 -0
  141. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
  142. package/codeyam-cli/src/webserver/build/client/assets/{settings-CS5f3WzT.js → settings-B2X7lJgQ.js} +1 -1
  143. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
  144. package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
  145. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
  146. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
  147. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
  148. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
  149. package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
  150. package/codeyam-cli/src/webserver/build/server/assets/{index-TD1f-DHV.js → index-C0KrUQp-.js} +1 -1
  151. package/codeyam-cli/src/webserver/build/server/assets/server-build-C2h1v1XD.js +260 -0
  152. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  153. package/codeyam-cli/src/webserver/build-info.json +5 -5
  154. package/codeyam-cli/templates/codeyam-memory-hook.sh +9 -10
  155. package/codeyam-cli/templates/codeyam:memory.md +10 -9
  156. package/codeyam-cli/templates/codeyam:new-rule.md +0 -39
  157. package/codeyam-cli/templates/rule-notification-hook.py +54 -0
  158. package/codeyam-cli/templates/rule-reflection-hook.py +356 -89
  159. package/codeyam-cli/templates/rules-instructions.md +19 -22
  160. package/package.json +2 -2
  161. package/packages/ai/src/lib/analyzeScope.js +7 -1
  162. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  163. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  164. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  165. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +134 -1
  166. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  167. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  168. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  169. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +11 -2
  170. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  171. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +2 -2
  172. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  173. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  174. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  175. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +63 -1
  176. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  177. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +15 -1
  178. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -1
  179. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +78 -17
  180. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  181. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  182. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  183. package/packages/ai/src/lib/generateEntityScenarioData.js +10 -0
  184. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  185. package/packages/ai/src/lib/isolateScopes.js +39 -3
  186. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  187. package/packages/analyze/index.js +1 -0
  188. package/packages/analyze/index.js.map +1 -1
  189. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +41 -1
  190. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  191. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +3 -0
  192. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  193. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  194. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  195. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +5 -1
  196. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  197. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +9 -1
  198. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  199. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +116 -13
  200. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  201. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +231 -22
  202. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  203. package/packages/analyze/src/lib/index.js +1 -0
  204. package/packages/analyze/src/lib/index.js.map +1 -1
  205. package/codeyam-cli/src/utils/reviewedRules.js +0 -92
  206. package/codeyam-cli/src/utils/reviewedRules.js.map +0 -1
  207. package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
  208. package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
  209. package/codeyam-cli/src/webserver/build/client/assets/globals-CX9f-5xM.css +0 -1
  210. package/codeyam-cli/src/webserver/build/client/assets/manifest-bba56ec1.js +0 -1
  211. package/codeyam-cli/src/webserver/build/client/assets/memory-DuTFSyJ2.js +0 -92
  212. package/codeyam-cli/src/webserver/build/client/assets/root-DTfSQARG.js +0 -62
  213. package/codeyam-cli/src/webserver/build/server/assets/server-build-BQ-1XyEa.js +0 -258
@@ -4,6 +4,7 @@ import {
4
4
  } from '~codeyam/ai';
5
5
  import { cleanKnownObjectFunctionsFromMapping } from '~codeyam/ai';
6
6
  import { DataStructure, Entity, ReadonlyAnalysis } from '~codeyam/types';
7
+ import { transformationTracer } from './TransformationTracer';
7
8
 
8
9
  export interface DataStructureInfo {
9
10
  signatureSchema: { [key: string]: string };
@@ -65,6 +66,13 @@ function isPrimitiveType(typeStr: string): boolean {
65
66
  return false;
66
67
  }
67
68
 
69
+ // Extract signature index from a path like "signature[0]" or "signature[0].foo"
70
+ // Returns the index number or undefined if not a signature path
71
+ function extractSignatureIndex(path: string): number | undefined {
72
+ const match = path.match(/^signature\[(\d+)\]/);
73
+ return match ? parseInt(match[1], 10) : undefined;
74
+ }
75
+
68
76
  // Check if a new schema path would go through a primitive type
69
77
  // e.g., if schema has 'entities[].scenarioCount': 'number', then
70
78
  // 'entities[].scenarioCount.sha' would go through a primitive and should be rejected
@@ -253,8 +261,17 @@ export default function mergeInDependentDataStructure({
253
261
  return mergedDataStructure.dependencySchemas[filePath][name];
254
262
  };
255
263
 
256
- const cleanSchema = (schema: { [key: string]: string }) => {
257
- cleanKnownObjectFunctionsFromMapping(schema);
264
+ const cleanSchema = (
265
+ schema: { [key: string]: string },
266
+ context?: Record<string, any>,
267
+ ) => {
268
+ transformationTracer.traceSchemaTransform(
269
+ rootScopeName,
270
+ 'cleanKnownObjectFunctionsFromMapping',
271
+ schema,
272
+ cleanKnownObjectFunctionsFromMapping,
273
+ context,
274
+ );
258
275
  };
259
276
 
260
277
  const translatePath = (path: string, dependencyName: string) => {
@@ -327,10 +344,21 @@ export default function mergeInDependentDataStructure({
327
344
  let equivalentSchemaPathsEntry:
328
345
  | (typeof equivalentSchemaPaths)[0]
329
346
  | undefined;
347
+
348
+ // Collect the signature indices from the new roots we want to add
349
+ const newRootSignatureIndices = new Set<number>();
350
+ for (const root of equivalentRoots) {
351
+ const idx = extractSignatureIndex(root.schemaRootPath);
352
+ if (idx !== undefined) {
353
+ newRootSignatureIndices.add(idx);
354
+ }
355
+ }
356
+
330
357
  for (const pathInfo of allPaths) {
331
358
  if (!equivalentSchemaPathsEntry) {
332
- equivalentSchemaPathsEntry = equivalentSchemaPaths.find((esp) =>
333
- esp.equivalentRoots.some(
359
+ equivalentSchemaPathsEntry = equivalentSchemaPaths.find((esp) => {
360
+ // First check: does this entry have a matching root?
361
+ const hasMatchingRoot = esp.equivalentRoots.some(
334
362
  (er) =>
335
363
  er.schemaRootPath === pathInfo.path &&
336
364
  (er.function?.name ===
@@ -338,14 +366,90 @@ export default function mergeInDependentDataStructure({
338
366
  (!er.function &&
339
367
  cleanFunctionName(pathInfo.functionName) ===
340
368
  rootScopeName)),
341
- ),
342
- );
369
+ );
370
+ if (!hasMatchingRoot) return false;
371
+
372
+ // Second check: would adding our new roots create a signature index conflict?
373
+ // An entry should NOT contain roots with different signature indices from the same function.
374
+ if (newRootSignatureIndices.size > 0) {
375
+ // Get all signature indices in the existing entry (grouped by function)
376
+ const existingIndicesByFunction = new Map<string, Set<number>>();
377
+ for (const er of esp.equivalentRoots) {
378
+ const funcKey = er.function
379
+ ? `${er.function.name}::${er.function.filePath}`
380
+ : '__self__';
381
+ const idx = extractSignatureIndex(er.schemaRootPath);
382
+ if (idx !== undefined) {
383
+ if (!existingIndicesByFunction.has(funcKey)) {
384
+ existingIndicesByFunction.set(funcKey, new Set());
385
+ }
386
+ existingIndicesByFunction.get(funcKey)!.add(idx);
387
+ }
388
+ }
389
+
390
+ // Check if adding our new roots would create a conflict
391
+ for (const newRoot of equivalentRoots) {
392
+ const funcKey = newRoot.function
393
+ ? `${newRoot.function.name}::${newRoot.function.filePath}`
394
+ : '__self__';
395
+ const newIdx = extractSignatureIndex(newRoot.schemaRootPath);
396
+ if (newIdx !== undefined) {
397
+ const existingIndices =
398
+ existingIndicesByFunction.get(funcKey);
399
+ if (existingIndices && existingIndices.size > 0) {
400
+ // If this function already has signature indices, check for conflict
401
+ if (!existingIndices.has(newIdx)) {
402
+ // Conflict: entry has indices like [1] but we want to add [2]
403
+ return false;
404
+ }
405
+ }
406
+ }
407
+ }
408
+ }
409
+
410
+ return true;
411
+ });
343
412
  }
344
413
  }
345
414
 
346
415
  if (!equivalentSchemaPathsEntry) {
416
+ // Before creating a new entry, filter out roots that have conflicting
417
+ // signature indices from the same function. An entry should never contain
418
+ // roots with different signature indices from the same function.
419
+ // This prevents the bug where signature[1], signature[2], signature[4]
420
+ // all get merged together due to incorrect sourceEquivalencies.
421
+ let filteredRoots = equivalentRoots;
422
+ if (newRootSignatureIndices.size > 1) {
423
+ // There are multiple signature indices - we need to filter to keep only
424
+ // one consistent set. We'll keep the roots that match the PRIMARY index
425
+ // (the first signature index we encounter from self, or the lowest index).
426
+
427
+ // First, determine the primary index - prefer the self root's index
428
+ let primaryIndex: number | undefined;
429
+ for (const root of equivalentRoots) {
430
+ if (!root.function) {
431
+ // This is a self root
432
+ const idx = extractSignatureIndex(root.schemaRootPath);
433
+ if (idx !== undefined) {
434
+ primaryIndex = idx;
435
+ break;
436
+ }
437
+ }
438
+ }
439
+ // If no self root has a signature index, use the lowest index
440
+ if (primaryIndex === undefined) {
441
+ primaryIndex = Math.min(...newRootSignatureIndices);
442
+ }
443
+
444
+ // Filter roots: keep if no signature index OR signature index matches primary
445
+ filteredRoots = equivalentRoots.filter((root) => {
446
+ const idx = extractSignatureIndex(root.schemaRootPath);
447
+ return idx === undefined || idx === primaryIndex;
448
+ });
449
+ }
450
+
347
451
  equivalentSchemaPathsEntry = {
348
- equivalentRoots,
452
+ equivalentRoots: filteredRoots,
349
453
  equivalentPostfixes: {},
350
454
  };
351
455
  equivalentSchemaPaths.push(equivalentSchemaPathsEntry);
@@ -537,6 +641,26 @@ export default function mergeInDependentDataStructure({
537
641
  allPaths.push(...derivedBasePaths);
538
642
 
539
643
  const entry = findOrCreateEquivalentSchemaPathsEntry(allPaths);
644
+
645
+ // Trace equivalency gathering - helps debug why paths may not be connected
646
+ if (allPaths.length > 1) {
647
+ transformationTracer.operation(rootScopeName, {
648
+ operation: 'gatherEquivalency',
649
+ stage: 'gathering',
650
+ path: translatedPath,
651
+ context: {
652
+ sourceFunction: functionName,
653
+ equivalentPaths: allPaths.map((p) => ({
654
+ path: p.path,
655
+ function: p.functionName,
656
+ })),
657
+ equivalentRoots: entry.equivalentRoots.map((r) => ({
658
+ path: r.schemaRootPath,
659
+ function: r.function?.name,
660
+ })),
661
+ },
662
+ });
663
+ }
540
664
  for (const equivalentRoot of entry.equivalentRoots) {
541
665
  const dataStructures =
542
666
  equivalentRoot.function &&
@@ -667,13 +791,29 @@ export default function mergeInDependentDataStructure({
667
791
  schemaPathParts.slice(matchedUpToIndex),
668
792
  );
669
793
 
670
- entry.equivalentPostfixes[postfix] = entry
671
- .equivalentPostfixes[postfix]
672
- ? bestValueFromOptions([
673
- entry.equivalentPostfixes[postfix],
674
- schema[schemaPath],
675
- ])
676
- : schema[schemaPath];
794
+ const previousValue = entry.equivalentPostfixes[postfix];
795
+ const newValue = schema[schemaPath];
796
+ entry.equivalentPostfixes[postfix] = previousValue
797
+ ? bestValueFromOptions([previousValue, newValue])
798
+ : newValue;
799
+
800
+ // Trace postfix gathering - shows where type info comes from
801
+ if (entry.equivalentPostfixes[postfix] !== previousValue) {
802
+ transformationTracer.operation(rootScopeName, {
803
+ operation: 'gatherPostfix',
804
+ stage: 'gathering',
805
+ path: postfix || '(root)',
806
+ before: previousValue,
807
+ after: entry.equivalentPostfixes[postfix],
808
+ context: {
809
+ sourceSchemaPath: schemaPath,
810
+ sourceFunction:
811
+ equivalentRoot.function?.name || rootScopeName,
812
+ equivalentRootPath: equivalentRoot.schemaRootPath,
813
+ rawValue: newValue,
814
+ },
815
+ });
816
+ }
677
817
  }
678
818
  }
679
819
  }
@@ -733,14 +873,14 @@ export default function mergeInDependentDataStructure({
733
873
  const postfix = joinParenthesesAndArrays(
734
874
  schemaPathParts.slice(basePathParts.length),
735
875
  );
736
- entry.equivalentPostfixes[postfix] = entry.equivalentPostfixes[
737
- postfix
738
- ]
876
+ const newValue = entry.equivalentPostfixes[postfix]
739
877
  ? bestValueFromOptions([
740
878
  entry.equivalentPostfixes[postfix],
741
879
  dataStructure.returnValueSchema[schemaPath],
742
880
  ])
743
881
  : dataStructure.returnValueSchema[schemaPath];
882
+
883
+ entry.equivalentPostfixes[postfix] = newValue;
744
884
  }
745
885
  }
746
886
  }
@@ -795,6 +935,10 @@ export default function mergeInDependentDataStructure({
795
935
  equivalentRootFunction: (typeof equivalentSchemaPaths)[0]['equivalentRoots'][0]['function'],
796
936
  ) => {
797
937
  let postfix: string | undefined;
938
+
939
+ // Get the signature index we're looking for (if any)
940
+ const lookingForSignatureIndex = extractSignatureIndex(schemaSubPath);
941
+
798
942
  const equivalentEntry = mergedEquivalentSchemaPaths.find((esp) =>
799
943
  esp.equivalentRoots.some((er) => {
800
944
  if (
@@ -807,6 +951,35 @@ export default function mergeInDependentDataStructure({
807
951
  }
808
952
 
809
953
  if (schemaSubPath === er.schemaRootPath) {
954
+ // Additional check: if we're looking for a signature path, make sure
955
+ // the entry doesn't already have DIFFERENT signature indices.
956
+ // This prevents entries with signature[1], signature[2], signature[4]
957
+ // from all being merged together.
958
+ if (lookingForSignatureIndex !== undefined) {
959
+ const hasConflictingSignatureIndex = esp.equivalentRoots.some(
960
+ (otherRoot) => {
961
+ // Only check roots from the same function
962
+ if (
963
+ otherRoot.function?.name !== equivalentRootFunction?.name ||
964
+ otherRoot.function?.filePath !==
965
+ equivalentRootFunction?.filePath
966
+ ) {
967
+ return false;
968
+ }
969
+ const otherIndex = extractSignatureIndex(
970
+ otherRoot.schemaRootPath,
971
+ );
972
+ return (
973
+ otherIndex !== undefined &&
974
+ otherIndex !== lookingForSignatureIndex
975
+ );
976
+ },
977
+ );
978
+ if (hasConflictingSignatureIndex) {
979
+ return false;
980
+ }
981
+ }
982
+
810
983
  postfix = er.postfix;
811
984
  return true;
812
985
  }
@@ -1037,6 +1210,15 @@ export default function mergeInDependentDataStructure({
1037
1210
  // Skip paths that would go through a primitive type
1038
1211
  // e.g., if schema has 'entities[].scenarioCount': 'number', skip 'entities[].scenarioCount.sha'
1039
1212
  if (wouldGoThroughPrimitive(newSchemaPath, schema)) {
1213
+ transformationTracer.operation(rootScopeName, {
1214
+ operation: 'skipPrimitivePath',
1215
+ stage: 'merged',
1216
+ path: newSchemaPath,
1217
+ context: {
1218
+ reason: 'would go through primitive type',
1219
+ postfixValue,
1220
+ },
1221
+ });
1040
1222
  continue;
1041
1223
  }
1042
1224
 
@@ -1060,6 +1242,16 @@ export default function mergeInDependentDataStructure({
1060
1242
  PRIMITIVE_TYPES.has(existingType) &&
1061
1243
  (postfixValue === 'object' || postfixValue === 'array')
1062
1244
  ) {
1245
+ transformationTracer.operation(rootScopeName, {
1246
+ operation: 'skipTypeDowngrade',
1247
+ stage: 'merged',
1248
+ path: newSchemaPath,
1249
+ context: {
1250
+ reason: 'would overwrite primitive with object/array',
1251
+ existingType,
1252
+ newType: postfixValue,
1253
+ },
1254
+ });
1063
1255
  continue;
1064
1256
  }
1065
1257
  // Don't overwrite a complex/union type with a primitive
@@ -1068,14 +1260,37 @@ export default function mergeInDependentDataStructure({
1068
1260
  !PRIMITIVE_TYPES.has(existingType) &&
1069
1261
  PRIMITIVE_TYPES.has(postfixValue)
1070
1262
  ) {
1263
+ transformationTracer.operation(rootScopeName, {
1264
+ operation: 'skipTypeDowngrade',
1265
+ stage: 'merged',
1266
+ path: newSchemaPath,
1267
+ context: {
1268
+ reason: 'would overwrite complex type with primitive',
1269
+ existingType,
1270
+ newType: postfixValue,
1271
+ },
1272
+ });
1071
1273
  continue;
1072
1274
  }
1073
1275
  }
1074
1276
 
1277
+ // Log the successful postfix merge
1278
+ transformationTracer.operation(rootScopeName, {
1279
+ operation: 'mergePostfix',
1280
+ stage: 'merged',
1281
+ path: newSchemaPath,
1282
+ before: existingType,
1283
+ after: postfixValue,
1284
+ context: {
1285
+ schemaRootPath: equivalentRoot.schemaRootPath,
1286
+ postfix: relevantPostfix,
1287
+ dependency: equivalentRoot.function?.name,
1288
+ },
1289
+ });
1075
1290
  schema[newSchemaPath] = postfixValue;
1076
1291
  }
1077
1292
 
1078
- cleanSchema(schema);
1293
+ cleanSchema(schema, { stage: 'afterMergePostfix' });
1079
1294
  }
1080
1295
  }
1081
1296
 
@@ -1197,6 +1412,14 @@ export default function mergeInDependentDataStructure({
1197
1412
  `${dependency.name}().functionCallReturnValue`,
1198
1413
  );
1199
1414
  }
1415
+ transformationTracer.operation(rootScopeName, {
1416
+ operation: 'normalizeReturnValuePath',
1417
+ stage: 'merged',
1418
+ path: normalizedPath,
1419
+ before: path,
1420
+ after: normalizedPath,
1421
+ context: { dependency: dependency.name, value },
1422
+ });
1200
1423
  depSchema.returnValueSchema[normalizedPath] = value;
1201
1424
  }
1202
1425
 
@@ -1281,7 +1504,10 @@ export default function mergeInDependentDataStructure({
1281
1504
  }
1282
1505
  }
1283
1506
 
1284
- cleanSchema(depSchema.returnValueSchema);
1507
+ cleanSchema(depSchema.returnValueSchema, {
1508
+ stage: 'afterMockedDependencyMerge',
1509
+ dependency: dependency.name,
1510
+ });
1285
1511
 
1286
1512
  // Pull signature requirements from downstream functions into the mocked return value.
1287
1513
  // When a mocked function's return flows into another function's signature (via usageEquivalencies),
@@ -1358,7 +1584,10 @@ export default function mergeInDependentDataStructure({
1358
1584
  }
1359
1585
  }
1360
1586
 
1361
- cleanSchema(depSchema.returnValueSchema);
1587
+ cleanSchema(depSchema.returnValueSchema, {
1588
+ stage: 'afterSignatureRequirementsMerge',
1589
+ dependency: dependency.name,
1590
+ });
1362
1591
  }
1363
1592
 
1364
1593
  // Process the input dependencySchemas FIRST (before child dependentAnalyses).
@@ -1399,7 +1628,11 @@ export default function mergeInDependentDataStructure({
1399
1628
  // from the copied schema. Without this, method call paths on primitives like
1400
1629
  // "projectSlug.replace(...)" would cause convertDotNotation to create nested
1401
1630
  // object structures instead of preserving the primitive type.
1402
- cleanSchema(depSchema.returnValueSchema);
1631
+ cleanSchema(depSchema.returnValueSchema, {
1632
+ stage: 'afterDependencySchemaCopy',
1633
+ filePath,
1634
+ dependency: name,
1635
+ });
1403
1636
  }
1404
1637
 
1405
1638
  // TYPE REFINEMENT: Check if dependentAnalyses has a more specific type for this dependency.
@@ -1470,7 +1703,12 @@ export default function mergeInDependentDataStructure({
1470
1703
  srcSchema.returnValueSchema[path];
1471
1704
  }
1472
1705
  }
1473
- cleanSchema(variantSchema.returnValueSchema);
1706
+ cleanSchema(variantSchema.returnValueSchema, {
1707
+ stage: 'afterTypeVariantCopy',
1708
+ filePath,
1709
+ dependency: name,
1710
+ variant,
1711
+ });
1474
1712
  }
1475
1713
  }
1476
1714
  }
@@ -4,3 +4,4 @@ export { type FunctionDependenciesMap } from './asts/sourceFiles/getPseudoFile';
4
4
  export * as asts from './asts/index';
5
5
  export * as projects from './projects/index';
6
6
  export * as types from './types';
7
+ export { transformationTracer } from './files/scenarios/TransformationTracer';
@@ -15,7 +15,7 @@
15
15
  "@supabase/supabase-js": "2.88.0",
16
16
  "better-sqlite3": "^12.4.1",
17
17
  "fetch-retry": "^6.0.0",
18
- "kysely": "^0.28.5",
18
+ "kysely": "^0.28.11",
19
19
  "pg": "^8.16.3"
20
20
  },
21
21
  "jest": {
@@ -42,5 +42,8 @@ export type ProjectMetadata = {
42
42
  webapps?: WebApp[];
43
43
  framework?: any;
44
44
  environmentVariables?: EnvironmentVariable[];
45
+ labs?: {
46
+ simulations?: boolean;
47
+ };
45
48
  };
46
49
  //# sourceMappingURL=ProjectMetadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectMetadata.d.ts","sourceRoot":"","sources":["../../../../../types/src/types/ProjectMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,gBAAgB,CAAC;IAC5B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,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,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAClC,CAAC"}
@@ -46,4 +46,5 @@ export type ProjectMetadata = {
46
46
  webapps?: WebApp[]; // Array of webapps in the project
47
47
  framework?: any; // Deprecated: use webapps[].framework instead
48
48
  environmentVariables?: EnvironmentVariable[]; // Environment variables to pass during startup/analysis
49
+ labs?: { simulations?: boolean };
49
50
  };
@@ -42,5 +42,8 @@ export type ProjectMetadata = {
42
42
  webapps?: WebApp[];
43
43
  framework?: any;
44
44
  environmentVariables?: EnvironmentVariable[];
45
+ labs?: {
46
+ simulations?: boolean;
47
+ };
45
48
  };
46
49
  //# sourceMappingURL=ProjectMetadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectMetadata.d.ts","sourceRoot":"","sources":["../../../../../types/src/types/ProjectMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,IA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,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAClC,CAAC"}
@@ -1413,6 +1413,17 @@ export default function constructMockCode(
1413
1413
  .replace(/,\s*$/, '');
1414
1414
  returnValueContents = `${arrayBasePath}?.map((__item__, __idx__) => (\n${indent(trimmedContent)}\n))`;
1415
1415
  } else {
1416
+ // When generating object-wrapped .map(), ensure original item data is preserved.
1417
+ // If no data spread was included (e.g., because this is a plain array property,
1418
+ // not a function return), add ...__item__ to spread the original item properties.
1419
+ // Without this, the .map() would create new objects with only nested function
1420
+ // properties, losing data like filePath, frontmatter, body, etc.
1421
+ const hasDataSpread =
1422
+ mappedContents.includes('...scenarios()') ||
1423
+ mappedContents.includes('...__item__');
1424
+ if (!hasDataSpread) {
1425
+ mappedContents = `...__item__,\n${mappedContents}`;
1426
+ }
1416
1427
  returnValueContents = `${arrayBasePath}?.map((__item__, __idx__) => ({\n${indent(mappedContents)}\n}))`;
1417
1428
  }
1418
1429
  } // Close the empty content check else block
@@ -1479,6 +1490,17 @@ export default function constructMockCode(
1479
1490
  mappedContents = filterOutArrowFunctions(mappedContents);
1480
1491
  mappedContents = filterOutBareObjects(mappedContents, true);
1481
1492
  mappedContents = cleanupContent(mappedContents);
1493
+ // Same as needsWrapper branch: ensure item data is preserved in .map()
1494
+ const hasDataSpreadInner =
1495
+ mappedContents.includes('...scenarios()') ||
1496
+ mappedContents.includes('...__item__');
1497
+ if (!hasDataSpreadInner && mappedContents.trim().length > 0) {
1498
+ // Insert ...__item__ after the opening brace
1499
+ mappedContents = mappedContents.replace(
1500
+ /^\s*\{/,
1501
+ '{\n...__item__,',
1502
+ );
1503
+ }
1482
1504
  returnValueContents = `${arrayBasePath}?.map((__item__, __idx__) => (\n${indent(mappedContents)}\n))`;
1483
1505
  }
1484
1506
  } else {
@@ -2428,7 +2450,20 @@ export default function constructMockCode(
2428
2450
  const safeReturnValue = isSimpleDataPath
2429
2451
  ? `${returnValue} ?? {}`
2430
2452
  : returnValue;
2431
- return `${isRootAsyncFunction ? 'async ' : ''}function ${safeFunctionName}(...args) {\n${indent(`return ${safeReturnValue};`)}\n}`;
2453
+ const refName = `_${safeFunctionName}Ref`;
2454
+ const assignment = `${refName}.current = ${safeReturnValue};`;
2455
+ const ifBlock = `if (!${refName}.current) {\n${indent(assignment)}\n}`;
2456
+ const body = `${ifBlock}\nreturn ${refName}.current;`;
2457
+
2458
+ return [
2459
+ `// PATCHED: memoize to return stable reference (prevents infinite useEffect re-triggers)`,
2460
+ `const ${refName} = {`,
2461
+ ` current: null,`,
2462
+ `};`,
2463
+ `${isRootAsyncFunction ? 'async ' : ''}function ${safeFunctionName}(...args) {`,
2464
+ indent(body),
2465
+ `}`,
2466
+ ].join('\n');
2432
2467
  } else {
2433
2468
  // Generate safe const name:
2434
2469
  // 1. For call signatures: use derivedFunctionName