@databricks-solutions/lakebase-scm-utils 0.3.2 → 0.3.4

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.
Files changed (53) hide show
  1. package/dist/scripts/index.cjs +2 -2
  2. package/dist/scripts/index.js +2 -2
  3. package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +2 -2
  4. package/dist/scripts/lakebase/ci-resolve-branch.cli.js +2 -2
  5. package/dist/scripts/lakebase/collapse-heads.cli.cjs +2 -2
  6. package/dist/scripts/lakebase/collapse-heads.cli.js +2 -2
  7. package/dist/scripts/lakebase/detect-language.cli.cjs +2 -2
  8. package/dist/scripts/lakebase/detect-language.cli.js +2 -2
  9. package/dist/scripts/lakebase/doctor.cli.cjs +2 -2
  10. package/dist/scripts/lakebase/doctor.cli.js +2 -2
  11. package/dist/scripts/lakebase/get-connection.cli.cjs +2 -2
  12. package/dist/scripts/lakebase/get-connection.cli.js +2 -2
  13. package/dist/scripts/lakebase/index.cjs +2 -2
  14. package/dist/scripts/lakebase/index.js +2 -2
  15. package/dist/scripts/lakebase/infra-runner.cli.cjs +2 -2
  16. package/dist/scripts/lakebase/infra-runner.cli.js +2 -2
  17. package/dist/scripts/lakebase/new-migration.cli.cjs +2 -2
  18. package/dist/scripts/lakebase/new-migration.cli.js +2 -2
  19. package/dist/scripts/lakebase/schema-diff.cli.cjs +2 -2
  20. package/dist/scripts/lakebase/schema-diff.cli.js +2 -2
  21. package/dist/scripts/lakebase/schema-migrate.cli.cjs +2 -2
  22. package/dist/scripts/lakebase/schema-migrate.cli.js +2 -2
  23. package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +2 -2
  24. package/dist/scripts/lakebase/scm-claim-feature.cli.js +2 -2
  25. package/dist/scripts/lakebase/scm-doctor.cli.cjs +2 -2
  26. package/dist/scripts/lakebase/scm-doctor.cli.js +2 -2
  27. package/dist/scripts/lakebase/scm-merge.cli.cjs +2 -2
  28. package/dist/scripts/lakebase/scm-merge.cli.js +2 -2
  29. package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +2 -2
  30. package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +2 -2
  31. package/dist/scripts/util/index.cjs +2 -2
  32. package/dist/scripts/util/index.js +2 -2
  33. package/package.json +1 -1
  34. package/templates/project/client/consort-vitest-reporter.ts +96 -0
  35. package/templates/project/client/package.json +1 -0
  36. package/templates/project/client/playwright.config.ts +18 -3
  37. package/templates/project/client/tests/e2e/about.spec.ts +1 -1
  38. package/templates/project/client/tests/e2e/consort-fixtures.ts +23 -0
  39. package/templates/project/client/tests/e2e/home.spec.ts +1 -1
  40. package/templates/project/client/tests/setup.ts +79 -4
  41. package/templates/project/client/tsconfig.json +1 -1
  42. package/templates/project/client/vite.config.ts +8 -0
  43. package/templates/project/client/vitest.globalSetup.ts +121 -0
  44. package/templates/project/common/consort-capture.ts +87 -0
  45. package/templates/project/common/consort-test-reporter.ts +45 -0
  46. package/templates/project/common/playwright.config.ts +6 -1
  47. package/templates/project/python/app/consort_capture.py +130 -0
  48. package/templates/project/python/app/database.py +6 -6
  49. package/templates/project/python/app/main.py +52 -0
  50. package/templates/project/python/app/repositories/__init__.py +8 -0
  51. package/templates/project/python/app/repositories/session.py +28 -0
  52. package/templates/project/python/pyproject.toml +1 -0
  53. package/templates/project/python/tests/conftest.py +132 -3
@@ -88943,8 +88943,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
88943
88943
  var cached;
