assertledger 1.0.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.
Files changed (203) hide show
  1. package/CONTRIBUTING.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.fr.md +236 -0
  4. package/README.md +224 -0
  5. package/SECURITY.md +51 -0
  6. package/benchmarks/agentic-profile/README.md +15 -0
  7. package/benchmarks/agentic-profile/public/README.md +5 -0
  8. package/benchmarks/self-hosted-core/README.md +113 -0
  9. package/benchmarks/self-hosted-core/adapter.mjs +293 -0
  10. package/benchmarks/self-hosted-core/builder.ts +193 -0
  11. package/benchmarks/self-hosted-core/campaign.ts +233 -0
  12. package/benchmarks/self-hosted-core/existing-tests-builder.ts +217 -0
  13. package/benchmarks/self-hosted-core/existing-tests.ts +146 -0
  14. package/benchmarks/self-hosted-core/liveness.test.mjs +8 -0
  15. package/conformance/v1/bundle.json +104 -0
  16. package/conformance/v1/expected/canonical-order-a.json +4 -0
  17. package/conformance/v1/expected/canonical-order-b.json +4 -0
  18. package/conformance/v1/expected/create-benchmark-v1-measured.json +575 -0
  19. package/conformance/v1/expected/create-profile-v1-qualified.json +280 -0
  20. package/conformance/v1/expected/decide-collection-failure-non-kill.json +192 -0
  21. package/conformance/v1/expected/decide-compile-failure-non-kill.json +192 -0
  22. package/conformance/v1/expected/decide-infra-error-non-kill.json +192 -0
  23. package/conformance/v1/expected/decide-no-test-discovered-non-kill.json +192 -0
  24. package/conformance/v1/expected/decide-process-crash-non-kill.json +192 -0
  25. package/conformance/v1/expected/decide-timeout-non-kill.json +192 -0
  26. package/conformance/v1/expected/decide-verified.json +192 -0
  27. package/conformance/v1/expected/replay-benchmark-v1-resealed-summary-forgery.json +12 -0
  28. package/conformance/v1/expected/replay-evidence-raw-tamper.json +6 -0
  29. package/conformance/v1/expected/replay-evidence-resealed-semantic-forgery.json +6 -0
  30. package/conformance/v1/inputs/canonical-order-a.json +8 -0
  31. package/conformance/v1/inputs/canonical-order-b.json +8 -0
  32. package/conformance/v1/inputs/create-benchmark-v1-measured.json +459 -0
  33. package/conformance/v1/inputs/create-profile-v1-qualified.json +228 -0
  34. package/conformance/v1/inputs/decide-collection-failure-non-kill.json +143 -0
  35. package/conformance/v1/inputs/decide-compile-failure-non-kill.json +143 -0
  36. package/conformance/v1/inputs/decide-infra-error-non-kill.json +143 -0
  37. package/conformance/v1/inputs/decide-no-test-discovered-non-kill.json +143 -0
  38. package/conformance/v1/inputs/decide-process-crash-non-kill.json +143 -0
  39. package/conformance/v1/inputs/decide-timeout-non-kill.json +143 -0
  40. package/conformance/v1/inputs/decide-verified.json +143 -0
  41. package/conformance/v1/inputs/replay-benchmark-v1-resealed-summary-forgery.json +575 -0
  42. package/conformance/v1/inputs/replay-evidence-raw-tamper.json +201 -0
  43. package/conformance/v1/inputs/replay-evidence-resealed-semantic-forgery.json +192 -0
  44. package/conformance/v1/schemas/expected-digests.json +175 -0
  45. package/dist/cli.d.ts +9 -0
  46. package/dist/cli.d.ts.map +1 -0
  47. package/dist/cli.js +951 -0
  48. package/dist/cli.js.map +1 -0
  49. package/dist/contracts/diagnostics.d.ts +18 -0
  50. package/dist/contracts/diagnostics.d.ts.map +1 -0
  51. package/dist/contracts/diagnostics.js +13 -0
  52. package/dist/contracts/diagnostics.js.map +1 -0
  53. package/dist/contracts/index.d.ts +3908 -0
  54. package/dist/contracts/index.d.ts.map +1 -0
  55. package/dist/contracts/index.js +2569 -0
  56. package/dist/contracts/index.js.map +1 -0
  57. package/dist/contracts/runtime-doctor.d.ts +107 -0
  58. package/dist/contracts/runtime-doctor.d.ts.map +1 -0
  59. package/dist/contracts/runtime-doctor.js +91 -0
  60. package/dist/contracts/runtime-doctor.js.map +1 -0
  61. package/dist/core/index.d.ts +200 -0
  62. package/dist/core/index.d.ts.map +1 -0
  63. package/dist/core/index.js +2587 -0
  64. package/dist/core/index.js.map +1 -0
  65. package/dist/diagnostics.d.ts +7 -0
  66. package/dist/diagnostics.d.ts.map +1 -0
  67. package/dist/diagnostics.js +252 -0
  68. package/dist/diagnostics.js.map +1 -0
  69. package/dist/engine/adapters/node-test-profile.d.ts +14 -0
  70. package/dist/engine/adapters/node-test-profile.d.ts.map +1 -0
  71. package/dist/engine/adapters/node-test-profile.js +14 -0
  72. package/dist/engine/adapters/node-test-profile.js.map +1 -0
  73. package/dist/engine/adapters/node-test-runtime.d.ts +39 -0
  74. package/dist/engine/adapters/node-test-runtime.d.ts.map +1 -0
  75. package/dist/engine/adapters/node-test-runtime.js +173 -0
  76. package/dist/engine/adapters/node-test-runtime.js.map +1 -0
  77. package/dist/engine/adapters/runtime-facts.d.ts +26 -0
  78. package/dist/engine/adapters/runtime-facts.d.ts.map +1 -0
  79. package/dist/engine/adapters/runtime-facts.js +73 -0
  80. package/dist/engine/adapters/runtime-facts.js.map +1 -0
  81. package/dist/engine/connection.d.ts +22 -0
  82. package/dist/engine/connection.d.ts.map +1 -0
  83. package/dist/engine/connection.js +343 -0
  84. package/dist/engine/connection.js.map +1 -0
  85. package/dist/engine/git-regression.d.ts +25 -0
  86. package/dist/engine/git-regression.d.ts.map +1 -0
  87. package/dist/engine/git-regression.js +803 -0
  88. package/dist/engine/git-regression.js.map +1 -0
  89. package/dist/engine/index.d.ts +55 -0
  90. package/dist/engine/index.d.ts.map +1 -0
  91. package/dist/engine/index.js +2782 -0
  92. package/dist/engine/index.js.map +1 -0
  93. package/dist/engine/node-test-reporter.d.ts +2 -0
  94. package/dist/engine/node-test-reporter.d.ts.map +1 -0
  95. package/dist/engine/node-test-reporter.js +70 -0
  96. package/dist/engine/node-test-reporter.js.map +1 -0
  97. package/dist/engine/runtime-doctor.d.ts +16 -0
  98. package/dist/engine/runtime-doctor.d.ts.map +1 -0
  99. package/dist/engine/runtime-doctor.js +100 -0
  100. package/dist/engine/runtime-doctor.js.map +1 -0
  101. package/dist/evaluation/agentic-corpus.d.ts +161 -0
  102. package/dist/evaluation/agentic-corpus.d.ts.map +1 -0
  103. package/dist/evaluation/agentic-corpus.js +710 -0
  104. package/dist/evaluation/agentic-corpus.js.map +1 -0
  105. package/dist/index.d.ts +8 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +8 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/mcp/index.d.ts +13 -0
  110. package/dist/mcp/index.d.ts.map +1 -0
  111. package/dist/mcp/index.js +391 -0
  112. package/dist/mcp/index.js.map +1 -0
  113. package/dist/mcp/stdio.d.ts +3 -0
  114. package/dist/mcp/stdio.d.ts.map +1 -0
  115. package/dist/mcp/stdio.js +13 -0
  116. package/dist/mcp/stdio.js.map +1 -0
  117. package/dist/sdk/index.d.ts +52 -0
  118. package/dist/sdk/index.d.ts.map +1 -0
  119. package/dist/sdk/index.js +224 -0
  120. package/dist/sdk/index.js.map +1 -0
  121. package/dist/version.d.ts +2 -0
  122. package/dist/version.d.ts.map +1 -0
  123. package/dist/version.js +10 -0
  124. package/dist/version.js.map +1 -0
  125. package/docs/adapter-protocol.md +196 -0
  126. package/docs/agentic-benchmark.md +118 -0
  127. package/docs/agentic-corpus-experiment-h3.md +89 -0
  128. package/docs/agentic-corpus-plan.md +105 -0
  129. package/docs/agentic-corpus-provenance.md +59 -0
  130. package/docs/agentic-test-profile-pilot.md +57 -0
  131. package/docs/agentic-test-profile-v2.md +116 -0
  132. package/docs/agentic-test-profile.md +274 -0
  133. package/docs/architecture.md +157 -0
  134. package/docs/ci.md +37 -0
  135. package/docs/client-connections.md +61 -0
  136. package/docs/conformance-v1.md +72 -0
  137. package/docs/decisions/0001-typescript-runtime.md +24 -0
  138. package/docs/developer-experience.md +55 -0
  139. package/docs/diagnostics.md +35 -0
  140. package/docs/distribution.md +40 -0
  141. package/docs/git-regression.md +39 -0
  142. package/docs/migration-repository-validation-order.md +35 -0
  143. package/docs/migration-testforge-to-assertledger.md +64 -0
  144. package/docs/project-intent.md +173 -0
  145. package/docs/proof-model.md +116 -0
  146. package/docs/reference.md +336 -0
  147. package/docs/release-1.0.md +63 -0
  148. package/docs/repository-audit.md +52 -0
  149. package/docs/repository-init.md +60 -0
  150. package/docs/research-basis.md +27 -0
  151. package/docs/roadmap.md +74 -0
  152. package/docs/runtime-doctor.md +65 -0
  153. package/docs/testexplora-calibration.md +71 -0
  154. package/examples/agentic-benchmark/benchmark-request.mjs +19 -0
  155. package/examples/agentic-benchmark/structured-phase-adapter-fixture.mjs +35 -0
  156. package/examples/agentic-profile/profile-benchmark.mjs +34 -0
  157. package/examples/agentic-profile/profile-manifest.mjs +28 -0
  158. package/examples/git-history/README.md +44 -0
  159. package/examples/git-history/create-demo.mjs +128 -0
  160. package/examples/git-history/escape-string-regexp/LICENSE +9 -0
  161. package/examples/git-history/escape-string-regexp/before.cjs.txt +11 -0
  162. package/examples/git-history/escape-string-regexp/fixed.cjs.txt +13 -0
  163. package/examples/git-history/escape-string-regexp/provenance.json +28 -0
  164. package/examples/node-test/repository/package.json +5 -0
  165. package/examples/node-test/repository/src/is-even.js +3 -0
  166. package/examples/node-test/repository/tests/base.test.js +6 -0
  167. package/examples/node-test/request.json +93 -0
  168. package/integrations/skill/SKILL.md +51 -0
  169. package/package.json +88 -0
  170. package/schemas/agentic-benchmark-acquisition-replay-result.v1.json +70 -0
  171. package/schemas/agentic-benchmark-acquisition-request.v1.json +564 -0
  172. package/schemas/agentic-benchmark-acquisition-result.v1.json +1409 -0
  173. package/schemas/agentic-benchmark-artifact.v1.json +1251 -0
  174. package/schemas/agentic-benchmark-replay-result.v1.json +84 -0
  175. package/schemas/agentic-benchmark-request.v1.json +1034 -0
  176. package/schemas/agentic-corpus-allocation-commitment-replay-result.v1.json +58 -0
  177. package/schemas/agentic-corpus-allocation-commitment.v1.json +141 -0
  178. package/schemas/agentic-corpus-allocation-replay-result.v1.json +34 -0
  179. package/schemas/agentic-corpus-allocation-request.v1.json +65 -0
  180. package/schemas/agentic-corpus-allocation-reveal.v1.json +66 -0
  181. package/schemas/agentic-corpus-allocation.v1.json +167 -0
  182. package/schemas/agentic-corpus-experiment-artifact.v1.json +329 -0
  183. package/schemas/agentic-corpus-experiment-plan-replay-result.v1.json +50 -0
  184. package/schemas/agentic-corpus-experiment-plan.v1.json +424 -0
  185. package/schemas/agentic-corpus-experiment-replay-request.v1.json +336 -0
  186. package/schemas/agentic-corpus-experiment-replay-result.v1.json +106 -0
  187. package/schemas/agentic-corpus-experiment-request.v1.json +204 -0
  188. package/schemas/agentic-corpus-provenance.v1.json +143 -0
  189. package/schemas/agentic-corpus-trust-policy.v1.json +133 -0
  190. package/schemas/agentic-profile-replay-result.v1.json +56 -0
  191. package/schemas/agentic-profile-replay-result.v2.json +63 -0
  192. package/schemas/agentic-profile-report.v1.json +961 -0
  193. package/schemas/agentic-profile-report.v2.json +1674 -0
  194. package/schemas/agentic-profile-request.v1.json +671 -0
  195. package/schemas/agentic-profile-request.v2.json +1338 -0
  196. package/schemas/evidence-manifest.v1.json +636 -0
  197. package/schemas/replay-result.v1.json +49 -0
  198. package/schemas/repository-analysis.v1.json +119 -0
  199. package/schemas/repository-audit.v1.json +811 -0
  200. package/schemas/repository-init-config.v1.json +183 -0
  201. package/schemas/repository-init-lock.v1.json +162 -0
  202. package/schemas/repository-init-result.v1.json +212 -0
  203. package/schemas/verification-request.v1.json +389 -0
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ AssertLedger accepts small, reviewable changes backed by observable behavior.
4
+
5
+ Use Node.js 22.15 or newer and pnpm 11.
6
+
7
+ `pnpm test` and `pnpm test:coverage` build the package through their explicit pretest lifecycle
8
+ scripts, enabled in `pnpm-workspace.yaml`. This supplies the compiled reporter even in a fresh
9
+ checkout. `pnpm check` includes that same build and test path.
10
+
11
+ 1. Read `AGENTS.md`, `docs/architecture.md`, and `docs/proof-model.md`.
12
+ 2. Install the pinned toolchain with `pnpm install --frozen-lockfile`.
13
+ 3. Add a failing test for public behavior changes.
14
+ 4. Keep deterministic decision logic in `src/core`; keep I/O in `src/engine`.
15
+ 5. Run `pnpm generate:schemas` after changing any wire contract, and include all resulting files in
16
+ `schemas/` in the review.
17
+ 6. Run `pnpm check` and include the relevant evidence in the pull request.
18
+
19
+ Test and coverage runs execute at most two test files concurrently. Many suites launch real child
20
+ processes; bounded concurrency keeps their unchanged execution deadlines meaningful on shared hosts.
21
+
22
+ Commits should follow Conventional Commits. Contract-breaking changes require a schema-version and
23
+ migration discussion before implementation.
24
+
25
+ The following surfaces are public contracts: request schemas, normalized outcomes, candidate and
26
+ campaign statuses, gate ordering, reason codes, CLI exit codes, canonicalization, decision-digest
27
+ scope, artifact-digest scope, adapter protocols, and MCP tool schemas. Add compatibility tests and a
28
+ migration note before changing any of them.
29
+
30
+ Do not run `trusted-local` campaigns on untrusted contributions or credential-bearing CI runners.
31
+ The normal `pnpm check` gate does not require a user-supplied unsafe campaign.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TestForge contributors
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.
package/README.fr.md ADDED
@@ -0,0 +1,236 @@
1
+ # AssertLedger
2
+
3
+ **Votre test de régression détecte-t-il vraiment le bug ?**
4
+
5
+ AssertLedger exécute le même test sur le code corrigé, un défaut connu et un témoin neutre.
6
+ Vous obtenez un verdict, les observations qui le justifient et un fichier de preuves à revérifier.
7
+
8
+ [English](README.md) · **Français**
9
+
10
+ [Essayer l’exemple](#essayer-lexemple) · [Comprendre le résultat](#comprendre-le-résultat) · [Utiliser votre dépôt](#utiliser-votre-dépôt) · [Documentation](#documentation)
11
+
12
+ **1.0 · node:test · CLI, SDK et MCP · MIT**
13
+
14
+ Installez l’outil dans votre dépôt avec Node.js 22.15 ou une version ultérieure :
15
+
16
+ ```sh
17
+ npm install --save-dev assertledger@1.0.0
18
+ npx assertledger doctor .
19
+ ```
20
+
21
+ La [démonstration d’une correction historique](examples/git-history/README.md) fonctionne depuis
22
+ le paquet installé. L’exemple source ci-dessous détaille les preuves étape par étape.
23
+
24
+ ## Un test vert peut laisser passer le bug
25
+
26
+ La fonction `isEven(2)` doit renvoyer `true`. Une régression inverse accidentellement sa réponse.
27
+
28
+ ```js
29
+ // Les deux tests passent avec le code correct.
30
+ assert.equal(typeof isEven(2), "boolean"); // Passe aussi quand la réponse est fausse.
31
+ assert.equal(isEven(2), true); // Détecte cette régression précise.
32
+ ```
33
+
34
+ AssertLedger rend cette différence visible :
35
+
36
+ | Même test candidat | Code corrigé | Défaut connu | Témoin neutre | Résultat |
37
+ | --- | --- | --- | --- | --- |
38
+ | « Renvoie un booléen » | Réussite | Réussite | Réussite | `WEAK_ORACLE` pour ce défaut |
39
+ | « Deux est pair » | Réussite | Échec d’assertion | Réussite | Admissible à la sélection |
40
+ | Le test plante ou dépasse le délai | — | Erreur d’exécution | — | Ne compte pas comme détection |
41
+
42
+ Vous fournissez le défaut et le témoin neutre. AssertLedger ne décide pas de leur signification.
43
+ Des exécutions répétées et des tests de contrôle vérifient que la différence observée peut être
44
+ attribuée au test candidat.
45
+
46
+ ```mermaid
47
+ flowchart LR
48
+ T[Même test candidat] --> R[Code corrigé]
49
+ T --> B[Défaut connu]
50
+ T --> N[Témoin neutre]
51
+ R --> E[Observations enregistrées]
52
+ B --> E
53
+ N --> E
54
+ E --> V[Verdict déterministe]
55
+ V --> M[Preuves revérifiables]
56
+ ```
57
+
58
+ ## Essayer l’exemple
59
+
60
+ Prérequis : **Git**, **Node.js 22.15+** et **pnpm 11.1.2**. Le premier adaptateur intégré utilise `node:test`.
61
+
62
+ ```sh
63
+ git clone --branch v1.0.0 https://github.com/hoklims/assertledger.git
64
+ cd assertledger
65
+ pnpm install --frozen-lockfile
66
+ pnpm build
67
+ ```
68
+
69
+ L’exemple fourni contient une fonction de parité correcte, sa version inversée, un témoin neutre
70
+ équivalent et les deux tests présentés plus haut. Consultez [sa requête](examples/node-test/request.json),
71
+ puis lancez :
72
+
73
+ ```sh
74
+ node dist/cli.js verify examples/node-test/request.json --allow-unsafe-execution --json
75
+ ```
76
+
77
+ > **Exécutez uniquement du code de confiance.** L’option `--allow-unsafe-execution` autorise
78
+ > l’exécution locale du code. Ce mode est explicitement **UNSANDBOXED**, sans bac à sable :
79
+ > il ne protège pas votre machine contre du code malveillant.
80
+
81
+ Décision attendue :
82
+
83
+ ```json
84
+ {
85
+ "status": "VERIFIED",
86
+ "selectedCandidateIds": ["strong"],
87
+ "reasonCodes": ["POLICY_SATISFIED"]
88
+ }
89
+ ```
90
+
91
+ Il s’agit de la section `decision` du manifeste complet. Le candidat `weak` reçoit le motif
92
+ `WEAK_ORACLE`. Le manifeste consigne aussi les contrôles, les tentatives, les résultats observés,
93
+ les empreintes et les limites d’exécution.
94
+
95
+ ### Enregistrer et revérifier les preuves
96
+
97
+ Créez un fichier `demo.mjs` à la racine du dépôt avec ce contenu. Il utilise le même exemple via
98
+ le SDK et écrit le manifeste en UTF-8, sous Windows comme sous Linux :
99
+
100
+ ```js
101
+ import { readFile, writeFile } from "node:fs/promises";
102
+ import { AssertLedger } from "./dist/index.js";
103
+
104
+ const ledger = new AssertLedger();
105
+ const request = JSON.parse(await readFile("examples/node-test/request.json", "utf8"));
106
+ // Examinez l’exemple de confiance avant d’autoriser explicitement son exécution.
107
+ request.isolation.acknowledgedUnsafeExecution = true;
108
+ const manifest = await ledger.verify(request);
109
+ await writeFile("manifest.json", JSON.stringify(manifest, null, 2), "utf8");
110
+ console.log(manifest.decision);
111
+ ```
112
+
113
+ ```sh
114
+ node demo.mjs
115
+ node dist/cli.js replay manifest.json --json
116
+ ```
117
+
118
+ Les cinq champs de vérification doivent valoir `true` : `valid`, `schemaValid`, `decisionDigestValid`,
119
+ `artifactDigestValid` et `decisionSemanticsValid`. Cette revérification ne nécessite aucun modèle
120
+ d’IA et ne relance pas les tests.
121
+
122
+ ## Comprendre le résultat
123
+
124
+ | Verdict de la campagne | Ce qu’il indique | Suite à donner |
125
+ | --- | --- | --- |
126
+ | `VERIFIED` | Les tests sélectionnés respectent la politique déclarée pour ces variantes et ces tentatives. | Examinez le défaut, les contrôles et les preuves avant d’accepter le test. |
127
+ | `REJECTED` | Aucun candidat ne respecte la politique déclarée. | Consultez les motifs ; renforcez l’assertion ou corrigez les variantes déclarées. |
128
+ | `INCONCLUSIVE` | Les observations ne permettent pas de décider de façon stable. | Examinez les exécutions instables, la découverte des tests et les erreurs d’exécution. |
129
+ | `ENGINE_ERROR` | La campagne n’a pas produit de résultat exploitable. | Corrigez l’environnement ou la configuration, puis relancez. |
130
+
131
+ Un délai dépassé, une erreur de syntaxe, un échec de collecte des tests ou un plantage de processus
132
+ **ne compte jamais comme un bug détecté**. Un rejet concerne le défaut déclaré ; le test peut
133
+ rester utile dans d’autres situations.
134
+
135
+ La commande `replay` contrôle l’intégrité et la cohérence de la décision. Elle n’authentifie pas
136
+ l’auteur des observations, ne prouve pas la correction générale du programme et ne garantit pas
137
+ qu’un test restera toujours stable.
138
+
139
+ ## Utiliser votre dépôt
140
+
141
+ Commencez par un diagnostic statique. Il lit le dépôt sans exécuter ses tests ni écrire de fichiers :
142
+
143
+ ```sh
144
+ node dist/cli.js doctor path/to/your-repository
145
+ node dist/cli.js doctor path/to/your-repository --json
146
+ ```
147
+
148
+ `WOULD_CREATE` signifie qu’une configuration peut être préparée. Vous fournissez encore le test
149
+ candidat et les contrôles. Le [guide d’initialisation](docs/repository-init.md) décrit `init`,
150
+ la configuration et le verrou des preuves. Détecter un framework ne signifie pas savoir l’exécuter.
151
+
152
+ Après l’initialisation, le [diagnostic dynamique](docs/runtime-doctor.md) vérifie Node, le reporter,
153
+ la découverte des tests et l’attribution des assertions avec `doctor --runtime --allow-unsafe-execution`.
154
+ Pour comprendre un refus, lancez `explain CODE` : la commande indique la prochaine action sûre.
155
+
156
+ ### Qualifier un test de régression commité
157
+
158
+ Choisissez le commit qui contient le bug (`BEFORE`), sa correction (`AFTER`) et un témoin neutre
159
+ (`NEUTRAL`). Le candidat provient de `AFTER` ; ses octets restent identiques dans les trois variantes.
160
+ Remplacez les chemins, les révisions et la justification du témoin par vos propres valeurs :
161
+
162
+ ```sh
163
+ node dist/cli.js check path/to/your-repository --before BEFORE --after AFTER --neutral NEUTRAL --neutral-reason "Expliquez pourquoi ce témoin préserve le comportement attendu" --test tests/regression.test.js --base-test tests/base.test.js --out .assertledger/evidence-001 --allow-unsafe-execution
164
+ ```
165
+
166
+ | Prérequis de ce premier parcours Git | Pourquoi |
167
+ | --- | --- |
168
+ | Un candidat JavaScript `node:test` commité | Chaque variante reçoit le même test enregistré. |
169
+ | Aucune dépendance d’exécution déclarée | Ce parcours n’installe ni ne transporte les dépendances. |
170
+ | Un test de base inchangé dans chaque révision | Le contrôle ne doit pas varier avec la correction. |
171
+ | Les mêmes chemins de fichiers, hormis le candidat | Les ajouts, suppressions et renommages ne sont pas encore qualifiés. |
172
+
173
+ La commande enregistre `summary.md`, `executed-request.json` et `manifest.json` dans un nouveau dossier.
174
+ Le manifeste est publié en dernier ; sa présence marque un résultat complet. La requête enregistrée
175
+ pointe vers une copie temporaire supprimée après l’exécution ; conservez les révisions Git pour
176
+ relancer la campagne. Le [guide du parcours Git](docs/git-regression.md) détaille les limites et
177
+ le rôle du témoin neutre.
178
+
179
+ ## Utiliser AssertLedger avec un agent
180
+
181
+ Un agent propose un test candidat ; le moteur déterministe évalue les observations.
182
+ Consultez le [skill pour les agents](integrations/skill/SKILL.md), le
183
+ [SDK TypeScript](docs/reference.md#typescript-sdk) ou la [référence MCP](docs/reference.md#mcp-v2-over-stdio).
184
+
185
+ Générez une configuration Codex propre au projet avec le CLI compilé :
186
+
187
+ ```sh
188
+ node dist/cli.js connect path/to/your-repository --client codex
189
+ ```
190
+
191
+ Cette commande prévisualise la configuration et le skill fourni. Ajoutez `--write` pour les
192
+ installer ; tout contenu existant différent est conservé et signalé comme un conflit.
193
+ Le serveur MCP généré démarre en lecture seule. L’exécution de tests candidats demande une
194
+ autorisation explicite distincte. Le [guide de prise en main](docs/developer-experience.md) précise
195
+ les exigences de confiance du projet et de rechargement du client.
196
+
197
+ Utilisez `--client claude-code` pour Claude Code ou `--client mcp` pour un descripteur générique.
198
+ `disconnect --client codex --write` retire seulement les fichiers restés strictement identiques.
199
+ Le [guide des clients](docs/client-connections.md) décrit l’installation et la désinstallation.
200
+
201
+ ## Documentation
202
+
203
+ Le guide Git est en français ; les autres références techniques sont en anglais.
204
+
205
+ | Vous souhaitez… | Commencez ici |
206
+ | --- | --- |
207
+ | Préparer un dépôt | [Initialisation](docs/repository-init.md) · [Audit statique](docs/repository-audit.md) |
208
+ | Comprendre un blocage | [Diagnostic dynamique](docs/runtime-doctor.md) · [Explication des motifs](docs/diagnostics.md) |
209
+ | Essayer une correction historique | [Exemple Unicode-regexp](examples/git-history/README.md) |
210
+ | Qualifier une correction ou connecter Codex | [Parcours Git](docs/git-regression.md) · [Prise en main](docs/developer-experience.md) |
211
+ | Comprendre l’attribution, les contrôles et les empreintes | [Modèle de preuve](docs/proof-model.md) |
212
+ | Intégrer le CLI, le SDK ou MCP | [Référence d’intégration](docs/reference.md) |
213
+ | Vérifier le paquet réellement distribué | [Contrôles de distribution](docs/distribution.md) · [Preuves CI](docs/ci.md) |
214
+ | Développer un adaptateur | [Protocole des adaptateurs](docs/adapter-protocol.md) · [Architecture](docs/architecture.md) |
215
+ | Consulter le périmètre de la version 1.0 | [Critères de release](docs/release-1.0.md) · [Feuille de route](docs/roadmap.md) |
216
+ | Explorer les évaluations avancées | [Profils](docs/agentic-test-profile.md) · [Benchmarks](docs/agentic-benchmark.md) · [Calibration](docs/agentic-corpus-plan.md) |
217
+
218
+ Les profils scientifiques et la calibration conservent leurs propres exigences de preuve.
219
+ Leur présence n’établit ni un avantage sur un produit externe ni une adéquation au marché mesurée.
220
+
221
+ ## Contribuer
222
+
223
+ ```sh
224
+ pnpm check
225
+ pnpm run smoke:package
226
+ ```
227
+
228
+ Ajoutez un test comportemental rouge avant de changer un contrat public. Gardez l’exécution
229
+ dans le moteur et les décisions dans le noyau pur. Consultez [CONTRIBUTING.md](CONTRIBUTING.md)
230
+ et [SECURITY.md](SECURITY.md).
231
+
232
+ **Compatibilité :** le nom actuel est AssertLedger. Les anciens alias TestForge et les identifiants
233
+ des contrats versionnés restent disponibles pour préserver les intégrations et la revérification
234
+ des preuves existantes. Consultez le [guide de migration](docs/migration-testforge-to-assertledger.md).
235
+
236
+ Distribué sous licence [MIT](LICENSE).
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # AssertLedger
2
+
3
+ **Does your regression test actually catch the bug?**
4
+
5
+ AssertLedger runs the same test against fixed code, a known fault and a neutral control.
6
+ You get a verdict, the observations behind it and an evidence file you can replay.
7
+
8
+ **English** · [Français](README.fr.md)
9
+
10
+ [Try the example](#try-the-example) · [Understand the result](#understand-the-result) · [Use your repository](#use-your-repository) · [Documentation](#documentation)
11
+
12
+ **1.0 · node:test · CLI, SDK and MCP · MIT**
13
+
14
+ Install in your repository with Node.js 22.15 or later:
15
+
16
+ ```sh
17
+ npm install --save-dev assertledger@1.0.0
18
+ npx assertledger doctor .
19
+ ```
20
+
21
+ The [historical correction demo](examples/git-history/README.md) runs from the installed package.
22
+ The source example below walks through the evidence step by step.
23
+
24
+ ## A passing test can miss the bug
25
+
26
+ Suppose `isEven(2)` should return `true`. A regression accidentally inverts the implementation.
27
+
28
+ ```js
29
+ // Both tests pass on the correct implementation.
30
+ assert.equal(typeof isEven(2), "boolean"); // Also passes when the answer is wrong.
31
+ assert.equal(isEven(2), true); // Detects this particular regression.
32
+ ```
33
+
34
+ AssertLedger makes that distinction explicit:
35
+
36
+ | Same candidate test | Fixed code | Known fault | Neutral control | Result |
37
+ | --- | --- | --- | --- | --- |
38
+ | “Returns a boolean” | Pass | Pass | Pass | `WEAK_ORACLE` for this fault |
39
+ | “Two is even” | Pass | Assertion failure | Pass | Eligible for selection |
40
+ | Test crashes or times out | — | Operational error | — | No credited detection |
41
+
42
+ The operator supplies the fault and the neutral control. AssertLedger does not invent their meaning.
43
+ Repeated runs and base tests check that the observed difference can be attributed to the candidate.
44
+
45
+ ```mermaid
46
+ flowchart LR
47
+ T[Same candidate test] --> R[Fixed code]
48
+ T --> B[Known fault]
49
+ T --> N[Neutral control]
50
+ R --> E[Recorded observations]
51
+ B --> E
52
+ N --> E
53
+ E --> V[Deterministic verdict]
54
+ V --> M[Replayable evidence]
55
+ ```
56
+
57
+ ## Try the example
58
+
59
+ You need **Git**, **Node.js 22.15+** and **pnpm 11.1.2**. The first built-in adapter is `node:test`.
60
+
61
+ ```sh
62
+ git clone --branch v1.0.0 https://github.com/hoklims/assertledger.git
63
+ cd assertledger
64
+ pnpm install --frozen-lockfile
65
+ pnpm build
66
+ ```
67
+
68
+ The bundled example contains a correct parity function, an inverted version, a neutral equivalent,
69
+ and the two tests above. Inspect [its request](examples/node-test/request.json), then run:
70
+
71
+ ```sh
72
+ node dist/cli.js verify examples/node-test/request.json --allow-unsafe-execution --json
73
+ ```
74
+
75
+ > **Run trusted code only.** `--allow-unsafe-execution` authorizes local code execution.
76
+ > This backend is explicitly **UNSANDBOXED**. Use a trusted checkout; it cannot contain hostile code.
77
+
78
+ Expected decision:
79
+
80
+ ```json
81
+ {
82
+ "status": "VERIFIED",
83
+ "selectedCandidateIds": ["strong"],
84
+ "reasonCodes": ["POLICY_SATISFIED"]
85
+ }
86
+ ```
87
+
88
+ That is the `decision` section of the full manifest. The `weak` candidate is marked `WEAK_ORACLE`.
89
+ The manifest also records the controls, attempts, observed outcomes, digests and execution limits.
90
+
91
+ ### Save and replay the evidence
92
+
93
+ Create `demo.mjs` at the repository root with the following content. This writes UTF-8 consistently
94
+ on Windows and Linux and uses the same example through the SDK:
95
+
96
+ ```js
97
+ import { readFile, writeFile } from "node:fs/promises";
98
+ import { AssertLedger } from "./dist/index.js";
99
+
100
+ const ledger = new AssertLedger();
101
+ const request = JSON.parse(await readFile("examples/node-test/request.json", "utf8"));
102
+ // Review the trusted example before explicitly authorizing its execution.
103
+ request.isolation.acknowledgedUnsafeExecution = true;
104
+ const manifest = await ledger.verify(request);
105
+ await writeFile("manifest.json", JSON.stringify(manifest, null, 2), "utf8");
106
+ console.log(manifest.decision);
107
+ ```
108
+
109
+ ```sh
110
+ node demo.mjs
111
+ node dist/cli.js replay manifest.json --json
112
+ ```
113
+
114
+ All five replay fields should be `true`: `valid`, `schemaValid`, `decisionDigestValid`,
115
+ `artifactDigestValid` and `decisionSemanticsValid`. Replay requires no model and does not run tests again.
116
+
117
+ ## Understand the result
118
+
119
+ | Campaign verdict | What it tells you | Next step |
120
+ | --- | --- | --- |
121
+ | `VERIFIED` | Selected tests meet the declared policy for these worlds and attempts. | Review the fault, controls and evidence before accepting the test. |
122
+ | `REJECTED` | No candidate meets the declared policy. | Read candidate reasons; strengthen the assertion or correct the declared worlds. |
123
+ | `INCONCLUSIVE` | The observations do not support a stable decision. | Inspect unstable runs, discovery and operational errors. |
124
+ | `ENGINE_ERROR` | The campaign could not produce a usable result. | Fix the environment or configuration, then rerun. |
125
+
126
+ A timeout, syntax error, collection failure or process crash **never counts as a detected bug**.
127
+ A rejection concerns the declared fault model; the test may still have value elsewhere.
128
+
129
+ Replay checks integrity and decision consistency. It does **not** authenticate whoever produced the
130
+ observations, prove general program correctness or guarantee permanent freedom from flaky tests.
131
+
132
+ ## Use your repository
133
+
134
+ Start with a static diagnostic. It reads the repository without running its tests or writing files:
135
+
136
+ ```sh
137
+ node dist/cli.js doctor path/to/your-repository
138
+ node dist/cli.js doctor path/to/your-repository --json
139
+ ```
140
+
141
+ `WOULD_CREATE` means a configuration can be planned. You still supply the candidate and controls.
142
+ The [initialization guide](docs/repository-init.md) explains `init`, the configuration and evidence
143
+ lock. Detection of a framework is not proof that AssertLedger can execute it.
144
+
145
+ After initialization, [runtime doctor](docs/runtime-doctor.md) can check Node, the reporter,
146
+ discovery and assertion attribution with `doctor --runtime --allow-unsafe-execution`.
147
+ For a refusal, use `explain CODE` to get a safe next action.
148
+
149
+ ### Qualify a committed regression test
150
+
151
+ Choose the buggy commit (`BEFORE`), its correction (`AFTER`) and a neutral control (`NEUTRAL`).
152
+ The candidate comes from `AFTER`; the exact same bytes run in all three worlds.
153
+ Replace the paths, revisions and neutral reason below with your own:
154
+
155
+ ```sh
156
+ node dist/cli.js check path/to/your-repository --before BEFORE --after AFTER --neutral NEUTRAL --neutral-reason "Explain why this control preserves the expected behavior" --test tests/regression.test.js --base-test tests/base.test.js --out .assertledger/evidence-001 --allow-unsafe-execution
157
+ ```
158
+
159
+ | Required for this first Git workflow | Why |
160
+ | --- | --- |
161
+ | Committed JavaScript `node:test` candidate | Each world receives the same recorded test. |
162
+ | No declared runtime dependencies | This workflow does not install or transport dependencies. |
163
+ | An unchanged base test in every revision | The control must not change with the correction. |
164
+ | The same file paths, apart from the candidate | File additions, deletions and renames are not qualified yet. |
165
+
166
+ The command saves `summary.md`, `executed-request.json` and `manifest.json` in a new output directory.
167
+ `manifest.json` is published last; its presence marks a complete result. The saved request refers to
168
+ a temporary snapshot that has been removed; preserve the Git revisions if you need to run again.
169
+ Read the [Git workflow guide](docs/git-regression.md) for limits and neutral-control semantics.
170
+
171
+ ## Use it with an agent
172
+
173
+ An agent can propose a candidate; the deterministic engine evaluates the observations.
174
+ Use the [agent skill](integrations/skill/SKILL.md), [TypeScript SDK](docs/reference.md#typescript-sdk)
175
+ or [MCP reference](docs/reference.md#mcp-v2-over-stdio).
176
+
177
+ Generate a project-scoped Codex configuration from the built CLI:
178
+
179
+ ```sh
180
+ node dist/cli.js connect path/to/your-repository --client codex
181
+ ```
182
+
183
+ This previews the configuration and packaged skill. Add `--write` to install both; different
184
+ existing content is preserved and reported as a conflict. The generated MCP server starts read-only.
185
+ Candidate execution requires a separate explicit opt-in. See [developer entry points](docs/developer-experience.md)
186
+ for project trust and reload requirements.
187
+
188
+ Use `--client claude-code` for Claude Code or `--client mcp` for a generic descriptor.
189
+ `disconnect --client codex --write` removes only byte-identical owned files.
190
+ The [client guide](docs/client-connections.md) covers installation and removal.
191
+
192
+ ## Documentation
193
+
194
+ | You want to… | Start here |
195
+ | --- | --- |
196
+ | Set up a repository | [Initialization](docs/repository-init.md) · [Static audit](docs/repository-audit.md) |
197
+ | Diagnose a blockage | [Runtime doctor](docs/runtime-doctor.md) · [Reason-code guidance](docs/diagnostics.md) |
198
+ | Try a historical correction | [Unicode-regexp example](examples/git-history/README.md) |
199
+ | Qualify a correction or connect Codex | [Git workflow](docs/git-regression.md) · [Developer entry points](docs/developer-experience.md) |
200
+ | Understand attribution, controls and digests | [Proof model](docs/proof-model.md) |
201
+ | Integrate the CLI, SDK or MCP | [Integration reference](docs/reference.md) |
202
+ | Verify the actual distributed package | [Distribution checks](docs/distribution.md) · [CI evidence](docs/ci.md) |
203
+ | Extend an adapter | [Adapter protocol](docs/adapter-protocol.md) · [Architecture](docs/architecture.md) |
204
+ | Review the 1.0 scope | [Release criteria](docs/release-1.0.md) · [Roadmap](docs/roadmap.md) |
205
+ | Explore advanced evaluation work | [Profiles](docs/agentic-test-profile.md) · [Benchmarks](docs/agentic-benchmark.md) · [Calibration](docs/agentic-corpus-plan.md) |
206
+
207
+ Scientific profiles and calibration retain their own evidence requirements. Their presence does
208
+ not establish an improvement on an external product or a measured product-market fit.
209
+
210
+ ## Contribute
211
+
212
+ ```sh
213
+ pnpm check
214
+ pnpm run smoke:package
215
+ ```
216
+
217
+ Add a failing behavioral test for public contract changes. Keep execution in the engine and decision
218
+ logic in the pure core. Read [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
219
+
220
+ **Compatibility:** AssertLedger is the current name. Legacy TestForge aliases and versioned wire
221
+ identifiers remain available so existing integrations and evidence can be replayed.
222
+ See the [migration guide](docs/migration-testforge-to-assertledger.md).
223
+
224
+ Licensed under [MIT](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,51 @@
1
+ # Security policy
2
+
3
+ ## Execution boundary
4
+
5
+ AssertLedger executes repository code, world overlays, adapter code, and candidate tests. The
6
+ `trusted-local` backend is explicitly `UNSANDBOXED`: temporary workspaces, a reduced environment,
7
+ bounded output, and process timeouts reduce accidental damage, but they do not contain hostile code.
8
+ Timeout enforcement and process-tree termination are best effort and depend on local host facilities.
9
+
10
+ Do not run untrusted or adversarial candidates with `trusted-local` on a developer workstation or a
11
+ CI runner containing secrets. Use a separately administered container or VM boundary with network
12
+ disabled, no host sockets, no credentials, a non-root user, a read-only base image, and CPU, memory,
13
+ PID, disk, and time limits. AssertLedger v0.1 records the achieved isolation level; it does not claim to
14
+ provide an OS sandbox.
15
+
16
+ Candidate files are restricted to configured test roots. Absolute paths, traversal segments, path
17
+ segments ending in a dot or space, and NTFS alternate data stream syntax are rejected. Repository
18
+ symlinks are not silently omitted: AssertLedger rejects a symlink unless an excluded path segment keeps
19
+ it outside the inventory and snapshot. Overlay writes also reject symlink destinations discovered in
20
+ the workspace. Commands run from executable and argument arrays with `shell: false`.
21
+
22
+ Environment allowlists cannot include `NODE_OPTIONS` or names beginning with `TESTFORGE_` or
23
+ `NODE_TEST_`, using case-insensitive comparison. AssertLedger reserves these names for runner custody.
24
+
25
+ These checks protect the intended write boundary; they do not make execution safe. The source
26
+ repository, operator-supplied worlds and policy, dependencies, runner adapter, host, and AssertLedger
27
+ engine remain part of the trusted computing base.
28
+
29
+ ## Semantic boundary
30
+
31
+ A `VERIFIED` decision means only that the selected candidate produced the policy-required,
32
+ repeatable observations in the declared worlds. It is not proof of program correctness, absence of
33
+ flakiness, absence of bugs, complete fault detection, or resistance to a candidate designed to
34
+ recognize the worlds.
35
+
36
+ Manifest digests detect modification; they do not authenticate the producer or prove that reported
37
+ observations were truthful. Use an external signing and attestation system when provenance identity
38
+ matters.
39
+
40
+ The repository digest omits `.git`, `.testforge`, `node_modules`, and operator-excluded path segments.
41
+ The manifest stores repository, candidate, world, executable, and process-output digests where the
42
+ adapter supplies them; it does not embed the repository snapshot, overlay bodies, raw logs, or
43
+ effective environment values. The built-in `node:test` adapter records its resolved executable real
44
+ path, Node.js version, and executable SHA-256 digest. The structured-command adapter does not resolve
45
+ or hash its executable. Preserve and attest missing materials separately when they affect an audit or
46
+ reproduction claim.
47
+
48
+ ## Reporting a vulnerability
49
+
50
+ Until a private security contact is published, open a GitHub security advisory on the repository.
51
+ Do not include exploit payloads or secrets in a public issue.
@@ -0,0 +1,15 @@
1
+ # Agentic Test Profile corpus
2
+
3
+ This scaffold accumulates evidence for hypotheses H1-H4. It is not an optimization loop and it
4
+ does not alter AssertLedger's deterministic `VERIFIED` verdict.
5
+
6
+ - `public/` contains reviewable `*.case.json` evidence that may be evaluated with per-case feedback.
7
+ - `private/` is the physically separate holdout. Only aggregate H1-H4 counts may leave that split.
8
+
9
+ Each case must have a canonical paired `*.provenance.json`. The evaluator also requires an
10
+ externally pinned trust policy and expected policy digest; source IDs are never self-authenticating.
11
+
12
+ The evaluator remains `NOT_READY` until it validates at least 20 cases from at least three sources,
13
+ including non-empty public and private splits and evaluable evidence for every hypothesis.
14
+ Unsigned legacy cases remain parseable but cannot satisfy readiness. See
15
+ `docs/agentic-corpus-provenance.md` for the migration and non-claims.
@@ -0,0 +1,5 @@
1
+ # Public corpus split
2
+
3
+ Place reviewable Agentic Test Profile v1 files here with the suffix `*.case.json`. Do not fabricate
4
+ cases to satisfy readiness gates; each source revision must be immutable and independently auditable.
5
+ Pair every case with a canonical `<basename>.provenance.json`; do not store private keys here.