gitnexus 1.6.8-rc.8 → 1.6.8
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/README.md +3 -3
- package/dist/_shared/graph/types.d.ts +31 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +11 -1
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +6 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/scope-resolution/parsed-file.d.ts +21 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +6 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +31 -1
- package/dist/cli/ai-context.js +18 -16
- package/dist/cli/analyze-config.js +11 -0
- package/dist/cli/analyze.d.ts +14 -0
- package/dist/cli/analyze.js +98 -0
- package/dist/cli/embedding-dims.d.ts +33 -0
- package/dist/cli/embedding-dims.js +39 -0
- package/dist/cli/eval-server.d.ts +8 -0
- package/dist/cli/eval-server.js +242 -2
- package/dist/cli/help-i18n.js +19 -0
- package/dist/cli/i18n/en.d.ts +15 -1
- package/dist/cli/i18n/en.js +15 -1
- package/dist/cli/i18n/resources.d.ts +29 -1
- package/dist/cli/i18n/zh-CN.d.ts +14 -0
- package/dist/cli/i18n/zh-CN.js +15 -1
- package/dist/cli/index.js +89 -1
- package/dist/cli/mcp.d.ts +6 -1
- package/dist/cli/mcp.js +26 -1
- package/dist/cli/optional-grammars.d.ts +6 -8
- package/dist/cli/optional-grammars.js +8 -11
- package/dist/cli/setup.d.ts +3 -1
- package/dist/cli/setup.js +67 -17
- package/dist/cli/skill-gen.js +2 -1
- package/dist/cli/tool.d.ts +19 -1
- package/dist/cli/tool.js +96 -3
- package/dist/core/embeddings/hf-env.d.ts +0 -66
- package/dist/core/embeddings/http-client.d.ts +7 -0
- package/dist/core/embeddings/http-client.js +5 -3
- package/dist/core/embeddings/server-mapping.d.ts +1 -1
- package/dist/core/embeddings/server-mapping.js +7 -3
- package/dist/core/graph/import-cycles.d.ts +10 -0
- package/dist/core/graph/import-cycles.js +103 -0
- package/dist/core/group/cross-impact.d.ts +2 -1
- package/dist/core/group/cross-impact.js +5 -1
- package/dist/core/group/extractors/grpc-patterns/proto.js +10 -6
- package/dist/core/group/extractors/http-patterns/kotlin.js +7 -7
- package/dist/core/group/extractors/http-route-extractor.d.ts +24 -0
- package/dist/core/group/extractors/http-route-extractor.js +22 -4
- package/dist/core/group/extractors/include-extractor.js +22 -13
- package/dist/core/group/sync.d.ts +27 -1
- package/dist/core/group/sync.js +0 -0
- package/dist/core/incremental/subgraph-extract.js +18 -1
- package/dist/core/ingestion/cfg/cfg-builder.d.ts +114 -0
- package/dist/core/ingestion/cfg/cfg-builder.js +196 -0
- package/dist/core/ingestion/cfg/collect.d.ts +51 -0
- package/dist/core/ingestion/cfg/collect.js +77 -0
- package/dist/core/ingestion/cfg/control-dependence.d.ts +58 -0
- package/dist/core/ingestion/cfg/control-dependence.js +182 -0
- package/dist/core/ingestion/cfg/control-flow-context.d.ts +106 -0
- package/dist/core/ingestion/cfg/control-flow-context.js +124 -0
- package/dist/core/ingestion/cfg/emit.d.ts +293 -0
- package/dist/core/ingestion/cfg/emit.js +646 -0
- package/dist/core/ingestion/cfg/post-dominators.d.ts +79 -0
- package/dist/core/ingestion/cfg/post-dominators.js +176 -0
- package/dist/core/ingestion/cfg/reaching-def-reason-codec.d.ts +106 -0
- package/dist/core/ingestion/cfg/reaching-def-reason-codec.js +133 -0
- package/dist/core/ingestion/cfg/reaching-defs-graph.d.ts +18 -0
- package/dist/core/ingestion/cfg/reaching-defs-graph.js +312 -0
- package/dist/core/ingestion/cfg/reaching-defs.d.ts +162 -0
- package/dist/core/ingestion/cfg/reaching-defs.js +785 -0
- package/dist/core/ingestion/cfg/synthetic-escape.d.ts +124 -0
- package/dist/core/ingestion/cfg/synthetic-escape.js +300 -0
- package/dist/core/ingestion/cfg/traversal-result.d.ts +20 -0
- package/dist/core/ingestion/cfg/traversal-result.js +2 -0
- package/dist/core/ingestion/cfg/types.d.ts +274 -0
- package/dist/core/ingestion/cfg/types.js +13 -0
- package/dist/core/ingestion/cfg/visitors/c-cpp-harvest.d.ts +111 -0
- package/dist/core/ingestion/cfg/visitors/c-cpp-harvest.js +541 -0
- package/dist/core/ingestion/cfg/visitors/c-cpp.d.ts +74 -0
- package/dist/core/ingestion/cfg/visitors/c-cpp.js +584 -0
- package/dist/core/ingestion/cfg/visitors/call-site-harvest.d.ts +195 -0
- package/dist/core/ingestion/cfg/visitors/call-site-harvest.js +350 -0
- package/dist/core/ingestion/cfg/visitors/csharp-harvest.d.ts +124 -0
- package/dist/core/ingestion/cfg/visitors/csharp-harvest.js +589 -0
- package/dist/core/ingestion/cfg/visitors/csharp.d.ts +87 -0
- package/dist/core/ingestion/cfg/visitors/csharp.js +867 -0
- package/dist/core/ingestion/cfg/visitors/dart-harvest.d.ts +278 -0
- package/dist/core/ingestion/cfg/visitors/dart-harvest.js +870 -0
- package/dist/core/ingestion/cfg/visitors/dart.d.ts +119 -0
- package/dist/core/ingestion/cfg/visitors/dart.js +836 -0
- package/dist/core/ingestion/cfg/visitors/go-harvest.d.ts +160 -0
- package/dist/core/ingestion/cfg/visitors/go-harvest.js +621 -0
- package/dist/core/ingestion/cfg/visitors/go.d.ts +108 -0
- package/dist/core/ingestion/cfg/visitors/go.js +638 -0
- package/dist/core/ingestion/cfg/visitors/java-harvest.d.ts +108 -0
- package/dist/core/ingestion/cfg/visitors/java-harvest.js +513 -0
- package/dist/core/ingestion/cfg/visitors/java.d.ts +101 -0
- package/dist/core/ingestion/cfg/visitors/java.js +812 -0
- package/dist/core/ingestion/cfg/visitors/kotlin-harvest.d.ts +253 -0
- package/dist/core/ingestion/cfg/visitors/kotlin-harvest.js +719 -0
- package/dist/core/ingestion/cfg/visitors/kotlin.d.ts +121 -0
- package/dist/core/ingestion/cfg/visitors/kotlin.js +809 -0
- package/dist/core/ingestion/cfg/visitors/php-harvest.d.ts +172 -0
- package/dist/core/ingestion/cfg/visitors/php-harvest.js +626 -0
- package/dist/core/ingestion/cfg/visitors/php.d.ts +96 -0
- package/dist/core/ingestion/cfg/visitors/php.js +721 -0
- package/dist/core/ingestion/cfg/visitors/python-harvest.d.ts +212 -0
- package/dist/core/ingestion/cfg/visitors/python-harvest.js +739 -0
- package/dist/core/ingestion/cfg/visitors/python.d.ts +103 -0
- package/dist/core/ingestion/cfg/visitors/python.js +558 -0
- package/dist/core/ingestion/cfg/visitors/ruby-harvest.d.ts +223 -0
- package/dist/core/ingestion/cfg/visitors/ruby-harvest.js +587 -0
- package/dist/core/ingestion/cfg/visitors/ruby.d.ts +112 -0
- package/dist/core/ingestion/cfg/visitors/ruby.js +756 -0
- package/dist/core/ingestion/cfg/visitors/rust-harvest.d.ts +324 -0
- package/dist/core/ingestion/cfg/visitors/rust-harvest.js +873 -0
- package/dist/core/ingestion/cfg/visitors/rust.d.ts +95 -0
- package/dist/core/ingestion/cfg/visitors/rust.js +558 -0
- package/dist/core/ingestion/cfg/visitors/scope-tree-harvest.d.ts +87 -0
- package/dist/core/ingestion/cfg/visitors/scope-tree-harvest.js +116 -0
- package/dist/core/ingestion/cfg/visitors/swift-harvest.d.ts +255 -0
- package/dist/core/ingestion/cfg/visitors/swift-harvest.js +679 -0
- package/dist/core/ingestion/cfg/visitors/swift.d.ts +116 -0
- package/dist/core/ingestion/cfg/visitors/swift.js +787 -0
- package/dist/core/ingestion/cfg/visitors/typescript-harvest.d.ts +149 -0
- package/dist/core/ingestion/cfg/visitors/typescript-harvest.js +1056 -0
- package/dist/core/ingestion/cfg/visitors/typescript.d.ts +66 -0
- package/dist/core/ingestion/cfg/visitors/typescript.js +583 -0
- package/dist/core/ingestion/import-resolvers/utils.js +2 -0
- package/dist/core/ingestion/language-provider.d.ts +23 -2
- package/dist/core/ingestion/languages/c-cpp.js +17 -5
- package/dist/core/ingestion/languages/cobol.js +4 -0
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +41 -2
- package/dist/core/ingestion/languages/cpp/captures.js +50 -1
- package/dist/core/ingestion/languages/cpp/conversion-rank.d.ts +2 -0
- package/dist/core/ingestion/languages/cpp/conversion-rank.js +89 -0
- package/dist/core/ingestion/languages/cpp/header-scan.d.ts +1 -1
- package/dist/core/ingestion/languages/cpp/header-scan.js +2 -2
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +7 -2
- package/dist/core/ingestion/languages/cpp/member-lookup.js +2 -1
- package/dist/core/ingestion/languages/cpp/query.js +23 -0
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +2 -1
- package/dist/core/ingestion/languages/csharp.js +2 -0
- package/dist/core/ingestion/languages/dart.js +2 -0
- package/dist/core/ingestion/languages/go.js +2 -0
- package/dist/core/ingestion/languages/java.js +3 -0
- package/dist/core/ingestion/languages/kotlin/query.js +3 -2
- package/dist/core/ingestion/languages/kotlin.js +8 -1
- package/dist/core/ingestion/languages/php.js +2 -0
- package/dist/core/ingestion/languages/python.js +2 -0
- package/dist/core/ingestion/languages/ruby.js +2 -0
- package/dist/core/ingestion/languages/rust.js +2 -0
- package/dist/core/ingestion/languages/swift.js +2 -0
- package/dist/core/ingestion/languages/typescript.js +5 -0
- package/dist/core/ingestion/languages/vue.js +6 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.js +6 -13
- package/dist/core/ingestion/method-extractors/generic.js +1 -0
- package/dist/core/ingestion/method-types.d.ts +2 -0
- package/dist/core/ingestion/model/symbol-table.d.ts +1 -0
- package/dist/core/ingestion/model/symbol-table.js +1 -0
- package/dist/core/ingestion/mro-processor.js +109 -0
- package/dist/core/ingestion/parsing-processor.js +44 -0
- package/dist/core/ingestion/pipeline-phases/call-summaries.d.ts +26 -0
- package/dist/core/ingestion/pipeline-phases/call-summaries.js +46 -0
- package/dist/core/ingestion/pipeline-phases/index.d.ts +2 -0
- package/dist/core/ingestion/pipeline-phases/index.js +2 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +0 -21
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +18 -1
- package/dist/core/ingestion/pipeline-phases/routes.d.ts +10 -0
- package/dist/core/ingestion/pipeline-phases/routes.js +30 -1
- package/dist/core/ingestion/pipeline-phases/taint-summaries.d.ts +30 -0
- package/dist/core/ingestion/pipeline-phases/taint-summaries.js +81 -0
- package/dist/core/ingestion/pipeline.d.ts +92 -10
- package/dist/core/ingestion/pipeline.js +11 -2
- package/dist/core/ingestion/scope-extractor.js +12 -2
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +9 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/callee-id-sink.d.ts +75 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/callee-id-sink.js +67 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +12 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +14 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +6 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +13 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +9 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +28 -2
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +4 -0
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +9 -0
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +6 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +174 -40
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +24 -0
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +276 -190
- package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +43 -3
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +75 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +349 -1
- package/dist/core/ingestion/scope-resolution/resolution-outcome.d.ts +1 -1
- package/dist/core/ingestion/taint/call-summary-codec.d.ts +75 -0
- package/dist/core/ingestion/taint/call-summary-codec.js +128 -0
- package/dist/core/ingestion/taint/call-summary-emit.d.ts +43 -0
- package/dist/core/ingestion/taint/call-summary-emit.js +70 -0
- package/dist/core/ingestion/taint/call-summary-harvest.d.ts +77 -0
- package/dist/core/ingestion/taint/call-summary-harvest.js +179 -0
- package/dist/core/ingestion/taint/call-summary-model.d.ts +47 -0
- package/dist/core/ingestion/taint/call-summary-model.js +25 -0
- package/dist/core/ingestion/taint/emit.d.ts +125 -0
- package/dist/core/ingestion/taint/emit.js +208 -0
- package/dist/core/ingestion/taint/interproc-emit.d.ts +50 -0
- package/dist/core/ingestion/taint/interproc-emit.js +88 -0
- package/dist/core/ingestion/taint/interproc-solver.d.ts +110 -0
- package/dist/core/ingestion/taint/interproc-solver.js +312 -0
- package/dist/core/ingestion/taint/match.d.ts +153 -0
- package/dist/core/ingestion/taint/match.js +278 -0
- package/dist/core/ingestion/taint/path-codec.d.ts +134 -0
- package/dist/core/ingestion/taint/path-codec.js +190 -0
- package/dist/core/ingestion/taint/propagate.d.ts +216 -0
- package/dist/core/ingestion/taint/propagate.js +659 -0
- package/dist/core/ingestion/taint/site-safety.d.ts +29 -0
- package/dist/core/ingestion/taint/site-safety.js +98 -0
- package/dist/core/ingestion/taint/source-sink-config.d.ts +107 -23
- package/dist/core/ingestion/taint/source-sink-config.js +35 -12
- package/dist/core/ingestion/taint/source-sink-registry.d.ts +6 -4
- package/dist/core/ingestion/taint/source-sink-registry.js +6 -4
- package/dist/core/ingestion/taint/summary-harvest-driver.d.ts +80 -0
- package/dist/core/ingestion/taint/summary-harvest-driver.js +179 -0
- package/dist/core/ingestion/taint/summary-harvest.d.ts +89 -0
- package/dist/core/ingestion/taint/summary-harvest.js +537 -0
- package/dist/core/ingestion/taint/summary-model.d.ts +200 -0
- package/dist/core/ingestion/taint/summary-model.js +86 -0
- package/dist/core/ingestion/taint/typescript-model.d.ts +38 -0
- package/dist/core/ingestion/taint/typescript-model.js +102 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +21 -0
- package/dist/core/ingestion/utils/env.d.ts +7 -0
- package/dist/core/ingestion/utils/env.js +12 -0
- package/dist/core/ingestion/utils/method-props.js +1 -0
- package/dist/core/ingestion/workers/clone-safety.d.ts +109 -0
- package/dist/core/ingestion/workers/clone-safety.js +465 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +23 -0
- package/dist/core/ingestion/workers/parse-worker.js +81 -53
- package/dist/core/ingestion/workers/post-result.d.ts +22 -0
- package/dist/core/ingestion/workers/post-result.js +87 -0
- package/dist/core/ingestion/workers/result-merge.d.ts +20 -0
- package/dist/core/ingestion/workers/result-merge.js +43 -0
- package/dist/core/ingestion/workers/worker-pool.d.ts +15 -40
- package/dist/core/ingestion/workers/worker-pool.js +43 -16
- package/dist/core/lbug/csv-generator.d.ts +51 -3
- package/dist/core/lbug/csv-generator.js +369 -255
- package/dist/core/lbug/lbug-adapter.d.ts +58 -18
- package/dist/core/lbug/lbug-adapter.js +346 -84
- package/dist/core/lbug/lbug-config.d.ts +19 -0
- package/dist/core/lbug/lbug-config.js +29 -0
- package/dist/core/lbug/pdg-emit-sink.d.ts +127 -0
- package/dist/core/lbug/pdg-emit-sink.js +358 -0
- package/dist/core/lbug/pool-adapter.d.ts +35 -0
- package/dist/core/lbug/pool-adapter.js +90 -1
- package/dist/core/lbug/rel-pair-routing.d.ts +54 -0
- package/dist/core/lbug/rel-pair-routing.js +140 -0
- package/dist/core/lbug/schema.d.ts +2 -2
- package/dist/core/lbug/schema.js +3 -0
- package/dist/core/logger.d.ts +0 -5
- package/dist/core/run-analyze.d.ts +96 -0
- package/dist/core/run-analyze.js +207 -3
- package/dist/core/tree-sitter/parser-loader.js +5 -4
- package/dist/core/tree-sitter/safe-parse.d.ts +0 -5
- package/dist/core/tree-sitter/vendored-grammars.d.ts +39 -0
- package/dist/core/tree-sitter/vendored-grammars.js +57 -0
- package/dist/core/wiki/generator.js +3 -1
- package/dist/core/wiki/graph-queries.d.ts +6 -0
- package/dist/core/wiki/graph-queries.js +9 -1
- package/dist/mcp/http-transport.d.ts +134 -0
- package/dist/mcp/http-transport.js +503 -0
- package/dist/mcp/local/local-backend.d.ts +110 -24
- package/dist/mcp/local/local-backend.js +1225 -19
- package/dist/mcp/local/pdg-impact.d.ts +384 -0
- package/dist/mcp/local/pdg-impact.js +1972 -0
- package/dist/mcp/resources.js +13 -1
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.js +214 -7
- package/dist/server/analyze-launch.d.ts +29 -0
- package/dist/server/analyze-launch.js +137 -0
- package/dist/server/analyze-upload.d.ts +33 -0
- package/dist/server/analyze-upload.js +123 -0
- package/dist/server/analyze-worker-ipc.d.ts +58 -0
- package/dist/server/analyze-worker-ipc.js +16 -0
- package/dist/server/analyze-worker.d.ts +17 -1
- package/dist/server/analyze-worker.js +7 -1
- package/dist/server/api.d.ts +17 -0
- package/dist/server/api.js +132 -168
- package/dist/server/git-clone.d.ts +43 -2
- package/dist/server/git-clone.js +211 -16
- package/dist/server/mcp-http.d.ts +5 -6
- package/dist/server/mcp-http.js +9 -82
- package/dist/server/middleware.d.ts +40 -0
- package/dist/server/middleware.js +92 -0
- package/dist/server/private-ip.d.ts +1 -0
- package/dist/server/private-ip.js +15 -0
- package/dist/server/upload-ingest.d.ts +56 -0
- package/dist/server/upload-ingest.js +276 -0
- package/dist/server/upload-paths.d.ts +37 -0
- package/dist/server/upload-paths.js +57 -0
- package/dist/server/upload-sweep.d.ts +20 -0
- package/dist/server/upload-sweep.js +57 -0
- package/dist/storage/git.js +5 -8
- package/dist/storage/parse-cache.d.ts +22 -1
- package/dist/storage/parse-cache.js +44 -10
- package/dist/storage/repo-manager.d.ts +121 -10
- package/dist/storage/repo-manager.js +43 -5
- package/dist/types/pipeline.d.ts +9 -0
- package/hooks/antigravity/gitnexus-antigravity-hook.cjs +110 -10
- package/hooks/claude/gitnexus-hook.cjs +110 -13
- package/hooks/claude/hook-db-lock-probe.cjs +513 -26
- package/package.json +8 -2
- package/scripts/assert-publish-grammar-coverage.cjs +31 -0
- package/scripts/build-tree-sitter-grammars.cjs +16 -10
- package/scripts/cross-platform-tests.ts +1 -0
- package/skills/gitnexus-debugging.md +16 -4
- package/skills/gitnexus-exploring.md +3 -3
- package/skills/gitnexus-guide.md +33 -0
- package/skills/gitnexus-pdg-query.md +89 -0
- package/skills/gitnexus-refactoring.md +1 -1
- package/skills/gitnexus-taint-analysis.md +178 -0
- package/vendor/tree-sitter-c/package.json +1 -1
- package/vendor/tree-sitter-dart/package.json +1 -1
- package/vendor/tree-sitter-kotlin/package.json +1 -1
- package/vendor/tree-sitter-proto/package.json +1 -1
- package/vendor/tree-sitter-swift/package.json +1 -1
- package/web/assets/{agent-CKPMqImC.js → agent-D3Xd7zZE.js} +123 -123
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-DxJw65fT.js +1 -0
- package/web/assets/architectureDiagram-UL44E2DR-ChH9xW-N.js +36 -0
- package/web/assets/{blockDiagram-7IZFK4PR-B4niSLvR.js → blockDiagram-7IZFK4PR-BkWhpzWB.js} +1 -1
- package/web/assets/{c4Diagram-Y2BXMSZH-DIzEXalR.js → c4Diagram-Y2BXMSZH-DtBvpzWD.js} +1 -1
- package/web/assets/{chunk-3SSMPTDK-BzGeeheI.js → chunk-3SSMPTDK-B4_etUhr.js} +2 -2
- package/web/assets/{chunk-5IMINLNL-CnTLsXIV.js → chunk-5IMINLNL-DOdTeQri.js} +1 -1
- package/web/assets/{chunk-5VCL7Z4A-w1BCx98Z.js → chunk-5VCL7Z4A-CQ-2dYWj.js} +1 -1
- package/web/assets/chunk-6764PJDD-DpIS7hxD.js +1 -0
- package/web/assets/{chunk-67TQ5CYL-CChC2cAv.js → chunk-67TQ5CYL-4sNPJU1q.js} +3 -3
- package/web/assets/{chunk-7W6UQGC5-CgFyfZ6k.js → chunk-7W6UQGC5-KyEG0HQg.js} +1 -1
- package/web/assets/{chunk-AZZRMDJM-5E9ARdDQ.js → chunk-AZZRMDJM-y-xJBuMz.js} +1 -1
- package/web/assets/{chunk-INKRHTLW-ELpfuk9h.js → chunk-INKRHTLW-Nu4ri9P-.js} +1 -1
- package/web/assets/{chunk-JQRUD6KW-Dcq_Qnyy.js → chunk-JQRUD6KW-Dbva2Z17.js} +1 -1
- package/web/assets/{chunk-KGFNY3KK-W-VR57xb.js → chunk-KGFNY3KK-JGMJvKCK.js} +1 -1
- package/web/assets/chunk-KGYTTC2M-CWC_c3H9.js +161 -0
- package/web/assets/{chunk-KNLZD3CH-BuZBOcso.js → chunk-KNLZD3CH-BGlP6X9R.js} +1 -1
- package/web/assets/{chunk-KRXBNO2N-DH2NPM7I.js → chunk-KRXBNO2N-BW5o0KUN.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-Dfmux4m1.js → chunk-LCXTWHL2-zoomRtWX.js} +1 -1
- package/web/assets/{chunk-LII3EMHJ-3X33tCpU.js → chunk-LII3EMHJ-D-jm-dLa.js} +1 -1
- package/web/assets/{chunk-QA3QBVWF-D5Ha3GgB.js → chunk-QA3QBVWF-BgRW3SXd.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-CAkzcoRj.js → chunk-RG4AUYOV-DD0B2N2B.js} +1 -1
- package/web/assets/{chunk-T2UQINTJ-kGYG7ppP.js → chunk-T2UQINTJ-DSBqkzH7.js} +1 -1
- package/web/assets/chunk-T5OCTHI4-DdZvN-9i.js +1 -0
- package/web/assets/{chunk-UY5QBCOK-Du-c56gs.js → chunk-UY5QBCOK-DyF0vyGd.js} +1 -1
- package/web/assets/{chunk-W44A43WB-lrCpuupA.js → chunk-W44A43WB-JqMLIpR0.js} +1 -1
- package/web/assets/{chunk-ZXARS5L4-CSZRiyOf.js → chunk-ZXARS5L4-CxN8oiwI.js} +1 -1
- package/web/assets/classDiagram-KGZ6W3CR-DJm9BgF-.js +1 -0
- package/web/assets/classDiagram-v2-72OJOZXJ-DJm9BgF-.js +1 -0
- package/web/assets/{context-builder-_HS0v2ma.js → context-builder-BHiFUA8O.js} +10 -2
- package/web/assets/{cose-bilkent-UX7MHV2Q-BHv2bbtl.js → cose-bilkent-UX7MHV2Q-D71wNYRJ.js} +1 -1
- package/web/assets/dagre-ND4H6XIP-BIkxmhcu.js +4 -0
- package/web/assets/diagram-3NCE3AQN-BTa6iH0T.js +43 -0
- package/web/assets/diagram-GF46GFSD-DZDV0vBj.js +24 -0
- package/web/assets/{diagram-HNR7UZ2L-fUWreZzx.js → diagram-HNR7UZ2L-DFCfd5LI.js} +2 -2
- package/web/assets/diagram-QXG6HAR7-BzM--Jj0.js +24 -0
- package/web/assets/diagram-WEQXMOUZ-DFFwz0k4.js +10 -0
- package/web/assets/{erDiagram-L5TCEMPS-QN2eEP1e.js → erDiagram-L5TCEMPS-CfHMJJqo.js} +1 -1
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-BQm9QzEa.js +1 -0
- package/web/assets/{flowDiagram-H6V6AXG4-CXbXImlN.js → flowDiagram-H6V6AXG4-Be805QiJ.js} +3 -3
- package/web/assets/{ganttDiagram-JCBTUEKG-BHQssTz6.js → ganttDiagram-JCBTUEKG-D3iL2Aet.js} +1 -1
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-Cr_Bm2Nb.js +1 -0
- package/web/assets/gitGraphDiagram-S2ZK5IYY-CPIDgxGm.js +106 -0
- package/web/assets/index-BvYev1UJ.js +635 -0
- package/web/assets/index-_lgn7hs5.css +2 -0
- package/web/assets/info-J43DQDTF-KCYPFFUO-Cs4p2oyk.js +1 -0
- package/web/assets/infoDiagram-3YFTVSEB-Y7BKSoke.js +2 -0
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-6LKOvBfp.js → ishikawaDiagram-BNXS4ZKH-CT4SHFuI.js} +1 -1
- package/web/assets/{journeyDiagram-M6C3CM3L-DNPYCpvq.js → journeyDiagram-M6C3CM3L-CvArszLo.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-DgDi9oJT.js → kanban-definition-75IXJCU3-C6yDxr7N.js} +3 -3
- package/web/assets/{katex-K3KEBU37-CrVLz8l7.js → katex-K3KEBU37-CTc5BslQ.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-CwR5sBB-.js → mindmap-definition-2TDM6QVE-BOc2WEne.js} +1 -1
- package/web/assets/packet-YPE3B663-LP52Z2RK-CKCrztD2.js +1 -0
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-BB7pHqoD.js +1 -0
- package/web/assets/{pieDiagram-CU6KROY3-By8g6f6B.js → pieDiagram-CU6KROY3-Cvc0f_Pd.js} +1 -1
- package/web/assets/{quadrantDiagram-VICAPDV7-bAm6Hi_5.js → quadrantDiagram-VICAPDV7-yXSZ2lLz.js} +1 -1
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-DhoTOcuK.js +1 -0
- package/web/assets/{requirementDiagram-JXO7QTGE-7oDcJ1_J.js → requirementDiagram-JXO7QTGE-BRcZvHs4.js} +1 -1
- package/web/assets/{sankeyDiagram-URQDO5SZ-LFJz53u5.js → sankeyDiagram-URQDO5SZ-1qEjlFIB.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-FySeKCUy.js → sequenceDiagram-VS2MUI6T-PcSCuvrB.js} +3 -3
- package/web/assets/stateDiagram-7D4R322I-D6qYSV1E.js +1 -0
- package/web/assets/stateDiagram-v2-36443NZ5-Bg-ImOSX.js +1 -0
- package/web/assets/{timeline-definition-O6YCAMPW-Ds2CnVZK.js → timeline-definition-O6YCAMPW-QWkh01xw.js} +1 -1
- package/web/assets/treeView-BLDUP644-QA4HXRO3-ODehyGKL.js +1 -0
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-BfpgC-7o.js +1 -0
- package/web/assets/{vennDiagram-MWXL3ELB-DUIEwXWp.js → vennDiagram-MWXL3ELB-ak4DfwuM.js} +3 -3
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-CNeL6VHE.js +1 -0
- package/web/assets/{wardleyDiagram-CUQ6CDDI-DEiFPQih.js → wardleyDiagram-CUQ6CDDI-CTzR4Loq.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-BUbayhST.js → xychartDiagram-N2JHSOCM-DA1BEaQz.js} +1 -1
- package/web/index.html +13 -15
- package/scripts/materialize-vendor-grammars.cjs +0 -97
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-BETj2x4g.js +0 -1
- package/web/assets/architectureDiagram-UL44E2DR-D1EXI0zA.js +0 -36
- package/web/assets/chunk-2T2R6R2M-n6s9JZqv.js +0 -4
- package/web/assets/chunk-2UTLFMKG-CMBB1TMN.js +0 -1
- package/web/assets/chunk-4R4BOZG6-mKhL59ul.js +0 -159
- package/web/assets/chunk-6764PJDD-ChwMM2z4.js +0 -1
- package/web/assets/chunk-7J6CGLKN-DT-b53FT.js +0 -10
- package/web/assets/chunk-C62D2QBJ-CDAWj26E.js +0 -1
- package/web/assets/chunk-CEXFNPSA-D68Tk6ls.js +0 -1
- package/web/assets/chunk-CilyBKbf.js +0 -1
- package/web/assets/chunk-J5EP6P6S-DxWW0yvu.js +0 -1
- package/web/assets/chunk-KGYTTC2M-C6PHeuay.js +0 -1
- package/web/assets/chunk-RERM46MO-DQNbXtfw.js +0 -1
- package/web/assets/chunk-RKZBBQEN-BmTPLSyv.js +0 -1
- package/web/assets/chunk-RLI5ZMPA-DExu2DOK.js +0 -1
- package/web/assets/chunk-T5OCTHI4--9wWpVws.js +0 -1
- package/web/assets/chunk-UP6H54XL-DsKdC6jC.js +0 -1
- package/web/assets/chunk-UXSXWOXI-DR81EqLr.js +0 -1
- package/web/assets/classDiagram-KGZ6W3CR-Bv93af_b.js +0 -1
- package/web/assets/classDiagram-v2-72OJOZXJ-CLfEqHUa.js +0 -1
- package/web/assets/dagre-ND4H6XIP-DsIr9MOv.js +0 -4
- package/web/assets/diagram-3NCE3AQN-BqAtKUpW.js +0 -43
- package/web/assets/diagram-GF46GFSD-CaBG6n6o.js +0 -24
- package/web/assets/diagram-QXG6HAR7-CZ-O3rcV.js +0 -24
- package/web/assets/diagram-WEQXMOUZ-P4lSL4GH.js +0 -10
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-B3myHUst.js +0 -1
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-DF3rtf4A.js +0 -1
- package/web/assets/gitGraphDiagram-S2ZK5IYY-CCwVLT__.js +0 -106
- package/web/assets/index-BKWA-m7o.css +0 -2
- package/web/assets/index-CG6q8eTs.js +0 -626
- package/web/assets/info-J43DQDTF-KCYPFFUO-R4XV_akJ.js +0 -1
- package/web/assets/infoDiagram-3YFTVSEB-DmLICZx1.js +0 -2
- package/web/assets/packet-YPE3B663-LP52Z2RK-CgQPdNZa.js +0 -1
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-BzWOwc_c.js +0 -1
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-B7KG0FN7.js +0 -1
- package/web/assets/stateDiagram-7D4R322I-CB2nABwH.js +0 -1
- package/web/assets/stateDiagram-v2-36443NZ5-COBGd2RL.js +0 -1
- package/web/assets/treeView-BLDUP644-QA4HXRO3-CRSxEwLO.js +0 -1
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-a0PfKoVn.js +0 -1
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-BKQ6e5mC.js +0 -1
- /package/web/assets/{chunk-AQ6EADP3-CCFje6lL.js → chunk-AQ6EADP3-CZhslHi-.js} +0 -0
|
@@ -11,15 +11,17 @@ import Go from 'tree-sitter-go';
|
|
|
11
11
|
import Rust from 'tree-sitter-rust';
|
|
12
12
|
import PHP from 'tree-sitter-php';
|
|
13
13
|
import Ruby from 'tree-sitter-ruby';
|
|
14
|
-
import {
|
|
14
|
+
import { requireVendoredGrammar } from '../../tree-sitter/vendored-grammars.js';
|
|
15
15
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
16
16
|
import { getProvider } from '../languages/index.js';
|
|
17
17
|
import { getTreeSitterBufferSize, getTreeSitterContentByteLength, TREE_SITTER_MAX_BUFFER, } from '../constants.js';
|
|
18
18
|
import { ARRAY_METHOD_HOC_BLOCKLIST_SET, DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET, deriveDefaultExportHocName, } from '../ts-js-hoc-utils.js';
|
|
19
19
|
import { parseSourceSafe } from '../../tree-sitter/safe-parse.js';
|
|
20
|
+
import { postResultCloneSafe } from './post-result.js';
|
|
21
|
+
import { mergeResult } from './result-merge.js';
|
|
20
22
|
// ── Worker grammar loading — enforcement boundary (#2091/#2093, #2101) ───────
|
|
21
|
-
// The worker maintains its own grammar table (the guarded
|
|
22
|
-
// `languageMap`) and intentionally does NOT consult the runtime
|
|
23
|
+
// The worker maintains its own grammar table (the guarded vendored-grammar
|
|
24
|
+
// loads below + `languageMap`) and intentionally does NOT consult the runtime
|
|
23
25
|
// `GITNEXUS_SKIP_OPTIONAL_GRAMMARS` opt-out. It does not need to: the MAIN
|
|
24
26
|
// THREAD's `parseableScanned` filter (pipeline-phases/parse-impl.ts, gated on
|
|
25
27
|
// `parser-loader.isLanguageAvailable`, which honors the runtime opt-out and a
|
|
@@ -30,33 +32,29 @@ import { parseSourceSafe } from '../../tree-sitter/safe-parse.js';
|
|
|
30
32
|
// `isLanguageAvailable` must re-introduce the gate here. (The cleaner end-state
|
|
31
33
|
// — routing this table through `parser-loader.getLanguageGrammar` so there is
|
|
32
34
|
// one loader — is the deferred Tier-1 consolidation.)
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
+
// Swift/Dart/Kotlin/C are vendored grammars loaded from `vendor/` by absolute
|
|
36
|
+
// path (NEVER copied into node_modules — see vendored-grammars.ts / #2111). Each
|
|
37
|
+
// may be absent on a platform without a prebuild or a toolchain-less /
|
|
38
|
+
// `--ignore-scripts` install, so every load is guarded so a missing binding
|
|
39
|
+
// cannot crash the worker at module-load (#2091/#2093, #2116).
|
|
35
40
|
let Swift = null;
|
|
36
41
|
try {
|
|
37
|
-
Swift =
|
|
42
|
+
Swift = requireVendoredGrammar('tree-sitter-swift');
|
|
38
43
|
}
|
|
39
44
|
catch { }
|
|
40
|
-
// tree-sitter-dart is an optionalDependency — may not be installed
|
|
41
45
|
let Dart = null;
|
|
42
46
|
try {
|
|
43
|
-
Dart =
|
|
47
|
+
Dart = requireVendoredGrammar('tree-sitter-dart');
|
|
44
48
|
}
|
|
45
49
|
catch { }
|
|
46
|
-
// tree-sitter-kotlin is an optionalDependency — may not be installed
|
|
47
50
|
let Kotlin = null;
|
|
48
51
|
try {
|
|
49
|
-
Kotlin =
|
|
52
|
+
Kotlin = requireVendoredGrammar('tree-sitter-kotlin');
|
|
50
53
|
}
|
|
51
54
|
catch { }
|
|
52
|
-
// tree-sitter-c is now vendored prebuild-only (#2116) and may be absent on a
|
|
53
|
-
// toolchain-less / `--ignore-scripts` install. Guard it like Swift/Dart/Kotlin so
|
|
54
|
-
// a missing binding cannot crash the worker at module-load (#2091/#2093); the
|
|
55
|
-
// main-thread `isLanguageAvailable` filter keeps C files from being dispatched
|
|
56
|
-
// here when the entry is absent.
|
|
57
55
|
let C = null;
|
|
58
56
|
try {
|
|
59
|
-
C =
|
|
57
|
+
C = requireVendoredGrammar('tree-sitter-c');
|
|
60
58
|
}
|
|
61
59
|
catch { }
|
|
62
60
|
import { getLanguageFromFilename } from '../../../_shared/index.js';
|
|
@@ -71,6 +69,7 @@ import { extractTemplateArguments, templateArgumentsIdTag, templateConstraintsId
|
|
|
71
69
|
import { extractParsedFile } from '../scope-extractor-bridge.js';
|
|
72
70
|
import { persistParsedFileShardSync, persistDurableParsedFileShardSync, } from '../../../storage/parsedfile-store.js';
|
|
73
71
|
import { extractLaravelRoutes } from '../route-extractors/laravel.js';
|
|
72
|
+
import { collectFunctionCfgs, DEFAULT_PDG_MAX_FUNCTION_LINES, } from '../cfg/collect.js';
|
|
74
73
|
import { logger } from '../../logger.js';
|
|
75
74
|
// ── ParsedFile store (#1983 parallel serialization) ─────────────────────────
|
|
76
75
|
// Read ONCE at worker init from `workerData` (immutable for the run, inherited
|
|
@@ -88,6 +87,17 @@ const PARSED_FILE_STORE_STORAGE_PATH = workerData?.parsedFileStoreStoragePath;
|
|
|
88
87
|
// restores them without re-parsing. `undefined` ⇒ no durable write.
|
|
89
88
|
const DURABLE_PARSED_FILE_STORAGE_PATH = workerData?.durableParsedFileStoragePath;
|
|
90
89
|
let shardSeq = 0;
|
|
90
|
+
// ── PDG/CFG opt-in (#2081 M1) ───────────────────────────────────────────────
|
|
91
|
+
// Read ONCE at worker init from `workerData` (the worker never sees
|
|
92
|
+
// PipelineOptions — config arrives via the pool factory's `workerData`, see
|
|
93
|
+
// KTD7 / U5). When `pdg` is set, the worker builds a per-function control-flow
|
|
94
|
+
// graph from the tree-sitter AST (where it lives) and serializes it onto
|
|
95
|
+
// `ParsedFile.cfgSideChannel`. Off ⇒ no CFG work and no field — the default for
|
|
96
|
+
// every run today. `pdgMaxFunctionLines` bounds per-function CFG cost
|
|
97
|
+
// (0/undefined ⇒ no cap; see collectFunctionCfgs).
|
|
98
|
+
const PDG_ENABLED = workerData?.pdg === true;
|
|
99
|
+
const PDG_MAX_FUNCTION_LINES = workerData?.pdgMaxFunctionLines ??
|
|
100
|
+
DEFAULT_PDG_MAX_FUNCTION_LINES;
|
|
91
101
|
// ── Bootstrap-stage diagnostics (#1741) ────────────────────────────────────
|
|
92
102
|
// When GITNEXUS_WORKER_BOOTSTRAP=1 (or --verbose sets GITNEXUS_VERBOSE), each
|
|
93
103
|
// worker reports its startup stage timings to stderr — which the pool tees
|
|
@@ -501,6 +511,7 @@ const processBatch = (files, onProgress) => {
|
|
|
501
511
|
fileScopeBindings: [],
|
|
502
512
|
parsedFiles: [],
|
|
503
513
|
skippedLanguages: {},
|
|
514
|
+
cfgSkipped: {},
|
|
504
515
|
fileCount: 0,
|
|
505
516
|
};
|
|
506
517
|
// Group by language to minimize setLanguage calls
|
|
@@ -835,7 +846,52 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
835
846
|
// copy — scopes/defs are carried by reference) to attach the field rather
|
|
836
847
|
// than mutate the frozen object.
|
|
837
848
|
const sideChannel = provider.collectCaptureSideChannel?.(file.path);
|
|
838
|
-
|
|
849
|
+
let withChannels = sideChannel !== undefined ? { ...parsedFile, captureSideChannel: sideChannel } : parsedFile;
|
|
850
|
+
// CFG side-channel (#2081 M1): build the per-function control-flow graph
|
|
851
|
+
// here, where the tree-sitter AST is still in hand, and attach it as plain
|
|
852
|
+
// serializable data. Only on a --pdg run and only for languages with a
|
|
853
|
+
// cfgVisitor (TS/JS in M1). The same disk-store/warm-cache machinery that
|
|
854
|
+
// carries captureSideChannel carries this — its coherence rests on the
|
|
855
|
+
// SCHEMA_BUMP + the pdg-folded chunk-hash key (see parse-cache.ts).
|
|
856
|
+
if (PDG_ENABLED && provider.cfgVisitor) {
|
|
857
|
+
// Isolate the CFG build per file: a throw here (an unexpected tree-sitter
|
|
858
|
+
// node shape) must NOT propagate — it would escape processFileGroup to the
|
|
859
|
+
// language-group catch, which treats any throw as "parser unavailable" and
|
|
860
|
+
// silently drops EVERY remaining file in the group. Skip CFG for this one
|
|
861
|
+
// file; parsing + scope resolution proceed unaffected (CFG is a
|
|
862
|
+
// strictly-additive opt-in). collectFunctionCfgs ALSO isolates per
|
|
863
|
+
// FUNCTION now (#2195) — a deep-nesting bail or a single malformed function
|
|
864
|
+
// is counted in `skipped` and skipped, not allowed to lose the whole file.
|
|
865
|
+
try {
|
|
866
|
+
const { cfgs, skipped } = collectFunctionCfgs(tree.rootNode, provider.cfgVisitor, file.path, PDG_MAX_FUNCTION_LINES,
|
|
867
|
+
// Embedded scripts (Vue SFC <script>) parse at row 0 but live at
|
|
868
|
+
// `lineOffset` in the file — shift the CFG into file coordinates so
|
|
869
|
+
// it joins its graph node and BasicBlock lines map to source.
|
|
870
|
+
lineOffset);
|
|
871
|
+
if (cfgs.length)
|
|
872
|
+
withChannels = { ...withChannels, cfgSideChannel: cfgs };
|
|
873
|
+
// Surface per-function CFG skips per-language (#2195): merged + logged
|
|
874
|
+
// in mergeChunkResults. Only accumulate when something was skipped so
|
|
875
|
+
// the common (nothing-skipped) case stays a no-op.
|
|
876
|
+
if (skipped.tooManyLines || skipped.tooDeeplyNested || skipped.buildError) {
|
|
877
|
+
const agg = (result.cfgSkipped ??= {});
|
|
878
|
+
const prev = agg[language] ?? { tooManyLines: 0, tooDeeplyNested: 0, buildError: 0 };
|
|
879
|
+
agg[language] = {
|
|
880
|
+
tooManyLines: prev.tooManyLines + skipped.tooManyLines,
|
|
881
|
+
tooDeeplyNested: prev.tooDeeplyNested + skipped.tooDeeplyNested,
|
|
882
|
+
buildError: prev.buildError + skipped.buildError,
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
catch (err) {
|
|
887
|
+
const message = `CFG build failed for ${file.path}: ${err instanceof Error ? err.message : String(err)}`;
|
|
888
|
+
if (parentPort)
|
|
889
|
+
parentPort.postMessage({ type: 'warning', message });
|
|
890
|
+
else
|
|
891
|
+
logger.warn(message);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
result.parsedFiles.push(withChannels);
|
|
839
895
|
}
|
|
840
896
|
// Build per-file type environment + constructor bindings in a single AST walk.
|
|
841
897
|
// The legacy heritage pre-pass that seeded a file-local parentMap for
|
|
@@ -1675,6 +1731,9 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1675
1731
|
isReadonly: methodProps.isReadonly,
|
|
1676
1732
|
isAbstract: methodProps.isAbstract,
|
|
1677
1733
|
isFinal: methodProps.isFinal,
|
|
1734
|
+
...(methodProps.isDeleted !== undefined
|
|
1735
|
+
? { isDeleted: methodProps.isDeleted }
|
|
1736
|
+
: {}),
|
|
1678
1737
|
...(methodProps.isVirtual !== undefined
|
|
1679
1738
|
? { isVirtual: methodProps.isVirtual }
|
|
1680
1739
|
: {}),
|
|
@@ -1790,44 +1849,12 @@ let accumulated = {
|
|
|
1790
1849
|
fileScopeBindings: [],
|
|
1791
1850
|
parsedFiles: [],
|
|
1792
1851
|
skippedLanguages: {},
|
|
1852
|
+
cfgSkipped: {},
|
|
1793
1853
|
fileCount: 0,
|
|
1794
1854
|
};
|
|
1795
1855
|
let cumulativeProcessed = 0;
|
|
1796
|
-
//
|
|
1797
|
-
//
|
|
1798
|
-
// and blows the stack when arr has >~65k elements).
|
|
1799
|
-
const appendAll = (target, src) => {
|
|
1800
|
-
for (let i = 0; i < src.length; i++)
|
|
1801
|
-
target.push(src[i]);
|
|
1802
|
-
};
|
|
1803
|
-
const mergeResult = (target, src) => {
|
|
1804
|
-
appendAll(target.nodes, src.nodes);
|
|
1805
|
-
appendAll(target.relationships, src.relationships);
|
|
1806
|
-
appendAll(target.symbols, src.symbols);
|
|
1807
|
-
appendAll(target.calls, src.calls);
|
|
1808
|
-
appendAll(target.assignments, src.assignments);
|
|
1809
|
-
appendAll(target.routes, src.routes);
|
|
1810
|
-
appendAll(target.fetchCalls, src.fetchCalls);
|
|
1811
|
-
appendAll(target.fetchWrapperDefs, src.fetchWrapperDefs);
|
|
1812
|
-
appendAll(target.decoratorRoutes, src.decoratorRoutes);
|
|
1813
|
-
if (src.routerIncludes)
|
|
1814
|
-
appendAll(target.routerIncludes, src.routerIncludes);
|
|
1815
|
-
if (src.routerImports)
|
|
1816
|
-
appendAll(target.routerImports, src.routerImports);
|
|
1817
|
-
if (src.routerModuleAliases) {
|
|
1818
|
-
target.routerModuleAliases ??= [];
|
|
1819
|
-
appendAll(target.routerModuleAliases, src.routerModuleAliases);
|
|
1820
|
-
}
|
|
1821
|
-
appendAll(target.toolDefs, src.toolDefs);
|
|
1822
|
-
appendAll(target.ormQueries, src.ormQueries);
|
|
1823
|
-
appendAll(target.constructorBindings, src.constructorBindings);
|
|
1824
|
-
appendAll(target.fileScopeBindings, src.fileScopeBindings);
|
|
1825
|
-
appendAll(target.parsedFiles, src.parsedFiles);
|
|
1826
|
-
for (const [lang, count] of Object.entries(src.skippedLanguages)) {
|
|
1827
|
-
target.skippedLanguages[lang] = (target.skippedLanguages[lang] || 0) + count;
|
|
1828
|
-
}
|
|
1829
|
-
target.fileCount += src.fileCount;
|
|
1830
|
-
};
|
|
1856
|
+
// `mergeResult` (+ its `appendAll`) lives in ./result-merge.ts (extracted so it
|
|
1857
|
+
// can be unit-tested without importing this entry module).
|
|
1831
1858
|
// Signal the pool that worker-side initialization (parser imports, language
|
|
1832
1859
|
// grammars, type-env setup, all helper modules) is complete and the message
|
|
1833
1860
|
// handler below is about to be attached. The pool's `waitForWorkerReady`
|
|
@@ -1920,7 +1947,7 @@ parentPort.on('message', (msg) => {
|
|
|
1920
1947
|
accumulated.parsedFiles = [];
|
|
1921
1948
|
}
|
|
1922
1949
|
}
|
|
1923
|
-
|
|
1950
|
+
postResultCloneSafe(accumulated);
|
|
1924
1951
|
// Reset for potential reuse
|
|
1925
1952
|
accumulated = {
|
|
1926
1953
|
nodes: [],
|
|
@@ -1941,6 +1968,7 @@ parentPort.on('message', (msg) => {
|
|
|
1941
1968
|
fileScopeBindings: [],
|
|
1942
1969
|
parsedFiles: [],
|
|
1943
1970
|
skippedLanguages: {},
|
|
1971
|
+
cfgSkipped: {},
|
|
1944
1972
|
fileCount: 0,
|
|
1945
1973
|
};
|
|
1946
1974
|
cumulativeProcessed = 0;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParseWorkerResult } from './parse-worker.js';
|
|
2
|
+
/**
|
|
3
|
+
* Deliver the accumulated result to the pool, surviving a non-cloneable value
|
|
4
|
+
* (#2112). Fast path: post as-is — on a healthy result this is the only thing
|
|
5
|
+
* that runs, so clone-safety adds zero overhead to normal runs. If structured
|
|
6
|
+
* clone rejects the payload (a function/symbol leaked into an extraction
|
|
7
|
+
* record — the reporter's case was a node `properties` value pointing at a
|
|
8
|
+
* native `toString`), rewrite the boundary-crossing arrays so the result is
|
|
9
|
+
* cloneable, record the affected paths on `result.skippedPaths`, warn the
|
|
10
|
+
* operator naming the offending field + file (so the still-unpinned leak is
|
|
11
|
+
* diagnosable from logs and fixable at source), and re-post.
|
|
12
|
+
*
|
|
13
|
+
* Recovery is attempted for ANY first-post failure, not only a `DataCloneError`.
|
|
14
|
+
* structuredClone invokes getters, and a getter that THROWS surfaces its own
|
|
15
|
+
* error (a `RangeError`, etc.) — NOT a `DataCloneError` (confirmed against a
|
|
16
|
+
* real MessageChannel). Gating recovery on `DataCloneError` let such a throw
|
|
17
|
+
* re-throw past the sanitizer and re-arm, under `POOL_SIZE=1`, the worker-death
|
|
18
|
+
* cascade this net prevents. The recovery path is wrapped in its own try/catch
|
|
19
|
+
* so a still-uncloneable re-post fails closed to a primitive-only
|
|
20
|
+
* `{type:'error'}` DELIBERATELY rather than escaping the worker.
|
|
21
|
+
*/
|
|
22
|
+
export declare function postResultCloneSafe(result: ParseWorkerResult): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker → main result delivery with clone-safety (#2112).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `parse-worker.ts` into its own side-effect-free module so it
|
|
5
|
+
* can be imported and exercised directly (the parse worker is an entry module:
|
|
6
|
+
* importing it would construct the parser, post `ready`, and attach the real
|
|
7
|
+
* message handler). The integration test imports `postResultCloneSafe` from
|
|
8
|
+
* here to cover the production wiring end to end rather than re-implementing it.
|
|
9
|
+
*/
|
|
10
|
+
import { parentPort } from 'node:worker_threads';
|
|
11
|
+
import { makeWorkerResultCloneSafe } from './clone-safety.js';
|
|
12
|
+
/**
|
|
13
|
+
* Strict mode (opt-in via `GITNEXUS_STRICT_CLONE=1`, inherited by workers). When
|
|
14
|
+
* on, a clone failure THROWS with the offending key path instead of silently
|
|
15
|
+
* sanitizing + delivering — so a leak introduced by a future provider/extractor
|
|
16
|
+
* change fails LOUDLY (in CI / dev) at its origin rather than being quietly
|
|
17
|
+
* stripped in production. The silent-recovery behavior is exactly what hid the
|
|
18
|
+
* original #2112 leak; strict mode removes the silence where we want loudness.
|
|
19
|
+
* Off in production, where the net's job is to keep the run alive.
|
|
20
|
+
*/
|
|
21
|
+
const STRICT_CLONE = process.env.GITNEXUS_STRICT_CLONE === '1';
|
|
22
|
+
/**
|
|
23
|
+
* Deliver the accumulated result to the pool, surviving a non-cloneable value
|
|
24
|
+
* (#2112). Fast path: post as-is — on a healthy result this is the only thing
|
|
25
|
+
* that runs, so clone-safety adds zero overhead to normal runs. If structured
|
|
26
|
+
* clone rejects the payload (a function/symbol leaked into an extraction
|
|
27
|
+
* record — the reporter's case was a node `properties` value pointing at a
|
|
28
|
+
* native `toString`), rewrite the boundary-crossing arrays so the result is
|
|
29
|
+
* cloneable, record the affected paths on `result.skippedPaths`, warn the
|
|
30
|
+
* operator naming the offending field + file (so the still-unpinned leak is
|
|
31
|
+
* diagnosable from logs and fixable at source), and re-post.
|
|
32
|
+
*
|
|
33
|
+
* Recovery is attempted for ANY first-post failure, not only a `DataCloneError`.
|
|
34
|
+
* structuredClone invokes getters, and a getter that THROWS surfaces its own
|
|
35
|
+
* error (a `RangeError`, etc.) — NOT a `DataCloneError` (confirmed against a
|
|
36
|
+
* real MessageChannel). Gating recovery on `DataCloneError` let such a throw
|
|
37
|
+
* re-throw past the sanitizer and re-arm, under `POOL_SIZE=1`, the worker-death
|
|
38
|
+
* cascade this net prevents. The recovery path is wrapped in its own try/catch
|
|
39
|
+
* so a still-uncloneable re-post fails closed to a primitive-only
|
|
40
|
+
* `{type:'error'}` DELIBERATELY rather than escaping the worker.
|
|
41
|
+
*/
|
|
42
|
+
export function postResultCloneSafe(result) {
|
|
43
|
+
try {
|
|
44
|
+
parentPort.postMessage({ type: 'result', data: result });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Fall through to recovery on ANY failure (DataCloneError OR a throwing
|
|
49
|
+
// getter's own error). A healthy post returned above and never reaches here.
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
// `as unknown as Record<string, unknown>` is the standard widening for a
|
|
53
|
+
// no-index-signature interface (TS rejects a single-step `as`). The field
|
|
54
|
+
// sets are typed to `keyof ParseWorkerResult` so renaming a field is a
|
|
55
|
+
// compile error here, not a silent loss of the drop-whole / skip protection.
|
|
56
|
+
const { skipped } = makeWorkerResultCloneSafe(result, {
|
|
57
|
+
dropWholeElement: new Set(['parsedFiles']),
|
|
58
|
+
skipFields: new Set(['skippedPaths']),
|
|
59
|
+
});
|
|
60
|
+
if (skipped.length > 0) {
|
|
61
|
+
if (STRICT_CLONE) {
|
|
62
|
+
// Surface the leak loudly with its exact key path(s) instead of
|
|
63
|
+
// delivering a sanitized result. Routes to the catch below → a
|
|
64
|
+
// primitive-only {type:'error'} the pool reports, failing CI.
|
|
65
|
+
const detail = skipped.map((s) => `${s.path}: ${s.reason}`).join('; ');
|
|
66
|
+
throw new Error(`GITNEXUS_STRICT_CLONE: worker result was not structured-cloneable — ${detail}`);
|
|
67
|
+
}
|
|
68
|
+
result.skippedPaths = [...(result.skippedPaths ?? []), ...skipped];
|
|
69
|
+
const sample = skipped
|
|
70
|
+
.slice(0, 5)
|
|
71
|
+
.map((s) => `${s.path} (${s.reason})`)
|
|
72
|
+
.join('; ');
|
|
73
|
+
const more = skipped.length > 5 ? ` …and ${skipped.length - 5} more` : '';
|
|
74
|
+
if (parentPort) {
|
|
75
|
+
parentPort.postMessage({
|
|
76
|
+
type: 'warning',
|
|
77
|
+
message: `Sanitized ${skipped.length} file(s) with non-serializable parse output before delivery: ${sample}${more}`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
parentPort.postMessage({ type: 'result', data: result });
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
85
|
+
parentPort.postMessage({ type: 'error', error: e.message, errorStack: e.stack });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge of accumulated parse-worker results (sub-batch result → the conceptual
|
|
3
|
+
* job's running accumulator).
|
|
4
|
+
*
|
|
5
|
+
* Extracted from `parse-worker.ts` into this side-effect-free module so the
|
|
6
|
+
* merge can be imported and unit-tested directly — the parse worker is an entry
|
|
7
|
+
* module (importing it constructs the parser, posts `ready`, and attaches the
|
|
8
|
+
* real MessagePort handler), so a main-thread test cannot import a helper out of
|
|
9
|
+
* it. Mirrors the `post-result.ts` extraction.
|
|
10
|
+
*
|
|
11
|
+
* `import type` of `ParseWorkerResult` is erased at runtime, so there is no
|
|
12
|
+
* import cycle with `parse-worker.ts` (which imports this module's runtime).
|
|
13
|
+
*/
|
|
14
|
+
import type { ParseWorkerResult } from './parse-worker.js';
|
|
15
|
+
/**
|
|
16
|
+
* Merge `src` into `target` in place: append every boundary-crossing array,
|
|
17
|
+
* sum the per-language skip counts, union the clone-safety `skippedPaths`, and
|
|
18
|
+
* add the file count.
|
|
19
|
+
*/
|
|
20
|
+
export declare const mergeResult: (target: ParseWorkerResult, src: ParseWorkerResult) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Use a loop instead of push(...spread) to avoid hitting V8's argument limit
|
|
2
|
+
// when merging large result sets (push(...arr) calls apply() under the hood
|
|
3
|
+
// and blows the stack when arr has >~65k elements).
|
|
4
|
+
const appendAll = (target, src) => {
|
|
5
|
+
for (let i = 0; i < src.length; i++)
|
|
6
|
+
target.push(src[i]);
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Merge `src` into `target` in place: append every boundary-crossing array,
|
|
10
|
+
* sum the per-language skip counts, union the clone-safety `skippedPaths`, and
|
|
11
|
+
* add the file count.
|
|
12
|
+
*/
|
|
13
|
+
export const mergeResult = (target, src) => {
|
|
14
|
+
appendAll(target.nodes, src.nodes);
|
|
15
|
+
appendAll(target.relationships, src.relationships);
|
|
16
|
+
appendAll(target.symbols, src.symbols);
|
|
17
|
+
appendAll(target.calls, src.calls);
|
|
18
|
+
appendAll(target.assignments, src.assignments);
|
|
19
|
+
appendAll(target.routes, src.routes);
|
|
20
|
+
appendAll(target.fetchCalls, src.fetchCalls);
|
|
21
|
+
appendAll(target.fetchWrapperDefs, src.fetchWrapperDefs);
|
|
22
|
+
appendAll(target.decoratorRoutes, src.decoratorRoutes);
|
|
23
|
+
if (src.routerIncludes)
|
|
24
|
+
appendAll(target.routerIncludes, src.routerIncludes);
|
|
25
|
+
if (src.routerImports)
|
|
26
|
+
appendAll(target.routerImports, src.routerImports);
|
|
27
|
+
if (src.routerModuleAliases) {
|
|
28
|
+
target.routerModuleAliases ??= [];
|
|
29
|
+
appendAll(target.routerModuleAliases, src.routerModuleAliases);
|
|
30
|
+
}
|
|
31
|
+
appendAll(target.toolDefs, src.toolDefs);
|
|
32
|
+
appendAll(target.ormQueries, src.ormQueries);
|
|
33
|
+
appendAll(target.constructorBindings, src.constructorBindings);
|
|
34
|
+
appendAll(target.fileScopeBindings, src.fileScopeBindings);
|
|
35
|
+
appendAll(target.parsedFiles, src.parsedFiles);
|
|
36
|
+
for (const [lang, count] of Object.entries(src.skippedLanguages)) {
|
|
37
|
+
target.skippedLanguages[lang] = (target.skippedLanguages[lang] || 0) + count;
|
|
38
|
+
}
|
|
39
|
+
if (src.skippedPaths && src.skippedPaths.length > 0) {
|
|
40
|
+
(target.skippedPaths ??= []).push(...src.skippedPaths);
|
|
41
|
+
}
|
|
42
|
+
target.fileCount += src.fileCount;
|
|
43
|
+
};
|
|
@@ -1,30 +1,4 @@
|
|
|
1
1
|
import { Worker } from 'node:worker_threads';
|
|
2
|
-
/**
|
|
3
|
-
* Build the sub-batch dispatch payload + transferList.
|
|
4
|
-
*
|
|
5
|
-
* For the parse-worker shape `{path, content: string}[]`, encodes each
|
|
6
|
-
* file's content as a `Uint8Array` via `TextEncoder` so the underlying
|
|
7
|
-
* `ArrayBuffer` can be transferred zero-copy. For any other input
|
|
8
|
-
* shape, the items array is passed through verbatim (no transfer).
|
|
9
|
-
*
|
|
10
|
-
* @internal Exported for the unit test suite
|
|
11
|
-
* (`test/unit/worker-pool-transferlist.test.ts`) so the
|
|
12
|
-
* Uint8Array-per-content allocation contract can be pinned without
|
|
13
|
-
* spinning up a real worker_threads.
|
|
14
|
-
*/
|
|
15
|
-
export declare function buildDispatchMessage<T>(items: readonly T[]): {
|
|
16
|
-
message: {
|
|
17
|
-
type: 'sub-batch';
|
|
18
|
-
files: Array<{
|
|
19
|
-
path: string;
|
|
20
|
-
content: Uint8Array;
|
|
21
|
-
}>;
|
|
22
|
-
} | {
|
|
23
|
-
type: 'sub-batch';
|
|
24
|
-
files: readonly T[];
|
|
25
|
-
};
|
|
26
|
-
transferList?: ArrayBuffer[];
|
|
27
|
-
};
|
|
28
2
|
export interface WorkerPool {
|
|
29
3
|
/**
|
|
30
4
|
* Dispatch items across workers. Items are split into bounded jobs, each job
|
|
@@ -152,6 +126,15 @@ export interface WorkerPoolOptions {
|
|
|
152
126
|
* `undefined` ⇒ no durable write.
|
|
153
127
|
*/
|
|
154
128
|
durableParsedFileStoragePath?: string;
|
|
129
|
+
/**
|
|
130
|
+
* CFG/PDG opt-in (#2081 M1). Baked into every spawned worker's `workerData`
|
|
131
|
+
* (like the store paths above); when `true`, workers build a per-function
|
|
132
|
+
* control-flow graph from the tree-sitter AST and attach it to
|
|
133
|
+
* `ParsedFile.cfgSideChannel`. `undefined`/`false` ⇒ no CFG work.
|
|
134
|
+
*/
|
|
135
|
+
pdg?: boolean;
|
|
136
|
+
/** Per-function source-line cap for worker-side CFG construction (0 ⇒ no cap). */
|
|
137
|
+
pdgMaxFunctionLines?: number;
|
|
155
138
|
}
|
|
156
139
|
export declare class WorkerPoolDispatchError extends Error {
|
|
157
140
|
/**
|
|
@@ -201,20 +184,6 @@ export declare class WorkerPoolInitializationError extends WorkerPoolDispatchErr
|
|
|
201
184
|
export declare class WorkerPoolDisabledError extends Error {
|
|
202
185
|
constructor(message: string);
|
|
203
186
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Normalize a worker crash message into a stable signature so two instances of
|
|
206
|
-
* the SAME deterministic crash compare equal while unrelated crashes don't.
|
|
207
|
-
* Strips hex addresses, digit runs (pids / line numbers / timestamps) and
|
|
208
|
-
* absolute paths. Best-effort by design: the deterministic classification's
|
|
209
|
-
* correctness rests on the STRUCTURAL signal (zero workers ever ready + startup
|
|
210
|
-
* budget exhausted), so an imperfect signature only changes how fast the
|
|
211
|
-
* short-circuit fires, never whether the pool ultimately fails fast. Even a
|
|
212
|
-
* stderr-less crash normalizes its "exited with code N" message to a stable
|
|
213
|
-
* key, so the empty-stderr timing case still groups.
|
|
214
|
-
*
|
|
215
|
-
* @internal Exported for unit tests; production callers are in this module.
|
|
216
|
-
*/
|
|
217
|
-
export declare function crashSignature(message: string): string;
|
|
218
187
|
interface ResolvedWorkerPoolOptions {
|
|
219
188
|
subBatchSize: number;
|
|
220
189
|
subBatchMaxBytes: number;
|
|
@@ -273,6 +242,12 @@ export declare function resolveAutoPoolSize(): number;
|
|
|
273
242
|
* time spent across all attempts/splits/retries. When the budget is
|
|
274
243
|
* exhausted, the pool surfaces the in-flight path via `WorkerPoolDispatchError`
|
|
275
244
|
* instead of letting timeouts compound indefinitely.
|
|
245
|
+
*
|
|
246
|
+
* Upstream of these layers, the parse worker self-sanitizes a result that the
|
|
247
|
+
* structured-clone algorithm can't serialize (#2112) — stripping or dropping
|
|
248
|
+
* the offending value and reporting the affected paths on the result — so a
|
|
249
|
+
* single non-cloneable value can't masquerade as a worker death and exhaust a
|
|
250
|
+
* slot's respawn budget here.
|
|
276
251
|
*/
|
|
277
252
|
export declare const createWorkerPool: (workerUrl: URL, poolSize?: number, options?: WorkerPoolOptions) => WorkerPool;
|
|
278
253
|
export {};
|
|
@@ -523,6 +523,12 @@ function createJobs(items, maxItems, maxBytes, timeoutMs, chunkHash) {
|
|
|
523
523
|
* time spent across all attempts/splits/retries. When the budget is
|
|
524
524
|
* exhausted, the pool surfaces the in-flight path via `WorkerPoolDispatchError`
|
|
525
525
|
* instead of letting timeouts compound indefinitely.
|
|
526
|
+
*
|
|
527
|
+
* Upstream of these layers, the parse worker self-sanitizes a result that the
|
|
528
|
+
* structured-clone algorithm can't serialize (#2112) — stripping or dropping
|
|
529
|
+
* the offending value and reporting the affected paths on the result — so a
|
|
530
|
+
* single non-cloneable value can't masquerade as a worker death and exhaust a
|
|
531
|
+
* slot's respawn budget here.
|
|
526
532
|
*/
|
|
527
533
|
export const createWorkerPool = (workerUrl, poolSize, options) => {
|
|
528
534
|
// Validate worker script exists before spawning to prevent uncaught
|
|
@@ -544,13 +550,26 @@ export const createWorkerPool = (workerUrl, poolSize, options) => {
|
|
|
544
550
|
// signature is unchanged so the zero-arg test factories keep working.
|
|
545
551
|
const parsedFileStoreStoragePath = options?.parsedFileStoreStoragePath;
|
|
546
552
|
const durableParsedFileStoragePath = options?.durableParsedFileStoragePath;
|
|
547
|
-
|
|
548
|
-
|
|
553
|
+
// CFG/PDG opt-in (#2081 M1) — carried in workerData alongside the store paths.
|
|
554
|
+
const pdg = options?.pdg === true;
|
|
555
|
+
const pdgMaxFunctionLines = options?.pdgMaxFunctionLines;
|
|
556
|
+
const workerStoreData = parsedFileStoreStoragePath || durableParsedFileStoragePath || pdg
|
|
557
|
+
? { parsedFileStoreStoragePath, durableParsedFileStoragePath, pdg, pdgMaxFunctionLines }
|
|
549
558
|
: undefined;
|
|
550
559
|
const spawnWorker = options?.workerFactory ??
|
|
551
560
|
((url) => new Worker(url, {
|
|
552
561
|
stderr: true,
|
|
553
562
|
workerData: workerStoreData,
|
|
563
|
+
// The CFG visitors build per-function control-flow graphs by RECURSIVE
|
|
564
|
+
// descent over the tree-sitter AST, so deeply-nested source overflows
|
|
565
|
+
// the worker thread's call stack. A worker's stack is governed by
|
|
566
|
+
// `resourceLimits.stackSizeMb` (Node default 4 MB) — the main process's
|
|
567
|
+
// `--stack-size` flag does NOT propagate to worker threads — so raise it
|
|
568
|
+
// here. This pushes the overflow threshold from ~1.5k to several-k
|
|
569
|
+
// nesting levels (far beyond any hand-written code); a deeper machine-
|
|
570
|
+
// generated nest is still caught per-function (buildFunctionCfg's R4
|
|
571
|
+
// try/catch) and only that function's PDG is skipped, never a crash.
|
|
572
|
+
resourceLimits: { stackSizeMb: 16 },
|
|
554
573
|
}));
|
|
555
574
|
/** Spawn + wire stderr capture in one step (used by all spawn sites). */
|
|
556
575
|
const spawnAndCapture = (url) => {
|
|
@@ -1313,14 +1332,19 @@ export const createWorkerPool = (workerUrl, poolSize, options) => {
|
|
|
1313
1332
|
if (settled || stopped)
|
|
1314
1333
|
return;
|
|
1315
1334
|
// Native postMessage delivers POJO directly via Node's
|
|
1316
|
-
// structured clone.
|
|
1317
|
-
//
|
|
1318
|
-
//
|
|
1319
|
-
//
|
|
1320
|
-
//
|
|
1321
|
-
//
|
|
1322
|
-
// `
|
|
1323
|
-
//
|
|
1335
|
+
// structured clone. Two distinct clone failure modes exist,
|
|
1336
|
+
// and NEITHER reaches this handler: (1) a SENDER-side
|
|
1337
|
+
// non-cloneable value (a function/symbol that leaked into the
|
|
1338
|
+
// result) throws a synchronous `DataCloneError` on the
|
|
1339
|
+
// worker's own postMessage — the parse worker self-sanitizes
|
|
1340
|
+
// such results before delivery (#2112) and falls back to a
|
|
1341
|
+
// primitive-only `{type:'error'}` if it still can't serialize;
|
|
1342
|
+
// (2) a RECEIVER-side deserialization failure surfaces as a
|
|
1343
|
+
// `messageerror` event handled below. The only thing THIS
|
|
1344
|
+
// handler guards is a worker that sends a message without a
|
|
1345
|
+
// `type` discriminant (a worker bug, not a wire-format issue):
|
|
1346
|
+
// without the guard `null.type` would throw a TypeError out of
|
|
1347
|
+
// the EventEmitter listener → uncaughtException on the main
|
|
1324
1348
|
// thread.
|
|
1325
1349
|
const msg = raw;
|
|
1326
1350
|
if (msg === null || typeof msg !== 'object' || typeof msg.type !== 'string') {
|
|
@@ -1417,12 +1441,15 @@ export const createWorkerPool = (workerUrl, poolSize, options) => {
|
|
|
1417
1441
|
`Likely OOM or native addon failure${inFlightSuffix}.`, excludes);
|
|
1418
1442
|
}
|
|
1419
1443
|
};
|
|
1420
|
-
// `messageerror` fires when V8 fails to
|
|
1421
|
-
// payload (
|
|
1422
|
-
//
|
|
1423
|
-
//
|
|
1424
|
-
//
|
|
1425
|
-
//
|
|
1444
|
+
// `messageerror` fires when V8 fails to DESERIALIZE a postMessage
|
|
1445
|
+
// payload on THIS (receiver) side — a value that serialized on the
|
|
1446
|
+
// worker but can't be reconstructed here. (A non-cloneable value on
|
|
1447
|
+
// the SENDER side instead throws a synchronous DataCloneError on the
|
|
1448
|
+
// worker's own postMessage; that path is caught and sanitized
|
|
1449
|
+
// worker-side (#2112) and never arrives here.) The worker stays ALIVE
|
|
1450
|
+
// but the message is lost — without this handler the pool would sit on
|
|
1451
|
+
// the dropped message until the idle timeout expires. Treat it as
|
|
1452
|
+
// worker death so the resilience layers fire:
|
|
1426
1453
|
// requeue the remainder via `recoverAndResume`, attribute the
|
|
1427
1454
|
// in-flight file from the `starting-file` signal (if observed),
|
|
1428
1455
|
// and let the per-slot respawn budget and circuit breaker decide
|