@perrylink/dsh-test-kit 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,70 @@
1
+ # Changelog — dsh-test-kit
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ First implementation of the standalone kit. The source now lives in its own
6
+ repository, `PerryLink/dsh-test-kit`. **Not published and not tagged**; npm
7
+ publication and release tags require explicit owner approval.
8
+
9
+ ### Added
10
+
11
+ - `dsh-test-kit run <target>`: drives `github:`, `git+https`, `npm:`, local
12
+ path, and `.tgz` targets through the extracted `dsh-test-drive` engine
13
+ (install → patch check → boot smoke → uninstall → cleanup) in a throwaway
14
+ `DSH_HOME`, and writes the frozen `schema: "dsh-test-drive/v1"` JSON record.
15
+ - `dsh-test-kit render --input <json> --out-dir <dir>`: validates the record and
16
+ emits Markdown (PR comment) and JUnit XML; rejects placeholder/invalid JSON.
17
+ - `node:child_process` subprocess adapter (`src/subprocess.ts`) implementing the
18
+ engine's subprocess seam outside DSH: PATH/PATHEXT resolution, scrubbed
19
+ parent env, tail-bounded collected output, abort → tree termination.
20
+ - Composite `action.yml`: install/build kit → run with `--no-fail` → render →
21
+ enforce `pass` (with `fail`/`unknown` always failing, `partial` opt-in).
22
+ - Standalone extraction: `src/core/` (10 engine modules) lives in this
23
+ repository; imports are package-relative (`./core/...`), with no monorepo
24
+ path or `@deepseek-ai/*` runtime dependency. CLI/subprocess tests moved to
25
+ `tests/` and run with plain `npm test`.
26
+ - `.github/workflows/ci.yml`: Ubuntu/Windows on Node 22 and 24, a dedicated
27
+ `macos-latest` job (Node 24), and a composite-action end-to-end job.
28
+ - Exit codes by verdict: 0 pass, 1 fail, 2 partial, 3 unknown.
29
+
30
+ ### Fixed in P0 verification
31
+
32
+ - **Boot verdicts are honest.** `pass` now requires `smoke.status=pass` with exit 0 (or an explicitly skipped smoke from an empty task). `boot-ok` (non-zero exit) is `partial`, and `Cannot find module` / `Cannot find package` / `ERR_MODULE_NOT_FOUND` are boot-failure markers → `fail`. The `dsh-todo@0.1.0` real boot crash is no longer reported as pass.
33
+ - **Published package is self-contained.** A clean standalone checkout resolved `zod` from outside the package and emitted a 105 KB externalized bundle. The build now aliases `zod` via `import.meta.resolve`, `verify-build.mjs` fails the build unless zod is bundled, and `zod` is also declared as a dependency. `npm pack` + bare install runs.
34
+ - **Empty headless-task no longer defaults to partial.** The action's default (empty task → `--no-smoke`) yields `pass` from install/patch/uninstall; only an explicit config skip is accepted as a pass.
35
+ - **Empty/unknown matrices are failures.** Empty matrix → `unknown`, with a synthetic JUnit `empty-matrix` failure; `unknown` rows and the overall drive verdict are counted as JUnit failures.
36
+ - **CI gates** now build/typecheck/test/verify/pack the kit and run the composite action against a scripted `dsh` (default empty task must pass).
37
+
38
+ ### Fixed in P2 verification
39
+
40
+ - **`render` cannot publish a green report over failed stages.** A record that
41
+ claims `verdict: pass` while its own stages say `fail` now renders the
42
+ stage-derived verdict (including a corrected `verdictReason`) and exits `1`
43
+ instead of `0`. Contradictions with partial/inconclusive evidence exit `2`/`3`
44
+ respectively. Regression test: `tests/cli.spec.ts` forges `pass` over a failed
45
+ install and asserts exit `1` plus a `fail` report.
46
+ - **Windows JS/ESM `--dsh` entries run.** A `.js`/`.mjs`/`.cjs` executable is
47
+ launched through `node` on Windows (direct `CreateProcess` fails with
48
+ `EFTYPE`), so the scripted test dsh and JS-entry deployments work there.
49
+ Aborted runs settle with `exitCode: null` on Windows too (the `taskkill /F`
50
+ path used to surface exit `1`).
51
+ - **Cross-platform test suite is green locally.** `npm test` passes 30/30 on
52
+ Linux and on Windows (Node 24); macOS is covered by the `macos-latest` CI
53
+ job because no macOS hardware was available for the extraction.
54
+
55
+ ### Changed in the shared engine
56
+
57
+ - Engine modules moved to `src/core/` and re-exported from their original
58
+ paths, so the existing `dsh-test-drive` public API and tests remain valid.
59
+ - The subprocess seam is structural (`DriverSubprocessService`) instead of a
60
+ `@deepseek-ai/*` type, and `resolveConfig` no longer imports Schemastery;
61
+ the plugin still exports the loader-facing Schemastery `Config` schema.
62
+ - `classifyTarget` recognizes the explicit `npm:` registry form and the drive
63
+ strips the marker before `dsh plugin add`.
64
+
65
+ ### Not done (needs owner approval or a later release)
66
+
67
+ - npm publish, git tag, GitHub release, announcements (owner action).
68
+ - Batch/matrix CLI, multi-target runs, capability-credential automation.
69
+ - macOS was not available on the extraction host; the `macos-latest` CI job is
70
+ the verification path.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,317 @@
1
- # Temporary Holding Version
1
+ # dsh-test-kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![ci](https://github.com/PerryLink/dsh-test-kit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/PerryLink/dsh-test-kit/actions/workflows/ci.yml)
4
+
5
+ **Run a DeepSeek Harness plugin's install-and-smoke check outside DeepSeek Harness.**
6
+
7
+ `dsh-test-kit` is the standalone home of the extracted `dsh-test-drive` engine.
8
+ It installs a target into a throwaway `DSH_HOME` profile, verifies that the
9
+ bundle patch layer actually mounted, runs a keyless boot smoke, uninstalls the
10
+ package, cleans up every directory it owns, and writes the frozen
11
+ `dsh-test-drive/v1` JSON record plus Markdown and JUnit reports.
12
+
13
+ This repository is self-contained: `src/core/` lives here, no monorepo checkout,
14
+ no `@deepseek-ai/*` runtime import, and no DSH host process are required. The
15
+ only things a drive needs are the `dsh` CLI, pnpm, and network access for the
16
+ throwaway profile's install.
17
+
18
+ - **Starts with plain Node.** The CLI bundles `zod`; a clean checkout boots with
19
+ `node lib/cli.js --version`.
20
+ - **Never reports success for unknown output.** Missing or invalid JSON is
21
+ rejected; `fail`, `partial`, and `unknown` all have non-zero exit codes.
22
+ - **`boot-ok` is not `pass`.** A non-zero boot without loader-failure markers is
23
+ `partial`; `pass` requires a real boot (`smoke.status=pass`, exit 0) or an
24
+ explicitly skipped smoke.
25
+ - **Isolation by construction.** Throwaway `DSH_HOME`, throwaway cwd, redirected
26
+ pnpm store; the host profile is never read or written.
27
+ - **Sanitized reports.** Token literals, URL credentials, bearer headers, and
28
+ temp paths are redacted before any string reaches a report.
29
+
30
+ ## Status
31
+
32
+ - **Source of truth:** this repository. The package was extracted from the
33
+ `dsh-test-drive` monorepo into a self-contained `src/` + `src/core/` tree.
34
+ - **npm:** not published by this repository yet. Publication is handled by the
35
+ owner; until then, build from source or use the GitHub Action.
36
+ - **Schema:** frozen at `schema: "dsh-test-drive/v1"`. The kit does not add
37
+ fields, so existing scorers and dashboards keep working.
38
+ - **macOS:** verified in GitHub-hosted CI (`macos-latest`, Node 24). The
39
+ extraction host has no macOS hardware, so the local macOS run is **BLOCKED**;
40
+ the `macos-latest` Actions job is the authoritative macOS result.
41
+
42
+ ## Requirements
43
+
44
+ | Requirement | Notes |
45
+ |---|---|
46
+ | Node.js | `^22.19.0` or `>=24.9.0` |
47
+ | `dsh` CLI | any 0.2.x build that provides `plugin add` and `--dump-config`; pass `--dsh <path>` or put `dsh` on `PATH` |
48
+ | Network | only for the throwaway profile's pnpm install |
49
+ | pnpm | the `dsh plugin` manager uses its own pnpm; a working registry is required |
50
+
51
+ ## Install
52
+
53
+ Once the owner publishes the package:
54
+
55
+ ```sh
56
+ npm install -g @perrylink/dsh-test-kit
57
+ dsh-test-kit --version
58
+ ```
59
+
60
+ Until then, build the standalone checkout:
61
+
62
+ ```sh
63
+ git clone https://github.com/PerryLink/dsh-test-kit.git
64
+ cd dsh-test-kit
65
+ npm ci
66
+ npm run build
67
+ node lib/cli.js --version
68
+ ```
69
+
70
+ `lib/cli.js` is a single self-contained ESM entry (zod bundled); the build fails
71
+ if zod is externalized or the frozen schema string is missing.
72
+
73
+ ## Quick start
74
+
75
+ ```sh
76
+ # A GitHub ref (the checkout/pack path plugin authors actually ship)
77
+ dsh-test-kit run github:owner/repo#<sha> --dsh /path/to/dsh --json out.json
78
+
79
+ # A published plugin
80
+ dsh-test-kit run npm:dsh-score@0.2.28 --dsh /path/to/dsh --json out.json
81
+
82
+ # A local checkout or tarball
83
+ dsh-test-kit run ./my-plugin --json out.json
84
+ dsh-test-kit run ./my-plugin.tgz --json out.json
85
+
86
+ # Render the CI report pair from the settled record
87
+ dsh-test-kit render --input out.json --out-dir reports
88
+ ```
89
+
90
+ `render` writes `reports/out.md` (PR comment body) and
91
+ `reports/out.junit.xml` (test reporter input), then prints one JSON line with
92
+ the absolute paths and the verdict.
93
+
94
+ ## Targets
95
+
96
+ | Form | Example | Notes |
97
+ |---|---|---|
98
+ | GitHub ref | `github:owner/repo#<sha>` | passed to `dsh plugin add` |
99
+ | git URL | `git+https://host/repo.git#ref` | any pnpm-supported git spec |
100
+ | npm registry | `npm:name`, `npm:@scope/name@1.2.3` | the `npm:` marker is stripped before install |
101
+ | local path | `./plugin`, `/abs/plugin` | anchored at the invoking directory |
102
+ | tarball | `./plugin.tgz` | packed plugin |
103
+
104
+ ## The result record
105
+
106
+ ```json
107
+ {
108
+ "schema": "dsh-test-drive/v1",
109
+ "run": { "runId": "tdr_…", "harnessVersion": "0.2.2-rc.3", "pluginVersion": "0.1.0", "…": "…" },
110
+ "target": { "kind": "npm", "spec": "dsh-score@0.2.28", "resolved": { "packageName": "dsh-score", "packageVersion": "0.2.28", "hasBundleManifest": true } },
111
+ "stages": {
112
+ "install": { "status": "pass", "…": "…" },
113
+ "config": { "status": "pass", "patchEffective": true, "layers": ["dsh-score"], "…": "…" },
114
+ "smoke": { "status": "boot-ok", "bootFailed": false, "taskCompleted": false, "…": "…" },
115
+ "uninstall": { "status": "pass", "…": "…" },
116
+ "cleanup": { "status": "pass", "quarantined": true, "removed": true, "…": "…" }
117
+ },
118
+ "verdict": "partial",
119
+ "verdictReason": "install, patch, and uninstall verified; boot smoke exited 1 without loader-failure markers, so a successful boot is not proven"
120
+ }
121
+ ```
122
+
123
+ `verdict=pass` requires `smoke.status=pass` with exit 0, or an explicitly
124
+ skipped smoke. A non-zero boot (`boot-ok`) is **always** `partial`. An empty
125
+ matrix is `unknown`, never `pass`.
126
+
127
+ ### Verdicts
128
+
129
+ | Verdict | Meaning | `run` exit code |
130
+ |---|---|---|
131
+ | `pass` | install, patch layer, and uninstall verified, plus either a real boot (`smoke.pass` with exit 0) or an explicitly skipped smoke (empty task / `--no-smoke`) | 0 |
132
+ | `fail` | install failed, boot found loader failures (including `Cannot find module`), or a capability assertion failed | 1 |
133
+ | `partial` | install passed but the patch/boot/uninstall could not be fully verified; `boot-ok` (non-zero exit) is always here | 2 |
134
+ | `unknown` | the stage combination has no conclusive rule (typically install never ran) | 3 |
135
+
136
+ ## `render` integrity rules (P2 fix)
137
+
138
+ `render` re-folds the verdict from the record's own stages before writing a
139
+ report. A record that **claims `pass` while its stages say otherwise** is never
140
+ rendered as green:
141
+
142
+ - any failed stage (`install`, `config`, `smoke`, `capability`, `uninstall`, or
143
+ `cleanup`) → report shows the stage-derived `fail`, exit **1**;
144
+ - partial evidence such as `patchEffective: false` → report shows `partial`,
145
+ exit **2**;
146
+ - inconclusive evidence → `unknown`, exit **3**.
147
+
148
+ Exit codes for `render` are therefore:
149
+
150
+ | Code | Meaning |
151
+ |---|---|
152
+ | `0` | reports written from a consistent record |
153
+ | `1` | record claimed `pass` but a stage is `fail` |
154
+ | `2` | record claimed `pass` but the stage evidence is `partial` |
155
+ | `3` | record claimed `pass` but the stage evidence is inconclusive |
156
+ | `64` | usage error |
157
+ | `65` | input is not a `dsh-test-drive/v1` record (including placeholder JSON) |
158
+
159
+ Placeholder JSON such as `{"note":"replace this step"}` is **rejected**, never
160
+ rendered as a success.
161
+
162
+ ### What the stages actually check
163
+
164
+ 1. **install** — `dsh plugin --profile <name> add <target>` in the throwaway
165
+ home. A pnpm `allowBuilds` gate hit on a git source is allowlisted and
166
+ retried once.
167
+ 2. **config** — `dsh --profile <name> --dump-config`; the installed package must
168
+ appear as a layer or a row. Install success alone is not enough.
169
+ 3. **smoke** — one headless invocation. Exit 0 with no loader-failure markers
170
+ is `pass`; a non-zero exit **is not a verified boot** and yields `boot-ok`
171
+ → verdict `partial`; loader/module failures (`Cannot find module` etc.) make
172
+ it `fail`. An empty task skips the stage entirely (install/patch/uninstall
173
+ still yield `pass`).
174
+ 4. **capability** (optional) — prove one named tool/command is registered,
175
+ invoked, and observed in the durable session log. Needs a model credential
176
+ forwarded explicitly; otherwise the stage is `skipped`, not failed.
177
+ 5. **uninstall / cleanup** — remove the package and always run the owned
178
+ quarantine → delete ladder, including on abort and pipeline errors.
179
+
180
+ ## GitHub Action
181
+
182
+ The action lives at the repository root; reference `@main` until a release tag
183
+ exists:
184
+
185
+ ```yaml
186
+ name: test-drive
187
+ on: [pull_request, workflow_dispatch]
188
+ jobs:
189
+ smoke:
190
+ runs-on: ubuntu-latest
191
+ steps:
192
+ - uses: actions/checkout@v4
193
+ - name: Install the dsh CLI (or use your own cache)
194
+ run: npm install -g @deepseek-ai/dsh@0.2.2-rc.3
195
+ - name: Drive this plugin
196
+ id: drive
197
+ uses: PerryLink/dsh-test-kit@main
198
+ with:
199
+ target: github:${{ github.repository }}#${{ github.sha }}
200
+ # Optional: headless-task: 'Reply with exactly: ok'
201
+ # Optional: dsh: /usr/local/bin/dsh
202
+ - name: Publish JUnit
203
+ uses: EnricoMi/publish-unit-test-result-action@v2
204
+ with:
205
+ files: ${{ steps.drive.outputs.junit }}
206
+ - name: Comment the report
207
+ run: cat "${{ steps.drive.outputs.markdown }}"
208
+ ```
209
+
210
+ | Input | Default | Purpose |
211
+ |---|---|---|
212
+ | `target` | — (required) | same target forms as the CLI |
213
+ | `headless-task` | `''` | empty skips the smoke stage |
214
+ | `dsh` | `dsh` | absolute path, bare command, or `npm:<pkg>@<version>` |
215
+ | `node-version` | `24` | Node used by the kit |
216
+ | `kit-version` | `latest` | only used when the checkout has no local kit |
217
+ | `allow-partial` | `false` | `partial` passes only when explicitly allowed |
218
+
219
+ Outputs: `markdown`, `junit`, `verdict`, `result`.
220
+
221
+ The action installs/builds the kit, runs the drive with `--no-fail`, validates
222
+ and renders the record, then **fails the job on `fail` or `unknown`** (and on
223
+ `partial` unless `allow-partial: true`). It never substitutes a placeholder
224
+ result.
225
+
226
+ ## Security model
227
+
228
+ - **Owned temp roots only.** Every directory is created with `mkdtemp` under the
229
+ OS temp dir with the `dsh-test-drive-` prefix, registered, and removed through
230
+ the dry-run → quarantine-rename → delete ladder. `assertOwned` refuses
231
+ anything else.
232
+ - **Throwaway profile.** The child gets `DSH_HOME=<owned root>/home`, a
233
+ throwaway cwd, and `npm_config_store_dir=<owned root>/store`. The real
234
+ `~/.dsh` is never read or written; the record asserts
235
+ `isolation.hostHomeTouched: false`.
236
+ - **No implicit secrets.** The adapter starts from the parent environment minus
237
+ credential-shaped names (`/KEY|PASSWORD|SECRET|TOKEN/i`) and all `DSH_*`
238
+ names; only values named with `--forward-env` survive.
239
+ - **Sanitized output.** Every report string passes the engine sanitizers; stage
240
+ output is byte-capped and temp paths are redacted.
241
+
242
+ ## Source layout
243
+
244
+ ```
245
+ src/core/ self-contained engine (10 modules)
246
+ config.ts defaults + fail-loud resolveConfig (no Schemastery)
247
+ driver.ts dsh location, argv-only spawning, allowBuilds, dump parsing
248
+ drive.ts install → config → smoke → capability → uninstall → cleanup
249
+ result.ts frozen zod schema + verdictOf
250
+ report.ts Markdown + JUnit renderers
251
+ workspace.ts owned temp roots, quarantine ladder
252
+ capability.ts session-log capability analyzer
253
+ session-log.ts multi-frame zstd session reader
254
+ sanitize.ts secret/temp-path redaction
255
+ version.ts engine version
256
+
257
+ src/cli.ts run / render, argument parsing, exit codes
258
+ src/subprocess.ts node:child_process adapter for the engine seam
259
+ action.yml composite GitHub Action
260
+ lib/cli.js built single-file bundle (committed so the Action needs no build)
261
+ tests/ CLI + subprocess specs and the scripted fake dsh
262
+ ```
263
+
264
+ Dependency direction is one-way: the CLI imports the engine, the engine imports
265
+ nothing from DSH (type-only seams live in `driver.ts`), and only
266
+ `subprocess.ts` starts processes. That is what makes `dsh-test-kit run` startable
267
+ with plain Node.
268
+
269
+ ## Development
270
+
271
+ ```sh
272
+ npm ci
273
+ npm run typecheck # tsc --noEmit over src/ and tests/
274
+ npm test # vitest: CLI + subprocess specs
275
+ npm run build # tsdown bundle + self-contained bundle guard
276
+ npm run verify # verify lib/cli.js bundles zod and the frozen schema
277
+ node lib/cli.js run npm:dsh-score@0.2.28 --json /tmp/out.json
278
+ node lib/cli.js render --input /tmp/out.json --out-dir /tmp/reports
279
+ ```
280
+
281
+ The tests use a scripted `dsh` (`tests/fixtures/fake-dsh.mjs`), so the full
282
+ run → JSON → render loop is exercised without a network install. The P2
283
+ regression test forges `verdict: pass` over a failed install and asserts
284
+ `render` exits `1` and writes a `fail` report.
285
+
286
+ ## CI
287
+
288
+ `.github/workflows/ci.yml` runs `npm ci`, typecheck, tests, build, and
289
+ `node lib/cli.js --version` on:
290
+
291
+ | Job | Runner | Node |
292
+ |---|---|---|
293
+ | `test` | `ubuntu-latest`, `windows-latest` | 22, 24 |
294
+ | `macos` | `macos-latest` | 24 |
295
+ | `action` | `ubuntu-latest` | 24 |
296
+
297
+ The `action` job runs this repository's composite action end-to-end against the
298
+ scripted `dsh` and asserts a `pass` verdict. The `macos` job exists because the
299
+ extraction host has no macOS hardware (local macOS run: BLOCKED); CI is the
300
+ authoritative macOS check.
301
+
302
+ ## v0.1 limits
303
+
304
+ - One target per `run`; batch matrices are still a plugin-only feature
305
+ (`/testdrive` + `drive-batch`).
306
+ - The smoke stage is keyless by default; forwarding a model credential is
307
+ always an explicit `--forward-env` decision.
308
+ - Windows: the adapter refuses to spawn `.cmd`/`.bat`/`.ps1` shims directly (no
309
+ shell). Pass a `.exe`, or a JS/ESM entry (`.js`/`.mjs`/`.cjs`) — JS entries are
310
+ launched through `node`.
311
+ - `--dsh npm:<pkg>@<version>` uses `npm exec --package=… -- dsh`; npm must be
312
+ resolvable as a JS entry (the adapter locates `npm-cli.js`).
313
+ - No git tag or npm release is created by this repository yet.
314
+
315
+ ## License
316
+
317
+ Apache-2.0. The bundled `zod` is MIT; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,23 @@
1
+ # Third-party notices — dsh-test-kit
2
+
3
+ `dsh-test-kit` is Apache-2.0. Its source is derived from the `dsh-test-drive`
4
+ engine (same author, Apache-2.0).
5
+
6
+ ## Bundled at build time
7
+
8
+ The published `lib/cli.js` bundles the following package so the CLI has no
9
+ runtime npm dependencies:
10
+
11
+ | Package | Version | License | Use |
12
+ |---|---|---|---|
13
+ | [`zod`](https://github.com/colinhacks/zod) | 4.6.6 | MIT | frozen result-schema validation |
14
+
15
+ The MIT notice of `zod` is reproduced by the package's own `LICENSE` file in
16
+ the npm tarball of `zod`; its copyright notice is:
17
+
18
+ ```
19
+ Copyright (c) 2020 Colin Hacks
20
+ ```
21
+
22
+ No other third-party code is bundled. `node:child_process`, `node:fs`,
23
+ `node:path`, and the other `node:` builtins are part of Node.js.