@fabricorg/experiments 0.7.0 → 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.
package/README.md CHANGED
@@ -31,6 +31,10 @@ fx doctor
31
31
  fx profile show
32
32
  fx push experiments/
33
33
  fx test publish reports/evidence.json
34
+ fx targets list
35
+ fx targets doctor lakeflow-jobs
36
+ fx targets run lakeflow-jobs --live --evidence reports/jobs-pack.json
37
+ fx targets publish reports/jobs-pack.json
34
38
  ```
35
39
 
36
40
  `fx login` discovers the current API and organization through the branded Studio
@@ -67,6 +71,10 @@ fx login Configure and verify a secure hosted profile.
67
71
  fx logout [profile] Remove a hosted profile.
68
72
  fx profile [list|show|use] Inspect or switch profiles without printing secrets.
69
73
  fx doctor Verify API, gateway, tenant, role, and config security.
74
+ fx targets list List typed workload target packs and maturity.
75
+ fx targets doctor <pack> Check a pack's environment without exposing secrets.
76
+ fx targets run <pack> --live Run a pack against a real target and write evidence.
77
+ fx targets publish <file> Publish pack evidence to the tenant's Quality Center.
70
78
  ```
71
79
 
72
80
  For a migration gate that fails until every trigger and asset is portable:
package/dist/bin/fx.cjs CHANGED
@@ -7580,6 +7580,7 @@ var TestRunListInput = external_exports.object({
7580
7580
  status: TestRunStatus.optional(),
7581
7581
  source: CreateTestRunInput.shape.source.optional(),
7582
7582
  suite: external_exports.string().min(1).max(240).optional(),
7583
+ targetPack: external_exports.string().min(1).max(120).regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/).optional(),
7583
7584
  limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7584
7585
  offset: external_exports.coerce.number().int().min(0).max(1e5).optional()
7585
7586
  });
@@ -8270,7 +8271,7 @@ var FILES = {
8270
8271
  devDependencies: {
8271
8272
  "@cucumber/cucumber": "^13.0.0",
8272
8273
  "@duckdb/node-api": "^1.5.0",
8273
- "@fabricorg/databricks-bdd": "^0.4.0",
8274
+ "@fabricorg/databricks-bdd": "^0.5.0",
8274
8275
  tsx: "^4.19.2",
8275
8276
  typescript: "^5.8.3"
8276
8277
  }
@@ -8806,6 +8807,8 @@ function normalizeTestEvidence(value, options = {}) {
8806
8807
  };
8807
8808
  }
