@dads-framework/testing 0.5.1 → 0.6.1

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 (118) hide show
  1. package/README.md +111 -18
  2. package/dist/commands/diagnose.d.ts +15 -0
  3. package/dist/commands/diagnose.d.ts.map +1 -0
  4. package/dist/commands/diagnose.js +119 -0
  5. package/dist/commands/diagnose.js.map +1 -0
  6. package/dist/commands/plan-run.d.ts.map +1 -1
  7. package/dist/commands/plan-run.js +11 -1
  8. package/dist/commands/plan-run.js.map +1 -1
  9. package/dist/dad-test-cli.d.ts.map +1 -1
  10. package/dist/dad-test-cli.js +20 -3
  11. package/dist/dad-test-cli.js.map +1 -1
  12. package/dist/dst/fault-delivery.d.ts +60 -0
  13. package/dist/dst/fault-delivery.d.ts.map +1 -0
  14. package/dist/dst/fault-delivery.js +164 -0
  15. package/dist/dst/fault-delivery.js.map +1 -0
  16. package/dist/dst/fault-transactions.d.ts +58 -0
  17. package/dist/dst/fault-transactions.d.ts.map +1 -0
  18. package/dist/dst/fault-transactions.js +127 -0
  19. package/dist/dst/fault-transactions.js.map +1 -0
  20. package/dist/dst/index.d.ts +7 -0
  21. package/dist/dst/index.d.ts.map +1 -0
  22. package/dist/dst/index.js +7 -0
  23. package/dist/dst/index.js.map +1 -0
  24. package/dist/dst/prng.d.ts +36 -0
  25. package/dist/dst/prng.d.ts.map +1 -0
  26. package/dist/dst/prng.js +98 -0
  27. package/dist/dst/prng.js.map +1 -0
  28. package/dist/dst/sim-clock.d.ts +32 -0
  29. package/dist/dst/sim-clock.d.ts.map +1 -0
  30. package/dist/dst/sim-clock.js +75 -0
  31. package/dist/dst/sim-clock.js.map +1 -0
  32. package/dist/dst/sim-world.d.ts +28 -0
  33. package/dist/dst/sim-world.d.ts.map +1 -0
  34. package/dist/dst/sim-world.js +26 -0
  35. package/dist/dst/sim-world.js.map +1 -0
  36. package/dist/dst/simulation-runner.d.ts +78 -0
  37. package/dist/dst/simulation-runner.d.ts.map +1 -0
  38. package/dist/dst/simulation-runner.js +209 -0
  39. package/dist/dst/simulation-runner.js.map +1 -0
  40. package/dist/explain-plan.d.ts +4 -0
  41. package/dist/explain-plan.d.ts.map +1 -1
  42. package/dist/explain-plan.js +30 -36
  43. package/dist/explain-plan.js.map +1 -1
  44. package/dist/index.d.ts +3 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +2 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/init/check-testing-manifest.js +9 -0
  49. package/dist/init/check-testing-manifest.js.map +1 -1
  50. package/dist/init/dads-app-discovery.d.ts +24 -0
  51. package/dist/init/dads-app-discovery.d.ts.map +1 -0
  52. package/dist/init/dads-app-discovery.js +168 -0
  53. package/dist/init/dads-app-discovery.js.map +1 -0
  54. package/dist/init/infer-dads-app.d.ts +11 -0
  55. package/dist/init/infer-dads-app.d.ts.map +1 -0
  56. package/dist/init/infer-dads-app.js +228 -0
  57. package/dist/init/infer-dads-app.js.map +1 -0
  58. package/dist/init/infer-one-package.d.ts.map +1 -1
  59. package/dist/init/infer-one-package.js +5 -4
  60. package/dist/init/infer-one-package.js.map +1 -1
  61. package/dist/init/init-testing-manifest.d.ts.map +1 -1
  62. package/dist/init/init-testing-manifest.js +3 -2
  63. package/dist/init/init-testing-manifest.js.map +1 -1
  64. package/dist/nx/dads-identifier.d.ts +7 -3
  65. package/dist/nx/dads-identifier.d.ts.map +1 -1
  66. package/dist/nx/dads-identifier.js +23 -5
  67. package/dist/nx/dads-identifier.js.map +1 -1
  68. package/dist/nx/index.d.ts +5 -1
  69. package/dist/nx/index.d.ts.map +1 -1
  70. package/dist/nx/index.js +5 -1
  71. package/dist/nx/index.js.map +1 -1
  72. package/dist/nx/nx-eject-targets.d.ts +30 -0
  73. package/dist/nx/nx-eject-targets.d.ts.map +1 -0
  74. package/dist/nx/nx-eject-targets.js +283 -0
  75. package/dist/nx/nx-eject-targets.js.map +1 -0
  76. package/dist/nx/nx-eject-vitest.d.ts +24 -0
  77. package/dist/nx/nx-eject-vitest.d.ts.map +1 -0
  78. package/dist/nx/nx-eject-vitest.js +156 -0
  79. package/dist/nx/nx-eject-vitest.js.map +1 -0
  80. package/dist/nx/nx-eject-workspace.d.ts +45 -0
  81. package/dist/nx/nx-eject-workspace.d.ts.map +1 -0
  82. package/dist/nx/nx-eject-workspace.js +267 -0
  83. package/dist/nx/nx-eject-workspace.js.map +1 -0
  84. package/dist/nx/nx-native-cli.js +88 -8
  85. package/dist/nx/nx-native-cli.js.map +1 -1
  86. package/dist/nx/nx-native-inputs.d.ts +9 -2
  87. package/dist/nx/nx-native-inputs.d.ts.map +1 -1
  88. package/dist/nx/nx-native-inputs.js +87 -35
  89. package/dist/nx/nx-native-inputs.js.map +1 -1
  90. package/dist/nx/nx-native-model.d.ts +3 -2
  91. package/dist/nx/nx-native-model.d.ts.map +1 -1
  92. package/dist/nx/nx-native-model.js +117 -28
  93. package/dist/nx/nx-native-model.js.map +1 -1
  94. package/dist/nx/nx-native-scope.d.ts +1 -1
  95. package/dist/nx/nx-native-scope.d.ts.map +1 -1
  96. package/dist/nx/nx-native-workspace.d.ts +14 -1
  97. package/dist/nx/nx-native-workspace.d.ts.map +1 -1
  98. package/dist/nx/nx-native-workspace.js +40 -5
  99. package/dist/nx/nx-native-workspace.js.map +1 -1
  100. package/dist/plan-reasons.d.ts.map +1 -1
  101. package/dist/plan-reasons.js +4 -0
  102. package/dist/plan-reasons.js.map +1 -1
  103. package/dist/testing-api.d.ts +78 -0
  104. package/dist/testing-api.d.ts.map +1 -1
  105. package/dist/testing-api.js +9 -0
  106. package/dist/testing-api.js.map +1 -1
  107. package/dist/testing-manifest-sql.d.ts +24 -0
  108. package/dist/testing-manifest-sql.d.ts.map +1 -0
  109. package/dist/testing-manifest-sql.js +104 -0
  110. package/dist/testing-manifest-sql.js.map +1 -0
  111. package/dist/testing-manifest.d.ts +12 -0
  112. package/dist/testing-manifest.d.ts.map +1 -1
  113. package/dist/testing-manifest.js +74 -3
  114. package/dist/testing-manifest.js.map +1 -1
  115. package/dist/testing.tsbuildinfo +1 -1
  116. package/dst/README.md +75 -0
  117. package/nx/README.md +78 -39
  118. package/package.json +11 -6
