@tiangong-lca/cli 0.0.32 → 0.0.33

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 CHANGED
@@ -45,6 +45,8 @@ Review note, 2026-07-23: `dataset save-draft --execution-contract` adds an opt-i
45
45
 
46
46
  Review note, 2026-07-24: CLI 0.0.32 adds bounded execution-contract concurrency without changing the sealed payload or replay model. `--max-parallel 1..8` keeps the complete dependency prefix serial and exact-read-back, then overlaps only the unique-target suffix. The current owner token is renewed and revalidated before each DML dispatch so long batches do not turn token expiry into an avoidable UNKNOWN.
47
47
 
48
+ Review note, 2026-07-24: CLI 0.0.33 adds an explicit `dataset maintenance apply --max-parallel 1..8` profile for large owner-draft flow convergence. It accepts only unique flow delete-only plans with zero frozen and fresh visible-process inbound references, persists `PREPARED` and `DISPATCHED` before each protected RPC, requires exact absent readback for `COMMITTED`, never automatically replays success or UNKNOWN, and continues independent rows.
49
+
48
50
  ## Run
49
51
 
50
52
  One-off published run:
@@ -374,6 +376,7 @@ tiangong-lca dataset references rewrite --input ./rows.jsonl --from flow:<old-id
374
376
  tiangong-lca dataset maintenance plan --scope ./maintenance-scope.json --operation redo-import --out-dir /abs/path/to/dataset-maintenance --page-size 1000 --timeout-ms 10000 --json
375
377
  tiangong-lca dataset maintenance plan --scope ./derivative-rebuild-scope.json --operation rebuild-derivatives --out-dir /abs/path/to/derivative-rebuild --json
376
378
  tiangong-lca dataset maintenance apply --plan /abs/path/to/dataset-maintenance/maintenance-plan.json --commit --approve-plan <sha256> --confirm <current-account-email> --timeout-ms 10000 --json
379
+ tiangong-lca dataset maintenance apply --plan /abs/path/to/flow-delete-maintenance/maintenance-plan.json --commit --approve-plan <sha256> --confirm <current-account-email> --max-parallel 8 --timeout-ms 10000 --json
377
380
  tiangong-lca dataset maintenance verify --plan /abs/path/to/dataset-maintenance/maintenance-plan.json --out-dir /abs/path/to/dataset-maintenance/verify --page-size 1000 --timeout-ms 10000 --json
378
381
  tiangong-lca dataset maintenance run-protected --plan /abs/path/to/maintenance-plan.json --freeze /abs/path/to/protected-execution-freeze.json --approval /abs/path/to/protected-approval.json --out-dir /abs/path/to/protected-run --status-only --json
379
382
  tiangong-lca lifecyclemodel auto-build --input ./examples/lifecyclemodel-auto-build.request.json --out-dir /abs/path/to/lifecyclemodel-run --json
@@ -404,6 +407,8 @@ For `process save-draft`, canonical process payloads are validated locally with
404
407
 
405
408
  For `dataset save-draft --execution-contract`, the JSON contract uses schema `dataset-save-draft-execution-contract.v1` and supplies `execution_id`, `project_ref`, an exact owner (`user_id`, lowercase `email`, `state_code: 0`), and ordered actions. Each action binds `action_id`, `desired_sha256`, `expected_operation` (`insert` or `save_draft`), table/id/version, `before_sha256`, and earlier `dependency_action_ids`. Contract mode requires `--commit`; account-local Unit Group or Flow Property support rows additionally require `--allow-account-local-support`. `--max-parallel` defaults to 1 and is capped at 8. When it is greater than 1, every action through the highest referenced dependency remains serial; only the later table/id/version-unique suffix may overlap. The exact owner token is renewed and checked before each DML dispatch. Attempts and outcomes are stored under the platform user-state directory (`$XDG_STATE_HOME/tiangong-lca-cli` when configured), not beside the contract or report. Any prior terminal or unresolved attempt is read back or retained without re-dispatch; exit status is nonzero unless every action has exact terminal success.
406
409
 
