@shapeshift-labs/frontier-lang-compiler 0.2.149 → 0.2.151
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 +315 -9
- package/bench/real-repo-corpus-checkout-identity.mjs +134 -0
- package/bench/real-repo-corpus-checkout-proof.mjs +263 -0
- package/bench/real-repo-corpus-command-execution.mjs +314 -0
- package/bench/real-repo-corpus-evidence.mjs +165 -0
- package/bench/real-repo-corpus-suite.mjs +273 -0
- package/bench/smoke.mjs +109 -7
- package/dist/declarations/import-adapter-core.d.ts +4 -3
- package/dist/declarations/import-adapter-options-native.d.ts +21 -0
- package/dist/declarations/js-ts-project-merge-admission-routes.d.ts +35 -0
- package/dist/declarations/js-ts-project-merge-commonjs-interop.d.ts +29 -0
- package/dist/declarations/js-ts-project-merge-confidence.d.ts +64 -0
- package/dist/declarations/js-ts-project-merge-declaration-emit-parity.d.ts +37 -0
- package/dist/declarations/js-ts-project-merge-declarations.d.ts +65 -0
- package/dist/declarations/js-ts-project-merge-diagnostics.d.ts +97 -0
- package/dist/declarations/js-ts-project-merge-global-augmentation.d.ts +30 -0
- package/dist/declarations/js-ts-project-merge-jsx-render-branch.d.ts +48 -0
- package/dist/declarations/js-ts-project-merge-proof-levels.d.ts +109 -0
- package/dist/declarations/js-ts-project-merge-quality-gates.d.ts +38 -0
- package/dist/declarations/js-ts-project-merge-semantic-equivalence-proof.d.ts +45 -0
- package/dist/declarations/js-ts-project-merge-tsconfig.d.ts +43 -0
- package/dist/declarations/js-ts-safe-merge.d.ts +47 -0
- package/dist/declarations/js-ts-safe-project-merge.d.ts +120 -38
- package/dist/declarations/native-project-compiler-assignability-oracle.d.ts +41 -0
- package/dist/declarations/native-project-compiler-callable-signatures.d.ts +31 -0
- package/dist/declarations/native-project-compiler-class-member-runtime-proof.d.ts +87 -0
- package/dist/declarations/native-project-compiler-composite-types.d.ts +23 -0
- package/dist/declarations/native-project-compiler-enum-proof.d.ts +58 -0
- package/dist/declarations/native-project-compiler-index-signature.d.ts +7 -0
- package/dist/declarations/native-project-compiler-public-api-source-binding.d.ts +8 -0
- package/dist/declarations/native-project-compiler-scope.d.ts +37 -0
- package/dist/declarations/native-project-compiler-type-reference-targets.d.ts +38 -0
- package/dist/declarations/native-project-css-modules.d.ts +90 -0
- package/dist/declarations/native-project-decorator-metadata.d.ts +126 -0
- package/dist/declarations/native-project-jsx-graph.d.ts +313 -0
- package/dist/declarations/native-project-module-declarations.d.ts +52 -0
- package/dist/declarations/native-project-module-resolution.d.ts +76 -1
- package/dist/declarations/native-project-runtime-effect-target.d.ts +29 -0
- package/dist/declarations/native-project-runtime-executable-effect-evidence.d.ts +107 -0
- package/dist/declarations/native-project-runtime-mutation-target.d.ts +33 -0
- package/dist/declarations/native-project-runtime-promise-chain.d.ts +30 -0
- package/dist/declarations/native-project-runtime-promise-combinator.d.ts +22 -0
- package/dist/declarations/native-project-runtime-reachability.d.ts +30 -0
- package/dist/declarations/native-project-runtime-resource-management.d.ts +27 -0
- package/dist/declarations/native-project-runtime-yield-delegation.d.ts +10 -0
- package/dist/declarations/native-project-scope-template-reference.d.ts +13 -0
- package/dist/declarations/native-project-source-evidence.d.ts +8 -0
- package/dist/declarations/native-project.d.ts +40 -39
- package/dist/declarations/semantic-edit-script.d.ts +10 -8
- package/dist/declarations/semantic-graph-layers.d.ts +79 -0
- package/dist/declarations/semantic-patch-bundle-composition.d.ts +62 -0
- package/dist/declarations/semantic-sidecar.d.ts +3 -2
- package/dist/declarations/semantic-structural-diff.d.ts +94 -0
- package/dist/declarations/source-preservation.d.ts +32 -1
- package/dist/declarations/target-adapters.d.ts +22 -2
- package/dist/index.d.ts +32 -0
- package/dist/index.js +6 -0
- package/dist/internal/index-impl/compileNativeSource.js +53 -5
- package/dist/internal/index-impl/createLightweightNativeImport.js +58 -4
- package/dist/internal/index-impl/createNativeImportFromSyntaxAst.js +17 -1
- package/dist/internal/index-impl/createNativeImportFromTypeScriptAst.js +28 -4
- package/dist/internal/index-impl/createNativeProjectImportResult.js +31 -27
- package/dist/internal/index-impl/createNativeProjectModuleResolutionFromPackageManifests.js +145 -0
- package/dist/internal/index-impl/createNativeSourcePreservation.js +34 -7
- package/dist/internal/index-impl/createSemanticImportSidecar.js +27 -1
- package/dist/internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js +16 -5
- package/dist/internal/index-impl/dynamicImportExpressionMetadata.js +80 -0
- package/dist/internal/index-impl/importMetaUrlDependencyMetadata.js +176 -0
- package/dist/internal/index-impl/importNativeSource.js +2 -3
- package/dist/internal/index-impl/moduleImportAttributeMetadata.js +232 -0
- package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +8 -1
- package/dist/internal/index-impl/projectSymbolGraphClassStaticBlocks.js +148 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerAdvancedTypeMetadata.js +45 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerCallableSignatureEquivalence.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js +280 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassShapeEquivalence.js +103 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerConditionalTypeEquivalence.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerDecoratorRuntimeProof.js +197 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerEnumEquivalence.js +188 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerFacts.js +244 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerIndexSignatureEquivalence.js +58 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerMetadata.js +168 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalence.js +199 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalenceProof.js +204 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js +99 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleRecords.js +264 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleScanners.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleUtils.js +152 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModules.js +82 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentImports.js +170 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentProviderLookup.js +167 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentWrappers.js +150 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextTargets.js +71 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextValues.js +212 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxEventHandlers.js +172 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHookEffects.js +124 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHooks.js +281 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxMemberComponents.js +139 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropFlows.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropValues.js +145 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxProviderFlows.js +133 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRecords.js +315 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderCollections.js +155 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderReturns.js +291 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderRisk.js +279 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleDeclarationShapes.js +138 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleResolution.js +89 -87
- package/dist/internal/index-impl/projectSymbolGraphPackageConditions.js +314 -0
- package/dist/internal/index-impl/projectSymbolGraphReExportImportTargets.js +43 -0
- package/dist/internal/index-impl/projectSymbolGraphReExports.js +55 -1
- package/dist/internal/index-impl/projectSymbolGraphRuntimeRegions.js +108 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefAliases.js +307 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefLexical.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefOwners.js +50 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecordBuilders.js +112 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecords.js +238 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructural.js +104 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructuralNormalize.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefUseHashes.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceMapGeneratedBoundary.js +111 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecords.js +268 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecordsOwnership.js +309 -0
- package/dist/internal/index-impl/replaySemanticEditProjection.js +53 -39
- package/dist/internal/index-impl/runtimeOrderEvidenceBinding.js +151 -0
- package/dist/internal/index-impl/runtimeOrderProofSurfaces.js +253 -0
- package/dist/internal/index-impl/semanticEditCallsiteArgumentMerge.js +319 -0
- package/dist/internal/index-impl/semanticEditExplicitSourceReplacement.js +7 -2
- package/dist/internal/index-impl/semanticEditProjectionRecord.js +8 -0
- package/dist/internal/index-impl/semanticEditReplayDiagnostics.js +7 -2
- package/dist/internal/index-impl/semanticEditReplayOutputBinding.js +61 -0
- package/dist/internal/index-impl/semanticEditReplayRerunRoute.js +27 -0
- package/dist/internal/index-impl/semanticEditReplaySourceReplacement.js +6 -1
- package/dist/internal/index-impl/semanticEditRuntimeOrderReasons.js +320 -0
- package/dist/internal/index-impl/semanticEditScriptClassification.js +90 -5
- package/dist/internal/index-impl/semanticEditScripts.js +42 -5
- package/dist/internal/index-impl/semanticEditTypeSyntaxReasons.js +134 -0
- package/dist/internal/index-impl/semanticIndexFromNativeDeclarations.js +11 -5
- package/dist/internal/index-impl/semanticPatchBundleComposition.js +166 -0
- package/dist/internal/index-impl/semanticStructuralDiffRecords.js +150 -0
- package/dist/internal/index-impl/sourceMapGeneratedBoundaryGate.js +185 -0
- package/dist/internal/index-impl/staticMemberLiteral.js +31 -0
- package/dist/internal/index-impl/staticOptionalMemberReference.js +22 -0
- package/dist/internal/index-impl/syntaxAstSourcePreservation.js +273 -0
- package/dist/internal/index-impl/syntaxCommonJsModuleDeclarationEntries.js +297 -0
- package/dist/internal/index-impl/syntaxModuleDeclarationEntries.js +56 -132
- package/dist/internal/index-impl/syntaxModuleEntryRecords.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAdvancedTypeShapes.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAssignabilityOracle.js +97 -0
- package/dist/internal/index-impl/typeScriptCompilerClassApi.js +238 -0
- package/dist/internal/index-impl/typeScriptCompilerDecoratorMetadata.js +290 -0
- package/dist/internal/index-impl/typeScriptCompilerEnumShape.js +279 -0
- package/dist/internal/index-impl/typeScriptCompilerFacts.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerInferenceSyntax.js +170 -0
- package/dist/internal/index-impl/typeScriptCompilerReferenceGraph.js +186 -0
- package/dist/internal/index-impl/typeScriptCompilerSymbolIdentity.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerTypeReferenceTargets.js +142 -0
- package/dist/internal/index-impl/typeScriptDeclaration.js +10 -38
- package/dist/internal/index-impl/typeScriptModuleDeclarationEntries.js +52 -15
- package/dist/internal/index-impl/typeScriptSourceFilePreservation.js +296 -0
- package/dist/js-ts-safe-member-class-invariants.js +247 -0
- package/dist/js-ts-safe-member-merge-result.js +23 -3
- package/dist/js-ts-safe-member-merge.js +28 -4
- package/dist/js-ts-safe-merge-binding-patterns.js +170 -0
- package/dist/js-ts-safe-merge-context.js +1 -0
- package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +314 -0
- package/dist/js-ts-safe-merge-jsx-attribute-parser.js +277 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-fallback.js +161 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-merge.js +319 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-parser.js +300 -0
- package/dist/js-ts-safe-merge-parse-declarations.js +46 -2
- package/dist/js-ts-safe-merge-parse-statements.js +8 -0
- package/dist/js-ts-safe-merge-plan.js +3 -1
- package/dist/js-ts-safe-merge-semantic-edit-fallback.js +49 -0
- package/dist/js-ts-safe-merge-source-shape-fallbacks.js +5 -1
- package/dist/js-ts-safe-merge-top-level-rename-fallback.js +31 -5
- package/dist/js-ts-safe-merge-top-level-rename-result.js +7 -2
- package/dist/js-ts-safe-merge-variable-declarator-fallback.js +124 -6
- package/dist/js-ts-safe-merge-variable-declarator-parser.js +34 -4
- package/dist/js-ts-safe-merge.js +136 -0
- package/dist/js-ts-safe-project-merge-admission-routes.js +216 -0
- package/dist/js-ts-safe-project-merge-admission.js +161 -0
- package/dist/js-ts-safe-project-merge-ambient.js +110 -0
- package/dist/js-ts-safe-project-merge-core.js +85 -0
- package/dist/js-ts-safe-project-merge-css-module-conflicts.js +60 -0
- package/dist/js-ts-safe-project-merge-declaration-emit-parity.js +186 -0
- package/dist/js-ts-safe-project-merge-declarations.js +227 -0
- package/dist/js-ts-safe-project-merge-diagnostics-metadata.js +42 -0
- package/dist/js-ts-safe-project-merge-diagnostics-ts.js +73 -0
- package/dist/js-ts-safe-project-merge-diagnostics.js +283 -0
- package/dist/js-ts-safe-project-merge-evidence-routing.js +38 -0
- package/dist/js-ts-safe-project-merge-files.js +70 -0
- package/dist/js-ts-safe-project-merge-global-augmentation-compatibility.js +99 -0
- package/dist/js-ts-safe-project-merge-graph-conflicts.js +90 -2
- package/dist/js-ts-safe-project-merge-graph-delta-commonjs-interop.js +108 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-conflicts.js +179 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-details.js +189 -0
- package/dist/js-ts-safe-project-merge-graph-delta-conflicts.js +51 -184
- package/dist/js-ts-safe-project-merge-graph-delta-identity-conflicts.js +202 -0
- package/dist/js-ts-safe-project-merge-graph-delta-inference-syntax.js +80 -0
- package/dist/js-ts-safe-project-merge-graph-delta-module-declarations.js +155 -0
- package/dist/js-ts-safe-project-merge-graph-limits.js +16 -1
- package/dist/js-ts-safe-project-merge-graph.js +37 -5
- package/dist/js-ts-safe-project-merge-import-removal.js +292 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflict-details.js +235 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflicts.js +173 -0
- package/dist/js-ts-safe-project-merge-jsx-prop-contracts.js +86 -0
- package/dist/js-ts-safe-project-merge-jsx-render-branch-proof.js +189 -0
- package/dist/js-ts-safe-project-merge-missing-evidence.js +310 -0
- package/dist/js-ts-safe-project-merge-move-rename.js +209 -0
- package/dist/js-ts-safe-project-merge-proof-conflicts.js +44 -0
- package/dist/js-ts-safe-project-merge-proof-levels.js +320 -0
- package/dist/js-ts-safe-project-merge-quality-gates.js +140 -0
- package/dist/js-ts-safe-project-merge-routing-calibration.js +125 -0
- package/dist/js-ts-safe-project-merge-runtime-region-conflicts.js +156 -0
- package/dist/js-ts-safe-project-merge-scope-use-def-conflicts.js +292 -0
- package/dist/js-ts-safe-project-merge-semantic-equivalence-proof.js +175 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-proof.js +311 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-routes.js +179 -0
- package/dist/js-ts-safe-project-merge-source-span-conflicts.js +310 -0
- package/dist/js-ts-safe-project-merge-source-span-roundtrip-proof.js +172 -0
- package/dist/js-ts-safe-project-merge-split-merge-admission.js +96 -0
- package/dist/js-ts-safe-project-merge-split-merge-records.js +320 -0
- package/dist/js-ts-safe-project-merge-split-merge-shapes.js +234 -0
- package/dist/js-ts-safe-project-merge-split-merge.js +218 -0
- package/dist/js-ts-safe-project-merge-summary.js +320 -0
- package/dist/js-ts-safe-project-merge-symbol-move-admission.js +63 -0
- package/dist/js-ts-safe-project-merge-symbol-move-default-admission.js +143 -0
- package/dist/js-ts-safe-project-merge-symbol-move-risks.js +213 -0
- package/dist/js-ts-safe-project-merge-symbol-move.js +316 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-admission.js +59 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-default-admission.js +111 -0
- package/dist/js-ts-safe-project-merge-symbol-rename.js +319 -0
- package/dist/js-ts-safe-project-merge-ts-options.js +205 -0
- package/dist/js-ts-safe-project-merge-ts-program.js +268 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase-utils.js +69 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase.js +317 -0
- package/dist/js-ts-safe-project-merge-unsupported-surfaces.js +319 -0
- package/dist/js-ts-safe-project-merge.js +171 -172
- package/dist/js-ts-semantic-scope-use-def-bindings.js +287 -0
- package/dist/js-ts-semantic-scope-use-def-scan.js +241 -0
- package/dist/js-ts-semantic-scope-use-def-utils.js +132 -0
- package/dist/js-ts-semantic-scope-use-def.js +217 -0
- package/dist/lightweight-dependency-effects.js +28 -4
- package/dist/lightweight-dependency-relations.js +13 -7
- package/dist/lightweight-dependency-top-level.js +63 -0
- package/dist/native-import-language-profiles.js +27 -1
- package/dist/native-js-ts-importers.js +9 -5
- package/dist/native-parser-ast-format-profiles.js +12 -0
- package/dist/native-parser-html-css-format-profiles.js +85 -0
- package/dist/native-region-scanner-core.js +5 -3
- package/dist/native-region-scanner-js-commonjs.js +155 -0
- package/dist/native-region-scanner-js-imports.js +51 -13
- package/dist/native-region-scanner-js-reexports.js +79 -0
- package/dist/native-region-scanner-js-ts-helpers.js +23 -0
- package/dist/native-source-ledger-helpers.js +1 -1
- package/dist/native-source-ledger.js +24 -10
- package/dist/native-source-maps-ecma426.js +316 -0
- package/dist/native-source-maps.js +36 -6
- package/dist/native-source-preservation-ownership.js +292 -0
- package/dist/native-source-preservation-scanner.js +63 -25
- package/dist/native-source-preservation-types.d.ts +3 -0
- package/dist/semantic-import-effect-occurrences.js +242 -0
- package/dist/semantic-import-effect-regions.js +95 -58
- package/dist/semantic-import-graph-layers.js +224 -0
- package/dist/semantic-import-runtime-conditional-evidence.js +135 -0
- package/dist/semantic-import-runtime-effect-target-evidence.js +145 -0
- package/dist/semantic-import-runtime-exit-evidence.js +32 -0
- package/dist/semantic-import-runtime-import-meta-evidence.js +33 -0
- package/dist/semantic-import-runtime-mutation-evidence.js +155 -0
- package/dist/semantic-import-runtime-order-evidence.js +318 -0
- package/dist/semantic-import-runtime-promise-chain-evidence.js +103 -0
- package/dist/semantic-import-runtime-promise-combinator-evidence.js +166 -0
- package/dist/semantic-import-runtime-reachability-evidence.js +269 -0
- package/dist/semantic-import-runtime-resource-management-evidence.js +293 -0
- package/dist/semantic-import-runtime-switch-evidence.js +304 -0
- package/dist/semantic-import-runtime-throw-evidence.js +44 -0
- package/dist/semantic-import-runtime-try-finally-evidence.js +172 -0
- package/dist/semantic-import-sidecar-entry.js +4 -0
- package/dist/semantic-import-source-preservation.js +6 -2
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
|
+
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
3
|
+
|
|
4
|
+
const JsxRenderReturnBranchRoute = Object.freeze({
|
|
5
|
+
routeId: 'prove-jsx-render-return-branch-arm-preservation',
|
|
6
|
+
routeLane: 'jsx-static-render-return-branches',
|
|
7
|
+
routeNext: 'supply-jsx-render-return-branch-proof'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function jsxRenderReturnBranchProofAssessment(input, options = {}) {
|
|
11
|
+
const delta = jsxRenderReturnBranchDelta(input);
|
|
12
|
+
if (!delta) return undefined;
|
|
13
|
+
const proof = jsxRenderReturnBranchProofFor(delta, options);
|
|
14
|
+
const reasonCodes = [];
|
|
15
|
+
if (!proof) reasonCodes.push('jsx-render-return-branch-proof-missing');
|
|
16
|
+
else {
|
|
17
|
+
if (proof.status !== 'passed' && proof.status !== 'verified') reasonCodes.push('jsx-render-return-branch-proof-status-not-passed');
|
|
18
|
+
if (proof.schema !== 'frontier.lang.jsxRenderReturnBranchProof.v1' && proof.kind !== 'frontier.lang.jsxRenderReturnBranchProof') reasonCodes.push('jsx-render-return-branch-proof-schema-missing');
|
|
19
|
+
if (proof.sourcePath !== delta.sourcePath) reasonCodes.push('jsx-render-return-branch-proof-source-path-mismatch');
|
|
20
|
+
for (const stage of ['base', 'worker', 'head', 'output']) {
|
|
21
|
+
if (proof[`${stage}SourceHash`] !== delta[`${stage}SourceHash`]) reasonCodes.push('jsx-render-return-branch-proof-source-hash-mismatch');
|
|
22
|
+
}
|
|
23
|
+
if (proof.identityKey !== undefined && proof.identityKey !== delta.identityKey) reasonCodes.push('jsx-render-return-branch-proof-identity-mismatch');
|
|
24
|
+
if (proof.publicOwnerName !== delta.publicOwnerName || proof.tagName !== delta.tagName || proof.tagKey !== delta.tagKey) reasonCodes.push('jsx-render-return-branch-proof-identity-mismatch');
|
|
25
|
+
if (proof.returnOrdinal !== delta.returnOrdinal || proof.returnKind !== delta.returnKind || proof.branchControlKind !== delta.branchControlKind) reasonCodes.push('jsx-render-return-branch-proof-branch-kind-unsupported');
|
|
26
|
+
if (delta.nonRenderRiskPresent) reasonCodes.push('jsx-render-return-branch-proof-non-render-risk-present');
|
|
27
|
+
if (delta.branchCountUnsupported) reasonCodes.push('jsx-render-return-branch-proof-branch-count-unsupported');
|
|
28
|
+
reasonCodes.push(...branchReasonCodes(delta, proof));
|
|
29
|
+
if (proof.branchArmPreservationHash !== delta.branchArmPreservationHash) reasonCodes.push('jsx-render-return-branch-proof-output-signature-mismatch');
|
|
30
|
+
if (proof.autoMergeClaim !== false || proof.semanticEquivalenceClaim !== false || proof.runtimeEquivalenceClaim !== false
|
|
31
|
+
|| proof.renderEquivalenceClaim !== false || proof.branchArmPreservationClaim !== true
|
|
32
|
+
|| proof.claimScope !== 'static-render-return-branch-arm-preservation-only') {
|
|
33
|
+
reasonCodes.push('jsx-render-return-branch-proof-claim-flags-missing');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const status = proof && reasonCodes.length === 0 ? 'passed' : proof ? 'failed' : 'missing';
|
|
37
|
+
return {
|
|
38
|
+
status,
|
|
39
|
+
...JsxRenderReturnBranchRoute,
|
|
40
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
41
|
+
record: compactRecord({
|
|
42
|
+
schema: 'frontier.lang.jsxRenderReturnBranchProofAssessment.v1',
|
|
43
|
+
status,
|
|
44
|
+
proofStatus: proof?.status,
|
|
45
|
+
proofId: proof?.id,
|
|
46
|
+
proofHash: proof?.proofHash,
|
|
47
|
+
...JsxRenderReturnBranchRoute,
|
|
48
|
+
reasonCodes: uniqueStrings(reasonCodes),
|
|
49
|
+
expected: delta,
|
|
50
|
+
autoMergeClaim: false,
|
|
51
|
+
semanticEquivalenceClaim: false,
|
|
52
|
+
runtimeEquivalenceClaim: false,
|
|
53
|
+
renderEquivalenceClaim: false,
|
|
54
|
+
branchArmPreservationClaim: status === 'passed'
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function jsxRenderReturnBranchDelta({ identityKey, baseRecord, workerRecord, headRecord, outputRecord } = {}) {
|
|
60
|
+
const records = { base: baseRecord, worker: workerRecord, head: headRecord, output: outputRecord };
|
|
61
|
+
const branches = Object.fromEntries(Object.entries(records).map(([stage, record]) => [stage, singleBranch(record)]));
|
|
62
|
+
if (!Object.values(records).some((record) => hasBranchUnsupported(record))) return undefined;
|
|
63
|
+
const outputBranch = branches.output;
|
|
64
|
+
const branchControlKind = firstString(outputBranch?.branchControlKind, branches.worker?.branchControlKind, branches.head?.branchControlKind, branches.base?.branchControlKind);
|
|
65
|
+
if (branchControlKind !== 'conditional-expression' && branchControlKind !== 'logical-expression') return undefined;
|
|
66
|
+
const sourcePath = firstString(outputRecord?.sourcePath, workerRecord?.sourcePath, headRecord?.sourcePath, baseRecord?.sourcePath);
|
|
67
|
+
const delta = compactRecord({
|
|
68
|
+
schema: 'frontier.lang.jsxRenderReturnBranchDelta.v1',
|
|
69
|
+
identityKey,
|
|
70
|
+
sourcePath,
|
|
71
|
+
publicOwnerName: firstString(outputRecord?.publicOwnerName, workerRecord?.publicOwnerName, headRecord?.publicOwnerName, baseRecord?.publicOwnerName),
|
|
72
|
+
tagName: firstString(outputRecord?.tagName, workerRecord?.tagName, headRecord?.tagName, baseRecord?.tagName),
|
|
73
|
+
tagKey: firstString(outputRecord?.tagKey, workerRecord?.tagKey, headRecord?.tagKey, baseRecord?.tagKey),
|
|
74
|
+
baseSourceHash: baseRecord?.sourceHash,
|
|
75
|
+
workerSourceHash: workerRecord?.sourceHash,
|
|
76
|
+
headSourceHash: headRecord?.sourceHash,
|
|
77
|
+
outputSourceHash: outputRecord?.sourceHash,
|
|
78
|
+
returnOrdinal: outputBranch?.ordinal,
|
|
79
|
+
returnKind: outputBranch?.returnKind,
|
|
80
|
+
branchControlKind,
|
|
81
|
+
nonRenderRiskPresent: nonRenderRiskPresent(outputRecord ?? workerRecord ?? headRecord ?? baseRecord) || undefined,
|
|
82
|
+
branchCountUnsupported: Object.values(branches).some((branch) => !branch) || undefined,
|
|
83
|
+
base: branchSummary(branches.base),
|
|
84
|
+
worker: branchSummary(branches.worker),
|
|
85
|
+
head: branchSummary(branches.head),
|
|
86
|
+
output: branchSummary(branches.output)
|
|
87
|
+
});
|
|
88
|
+
return { ...delta, branchArmPreservationHash: jsxRenderReturnBranchProofHash(delta) };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function branchReasonCodes(delta, proof) {
|
|
92
|
+
if (delta.branchControlKind === 'conditional-expression') return conditionalBranchReasonCodes(delta, proof);
|
|
93
|
+
if (delta.branchControlKind === 'logical-expression') return logicalBranchReasonCodes(delta, proof);
|
|
94
|
+
return ['jsx-render-return-branch-proof-branch-kind-unsupported'];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function conditionalBranchReasonCodes(delta, proof) {
|
|
98
|
+
const reasons = [];
|
|
99
|
+
if (proof.conditionHash !== delta.base?.conditionHash || proof.outputConditionHash !== delta.output?.conditionHash) reasons.push('jsx-render-return-branch-proof-condition-hash-mismatch');
|
|
100
|
+
if (proof.consequentOrigin === undefined || proof.alternateOrigin === undefined) reasons.push('jsx-render-return-branch-proof-output-arm-origin-missing');
|
|
101
|
+
if (proof.outputConsequentHash !== delta.output?.consequentHash || proof.outputAlternateHash !== delta.output?.alternateHash) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
102
|
+
if (proof.consequentHash !== armHash(delta, proof.consequentOrigin, 'consequentHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
103
|
+
if (proof.alternateHash !== armHash(delta, proof.alternateOrigin, 'alternateHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
104
|
+
if (delta.output?.consequentHash !== armHash(delta, proof.consequentOrigin, 'consequentHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
105
|
+
if (delta.output?.alternateHash !== armHash(delta, proof.alternateOrigin, 'alternateHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
106
|
+
return reasons;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function logicalBranchReasonCodes(delta, proof) {
|
|
110
|
+
const reasons = [];
|
|
111
|
+
if (proof.operator !== delta.output?.operator) reasons.push('jsx-render-return-branch-proof-branch-kind-unsupported');
|
|
112
|
+
if (proof.leftOrigin === undefined || proof.rightOrigin === undefined) reasons.push('jsx-render-return-branch-proof-output-arm-origin-missing');
|
|
113
|
+
if (proof.outputLeftHash !== delta.output?.leftHash || proof.outputRightHash !== delta.output?.rightHash) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
114
|
+
if (proof.leftHash !== armHash(delta, proof.leftOrigin, 'leftHash')) reasons.push('jsx-render-return-branch-proof-logical-guard-hash-mismatch');
|
|
115
|
+
if (proof.rightHash !== armHash(delta, proof.rightOrigin, 'rightHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
116
|
+
if (delta.output?.leftHash !== armHash(delta, proof.leftOrigin, 'leftHash')) reasons.push('jsx-render-return-branch-proof-logical-guard-hash-mismatch');
|
|
117
|
+
if (delta.output?.rightHash !== armHash(delta, proof.rightOrigin, 'rightHash')) reasons.push('jsx-render-return-branch-proof-arm-hash-mismatch');
|
|
118
|
+
return reasons;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function jsxRenderReturnBranchProofFor(delta, options = {}) {
|
|
122
|
+
return [
|
|
123
|
+
options.jsxRenderReturnBranchProof,
|
|
124
|
+
...(Array.isArray(options.jsxRenderReturnBranchProofs) ? options.jsxRenderReturnBranchProofs : [])
|
|
125
|
+
].filter(Boolean).find((proof) => proof.identityKey === delta.identityKey || (
|
|
126
|
+
proof.sourcePath === delta.sourcePath && proof.publicOwnerName === delta.publicOwnerName && proof.tagKey === delta.tagKey
|
|
127
|
+
));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function jsxRenderReturnBranchProofHash(delta) {
|
|
131
|
+
return hashSemanticValue({
|
|
132
|
+
kind: 'frontier.lang.jsxRenderReturnBranchProof.expected.v1',
|
|
133
|
+
identityKey: delta.identityKey,
|
|
134
|
+
sourcePath: delta.sourcePath,
|
|
135
|
+
publicOwnerName: delta.publicOwnerName,
|
|
136
|
+
tagName: delta.tagName,
|
|
137
|
+
tagKey: delta.tagKey,
|
|
138
|
+
baseSourceHash: delta.baseSourceHash,
|
|
139
|
+
workerSourceHash: delta.workerSourceHash,
|
|
140
|
+
headSourceHash: delta.headSourceHash,
|
|
141
|
+
outputSourceHash: delta.outputSourceHash,
|
|
142
|
+
returnOrdinal: delta.returnOrdinal,
|
|
143
|
+
returnKind: delta.returnKind,
|
|
144
|
+
branchControlKind: delta.branchControlKind,
|
|
145
|
+
base: delta.base,
|
|
146
|
+
worker: delta.worker,
|
|
147
|
+
head: delta.head,
|
|
148
|
+
output: delta.output
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function singleBranch(record) {
|
|
153
|
+
const returns = Array.isArray(record?.renderReturnRecords) ? record.renderReturnRecords : [];
|
|
154
|
+
if (returns.length !== 1) return undefined;
|
|
155
|
+
const item = returns[0];
|
|
156
|
+
const branch = item.conditionalBranchRecord ?? item.logicalBranchRecord;
|
|
157
|
+
return branch ? { ...item, ...branch } : undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function branchSummary(branch) {
|
|
161
|
+
if (!branch) return undefined;
|
|
162
|
+
return compactRecord({
|
|
163
|
+
ordinal: branch.ordinal,
|
|
164
|
+
returnKind: branch.returnKind,
|
|
165
|
+
branchControlKind: branch.branchControlKind,
|
|
166
|
+
conditionHash: branch.conditionHash,
|
|
167
|
+
consequentHash: branch.consequentHash,
|
|
168
|
+
alternateHash: branch.alternateHash,
|
|
169
|
+
operator: branch.operator,
|
|
170
|
+
leftHash: branch.leftHash,
|
|
171
|
+
rightHash: branch.rightHash,
|
|
172
|
+
signatureHash: branch.signatureHash
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function nonRenderRiskPresent(record) {
|
|
177
|
+
return (record?.renderRiskKinds ?? []).some((kind) => kind !== 'render-return-boundary' && kind !== 'render-return-branch-control-flow');
|
|
178
|
+
}
|
|
179
|
+
function hasBranchUnsupported(record) { return (record?.renderRiskReasonCodes ?? []).includes('jsx-render-return-branch-unsupported'); }
|
|
180
|
+
function armHash(delta, origin, field) { return ['base', 'worker', 'head', 'output'].includes(origin) ? delta[origin]?.[field] : undefined; }
|
|
181
|
+
function firstString(...values) { return values.find((value) => typeof value === 'string' && value.length > 0); }
|
|
182
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
JsxRenderReturnBranchRoute,
|
|
186
|
+
jsxRenderReturnBranchDelta,
|
|
187
|
+
jsxRenderReturnBranchProofAssessment,
|
|
188
|
+
jsxRenderReturnBranchProofHash
|
|
189
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
const ProjectMergeMissingSignals = Object.freeze({
|
|
2
|
+
outputDiagnosticsGate: 'output-diagnostics-gate-not-run',
|
|
3
|
+
declarationGate: 'declaration-gate-not-run',
|
|
4
|
+
qualityGates: 'quality-gates-not-run',
|
|
5
|
+
focusedTestGate: 'focused-test-gate-not-run',
|
|
6
|
+
projectGraphEvidence: 'project-graph-evidence-not-included',
|
|
7
|
+
projectGraphDeltaEvidence: 'project-graph-delta-evidence-not-included',
|
|
8
|
+
sourceSpanRoundtrip: 'source-span-roundtrip-evidence-not-produced',
|
|
9
|
+
semanticArtifacts: 'semantic-artifacts-not-produced',
|
|
10
|
+
semanticEditReplayProof: 'semantic-edit-replay-proof-not-produced',
|
|
11
|
+
semanticEditReplayOutputMismatch: 'semantic-edit-replay-proof-output-mismatch',
|
|
12
|
+
unsupportedJsTsSurface: 'unsupported-js-ts-surface-proof-not-available',
|
|
13
|
+
semanticEquivalenceProof: 'semantic-equivalence-proof-not-available'
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const ProjectMergeMissingEvidenceRoutes = Object.freeze({
|
|
17
|
+
[ProjectMergeMissingSignals.outputDiagnosticsGate]: route('run-output-diagnostics', 'project-output', 'supply-output-diagnostics'),
|
|
18
|
+
[ProjectMergeMissingSignals.declarationGate]: route('emit-output-declarations', 'project-output', 'supply-declaration-output'),
|
|
19
|
+
[ProjectMergeMissingSignals.qualityGates]: route('attach-quality-gates', 'quality-gates', 'attach-passing-quality-gates'),
|
|
20
|
+
[ProjectMergeMissingSignals.focusedTestGate]: route('attach-focused-test-gate', 'quality-gates', 'attach-focused-test-gate'),
|
|
21
|
+
[ProjectMergeMissingSignals.projectGraphEvidence]: route('include-project-graph-delta', 'project-graph', 'include-project-graph-delta'),
|
|
22
|
+
[ProjectMergeMissingSignals.projectGraphDeltaEvidence]: route('include-project-graph-delta', 'project-graph', 'include-project-graph-delta'),
|
|
23
|
+
[ProjectMergeMissingSignals.sourceSpanRoundtrip]: route('produce-source-span-roundtrip-evidence', 'source-files', 'supply-source-span-roundtrip-evidence'),
|
|
24
|
+
[ProjectMergeMissingSignals.semanticArtifacts]: route('produce-semantic-artifacts', 'source-files', 'produce-semantic-edit-artifacts'),
|
|
25
|
+
[ProjectMergeMissingSignals.semanticEditReplayProof]: route('produce-semantic-edit-replay-proof', 'source-files', 'run-semantic-edit-replay-diagnostics'),
|
|
26
|
+
[ProjectMergeMissingSignals.semanticEditReplayOutputMismatch]: route('reject-semantic-edit-replay-output-mismatch', 'source-files', 'inspect-semantic-edit-replay-output-binding'),
|
|
27
|
+
[ProjectMergeMissingSignals.unsupportedJsTsSurface]: route('prove-unsupported-js-ts-surface', 'semantic-proof', 'supply-unsupported-surface-evidence'),
|
|
28
|
+
[ProjectMergeMissingSignals.semanticEquivalenceProof]: route('external-semantic-equivalence-proof', 'semantic-proof', 'attach-external-equivalence-proof')
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const ProjectMergeAdmissionMatrixRows = Object.freeze([
|
|
32
|
+
matrixRow('parser-source-span-trivia', 'partial', ['source-span-roundtrip'], [ProjectMergeMissingSignals.sourceSpanRoundtrip, ProjectMergeMissingSignals.semanticArtifacts]),
|
|
33
|
+
matrixRow('scope-use-def-graph', 'partial', ['project-graph-delta'], [ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
34
|
+
matrixRow('module-export-import-graph', 'partial', ['project-graph-delta'], [ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
35
|
+
matrixRow('type-public-api-graph', 'partial', ['declaration-output-stable', 'project-graph-delta'], [ProjectMergeMissingSignals.declarationGate, ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
36
|
+
matrixRow('jsx-tsx-element-prop-graph', 'partial', ['project-graph-delta', 'focused-test-passed'], [ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence, ProjectMergeMissingSignals.qualityGates, ProjectMergeMissingSignals.focusedTestGate]),
|
|
37
|
+
matrixRow('control-flow-effect-graph', 'partial', ['source-span-roundtrip', 'focused-test-passed'], [ProjectMergeMissingSignals.sourceSpanRoundtrip, ProjectMergeMissingSignals.semanticArtifacts, ProjectMergeMissingSignals.qualityGates, ProjectMergeMissingSignals.focusedTestGate]),
|
|
38
|
+
matrixRow('generic-semantic-edit-admission', 'partial', ['source-span-roundtrip', 'semantic-edit-replay-clean'], [ProjectMergeMissingSignals.sourceSpanRoundtrip, ProjectMergeMissingSignals.semanticArtifacts, ProjectMergeMissingSignals.semanticEditReplayProof, ProjectMergeMissingSignals.semanticEditReplayOutputMismatch]),
|
|
39
|
+
matrixRow('unsupported-js-ts-surface-coverage', 'partial', ['unsupported-js-ts-surface-review'], [ProjectMergeMissingSignals.unsupportedJsTsSurface]),
|
|
40
|
+
matrixRow('semantic-equivalence-proof', 'bounded-evidence', ['semantic-equivalence-external', 'semantic-equivalence-unknown'], [ProjectMergeMissingSignals.semanticEquivalenceProof]),
|
|
41
|
+
matrixRow('cross-file-symbol-rename', 'partial', ['diagnostics-clean', 'declaration-output-stable', 'project-graph-delta'], [ProjectMergeMissingSignals.outputDiagnosticsGate, ProjectMergeMissingSignals.declarationGate, ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
42
|
+
matrixRow('symbol-move-between-files', 'partial', ['diagnostics-clean', 'declaration-output-stable', 'project-graph-delta'], [ProjectMergeMissingSignals.outputDiagnosticsGate, ProjectMergeMissingSignals.declarationGate, ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
43
|
+
matrixRow('split-merge-modules-classes', 'partial', ['diagnostics-clean', 'declaration-output-stable', 'project-graph-delta'], [ProjectMergeMissingSignals.outputDiagnosticsGate, ProjectMergeMissingSignals.declarationGate, ProjectMergeMissingSignals.projectGraphEvidence, ProjectMergeMissingSignals.projectGraphDeltaEvidence]),
|
|
44
|
+
matrixRow('real-repo-benchmark-suite', 'partial', ['manifest-metadata-validated', 'local-checkout-metadata-proof', 'dependency-install-not-run-default', 'repository-commands-not-run-default'], [ProjectMergeMissingSignals.qualityGates, ProjectMergeMissingSignals.focusedTestGate]),
|
|
45
|
+
matrixRow('telemetry-confidence-routing', 'partial', ['semantic-equivalence-external', 'semantic-equivalence-unknown'], [ProjectMergeMissingSignals.semanticEquivalenceProof])
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
function missingEvidenceItems(summary, context = {}) {
|
|
49
|
+
const items = [];
|
|
50
|
+
if (!context.hasProjectGraphEvidence) items.push(missingEvidenceItem({
|
|
51
|
+
code: ProjectMergeMissingSignals.projectGraphEvidence,
|
|
52
|
+
scope: 'project-graph',
|
|
53
|
+
kind: 'project-graph-delta',
|
|
54
|
+
proofLevel: 'project-graph-evidence',
|
|
55
|
+
action: 'review',
|
|
56
|
+
relatedSignals: [ProjectMergeMissingSignals.projectGraphDeltaEvidence],
|
|
57
|
+
summary: 'Include project graph delta evidence before applying broad project merges so public contract, source span, compiler type, runtime region, scope/use-def, JSX prop, re-export, import-attribute, and import-target gaps are checked.',
|
|
58
|
+
suggestedInput: { includeProjectGraphDelta: true }
|
|
59
|
+
}));
|
|
60
|
+
else if (!summary.projectGraphDeltaEvidenceIncluded) items.push(missingEvidenceItem({
|
|
61
|
+
code: ProjectMergeMissingSignals.projectGraphDeltaEvidence,
|
|
62
|
+
scope: 'project-graph',
|
|
63
|
+
kind: 'project-graph-delta',
|
|
64
|
+
proofLevel: 'project-graph-delta',
|
|
65
|
+
action: 'review',
|
|
66
|
+
summary: 'Output project graph evidence was available, but graph-delta evidence was not included for broad semantic gap checks across base, worker, head, and output.',
|
|
67
|
+
suggestedInput: { includeProjectGraphDelta: true }
|
|
68
|
+
}));
|
|
69
|
+
if (!context.outputDiagnosticsGate) items.push(missingEvidenceItem({
|
|
70
|
+
code: ProjectMergeMissingSignals.outputDiagnosticsGate,
|
|
71
|
+
scope: 'project-output',
|
|
72
|
+
kind: 'diagnostics',
|
|
73
|
+
proofLevel: 'diagnostics-clean',
|
|
74
|
+
action: 'review',
|
|
75
|
+
summary: 'Run or supply output diagnostics so syntax/type diagnostic conflicts can block unsafe project output.',
|
|
76
|
+
suggestedInput: { requireOutputDiagnostics: true, outputDiagnostics: [] }
|
|
77
|
+
}));
|
|
78
|
+
if (!context.outputDeclarationGate) items.push(missingEvidenceItem({
|
|
79
|
+
code: ProjectMergeMissingSignals.declarationGate,
|
|
80
|
+
scope: 'project-output',
|
|
81
|
+
kind: 'declaration-output',
|
|
82
|
+
proofLevel: 'declaration-output-stable',
|
|
83
|
+
action: 'review',
|
|
84
|
+
summary: 'Run or supply declaration output evidence so public declaration drift is checked before apply.',
|
|
85
|
+
suggestedInput: { includeDeclarationOutput: true }
|
|
86
|
+
}));
|
|
87
|
+
if (!context.outputQualityGate) items.push(missingEvidenceItem({
|
|
88
|
+
code: ProjectMergeMissingSignals.qualityGates,
|
|
89
|
+
scope: 'quality-gates',
|
|
90
|
+
kind: 'quality-gate',
|
|
91
|
+
proofLevel: 'focused-test-passed',
|
|
92
|
+
action: 'review',
|
|
93
|
+
relatedSignals: [ProjectMergeMissingSignals.focusedTestGate],
|
|
94
|
+
summary: 'Attach focused lint, build, or test gate evidence before treating the project merge as evidence-complete.',
|
|
95
|
+
suggestedInput: { testGates: [{ id: 'focused', status: 'passed', command: 'node test/smoke/<focused>.mjs' }] }
|
|
96
|
+
}));
|
|
97
|
+
else if (!Number(context.outputQualityGate.summary?.test ?? 0)) items.push(missingEvidenceItem({
|
|
98
|
+
code: ProjectMergeMissingSignals.focusedTestGate,
|
|
99
|
+
scope: 'quality-gates',
|
|
100
|
+
kind: 'quality-gate',
|
|
101
|
+
proofLevel: 'focused-test-passed',
|
|
102
|
+
action: 'review',
|
|
103
|
+
summary: 'Quality gate evidence was supplied without a focused test gate; attach at least one passing focused test for the changed project behavior.',
|
|
104
|
+
suggestedInput: { testGates: [{ id: 'focused', status: 'passed', command: 'node test/smoke/<focused>.mjs' }] }
|
|
105
|
+
}));
|
|
106
|
+
if (!summary.semanticArtifactFiles) items.push(missingEvidenceItem({
|
|
107
|
+
code: ProjectMergeMissingSignals.semanticArtifacts,
|
|
108
|
+
scope: 'source-files',
|
|
109
|
+
kind: 'semantic-artifacts',
|
|
110
|
+
proofLevel: 'parser-roundtrip',
|
|
111
|
+
action: 'review',
|
|
112
|
+
summary: 'No semantic edit artifacts were produced for source files, so parser/projection/replay evidence cannot support automatic apply.'
|
|
113
|
+
}));
|
|
114
|
+
if (summary.semanticArtifactFiles && summary.proofSemanticEditReplayCleanStatus !== 'passed') items.push(missingEvidenceItem({
|
|
115
|
+
code: ProjectMergeMissingSignals.semanticEditReplayProof,
|
|
116
|
+
scope: 'source-files',
|
|
117
|
+
kind: 'semantic-edit-replay',
|
|
118
|
+
proofLevel: 'semantic-edit-replay-clean',
|
|
119
|
+
action: 'review',
|
|
120
|
+
summary: 'Semantic edit artifacts were produced, but clean replay proof was not available for every semantic edit candidate.'
|
|
121
|
+
}));
|
|
122
|
+
if (summary.semanticEquivalenceLevel === 'semantic-equivalence-unknown') items.push(missingEvidenceItem({
|
|
123
|
+
code: ProjectMergeMissingSignals.semanticEquivalenceProof,
|
|
124
|
+
scope: 'project',
|
|
125
|
+
kind: 'semantic-equivalence',
|
|
126
|
+
proofLevel: 'semantic-equivalence-unknown',
|
|
127
|
+
action: 'review',
|
|
128
|
+
summary: 'Executable semantic equivalence is still unknown; keep semanticEquivalenceClaim false and require human or external proof for equivalence claims.'
|
|
129
|
+
}));
|
|
130
|
+
return items;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function missingEvidenceSignals(items = []) {
|
|
134
|
+
return uniqueStrings(items.flatMap((item) => [item.code, ...(item.relatedSignals ?? [])]));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function confidenceRecommendedAction(status, failedEvidence, missingEvidence, options = {}) {
|
|
138
|
+
if (status !== 'merged' || failedEvidence > 0) {
|
|
139
|
+
return shouldRecommendRerun(missingEvidence, options) ? 'rerun' : 'block';
|
|
140
|
+
}
|
|
141
|
+
return missingEvidence.length ? 'review' : 'apply';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function compactMissingEvidenceTelemetry(items = []) {
|
|
145
|
+
return {
|
|
146
|
+
total: items.length,
|
|
147
|
+
byScope: countField(items, 'scope'),
|
|
148
|
+
byKind: countField(items, 'kind'),
|
|
149
|
+
byStatus: countField(items, 'status'),
|
|
150
|
+
byAction: countField(items, 'action'),
|
|
151
|
+
byRoute: countRoute(items),
|
|
152
|
+
byLane: countRoute(items, 'lane')
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function createProjectMergeAdmissionMatrixAudit(summary = {}, missingEvidence = [], proofEvidence = undefined) {
|
|
157
|
+
const surfaces = ProjectMergeAdmissionMatrixRows.map((row) => matrixAuditSurface(row, summary, missingEvidence, proofEvidence));
|
|
158
|
+
const missingRouteItems = surfaces.flatMap((surface) => (surface.missingRouteIds ?? []).map((routeId) => ({ routeId })));
|
|
159
|
+
const semanticEquivalenceLevel = summary.semanticEquivalenceLevel ?? proofEvidence?.summary?.semanticEquivalenceLevel ?? 'semantic-equivalence-unknown';
|
|
160
|
+
return compactRecord({
|
|
161
|
+
kind: 'frontier.lang.jsTsProjectMergeAdmissionMatrixAudit',
|
|
162
|
+
version: 1,
|
|
163
|
+
schema: 'frontier.lang.jsTsProjectMergeAdmissionMatrixAudit.v1',
|
|
164
|
+
total: surfaces.length,
|
|
165
|
+
partialRows: surfaces.filter((surface) => surface.status === 'partial').length,
|
|
166
|
+
missingRows: surfaces.filter((surface) => (surface.missingSignals ?? []).length).length,
|
|
167
|
+
semanticEquivalenceLevel,
|
|
168
|
+
semanticEquivalenceUnknown: semanticEquivalenceLevel === 'semantic-equivalence-unknown',
|
|
169
|
+
autoMergeClaim: false,
|
|
170
|
+
semanticEquivalenceClaim: semanticEquivalenceLevel !== 'semantic-equivalence-unknown',
|
|
171
|
+
routeIds: uniqueStrings(surfaces.flatMap((surface) => surface.routeIds ?? [])),
|
|
172
|
+
missingRouteIds: uniqueStrings(surfaces.flatMap((surface) => surface.missingRouteIds ?? [])),
|
|
173
|
+
byRoute: countRoute(missingRouteItems),
|
|
174
|
+
surfaces
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function prioritizedMissingEvidence(proofEvidenceMissing = [], policyMissing = []) {
|
|
179
|
+
const combined = uniqueMissingEvidence([...proofEvidenceMissing, ...policyMissing]);
|
|
180
|
+
return [
|
|
181
|
+
...combined.filter((item) => !isSemanticEquivalenceMissing(item)),
|
|
182
|
+
...combined.filter(isSemanticEquivalenceMissing)
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function missingEvidenceRouteForSignal(signal) {
|
|
187
|
+
return ProjectMergeMissingEvidenceRoutes[signal];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function missingEvidenceItem(input) {
|
|
191
|
+
const route = input.route ?? missingEvidenceRouteForSignal(input.code);
|
|
192
|
+
return compactRecord({
|
|
193
|
+
code: input.code,
|
|
194
|
+
kind: input.kind,
|
|
195
|
+
scope: input.scope,
|
|
196
|
+
status: 'missing',
|
|
197
|
+
action: input.action ?? 'review',
|
|
198
|
+
proofLevel: input.proofLevel,
|
|
199
|
+
route,
|
|
200
|
+
routeId: route?.id,
|
|
201
|
+
routeLane: route?.lane,
|
|
202
|
+
routeNext: route?.next,
|
|
203
|
+
relatedSignals: input.relatedSignals,
|
|
204
|
+
summary: input.summary,
|
|
205
|
+
suggestedInput: input.suggestedInput,
|
|
206
|
+
autoMergeClaim: false,
|
|
207
|
+
semanticEquivalenceClaim: false
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function matrixAuditSurface(row, summary, missingEvidence, proofEvidence) {
|
|
212
|
+
const routeIds = matrixRouteIds(row.signals);
|
|
213
|
+
const activeMissing = missingEvidence.filter((item) => matrixRowMatchesMissingEvidence(row, routeIds, item));
|
|
214
|
+
const missingRouteIds = uniqueStrings(activeMissing.flatMap((item) => [item.routeId, item.route?.id]));
|
|
215
|
+
return compactRecord({
|
|
216
|
+
surface: row.surface,
|
|
217
|
+
status: row.status,
|
|
218
|
+
proofLevels: row.proofLevels,
|
|
219
|
+
proofStatuses: matrixProofStatuses(row.proofLevels, summary, proofEvidence),
|
|
220
|
+
routeIds,
|
|
221
|
+
missingSignals: missingEvidenceSignals(activeMissing),
|
|
222
|
+
missingRouteIds,
|
|
223
|
+
nextMissingRouteId: missingRouteIds[0],
|
|
224
|
+
semanticEquivalenceClaim: row.surface === 'semantic-equivalence-proof' && summary.semanticEquivalenceClaim === true
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function matrixRowMatchesMissingEvidence(row, routeIds, item) {
|
|
229
|
+
return row.signals.includes(item?.code)
|
|
230
|
+
|| (item?.relatedSignals ?? []).some((signal) => row.signals.includes(signal))
|
|
231
|
+
|| row.proofLevels.includes(item?.proofLevel)
|
|
232
|
+
|| routeIds.includes(item?.routeId ?? item?.route?.id);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function matrixProofStatuses(proofLevels, summary, proofEvidence) {
|
|
236
|
+
return Object.fromEntries(proofLevels.map((level) => [level, matrixProofStatus(level, summary, proofEvidence)]));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function matrixProofStatus(level, summary, proofEvidence) {
|
|
240
|
+
const levelStatuses = proofEvidence?.summary?.levelStatuses ?? summary.proofEvidenceLevelStatuses ?? {};
|
|
241
|
+
if (levelStatuses[level]) return levelStatuses[level];
|
|
242
|
+
if (level === 'project-graph-delta') return summary.projectGraphDeltaEvidenceIncluded ? (summary.projectGraphDeltaConflicts ? 'failed' : 'passed') : 'missing';
|
|
243
|
+
if (level === 'project-graph-evidence') return summary.projectGraphConflicts ? 'failed' : summary.projectGraphDeltaEvidenceIncluded ? 'passed' : 'missing';
|
|
244
|
+
if (level === 'semantic-artifacts') return summary.semanticArtifactFiles ? 'present' : 'missing';
|
|
245
|
+
return 'absent';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function matrixRouteIds(signals) {
|
|
249
|
+
return uniqueStrings(signals.map((signal) => missingEvidenceRouteForSignal(signal)?.id));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function matrixRow(surface, status, proofLevels, signals) {
|
|
253
|
+
return Object.freeze({ surface, status, proofLevels, signals });
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function uniqueStrings(values) {
|
|
257
|
+
return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function uniqueMissingEvidence(items) {
|
|
261
|
+
const seen = new Set();
|
|
262
|
+
return items.filter((item) => {
|
|
263
|
+
const key = item?.code ?? item?.proofLevel ?? item?.summary;
|
|
264
|
+
if (!key || seen.has(key)) return false;
|
|
265
|
+
seen.add(key);
|
|
266
|
+
return true;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function countField(items, field) {
|
|
271
|
+
const counts = {};
|
|
272
|
+
for (const item of items) if (item?.[field]) counts[item[field]] = (counts[item[field]] ?? 0) + 1;
|
|
273
|
+
return counts;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function countRoute(items, field = 'id') {
|
|
277
|
+
const counts = {};
|
|
278
|
+
for (const item of items) {
|
|
279
|
+
const key = field === 'lane' ? item?.routeLane ?? item?.route?.lane : item?.routeId ?? item?.route?.id;
|
|
280
|
+
if (key) counts[key] = (counts[key] ?? 0) + 1;
|
|
281
|
+
}
|
|
282
|
+
return counts;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function route(id, lane, next) { return Object.freeze({ id, lane, next }); }
|
|
286
|
+
function shouldRecommendRerun(missingEvidence = [], options = {}) {
|
|
287
|
+
const rerunReasonCodes = new Set((options.rerunReasonCodes ?? []).filter(Boolean));
|
|
288
|
+
if (!rerunReasonCodes.size) return false;
|
|
289
|
+
const reasonCodes = (options.reasonCodes ?? []).filter(Boolean);
|
|
290
|
+
if (reasonCodes.length) return reasonCodes.every((code) => rerunReasonCodes.has(code));
|
|
291
|
+
return missingEvidence[0]?.action === 'rerun-gate' && missingEvidence[0]?.kind === 'quality-gate';
|
|
292
|
+
}
|
|
293
|
+
function isSemanticEquivalenceMissing(item) {
|
|
294
|
+
return item?.proofLevel === 'semantic-equivalence-unknown'
|
|
295
|
+
|| item?.code === ProjectMergeMissingSignals.semanticEquivalenceProof;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function compactRecord(record) {
|
|
299
|
+
return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
compactMissingEvidenceTelemetry,
|
|
304
|
+
confidenceRecommendedAction,
|
|
305
|
+
createProjectMergeAdmissionMatrixAudit,
|
|
306
|
+
missingEvidenceItems,
|
|
307
|
+
missingEvidenceRouteForSignal,
|
|
308
|
+
missingEvidenceSignals,
|
|
309
|
+
prioritizedMissingEvidence
|
|
310
|
+
};
|