package/README.md CHANGED
@@ -98,7 +98,15 @@ described under [Contract](#contract).
98
98
  `dad-test run` selects the same way and then executes the selected tasks as a
99
99
  dependency-aware DAG, four workers at a time by default; `--jobs` sets a
100
100
  different positive limit. Independent tasks keep going after another task
101
- fails; dependents of a failed or blocked prerequisite are blocked.
101
+ fails; dependents of a failed or blocked prerequisite are blocked. By default
102
+ every selected task executes fresh. Passing `--cache` opts into content-hashed
103
+ passing receipts persisted under Git metadata (invalidated by any source,
104
+ policy-file, manifest, command, `execution.env`, runtime fingerprint, or
105
+ selected-file change; failing runs never write receipts); `--no-cache` forces
106
+ fresh execution. Passing `--remote-cache <url>` (or setting
107
+ `DADS_TESTING_REMOTE_CACHE_URL`, with optional
108
+ `DADS_TESTING_REMOTE_CACHE_TOKEN`) adds a fail-closed L2 remote receipt store
109
+ (`file://`, `http://`, or `https://`) shared across workers.
102
110
 
103
111
  `dad-test explain` prints the same selection in readable lines, taking
104
112
  `--manifest`, `--base`, `--head`, `--all`, `--task`, and `--json`:
@@ -110,6 +118,7 @@ full-fallback: yes|no
110
118
  forced-by <issue>
111
119
  RUN|SKIP <id> project=<p> reason=<code> confidence=<c> widened=yes|no
112
120
  because <plain words>
121
+ file <selected test path>
113
122
  changed <path>
114
123
  export <symbol> <path>
115
124
  import <path>:line:col from <path> [symbols]
@@ -125,10 +134,27 @@ every cause came from the plan the native engine returned; `detail=derived`
125
134
  means that engine predates structured causes, so `explain` reconstructs what
126
135
  each reason code implies from the plan and the manifest instead.
127
136
 
137
+ `dad-test diagnose` inspects the workspace's dependency graph and manifest
138
+ without requiring a Git diff, taking `--manifest` and `--json`. In an Nx
139
+ workspace without a `dads.testing.json`, `dad-test diagnose` detects `nx.json`
140
+ and runs directly through the live Nx adapter (equivalent to `dad-test-nx
141
+ diagnose`). It prints a read-only coupling and precision X-ray: summary totals
142
+ (modules, projects, tasks, test files, uncertainties, and effective-today vs.
143
+ potential leaf skip percentages), ranked widening culprits (`path:line:col
144
+ [code] -> widens N tasks / M test files`), top module coupling hotspots
145
+ separating runtime test reach from `import type` reach (`path -> reaches M
146
+ runtime test files (P%) across K projects`), and fallback traps (unowned
147
+ tracked directories and uncovered non-code files inside reachability projects,
148
+ excluding intentional root policy files). Each finding carries a safety-tiered
149
+ `remediation` (`safe`, `verify-before-changing`, or
150
+ `keep-widened-unless-verified`) with an action, a soundness guardrail caution,
151
+ and a verification step so narrowing never hides real regressions.
152
+
128
153
  `dad-test init` refuses Nx workspaces and writes an unsuccessful coverage report
129
154
  instead of treating a few root scripts as the repository's entire task inventory.
130
- Use `dad-test-nx plan` for those repositories. The [Nx adapter and import guide](nx/README.md)
131
- covers both CLIs and the `@dads-framework/testing/nx` API.
155
+ Use `dad-test-nx diagnose`, `dad-test-nx plan`, and `dad-test-nx run` for those
156
+ repositories. The [Nx adapter and import guide](nx/README.md) covers both CLIs
157
+ and the `@dads-framework/testing/nx` API.
132
158
 
133
159
  `dad-test init` writes `dads.testing.json` at the workspace root, taking
134
160
  `--manifest`, `--force`, and `--json`. It detects the package manager — npm,
@@ -136,13 +162,16 @@ yarn, or pnpm — from the lockfile. Workspace patterns come from
136
162
  `pnpm-workspace.yaml`'s `packages` list of strings; other top-level keys in
137
163
  that file are ignored and reported, and anything else refuses with a
138
164
  `file:line` pointing at the problem. Absent that file, patterns come from
139
- `package.json`'s `workspaces` field; absent that, the workspace is one
140
- package. Recognized `test` scripts become `reachability` tasks; `typecheck`,
141
- `lint`, and `build` scripts become `project` tasks; `test` depends on
142
- `typecheck`; and `fallbackDependencies` come from workspace dependencies and
143
- `tsconfig` references. `init` refuses to overwrite an existing manifest
144
- without `--force`, and a workspace with zero recognized scripts still gets a
145
- report before `init` refuses.
165
+ `package.json`'s `workspaces` field; absent that, a single-package Dads
166
+ application with `dads.project.json` and Vitest gets per-domain projects plus
167
+ file-level Vitest narrowing, and any other single-package repository is treated
168
+ as one project. Recognized `test` and `typecheck` scripts become `reachability`
169
+ tasks (runtime edges for `test`, full runtime plus `import type` edges for
170
+ `typecheck`, so comment-only edits skip both); `lint` and `build` scripts become
171
+ `project` tasks; `test` depends on `typecheck`; and `fallbackDependencies` come
172
+ from workspace dependencies and `tsconfig` references. `init` refuses to
173
+ overwrite an existing manifest without `--force`, and a workspace with zero
174
+ recognized scripts still gets a report before `init` refuses.
146
175
 
147
176
  Toolbox's `dad test plan|run|explain|init` is a passthrough to the commands
148
177
  above. Toolbox's own `dad init` (scaffolds an application) and `dad explain
@@ -170,9 +199,67 @@ above. Toolbox's own `dad init` (scaffolds an application) and `dad explain
170
199
 
171
200
  All fields are strict. Paths must stay within the workspace. Project and task
172
201
  ids are unique, all references must resolve, task cycles are rejected, and
173
- `workspace.fullFallback.taskIds` must list every task exactly once. Ordinary
174
- tasks are an executable plus arguments; an explicit `shell: true` runs
175
- `executable` and `args` through the platform shell for shell recipes.
202
+ `workspace.fullFallback.taskIds` must list every task exactly once. Ordinary tasks are an executable plus arguments (with optional `env` key-value
203
+ pairs passed to the process and hashed into receipts); an explicit `shell: true`
204
+ runs `executable` and `args` through the platform shell for shell recipes. A `reachability` test task may also declare `execution.fileNarrowing`
205
+ (`suffixes`, optional `excludeSuffixes`, and optional `setupFiles`) so that an
206
+ un-widened run appends only the reached test files to `execution.args` and
207
+ skips the task when zero matching test files are reached. Workspaces with SQL
208
+ migrations may declare `workspace.sql` (`migrationRoots`, `objects`, `edges`,
209
+ and optional `snapshotPatterns`) alongside per-task `sqlImpact`
210
+ (`isMigrationRunner`, `tables`, or `hasUnmappedSql`) so table-scoped DDL runs
211
+ migration runners plus only affected database domains via bidirectional FK
212
+ closure while global/unrecognized DDL widens safely to all database tasks.
213
+ Workspaces may also declare `workspace.nonCodeSuffixes` (for example `[".md"]`)
214
+ so documentation-only edits do not widen JavaScript/TypeScript reachability.
215
+
216
+ Optional `fileNarrowing` and `workspace.sql` / `sqlImpact` shape (`objects` is
217
+ an array of `"schema.table"` strings; `edges` is an array of `{ from, to }`
218
+ foreign-key pairs):
219
+
220
+ ```json
221
+ {
222
+ "workspace": {
223
+ "root": ".",
224
+ "fullFallback": { "taskIds": ["billing:test", "db:migrate-test"] },
225
+ "nonCodeSuffixes": [".md"],
226
+ "sql": {
227
+ "migrationRoots": ["db/migrations"],
228
+ "objects": ["public.accounts", "public.invoices"],
229
+ "edges": [{ "from": "public.invoices", "to": "public.accounts" }],
230
+ "snapshotPatterns": [{ "prefix": "db/snapshots/", "suffix": ".sql", "schema": "public" }]
231
+ }
232
+ },
233
+ "tasks": [
234
+ {
235
+ "id": "billing:test",
236
+ "project": "billing",
237
+ "kind": "test",
238
+ "execution": {
239
+ "executable": "npx",
240
+ "args": ["vitest", "run"],
241
+ "fileNarrowing": {
242
+ "suffixes": [".test.ts"],
243
+ "excludeSuffixes": [".integration.test.ts"],
244
+ "setupFiles": ["vitest.setup.ts"]
245
+ }
246
+ },
247
+ "dependsOn": [],
248
+ "impact": { "mode": "reachability", "paths": ["vitest.config.ts"] },
249
+ "sqlImpact": { "tables": ["public.invoices"] }
250
+ },
251
+ {
252
+ "id": "db:migrate-test",
253
+ "project": "db",
254
+ "kind": "test",
255
+ "execution": { "executable": "npm", "args": ["run", "test:migrations"] },
256
+ "dependsOn": [],
257
+ "impact": { "mode": "reachability" },
258
+ "sqlImpact": { "isMigrationRunner": true }
259
+ }
260
+ ]
261
+ }
262
+ ```
176
263
 
177
264
  ## How selection works
178
265
 
@@ -205,8 +292,10 @@ tasks are an executable plus arguments; an explicit `shell: true` runs
205
292
 
206
293
  - The core API and `dad-test` run without Nx. The Nx adapter uses the target
207
294
  workspace’s local Nx installation.
208
- - No test-result cache and no result reuse: every `run` executes its selected
209
- tasks again.
295
+ - No implicit test-result cache: every `run` executes its selected tasks fresh
296
+ unless the caller explicitly passes `--cache` (which only reuses a verified
297
+ passing receipt when the entire content-hashed input closure matches, and
298
+ `--no-cache` always overrides it).
210
299
  - No daemon, no network service, no telemetry.
211
300
  - No skip it cannot prove.
212
301
  - `DADS_TEST_NATIVE_BINARY` is for local development only. When it is set it
@@ -219,7 +308,8 @@ tasks are an executable plus arguments; an explicit `shell: true` runs
219
308
 
220
309
  The plan JSON carries `scope`, `tasks`, and `issues`. A task has `id`,
221
310
  `decision`, `reason`, `confidence`, and `widened`, plus an optional `project`
222
- that owns it and an optional `causes` list naming every reason it was
311
+ that owns it, optional `reachedFiles` and `selectedFiles` lists for narrowed
312
+ test selection, and an optional `causes` list naming every reason it was
223
313
  selected: a direct task input, a prerequisite of another selected task, a
224
314
  changed path, a changed export, a reached import (with its location, the
225
315
  module it was imported from, and the symbols), a plan issue, or a fallback
@@ -252,8 +342,11 @@ workspace facts, each package's tasks and skips, inferences, unsupported
252
342
  constructs, the manifest's checksum, and the validation method: `native` when
253
343
  a binary was available, otherwise `structural`, or `none`.
254
344
 
255
- The package also exposes `planTesting(request)` and `runTesting(request)`.
256
- Each operation makes one JSON request to the native `dad-test` process.
345
+ The package also exposes `planTesting(request)`, `runTesting(request)`, and
346
+ `diagnoseTesting(request)`. Each operation makes one JSON request to the native
347
+ `dad-test` process. For deterministic simulation testing (seeded PRNG, simulated
348
+ `Clock`, UUIDv7, shrinking invariant runner, and fault-injecting adapters), see
349
+ the [DST guide](dst/README.md) (`@dads-framework/testing/dst`).
257
350
 
258
351
  ## Native packages
259
352
 
@@ -0,0 +1,15 @@
1
+ import type { DadTestCommand } from "../dad-test-cli.js";
2
+ import type { TestingDiagnoseResult } from "../testing-api.js";
3
+ /**
4
+ * `dad-test diagnose` inspects the workspace's dependency graph and manifest
5
+ * without requiring a Git diff, reporting widening culprits, coupling hotspots,
6
+ * fallback traps, and safety-tiered remediation guidance.
7
+ *
8
+ * When invoked in an Nx workspace without a `dads.testing.json`, it runs
9
+ * diagnosis directly through the native Nx adapter so the quickstart works
10
+ * with zero hand-authored manifest.
11
+ */
12
+ export declare const diagnoseCommand: DadTestCommand;
13
+ /** Renders a human-readable Coupling & Precision X-Ray report with safe remediation guidance. */
14
+ export declare function renderDiagnosis(diagnosis: TestingDiagnoseResult): string;
15
+ //# sourceMappingURL=diagnose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnose.d.ts","sourceRoot":"","sources":["../../src/commands/diagnose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAGV,qBAAqB,EAGtB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,cAY7B,CAAC;AA+CF,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,SAAS,EAAE,qBAAqB,GAAG,MAAM,CAexE"}
@@ -0,0 +1,119 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { writeCommandSuccess } from "../cli-output.js";
4
+ import { diagnoseNativeNxTesting } from "../nx/nx-native-workspace.js";
5
+ import { diagnoseTesting } from "../testing-api.js";
6
+ import { defaultTestingManifestFileName } from "../testing-manifest.js";
7
+ const diagnoseOptions = [{ name: "--manifest", kind: "value" }];
8
+ /**
9
+ * `dad-test diagnose` inspects the workspace's dependency graph and manifest
10
+ * without requiring a Git diff, reporting widening culprits, coupling hotspots,
11
+ * fallback traps, and safety-tiered remediation guidance.
12
+ *
13
+ * When invoked in an Nx workspace without a `dads.testing.json`, it runs
14
+ * diagnosis directly through the native Nx adapter so the quickstart works
15
+ * with zero hand-authored manifest.
16
+ */
17
+ export const diagnoseCommand = {
18
+ options: diagnoseOptions,
19
+ execute: async (parsed, io, json) => {
20
+ const manifestPath = parsed.values.get("--manifest");
21
+ const diagnosis = await runDiagnosis(io.cwd, manifestPath, io.nativeBinary);
22
+ if (json) {
23
+ writeCommandSuccess(io, json, "diagnose", diagnosis);
24
+ }
25
+ else {
26
+ io.stdout(renderDiagnosis(diagnosis));
27
+ }
28
+ return 0;
29
+ },
30
+ };
31
+ async function runDiagnosis(workspaceRoot, manifestPath, nativeBinary) {
32
+ if (shouldDiagnoseViaNx(workspaceRoot, manifestPath)) {
33
+ const nxResult = await diagnoseNativeNxTesting({
34
+ workspaceRoot,
35
+ ...(nativeBinary === undefined ? {} : { nativeBinary }),
36
+ });
37
+ return nxResult.diagnose;
38
+ }
39
+ try {
40
+ return await diagnoseTesting({
41
+ workspaceRoot,
42
+ ...(manifestPath === undefined ? {} : { manifestPath }),
43
+ ...(nativeBinary === undefined ? {} : { nativeBinary }),
44
+ });
45
+ }
46
+ catch (error) {
47
+ throw enrichMissingManifestError(error, manifestPath);
48
+ }
49
+ }
50
+ function shouldDiagnoseViaNx(workspaceRoot, manifestPath) {
51
+ return (manifestPath === undefined &&
52
+ !existsSync(join(workspaceRoot, defaultTestingManifestFileName)) &&
53
+ existsSync(join(workspaceRoot, "nx.json")));
54
+ }
55
+ function enrichMissingManifestError(error, manifestPath) {
56
+ if (manifestPath === undefined &&
57
+ error instanceof Error &&
58
+ /Unable to resolve manifestPath|No such file or directory/i.test(error.message)) {
59
+ return new Error(`No ${defaultTestingManifestFileName} found. Run 'dad-test init' to generate one, pass --manifest <path>, or use 'dad-test-nx diagnose' in an Nx workspace.`, { cause: error });
60
+ }
61
+ return error;
62
+ }
63
+ /** Renders a human-readable Coupling & Precision X-Ray report with safe remediation guidance. */
64
+ export function renderDiagnosis(diagnosis) {
65
+ const { summary } = diagnosis;
66
+ const skipSummary = summary.estimatedLeafSkipPercent === summary.potentialLeafSkipPercent
67
+ ? `${String(summary.estimatedLeafSkipPercent)}% effective`
68
+ : `${String(summary.estimatedLeafSkipPercent)}% effective today -> ${String(summary.potentialLeafSkipPercent)}% potential after fixing widening culprits`;
69
+ const lines = [
70
+ `diagnose: ${plural(summary.totalModules, "module")}, ${plural(summary.totalProjects, "project")}, ${plural(summary.totalTasks, "task")}, ${plural(summary.totalTestFiles, "test file")}, ${plural(summary.totalUncertainties, "uncertainty", "uncertainties")} (${String(summary.wholeWorkspaceUncertainties)} workspace-wide)`,
71
+ ` leaf skip: ${skipSummary}`,
72
+ ` unowned tracked files: ${String(summary.unownedTrackedFiles)}, uncovered non-code files: ${String(summary.nonCodeUncoveredFiles)}`,
73
+ ];
74
+ appendSection(lines, "Widening culprits", diagnosis.wideningCulprits, formatCulprit);
75
+ appendSection(lines, "Coupling hotspots", diagnosis.couplingHotspots, formatHotspot);
76
+ appendSection(lines, "Fallback traps", diagnosis.fallbackTraps, formatTrap);
77
+ return `${lines.join("\n")}\n`;
78
+ }
79
+ function appendSection(lines, heading, items, formatItem) {
80
+ lines.push("");
81
+ if (items.length === 0) {
82
+ lines.push(`${heading}: none`);
83
+ return;
84
+ }
85
+ lines.push(`${heading} (${String(items.length)}):`);
86
+ for (const item of items) {
87
+ lines.push(` ${formatItem(item)}`);
88
+ lines.push(` fix [${item.remediation.safety}]: ${item.remediation.action}`);
89
+ lines.push(` caution: ${item.remediation.caution}`);
90
+ }
91
+ }
92
+ function formatCulprit(culprit) {
93
+ const location = formatLocation(culprit.path, culprit.line, culprit.column);
94
+ const scopeNote = culprit.scope === "workspace" ? " (worst-case workspace-wide)" : "";
95
+ return `${location} [${culprit.code}] -> widens ${plural(culprit.widenedTasks, "task")} / ${plural(culprit.widenedTestFiles, "test file")}${scopeNote}`;
96
+ }
97
+ function formatHotspot(hotspot) {
98
+ const typeNote = hotspot.typecheckReachedTestFiles > hotspot.reachedTestFiles
99
+ ? ` / ${String(hotspot.typecheckReachedTestFiles)} with types${hotspot.reachedTestFiles === 0 ? " (type-only)" : ""}`
100
+ : "";
101
+ return `${hotspot.path} -> reaches ${plural(hotspot.reachedTestFiles, "runtime test file")} (${String(hotspot.reachedTestPercent)}%)${typeNote} across ${plural(hotspot.reachedProjects, "project")}`;
102
+ }
103
+ function formatTrap(trap) {
104
+ const countText = plural(trap.fileCount, "file");
105
+ const sample = trap.samplePaths[0];
106
+ const detail = sample === undefined ? countText : `${countText}, e.g. ${sample}`;
107
+ return `[${trap.kind}] ${trap.prefix} (${detail})`;
108
+ }
109
+ function plural(count, singular, pluralForm = `${singular}s`) {
110
+ return `${String(count)} ${count === 1 ? singular : pluralForm}`;
111
+ }
112
+ function formatLocation(path, line, column) {
113
+ if (line === undefined)
114
+ return path;
115
+ if (column === undefined)
116
+ return `${path}:${String(line)}`;
117
+ return `${path}:${String(line)}:${String(column)}`;
118
+ }
119
+ //# sourceMappingURL=diagnose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnose.js","sourceRoot":"","sources":["../../src/commands/diagnose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,eAAe,GAAmC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAEhG;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAClC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;QAC5E,IAAI,IAAI,EAAE,CAAC;YACT,mBAAmB,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC;a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,UAAU,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,IAAa,EAAE,MAAe;IAClE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3D,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plan-run.d.ts","sourceRoot":"","sources":["../../src/commands/plan-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAuC,MAAM,mBAAmB,CAAC;AAiBtG,eAAO,MAAM,WAAW,EAAE,cASzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAcxB,CAAC;AA6CF,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,YAAY,GAAG,uBAAuB,CAexG"}
1
+ {"version":3,"file":"plan-run.d.ts","sourceRoot":"","sources":["../../src/commands/plan-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAuC,MAAM,mBAAmB,CAAC;AAwBtG,eAAO,MAAM,WAAW,EAAE,cASzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAcxB,CAAC;AA6CF,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,YAAY,GAAG,uBAAuB,CAmBxG"}
@@ -15,6 +15,12 @@ const operationOptions = [
15
15
  { name: "--jobs", kind: "value" },
16
16
  { name: "--report", kind: "optional-value" },
17
17
  ];
18
+ const runOptions = [
19
+ ...operationOptions,
20
+ { name: "--cache", kind: "flag" },
21
+ { name: "--no-cache", kind: "flag" },
22
+ { name: "--remote-cache", kind: "value" },
23
+ ];
18
24
  export const planCommand = {
19
25
  options: operationOptions,
20
26
  execute: async (parsed, io, json) => {
@@ -26,7 +32,7 @@ export const planCommand = {
26
32
  },
27
33
  };
28
34
  export const runCommand = {
29
- options: operationOptions,
35
+ options: runOptions,
30
36
  execute: async (parsed, io, json) => {
31
37
  const result = await runTesting(buildOperationRequest(parsed, io));
32
38
  const report = buildReportIfRequested(parsed, io, result.plan, result.run);
@@ -75,6 +81,8 @@ export function buildOperationRequest(parsed, io) {
75
81
  const base = parsed.values.get("--base");
76
82
  const head = parsed.values.get("--head");
77
83
  const jobs = parsed.values.get("--jobs");
84
+ const cacheEnabled = parsed.flags.has("--cache") && !parsed.flags.has("--no-cache");
85
+ const remoteCacheUrl = parsed.values.get("--remote-cache");
78
86
  return {
79
87
  workspaceRoot: io.cwd,
80
88
  ...(manifestPath === undefined ? {} : { manifestPath }),
@@ -83,6 +91,8 @@ export function buildOperationRequest(parsed, io) {
83
91
  all: parsed.flags.has("--all"),
84
92
  taskIds: parsed.repeated.get("--task") ?? [],
85
93
  ...(jobs === undefined ? {} : { jobs: readPositiveInteger(jobs, "--jobs") }),
94
+ ...(cacheEnabled ? { cache: true } : {}),
95
+ ...(remoteCacheUrl === undefined ? {} : { remoteCacheUrl }),
86
96
  ...(io.nativeBinary === undefined ? {} : { nativeBinary: io.nativeBinary }),
87
97
  };
88
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plan-run.js","sourceRoot":"","sources":["../../src/commands/plan-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM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"}
@@ -1 +1 @@
1
- {"version":3,"file":"dad-test-cli.d.ts","sourceRoot":"","sources":["../src/dad-test-cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAK/E;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjG,CAAC;AAWF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,SAAS;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,EAAE,CAMF;AAED,gEAAgE;AAChE,wBAAsB,aAAa,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlH"}
1
+ {"version":3,"file":"dad-test-cli.d.ts","sourceRoot":"","sources":["../src/dad-test-cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM/E;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjG,CAAC;AA4BF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,SAAS;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,EAAE,CAMF;AAED,gEAAgE;AAChE,wBAAsB,aAAa,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlH"}
@@ -1,12 +1,29 @@
1
1
  import { parseCommandOptions } from "./cli-arguments.js";
2
+ import { diagnoseCommand } from "./commands/diagnose.js";
2
3
  import { explainCommand } from "./commands/explain.js";
3
4
  import { initCommand } from "./commands/init.js";
4
5
  import { planCommand, runCommand } from "./commands/plan-run.js";
5
- const usage = "Usage: dad-test plan|run|explain|init [options] [--json]. See the package README for each option.\n";
6
+ const usage = [
7
+ "Usage: dad-test <plan|run|explain|diagnose|init> [options] [--json]",
8
+ "",
9
+ "Commands:",
10
+ " plan Compute affected tasks without running them (--base, --head, --all, --task, --manifest)",
11
+ " run Execute affected tasks (--base, --head, --all, --task, --jobs, --cache, --remote-cache, --report)",
12
+ " explain Show why each task ran or was skipped with located evidence (--base, --head, --all, --task)",
13
+ " diagnose Coupling & precision X-ray with widening culprits and fixes (auto-detects Nx workspaces)",
14
+ " init Generate dads.testing.json for npm/pnpm/yarn workspaces (--manifest, --force)",
15
+ "",
16
+ "Options:",
17
+ " --json Emit versioned machine-readable JSON output",
18
+ " --help Show this help message",
19
+ "",
20
+ "Nx workspaces: use 'dad-test-nx plan|run|diagnose' (or 'dad-test diagnose').",
21
+ ].join("\n") + "\n";
6
22
  const commands = new Map([
7
23
  ["plan", planCommand],
8
24
  ["run", runCommand],
9
25
  ["explain", explainCommand],
26
+ ["diagnose", diagnoseCommand],
10
27
  ["init", initCommand],
11
28
  ]);
12
29
  /**
@@ -30,13 +47,13 @@ export async function runDadTestCli(argumentsAfterExecutable, io) {
30
47
  const json = argumentsAfterExecutable.includes("--json");
31
48
  try {
32
49
  const operation = argumentsAfterExecutable[0];
33
- if (operation === "--help" || operation === "help") {
50
+ if (operation === "--help" || operation === "-h" || operation === "help") {
34
51
  io.stdout(usage);
35
52
  return 0;
36
53
  }
37
54
  const command = operation === undefined ? undefined : commands.get(operation);
38
55
  if (command === undefined) {
39
- throw new Error("Expected operation plan, run, explain, or init.");
56
+ throw new Error("Expected operation plan, run, explain, diagnose, or init.");
40
57
  }
41
58
  const parsed = parseCommandOptions(argumentsAfterExecutable.slice(1), command.options);
42
59
  return await command.execute(parsed, io, json);
@@ -1 +1 @@
1
- {"version":3,"file":"dad-test-cli.js","sourceRoot":"","sources":["../src/dad-test-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,O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AE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,MAAM,OAAO,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9E,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACvF,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC;QAC5E,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,OAAO,IAAI,CAAC,CAAC;QACpH,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { SimWorld } from "./sim-world.js";
2
+ /**
3
+ * Fault-injecting adapters for at-least-once job/webhook delivery (duplicates,
4
+ * reordering, delays, drops) and SSE live streams with mid-stream revocation.
5
+ */
6
+ export type DeliveryEnvelope<Payload> = {
7
+ readonly messageId: string;
8
+ readonly deliveryNumber: number;
9
+ readonly enqueuedAtMs: number;
10
+ readonly deliverAtMs: number;
11
+ readonly payload: Payload;
12
+ };
13
+ export type FaultyDeliveryOptions = {
14
+ /** Probability that an enqueued message is scheduled twice. Defaults to `0.25`. */
15
+ readonly duplicateRate?: number;
16
+ /** Probability that a queued message is dropped before delivery. Defaults to `0.05`. */
17
+ readonly dropRate?: number;
18
+ /** Probability that two ready messages are delivered out of order. Defaults to `0.3`. */
19
+ readonly reorderRate?: number;
20
+ /** Maximum simulated delivery jitter in milliseconds. Defaults to `500`. */
21
+ readonly maxDelayMs?: number;
22
+ };
23
+ export type FaultyDeliveryStats = {
24
+ readonly enqueued: number;
25
+ readonly duplicatesInjected: number;
26
+ readonly dropped: number;
27
+ readonly delivered: number;
28
+ readonly pending: number;
29
+ };
30
+ export type FaultyDeliveryQueue<Payload> = {
31
+ enqueue(payload: Payload, messageId?: string): string;
32
+ /** Delivers one due message (possibly reordered); returns undefined if none is due. */
33
+ deliverNext(handler: (envelope: DeliveryEnvelope<Payload>) => void | Promise<void>): Promise<boolean>;
34
+ /** Advances the clock as needed and drains all queued messages through `handler`. */
35
+ drainAll(handler: (envelope: DeliveryEnvelope<Payload>) => void | Promise<void>): Promise<number>;
36
+ pendingCount(): number;
37
+ stats(): FaultyDeliveryStats;
38
+ };
39
+ export declare function createFaultyDeliveryQueue<Payload>(world: SimWorld, options?: FaultyDeliveryOptions): FaultyDeliveryQueue<Payload>;
40
+ export type StreamSubscriber<Event> = {
41
+ readonly id: string;
42
+ readonly received: readonly Event[];
43
+ readonly revoked: boolean;
44
+ readonly closed: boolean;
45
+ revoke(): void;
46
+ disconnect(): void;
47
+ reconnect(fromCursor?: number): boolean;
48
+ };
49
+ export type FaultyEventStream<Event> = {
50
+ subscribe(id?: string): StreamSubscriber<Event>;
51
+ publish(event: Event): number;
52
+ readonly publishedCount: number;
53
+ };
54
+ /**
55
+ * Deterministic SSE / live-channel stream simulator with mid-stream access
56
+ * revocation, transient disconnects, and cursor-based reconnects. Once revoked,
57
+ * a subscriber is closed permanently and can never reconnect or receive events.
58
+ */
59
+ export declare function createFaultyEventStream<Event>(world: SimWorld): Faulty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