velocious 1.0.750 → 1.0.751

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "velocious": "build/bin/velocious.js"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.750",
6
+ "version": "1.0.751",
7
7
  "main": "build/index.js",
8
8
  "types": "build/index.d.ts",
9
9
  "files": [
@@ -648,14 +648,36 @@ export default class BackgroundJobsMain {
648
648
  }
649
649
  this.lifecycleState = "active"
650
650
  this._creditReadyWorkers()
651
- await this._settleForeignGenerationHandoffs()
652
- await this._settleDeadOwnerHandoffs()
653
651
  this.logger.info(() => ["Background jobs generation activation acknowledged", {generationId: this.generationId}])
652
+ // Activation is the handoff boundary. Durable orphan settlement is recovery
653
+ // work and must not keep the lifecycle socket open while it examines rows
654
+ // owned by a retiring generation. A slow ledger query is allowed to finish
655
+ // in the background; it cannot turn a successful candidate into a
656
+ // timed-out release that Rollbridge incorrectly reports as recovered.
657
+ void this._settleActivationHandoffs().catch((error) => {
658
+ const normalizedError = error instanceof Error ? error : new Error(String(error))
659
+ const payload = {context: {generationId: this.generationId, stage: "background-job-activation-handoff-settlement"}, error: normalizedError}
660
+ const errorEvents = this.configuration.getErrorEvents()
661
+
662
+ this.logger.error(() => ["Failed to settle background-job handoffs after activation:", normalizedError])
663
+ errorEvents.emit("framework-error", payload)
664
+ errorEvents.emit("all-error", {...payload, errorType: "framework-error"})
665
+ })
654
666
  void this._drain().catch((error) => {
655
667
  this.logger.error(() => ["Background jobs generation post-activation drain failed", {error, generationId: this.generationId}])
656
668
  })
657
669
  }
658
670
 
671
+ /**
672
+ * Settles activation-time handoffs after the lifecycle acknowledgement.
673
+ * @returns {Promise<void>} - Resolves after recovery work completes.
674
+ */
675
+ async _settleActivationHandoffs() {
676
+ await this._settleForeignGenerationHandoffs()
677
+ const deadOwnerJobs = await this._settleDeadOwnerHandoffs()
678
+ await this._handleOrphanedJobs({jobs: deadOwnerJobs, warning: "Marked orphaned background jobs after generation activation"})
679
+ }
680
+
659
681
  /**
660
682
  * Establishes the synchronous retirement fence and then drains ownership setup.
661
683
  * @returns {Promise<void>} - Resolves after the retirement fence is durable in memory.