@shapeshift-labs/frontier-lang-compiler 0.2.58 → 0.2.59
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.
|
@@ -24,6 +24,9 @@ export interface SemanticImportSidecarProofAdmissionSummary {
|
|
|
24
24
|
|
|
25
25
|
export interface SemanticImportSidecarQuality {
|
|
26
26
|
readonly schema: 'frontier.lang.semanticSidecarQuality.v1';
|
|
27
|
+
readonly expected: boolean;
|
|
28
|
+
readonly expectedSatisfied: boolean;
|
|
29
|
+
readonly expectedMissingReasonCodes: readonly string[];
|
|
27
30
|
readonly selected: boolean;
|
|
28
31
|
readonly eligible: boolean;
|
|
29
32
|
readonly imported: boolean;
|
|
@@ -40,6 +43,9 @@ export interface SemanticImportSidecarQuality {
|
|
|
40
43
|
|
|
41
44
|
export interface SemanticImportSidecarAdmission {
|
|
42
45
|
readonly schema: 'frontier.lang.semanticSidecarAdmission.v1';
|
|
46
|
+
readonly expected: boolean;
|
|
47
|
+
readonly expectedSatisfied: boolean;
|
|
48
|
+
readonly expectedMissingReasonCodes: readonly string[];
|
|
43
49
|
readonly selected: boolean;
|
|
44
50
|
readonly eligible: boolean;
|
|
45
51
|
readonly imported: boolean;
|
|
@@ -304,8 +304,8 @@ export interface SemanticImportSidecar {
|
|
|
304
304
|
readonly dependencyRelations: number; readonly dependencyPredicates: readonly string[];
|
|
305
305
|
readonly patchHints: number;
|
|
306
306
|
readonly evidenceWarnings: number;
|
|
307
|
-
readonly
|
|
308
|
-
readonly emptySemanticIndex: boolean;
|
|
307
|
+
readonly semanticImportExpected: boolean; readonly semanticImportExpectedSatisfied: boolean; readonly semanticImportExpectedMissingReasonCodes: readonly string[];
|
|
308
|
+
readonly readiness: SemanticMergeReadiness; readonly emptySemanticIndex: boolean;
|
|
309
309
|
};
|
|
310
310
|
readonly metadata?: Record<string, unknown>;
|
|
311
311
|
}
|
|
@@ -314,6 +314,6 @@ export interface SemanticImportSidecarOptions {
|
|
|
314
314
|
readonly id?: string;
|
|
315
315
|
readonly generatedAt?: number;
|
|
316
316
|
readonly regionPrefix?: string;
|
|
317
|
-
readonly targetPath?: string;
|
|
317
|
+
readonly targetPath?: string; readonly expected?: boolean; readonly semanticImportExpected?: boolean;
|
|
318
318
|
readonly metadata?: Record<string, unknown>;
|
|
319
319
|
}
|
|
@@ -28,6 +28,7 @@ export function createSemanticImportSidecar(importResult, options = {}) {
|
|
|
28
28
|
);
|
|
29
29
|
const patchHints = ownershipRegions.map((region) => semanticPatchHintForRegion(region, readiness, options));
|
|
30
30
|
const quality = createSemanticImportSidecarQuality({
|
|
31
|
+
expected: options.expected === true || options.semanticImportExpected === true,
|
|
31
32
|
importEntries,
|
|
32
33
|
symbols,
|
|
33
34
|
ownershipRegions,
|
|
@@ -102,6 +103,9 @@ export function createSemanticImportSidecar(importResult, options = {}) {
|
|
|
102
103
|
dependencyPredicates: dependencies.predicates,
|
|
103
104
|
patchHints: patchHints.length,
|
|
104
105
|
evidenceWarnings: quality.emptyEvidenceWarnings.length,
|
|
106
|
+
semanticImportExpected: quality.expected,
|
|
107
|
+
semanticImportExpectedSatisfied: quality.expectedSatisfied,
|
|
108
|
+
semanticImportExpectedMissingReasonCodes: quality.expectedMissingReasonCodes,
|
|
105
109
|
readiness,
|
|
106
110
|
emptySemanticIndex: symbols.length === 0
|
|
107
111
|
},
|
|
@@ -14,15 +14,28 @@ function sidecarQualityWarning(code, message, action, sourcePaths) {
|
|
|
14
14
|
|
|
15
15
|
export function createSemanticImportSidecarQuality(input) {
|
|
16
16
|
const { importEntries, symbols, ownershipRegions, patchHints, proofSpec, evidence, readiness } = input;
|
|
17
|
+
const expected = input.expected === true;
|
|
17
18
|
const sourcePaths = sidecarSourcePaths(importEntries);
|
|
18
19
|
const importCount = importEntries.length;
|
|
19
20
|
const warnings = [];
|
|
21
|
+
if (expected && importCount === 0) warnings.push(sidecarQualityWarning(
|
|
22
|
+
'expected-semantic-import-missing',
|
|
23
|
+
'Semantic import was expected but no import entries were selected.',
|
|
24
|
+
'check-semantic-import-include-globs-and-workspace-paths',
|
|
25
|
+
sourcePaths
|
|
26
|
+
));
|
|
20
27
|
if (importCount === 0) warnings.push(sidecarQualityWarning(
|
|
21
28
|
'missing-imports',
|
|
22
29
|
'Semantic sidecar has no import entries; run native import before merge admission.',
|
|
23
30
|
'run-native-import',
|
|
24
31
|
sourcePaths
|
|
25
32
|
));
|
|
33
|
+
if (expected && importCount > 0 && symbols.length === 0) warnings.push(sidecarQualityWarning(
|
|
34
|
+
'expected-semantic-import-empty',
|
|
35
|
+
'Semantic import was expected but selected imports produced zero semantic symbols.',
|
|
36
|
+
'rerun-importer-with-semantic-source-selection',
|
|
37
|
+
sourcePaths
|
|
38
|
+
));
|
|
26
39
|
if (importCount > 0 && symbols.length === 0) warnings.push(sidecarQualityWarning(
|
|
27
40
|
'empty-semantic-index',
|
|
28
41
|
'Semantic sidecar has import entries but no semantic symbols.',
|
|
@@ -86,9 +99,21 @@ export function createSemanticImportSidecarQuality(input) {
|
|
|
86
99
|
const emptyEvidenceWarnings = warnings.filter((warning) => (
|
|
87
100
|
warning.code === 'empty-evidence' ||
|
|
88
101
|
warning.code === 'empty-semantic-index' ||
|
|
102
|
+
warning.code === 'expected-semantic-import-empty' ||
|
|
103
|
+
warning.code === 'expected-semantic-import-missing' ||
|
|
89
104
|
warning.code === 'missing-ownership-regions' ||
|
|
90
105
|
warning.code === 'missing-patch-hints'
|
|
91
106
|
));
|
|
107
|
+
const expectedMissingReasonCodes = expected
|
|
108
|
+
? emptyEvidenceWarnings.map((warning) => warning.code)
|
|
109
|
+
: [];
|
|
110
|
+
const expectedSatisfied = !expected || (
|
|
111
|
+
importCount > 0 &&
|
|
112
|
+
symbols.length > 0 &&
|
|
113
|
+
ownershipRegions.length > 0 &&
|
|
114
|
+
patchHints.length > 0 &&
|
|
115
|
+
evidence.length > 0
|
|
116
|
+
);
|
|
92
117
|
const proofSummary = {
|
|
93
118
|
total: proofSpec.total,
|
|
94
119
|
obligations: proofSpec.obligations,
|
|
@@ -104,6 +129,9 @@ export function createSemanticImportSidecarQuality(input) {
|
|
|
104
129
|
};
|
|
105
130
|
return {
|
|
106
131
|
schema: 'frontier.lang.semanticSidecarQuality.v1',
|
|
132
|
+
expected,
|
|
133
|
+
expectedSatisfied,
|
|
134
|
+
expectedMissingReasonCodes,
|
|
107
135
|
selected: importCount > 0,
|
|
108
136
|
eligible: importCount > 0 && emptyEvidenceWarnings.length === 0 && proofSpec.failed === 0 && readiness !== 'blocked',
|
|
109
137
|
imported: importCount > 0,
|
|
@@ -122,6 +150,9 @@ export function createSemanticImportSidecarQuality(input) {
|
|
|
122
150
|
export function createSemanticImportSidecarAdmission(quality, readiness) {
|
|
123
151
|
return {
|
|
124
152
|
schema: 'frontier.lang.semanticSidecarAdmission.v1',
|
|
153
|
+
expected: quality.expected,
|
|
154
|
+
expectedSatisfied: quality.expectedSatisfied,
|
|
155
|
+
expectedMissingReasonCodes: quality.expectedMissingReasonCodes,
|
|
125
156
|
selected: quality.selected,
|
|
126
157
|
eligible: quality.eligible,
|
|
127
158
|
imported: quality.imported,
|
package/package.json
CHANGED