@tiphys/kernel 0.0.0 → 0.2.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 (207) hide show
  1. package/AGENTS.md +663 -0
  2. package/LICENSE +202 -0
  3. package/assurance-modes.yaml +299 -0
  4. package/checklists/clean-room.yaml +325 -0
  5. package/checklists/env-failure-diagnosis.yaml +68 -0
  6. package/checklists/flake-playbook.yaml +68 -0
  7. package/checklists/hazard-review.yaml +144 -0
  8. package/checklists/plan-review.yaml +103 -0
  9. package/dist/bin/tiphys.d.ts +2 -0
  10. package/dist/bin/tiphys.js +92 -0
  11. package/dist/src/adapters/load.d.ts +202 -0
  12. package/dist/src/adapters/load.js +440 -0
  13. package/dist/src/brief.d.ts +32 -0
  14. package/dist/src/brief.js +66 -0
  15. package/dist/src/checklists.d.ts +169 -0
  16. package/dist/src/checklists.js +310 -0
  17. package/dist/src/checks.d.ts +1539 -0
  18. package/dist/src/checks.js +5025 -0
  19. package/dist/src/cli.d.ts +9 -0
  20. package/dist/src/cli.js +68 -0
  21. package/dist/src/commands/brief.d.ts +92 -0
  22. package/dist/src/commands/brief.js +343 -0
  23. package/dist/src/commands/checklist.d.ts +42 -0
  24. package/dist/src/commands/checklist.js +168 -0
  25. package/dist/src/commands/cutover.d.ts +35 -0
  26. package/dist/src/commands/cutover.js +448 -0
  27. package/dist/src/commands/doctor.d.ts +264 -0
  28. package/dist/src/commands/doctor.js +1546 -0
  29. package/dist/src/commands/gates.d.ts +9 -0
  30. package/dist/src/commands/gates.js +360 -0
  31. package/dist/src/commands/init.d.ts +30 -0
  32. package/dist/src/commands/init.js +177 -0
  33. package/dist/src/commands/lock.d.ts +34 -0
  34. package/dist/src/commands/lock.js +340 -0
  35. package/dist/src/commands/mode.d.ts +40 -0
  36. package/dist/src/commands/mode.js +134 -0
  37. package/dist/src/commands/next.d.ts +130 -0
  38. package/dist/src/commands/next.js +597 -0
  39. package/dist/src/commands/plan.d.ts +20 -0
  40. package/dist/src/commands/plan.js +105 -0
  41. package/dist/src/commands/pool.d.ts +1 -0
  42. package/dist/src/commands/pool.js +139 -0
  43. package/dist/src/commands/resume.d.ts +1 -0
  44. package/dist/src/commands/resume.js +88 -0
  45. package/dist/src/commands/spawn.d.ts +1 -0
  46. package/dist/src/commands/spawn.js +195 -0
  47. package/dist/src/commands/status.d.ts +21 -0
  48. package/dist/src/commands/status.js +122 -0
  49. package/dist/src/commands/sync.d.ts +47 -0
  50. package/dist/src/commands/sync.js +341 -0
  51. package/dist/src/commands/teardown.d.ts +1 -0
  52. package/dist/src/commands/teardown.js +87 -0
  53. package/dist/src/commands/tuition.d.ts +21 -0
  54. package/dist/src/commands/tuition.js +218 -0
  55. package/dist/src/commands/validate.d.ts +78 -0
  56. package/dist/src/commands/validate.js +430 -0
  57. package/dist/src/commands/watch.d.ts +1 -0
  58. package/dist/src/commands/watch.js +172 -0
  59. package/dist/src/cutover.d.ts +584 -0
  60. package/dist/src/cutover.js +1444 -0
  61. package/dist/src/exclusion.d.ts +389 -0
  62. package/dist/src/exclusion.js +843 -0
  63. package/dist/src/exec/env.d.ts +278 -0
  64. package/dist/src/exec/env.js +334 -0
  65. package/dist/src/fleet.d.ts +223 -0
  66. package/dist/src/fleet.js +298 -0
  67. package/dist/src/gates/adapters/http-json.d.ts +5 -0
  68. package/dist/src/gates/adapters/http-json.js +283 -0
  69. package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
  70. package/dist/src/gates/adapters/migrations-command.js +373 -0
  71. package/dist/src/gates/citations.d.ts +408 -0
  72. package/dist/src/gates/citations.js +1169 -0
  73. package/dist/src/gates/coverage.d.ts +375 -0
  74. package/dist/src/gates/coverage.js +836 -0
  75. package/dist/src/gates/credentials.d.ts +233 -0
  76. package/dist/src/gates/credentials.js +752 -0
  77. package/dist/src/gates/deploy.d.ts +1 -0
  78. package/dist/src/gates/deploy.js +33 -0
  79. package/dist/src/gates/gate-classes.d.ts +56 -0
  80. package/dist/src/gates/gate-classes.js +633 -0
  81. package/dist/src/gates/manifest.d.ts +99 -0
  82. package/dist/src/gates/manifest.js +208 -0
  83. package/dist/src/gates/merge-preconditions.d.ts +319 -0
  84. package/dist/src/gates/merge-preconditions.js +932 -0
  85. package/dist/src/gates/migrations.d.ts +1 -0
  86. package/dist/src/gates/migrations.js +36 -0
  87. package/dist/src/gates/pin.d.ts +114 -0
  88. package/dist/src/gates/pin.js +154 -0
  89. package/dist/src/gates/red-witness.d.ts +22 -0
  90. package/dist/src/gates/red-witness.js +482 -0
  91. package/dist/src/gates/release.d.ts +283 -0
  92. package/dist/src/gates/release.js +820 -0
  93. package/dist/src/gates/result.d.ts +116 -0
  94. package/dist/src/gates/result.js +91 -0
  95. package/dist/src/gates/run.d.ts +614 -0
  96. package/dist/src/gates/run.js +1614 -0
  97. package/dist/src/gates/schemas/citation-config.schema.json +59 -0
  98. package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
  99. package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
  100. package/dist/src/gates/schemas/gate-result.schema.json +160 -0
  101. package/dist/src/gates/schemas/phase-declaration.schema.json +87 -0
  102. package/dist/src/gates/schemas/release-record.schema.json +119 -0
  103. package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
  104. package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
  105. package/dist/src/gates/scope.d.ts +131 -0
  106. package/dist/src/gates/scope.js +1018 -0
  107. package/dist/src/gates/suite.d.ts +217 -0
  108. package/dist/src/gates/suite.js +968 -0
  109. package/dist/src/gates/validate.d.ts +121 -0
  110. package/dist/src/gates/validate.js +414 -0
  111. package/dist/src/hooks.d.ts +84 -0
  112. package/dist/src/hooks.js +125 -0
  113. package/dist/src/index.d.ts +31 -0
  114. package/dist/src/index.js +30 -0
  115. package/dist/src/liveness.d.ts +321 -0
  116. package/dist/src/liveness.js +396 -0
  117. package/dist/src/lock.d.ts +256 -0
  118. package/dist/src/lock.js +792 -0
  119. package/dist/src/model-resolution.d.ts +159 -0
  120. package/dist/src/model-resolution.js +307 -0
  121. package/dist/src/modes.d.ts +149 -0
  122. package/dist/src/modes.js +258 -0
  123. package/dist/src/path-identity.d.ts +34 -0
  124. package/dist/src/path-identity.js +48 -0
  125. package/dist/src/plan.d.ts +73 -0
  126. package/dist/src/plan.js +153 -0
  127. package/dist/src/pool.d.ts +326 -0
  128. package/dist/src/pool.js +988 -0
  129. package/dist/src/roles.d.ts +461 -0
  130. package/dist/src/roles.js +776 -0
  131. package/dist/src/spawn.d.ts +482 -0
  132. package/dist/src/spawn.js +1003 -0
  133. package/dist/src/status.d.ts +116 -0
  134. package/dist/src/status.js +148 -0
  135. package/dist/src/task.d.ts +504 -0
  136. package/dist/src/task.js +307 -0
  137. package/dist/src/teardown.d.ts +39 -0
  138. package/dist/src/teardown.js +422 -0
  139. package/dist/src/tuition.d.ts +159 -0
  140. package/dist/src/tuition.js +311 -0
  141. package/dist/src/validate.d.ts +263 -0
  142. package/dist/src/validate.js +742 -0
  143. package/dist/src/version.d.ts +3 -0
  144. package/dist/src/version.js +38 -0
  145. package/dist/src/watcher.d.ts +275 -0
  146. package/dist/src/watcher.js +849 -0
  147. package/dist/src/witness/run.d.ts +299 -0
  148. package/dist/src/witness/run.js +1373 -0
  149. package/dist/src/witness/spec.d.ts +270 -0
  150. package/dist/src/witness/spec.js +475 -0
  151. package/dist/tsconfig.src.tsbuildinfo +1 -0
  152. package/gate-registry.yaml +526 -0
  153. package/gates.manifest.json +257 -0
  154. package/package.json +72 -3
  155. package/role-model-config.yaml +88 -0
  156. package/roles/README.md +128 -0
  157. package/roles/_shared-dispatch-contract.md +87 -0
  158. package/roles/adversarial-plan-reviewer.md +80 -0
  159. package/roles/clean-room-reviewer.md +140 -0
  160. package/roles/implementer.md +463 -0
  161. package/roles/investigator.md +138 -0
  162. package/roles/plan-writer.md +95 -0
  163. package/schemas/README.md +82 -0
  164. package/schemas/assurance-modes.schema.json +264 -0
  165. package/schemas/charter.schema.json +185 -0
  166. package/schemas/checklist.schema.json +114 -0
  167. package/schemas/cutover-state.schema.json +64 -0
  168. package/schemas/decision-record.schema.json +88 -0
  169. package/schemas/executor-record.schema.json +36 -0
  170. package/schemas/final-report.schema.json +90 -0
  171. package/schemas/finding.schema.json +106 -0
  172. package/schemas/gate-registry.schema.json +260 -0
  173. package/schemas/mechanism-index.schema.json +94 -0
  174. package/schemas/model-resolution.schema.json +362 -0
  175. package/schemas/plan.schema.json +300 -0
  176. package/schemas/report.schema.json +579 -0
  177. package/schemas/role-brief.schema.json +105 -0
  178. package/schemas/role-model-config.schema.json +90 -0
  179. package/schemas/status-line.schema.json +40 -0
  180. package/schemas/tuition.schema.json +191 -0
  181. package/schemas/verdict.schema.json +295 -0
  182. package/schemas/work-history.schema.json +183 -0
  183. package/schemas/write-bypass.schema.json +69 -0
  184. package/templates/charter.example.yaml +54 -0
  185. package/templates/decision-record.example.yaml +27 -0
  186. package/templates/final-report.example.yaml +80 -0
  187. package/templates/plan.example.yaml +87 -0
  188. package/templates/report.example.yaml +236 -0
  189. package/templates/warnings.md +74 -0
  190. package/templates/work-history.example.yaml +185 -0
  191. package/tuition/README.md +76 -0
  192. package/tuition/T-001.yaml +48 -0
  193. package/tuition/T-002.yaml +51 -0
  194. package/tuition/T-003.yaml +100 -0
  195. package/tuition/T-004.yaml +52 -0
  196. package/tuition/T-005.yaml +72 -0
  197. package/tuition/T-006.yaml +81 -0
  198. package/tuition/T-007.yaml +56 -0
  199. package/tuition/T-008.yaml +111 -0
  200. package/tuition/T-009.yaml +50 -0
  201. package/tuition/T-015.yaml +36 -0
  202. package/tuition/T-016.yaml +36 -0
  203. package/tuition/T-017.yaml +46 -0
  204. package/tuition/T-018.yaml +84 -0
  205. package/tuition/T-021.yaml +40 -0
  206. package/tuition/T-022.yaml +36 -0
  207. package/tuition/mechanism-index.yaml +256 -0