8808
8809
  if (kind === "databricks-live-suite") {
8810
+ const targetPack = objectOf(evidence.targetPack);
8811
+ const target = objectOf(targetPack.target);
8809
8812
  const cases = arrayOfRecords(evidence.results).map((result) => ({
8810
8813
  id: String(result.id ?? ""),
8811
8814
  name: String(result.description ?? result.id ?? "Live check"),
@@ -8827,11 +8830,19 @@ function normalizeTestEvidence(value, options = {}) {
8827
8830
  summary,
8828
8831
  environment: compact({
8829
8832
  profile: "live",
8830
- cloud: env.DBX_TEST_CLOUD ?? "azure",
8831
- workspace: env.DATABRICKS_HOST,
8833
+ cloud: target.cloud ?? env.DBX_TEST_CLOUD ?? "azure",
8834
+ region: target.region ?? env.DBX_TEST_REGION,
8835
+ workspace: target.workspace ?? env.DATABRICKS_HOST,
8832
8836
  warehouseId: env.DATABRICKS_WAREHOUSE_ID,
8833
- runtime: env.DBX_TEST_RUNTIME_VERSION,
8834
- compute: env.DBX_TEST_COMPUTE
8837
+ runtime: target.runtime ?? env.DBX_TEST_RUNTIME_VERSION,
8838
+ compute: target.compute ?? env.DBX_TEST_COMPUTE,
8839
+ targetPackId: targetPack.id,
8840
+ targetPackName: targetPack.name,
8841
+ targetPackVersion: targetPack.version,
8842
+ targetPackMaturity: targetPack.maturity,
8843
+ targetPackCapabilities: targetPack.capabilities,
8844
+ targetPackCertificationScopes: targetPack.certificationScopes,
8845
+ targetPackDocsUrl: targetPack.docsUrl
8835
8846
  }),
8836
8847
  revision,
8837
8848
  cases,
@@ -9169,6 +9180,147 @@ async function readSecretApiKey() {
9169
9180
  process$1.stdin.on("data", onData);
9170
9181
  });
9171
9182
  }
9183
+ var registry = databricksTestkit.createTargetPackRegistry(databricksTestkit.builtinTargetPacks);
9184
+ async function cmdTargets(action, packId, options = {}) {
9185
+ const stdout = options.stdout ?? process.stdout;
9186
+ const stderr2 = options.stderr ?? process.stderr;
9187
+ const env = { ...options.env ?? process.env };
9188
+ if (action === "list") {
9189
+ const packs = [...registry.values()].map(describePack);
9190
+ if (options.json) {
9191
+ stdout.write(`${JSON.stringify({ packs }, null, 2)}
9192
+ `);
9193
+ } else {
9194
+ stdout.write("ID MATURITY VERSION CAPABILITIES NAME\n");
9195
+ for (const pack2 of packs) {
9196
+ stdout.write(
9197
+ `${pack2.id.padEnd(19)} ${pack2.maturity.padEnd(12)} ${pack2.version.padEnd(8)} ${String(pack2.capabilityCount).padEnd(13)} ${pack2.name}
9198
+ `
9199
+ );
9200
+ }
9201
+ }
9202
+ return 0;
9203
+ }
9204
+ if (!packId) {
9205
+ stderr2.write(`Usage: fx targets ${action || "<list|doctor|run>"} <pack> [flags]
9206
+ `);
9207
+ return 1;
9208
+ }
9209
+ const pack = registry.get(packId);
9210
+ if (!pack) {
9211
+ stderr2.write(
9212
+ `Unknown target pack '${packId}'. Available: ${[...registry.keys()].join(", ")}
9213
+ `
9214
+ );
9215
+ return 1;
9216
+ }
9217
+ const requiredChecks = options.requiredChecks ?? pack.requiredChecks;
9218
+ const doctor = databricksTestkit.doctorTargetPack(pack, env, requiredChecks);
9219
+ if (action === "doctor") {
9220
+ writeDoctor(doctor, options.json === true, stdout);
9221
+ return doctor.ready ? 0 : 1;
9222
+ }
9223
+ if (action !== "run") {
9224
+ stderr2.write(`Unknown targets action '${action}'. Use list, doctor, run, or publish.
9225
+ `);
9226
+ return 1;
9227
+ }
9228
+ if (options.live) env.DBX_TEST_LIVE = "1";
9229
+ if (env.DBX_TEST_LIVE !== "1") {
9230
+ stderr2.write(
9231
+ "Target packs can create or mutate Databricks resources. Pass --live or set DBX_TEST_LIVE=1.\n"
9232
+ );
9233
+ return 1;
9234
+ }
9235
+ if (!doctor.ready) {
9236
+ writeDoctor(doctor, options.json === true, stderr2);
9237
+ return 1;
9238
+ }
9239
+ const evidencePath = options.evidencePath ?? `reports/target-packs/${pack.id}/evidence.json`;
9240
+ const junitPath = options.junitPath ?? `reports/target-packs/${pack.id}/junit.xml`;
9241
+ const evidence = await databricksTestkit.runTargetPack(pack, {
9242
+ env,
9243
+ requiredChecks,
9244
+ evidencePath,
9245
+ junitPath
9246
+ });
9247
+ if (!evidence) {
9248
+ stderr2.write("Target pack did not run because DBX_TEST_LIVE is disabled.\n");
9249
+ return 1;
9250
+ }
9251
+ if (options.json) {
9252
+ stdout.write(`${JSON.stringify(evidence, null, 2)}
9253
+ `);
9254
+ } else {
9255
+ for (const result of evidence.results) {
9256
+ stdout.write(`${symbol(result.status)} ${result.id} (${result.durationMs}ms)
9257
+ `);
9258
+ }
9259
+ stdout.write(
9260
+ `${evidence.success ? "PASS" : "FAIL"} ${pack.name}; evidence=${evidencePath}; junit=${junitPath}
9261
+ `
9262
+ );
9263
+ }
9264
+ return evidence.success ? 0 : 1;
9265
+ }
9266
+ async function cmdTargetPublish(evidencePath, options = {}) {
9267
+ const raw = JSON.parse(await promises.readFile(evidencePath, "utf8"));
9268
+ const metadata = objectOf2(raw.targetPack);
9269
+ const packName = typeof metadata.name === "string" ? metadata.name : void 0;
9270
+ const packId = typeof metadata.id === "string" ? metadata.id : void 0;
9271
+ if (!packName && !packId) {
9272
+ throw new Error("Target evidence is missing targetPack metadata");
9273
+ }
9274
+ return cmdTestPublish(evidencePath, {
9275
+ ...options,
9276
+ suite: options.suite ?? `Databricks target: ${packName ?? packId}`
9277
+ });
9278
+ }
9279
+ function describePack(pack) {
9280
+ return {
9281
+ id: pack.id,
9282
+ name: pack.name,
9283
+ description: pack.description,
9284
+ version: pack.version,
9285
+ maturity: pack.maturity,
9286
+ capabilityCount: pack.capabilities.length,
9287
+ capabilities: [...pack.capabilities],
9288
+ requiredChecks: [...pack.requiredChecks ?? []],
9289
+ docsUrl: pack.docsUrl,
9290
+ certificationScopes: [...pack.certificationScopes ?? []]
9291
+ };
9292
+ }
9293
+ function writeDoctor(doctor, json, stream) {
9294
+ if (json) {
9295
+ stream.write(`${JSON.stringify(doctor, null, 2)}
9296
+ `);
9297
+ return;
9298
+ }
9299
+ stream.write(
9300
+ `${doctor.ready ? "READY" : "NOT READY"} ${doctor.pack.name} ${doctor.pack.version} (${doctor.pack.maturity})
9301
+ `
9302
+ );
9303
+ for (const requirement of doctor.requirements) {
9304
+ stream.write(
9305
+ `${requirement.satisfied ? "\u2713" : requirement.required ? "\u2717" : "-"} requirement ${requirement.id}: ${requirement.description} [${requirement.variables.join(" | ")}]
9306
+ `
9307
+ );
9308
+ }
9309
+ for (const check of doctor.checks) {
9310
+ stream.write(
9311
+ `${check.configured ? "\u2713" : check.required ? "\u2717" : "-"} check ${check.id}${check.required ? " [required]" : ""}: ${check.description}
9312
+ `
9313
+ );
9314
+ }
9315
+ }
9316
+ function symbol(status) {
9317
+ if (status === "pass") return "\u2713";
9318
+ if (status === "fail") return "\u2717";
9319
+ return "-";
9320
+ }
9321
+ function objectOf2(value) {
9322
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
9323
+ }
9172
9324
 
9173
9325
  // src/bin/fx.ts
9174
9326
  var HELP = `fx \u2014 Fabric Experiments CLI
@@ -9194,6 +9346,10 @@ COMMANDS
9194
9346
  logout [profile] Remove a stored hosted profile.
9195
9347
  profile [list|show|use] Inspect or switch hosted profiles.
9196
9348
  doctor Verify API, tenant, gateway, role, and config security.
9349
+ targets list List built-in Databricks target packs.
9350
+ targets doctor <pack> Validate target configuration without creating resources.
9351
+ targets run <pack> Run a pack and write JSON/JUnit evidence. Requires --live.
9352
+ targets publish <file> Publish target-pack evidence to Studio Quality.
9197
9353
 
9198
9354
  GLOBAL FLAGS
9199
9355
  --tenant <id> Tenant scope (default: default)
@@ -9224,6 +9380,10 @@ GLOBAL FLAGS
9224
9380
  --suite <name> test publish: display name for the suite
9225
9381
  --external-id <id> test publish: idempotent CI run identifier
9226
9382
  --run-url <url> test publish: CI artifact/run link
9383
+ --live targets run: explicitly allow live Databricks operations
9384
+ --required <ids> targets run: comma-separated required check IDs
9385
+ --evidence <file> targets run: evidence JSON output path
9386
+ --junit <file> targets run: JUnit XML output path
9227
9387
  --key-id <id> publish: keyId to sign with (default: dev-default)
9228
9388
  --out <dir> import-mojito: output directory
9229
9389
  --report <file> import-mojito: compatibility report path
@@ -9231,7 +9391,7 @@ GLOBAL FLAGS
9231
9391
  -h, --help print this help
9232
9392
  -v, --version print version
9233
9393
  `;
9234
- var VERSION2 = "0.7.0";
9394
+ var VERSION2 = "0.8.0";
9235
9395
  function parse2(argv) {
9236
9396
  const positional = [];
9237
9397
  const flags = {};
@@ -9302,6 +9462,38 @@ async function main() {
9302
9462
  );
9303
9463
  case "doctor":
9304
9464
  return cmdDoctor({ profileName: args.flags.profile });
9465
+ case "targets": {
9466
+ const action = args.positional[0] ?? "list";
9467
+ if (action === "publish") {
9468
+ const evidencePath = args.positional[1];
9469
+ if (!evidencePath) {
9470
+ process.stderr.write("Usage: fx targets publish <evidence.json> [flags]\n");
9471
+ return 1;
9472
+ }
9473
+ const hosted = await resolveHostedContext({
9474
+ profileName: args.flags.profile,
9475
+ apiUrl: args.flags["api-url"],
9476
+ apiKey: args.flags["api-key"],
9477
+ tenantId: explicitTenantId
9478
+ });
9479
+ return cmdTargetPublish(evidencePath, {
9480
+ tenantId: hosted.tenantId,
9481
+ apiUrl: hosted.apiUrl,
9482
+ apiKey: hosted.apiKey,
9483
+ bearerToken: hosted.bearerToken,
9484
+ suite: args.flags.suite,
9485
+ externalId: args.flags["external-id"],
9486
+ runUrl: args.flags["run-url"]
9487
+ });
9488
+ }
9489
+ return cmdTargets(action, args.positional[1], {
9490
+ json: args.flags.json === true,
9491
+ live: args.flags.live === true,
9492
+ requiredChecks: typeof args.flags.required === "string" ? args.flags.required.split(",").map((value) => value.trim()).filter(Boolean) : void 0,
9493
+ evidencePath: args.flags.evidence,
9494
+ junitPath: args.flags.junit
9495
+ });
9496
+ }
9305
9497
  case "validate":
9306
9498
  return cmdValidate(args.positional[0] ?? ".");
9307
9499
  case "plan":