410
+ For `dataset maintenance apply`, explicitly passing `--max-parallel 1..8` opts into the destructive flow-convergence profile. It accepts only a non-empty, unique-target, flow delete-only plan whose current and projected reference impacts are both zero. Before dispatch it also completes a fresh SELECT-only scan of every process visible to the owner session and rejects any inbound edge. Each action writes append-only `PREPARED` and `DISPATCHED` evidence before its protected owner-session RPC, then records `COMMITTED` only after exact absent readback. An ambiguous action is read back, marked `UNKNOWN`, and never replayed automatically; independent actions continue. Omit the flag to retain ordinary maintenance apply behavior.
411
+
407
412
  For `flow publish-version`, canonical flow payloads are validated locally with `FlowSchema` before remote visibility planning or writes. The command always writes `flow-publish-version-gate-report.json`; blocked rows are written to the remote-failure JSONL without calling the remote service.
408
413
 
409
414
  For `process publish-build`, canonical process payloads are validated locally with `ProcessSchema` before publish handoff artifacts are written. The gate report is `reports/process-publish-schema-gate.json`.
package/dist/src/cli.js CHANGED
@@ -536,6 +536,7 @@ Options:
536
536
  --approve-plan <sha256> Exact SHA-256 recorded for the plan
537
537
  --confirm <email> Current authenticated account email
538
538
  --timeout-ms <n> Request timeout in milliseconds
539
+ --max-parallel <1-8> Opt into bounded flow delete-only execution with durable dispatch ledger
539
540
  --json Print compact JSON
540
541
  -h, --help
541
542
 
@@ -3459,6 +3460,7 @@ function parseDatasetMaintenanceApplyFlags(args) {
3459
3460
  confirm: { type: 'string' },
3460
3461
  'timeout-ms': { type: 'string' },
3461
3462
  'dry-run': { type: 'boolean' },
3463
+ 'max-parallel': { type: 'string' },
3462
3464
  },
3463
3465
  }));
3464
3466
  }
@@ -3468,6 +3470,19 @@ function parseDatasetMaintenanceApplyFlags(args) {
3468
3470
  exitCode: 2,
3469
3471
  });
3470
3472
  }
3473
+ const maxParallelValue = values['max-parallel'];
3474
+ const maxParallel = typeof maxParallelValue === 'string' && /^\d+$/u.test(maxParallelValue)
3475
+ ? Number.parseInt(maxParallelValue, 10)
3476
+ : maxParallelValue === undefined
3477
+ ? undefined
3478
+ : Number.NaN;
3479
+ if (maxParallel !== undefined &&
3480
+ (!Number.isInteger(maxParallel) || maxParallel < 1 || maxParallel > 8)) {
3481
+ throw new CliError('--max-parallel must be an integer from 1 to 8.', {
3482
+ code: 'INVALID_ARGS',
3483
+ exitCode: 2,
3484
+ });
3485
+ }
3471
3486
  return {
3472
3487
  help: Boolean(values.help),
3473
3488
  json: Boolean(values.json),
@@ -3477,6 +3492,7 @@ function parseDatasetMaintenanceApplyFlags(args) {
3477
3492
  confirm: typeof values.confirm === 'string' ? values.confirm : '',
3478
3493
  timeoutMs: parseDatasetMaintenancePositiveInteger(values['timeout-ms'], '--timeout-ms'),
3479
3494
  dryRun: Boolean(values['dry-run']),
3495
+ maxParallel,
3480
3496
  };
3481
3497
  }
3482
3498
  function parseDatasetMaintenanceFreezeProtectedFlags(args) {
@@ -6401,11 +6417,14 @@ export async function executeCli(argv, deps) {
6401
6417
  approvePlan: datasetFlags.approvePlan,
6402
6418
  confirm: datasetFlags.confirm,
6403
6419
  timeoutMs: datasetFlags.timeoutMs,
6420
+ maxParallel: datasetFlags.maxParallel,
6404
6421
  env: deps.env,
6405
6422
  fetchImpl: deps.fetchImpl,
6406
6423
  });
6407
6424
  return {
6408
- exitCode: report.status === 'completed_with_failures' ? 1 : 0,
6425
+ exitCode: ['completed_with_failures', 'completed_with_unknowns'].includes(report.status)
6426
+ ? 1
6427
+ : 0,
6409
6428
  stdout: stringifyJson(report, datasetFlags.json),
6410
6429
  stderr: '',
6411
6430
  };