@lbdudc/linea-core 0.1.0
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 +358 -0
- package/dist/analysis/analyze.d.ts +105 -0
- package/dist/analysis/analyze.js +220 -0
- package/dist/analysis/analyze.js.map +1 -0
- package/dist/analysis/runtime.d.ts +97 -0
- package/dist/analysis/runtime.js +198 -0
- package/dist/analysis/runtime.js.map +1 -0
- package/dist/analysis/wheels/micropip-0.6.0-py3-none-any.whl +0 -0
- package/dist/analysis/wheels/packaging-23.2-py3-none-any.whl +0 -0
- package/dist/assets.d.ts +16 -0
- package/dist/assets.js +36 -0
- package/dist/assets.js.map +1 -0
- package/dist/constants.d.ts +77 -0
- package/dist/constants.js +76 -0
- package/dist/constants.js.map +1 -0
- package/dist/derivation/derive.d.ts +68 -0
- package/dist/derivation/derive.js +115 -0
- package/dist/derivation/derive.js.map +1 -0
- package/dist/derivation/engine.d.ts +48 -0
- package/dist/derivation/engine.js +98 -0
- package/dist/derivation/engine.js.map +1 -0
- package/dist/errors.d.ts +72 -0
- package/dist/errors.js +91 -0
- package/dist/errors.js.map +1 -0
- package/dist/feature-model/convert.d.ts +35 -0
- package/dist/feature-model/convert.js +47 -0
- package/dist/feature-model/convert.js.map +1 -0
- package/dist/feature-model/engine.d.ts +60 -0
- package/dist/feature-model/engine.js +139 -0
- package/dist/feature-model/engine.js.map +1 -0
- package/dist/feature-model/inspect.d.ts +67 -0
- package/dist/feature-model/inspect.js +113 -0
- package/dist/feature-model/inspect.js.map +1 -0
- package/dist/feature-model/io.d.ts +66 -0
- package/dist/feature-model/io.js +92 -0
- package/dist/feature-model/io.js.map +1 -0
- package/dist/feature-model/parse.d.ts +30 -0
- package/dist/feature-model/parse.js +36 -0
- package/dist/feature-model/parse.js.map +1 -0
- package/dist/feature-model/text.d.ts +54 -0
- package/dist/feature-model/text.js +126 -0
- package/dist/feature-model/text.js.map +1 -0
- package/dist/fs/archive.d.ts +23 -0
- package/dist/fs/archive.js +87 -0
- package/dist/fs/archive.js.map +1 -0
- package/dist/fs/diff.d.ts +40 -0
- package/dist/fs/diff.js +155 -0
- package/dist/fs/diff.js.map +1 -0
- package/dist/fs/format.d.ts +21 -0
- package/dist/fs/format.js +111 -0
- package/dist/fs/format.js.map +1 -0
- package/dist/fs/workspace.d.ts +77 -0
- package/dist/fs/workspace.js +103 -0
- package/dist/fs/workspace.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/guards.d.ts +15 -0
- package/dist/internal/guards.js +16 -0
- package/dist/internal/guards.js.map +1 -0
- package/dist/line/platform-files.d.ts +73 -0
- package/dist/line/platform-files.js +112 -0
- package/dist/line/platform-files.js.map +1 -0
- package/dist/line/scaffold.d.ts +88 -0
- package/dist/line/scaffold.js +145 -0
- package/dist/line/scaffold.js.map +1 -0
- package/dist/line/templates/core/extra.js +54 -0
- package/dist/line/templates/core/transformation.js +196 -0
- package/dist/line/templates/metamodels/dataModel/extra.js +328 -0
- package/dist/line/templates/metamodels/dataModel/transformation.js +211 -0
- package/dist/line/templates/metamodels/sensor/extra.js +36 -0
- package/dist/line/templates/metamodels/sensor/transformation.js +47 -0
- package/dist/line/templates/pipeline/.gitlab-ci.yml +51 -0
- package/dist/line/templates/pipeline/ci/test-client.sh +16 -0
- package/dist/line/templates/pipeline/ci/test-server.sh +16 -0
- package/dist/product/engine-spec.d.ts +25 -0
- package/dist/product/engine-spec.js +77 -0
- package/dist/product/engine-spec.js.map +1 -0
- package/dist/product/spec.d.ts +130 -0
- package/dist/product/spec.js +219 -0
- package/dist/product/spec.js.map +1 -0
- package/dist/product/version.d.ts +27 -0
- package/dist/product/version.js +49 -0
- package/dist/product/version.js.map +1 -0
- package/dist/products-index/products-index.d.ts +224 -0
- package/dist/products-index/products-index.js +395 -0
- package/dist/products-index/products-index.js.map +1 -0
- package/dist/selection/selection.d.ts +126 -0
- package/dist/selection/selection.js +152 -0
- package/dist/selection/selection.js.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# linea-core
|
|
2
|
+
|
|
3
|
+
Motor autocontenido de **Líneas de Producto Software (SPL)**: feature models,
|
|
4
|
+
validación de specs y derivación de productos.
|
|
5
|
+
|
|
6
|
+
Es una **librería de funciones JavaScript/TypeScript sin estado** (ADR-014):
|
|
7
|
+
cada función recibe todo lo que necesita por parámetros y devuelve resultados
|
|
8
|
+
explícitos. Sin estado interno entre llamadas, sin singletons, sin inyección de
|
|
9
|
+
dependencias, sin configuración global y sin base de datos propia.
|
|
10
|
+
|
|
11
|
+
**Funciona 100 % offline** (ADR-002): ni GitLab, ni HTTP, ni telemetría. Toda
|
|
12
|
+
integración remota vive en `linea-server` (ADR-003).
|
|
13
|
+
|
|
14
|
+
## Instalación
|
|
15
|
+
|
|
16
|
+
El paquete se consume como dependencia git mientras no se publique en npm:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@lbdudc/linea-core": "git+https://gitlab.lbd.udc.es/linea/linea-core.git"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`npm install` ejecuta `prepare` → `npm run build`, que compila TypeScript a
|
|
27
|
+
`dist/`. No hace falta ningún paso manual.
|
|
28
|
+
|
|
29
|
+
> **Aviso**: si instalas con `npm ci --ignore-scripts`, `prepare` no se ejecuta y
|
|
30
|
+
> el paquete queda **sin `dist/`**, por lo que fallará al importarlo. Es una
|
|
31
|
+
> limitación inherente a las dependencias git; desaparece cuando se publique en
|
|
32
|
+
> npm.
|
|
33
|
+
|
|
34
|
+
Requiere **Node >= 20.11**. Verificado también bajo **Bun 1.3.x**.
|
|
35
|
+
|
|
36
|
+
## Uso
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import {
|
|
40
|
+
readFeatureModel,
|
|
41
|
+
convertFeatureModel,
|
|
42
|
+
parseFeatureModel,
|
|
43
|
+
computeMandatoryFeatures,
|
|
44
|
+
estimateFeatureCount,
|
|
45
|
+
normalizeUvl,
|
|
46
|
+
resolveLinePaths
|
|
47
|
+
} from '@lbdudc/linea-core'
|
|
48
|
+
|
|
49
|
+
// Leer el feature model de un directorio de trabajo de línea (UVL o XML).
|
|
50
|
+
const { type, path, content } = readFeatureModel({ lineDir: '/tmp/mi-linea' })
|
|
51
|
+
|
|
52
|
+
// Convertir de notación.
|
|
53
|
+
const { content: xml } = convertFeatureModel({ content, from: 'UVL', to: 'XML' })
|
|
54
|
+
|
|
55
|
+
// Inspeccionar.
|
|
56
|
+
const model = parseFeatureModel({ content, type })
|
|
57
|
+
const { voidModel, mandatory } = computeMandatoryFeatures({ model })
|
|
58
|
+
|
|
59
|
+
// Helpers de texto y de rutas.
|
|
60
|
+
const features = estimateFeatureCount({ uvl: normalizeUvl({ uvl: content }) })
|
|
61
|
+
const paths = resolveLinePaths({ lineDir: '/tmp/mi-linea' })
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Selección de features
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import {
|
|
68
|
+
normalizeFeatureSelection,
|
|
69
|
+
validateFeatureSelection,
|
|
70
|
+
assertFeatureSelection,
|
|
71
|
+
validateModelAgainstSelections
|
|
72
|
+
} from '@lbdudc/linea-core'
|
|
73
|
+
|
|
74
|
+
// Acepta las tres formas históricas de spec.features.
|
|
75
|
+
const features = normalizeFeatureSelection({ spec })
|
|
76
|
+
|
|
77
|
+
// Sin excepciones: devuelve un veredicto.
|
|
78
|
+
const { valid, completed, error, errorType } = validateFeatureSelection({ model, features })
|
|
79
|
+
|
|
80
|
+
// Con excepción: lanza FeatureSelectionInvalidError.
|
|
81
|
+
const expanded = assertFeatureSelection({ model, features })
|
|
82
|
+
|
|
83
|
+
// ¿Sigue el modelo admitiendo todos estos productos?
|
|
84
|
+
const { valid: ok, broken } = validateModelAgainstSelections({
|
|
85
|
+
model,
|
|
86
|
+
selections: [{ name: 'producto-a', features: ['A', 'B'] }]
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Spec de producto
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import {
|
|
94
|
+
validateProductSpec,
|
|
95
|
+
normalizeProductSpec,
|
|
96
|
+
incrementVersion,
|
|
97
|
+
buildEngineSpec
|
|
98
|
+
} from '@lbdudc/linea-core'
|
|
99
|
+
|
|
100
|
+
// Sin excepciones. errors[].messageKey es SIEMPRE una clave i18n.
|
|
101
|
+
const { valid, errors } = validateProductSpec({ spec })
|
|
102
|
+
|
|
103
|
+
const completo = normalizeProductSpec({ spec }) // aplica los defaults
|
|
104
|
+
incrementVersion({ version: '1.2.3', index: 1 }) // '1.3.0'
|
|
105
|
+
const engineSpec = buildEngineSpec({ spec }) // forma que espera spl-js-engine
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Índice de productos (ADR-011)
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
import {
|
|
112
|
+
readProductsIndex,
|
|
113
|
+
addProductToIndex,
|
|
114
|
+
writeProductsIndex,
|
|
115
|
+
reconcileProductsIndex
|
|
116
|
+
} from '@lbdudc/linea-core'
|
|
117
|
+
|
|
118
|
+
// Una línea sin products.json devuelve un índice vacío, no lanza.
|
|
119
|
+
const index = readProductsIndex({ lineDir: '/tmp/mi-linea' })
|
|
120
|
+
|
|
121
|
+
// Todas las mutaciones son INMUTABLES: devuelven un índice nuevo.
|
|
122
|
+
// `version` es OPCIONAL: si se omite, la entrada no lleva la clave (los
|
|
123
|
+
// products.json anteriores al campo siguen valiendo y no cambian de bytes).
|
|
124
|
+
const siguiente = addProductToIndex({
|
|
125
|
+
index,
|
|
126
|
+
product: {
|
|
127
|
+
name: 'mi-producto',
|
|
128
|
+
repositorio: '/lab/mi-linea/mi-producto',
|
|
129
|
+
version: '1.0.0'
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
writeProductsIndex({ lineDir: '/tmp/mi-linea', index: siguiente })
|
|
133
|
+
|
|
134
|
+
// `removed` es informativo: no se poda nada (no hay BD que reconciliar).
|
|
135
|
+
const { index: reconciliado, added, removed } = reconcileProductsIndex({
|
|
136
|
+
index,
|
|
137
|
+
repositories: [{ name: 'mi-producto', repositorio: '/lab/mi-linea/mi-producto' }]
|
|
138
|
+
})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
La serialización es **determinista** (orden alfabético por `name`, solo los dos
|
|
142
|
+
campos normativos, salto de línea final) para que los commits de linea-server no
|
|
143
|
+
generen diffs de ruido.
|
|
144
|
+
|
|
145
|
+
La API pública es **una sola entrada** (`.`). Todo lo que hay bajo `src/` aparte
|
|
146
|
+
de `src/index.ts` es privado y puede cambiar sin aviso.
|
|
147
|
+
|
|
148
|
+
### Convención de llamada
|
|
149
|
+
|
|
150
|
+
**Todas** las funciones públicas reciben un único objeto de parámetros con
|
|
151
|
+
nombres, incluidas las de un solo argumento: `normalizeUvl({ uvl })`,
|
|
152
|
+
`estimateFeatureCount({ uvl })`, `resolveLinePaths({ lineDir })`,
|
|
153
|
+
`readTextFile({ filePath })`, `resolveAsset({ segments })`. Es más verboso que
|
|
154
|
+
un argumento posicional, pero mantiene un contrato uniforme para linea-server y
|
|
155
|
+
linea-cli y permite añadir parámetros sin romper a nadie.
|
|
156
|
+
|
|
157
|
+
### Crear una línea
|
|
158
|
+
|
|
159
|
+
```js
|
|
160
|
+
import { buildLineScaffold, writeLineScaffold } from '@lbdudc/linea-core'
|
|
161
|
+
|
|
162
|
+
// PURO: no toca disco ni red. Devuelve los ficheros en el mismo orden que
|
|
163
|
+
// LineService.createLine, listos para gitlabSession.createFile.
|
|
164
|
+
const files = buildLineScaffold({ name: 'MiLinea', models: ['UML'] })
|
|
165
|
+
// -> [{ path: 'src/platform/model.uvl', content: '...', encoding: 'text' }, ...]
|
|
166
|
+
|
|
167
|
+
// IMPURO: los materializa en disco (modo local de linea-cli).
|
|
168
|
+
const { dir } = writeLineScaffold({ dir: '/tmp/mi-linea', name: 'MiLinea' })
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
El par puro/impuro es deliberado: linea-server sube los ficheros a GitLab sin que
|
|
172
|
+
el core toque nada, y linea-cli escribe el árbol en local desde la misma
|
|
173
|
+
descripción.
|
|
174
|
+
|
|
175
|
+
### Derivar un producto
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
import { deriveProduct, deriveProductToZip } from '@lbdudc/linea-core'
|
|
179
|
+
|
|
180
|
+
const spec = { basicData: { name: 'MiTienda', version: '1.0.0' }, features: ['Shop', 'Payment'] }
|
|
181
|
+
|
|
182
|
+
await deriveProduct({ lineDir: '/tmp/mi-linea', spec, outputDir: '/tmp/producto' })
|
|
183
|
+
const zip = await deriveProductToZip({ lineDir: '/tmp/mi-linea', spec }) // Buffer
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Errores: selección inválida → `FeatureSelectionInvalidError`; plataforma
|
|
187
|
+
inservible o cualquier otro fallo del motor → `LinePlatformNotFoundError` (si una
|
|
188
|
+
anotación llama a una función que `extra.js` no define, el mensaje es la clave
|
|
189
|
+
`error_messages.missing_function_error`).
|
|
190
|
+
|
|
191
|
+
**La derivación no borra nada**: los directorios son del llamador.
|
|
192
|
+
|
|
193
|
+
> **Aviso al escribir un `extra.js`**: no uses comentarios `//`. El procesador de
|
|
194
|
+
> plantillas elimina todos los saltos de línea del código que construye
|
|
195
|
+
> (`processor.js:28`), así que un comentario de línea se traga el resto de la
|
|
196
|
+
> función generada y el fichero sale vacío. Usa `/* ... */`.
|
|
197
|
+
|
|
198
|
+
### Archivo, diff y formato
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
import { extractArchive, diffDirectories, formatDirectory } from '@lbdudc/linea-core'
|
|
202
|
+
|
|
203
|
+
const { dir } = await extractArchive({ source: '/tmp/a.zip', destDir: '/tmp/out', prefix: 'milinea' })
|
|
204
|
+
await formatDirectory({ dir })
|
|
205
|
+
const changes = diffDirectories({ oldDir: '/tmp/anterior', newDir: dir })
|
|
206
|
+
// -> [{ action: 'update', file_path: 'src/App.java', content: '...', encoding: 'text' }, ...]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`FileChange` usa el vocabulario de acciones de commit de GitLab (`action`,
|
|
210
|
+
`file_path`, `content`, `encoding`) **a propósito**, para que linea-server se lo
|
|
211
|
+
pase tal cual a `gitlabSession.commit` sin adaptador. Es un **formato neutro de
|
|
212
|
+
cambio de fichero**: una forma de datos, no una dependencia. `file_path` es
|
|
213
|
+
**siempre POSIX y relativo**.
|
|
214
|
+
|
|
215
|
+
### Analizar un feature model
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
import {
|
|
219
|
+
createAnalysisRuntime, disposeAnalysisRuntime,
|
|
220
|
+
analyzeFeatureModel, analyzeFeatureModelBdd, analyzeMetric
|
|
221
|
+
} from '@lbdudc/linea-core'
|
|
222
|
+
|
|
223
|
+
const runtime = await createAnalysisRuntime() // ~2,3 s: arranca Pyodide
|
|
224
|
+
try {
|
|
225
|
+
const info = await analyzeFeatureModel({ uvl, runtime })
|
|
226
|
+
// -> { coreFeatures, satisfiable, deadFeatures, maxDepth, ..., _skipped: [] }
|
|
227
|
+
const bdd = await analyzeFeatureModelBdd({ uvl, runtime })
|
|
228
|
+
const one = await analyzeMetric({ uvl, metric: 'deadFeatures', runtime })
|
|
229
|
+
} finally {
|
|
230
|
+
disposeAnalysisRuntime({ runtime })
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
El `runtime` **es del llamador** (ADR-014): no hay singleton de módulo. Puede
|
|
235
|
+
omitirse, y entonces cada llamada crea el suyo — correcto pero lento, así que
|
|
236
|
+
quien analice más de una vez debería mantener uno.
|
|
237
|
+
|
|
238
|
+
Dos cosas que hay que saber antes de usarlo en un servidor:
|
|
239
|
+
|
|
240
|
+
- **`disposeAnalysisRuntime` NO libera memoria.** Pyodide no ofrece teardown, así
|
|
241
|
+
que los ~180 MB de heap WASM se quedan hasta que muera el proceso; `dispose`
|
|
242
|
+
solo inutiliza el handle. Crear un runtime por petición **filtra un intérprete
|
|
243
|
+
cada vez**: hay que mantener unos pocos y reutilizarlos.
|
|
244
|
+
- **Si faltan los wheels vendorizados, el arranque falla en el acto.** No hay
|
|
245
|
+
degradación silenciosa: es el canario de ADR-021. `packageCacheDir` de Pyodide
|
|
246
|
+
es una caché y no un override, así que sin esa comprobación un wheel ausente
|
|
247
|
+
se descargaría de `cdn.jsdelivr.net` y el módulo estaría usando la red sin que
|
|
248
|
+
nadie se enterase.
|
|
249
|
+
|
|
250
|
+
El contrato de salida es **idéntico** al de `linea/flamapy-server/main.py`,
|
|
251
|
+
incluidos los umbrales (`SKIP_ENUM`, `SKIP_BDD`) y el patrón `safe()`: un fallo
|
|
252
|
+
individual devuelve `null` en su campo y lo anota en `_skipped`, sin abortar el
|
|
253
|
+
resto de la respuesta.
|
|
254
|
+
|
|
255
|
+
### Errores de validación: `messageKey` es una clave i18n
|
|
256
|
+
|
|
257
|
+
`validateProductSpec` y `validateProductsIndex` devuelven
|
|
258
|
+
`{ path, code, messageKey }`. **`messageKey` es siempre una clave**, nunca una
|
|
259
|
+
frase legible: pásala por la función de traducción del consumidor y ramifica con
|
|
260
|
+
`code`, que es estable.
|
|
261
|
+
|
|
262
|
+
Cinco claves vienen del monolito y ya están traducidas; **diez son nuevas y
|
|
263
|
+
todavía no**, así que hoy se pintarían literales. Ver la tabla del
|
|
264
|
+
`CHANGELOG.md`, que es la lista de trabajo para quien migre webui y cli.
|
|
265
|
+
|
|
266
|
+
### Notación explícita, nunca inferida
|
|
267
|
+
|
|
268
|
+
Las funciones que reciben un modelo exigen el `type` exacto (`'UVL'` o `'XML'`).
|
|
269
|
+
El monolito lo relaja con `(type ?? 'UVL').toUpperCase()` porque
|
|
270
|
+
`line.featureModelType` puede venir `undefined` de Mongo en líneas antiguas
|
|
271
|
+
(`LineService.js:284,401,432`). **Aplicar ese valor por defecto es
|
|
272
|
+
responsabilidad del llamador**: pasa `line.featureModelType ?? 'UVL'`.
|
|
273
|
+
|
|
274
|
+
## Estructura de un directorio de línea
|
|
275
|
+
|
|
276
|
+
Se corresponde con `paths.platform.*` de
|
|
277
|
+
`linea/server/src/resources/properties.yml`:
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
<lineDir>/
|
|
281
|
+
products.json índice de productos (ADR-011)
|
|
282
|
+
src/platform/
|
|
283
|
+
model.uvl | model.xml feature model (UVL preferido)
|
|
284
|
+
config.json configuración del motor de derivación
|
|
285
|
+
extra.js helpers de plantilla
|
|
286
|
+
transformation.js transformación de la spec
|
|
287
|
+
code/ código anotado que consume spl-js-engine
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Desarrollo
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm install
|
|
294
|
+
npm run typecheck # tsc --noEmit sobre src, test y scripts
|
|
295
|
+
npm run lint # eslint 9 flat config + typescript-eslint
|
|
296
|
+
npm run test # vitest run
|
|
297
|
+
npm run build # tsc + copia de assets a dist/
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Los ficheros que no son TypeScript bajo `src/` (por ejemplo
|
|
301
|
+
`src/line/templates/**`) son **assets**: `scripts/copy-assets.mjs` los replica en
|
|
302
|
+
`dist/` conservando su ruta relativa, y `resolveAsset()` los localiza vía
|
|
303
|
+
`import.meta.url`. Así la ruta relativa al módulo es la misma en fuente y en
|
|
304
|
+
`dist/`.
|
|
305
|
+
|
|
306
|
+
## Decisiones de arquitectura relevantes
|
|
307
|
+
|
|
308
|
+
| ADR | Qué fija |
|
|
309
|
+
|---|---|
|
|
310
|
+
| ADR-001 | Separación en 4 módulos; `core` no depende de nadie |
|
|
311
|
+
| ADR-002 | linea-core funciona sin conexión a internet |
|
|
312
|
+
| ADR-003 | Solo linea-server habla con GitLab |
|
|
313
|
+
| ADR-008 | Análisis de feature models con `@lbdudc/flamapy.js` |
|
|
314
|
+
| ADR-009 | Persistencia en GitLab; el core trabaja sobre directorios |
|
|
315
|
+
| ADR-011 | Índice de productos en `products.json` |
|
|
316
|
+
| ADR-014 | linea-core es una librería de funciones sin estado |
|
|
317
|
+
|
|
318
|
+
Paridad funcional: el monolito `linea/` es la referencia de comportamiento. Cada
|
|
319
|
+
función documenta en su JSDoc el fichero y la función original que migra.
|
|
320
|
+
|
|
321
|
+
## Deuda técnica conocida
|
|
322
|
+
|
|
323
|
+
- **`spl-js-engine` apunta a un commit de una rama sin publicar.** La versión
|
|
324
|
+
`4.0.5` del registro npm **no tiene soporte UVL en absoluto** (`fromUVL` y
|
|
325
|
+
`toUVL` son `undefined`, y falta `feature-model-uvl.js`), así que es
|
|
326
|
+
obligatorio usar la rama `#next`. Está fijada al commit
|
|
327
|
+
`cd67af2fd2f4019e99cbeb5ac4a8622f5549e68e` por reproducibilidad y vía
|
|
328
|
+
`git+https://` (nunca `git+ssh://`, que obligaría a cada consumidor a tener
|
|
329
|
+
claves de GitHub). Migrar a una versión publicada en cuanto exista.
|
|
330
|
+
- **Ruido en consola del parser UVL.** `uvl-parser/src/FeatureModel.js:22-28`
|
|
331
|
+
decide si su argumento es una ruta con `fs.statSync` y hace
|
|
332
|
+
`console.error('Error: ' + e)` cuando no lo es, volcando el modelo entero a
|
|
333
|
+
stderr en **cada** parseo. `src/feature-model/engine.ts` filtra exactamente ese
|
|
334
|
+
mensaje. Retirar el filtro si el upstream lo corrige.
|
|
335
|
+
- **Licencia sin confirmar.** `package.json` declara `UNLICENSED` como marcador.
|
|
336
|
+
TODO: actualizar cuando dirección responda.
|
|
337
|
+
- **Wheels de Python vendorizados (ADR-021).** `@lbdudc/flamapy.js` descarga
|
|
338
|
+
`micropip` y `packaging` de `cdn.jsdelivr.net` en una instalación limpia, lo
|
|
339
|
+
que rompe ADR-002, y sin red **no falla: devuelve `undefined` en silencio**.
|
|
340
|
+
Por eso `src/analysis/` no usa su `setupPyodide` sino un arranque propio, y
|
|
341
|
+
lleva los dos wheels (319 KB) dentro del paquete. Es una **mitigación con
|
|
342
|
+
fecha de caducidad**: si el laboratorio hace que `@lbdudc/flamapy.js`
|
|
343
|
+
incluya `micropip` y acepte configurar `indexURL`/`packageCacheDir`,
|
|
344
|
+
hay que retirar el vendorizado.
|
|
345
|
+
- **`disposeAnalysisRuntime` no libera memoria** (ADR-029). Pyodide no expone
|
|
346
|
+
teardown, así que los ~180 MB de heap WASM de cada intérprete siguen ocupados
|
|
347
|
+
hasta que muere el proceso; `dispose` solo inutiliza el handle. **linea-server
|
|
348
|
+
no puede crear un runtime por petición**: debe mantener unos pocos y
|
|
349
|
+
reutilizarlos.
|
|
350
|
+
- **Los tests de análisis corren cerca del techo de memoria.** Por eso están
|
|
351
|
+
repartidos en cuatro ficheros (Vitest da un worker por fichero, y es la única
|
|
352
|
+
forma de mantener los heaps WASM separados): `analyze.test.ts` comparte dos
|
|
353
|
+
runtimes para sus 22 tests, y `runtime.test.ts` y `wheels-missing.test.ts`
|
|
354
|
+
aíslan los que arrancan su propia instancia. **No añadas más instancias a un
|
|
355
|
+
fichero existente**; crea uno nuevo. Se observó una vez un fallo intermitente
|
|
356
|
+
de 2 tests bajo carga que no se reprodujo en seis pasadas posteriores, así que
|
|
357
|
+
el margen es estrecho: si el runner de CI tiene menos memoria que una máquina
|
|
358
|
+
de desarrollo, este es el primer sitio donde lo vas a notar.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type AnalysisRuntime } from './runtime.js';
|
|
2
|
+
/** Solver requested by the caller. */
|
|
3
|
+
export type AnalysisMode = 'SAT' | 'BDD';
|
|
4
|
+
/** Metrics `analyzeMetric` accepts, matching the `match` arms of `main.py`. */
|
|
5
|
+
export declare const ANALYSIS_METRICS: readonly ["satisfiable", "deadFeatures", "falseOptionalFeatures"];
|
|
6
|
+
/** A metric name accepted by `analyzeMetric`. */
|
|
7
|
+
export type AnalysisMetric = (typeof ANALYSIS_METRICS)[number];
|
|
8
|
+
/** Structural + SAT analysis, the fast path. */
|
|
9
|
+
export interface FeatureModelAnalysis {
|
|
10
|
+
coreFeatures: unknown;
|
|
11
|
+
averageBranchingFactor: unknown;
|
|
12
|
+
maxDepth: unknown;
|
|
13
|
+
estimatedConfigurations: unknown;
|
|
14
|
+
leafNumber: unknown;
|
|
15
|
+
leafFeatures: unknown;
|
|
16
|
+
atomicSets: unknown;
|
|
17
|
+
satisfiable: unknown;
|
|
18
|
+
deadFeatures: unknown;
|
|
19
|
+
falseOptionalFeatures: unknown;
|
|
20
|
+
/** Features counted by `estimateFeatureCount` over the normalised document. */
|
|
21
|
+
_featureCount: number;
|
|
22
|
+
/** `'small' | 'medium' | 'large' | 'very_large'`, thresholds from `main.py`. */
|
|
23
|
+
_modelSize: string;
|
|
24
|
+
/** Echo of the requested mode. */
|
|
25
|
+
_solveMode: AnalysisMode;
|
|
26
|
+
/** Always `[]` here: the fast path skips nothing. */
|
|
27
|
+
_skipped: string[];
|
|
28
|
+
_elapsedMs: number;
|
|
29
|
+
}
|
|
30
|
+
/** BDD + enumeration analysis, the slow path. */
|
|
31
|
+
export interface FeatureModelBddAnalysis {
|
|
32
|
+
configurations: unknown;
|
|
33
|
+
configsNumber: unknown;
|
|
34
|
+
configDistribution: unknown;
|
|
35
|
+
featureInclusionProb: unknown;
|
|
36
|
+
homogeneity: unknown;
|
|
37
|
+
variability: unknown;
|
|
38
|
+
uniqueFeatures: unknown;
|
|
39
|
+
variantFeatures: unknown;
|
|
40
|
+
/** Fields deliberately not computed because the model is too large. */
|
|
41
|
+
_skipped: string[];
|
|
42
|
+
_elapsedMs: number;
|
|
43
|
+
}
|
|
44
|
+
/** Result of `analyzeMetric`: the requested metric plus the solver used. */
|
|
45
|
+
export type MetricAnalysis = Partial<Record<AnalysisMetric, unknown>> & {
|
|
46
|
+
_solveMode: AnalysisMode;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Fast analysis: structural metrics plus the SAT group.
|
|
50
|
+
*
|
|
51
|
+
* PARITY QUIRK: `mode` does NOT change what is computed. `main.py` always runs
|
|
52
|
+
* the PySAT operations here and only echoes the requested mode back in
|
|
53
|
+
* `_solveMode`; the BDD group lives in `analyzeFeatureModelBdd`. Reproduced as
|
|
54
|
+
* is, because webui reads `_solveMode` to label the result.
|
|
55
|
+
*
|
|
56
|
+
* @param params.uvl UVL document. Normalised internally.
|
|
57
|
+
* @param params.mode Solver to report. Defaults to `'BDD'`.
|
|
58
|
+
* @param params.runtime Optional runtime to reuse.
|
|
59
|
+
* @returns Every field of `main.py`'s `/analyze`. Individual failures are `null`.
|
|
60
|
+
* @throws {InvalidArgumentError} for a non-string or non-`features` document.
|
|
61
|
+
* @throws {AnalysisRuntimeError} if the runtime cannot start or was disposed.
|
|
62
|
+
*/
|
|
63
|
+
export declare const analyzeFeatureModel: ({ uvl, mode, runtime }: {
|
|
64
|
+
uvl: string;
|
|
65
|
+
mode?: AnalysisMode;
|
|
66
|
+
runtime?: AnalysisRuntime;
|
|
67
|
+
}) => Promise<FeatureModelAnalysis>;
|
|
68
|
+
/**
|
|
69
|
+
* Slow analysis: the BDD group plus full configuration enumeration.
|
|
70
|
+
*
|
|
71
|
+
* Both are exponential, so `ANALYSIS_THRESHOLDS` gates them exactly as `main.py`
|
|
72
|
+
* does with `SKIP_BDD` and `SKIP_ENUM`:
|
|
73
|
+
* - at or above 100 features, every field is `null` and all eight names land in
|
|
74
|
+
* `_skipped` — the runtime is not even touched;
|
|
75
|
+
* - above 30 features, `configurations` alone is skipped.
|
|
76
|
+
*
|
|
77
|
+
* @param params.uvl UVL document.
|
|
78
|
+
* @param params.runtime Optional runtime to reuse.
|
|
79
|
+
* @returns Every field of `main.py`'s `/analyze/bdd`.
|
|
80
|
+
* @throws {InvalidArgumentError} for a non-string or non-`features` document.
|
|
81
|
+
*/
|
|
82
|
+
export declare const analyzeFeatureModelBdd: ({ uvl, runtime }: {
|
|
83
|
+
uvl: string;
|
|
84
|
+
runtime?: AnalysisRuntime;
|
|
85
|
+
}) => Promise<FeatureModelBddAnalysis>;
|
|
86
|
+
/**
|
|
87
|
+
* Computes a single metric.
|
|
88
|
+
*
|
|
89
|
+
* Mirrors the `match` of `main.py`'s `/analyze/metric`, including which solver
|
|
90
|
+
* each arm uses: only `satisfiable` honours `mode` (PySAT or BDD); the other two
|
|
91
|
+
* are PySAT-only and always report `_solveMode: 'SAT'`.
|
|
92
|
+
*
|
|
93
|
+
* @param params.uvl UVL document.
|
|
94
|
+
* @param params.metric One of `ANALYSIS_METRICS`.
|
|
95
|
+
* @param params.mode Solver, only meaningful for `satisfiable`. Defaults to `'BDD'`.
|
|
96
|
+
* @param params.runtime Optional runtime to reuse.
|
|
97
|
+
* @returns The metric plus the solver actually used.
|
|
98
|
+
* @throws {InvalidArgumentError} for an unknown metric or a malformed document.
|
|
99
|
+
*/
|
|
100
|
+
export declare const analyzeMetric: ({ uvl, metric, mode, runtime }: {
|
|
101
|
+
uvl: string;
|
|
102
|
+
metric: AnalysisMetric;
|
|
103
|
+
mode?: AnalysisMode;
|
|
104
|
+
runtime?: AnalysisRuntime;
|
|
105
|
+
}) => Promise<MetricAnalysis>;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature model analysis (ADR-008, ADR-021).
|
|
3
|
+
*
|
|
4
|
+
* Migrated from `linea/flamapy-server/main.py`: `/analyze` (~215-270),
|
|
5
|
+
* `/analyze/bdd` (~273-340) and `/analyze/metric` (~340-367). The RESPONSE SHAPE
|
|
6
|
+
* is contractual — webui and linea-cli already consume these exact keys — so it
|
|
7
|
+
* is reproduced field for field, including the `_`-prefixed metadata.
|
|
8
|
+
*
|
|
9
|
+
* The `safe()` pattern of `main.py:105-117` is preserved: an operation that
|
|
10
|
+
* fails yields `null` in its own field and never aborts the whole response. A
|
|
11
|
+
* partially analysable model still returns everything it could compute.
|
|
12
|
+
*/
|
|
13
|
+
import { ANALYSIS_THRESHOLDS } from '../constants.js';
|
|
14
|
+
import { InvalidArgumentError } from '../errors.js';
|
|
15
|
+
import { estimateFeatureCount, normalizeUvl } from '../feature-model/text.js';
|
|
16
|
+
import { createAnalysisRuntime, disposeAnalysisRuntime, runOperation, useRuntime } from './runtime.js';
|
|
17
|
+
/** Metrics `analyzeMetric` accepts, matching the `match` arms of `main.py`. */
|
|
18
|
+
export const ANALYSIS_METRICS = ['satisfiable', 'deadFeatures', 'falseOptionalFeatures'];
|
|
19
|
+
/** BDD fields, in the order `main.py` lists them. */
|
|
20
|
+
const BDD_FIELDS = [
|
|
21
|
+
'configsNumber', 'configDistribution', 'featureInclusionProb',
|
|
22
|
+
'homogeneity', 'variability', 'uniqueFeatures', 'variantFeatures'
|
|
23
|
+
];
|
|
24
|
+
/** Verbatim from `main.py`'s `/analyze`. */
|
|
25
|
+
const modelSizeOf = (featureCount) => {
|
|
26
|
+
if (featureCount < 50)
|
|
27
|
+
return 'small';
|
|
28
|
+
if (featureCount < 100)
|
|
29
|
+
return 'medium';
|
|
30
|
+
if (featureCount < 250)
|
|
31
|
+
return 'large';
|
|
32
|
+
return 'very_large';
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Normalises and sanity-checks the input, mirroring every endpoint's preamble.
|
|
36
|
+
* `main.py` answers HTTP 400 when the document does not start with `features`.
|
|
37
|
+
*/
|
|
38
|
+
const prepareUvl = (uvl) => {
|
|
39
|
+
if (typeof uvl !== 'string') {
|
|
40
|
+
throw new InvalidArgumentError('"uvl" must be a string.');
|
|
41
|
+
}
|
|
42
|
+
const normalised = normalizeUvl({ uvl });
|
|
43
|
+
if (!normalised.startsWith('features')) {
|
|
44
|
+
throw new InvalidArgumentError('The UVL document must start with "features". Got: ' +
|
|
45
|
+
`${JSON.stringify(normalised.slice(0, 40))}`);
|
|
46
|
+
}
|
|
47
|
+
return normalised;
|
|
48
|
+
};
|
|
49
|
+
const assertMode = (mode) => {
|
|
50
|
+
if (mode === undefined)
|
|
51
|
+
return 'BDD';
|
|
52
|
+
if (mode !== 'SAT' && mode !== 'BDD') {
|
|
53
|
+
throw new InvalidArgumentError(`"mode" must be "SAT" or "BDD", got ${JSON.stringify(mode)}.`);
|
|
54
|
+
}
|
|
55
|
+
return mode;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* `main.py:safe()` — run an operation, and on failure record `null` instead of
|
|
59
|
+
* letting one broken metric take the whole response down.
|
|
60
|
+
*/
|
|
61
|
+
const safe = async (run) => {
|
|
62
|
+
try {
|
|
63
|
+
return await run();
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
/** Runs `body` with a runtime, creating and disposing a private one if needed. */
|
|
70
|
+
const withRuntime = async (runtime, body) => {
|
|
71
|
+
if (runtime !== undefined)
|
|
72
|
+
return await body(runtime);
|
|
73
|
+
// Bootstrapping costs ~2.3 s; callers running more than one analysis should
|
|
74
|
+
// create a runtime once and pass it in.
|
|
75
|
+
const owned = await createAnalysisRuntime();
|
|
76
|
+
try {
|
|
77
|
+
return await body(owned);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
disposeAnalysisRuntime({ runtime: owned });
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Fast analysis: structural metrics plus the SAT group.
|
|
85
|
+
*
|
|
86
|
+
* PARITY QUIRK: `mode` does NOT change what is computed. `main.py` always runs
|
|
87
|
+
* the PySAT operations here and only echoes the requested mode back in
|
|
88
|
+
* `_solveMode`; the BDD group lives in `analyzeFeatureModelBdd`. Reproduced as
|
|
89
|
+
* is, because webui reads `_solveMode` to label the result.
|
|
90
|
+
*
|
|
91
|
+
* @param params.uvl UVL document. Normalised internally.
|
|
92
|
+
* @param params.mode Solver to report. Defaults to `'BDD'`.
|
|
93
|
+
* @param params.runtime Optional runtime to reuse.
|
|
94
|
+
* @returns Every field of `main.py`'s `/analyze`. Individual failures are `null`.
|
|
95
|
+
* @throws {InvalidArgumentError} for a non-string or non-`features` document.
|
|
96
|
+
* @throws {AnalysisRuntimeError} if the runtime cannot start or was disposed.
|
|
97
|
+
*/
|
|
98
|
+
export const analyzeFeatureModel = async ({ uvl, mode, runtime }) => {
|
|
99
|
+
const document = prepareUvl(uvl);
|
|
100
|
+
const solveMode = assertMode(mode);
|
|
101
|
+
const started = Date.now();
|
|
102
|
+
const featureCount = estimateFeatureCount({ uvl: document });
|
|
103
|
+
return await withRuntime(runtime, async (provided) => {
|
|
104
|
+
const state = useRuntime(provided);
|
|
105
|
+
const basic = async (operation) => await safe(async () => await runOperation(state, operation, document, 'basic'));
|
|
106
|
+
const pysat = async (operation) => await safe(async () => await runOperation(state, operation, document, 'pysat'));
|
|
107
|
+
return {
|
|
108
|
+
coreFeatures: await basic('core_features'),
|
|
109
|
+
averageBranchingFactor: await basic('average_branching_factor'),
|
|
110
|
+
maxDepth: await basic('max_depth'),
|
|
111
|
+
estimatedConfigurations: await basic('estimated_number_of_configurations'),
|
|
112
|
+
leafNumber: await basic('count_leafs'),
|
|
113
|
+
leafFeatures: await basic('leaf_features'),
|
|
114
|
+
atomicSets: await basic('atomic_sets'),
|
|
115
|
+
satisfiable: await pysat('Satisfiable'),
|
|
116
|
+
deadFeatures: await pysat('DeadFeatures'),
|
|
117
|
+
falseOptionalFeatures: await pysat('FalseOptionalFeatures'),
|
|
118
|
+
_featureCount: featureCount,
|
|
119
|
+
_modelSize: modelSizeOf(featureCount),
|
|
120
|
+
_solveMode: solveMode,
|
|
121
|
+
_skipped: [],
|
|
122
|
+
_elapsedMs: Date.now() - started
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Slow analysis: the BDD group plus full configuration enumeration.
|
|
128
|
+
*
|
|
129
|
+
* Both are exponential, so `ANALYSIS_THRESHOLDS` gates them exactly as `main.py`
|
|
130
|
+
* does with `SKIP_BDD` and `SKIP_ENUM`:
|
|
131
|
+
* - at or above 100 features, every field is `null` and all eight names land in
|
|
132
|
+
* `_skipped` — the runtime is not even touched;
|
|
133
|
+
* - above 30 features, `configurations` alone is skipped.
|
|
134
|
+
*
|
|
135
|
+
* @param params.uvl UVL document.
|
|
136
|
+
* @param params.runtime Optional runtime to reuse.
|
|
137
|
+
* @returns Every field of `main.py`'s `/analyze/bdd`.
|
|
138
|
+
* @throws {InvalidArgumentError} for a non-string or non-`features` document.
|
|
139
|
+
*/
|
|
140
|
+
export const analyzeFeatureModelBdd = async ({ uvl, runtime }) => {
|
|
141
|
+
const document = prepareUvl(uvl);
|
|
142
|
+
const started = Date.now();
|
|
143
|
+
const featureCount = estimateFeatureCount({ uvl: document });
|
|
144
|
+
const skipped = [];
|
|
145
|
+
if (featureCount >= ANALYSIS_THRESHOLDS.skipBdd) {
|
|
146
|
+
skipped.push('configurations', ...BDD_FIELDS);
|
|
147
|
+
return {
|
|
148
|
+
configurations: null,
|
|
149
|
+
configsNumber: null,
|
|
150
|
+
configDistribution: null,
|
|
151
|
+
featureInclusionProb: null,
|
|
152
|
+
homogeneity: null,
|
|
153
|
+
variability: null,
|
|
154
|
+
uniqueFeatures: null,
|
|
155
|
+
variantFeatures: null,
|
|
156
|
+
_skipped: skipped,
|
|
157
|
+
_elapsedMs: Date.now() - started
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return await withRuntime(runtime, async (provided) => {
|
|
161
|
+
const state = useRuntime(provided);
|
|
162
|
+
let configurations = null;
|
|
163
|
+
if (featureCount <= ANALYSIS_THRESHOLDS.skipEnumeration) {
|
|
164
|
+
configurations = await safe(async () => await runOperation(state, 'configurations', document, 'basic'));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
skipped.push('configurations');
|
|
168
|
+
}
|
|
169
|
+
const bdd = async (operation) => await safe(async () => await runOperation(state, operation, document, 'bdd'));
|
|
170
|
+
return {
|
|
171
|
+
configurations,
|
|
172
|
+
configsNumber: await bdd('ConfigurationsNumber'),
|
|
173
|
+
configDistribution: await bdd('ProductDistribution'),
|
|
174
|
+
featureInclusionProb: await bdd('FeatureInclusionProbability'),
|
|
175
|
+
homogeneity: await bdd('Homogeneity'),
|
|
176
|
+
variability: await bdd('Variability'),
|
|
177
|
+
uniqueFeatures: await bdd('UniqueFeatures'),
|
|
178
|
+
variantFeatures: await bdd('VariantFeatures'),
|
|
179
|
+
_skipped: skipped,
|
|
180
|
+
_elapsedMs: Date.now() - started
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Computes a single metric.
|
|
186
|
+
*
|
|
187
|
+
* Mirrors the `match` of `main.py`'s `/analyze/metric`, including which solver
|
|
188
|
+
* each arm uses: only `satisfiable` honours `mode` (PySAT or BDD); the other two
|
|
189
|
+
* are PySAT-only and always report `_solveMode: 'SAT'`.
|
|
190
|
+
*
|
|
191
|
+
* @param params.uvl UVL document.
|
|
192
|
+
* @param params.metric One of `ANALYSIS_METRICS`.
|
|
193
|
+
* @param params.mode Solver, only meaningful for `satisfiable`. Defaults to `'BDD'`.
|
|
194
|
+
* @param params.runtime Optional runtime to reuse.
|
|
195
|
+
* @returns The metric plus the solver actually used.
|
|
196
|
+
* @throws {InvalidArgumentError} for an unknown metric or a malformed document.
|
|
197
|
+
*/
|
|
198
|
+
export const analyzeMetric = async ({ uvl, metric, mode, runtime }) => {
|
|
199
|
+
const document = prepareUvl(uvl);
|
|
200
|
+
const requestedMode = assertMode(mode);
|
|
201
|
+
if (!ANALYSIS_METRICS.includes(metric)) {
|
|
202
|
+
throw new InvalidArgumentError(`Unknown metric ${JSON.stringify(metric)}. Supported: ${ANALYSIS_METRICS.join(', ')}.`);
|
|
203
|
+
}
|
|
204
|
+
return await withRuntime(runtime, async (provided) => {
|
|
205
|
+
const state = useRuntime(provided);
|
|
206
|
+
if (metric === 'satisfiable') {
|
|
207
|
+
const solver = requestedMode === 'SAT' ? 'pysat' : 'bdd';
|
|
208
|
+
return {
|
|
209
|
+
satisfiable: await safe(async () => await runOperation(state, 'Satisfiable', document, solver)),
|
|
210
|
+
_solveMode: requestedMode
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const operation = metric === 'deadFeatures' ? 'DeadFeatures' : 'FalseOptionalFeatures';
|
|
214
|
+
return {
|
|
215
|
+
[metric]: await safe(async () => await runOperation(state, operation, document, 'pysat')),
|
|
216
|
+
_solveMode: 'SAT'
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
//# sourceMappingURL=analyze.js.map
|