88944
88944
  function substrateSelfVersion() {
88945
88945
  if (cached !== void 0) return cached;
88946
- if ("0.3.2".length > 0) {
88947
- cached = "0.3.2";
88946
+ if ("0.3.4".length > 0) {
88947
+ cached = "0.3.4";
88948
88948
  return cached;
88949
88949
  }
88950
88950
  cached = "unknown";
@@ -9725,8 +9725,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9725
9725
  var cached;
9726
9726
  function substrateSelfVersion() {
9727
9727
  if (cached !== void 0) return cached;
9728
- if ("0.3.2".length > 0) {
9729
- cached = "0.3.2";
9728
+ if ("0.3.4".length > 0) {
9729
+ cached = "0.3.4";
9730
9730
  return cached;
9731
9731
  }
9732
9732
  cached = "unknown";
@@ -79629,8 +79629,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79629
79629
  var cached;
79630
79630
  function substrateSelfVersion() {
79631
79631
  if (cached !== void 0) return cached;
79632
- if ("0.3.2".length > 0) {
79633
- cached = "0.3.2";
79632
+ if ("0.3.4".length > 0) {
79633
+ cached = "0.3.4";
79634
79634
  return cached;
79635
79635
  }
79636
79636
  cached = "unknown";
@@ -721,8 +721,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
721
721
  var cached;
722
722
  function substrateSelfVersion() {
723
723
  if (cached !== void 0) return cached;
724
- if ("0.3.2".length > 0) {
725
- cached = "0.3.2";
724
+ if ("0.3.4".length > 0) {
725
+ cached = "0.3.4";
726
726
  return cached;
727
727
  }
728
728
  cached = "unknown";
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.3.2".length > 0) {
79294
- cached = "0.3.2";
79293
+ if ("0.3.4".length > 0) {
79294
+ cached = "0.3.4";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.3.2".length > 0) {
397
- cached = "0.3.2";
396
+ if ("0.3.4".length > 0) {
397
+ cached = "0.3.4";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.3.2".length > 0) {
79294
- cached = "0.3.2";
79293
+ if ("0.3.4".length > 0) {
79294
+ cached = "0.3.4";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.3.2".length > 0) {
397
- cached = "0.3.2";
396
+ if ("0.3.4".length > 0) {
397
+ cached = "0.3.4";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79382,8 +79382,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79382
79382
  var cached;
79383
79383
  function substrateSelfVersion() {
79384
79384
  if (cached !== void 0) return cached;
79385
- if ("0.3.2".length > 0) {
79386
- cached = "0.3.2";
79385
+ if ("0.3.4".length > 0) {
79386
+ cached = "0.3.4";
79387
79387
  return cached;
79388
79388
  }
79389
79389
  cached = "unknown";
@@ -484,8 +484,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
484
484
  var cached;
485
485
  function substrateSelfVersion() {
486
486
  if (cached !== void 0) return cached;
487
- if ("0.3.2".length > 0) {
488
- cached = "0.3.2";
487
+ if ("0.3.4".length > 0) {
488
+ cached = "0.3.4";
489
489
  return cached;
490
490
  }
491
491
  cached = "unknown";
@@ -79285,8 +79285,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79285
79285
  var cached;
79286
79286
  function substrateSelfVersion() {
79287
79287
  if (cached !== void 0) return cached;
79288
- if ("0.3.2".length > 0) {
79289
- cached = "0.3.2";
79288
+ if ("0.3.4".length > 0) {
79289
+ cached = "0.3.4";
79290
79290
  return cached;
79291
79291
  }
79292
79292
  cached = "unknown";
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.3.2".length > 0) {
393
- cached = "0.3.2";
392
+ if ("0.3.4".length > 0) {
393
+ cached = "0.3.4";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -81604,8 +81604,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
81604
81604
  var cached;
81605
81605
  function substrateSelfVersion() {
81606
81606
  if (cached !== void 0) return cached;
81607
- if ("0.3.2".length > 0) {
81608
- cached = "0.3.2";
81607
+ if ("0.3.4".length > 0) {
81608
+ cached = "0.3.4";
81609
81609
  return cached;
81610
81610
  }
81611
81611
  cached = "unknown";
@@ -2521,8 +2521,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
2521
2521
  var cached;
2522
2522
  function substrateSelfVersion() {
2523
2523
  if (cached !== void 0) return cached;
2524
- if ("0.3.2".length > 0) {
2525
- cached = "0.3.2";
2524
+ if ("0.3.4".length > 0) {
2525
+ cached = "0.3.4";
2526
2526
  return cached;
2527
2527
  }
2528
2528
  cached = "unknown";
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.3.2".length > 0) {
79294
- cached = "0.3.2";
79293
+ if ("0.3.4".length > 0) {
79294
+ cached = "0.3.4";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.3.2".length > 0) {
397
- cached = "0.3.2";
396
+ if ("0.3.4".length > 0) {
397
+ cached = "0.3.4";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.3.2".length > 0) {
79294
- cached = "0.3.2";
79293
+ if ("0.3.4".length > 0) {
79294
+ cached = "0.3.4";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.3.2".length > 0) {
397
- cached = "0.3.2";
396
+ if ("0.3.4".length > 0) {
397
+ cached = "0.3.4";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79288,8 +79288,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79288
79288
  var cached;
79289
79289
  function substrateSelfVersion() {
79290
79290
  if (cached !== void 0) return cached;
79291
- if ("0.3.2".length > 0) {
79292
- cached = "0.3.2";
79291
+ if ("0.3.4".length > 0) {
79292
+ cached = "0.3.4";
79293
79293
  return cached;
79294
79294
  }
79295
79295
  cached = "unknown";
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.3.2".length > 0) {
393
- cached = "0.3.2";
392
+ if ("0.3.4".length > 0) {
393
+ cached = "0.3.4";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -79324,8 +79324,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79324
79324
  var cached;
79325
79325
  function substrateSelfVersion() {
79326
79326
  if (cached !== void 0) return cached;
79327
- if ("0.3.2".length > 0) {
79328
- cached = "0.3.2";
79327
+ if ("0.3.4".length > 0) {
79328
+ cached = "0.3.4";
79329
79329
  return cached;
79330
79330
  }
79331
79331
  cached = "unknown";
@@ -427,8 +427,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
427
427
  var cached;
428
428
  function substrateSelfVersion() {
429
429
  if (cached !== void 0) return cached;
430
- if ("0.3.2".length > 0) {
431
- cached = "0.3.2";
430
+ if ("0.3.4".length > 0) {
431
+ cached = "0.3.4";
432
432
  return cached;
433
433
  }
434
434
  cached = "unknown";
@@ -79783,8 +79783,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79783
79783
  var cached;
79784
79784
  function substrateSelfVersion() {
79785
79785
  if (cached !== void 0) return cached;
79786
- if ("0.3.2".length > 0) {
79787
- cached = "0.3.2";
79786
+ if ("0.3.4".length > 0) {
79787
+ cached = "0.3.4";
79788
79788
  return cached;
79789
79789
  }
79790
79790
  cached = "unknown";
@@ -864,8 +864,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
864
864
  var cached;
865
865
  function substrateSelfVersion() {
866
866
  if (cached !== void 0) return cached;
867
- if ("0.3.2".length > 0) {
868
- cached = "0.3.2";
867
+ if ("0.3.4".length > 0) {
868
+ cached = "0.3.4";
869
869
  return cached;
870
870
  }
871
871
  cached = "unknown";
@@ -88240,8 +88240,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
88240
88240
  var cached;
88241
88241
  function substrateSelfVersion() {
88242
88242
  if (cached !== void 0) return cached;
88243
- if ("0.3.2".length > 0) {
88244
- cached = "0.3.2";
88243
+ if ("0.3.4".length > 0) {
88244
+ cached = "0.3.4";
88245
88245
  return cached;
88246
88246
  }
88247
88247
  cached = "unknown";
@@ -9393,8 +9393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9393
9393
  var cached;
9394
9394
  function substrateSelfVersion() {
9395
9395
  if (cached !== void 0) return cached;
9396
- if ("0.3.2".length > 0) {
9397
- cached = "0.3.2";
9396
+ if ("0.3.4".length > 0) {
9397
+ cached = "0.3.4";
9398
9398
  return cached;
9399
9399
  }
9400
9400
  cached = "unknown";
@@ -88825,8 +88825,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
88825
88825
  var cached;
88826
88826
  function substrateSelfVersion() {
88827
88827
  if (cached !== void 0) return cached;
88828
- if ("0.3.2".length > 0) {
88829
- cached = "0.3.2";
88828
+ if ("0.3.4".length > 0) {
88829
+ cached = "0.3.4";
88830
88830
  return cached;
88831
88831
  }
88832
88832
  cached = "unknown";
@@ -9978,8 +9978,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9978
9978
  var cached;
9979
9979
  function substrateSelfVersion() {
9980
9980
  if (cached !== void 0) return cached;
9981
- if ("0.3.2".length > 0) {
9982
- cached = "0.3.2";
9981
+ if ("0.3.4".length > 0) {
9982
+ cached = "0.3.4";
9983
9983
  return cached;
9984
9984
  }
9985
9985
  cached = "unknown";
@@ -79288,8 +79288,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79288
79288
  var cached;
79289
79289
  function substrateSelfVersion() {
79290
79290
  if (cached !== void 0) return cached;
79291
- if ("0.3.2".length > 0) {
79292
- cached = "0.3.2";
79291
+ if ("0.3.4".length > 0) {
79292
+ cached = "0.3.4";
79293
79293
  return cached;
79294
79294
  }
79295
79295
  cached = "unknown";
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.3.2".length > 0) {
393
- cached = "0.3.2";
392
+ if ("0.3.4".length > 0) {
393
+ cached = "0.3.4";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -1667,8 +1667,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
1667
1667
  var cached;
1668
1668
  function substrateSelfVersion() {
1669
1669
  if (cached !== void 0) return cached;
1670
- if ("0.3.2".length > 0) {
1671
- cached = "0.3.2";
1670
+ if ("0.3.4".length > 0) {
1671
+ cached = "0.3.4";
1672
1672
  return cached;
1673
1673
  }
1674
1674
  cached = "unknown";
@@ -1630,8 +1630,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
1630
1630
  var cached;
1631
1631
  function substrateSelfVersion() {
1632
1632
  if (cached !== void 0) return cached;
1633
- if ("0.3.2".length > 0) {
1634
- cached = "0.3.2";
1633
+ if ("0.3.4".length > 0) {
1634
+ cached = "0.3.4";
1635
1635
  return cached;
1636
1636
  }
1637
1637
  cached = "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks-solutions/lakebase-scm-utils",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Lakebase SCM + substrate engine: database branching, paired-branch SCM workflows, connection/credential minting, schema migration, project scaffold + deploy primitives, and the git/github utility layer. Extracted from consort for portable, standalone consumption by lakebase-scm-extension and the SFTDD orchestration.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -0,0 +1,96 @@
1
+ // Consort per-test "green as it runs" reporter for Vitest (client component/hook tests).
2
+ //
3
+ // Mirrors the Playwright reporter: a test whose name carries `@T<id>` streams its lifecycle to
4
+ // `.consort/test-run.jsonl` so the Consort dashboard lights that bubble. Reuses the single
5
+ // `emitTestRun` writer from the shared Playwright reporter one directory up (`../consort-test-reporter`)
6
+ // — one writer, one JSONL shape, one `.consort` resolver.
7
+ //
8
+ // Recent Vitest (the "Reported Tasks" reporter API, v2.1+) fires per-test hooks, so we stream
9
+ // `running` the moment a test starts and the final status when it ends. OLDER Vitest does not fire
10
+ // those hooks — so `onFinished` is a BATCH BACKSTOP that emits any test the per-test hooks did not
11
+ // already handle (tracked in `handled`), giving a correct end-of-run signal on any version. Typed
12
+ // structurally (not against vitest's own types) so a vitest major bump can't break the build;
13
+ // everything is wrapped so a reporter error can never fail the suite.
14
+ import { emitTestRun, type TestRunStatus } from "../consort-capture";
15
+
16
+ const TEST_ID = /@(T\d+(?:-[a-z0-9-]+)?)/;
17
+
18
+ // NOTE: per-test TABLE-STATE capture does NOT live here — it is in `tests/setup.ts`'s afterEach,
19
+ // which runs in the WORKER process where the booted backend's base URL (`.consort/.vitest-backend`)
20
+ // actually resolves. This reporter runs in the MAIN process, where that base did not resolve, so a
21
+ // capture here silently no-op'd. This reporter is purely the per-test STATUS stream (test-run.jsonl).
22
+
23
+ function idOf(name: string | undefined): string | undefined {
24
+ return TEST_ID.exec(name ?? "")?.[1];
25
+ }
26
+
27
+ function stateToStatus(state: string | undefined): TestRunStatus {
28
+ return state === "pass" || state === "passed" ? "green" : state === "skip" || state === "skipped" ? "skipped" : "red";
29
+ }
30
+
31
+ // --- Modern "Reported Tasks" shapes (duck-typed) ---------------------------------------------
32
+ interface ReportedTestCase {
33
+ name?: string;
34
+ module?: { moduleId?: string; id?: string };
35
+ result?: (() => { state?: string } | undefined) | { state?: string };
36
+ }
37
+
38
+ function moduleIdOf(tc: ReportedTestCase): string {
39
+ return tc.module?.moduleId ?? tc.module?.id ?? "";
40
+ }
41
+
42
+ function resultStateOf(tc: ReportedTestCase): string | undefined {
43
+ const r = typeof tc.result === "function" ? tc.result() : tc.result;
44
+ return r?.state;
45
+ }
46
+
47
+ // --- Legacy onFinished task tree (duck-typed) ------------------------------------------------
48
+ interface VitestTaskLike {
49
+ type?: string;
50
+ name?: string;
51
+ mode?: string;
52
+ result?: { state?: string };
53
+ tasks?: VitestTaskLike[];
54
+ filepath?: string;
55
+ }
56
+
57
+ export default class ConsortVitestReporter {
58
+ // Keys (`file\0name`) already emitted by the per-test hooks, so the onFinished backstop skips
59
+ // them on recent Vitest and only fires for versions where the per-test hooks never ran.
60
+ private handled = new Set<string>();
61
+
62
+ onTestCaseReady(testCase: ReportedTestCase): void {
63
+ const id = idOf(testCase.name);
64
+ if (id) emitTestRun(id, "running", moduleIdOf(testCase), "client");
65
+ }
66
+
67
+ onTestCaseResult(testCase: ReportedTestCase): void {
68
+ const id = idOf(testCase.name);
69
+ if (!id) return;
70
+ const file = moduleIdOf(testCase);
71
+ this.handled.add(`${file}\u0000${testCase.name ?? ""}`);
72
+ emitTestRun(id, stateToStatus(resultStateOf(testCase)), file, "client");
73
+ }
74
+
75
+ onFinished(files: VitestTaskLike[] = []): void {
76
+ try {
77
+ for (const f of files) this.walk(f, f.filepath ?? "");
78
+ } catch {
79
+ /* best-effort: a per-test reporter write must never fail the suite */
80
+ }
81
+ }
82
+
83
+ private walk(task: VitestTaskLike, file: string): void {
84
+ const isLeaf = task.type === "test" || task.type === "custom" || (!task.tasks && !!task.result);
85
+ if (isLeaf) {
86
+ const id = idOf(task.name);
87
+ if (!id) return;
88
+ if (this.handled.has(`${file}\u0000${task.name ?? ""}`)) return; // already streamed by the per-test hooks
89
+ const st = task.result?.state;
90
+ const status: TestRunStatus = st === "pass" ? "green" : st === "skip" || task.mode === "skip" ? "skipped" : "red";
91
+ emitTestRun(id, status, file, "client");
92
+ return;
93
+ }
94
+ for (const child of task.tasks ?? []) this.walk(child, file);
95
+ }
96
+ }
@@ -23,6 +23,7 @@
23
23
  "@testing-library/jest-dom": "^6.4.8",
24
24
  "@testing-library/react": "^16.0.0",
25
25
  "@testing-library/user-event": "^14.5.2",
26
+ "@types/node": "^20.14.0",
26
27
  "@types/react": "^18.3.3",
27
28
  "@types/react-dom": "^18.3.0",
28
29
  "@vitejs/plugin-react": "^4.3.1",
@@ -25,6 +25,7 @@ const ROOT = join(process.cwd(), "..");
25
25
  function resolvePort(envVar: string, fallback: number): string {
26
26
  const fromEnv = process.env[envVar];
27
27
  if (fromEnv) return fromEnv;
28
+ let resolved = String(fallback);
28
29
  const portUtils = join(ROOT, "scripts", "port-utils.sh");
29
30
  if (existsSync(portUtils)) {
30
31
  try {
@@ -33,12 +34,21 @@ function resolvePort(envVar: string, fallback: number): string {
33
34
  ["-c", `source ${JSON.stringify(portUtils)} && free_port ${fallback}`],
34
35
  { encoding: "utf8" }
35
36
  ).trim();
36
- if (/^\d+$/.test(out)) return out;
37
+ if (/^\d+$/.test(out)) resolved = out;
37
38
  } catch {
38
39
  // fall through to the conventional default
39
40
  }
40
41
  }
41
- return String(fallback);
42
+ // PERSIST the chosen port into the environment so Playwright's WORKER processes reuse it.
43
+ // Playwright evaluates this config in the main process AND re-evaluates it in each test
44
+ // worker. Without this, a worker re-runs resolvePort with E2E_CLIENT_PORT still unset, finds
45
+ // the port the main process picked (e.g. 5173) now TAKEN by the Vite webServer, allocates a
46
+ // DIFFERENT free port (5174), and points `baseURL` at 5174 where nothing listens — so the
47
+ // browser specs fail "not reachable" even though the app is healthy on the real port. Workers
48
+ // are spawned AFTER the main-process config load and inherit its process.env, so recording the
49
+ // resolution here makes every worker read it back via `fromEnv` above: resolve once, share it.
50
+ process.env[envVar] = resolved;
51
+ return resolved;
42
52
  }
43
53
  const BACKEND_PORT = resolvePort("E2E_BACKEND_PORT", 8000);
44
54
  const CLIENT_PORT = resolvePort("E2E_CLIENT_PORT", 5173);
@@ -91,7 +101,12 @@ export default defineConfig({
91
101
  workers: 1,
92
102
  forbidOnly: !!process.env.CI,
93
103
  retries: process.env.CI ? 2 : 0,
94
- reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list",
104
+ // `../consort-test-reporter.ts` (shared with the root config) appends each `@T<id>`-tagged test
105
+ // to `.consort/test-run.jsonl` as it finishes, for the dashboard's per-test live signal. It walks
106
+ // up from cwd to the project `.consort`, so running from client/ still finds the right ledger.
107
+ reporter: process.env.CI
108
+ ? [["list"], ["html", { open: "never" }], ["../consort-test-reporter.ts"]]
109
+ : [["list"], ["../consort-test-reporter.ts"]],
95
110
  use: {
96
111
  baseURL: CLIENT_URL,
97
112
  trace: "on-first-retry",
@@ -1,4 +1,4 @@
1
- import { test, expect } from "@playwright/test";
1
+ import { test, expect } from "./consort-fixtures";
2
2
 
3
3
  // The reachability pattern proven end-to-end: a feature page is reachable by
4
4
  // NAVIGATING the real app (a navbar link / a route), not just by mounting the
@@ -0,0 +1,23 @@
1
+ // Consort e2e test fixture: tag every spec's browser requests with the X-Consort-Test-Id header,
2
+ // derived from the test title's @T<id>. The backend's per-test capture (app/consort_capture.py) uses
3
+ // it to attribute the rows this spec RETRIEVES/STORES — the same per-test key the Vitest fetch shim
4
+ // and the pytest client fixture set, so the dashboard's per-test table view works for e2e specs too.
5
+ //
6
+ // Import { test, expect } from THIS module in e2e specs instead of "@playwright/test" — nothing else
7
+ // changes. (The header rides through Vite's /api proxy to the backend; it's inert in production.)
8
+ import { test as base } from "@playwright/test";
9
+
10
+ // Re-export EVERYTHING from @playwright/test (expect, devices, types like APIRequestContext, …) so a
11
+ // spec imports solely from here; the local `test` below overrides the re-exported one (an explicit
12
+ // export shadows a star re-export of the same name).
13
+ export * from "@playwright/test";
14
+
15
+ const TEST_ID = /@(T\d+(?:-[a-z0-9-]+)?)/;
16
+
17
+ export const test = base.extend({
18
+ page: async ({ page }, use, testInfo) => {
19
+ const id = TEST_ID.exec(testInfo.title)?.[1];
20
+ if (id) await page.setExtraHTTPHeaders({ "X-Consort-Test-Id": id });
21
+ await use(page);
22
+ },
23
+ });
@@ -1,4 +1,4 @@
1
- import { test, expect } from "@playwright/test";
1
+ import { test, expect } from "./consort-fixtures";
2
2
 
3
3
  // The one behavior a fresh scaffold can prove end-to-end: the SPA loads, calls
4
4
  // the backend /health through the Vite proxy, and shows the result as an