@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.323686
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.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +3 -3
- package/analyzer-template/packages/ai/index.ts +9 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +48 -34
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +31 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +277 -8
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +73 -1
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +198 -34
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +108 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +87 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +32 -7
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +626 -6
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +26 -1
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +375 -6
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1003 -45
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +23 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +154 -32
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +22 -1
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +10 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +142 -73
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +42 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +77 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +25 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/types/index.ts +1 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
- package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +64 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +25 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +20 -8
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +314 -29
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +71 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +152 -9
- package/analyzer-template/project/runAnalysis.ts +4 -0
- package/analyzer-template/project/start.ts +35 -11
- package/analyzer-template/project/writeMockDataTsx.ts +114 -2
- package/analyzer-template/project/writeScenarioComponents.ts +101 -8
- package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +255 -4
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +126 -9
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +32 -11
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +89 -2
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +57 -8
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +273 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +4 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +21 -2
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +20 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +1 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/rules/index.js +5 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +106 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +132 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +2 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DsN1wKrm.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-Ba2JVPzP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CEleMv_j.js → InlineSpinner-C8lyxW9k.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-aht4aafF.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-OApQuNyq.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-DzccYyI8.js} +3 -13
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BwavGCpm.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DgTPh8H-.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-EPOLDU6W-CXRTFQ3F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-BdhJEx6B.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-BJUiQqZF.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js → entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-wDWZZO1W.js → entity._sha_.create-scenario-D1T4TGjf.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-CS2cb_eZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-CJ6lTdTA.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CPTZZ-JZ.js} +8 -8
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7522edd4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-B2eDuBj8.js → settings-CS5f3WzT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-DwFIBT09.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-C1v1PQzo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BUm0UVJm.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-DYxHZQuP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DVzYx8PN.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +257 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/templates/codeyam-memory-hook.sh +200 -0
- package/codeyam-cli/templates/codeyam:debug.md +47 -3
- package/codeyam-cli/templates/codeyam:diagnose.md +203 -25
- package/codeyam-cli/templates/codeyam:memory.md +462 -0
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/package.json +8 -5
- package/packages/ai/index.js +5 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +41 -17
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +24 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +228 -11
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +161 -30
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +86 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +19 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +70 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +29 -7
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +111 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateEntityScenarioData.js +510 -7
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +19 -1
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +273 -4
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +738 -40
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +15 -7
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +131 -27
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +8 -4
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -7
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +116 -66
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +37 -5
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +65 -0
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +8 -1
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +8 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/types/index.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
- package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
|
@@ -17,7 +17,8 @@ import { startScenarioCapture } from './startScenarioCapture';
|
|
|
17
17
|
import { createController } from './controller/startController';
|
|
18
18
|
import { awsLog, awsLogDebugLevel } from '~codeyam/utils';
|
|
19
19
|
import * as v8 from 'v8';
|
|
20
|
-
import
|
|
20
|
+
import * as os from 'os';
|
|
21
|
+
import { initializeAIServiceMode, destroyWorkerPool } from '~codeyam/ai';
|
|
21
22
|
import runAnalysis, { EnvConfig, SharedContext } from './runAnalysis';
|
|
22
23
|
import {
|
|
23
24
|
loadOrCreateCommit,
|
|
@@ -119,28 +120,31 @@ async function main({
|
|
|
119
120
|
// and attempted to access project/commit/branch data before it was loaded.
|
|
120
121
|
const sharedContext = await loadSharedContext(envConfig);
|
|
121
122
|
|
|
122
|
-
//
|
|
123
|
+
// Memory monitoring: tracks both V8 heap and RSS (which includes worker threads)
|
|
124
|
+
const containerMemoryMB = process.env.ECS_CONTAINER_MEMORY_MB
|
|
125
|
+
? parseInt(process.env.ECS_CONTAINER_MEMORY_MB, 10)
|
|
126
|
+
: Math.round(os.totalmem() / 1024 / 1024);
|
|
123
127
|
let lastLogTime = 0;
|
|
124
128
|
setInterval(() => {
|
|
125
129
|
const mem = process.memoryUsage();
|
|
126
130
|
const heap = v8.getHeapStatistics();
|
|
127
|
-
const
|
|
131
|
+
const heapMB = Math.round(mem.heapUsed / 1024 / 1024);
|
|
132
|
+
const rssMB = Math.round(mem.rss / 1024 / 1024);
|
|
133
|
+
const heapLimitMB = Math.round(heap.heap_size_limit / 1024 / 1024);
|
|
134
|
+
const rssPercent = (rssMB / containerMemoryMB) * 100;
|
|
128
135
|
const now = Date.now();
|
|
129
136
|
|
|
130
|
-
if (
|
|
131
|
-
// High usage: warn every second
|
|
137
|
+
if (rssPercent >= 80) {
|
|
132
138
|
console.warn(
|
|
133
|
-
`CodeYam
|
|
139
|
+
`CodeYam Memory Warning: RSS ${rssMB}MB/${containerMemoryMB}MB (${Math.round(rssPercent)}%), heap ${heapMB}MB/${heapLimitMB}MB ⚠️ HIGH`,
|
|
134
140
|
);
|
|
135
|
-
} else if (
|
|
136
|
-
// Elevated usage: log every 5 seconds
|
|
141
|
+
} else if (rssPercent >= 50 && now - lastLogTime >= 5000) {
|
|
137
142
|
console.log(
|
|
138
|
-
`CodeYam
|
|
143
|
+
`CodeYam Memory Notice: RSS ${rssMB}MB/${containerMemoryMB}MB (${Math.round(rssPercent)}%), heap ${heapMB}MB/${heapLimitMB}MB ⚠️ Elevated`,
|
|
139
144
|
);
|
|
140
145
|
} else if (now - lastLogTime >= 30000) {
|
|
141
|
-
// Normal usage: log every 30 seconds
|
|
142
146
|
console.log(
|
|
143
|
-
`CodeYam
|
|
147
|
+
`CodeYam Memory Stats: RSS ${rssMB}MB/${containerMemoryMB}MB (${Math.round(rssPercent)}%), heap ${heapMB}MB/${heapLimitMB}MB 📊 OK`,
|
|
144
148
|
);
|
|
145
149
|
}
|
|
146
150
|
|
|
@@ -187,6 +191,11 @@ async function main({
|
|
|
187
191
|
analyzerPid: undefined,
|
|
188
192
|
capturePid: process.pid,
|
|
189
193
|
},
|
|
194
|
+
updateCallback(metadata) {
|
|
195
|
+
if (metadata.currentRun?.captureCompletedAt) {
|
|
196
|
+
metadata.currentRun.completedAt = new Date().toISOString();
|
|
197
|
+
}
|
|
198
|
+
},
|
|
190
199
|
}).catch((error) => {
|
|
191
200
|
awsLog(`Warning: Failed to update commit metadata: ${error}`);
|
|
192
201
|
});
|
|
@@ -219,6 +228,10 @@ async function main({
|
|
|
219
228
|
}
|
|
220
229
|
awsLog('CodeYam: Analysis producing, starting orchestration...');
|
|
221
230
|
|
|
231
|
+
// Worker pool is no longer needed after data structure prep phase.
|
|
232
|
+
// Freeing it reclaims ~2GB before capture workers ramp up.
|
|
233
|
+
await destroyWorkerPool();
|
|
234
|
+
|
|
222
235
|
// Create task runner based on orchestration mode
|
|
223
236
|
let taskRunner;
|
|
224
237
|
|
|
@@ -229,6 +242,17 @@ async function main({
|
|
|
229
242
|
framework: framework,
|
|
230
243
|
packageManager: packageManager,
|
|
231
244
|
});
|
|
245
|
+
|
|
246
|
+
const captureCommit =
|
|
247
|
+
sharedContext.commit ?? sharedContext.branchCommit;
|
|
248
|
+
if (captureCommit) {
|
|
249
|
+
await updateCommitMetadata({
|
|
250
|
+
commitId: captureCommit.id,
|
|
251
|
+
runStatusUpdate: {
|
|
252
|
+
captureTaskArns: taskRunner.getTaskArns(),
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
232
256
|
} else if (orchestrateCapture === 'local-sequential') {
|
|
233
257
|
taskRunner = await SequentialCaptureTaskRunner.create(
|
|
234
258
|
{
|
|
@@ -43,6 +43,108 @@ function normalizeParamsMockData(
|
|
|
43
43
|
return result;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Convert comma-separated string values to arrays when they look like array data.
|
|
48
|
+
* This handles cases where the LLM generates strings like "color,size" instead
|
|
49
|
+
* of arrays like ["color", "size"] due to schema type misdetection.
|
|
50
|
+
*/
|
|
51
|
+
function convertCommaSeparatedStringsToArrays(
|
|
52
|
+
mockData: Record<string, unknown>,
|
|
53
|
+
): Record<string, unknown> {
|
|
54
|
+
const result: Record<string, unknown> = {};
|
|
55
|
+
|
|
56
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
57
|
+
if (typeof value === 'string') {
|
|
58
|
+
const asArray = parseCommaSeparatedStringAsArray(value, key);
|
|
59
|
+
if (asArray !== null) {
|
|
60
|
+
result[key] = asArray;
|
|
61
|
+
console.log(
|
|
62
|
+
`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`,
|
|
63
|
+
);
|
|
64
|
+
} else {
|
|
65
|
+
result[key] = value;
|
|
66
|
+
}
|
|
67
|
+
} else if (
|
|
68
|
+
value !== null &&
|
|
69
|
+
typeof value === 'object' &&
|
|
70
|
+
!Array.isArray(value)
|
|
71
|
+
) {
|
|
72
|
+
// Recursively process nested objects
|
|
73
|
+
result[key] = convertCommaSeparatedStringsToArrays(
|
|
74
|
+
value as Record<string, unknown>,
|
|
75
|
+
);
|
|
76
|
+
} else if (Array.isArray(value)) {
|
|
77
|
+
// Recursively process arrays (each element could be an object)
|
|
78
|
+
result[key] = value.map((item) => {
|
|
79
|
+
if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
|
|
80
|
+
return convertCommaSeparatedStringsToArrays(
|
|
81
|
+
item as Record<string, unknown>,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return item;
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
result[key] = value;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Detect if a string looks like a comma-separated list that should be an array.
|
|
96
|
+
*/
|
|
97
|
+
function parseCommaSeparatedStringAsArray(
|
|
98
|
+
value: string,
|
|
99
|
+
key: string,
|
|
100
|
+
): string[] | null {
|
|
101
|
+
if (!value.includes(',')) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Heuristic: if the key name suggests it's an array field, convert it
|
|
106
|
+
// Check this FIRST before sentence detection, since "color, size" looks like
|
|
107
|
+
// a sentence but should be converted to ["color", "size"] for _attributes fields
|
|
108
|
+
const arrayFieldPatterns = [
|
|
109
|
+
/_attributes$/i,
|
|
110
|
+
/_ids$/i,
|
|
111
|
+
/_items$/i,
|
|
112
|
+
/_tags$/i,
|
|
113
|
+
/_values$/i,
|
|
114
|
+
/_types$/i,
|
|
115
|
+
/_names$/i,
|
|
116
|
+
/_keys$/i,
|
|
117
|
+
/^attributes$/i,
|
|
118
|
+
/^items$/i,
|
|
119
|
+
/^tags$/i,
|
|
120
|
+
/^values$/i,
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
const looksLikeArrayField = arrayFieldPatterns.some((pattern) =>
|
|
124
|
+
pattern.test(key),
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (looksLikeArrayField) {
|
|
128
|
+
// For array-like fields, only reject if it contains newlines (likely prose)
|
|
129
|
+
if (value.includes('\n')) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const parts = value.split(',').map((s) => s.trim());
|
|
133
|
+
return parts.filter((s) => s.length > 0);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// For non-array-named fields, apply stricter sentence detection
|
|
137
|
+
// Looks like a sentence: "Hello, world"
|
|
138
|
+
if (/,\s+[a-z]/.test(value)) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
if (value.includes('\n')) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
46
148
|
/**
|
|
47
149
|
* Return true when `markup` contains 0 or >1 meaningful
|
|
48
150
|
* top-level nodes (element *or* non-blank text), so React
|
|
@@ -749,11 +851,16 @@ export default async function writeMockDataTsx(
|
|
|
749
851
|
|
|
750
852
|
// Reconcile mock data keys to match expected keys from dataForMocks
|
|
751
853
|
// This handles cases where LLM generated literal values instead of variable references
|
|
752
|
-
const
|
|
854
|
+
const reconciledMockData = reconcileMockDataKeys(
|
|
753
855
|
rawDefaultMockData,
|
|
754
856
|
expectedKeys,
|
|
755
857
|
);
|
|
756
858
|
|
|
859
|
+
// Convert comma-separated strings to arrays for fields that should be arrays
|
|
860
|
+
// This handles cases where LLM generates "color,size" instead of ["color", "size"]
|
|
861
|
+
const defaultMockData =
|
|
862
|
+
convertCommaSeparatedStringsToArrays(reconciledMockData);
|
|
863
|
+
|
|
757
864
|
const mockDataComment = `// This file is auto-generated by CodeYam. Do not edit this file manually.
|
|
758
865
|
// This file contains mock data required for:
|
|
759
866
|
// Scenario: ${mockScenario.id} - ${mockScenario.name}
|
|
@@ -791,11 +898,16 @@ import React from 'react';
|
|
|
791
898
|
};
|
|
792
899
|
|
|
793
900
|
// Reconcile scenario-specific mock data keys as well
|
|
794
|
-
const
|
|
901
|
+
const reconciledScenarioMockData = reconcileMockDataKeys(
|
|
795
902
|
rawScenarioMockData,
|
|
796
903
|
expectedKeys,
|
|
797
904
|
);
|
|
798
905
|
|
|
906
|
+
// Convert comma-separated strings to arrays for scenario data
|
|
907
|
+
const scenarioMockData = convertCommaSeparatedStringsToArrays(
|
|
908
|
+
reconciledScenarioMockData,
|
|
909
|
+
);
|
|
910
|
+
|
|
799
911
|
const mergedArguments = defaultArguments.map((defaultArg, index) => {
|
|
800
912
|
return deepMerge(defaultArg, scenarioArguments[index]);
|
|
801
913
|
});
|
|
@@ -1205,6 +1205,21 @@ function addMockToContent(
|
|
|
1205
1205
|
fileContent = fileContent.replace(importRegExp, '$1$2');
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
|
+
// Also handle namespace imports (import * as foo from '...')
|
|
1209
|
+
// These need to be renamed to foo__cyOriginal when the mock code spreads from the original.
|
|
1210
|
+
// Note: We match any path (not just escapedImportPath) because the import path may have
|
|
1211
|
+
// been rewritten by transitive import handling before this code runs.
|
|
1212
|
+
if (shouldRenameToOriginal) {
|
|
1213
|
+
const namespaceImportRegExp = new RegExp(
|
|
1214
|
+
`(import\\s+\\*\\s+as\\s+)${escapeRegExp(firstPart)}(\\s+from\\s+['"][^'"]*['"])`,
|
|
1215
|
+
'm',
|
|
1216
|
+
);
|
|
1217
|
+
fileContent = fileContent.replace(
|
|
1218
|
+
namespaceImportRegExp,
|
|
1219
|
+
`$1${firstPart}__cyOriginal$2`,
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1208
1223
|
// Remove empty imports entirely to avoid partial commenting issues with multiline imports
|
|
1209
1224
|
// This handles both single-line and multiline empty imports
|
|
1210
1225
|
fileContent = fileContent.replace(
|
|
@@ -1698,9 +1713,16 @@ export default async function writeScenarioComponents({
|
|
|
1698
1713
|
});
|
|
1699
1714
|
|
|
1700
1715
|
let importedExportIndex = 0;
|
|
1716
|
+
const loopStartTime = Date.now();
|
|
1717
|
+
console.log(
|
|
1718
|
+
`[WriteScenario] Starting import loop for ${entity.name}: ${sortedImportedExports.length} imports`,
|
|
1719
|
+
);
|
|
1701
1720
|
for (const importedExport of sortedImportedExports) {
|
|
1702
1721
|
importedExportIndex++;
|
|
1703
1722
|
if (importedExportIndex % 5 === 0 || importedExportIndex === 1) {
|
|
1723
|
+
console.log(
|
|
1724
|
+
`[WriteScenario] ${entity.name} import ${importedExportIndex}/${sortedImportedExports.length}: ${importedExport.name} elapsed=${Date.now() - loopStartTime}ms`,
|
|
1725
|
+
);
|
|
1704
1726
|
debugLog(
|
|
1705
1727
|
`Processing importedExport ${importedExportIndex}/${sortedImportedExports.length}`,
|
|
1706
1728
|
{
|
|
@@ -1888,6 +1910,10 @@ export default async function writeScenarioComponents({
|
|
|
1888
1910
|
importedExport.resolvedIsDefault === true &&
|
|
1889
1911
|
importedExport.isDefault === false;
|
|
1890
1912
|
|
|
1913
|
+
console.log(
|
|
1914
|
+
`[WriteScenario] RECURSE START: ${entity.name} -> ${importedExportEntity.name}`,
|
|
1915
|
+
);
|
|
1916
|
+
const recurseStartTime = Date.now();
|
|
1891
1917
|
debugLog(
|
|
1892
1918
|
`Recursing into writeScenarioComponents for ${importedExportEntity.name}`,
|
|
1893
1919
|
{
|
|
@@ -1919,7 +1945,10 @@ export default async function writeScenarioComponents({
|
|
|
1919
1945
|
? importedExport.name
|
|
1920
1946
|
: undefined,
|
|
1921
1947
|
}),
|
|
1922
|
-
|
|
1948
|
+
180000, // 3 minute timeout for recursive calls (complex components need more time)
|
|
1949
|
+
);
|
|
1950
|
+
console.log(
|
|
1951
|
+
`[WriteScenario] RECURSE END: ${entity.name} -> ${importedExportEntity.name} took ${Date.now() - recurseStartTime}ms`,
|
|
1923
1952
|
);
|
|
1924
1953
|
debugLog(
|
|
1925
1954
|
`Completed recursive writeScenarioComponents for ${importedExportEntity.name}`,
|
|
@@ -2261,6 +2290,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2261
2290
|
}
|
|
2262
2291
|
}
|
|
2263
2292
|
|
|
2293
|
+
// Track post-import-loop timing
|
|
2294
|
+
const postLoopStartTime = Date.now();
|
|
2295
|
+
console.log(`[WriteScenario] POST-LOOP START: ${entity.name}`);
|
|
2296
|
+
|
|
2264
2297
|
// Collect universal mocks BEFORE processing nodeModuleImports
|
|
2265
2298
|
// This is needed to check if a node module import is handled by a universal mock
|
|
2266
2299
|
const universalMocks = project.metadata?.universalMocks ?? [];
|
|
@@ -2320,6 +2353,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2320
2353
|
);
|
|
2321
2354
|
}
|
|
2322
2355
|
|
|
2356
|
+
console.log(
|
|
2357
|
+
`[WriteScenario] POST-LOOP ${entity.name}: node+universal mocks took ${Date.now() - postLoopStartTime}ms`,
|
|
2358
|
+
);
|
|
2359
|
+
|
|
2323
2360
|
if (
|
|
2324
2361
|
rootAnalysis.entitySha === entity.sha &&
|
|
2325
2362
|
entity.metadata?.notExported &&
|
|
@@ -2398,6 +2435,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2398
2435
|
);
|
|
2399
2436
|
debugLog('Completed rewriteRelativeModuleImports');
|
|
2400
2437
|
|
|
2438
|
+
console.log(
|
|
2439
|
+
`[WriteScenario] POST-LOOP ${entity.name}: transformations took ${Date.now() - postLoopStartTime}ms`,
|
|
2440
|
+
);
|
|
2441
|
+
|
|
2401
2442
|
/**
|
|
2402
2443
|
* Recursively process a file's imports to create transitive copies with server-only stripped.
|
|
2403
2444
|
* This handles chains of arbitrary depth: A -> B -> C -> D where each needs server-only removed.
|
|
@@ -2418,7 +2459,7 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2418
2459
|
startTime: number = Date.now(),
|
|
2419
2460
|
): Promise<string> {
|
|
2420
2461
|
// Global timeout for entire transitive processing
|
|
2421
|
-
const GLOBAL_TIMEOUT_MS =
|
|
2462
|
+
const GLOBAL_TIMEOUT_MS = 180000; // 3 minutes max for all transitive processing (complex components need more time)
|
|
2422
2463
|
const elapsed = Date.now() - startTime;
|
|
2423
2464
|
if (elapsed > GLOBAL_TIMEOUT_MS) {
|
|
2424
2465
|
throw new Error(
|
|
@@ -2427,6 +2468,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2427
2468
|
}
|
|
2428
2469
|
|
|
2429
2470
|
const importPaths = extractInternalImportPaths(content);
|
|
2471
|
+
// Always log to help debug timeout issues
|
|
2472
|
+
console.log(
|
|
2473
|
+
`[TransitiveImports] depth=${depth} file=${path.basename(sourceFilePath)} imports=${importPaths.length} visited=${visitedPaths.size} elapsed=${Date.now() - startTime}ms`,
|
|
2474
|
+
);
|
|
2430
2475
|
debugLog(`processTransitiveImportsRecursively depth=${depth}`, {
|
|
2431
2476
|
sourceFilePath,
|
|
2432
2477
|
importCount: importPaths.length,
|
|
@@ -2481,8 +2526,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2481
2526
|
);
|
|
2482
2527
|
const extension = importFile.name.split('.').pop();
|
|
2483
2528
|
const isIndex = isIndexPath(importFile.path);
|
|
2484
|
-
|
|
2485
|
-
const
|
|
2529
|
+
// Limit pathHash length to prevent ENAMETOOLONG errors on macOS (255 char limit)
|
|
2530
|
+
const pathHash = safeFileName(importFile.path, { maxLength: 80 });
|
|
2531
|
+
const scenarioSlug = safeFileName(scenario.name, { maxLength: 60 });
|
|
2532
|
+
const transitiveFilePath = `${PROJECT_RELATIVE_PATH}/${basePath}/${pathHash}_${isIndex ? 'index_' : ''}transitive_${scenarioSlug}.${extension}`;
|
|
2486
2533
|
|
|
2487
2534
|
// Check if this is a circular import (we're already processing this file)
|
|
2488
2535
|
const isCircularImport = visitedPaths.has(resolvedPath);
|
|
@@ -2606,6 +2653,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2606
2653
|
return modifiedContent;
|
|
2607
2654
|
}
|
|
2608
2655
|
|
|
2656
|
+
console.log(
|
|
2657
|
+
`[WriteScenario] POST-LOOP ${entity.name}: before remaining imports ${Date.now() - postLoopStartTime}ms`,
|
|
2658
|
+
);
|
|
2659
|
+
|
|
2609
2660
|
// Process remaining internal imports that weren't in importedExports
|
|
2610
2661
|
// This handles transitive dependencies: when the file content includes code (e.g., from
|
|
2611
2662
|
// other functions in the same file) that imports from files with "server-only"
|
|
@@ -2681,8 +2732,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2681
2732
|
);
|
|
2682
2733
|
const targetFileExtension = targetFile.name.split('.').pop();
|
|
2683
2734
|
const targetFileIsIndex = isIndexPath(targetFile.path);
|
|
2684
|
-
|
|
2685
|
-
const
|
|
2735
|
+
// Limit path hash length to prevent ENAMETOOLONG errors
|
|
2736
|
+
const filePathHash = safeFileName(targetFile.path, { maxLength: 80 });
|
|
2737
|
+
const targetScenarioSlug = safeFileName(scenario.name, { maxLength: 60 });
|
|
2738
|
+
const transformedFilePath = `${PROJECT_RELATIVE_PATH}/${targetFileBasePath}/${filePathHash}_${targetFileIsIndex ? 'index_' : ''}transitive_${targetScenarioSlug}.${targetFileExtension}`;
|
|
2686
2739
|
|
|
2687
2740
|
// Check if we've already processed this file as a transitive copy
|
|
2688
2741
|
// Note: __data_file_written__ is for entity-specific scenario files with different naming,
|
|
@@ -2737,8 +2790,12 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2737
2790
|
);
|
|
2738
2791
|
const nestedExtension = nestedFile.name.split('.').pop();
|
|
2739
2792
|
const nestedIsIndex = isIndexPath(nestedFile.path);
|
|
2740
|
-
|
|
2741
|
-
const
|
|
2793
|
+
// Limit path hash length to prevent ENAMETOOLONG errors
|
|
2794
|
+
const nestedPathHash = safeFileName(nestedFile.path, { maxLength: 80 });
|
|
2795
|
+
const nestedScenarioSlug = safeFileName(scenario.name, {
|
|
2796
|
+
maxLength: 60,
|
|
2797
|
+
});
|
|
2798
|
+
const nestedTransformedPath = `${PROJECT_RELATIVE_PATH}/${nestedBasePath}/${nestedPathHash}_${nestedIsIndex ? 'index_' : ''}transitive_${nestedScenarioSlug}.${nestedExtension}`;
|
|
2742
2799
|
|
|
2743
2800
|
// Check if already processed as a transitive file (we can rewrite to point to it)
|
|
2744
2801
|
// Note: __data_file_written__ is for entity-specific scenario files with different naming,
|
|
@@ -2859,6 +2916,10 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2859
2916
|
fileContent = fileContent.replace(importRegex, `$1${safeRelativePath}$2`);
|
|
2860
2917
|
}
|
|
2861
2918
|
|
|
2919
|
+
console.log(
|
|
2920
|
+
`[WriteScenario] POST-LOOP ${entity.name}: remaining imports loop took ${Date.now() - postLoopStartTime}ms`,
|
|
2921
|
+
);
|
|
2922
|
+
|
|
2862
2923
|
const scenarioComponentComment = `// This file is auto-generated by CodeYam. Do not edit this file manually.
|
|
2863
2924
|
// This file contains content for a scenario component:
|
|
2864
2925
|
// Analyses being written: ${JSON.stringify(fileAnalyses?.map((a) => ({ id: a.id, entityName: a.entityName })))}
|
|
@@ -2870,6 +2931,34 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2870
2931
|
// Scenario: ${scenario.id} - ${scenario.name}
|
|
2871
2932
|
`;
|
|
2872
2933
|
|
|
2934
|
+
// Final pass: Rename any namespace imports (import * as X from '...') that have
|
|
2935
|
+
// corresponding mock code using ...X__cyOriginal spread pattern.
|
|
2936
|
+
// This handles cases where:
|
|
2937
|
+
// 1. The import path was rewritten by transitive import handling
|
|
2938
|
+
// 2. The import wasn't caught by the earlier renaming logic
|
|
2939
|
+
// We scan for all __cyOriginal references in the mock code and ensure the imports are renamed.
|
|
2940
|
+
const cyOriginalReferences = fileContent.match(/\.\.\.(\w+)__cyOriginal/g);
|
|
2941
|
+
if (cyOriginalReferences) {
|
|
2942
|
+
const uniqueNames = [
|
|
2943
|
+
...new Set(
|
|
2944
|
+
cyOriginalReferences.map((ref) =>
|
|
2945
|
+
ref.replace('...', '').replace('__cyOriginal', ''),
|
|
2946
|
+
),
|
|
2947
|
+
),
|
|
2948
|
+
];
|
|
2949
|
+
for (const name of uniqueNames) {
|
|
2950
|
+
// Match namespace imports for this name that haven't been renamed yet
|
|
2951
|
+
const namespaceImportRegex = new RegExp(
|
|
2952
|
+
`(import\\s+\\*\\s+as\\s+)${escapeRegExp(name)}(\\s+from\\s+['"][^'"]*['"])`,
|
|
2953
|
+
'g',
|
|
2954
|
+
);
|
|
2955
|
+
fileContent = fileContent.replace(
|
|
2956
|
+
namespaceImportRegex,
|
|
2957
|
+
`$1${name}__cyOriginal$2`,
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2873
2962
|
// Use the directive that was extracted at the beginning of processing
|
|
2874
2963
|
// This ensures it stays at the very top even after imports are prepended
|
|
2875
2964
|
// NOTE: We only preserve "use client" directives, NOT "use server" directives.
|
|
@@ -2891,5 +2980,9 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
|
|
|
2891
2980
|
debugLog('Successfully wrote scenario file');
|
|
2892
2981
|
scenarioComponentPaths.push(scenarioComponentPath);
|
|
2893
2982
|
|
|
2983
|
+
console.log(
|
|
2984
|
+
`[WriteScenario] POST-LOOP ${entity.name}: COMPLETE total=${Date.now() - postLoopStartTime}ms`,
|
|
2985
|
+
);
|
|
2986
|
+
|
|
2894
2987
|
return { scenarioComponentPaths, writtenScenarioComponents };
|
|
2895
2988
|
}
|
|
@@ -121,10 +121,11 @@ const validateFiles = async () => {
|
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
const createLinePrefixer = (stream, processName, outputStream) => {
|
|
124
|
+
const createLinePrefixer = (stream, processName, outputStream, onActivity) => {
|
|
125
125
|
let buffer = '';
|
|
126
126
|
|
|
127
127
|
stream.on('data', (chunk) => {
|
|
128
|
+
if (onActivity) onActivity();
|
|
128
129
|
buffer += chunk.toString();
|
|
129
130
|
const lines = buffer.split('\n');
|
|
130
131
|
|
|
@@ -147,19 +148,20 @@ const createLinePrefixer = (stream, processName, outputStream) => {
|
|
|
147
148
|
};
|
|
148
149
|
|
|
149
150
|
const spawnProcess = (command, args, processName, env = {}) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
env: { ...process.env, ...env },
|
|
155
|
-
});
|
|
151
|
+
const childProcess = spawn(command, args, {
|
|
152
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
153
|
+
env: { ...process.env, ...env },
|
|
154
|
+
});
|
|
156
155
|
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
console.log(`Started ${processName} process with PID ${childProcess.pid}`);
|
|
157
|
+
childProcesses.add(childProcess);
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
let lastActivityTime = Date.now();
|
|
160
|
+
const updateActivity = () => { lastActivityTime = Date.now(); };
|
|
161
|
+
|
|
162
|
+
const promise = new Promise((resolve, reject) => {
|
|
163
|
+
createLinePrefixer(childProcess.stdout, processName, process.stdout, updateActivity);
|
|
164
|
+
createLinePrefixer(childProcess.stderr, processName, process.stderr, updateActivity);
|
|
163
165
|
|
|
164
166
|
childProcess.on('close', (code, signal) => {
|
|
165
167
|
console.log(
|
|
@@ -169,7 +171,6 @@ const spawnProcess = (command, args, processName, env = {}) => {
|
|
|
169
171
|
if (code === 0) {
|
|
170
172
|
resolve();
|
|
171
173
|
} else if (code === null && signal && isCleaningUp) {
|
|
172
|
-
// Process was killed by signal during cleanup - this is expected, not an error
|
|
173
174
|
console.log(
|
|
174
175
|
`${processName} process was terminated by ${signal} during cleanup`,
|
|
175
176
|
);
|
|
@@ -189,11 +190,13 @@ const spawnProcess = (command, args, processName, env = {}) => {
|
|
|
189
190
|
reject(error);
|
|
190
191
|
});
|
|
191
192
|
});
|
|
193
|
+
|
|
194
|
+
return { promise, childProcess, getLastActivity: () => lastActivityTime };
|
|
192
195
|
};
|
|
193
196
|
|
|
194
197
|
const startPlaywrightCapture = () => {
|
|
195
198
|
console.log('Starting Playwright capture service...');
|
|
196
|
-
|
|
199
|
+
const { promise } = spawnProcess(
|
|
197
200
|
'node',
|
|
198
201
|
[
|
|
199
202
|
'--enable-source-maps',
|
|
@@ -204,40 +207,65 @@ const startPlaywrightCapture = () => {
|
|
|
204
207
|
'playwright',
|
|
205
208
|
{ PROJECT_URL: 'http://localhost:3000' },
|
|
206
209
|
);
|
|
210
|
+
return promise;
|
|
207
211
|
};
|
|
208
212
|
|
|
209
213
|
const runProjectSimulation = async (analysisIds) => {
|
|
210
|
-
|
|
211
|
-
// server now uses rsync, so project directory is guaranteed clean, just ensure it exists
|
|
212
|
-
await fs.mkdir(FIXED_PROJECT_PATH, { recursive: true });
|
|
214
|
+
await fs.mkdir(FIXED_PROJECT_PATH, { recursive: true });
|
|
213
215
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
const analysisIdString = analysisIds.join(',');
|
|
217
|
+
console.log(
|
|
218
|
+
`Starting project simulation for analysis IDs: ${analysisIdString}`,
|
|
219
|
+
);
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
221
|
+
return spawnProcess(
|
|
222
|
+
'node',
|
|
223
|
+
[
|
|
224
|
+
'--enable-source-maps',
|
|
225
|
+
'./dist/project/start.js',
|
|
226
|
+
'--packageManager',
|
|
227
|
+
process.env.PACKAGE_MANAGER,
|
|
228
|
+
'--absoluteProjectRootPath',
|
|
229
|
+
FIXED_PROJECT_PATH,
|
|
230
|
+
'--absoluteTempPath',
|
|
231
|
+
FIXED_TEMP_PATH,
|
|
232
|
+
'--port',
|
|
233
|
+
'3000',
|
|
234
|
+
'--framework',
|
|
235
|
+
process.env.FRAMEWORK,
|
|
236
|
+
],
|
|
237
|
+
'project',
|
|
238
|
+
{ ANALYSIS_IDS: analysisIdString, READY_TO_BE_CAPTURED: 'true' },
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const killChildProcess = async (childProcess, processName) => {
|
|
243
|
+
if (!childProcess || childProcess.exitCode !== null || childProcess.killed) {
|
|
244
|
+
return;
|
|
240
245
|
}
|
|
246
|
+
console.log(`Killing ${processName} process (PID ${childProcess.pid}) after timeout/stall`);
|
|
247
|
+
try {
|
|
248
|
+
process.kill(childProcess.pid, 'SIGTERM');
|
|
249
|
+
} catch (err) { /* already dead */ }
|
|
250
|
+
|
|
251
|
+
await new Promise((resolve) => {
|
|
252
|
+
const checkInterval = setInterval(() => {
|
|
253
|
+
if (!isProcessAlive(childProcess.pid)) {
|
|
254
|
+
clearInterval(checkInterval);
|
|
255
|
+
resolve();
|
|
256
|
+
}
|
|
257
|
+
}, 500);
|
|
258
|
+
setTimeout(() => {
|
|
259
|
+
clearInterval(checkInterval);
|
|
260
|
+
if (isProcessAlive(childProcess.pid)) {
|
|
261
|
+
try { process.kill(childProcess.pid, 'SIGKILL'); } catch (err) { /* ignore */ }
|
|
262
|
+
console.log(`Force-killed ${processName} process (PID ${childProcess.pid})`);
|
|
263
|
+
}
|
|
264
|
+
resolve();
|
|
265
|
+
}, 5000);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
childProcesses.delete(childProcess);
|
|
241
269
|
};
|
|
242
270
|
|
|
243
271
|
const isQueueNotExistsError = (error) => {
|
|
@@ -317,19 +345,38 @@ const processWorkMessage = async (sqs, message, queueUrl, controlQueueUrl) => {
|
|
|
317
345
|
}, timeoutMs);
|
|
318
346
|
});
|
|
319
347
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
runProjectSimulation(body.analysisIds),
|
|
324
|
-
timeoutPromise,
|
|
325
|
-
]);
|
|
348
|
+
let projectProcess = null;
|
|
349
|
+
let stallHandle = null;
|
|
350
|
+
let batchSuccess = false;
|
|
326
351
|
|
|
352
|
+
try {
|
|
353
|
+
const { promise: simulationPromise, childProcess, getLastActivity } =
|
|
354
|
+
await runProjectSimulation(body.analysisIds);
|
|
355
|
+
projectProcess = childProcess;
|
|
356
|
+
|
|
357
|
+
// Stall detection: abort if no output for 10 minutes
|
|
358
|
+
const STALL_TIMEOUT_MS = 10 * 60 * 1000;
|
|
359
|
+
const stallPromise = new Promise((_, reject) => {
|
|
360
|
+
stallHandle = setInterval(() => {
|
|
361
|
+
const silentMs = Date.now() - getLastActivity();
|
|
362
|
+
if (silentMs >= STALL_TIMEOUT_MS) {
|
|
363
|
+
reject(new Error(`Project process stalled (no output for ${Math.round(silentMs / 60000)} min)`));
|
|
364
|
+
}
|
|
365
|
+
}, 60000);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
await Promise.race([simulationPromise, timeoutPromise, stallPromise]);
|
|
369
|
+
|
|
370
|
+
batchSuccess = true;
|
|
327
371
|
console.log(`Successfully processed analysis IDs: ${analysisIdString}`);
|
|
328
372
|
} finally {
|
|
373
|
+
if (stallHandle) clearInterval(stallHandle);
|
|
329
374
|
if (visibilityInterval) clearInterval(visibilityInterval);
|
|
330
375
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
331
376
|
|
|
332
|
-
|
|
377
|
+
await killChildProcess(projectProcess, 'project');
|
|
378
|
+
|
|
379
|
+
// Send batch completion notification to control queue with success/failure status
|
|
333
380
|
try {
|
|
334
381
|
await sqs.send(
|
|
335
382
|
new SendMessageCommand({
|
|
@@ -337,11 +384,12 @@ const processWorkMessage = async (sqs, message, queueUrl, controlQueueUrl) => {
|
|
|
337
384
|
MessageBody: JSON.stringify({
|
|
338
385
|
type: 'batch_completed',
|
|
339
386
|
analysisIds: body.analysisIds,
|
|
387
|
+
success: batchSuccess,
|
|
340
388
|
}),
|
|
341
389
|
}),
|
|
342
390
|
);
|
|
343
391
|
console.log(
|
|
344
|
-
`Sent batch completion notification for ${body.analysisIds.length} analyses`,
|
|
392
|
+
`Sent batch completion notification (success=${batchSuccess}) for ${body.analysisIds.length} analyses`,
|
|
345
393
|
);
|
|
346
394
|
} catch (error) {
|
|
347
395
|
// Log error but don't fail - orchestrator will eventually timeout/abandon
|