@intentsolutions/audit-harness 0.1.0 → 1.1.6

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/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Jeremy Longshore / Intent Solutions
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,15 @@
1
+ @intentsolutions/audit-harness
2
+ Copyright 2026 Jeremy Longshore / Intent Solutions
3
+
4
+ This product includes software developed by
5
+ Jeremy Longshore (https://intentsolutions.io).
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @intentsolutions/audit-harness
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@intentsolutions/audit-harness?color=cb3837&logo=npm)](https://www.npmjs.com/package/@intentsolutions/audit-harness)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
5
+ [![Provenance](https://img.shields.io/badge/sigstore-provenance-066da5)](https://www.npmjs.com/package/@intentsolutions/audit-harness)
6
+
7
+ Part of the **[Intent Eval Platform](https://github.com/intent-solutions-io/intent-eval-platform)** — the umbrella mapping the six repos that converge via a shared Evidence Bundle schema.
8
+
3
9
  Deterministic test-enforcement toolkit. Companion to the `audit-tests` and `implement-tests` Claude Code skills — but usable standalone in any repo that wants hash-pinned, escape-scanned, AI-proof quality gates.
4
10
 
5
11
  ## What it is
@@ -19,12 +25,36 @@ A small CLI wrapping 6 deterministic scripts:
19
25
 
20
26
  ## Install
21
27
 
28
+ Pick the install flavor that matches your repo's ecosystem — all three publish the same CLI surface.
29
+
30
+ **Node / JS / TS** (from npm):
31
+
22
32
  ```bash
23
33
  pnpm add -D @intentsolutions/audit-harness
24
34
  # or: npm install --save-dev @intentsolutions/audit-harness
25
35
  # or: yarn add --dev @intentsolutions/audit-harness
26
36
  ```
27
37
 
38
+ **Python** (from PyPI):
39
+
40
+ ```bash
41
+ pip install intent-audit-harness
42
+ # or inside a project venv:
43
+ python -m pip install intent-audit-harness
44
+ ```
45
+
46
+ **Rust** (from crates.io):
47
+
48
+ ```bash
49
+ cargo install intent-audit-harness
50
+ ```
51
+
52
+ **Any other language** (Go, Ruby, PHP, Java, .NET, shell, etc.) — vendor the scripts:
53
+
54
+ ```bash
55
+ curl -sSL https://raw.githubusercontent.com/jeremylongshore/intent-audit-harness/main/install.sh | bash
56
+ ```
57
+
28
58
  ## Quick usage
29
59
 
30
60
  ### Pre-commit hook (`.husky/pre-commit`)
@@ -75,7 +105,7 @@ See `audit-tests/references/philosophy.md` in the companion skill for the full r
75
105
 
76
106
  This harness sits inside a larger framework:
77
107
 
78
- ```
108
+ ```text
79
109
  L7 Acceptance / RTM / Personas / Journeys ← WHAT are we proving?
80
110
  L6 E2E / BDD / Visual regression ← User-level guarantees
81
111
  L5 Perf / Security (SAST/DAST) / A11y / Chaos ← Non-functional
@@ -115,12 +145,14 @@ Most scripts are language-agnostic (shell + regex). CRAP has per-language backen
115
145
 
116
146
  ## License
117
147
 
118
- MIT — see [LICENSE](./LICENSE).
148
+ Apache 2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
149
+
150
+ **Note:** versions `0.x` shipped under the MIT license. Starting with `v1.0.0`, the project is licensed under Apache 2.0. Existing `0.x` releases on npm remain available under their original MIT terms; new releases (`>= 1.0.0`) are Apache 2.0.
119
151
 
120
152
  ## Related
121
153
 
122
- - [`audit-tests` Claude Code skill](https://github.com/jeremylongshore/audit-harness#related) — diagnostic pipeline that uses this harness
123
- - [`implement-tests` Claude Code skill](https://github.com/jeremylongshore/audit-harness#related) — filesystem-mutating installer that installs this harness as part of L1/L3 setup
154
+ - [`audit-tests` Claude Code skill](https://github.com/jeremylongshore/intent-audit-harness#related) — diagnostic pipeline that uses this harness
155
+ - [`implement-tests` Claude Code skill](https://github.com/jeremylongshore/intent-audit-harness#related) — filesystem-mutating installer that installs this harness as part of L1/L3 setup
124
156
 
125
157
  ## Versioning
126
158
 
@@ -13,16 +13,31 @@ const { existsSync } = require('node:fs');
13
13
  const SCRIPTS = resolve(__dirname, '..', 'scripts');
14
14
 
15
15
  const COMMANDS = {
16
- 'verify': { script: 'harness-hash.sh', args: ['--verify'] },
17
- 'init': { script: 'harness-hash.sh', args: ['--init'] },
18
- 'list': { script: 'harness-hash.sh', args: ['--list'] },
19
- 'escape-scan': { script: 'escape-scan.sh', args: [] },
20
- 'arch': { script: 'arch-check.sh', args: [] },
21
- 'bias': { script: 'bias-count.sh', args: [] },
22
- 'gherkin-lint': { script: 'gherkin-lint.sh', args: [] },
23
- 'crap': { script: 'crap-score.py', args: [] },
16
+ 'verify': { script: 'harness-hash.sh', args: ['--verify'] },
17
+ 'init': { script: 'harness-hash.sh', args: ['--init'] },
18
+ 'list': { script: 'harness-hash.sh', args: ['--list'] },
19
+ 'escape-scan': { script: 'escape-scan.sh', args: [] },
20
+ 'arch': { script: 'arch-check.sh', args: [] },
21
+ 'bias': { script: 'bias-count.sh', args: [] },
22
+ 'gherkin-lint': { script: 'gherkin-lint.sh', args: [] },
23
+ 'crap': { script: 'crap-score.py', args: [] },
24
+ 'emit-evidence': { script: 'emit-evidence.sh', args: [] },
25
+ 'classify': { script: 'classify.py', args: [] },
26
+ 'conform': { script: 'conform.py', args: [] },
27
+ 'audit': { script: 'audit.py', args: [] },
28
+ 'scan': { script: 'scan.py', args: [] },
29
+ 'fp-rate': { script: 'fp-rate.py', args: [] },
30
+ 'currency': { script: 'currency.py', args: [] },
31
+ 'gen-layer-applicability': { script: 'gen-layer-applicability.py', args: [] },
24
32
  };
25
33
 
34
+ // Gate commands that may be no-op'd by the AUDIT_HARNESS_DISABLE kill-switch.
35
+ // classify is intentionally NOT here: it emits a meaningful kill-switched profile
36
+ // itself (every gate enforcement=disabled). verify/init/list always run.
37
+ const KILLABLE_GATES = new Set([
38
+ 'escape-scan', 'arch', 'bias', 'gherkin-lint', 'crap', 'emit-evidence',
39
+ ]);
40
+
26
41
  function usage() {
27
42
  console.log(`audit-harness — deterministic test-enforcement toolkit
28
43
 
@@ -39,6 +54,63 @@ Commands:
39
54
  bias Count test-bias patterns (tautology, smoke-only, etc.)
40
55
  gherkin-lint Advisory Gherkin quality check
41
56
  crap [args...] CRAP complexity × coverage scorer (multi-language)
57
+ classify [repo] Read-only repository classifier. Emits an audit-profile/v1
58
+ value (JSON, stdout) describing the UNION of detected
59
+ classifications + the resolved gate set. Never writes.
60
+ conform [repo] Read-only conformance gate-runner. Validates each repo
61
+ artifact (SKILL.md, .mcp.json, plugin/agent ...) against a
62
+ content-addressed schema BUNDLED in this harness version
63
+ and emits gate-result/v1 rows (JSON array, stdout). Never
64
+ writes, never live-fetches. Advisory by default; --strict
65
+ turns any conformance violation into FAIL (exit 1).
66
+ OpenAPI -> spectral, Action -> yamllint (missing tool =
67
+ INDETERMINATE advisory).
68
+ audit [repo] Read-only testing-depth gate-runner. For each
69
+ testing-depth gate in the profile, reports coverage
70
+ PRESENCE per pyramid layer (unit/integration/e2e/perf/
71
+ fuzz/...) + runs crap-score. Emits gate-result/v1 rows.
72
+ --fast (default) presence only; --deep adds crap-score;
73
+ --strict turns a gap into FAIL. Does NOT execute the
74
+ repo's test suite — execution stays in the repo's CI.
75
+ scan [repo] Read-only security/hygiene/skill-quality gate-runner.
76
+ hygiene-readme is a local presence check; every tool-
77
+ backed gate (gitleaks/osv-scanner/semgrep/syft/
78
+ markdownlint/lychee) shells out (clean->PASS, findings->
79
+ ADVISORY, tool absent->INDETERMINATE); skill-behavioral
80
+ CONSUMES a j-rig verdict (--jrig-verdict PATH), never
81
+ reimplementing judgment. Emits gate-result/v1 rows.
82
+ Advisory by default; --strict turns findings into FAIL.
83
+ fp-rate Measure each gate's false-positive / false-negative rate
84
+ over a labeled corpus (valid/ should be clean, malformed/
85
+ should flag). The metric that gates advisory->blocking
86
+ promotion. --max-fp-rate X exits 1 if any gate exceeds X.
87
+ See docs/gate-promotion.md.
88
+ currency Advisory upstream-currency report. Reads the per-upstream
89
+ pin relation (schemas/currency/pins.v1.json) and flags
90
+ pins whose checked_at is past their staleness window.
91
+ NO exit-code authority (always exit 0), no live-fetch,
92
+ no auto-fix — it reports; /sync-testing-harness acts.
93
+ gen-layer-applicability Project schemas/audit-profile/registry.v1.json into
94
+ schemas/audit-profile/layer-applicability.md. --write to
95
+ regenerate, --check to fail on drift (CI gate). The doc
96
+ is a PROJECTION of the canonical registry datum.
97
+ emit-evidence Wrap a gate-result JSON envelope in an in-toto
98
+ Statement v1 (predicate https://evals.intentsolutions.io/gate-result/v1)
99
+ Read JSON on stdin: <gate> --json | audit-harness emit-evidence
100
+
101
+ Evidence Bundle (v0.3.0+):
102
+ All gates support --json to emit machine-readable gate-result envelopes
103
+ suitable for piping to emit-evidence. See SEMVER.md for compatibility rules
104
+ and intent-eval-lab/specs/evidence-bundle/v0.1.0-draft/SPEC.md for the
105
+ envelope schema.
106
+
107
+ Safety levers:
108
+ AUDIT_HARNESS_DISABLE=1 Kill-switch. Gate commands no-op (exit 0, banner);
109
+ classify still emits a profile with every gate disabled.
110
+ AUDIT_HARNESS_TIMEOUT=N Per-command supervision: kill the gate after N seconds
111
+ (exit 124) so a hung gate never blocks the pipeline.
112
+ .audit-harness.yml Engineer-owned per-repo override (classify_pins, advisory,
113
+ disable_gates, disable) honored by classify.
42
114
 
43
115
  Options:
44
116
  --version, -v Print version
@@ -77,12 +149,39 @@ if (!existsSync(scriptPath)) {
77
149
  process.exit(2);
78
150
  }
79
151
 
152
+ // Kill-switch: gate commands no-op; classify/verify/init/list still run.
153
+ if (process.env.AUDIT_HARNESS_DISABLE === '1' && KILLABLE_GATES.has(cmd)) {
154
+ console.error(`audit-harness: KILL-SWITCH active (AUDIT_HARNESS_DISABLE=1) — '${cmd}' skipped`);
155
+ process.exit(0);
156
+ }
157
+
80
158
  const isPython = entry.script.endsWith('.py');
81
159
  const interpreter = isPython ? 'python3' : 'bash';
82
160
  const finalArgs = [scriptPath, ...entry.args, ...rest];
83
161
 
162
+ // Per-command supervision: a hung gate hits its timeout and is killed (exit 124)
163
+ // rather than blocking the pipeline. 0/unset = no timeout.
164
+ const timeoutSec = Number(process.env.AUDIT_HARNESS_TIMEOUT) || 0;
165
+
84
166
  const child = spawn(interpreter, finalArgs, { stdio: 'inherit' });
167
+
168
+ let timedOut = false;
169
+ let timer = null;
170
+ if (timeoutSec > 0) {
171
+ timer = setTimeout(() => {
172
+ timedOut = true;
173
+ child.kill('SIGTERM');
174
+ setTimeout(() => child.kill('SIGKILL'), 2000).unref();
175
+ }, timeoutSec * 1000);
176
+ timer.unref();
177
+ }
178
+
85
179
  child.on('exit', (code, signal) => {
180
+ if (timer) clearTimeout(timer);
181
+ if (timedOut) {
182
+ console.error(`audit-harness: ${entry.script} exceeded AUDIT_HARNESS_TIMEOUT=${timeoutSec}s — killed (INDETERMINATE)`);
183
+ process.exit(124);
184
+ }
86
185
  if (signal) {
87
186
  console.error(`audit-harness: ${entry.script} killed by ${signal}`);
88
187
  process.exit(128);
@@ -90,6 +189,7 @@ child.on('exit', (code, signal) => {
90
189
  process.exit(code ?? 0);
91
190
  });
92
191
  child.on('error', (err) => {
192
+ if (timer) clearTimeout(timer);
93
193
  console.error(`audit-harness: failed to spawn ${interpreter}: ${err.message}`);
94
194
  process.exit(2);
95
195
  });
@@ -0,0 +1,45 @@
1
+ # Gate promotion — advisory → blocking
2
+
3
+ Every gate in the [dimension→gate registry](../schemas/audit-profile/registry.v1.json) ships `enforcement: advisory`. Advisory means: the gate runs, emits its `gate-result/v1` row, logs any finding — and **exits 0**. It never reddens a build. Blocking (`enforcement: blocking`, exit 1 on violation) is **earned**, not default.
4
+
5
+ This is deliberate. A gate that blocks before its false-positive rate is known erodes trust, and trust-erosion ends one way: someone appends `|| true` and the gate is dead. Advisory-first + earned-promotion keeps every blocking gate credible.
6
+
7
+ ## The rule
8
+
9
+ A gate may be promoted to `blocking` for a repo when **all** hold:
10
+
11
+ 1. **Measured FP-rate below the bar.** Run the [FP-rate harness](../scripts/fp-rate.py) over a labeled corpus and confirm the gate's false-positive rate is **≤ 5%** (the default bar). A false positive is a *clean* input the gate wrongly flags — the failure mode that destroys trust.
12
+
13
+ ```bash
14
+ audit-harness fp-rate # human-readable report
15
+ audit-harness fp-rate --json # machine-readable
16
+ audit-harness fp-rate --max-fp-rate 0.05 # exit 1 if any gate exceeds the bar
17
+ ```
18
+
19
+ The labeled corpus is `tests/fixtures/conform/{valid,malformed}/` (extend it: a gate is only as trustworthy as the corpus it was measured on — `valid/` inputs must stay clean, `malformed/` inputs must get flagged).
20
+
21
+ 2. **Engineer-pinned in the repo's policy.** Promotion is an engineer decision recorded in the target repo's hash-pinned `tests/TESTING.md` — never inferred by a tool, never proposed by an AI. The classifier reads the per-gate `enforcement` override from the engineer-owned `.audit-harness.yml` (`advisory:` / `disable_gates:` lists) and the policy in `tests/TESTING.md`; the registry default stays `advisory`.
22
+
23
+ 3. **Re-pinned manifest.** After editing the policy, re-init the hash manifest so the change travels with the code and `escape-scan` won't REFUSE a later legitimate edit:
24
+
25
+ ```bash
26
+ audit-harness init # re-pin after an engineer-reviewed policy edit
27
+ git add .harness-hash tests/TESTING.md # commit policy + manifest together
28
+ ```
29
+
30
+ ## Why FP-rate, not FN-rate, is the promotion gate
31
+
32
+ A false **negative** (a real problem the gate misses) is a coverage gap — annoying, but advisory output still surfaces it elsewhere and the gate can tighten over time. A false **positive** on a blocking gate halts a correct build, and the human response is to route around the gate permanently. So promotion is gated on FP-rate; FN-rate is reported for visibility but does not block promotion.
33
+
34
+ ## Demotion / kill-switch
35
+
36
+ Promotion is reversible without ceremony:
37
+
38
+ - Per-gate, per-repo: list the `gate_id` under `advisory:` or `disable_gates:` in `.audit-harness.yml`.
39
+ - Whole-repo break-glass: `AUDIT_HARNESS_DISABLE=1` (gates no-op; `classify` emits an all-disabled profile; `conform` emits `[]`).
40
+
41
+ A blocking gate that starts throwing false positives in the field should be demoted to advisory immediately, then re-measured before re-promotion.
42
+
43
+ ## Provenance
44
+
45
+ Each emitted `gate-result/v1` row records the `policy_hash` (sha256 of the policy/schema the gate evaluated against), so any promotion decision is auditable back to the exact policy version that produced the measurement.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@intentsolutions/audit-harness",
3
- "version": "0.1.0",
3
+ "version": "1.1.6",
4
4
  "description": "Deterministic test-enforcement harness — escape-scan, hash-pinning, CRAP, architecture checks, bias detection, Gherkin lint. Companion to the audit-tests and implement-tests Claude Code skills.",
5
- "license": "MIT",
5
+ "license": "Apache-2.0",
6
6
  "author": "Jeremy Longshore <jeremy@intentsolutions.io>",
7
- "homepage": "https://github.com/jeremylongshore/audit-harness",
7
+ "homepage": "https://github.com/jeremylongshore/intent-audit-harness",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/jeremylongshore/audit-harness.git"
10
+ "url": "git+https://github.com/jeremylongshore/intent-audit-harness.git"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/jeremylongshore/audit-harness/issues"
13
+ "url": "https://github.com/jeremylongshore/intent-audit-harness/issues"
14
14
  },
15
15
  "keywords": [
16
16
  "testing",
@@ -31,17 +31,21 @@
31
31
  "files": [
32
32
  "bin",
33
33
  "scripts",
34
+ "schemas",
35
+ "docs",
34
36
  "README.md",
35
37
  "LICENSE",
38
+ "NOTICE",
36
39
  "CHANGELOG.md"
37
40
  ],
41
+ "scripts": {
42
+ "test": "bash scripts/escape-scan.sh --staged || true",
43
+ "prepublishOnly": "node bin/audit-harness.js --version"
44
+ },
38
45
  "publishConfig": {
39
46
  "access": "public"
40
47
  },
41
48
  "engines": {
42
49
  "node": ">=18"
43
- },
44
- "scripts": {
45
- "test": "bash scripts/escape-scan.sh --staged || true"
46
50
  }
47
- }
51
+ }