@highstate/backend 0.7.10 → 0.8.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.
@@ -47,7 +47,7 @@ import {
47
47
  projectOperationSchema,
48
48
  resolverFactories,
49
49
  terminalSessionSchema
50
- } from "../chunk-TDCHA47F.js";
50
+ } from "../chunk-JEOPTUKC.js";
51
51
  export {
52
52
  CircularDependencyError,
53
53
  applyLibraryUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/backend",
3
- "version": "0.7.10",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -26,7 +26,7 @@
26
26
  "build": "highstate build"
27
27
  },
28
28
  "dependencies": {
29
- "@highstate/contract": "^0.7.10",
29
+ "@highstate/contract": "^0.8.0",
30
30
  "@types/node": "^22.10.1",
31
31
  "ajv": "^8.17.1",
32
32
  "better-lock": "^3.2.0",
@@ -65,5 +65,5 @@
65
65
  "rollup": "^4.28.1",
66
66
  "typescript": "^5.7.2"
67
67
  },
68
- "gitHead": "171465dab44ebcedd1d1eb9e5369fb1c88daa480"
68
+ "gitHead": "8590eea089a016c9b4b797299fc94ddc9afe10ba"
69
69
  }
@@ -213,6 +213,8 @@ export class LocalLibraryBackend implements LibraryBackend {
213
213
  private async reloadLibrary(): Promise<[LibraryModel, Worker]> {
214
214
  this.logger.info("reloading library")
215
215
 
216
+ await this.ensureLibraryPackagesLoaded(this.libraryPackages, true)
217
+
216
218
  this.worker = this.createLibraryWorker({
217
219
  modulePaths: this.libraryPackages,
218
220
  logLevel: "silent",
@@ -405,7 +405,9 @@ export class OperationWorkset {
405
405
  }
406
406
 
407
407
  for (const child of instance.children) {
408
- workset.addInstance(child)
408
+ if (!workset.instanceMap.has(child.id)) {
409
+ workset.addInstance(child)
410
+ }
409
411
  }
410
412
  }
411
413
 
@@ -155,6 +155,8 @@ export class ProjectManager {
155
155
 
156
156
  private async evaluateCompositeInstances(projectId: string, instanceIds: string[]) {
157
157
  await this.projectLockManager.getLock(projectId).lockInstances(instanceIds, async () => {
158
+ this.logger.debug({ instanceIds }, "evaluating composite instances")
159
+
158
160
  const [
159
161
  { instances, resolvedInputs, stateMap, resolveInputHash },
160
162
  topLevelCompositeChildrenIds,
@@ -251,6 +253,11 @@ export class ProjectManager {
251
253
  compositeInstances.length,
252
254
  )
253
255
 
256
+ this.logger.debug(
257
+ { compositeInstanceIds: compositeInstances.map(instance => instance.instance.id) },
258
+ "persisted composite instances",
259
+ )
260
+
254
261
  await Promise.all(promises)
255
262
  })
256
263
  }
@@ -294,11 +301,12 @@ export class ProjectManager {
294
301
  const resolvedUnits = await this.libraryBackend.getResolvedUnitSources([instance.type])
295
302
  const resolvedUnit = resolvedUnits.find(unit => unit.unitType === instance.type)
296
303
 
297
- if (!resolvedUnit) {
298
- throw new Error(`Resolved unit not found for type "${instance.type}"`)
304
+ if (resolvedUnit) {
305
+ sourceHash = resolvedUnit.sourceHash
306
+ } else {
307
+ this.logger.warn(`resolved unit not found for type "%s"`, instance.type)
308
+ sourceHash = undefined
299
309
  }
300
-
301
- sourceHash = resolvedUnit.sourceHash
302
310
  }
303
311
 
304
312
  inputHashInputs.set(instance.id, {
@@ -254,14 +254,18 @@ export class LocalRunnerBackend implements RunnerBackend {
254
254
  async stack => {
255
255
  await this.setStackConfig(stack, configMap)
256
256
 
257
+ const summary = await stack.workspace.stack()
258
+
259
+ let currentResourceCount = 0
260
+ const initialTotalResourceCount = summary?.resourceCount ?? 0
261
+
257
262
  this.updateState({
258
263
  id: instanceId,
259
264
  status: preview ? "previewing" : "updating",
260
- currentResourceCount: 0,
261
- totalResourceCount: 0,
265
+ currentResourceCount,
266
+ totalResourceCount: initialTotalResourceCount,
262
267
  })
263
268
 
264
- let currentResourceCount = 0
265
269
  let totalResourceCount = 0
266
270
 
267
271
  await runWithRetryOnError(
@@ -279,7 +283,9 @@ export class LocalRunnerBackend implements RunnerBackend {
279
283
  totalResourceCount,
280
284
  )
281
285
 
282
- this.updateState({ id: instanceId, totalResourceCount })
286
+ if (totalResourceCount > initialTotalResourceCount) {
287
+ this.updateState({ id: instanceId, totalResourceCount })
288
+ }
283
289
  return
284
290
  }
285
291
 
@@ -45,7 +45,7 @@ export const createValidationResolver = defineGraphResolver<
45
45
  },
46
46
 
47
47
  process({ instance, component, resolvedInputs }, dependencies, logger) {
48
- const ajv = new Ajv()
48
+ const ajv = new Ajv({ strict: false })
49
49
 
50
50
  logger.debug({ instanceId: instance.id }, "validating instance")
51
51