-
Notifications
You must be signed in to change notification settings - Fork 97
debug(designer): Add console logs to trace static result schema flow #8725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ import { StaticResultProperty } from './staticResultProperty'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { formatShownProperties, getOptions, initializeShownProperties } from './util'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { OpenAPIV2 } from '@microsoft/logic-apps-shared'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { Dispatch, SetStateAction } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState, useEffect } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useIntl } from 'react-intl'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interface StaticResultPropertiesProps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -28,6 +28,18 @@ export const StaticResultProperties = ({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initializeShownProperties(required, propertiesSchema, propertyValues) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Debug logging for StaticResultProperties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('[DEBUG StaticResult] StaticResultProperties rendered', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isRoot, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| propertiesSchemaKeys: propertiesSchema ? Object.keys(propertiesSchema) : 'none', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shownProperties, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| propertyValues, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dropdownOptions: getOptions(propertiesSchema, required), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+39
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Debug logging for StaticResultProperties | |
| useEffect(() => { | |
| console.log('[DEBUG StaticResult] StaticResultProperties rendered', { | |
| isRoot, | |
| propertiesSchemaKeys: propertiesSchema ? Object.keys(propertiesSchema) : 'none', | |
| required, | |
| shownProperties, | |
| propertyValues, | |
| dropdownOptions: getOptions(propertiesSchema, required), | |
| // Debug logging for StaticResultProperties (gated behind localStorage flag) | |
| useEffect(() => { | |
| if (typeof window === 'undefined') { | |
| return; | |
| } | |
| const debugFlag = window.localStorage?.getItem('mslaDebugStaticResultProperties'); | |
| if (debugFlag !== 'true') { | |
| return; | |
| } | |
| const dropdownOptions = getOptions(propertiesSchema, required) ?? []; | |
| const propertyKeys = propertyValues ? Object.keys(propertyValues) : []; | |
| console.log('[DEBUG StaticResult] StaticResultProperties rendered', { | |
| isRoot, | |
| propertiesSchemaKeys: propertiesSchema ? Object.keys(propertiesSchema) : [], | |
| required, | |
| shownPropertyKeys: Object.keys(shownProperties), | |
| shownPropertyCount: Object.keys(shownProperties).length, | |
| propertyValueKeys: propertyKeys, | |
| propertyValueCount: propertyKeys.length, | |
| dropdownOptionCount: dropdownOptions.length, | |
| dropdownOptionKeys: dropdownOptions.map((option: any) => option?.key ?? option?.text), |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -369,10 +369,24 @@ export const initializeOperationDetailsForManifest = async ( | |
|
|
||
| const { connectorId, operationId } = nodeOperationInfo; | ||
| const parsedManifest = new ManifestParser(manifest, OperationManifestService().isAliasingSupported(operation.type, operation.kind)); | ||
| console.log('[DEBUG StaticResult] operationdeserializer - fetching schema', { | ||
| nodeId, | ||
| connectorId, | ||
| operationId, | ||
| manifestOutputs: JSON.stringify(manifest.properties.outputs, null, 2), | ||
| }); | ||
|
Comment on lines
+372
to
+377
|
||
| const schema = staticResultService.getOperationResultSchema(connectorId, operationId, parsedManifest); | ||
| schema.then((schema) => { | ||
| if (schema) { | ||
| console.log('[DEBUG StaticResult] operationdeserializer - dispatching schema to Redux', { | ||
| schemaId: `${connectorId}-${operationId}`, | ||
| schemaProperties: schema.properties ? Object.keys(schema.properties) : 'none', | ||
| outputsProperties: schema.properties?.outputs?.properties ? Object.keys(schema.properties.outputs.properties) : 'none', | ||
| fullSchema: JSON.stringify(schema, null, 2), | ||
| }); | ||
| dispatch(addResultSchema({ id: `${connectorId}-${operationId}`, schema })); | ||
| } else { | ||
| console.log('[DEBUG StaticResult] operationdeserializer - no schema returned for', { connectorId, operationId }); | ||
| } | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { PanelTabFn, PanelTabProps } from '@microsoft/designer-ui'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { StaticResultContainer } from '@microsoft/designer-ui'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { isNullOrUndefined, type OpenAPIV2 } from '@microsoft/logic-apps-shared'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCallback } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCallback, useEffect } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useDispatch } from 'react-redux'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const TestingPanel: React.FC<PanelTabProps> = (props) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -27,6 +27,25 @@ export const TestingPanel: React.FC<PanelTabProps> = (props) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const staticResultOptions = parameterStaticResult?.staticResultOptions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const properties = useStaticResultProperties(name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Debug logging for Testing tab | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('[DEBUG StaticResult] TestingPanel rendered', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectedNode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| connectorId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| operationId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schemaId: `${connectorId}-${operationId}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasSchema: !!staticResultSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schemaProperties: staticResultSchema?.properties ? Object.keys(staticResultSchema.properties) : 'none', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputsProperties: staticResultSchema?.properties?.outputs?.properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? Object.keys(staticResultSchema.properties.outputs.properties) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : 'none', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bodySchema: staticResultSchema?.properties?.outputs?.properties?.body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? JSON.stringify(staticResultSchema.properties.outputs.properties.body, null, 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : 'none', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| currentProperties: properties, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+30
to
+45
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Debug logging for Testing tab | |
| useEffect(() => { | |
| console.log('[DEBUG StaticResult] TestingPanel rendered', { | |
| selectedNode, | |
| connectorId, | |
| operationId, | |
| schemaId: `${connectorId}-${operationId}`, | |
| hasSchema: !!staticResultSchema, | |
| schemaProperties: staticResultSchema?.properties ? Object.keys(staticResultSchema.properties) : 'none', | |
| outputsProperties: staticResultSchema?.properties?.outputs?.properties | |
| ? Object.keys(staticResultSchema.properties.outputs.properties) | |
| : 'none', | |
| bodySchema: staticResultSchema?.properties?.outputs?.properties?.body | |
| ? JSON.stringify(staticResultSchema.properties.outputs.properties.body, null, 2) | |
| : 'none', | |
| currentProperties: properties, | |
| // Debug logging for Testing tab (dev-only, gated by localStorage flag) | |
| useEffect(() => { | |
| // Only log in non-production environments | |
| if (process.env.NODE_ENV === 'production') { | |
| return; | |
| } | |
| // Ensure we're in a browser environment with localStorage | |
| if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') { | |
| return; | |
| } | |
| const isDebugEnabled = window.localStorage.getItem('LA_DESIGNER_STATICRESULT_DEBUG') === 'true'; | |
| if (!isDebugEnabled) { | |
| return; | |
| } | |
| const schemaProperties = staticResultSchema?.properties; | |
| const outputsProperties = schemaProperties && 'outputs' in schemaProperties ? (schemaProperties as any).outputs?.properties : undefined; | |
| const hasBodySchema = !!(outputsProperties && 'body' in outputsProperties); | |
| const propertyKeys = | |
| properties && typeof properties === 'object' ? Object.keys(properties as Record<string, unknown>) : []; | |
| console.log('[DEBUG StaticResult] TestingPanel rendered', { | |
| selectedNode, | |
| connectorId, | |
| operationId, | |
| schemaId: `${connectorId}-${operationId}`, | |
| hasSchema: !!staticResultSchema, | |
| schemaPropertyKeys: schemaProperties ? Object.keys(schemaProperties) : [], | |
| outputsPropertyKeys: outputsProperties ? Object.keys(outputsProperties) : [], | |
| hasBodySchema, | |
| propertyKeys, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,11 @@ export const getStaticResultSchemaForAPIConnector = ( | |
| parser: SwaggerParser | ManifestParser | ||
| ): Promise<StaticResultRootSchemaType | undefined> => { | ||
| const outputSchema = parser.getOutputSchema(operationId); | ||
| console.log('[DEBUG StaticResult] getStaticResultSchemaForAPIConnector called', { | ||
| operationId, | ||
| parserType: parser.constructor.name, | ||
| outputSchema: JSON.stringify(outputSchema, null, 2), | ||
| }); | ||
|
Comment on lines
+18
to
+22
|
||
| return wrapOutputsSchemaToOperationSchema(outputSchema); | ||
| }; | ||
|
|
||
|
|
@@ -28,10 +33,21 @@ const wrapOutputsSchemaToOperationSchema = (outputSchema: OpenApiSchema): Promis | |
| if (outputSchema) { | ||
| const newSchema = cleanDynamicSchemaParameters(clone(outputSchema)); | ||
| schema.properties.outputs.properties.body = newSchema; | ||
| console.log('[DEBUG StaticResult] wrapOutputsSchemaToOperationSchema', { | ||
| originalOutputSchema: JSON.stringify(outputSchema, null, 2), | ||
| cleanedSchema: JSON.stringify(newSchema, null, 2), | ||
| finalBodySchema: JSON.stringify(schema.properties.outputs.properties.body, null, 2), | ||
| }); | ||
|
Comment on lines
+36
to
+40
|
||
| } else { | ||
| schema.properties.outputs.properties.body = {}; | ||
| console.log('[DEBUG StaticResult] wrapOutputsSchemaToOperationSchema - no outputSchema, using empty body'); | ||
| } | ||
|
|
||
| console.log('[DEBUG StaticResult] Final wrapped schema', { | ||
| schemaKeys: Object.keys(schema.properties), | ||
| outputsKeys: Object.keys(schema.properties.outputs.properties), | ||
| }); | ||
|
|
||
| return Promise.resolve(schema); | ||
| }; | ||
|
|
||
|
|
@@ -47,6 +63,9 @@ const cleanDynamicSchemaParameters = (schema: OpenAPIV2.SchemaObject): OpenAPIV2 | |
|
|
||
| const currSchema = schema; | ||
| if (currSchema[ExtensionProperties.DynamicSchema]) { | ||
| console.log('[DEBUG StaticResult] cleanDynamicSchemaParameters - found dynamic schema, stripping to title only', { | ||
| title: currSchema.title, | ||
| }); | ||
| return { title: currSchema.title }; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log inside useMemo runs during render and is a side effect; in React StrictMode it may run twice and it makes render less pure. If you keep this diagnostic, move it to a useEffect that depends on staticResultSchema/parsed output (and gate behind a debug flag) to avoid render-path side effects.