@@ -0,0 +1,270 @@
1
+ import type { SchemaDocument } from "../gates/validate.ts";
2
+ /**
3
+ * WITNESS SPECIFICATIONS (kernel plan M2, M2-P2 step 2).
4
+ *
5
+ * One JSON document per behavior at `witness/<behavior-id>.json`, durable
6
+ * and repository-level rather than phase-scoped (M2R-002, M2-D-14). A spec
7
+ * declares which named tests guard a behavior and against WHICH dangerous
8
+ * states they have been demonstrated red. `dangerousStates` is an ARRAY of
9
+ * one or more members by design: rule (g), "one witness is not a class",
10
+ * needs something to require rather than something to bolt on.
11
+ *
12
+ * Kind-specific member fields cannot be expressed in the closed keyword set
13
+ * (no `if`/`then`, no `oneOf`; M2-D-04, DR-0013), so they are enforced here
14
+ * in code, emitting the SAME `INVALID <json-pointer> <message>` diagnostic
15
+ * contract the schema validator emits. This is the pattern the delivered
16
+ * `src/gates/manifest.ts` established; a second diagnostic dialect would be
17
+ * a review finding.
18
+ *
19
+ * M2-C-6: every spec path comes from configuration or from a directory
20
+ * walk, so every read goes through the DELIVERED `classifyEntry` and
21
+ * `readRegularFileIfPresent` in src/task.ts. A named pipe at a spec path is
22
+ * a reported refusal, never a blocked open.
23
+ */
24
+ export type WitnessClass = "additive" | "destructive" | "classification";
25
+ export declare const WITNESS_CLASSES: readonly WitnessClass[];
26
+ export type DangerousStateMember = {
27
+ kind: "baseline-ref";
28
+ ref: string;
29
+ } | {
30
+ kind: "patch";
31
+ patch: string;
32
+ } | {
33
+ kind: "mutation";
34
+ file: string;
35
+ find: string;
36
+ replace: string;
37
+ };
38
+ export interface ConsumesExternalOutput {
39
+ program: string;
40
+ captures: string[];
41
+ provenance: string;
42
+ }
43
+ export interface WitnessSpec {
44
+ id: string;
45
+ behavior: string;
46
+ tests: string[];
47
+ class: WitnessClass;
48
+ dangerousStates: DangerousStateMember[];
49
+ deterministic: boolean;
50
+ /** Red repetitions per member. The plan's default is 5. */
51
+ repeats: number;
52
+ consumesExternalOutput?: ConsumesExternalOutput;
53
+ }
54
+ export declare const DEFAULT_REPEATS = 5;
55
+ /** The witness-spec schema document, loaded once through the closed-set loader. */
56
+ export declare function witnessSpecSchema(): SchemaDocument;
57
+ /** Absolute path of the schema document, for self-check style consumers. */
58
+ export declare function witnessSpecSchemaPath(): string;
59
+ /**
60
+ * Validate an already-parsed witness spec. Returns `INVALID <pointer>
61
+ * <message>` lines in the contract's deterministic order.
62
+ */
63
+ export declare function validateWitnessSpecDocument(document: unknown): string[];
64
+ export type WitnessSpecLoad = {
65
+ ok: true;
66
+ spec: WitnessSpec;
67
+ sha256: string;
68
+ body: string;
69
+ } | {
70
+ ok: false;
71
+ reason: string;
72
+ diagnostics: string[];
73
+ };
74
+ /**
75
+ * Validate and materialise one spec from its BODY, with `label` naming the
76
+ * source in any reason. Split out of `loadWitnessSpec` so a spec can also be
77
+ * materialised from a git object (`git show <ref>:<path>`) rather than only
78
+ * from a working-tree path: the per-member ownership derivation below needs
79
+ * the merge-base version of a spec, which has no path.
80
+ */
81
+ export declare function parseWitnessSpec(body: string, label: string): WitnessSpecLoad;
82
+ /** Load and validate one spec from a path the caller supplied (M2-C-6). */
83
+ export declare function loadWitnessSpec(path: string): WitnessSpecLoad;
84
+ /**
85
+ * How a patch member's BODY is read, one reader per revision. A patch member's
86
+ * `patch` field is a PATH; the dangerous state it declares lives in the file at
87
+ * that path, so establishing whether the member changed needs the body on BOTH
88
+ * sides, at the merge base and at the audited head.
89
+ */
90
+ export interface PatchBodyReaders {
91
+ head: (patchPath: string) => string | undefined;
92
+ baseline: (patchPath: string) => string | undefined;
93
+ }
94
+ /**
95
+ * CANONICAL FORM OF ONE DANGEROUS-STATE MEMBER: everything that determines the
96
+ * dangerous state, in a fixed order, JSON-encoded. Two members are the SAME
97
+ * member when their canonical forms are equal. Field order inside the source
98
+ * document is not significant, so reformatting a spec is not authorship.
99
+ *
100
+ * PER KIND, and the three kinds are NOT alike, which is the correction fix
101
+ * round 1 makes:
102
+ *
103
+ * - `mutation` declares `file`, `find` and `replace`, and all three are INLINE
104
+ * in the spec document. The canonical form carries all three, so it is
105
+ * complete: nothing outside the document can change what this member does.
106
+ * - `patch` declares one field, `patch`, and it is a POINTER. The dangerous
107
+ * state is the patch FILE'S BODY, which lives outside the spec document
108
+ * entirely. Keying on the path alone made a member whose body was rewritten
109
+ * top to bottom compare EQUAL to its own previous version, so a phase could
110
+ * turn a dangerous state about file X into one about an unrelated file Y and
111
+ * be judged not to have authored it. The body's sha256 is therefore part of
112
+ * the canonical form. An unreadable body yields `undefined`, which the caller
113
+ * treats as "cannot be established", never as "unchanged".
114
+ * - `baseline-ref` declares `ref`, which is ALSO a pointer: the dangerous state
115
+ * is the whole tree at that ref, and a ref moves. It is deliberately NOT
116
+ * resolved, for two reasons stated rather than assumed. First, rule (d)
117
+ * SKIPS `baseline-ref` members outright (src/witness/run.ts:1295), so a
118
+ * baseline-ref member's ownership has no consequence anywhere: ownership is
119
+ * read in exactly one place and that place skips this kind. Second, resolving
120
+ * the ref would attribute a ref moved by SOMEBODY ELSE to this phase, which
121
+ * is the opposite of what an authorship derivation should say. If rule (d)
122
+ * ever stops skipping this kind, this decision has to be revisited, and the
123
+ * fix would be the patch one: fold the resolved tree, not the ref name.
124
+ */
125
+ export declare function canonicalMember(member: DangerousStateMember, readPatchBody: (patchPath: string) => string | undefined): string | undefined;
126
+ /**
127
+ * HAS THE SPEC BEEN RE-POINTED, as opposed to strengthened?
128
+ *
129
+ * A witness spec says "these named TESTS guard this BEHAVIOR, and here are the
130
+ * dangerous states they have been shown red against". Rule (d) is an obligation
131
+ * on that sentence, not only on its members: it exists so a phase cannot claim
132
+ * coverage using a dangerous state about code it did not touch. So a phase that
133
+ * rewrites the sentence takes the obligation for every state offered under it.
134
+ *
135
+ * THE TEST IS DIRECTIONAL, NOT EQUALITY, AND THAT DISTINCTION IS THE WHOLE
136
+ * FUNCTION. Fix round 1 compared `[behavior, sortedTests]` for equality, which
137
+ * is wrong in the safe direction and was caught by delta verification: a phase
138
+ * that ADDS one guarding test to an existing spec, changing no member and no
139
+ * behavior, was told its untouched siblings had to intersect the diff. Adding a
140
+ * test is not a re-point. It is strictly strengthening, and that is a MEASURED
141
+ * property of the harness rather than a judgement:
142
+ *
143
+ * - RED arm, src/witness/run.ts:918: `red: exitCode !== 0 && failed.length
144
+ * === tests.length`. A repetition counts as red only when EVERY named test
145
+ * failed, so an added test must ALSO redden against every declared
146
+ * dangerous state or the member stops being red and the spec goes red.
147
+ * - GREEN arm, src/witness/run.ts:1676: `headGreen = exitCode === 0 &&
148
+ * passedNamedTests.length === spec.tests.length`. An added test must ALSO
149
+ * pass at head.
150
+ *
151
+ * Both arms gain an obligation, neither loses one, and both are demonstrated by
152
+ * EXECUTION rather than accepted on trust. So there is nothing for rule (d) to
153
+ * police in an extension: no new dangerous state is declared, and the existing
154
+ * states' burden only grows.
155
+ *
156
+ * WHAT STILL COUNTS AS RE-POINTING, and each is a real relaxation:
157
+ *
158
+ * - `behavior` changed. The sentence is now about something else, and an older
159
+ * phase's dangerous state becomes evidence for a behavior this phase
160
+ * introduced. Any change, in either direction.
161
+ * - A baseline test name DROPPED. That relaxes both arms above: one fewer test
162
+ * must redden against every member and one fewer must pass at head. A phase
163
+ * can drop the test that was doing the work and keep the coverage claim.
164
+ * - A test name SWAPPED, which is a drop plus an addition and is caught by the
165
+ * drop half.
166
+ *
167
+ * So the predicate is `behavior` equality AND `baselineTests` being a SUBSET of
168
+ * `headTests`. Reordering is not a change: the comparison is over sets, which
169
+ * is the same positional indifference the member matching gets from comparing
170
+ * canonical forms rather than indices. Duplicates in `tests` collapse under set
171
+ * semantics, and that is harmless because both arms above count `tests`
172
+ * positionally on the same array, so a duplicate adds an obligation to each
173
+ * side identically.
174
+ *
175
+ * WHY MEMBERS ARE NOT TREATED THE SAME WAY, since adding a member also only
176
+ * ADDS an obligation (every member must independently redden). Because a member
177
+ * IS the thing rule (d) is an obligation on, and a test is not. An added member
178
+ * is a newly declared dangerous state, and checking that a declared dangerous
179
+ * state relates to the phase's own diff is the entire purpose of the rule; make
180
+ * added members exempt and rule (d) is empty. An added test declares no
181
+ * dangerous state at all.
182
+ *
183
+ * WHICH FIELDS ARE CONSIDERED, AND WHY THE OTHERS ARE NOT. The test applied to
184
+ * every field of the closed schema was: does changing THIS FIELD ALONE let a
185
+ * phase assert something new about its own diff while reusing a dangerous state
186
+ * somebody else authored?
187
+ *
188
+ * - `behavior`, `tests`: YES, in the directional sense above. IN.
189
+ * - `class`: NO. It selects which refusal rules apply (rules (a), (e), (g)) and
190
+ * none of them is ownership-gated, so a class change is evaluated in full on
191
+ * every run whether the spec is owned or not. A weakened class is refused by
192
+ * rule (e), which DERIVES the class from the named tests' sources rather than
193
+ * trusting the declaration. OUT, and including it would buy false reds on
194
+ * class fix-ups while closing no attack.
195
+ * - `id`: NO. It is the handle, checked for collisions at
196
+ * src/gates/red-witness.ts:263. Renaming a spec asserts nothing new. OUT.
197
+ * - `deterministic`, `repeats`: NO. They set the red THRESHOLD in the member
198
+ * execution loop (src/witness/run.ts:1517 and src/witness/run.ts:1605), which
199
+ * runs for every member of every evaluated spec regardless of ownership. OUT.
200
+ * - `consumesExternalOutput`: NO. Rules (c) and (f) read it and neither is
201
+ * ownership-gated. OUT.
202
+ */
203
+ export declare function claimRePointed(headSpec: WitnessSpec, baselineSpec: WitnessSpec): boolean;
204
+ /**
205
+ * WHICH MEMBERS OF A SPEC THIS PHASE AUTHORED (the ownership scope of rule
206
+ * (d)).
207
+ *
208
+ * Rule (d) requires a declared dangerous state to intersect the phase diff, so
209
+ * that a phase cannot add a witness about unrelated code and claim coverage.
210
+ * That obligation is a claim about AUTHORSHIP, and authorship is per MEMBER.
211
+ * Deriving it from the spec FILE appearing in the diff is one granularity too
212
+ * coarse: it makes every sibling member of an edited file acquire an obligation
213
+ * its author never took on. Measured by the M3 exit test at stage E1.6, where
214
+ * repairing one member's quoted source line reddened two untouched members of
215
+ * the same file.
216
+ *
217
+ * THREE WAYS A PHASE AUTHORS, and the round-1 reviews found that only the first
218
+ * was implemented:
219
+ *
220
+ * 1. A member whose CANONICAL FORM changed, which now includes a patch body.
221
+ * 2. A member with no counterpart at the merge base. Matching is a MULTISET
222
+ * consume rather than a set membership test, so a second copy of an existing
223
+ * member is authored (rule (g) is what refuses that copy, and it must still
224
+ * see it as new).
225
+ * 3. THE CLAIM WAS RE-POINTED. Then every member is authored, because every
226
+ * declared dangerous state is now being offered as evidence for a sentence
227
+ * this phase wrote. There is no narrower attribution available: a claim
228
+ * change cannot be pinned on one member, since the claim is a property of
229
+ * the document. This is the ONLY whole-spec trigger, and keeping it that
230
+ * narrow is the point. An edit to a sibling member, a `repeats` bump, a
231
+ * reformat, a rename, and ADDING A GUARDING TEST all still author nothing,
232
+ * which is what the converse tests hold. `claimRePointed` carries the
233
+ * derivation of why extension is safe and dropping a test is not.
234
+ *
235
+ * `baselineSpec` is `undefined` when the spec did not exist at the merge base,
236
+ * did not parse there, or could not be read there. All three mean the phase is
237
+ * answerable for the whole file, so every member is owned. That is the
238
+ * conservative direction, and it is applied identically to an unreadable patch
239
+ * BODY on either side: the failure mode of this derivation is a member wrongly
240
+ * EXEMPTED, so anything the derivation cannot establish keeps the obligation
241
+ * rather than dropping it.
242
+ */
243
+ export declare function phaseOwnedMemberIndices(headSpec: WitnessSpec, baselineSpec: WitnessSpec | undefined, readers: PatchBodyReaders): Set<number>;
244
+ export type WitnessSpecListing = {
245
+ ok: true;
246
+ paths: string[];
247
+ } | {
248
+ ok: false;
249
+ reason: string;
250
+ };
251
+ /**
252
+ * The spec files of a witness directory: the `.json` entries directly inside
253
+ * it, sorted by name. Deliberately NOT recursive: the layout is one document
254
+ * per behavior at `witness/<behavior-id>.json` (M2-D-14), and capture files
255
+ * live in subdirectories that a recursive walk would misread as specs.
256
+ *
257
+ * An absent directory is an empty corpus, not an error: whether that is
258
+ * acceptable is the GATE's coverage decision, not a listing failure.
259
+ */
260
+ export declare function listWitnessSpecFiles(dir: string): WitnessSpecListing;
261
+ /**
262
+ * The repository-relative files a member's dangerous state touches.
263
+ * mutation: the named file. patch: the paths in the patch's own headers,
264
+ * parsed from `diff --git a/<x> b/<y>` lines with `+++`/`---` fallbacks.
265
+ * baseline-ref: none; an absent-feature baseline is not a file-level
266
+ * dangerous state (work-history decision D-P2-2).
267
+ */
268
+ export declare function memberTouchedFiles(member: DangerousStateMember, readPatchBody: (patchPath: string) => string | undefined): string[];
269
+ /** One-line description of a member, used in reasons and records. */
270
+ export declare function describeMember(member: DangerousStateMember): string;