@githolon/dsl 0.105.17 → 0.105.18

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/dart/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.64.33
2
+
3
+ - Converge arbitrary historical generated-model backlogs while failing a genuinely repeated immutable lifecycle step with a typed stall error.
4
+
1
5
  ## 0.64.32
2
6
 
3
7
  - Prove a restored generated-application device is enrolled before exposing business APIs, including recovery from an interrupted bootstrap journal.
@@ -240,6 +240,73 @@ class DomainClientModelAdoptionRequired implements Exception {
240
240
  '"$expectedDomainKey" ($expectedDomainHash) is $status. $summary';
241
241
  }
242
242
 
243
+ /// A generated model step repeated without converging after several retries.
244
+ ///
245
+ /// The limit is per immutable lifecycle step, not a cap on how many historical
246
+ /// model generations a long-lived workspace may lawfully adopt. That distinction
247
+ /// lets an old workspace catch up across an arbitrary backlog while still making
248
+ /// a genuinely stuck stage/accept loop fail loudly and with useful context.
249
+ final class DomainClientModelLifecycleStalled implements Exception {
250
+ const DomainClientModelLifecycleStalled({
251
+ required this.domain,
252
+ required this.candidateHash,
253
+ required this.status,
254
+ required this.attempts,
255
+ });
256
+
257
+ final String domain;
258
+ final String candidateHash;
259
+ final String status;
260
+ final int attempts;
261
+
262
+ @override
263
+ String toString() => 'DomainClientModelLifecycleStalled: generated model for '
264
+ '"$domain" ($candidateHash) remained $status after $attempts governed '
265
+ 'attempts without progress.';
266
+ }
267
+
268
+ /// Converge every pending generated-model generation, bounded by repeated work.
269
+ ///
270
+ /// A workspace can legitimately be more than a fixed number of generations
271
+ /// behind. Each distinct domain/hash/status tuple is evidence of progress, so it
272
+ /// gets its own retry budget. Only repetition of the same immutable step is a
273
+ /// stall.
274
+ Future<T> nmsInternalConvergeGeneratedModel<T>({
275
+ required Future<T> Function() attempt,
276
+ required Future<void> Function(DomainClientModelAdoptionRequired change)
277
+ handle,
278
+ }) async {
279
+ const maxAttemptsPerStep = 12;
280
+ final attemptsByStep = <String, int>{};
281
+ while (true) {
282
+ try {
283
+ return await attempt();
284
+ } on DomainClientModelAdoptionRequired catch (change) {
285
+ final step = '${change.expectedDomainKey}\u0000'
286
+ '${change.expectedDomainHash}\u0000'
287
+ '${change.status}\u0000'
288
+ '${change.canStage}\u0000${change.canAccept}';
289
+ final attempts = (attemptsByStep[step] ?? 0) + 1;
290
+ attemptsByStep[step] = attempts;
291
+ if (attempts > maxAttemptsPerStep) {
292
+ throw DomainClientModelLifecycleStalled(
293
+ domain: change.expectedDomainKey,
294
+ candidateHash: change.expectedDomainHash,
295
+ status: change.status,
296
+ attempts: attempts,
297
+ );
298
+ }
299
+ try {
300
+ await handle(change);
301
+ } on DomainClientModelAdoptionRequired {
302
+ // A transient preflight/acceptance race re-enters the same typed step.
303
+ // The per-step budget above prevents a genuine loop without limiting
304
+ // how many distinct historical generations may converge.
305
+ }
306
+ }
307
+ }
308
+ }
309
+
243
310
  /// The context-rich replacement for the kernel's generic
244
311
  /// `no active installed law declares domain 'x' … deploy the domain package first` refusal —
245
312
  /// thrown wherever that error used to surface (bridge dispatch, birth lanes) so an app dev sees
package/dart/pubspec.yaml CHANGED
@@ -7,7 +7,7 @@ repository: https://github.com/Captain-App/nomos2
7
7
  description: >-
8
8
  Nomos 2 Dart client — generated domain values, intent payloads and application
9
9
  lifecycle types over the typed Nomos kernel protocol and USDA custody model.
10
- version: 0.64.32
10
+ version: 0.64.33
11
11
 
12
12
  environment:
13
13
  sdk: ^3.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.105.17",
3
+ "version": "0.105.18",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
@@ -2507,16 +2507,12 @@ export function generateDartBridgeClient(
2507
2507
  ` );`,
2508
2508
  ` }`,
2509
2509
  ]),
2510
- ` for (var modelStep = 0; modelStep < 12; modelStep += 1) {`,
2511
- ` try {`,
2512
- ` return await bind(session, actor: actor${
2510
+ ` return nmsInternalConvergeGeneratedModel<${className}>(`,
2511
+ ` attempt: () => bind(session, actor: actor${
2513
2512
  manualEncryptionPresent ? ", keyStore: keyStore" : ""
2514
- });`,
2515
- ` } on DomainClientModelAdoptionRequired catch (change) {`,
2516
- ` await session.nomosInternalHandleModelChange(change);`,
2517
- ` }`,
2518
- ` }`,
2519
- ` throw StateError('Generated model lifecycle did not settle after twelve governed steps.');`,
2513
+ }),`,
2514
+ ` handle: session.nomosInternalHandleModelChange,`,
2515
+ ` );`,
2520
2516
  ` }`,
2521
2517
  ``,
2522
2518
  ` /// The session workspace this client is bound to (from the [NomosSession] handle, when constructed with`,
@@ -1664,8 +1664,8 @@ const NOMOS_TYPES_DEP = "^0.8.7";
1664
1664
  // 0.48.x: session-bound clients (XClient.bind/NomosClientInterface/DomainClientSessionMismatch/
1665
1665
  // DomainNotInstalledForSession, engine.follow, pendingConflicts lanes) — the generated client
1666
1666
  // REQUIRES this surface. 0.48.1 fixes NomosSession.watchPendingConflicts delegation.
1667
- const NOMOS_CLIENT_DEP = "^0.64.32";
1668
- const NOMOS_FLUTTER_DEP = "^0.63.56";
1667
+ const NOMOS_CLIENT_DEP = "^0.64.33";
1668
+ const NOMOS_FLUTTER_DEP = "^0.63.57";
1669
1669
  // DRIFT TRIPWIRE: pubspec_pins.test.ts asserts these equal the CURRENT versions in dsl/dart/pubspec.yaml
1670
1670
  // and dsl/dart_types/pubspec.yaml — a Dart release without this bump fails the suite, so tenants never
1671
1671
  // land back in dependency_overrides (the exact co2 report this closes, third occurrence).