@tiangong-lca/cli 0.0.22 → 0.0.23

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.
@@ -3,8 +3,9 @@ import path from 'node:path';
3
3
  import { writeJsonArtifact } from './artifacts.js';
4
4
  import { CliError } from './errors.js';
5
5
  import { withStateFileLock } from './state-lock.js';
6
- import { appendStableJsonLine, isJsonObject, maintenanceRowKey, parseMaintenancePlan, readJsonFile, readJsonLinesIfPresent, resolveMaintenancePlanArtifactPath, sha256Json, snapshotRemoteRow, writeImmutableJson, } from './dataset-maintenance-contract.js';
6
+ import { MAINTENANCE_SCAN_TABLES, appendStableJsonLine, isJsonObject, maintenanceRowKey, parseMaintenancePlan, readJsonFile, readJsonLinesIfPresent, resolveMaintenancePlanArtifactPath, sha256Json, snapshotRemoteRow, writeImmutableJson, } from './dataset-maintenance-contract.js';
7
7
  import { maintenanceProjectedReferenceFingerprint } from './dataset-maintenance-plan.js';
8
+ import { isSnapshotCompletenessCompatible } from './dataset-maintenance-pagination.js';
8
9
  import { applyMaintenanceAliasPlan, deleteMaintenanceRow, fetchMaintenanceAccountRows, fetchMaintenanceExactRows, resolveMaintenanceRemoteContext, saveDraftMaintenanceRow, } from './dataset-maintenance-remote.js';
9
10
  const POSITIVE_INTEGER_TEXT = /^[1-9]\d*$/u;
10
11
  function clock(options) {
@@ -390,7 +391,8 @@ function validateApprovalRecord(options) {
390
391
  record.target_mode !== options.plan.target_mode ||
391
392
  !isJsonObject(record.account) ||
392
393
  record.account.user_id !== options.context.account.user_id ||
393
- record.account.email !== options.context.account.email) {
394
+ record.account.email !== options.context.account.email ||
395
+ !isSnapshotCompletenessCompatible(record.snapshot_completeness, options.plan.snapshot_completeness, MAINTENANCE_SCAN_TABLES)) {
394
396
  throw new CliError('Existing approval record does not match this plan and actor.', {
395
397
  code: 'DATASET_MAINTENANCE_APPROVAL_RECORD_MISMATCH',
396
398
  exitCode: 1,
@@ -1235,6 +1237,7 @@ export async function runDatasetMaintenanceApply(options) {
1235
1237
  },
1236
1238
  confirmed_email: options.confirm,
1237
1239
  row_counts: plan.summary,
1240
+ snapshot_completeness: current.completeness,
1238
1241
  redo_rows_ready: plan.operation === 'redo-import'
1239
1242
  ? Boolean(plan.source_import_run_id || plan.source_lineage !== null)
1240
1243
  : null,