@mmnto/totem 1.79.0 → 1.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-schema.d.ts +1635 -256
- package/dist/compiler-schema.d.ts.map +1 -1
- package/dist/compiler-schema.js +110 -10
- package/dist/compiler-schema.js.map +1 -1
- package/dist/compiler-schema.test.js +164 -7
- package/dist/compiler-schema.test.js.map +1 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +1 -1
- package/dist/compiler.js.map +1 -1
- package/dist/config-schema.d.ts +6 -6
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/spine/authored-rule.d.ts +1030 -32
- package/dist/spine/authored-rule.d.ts.map +1 -1
- package/dist/spine/authored-rule.js +115 -1
- package/dist/spine/authored-rule.js.map +1 -1
- package/dist/spine/authored-rule.test.js +10 -4
- package/dist/spine/authored-rule.test.js.map +1 -1
- package/dist/spine/authoring-ledger.d.ts +204 -0
- package/dist/spine/authoring-ledger.d.ts.map +1 -0
- package/dist/spine/authoring-ledger.js +220 -0
- package/dist/spine/authoring-ledger.js.map +1 -0
- package/dist/spine/authoring-ledger.test.d.ts +2 -0
- package/dist/spine/authoring-ledger.test.d.ts.map +1 -0
- package/dist/spine/authoring-ledger.test.js +144 -0
- package/dist/spine/authoring-ledger.test.js.map +1 -0
- package/dist/spine/compile.test.js +5 -2
- package/dist/spine/compile.test.js.map +1 -1
- package/dist/spine/corpus-dispositions.d.ts +4 -4
- package/dist/spine/preimage-differential.d.ts +112 -0
- package/dist/spine/preimage-differential.d.ts.map +1 -0
- package/dist/spine/preimage-differential.js +122 -0
- package/dist/spine/preimage-differential.js.map +1 -0
- package/dist/spine/preimage-differential.test.d.ts +2 -0
- package/dist/spine/preimage-differential.test.d.ts.map +1 -0
- package/dist/spine/preimage-differential.test.js +223 -0
- package/dist/spine/preimage-differential.test.js.map +1 -0
- package/dist/spine/windtunnel-lock.d.ts +6 -6
- package/dist/store/lance-schema.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-rule.d.ts","sourceRoot":"","sources":["../../src/spine/authored-rule.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"authored-rule.d.ts","sourceRoot":"","sources":["../../src/spine/authored-rule.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,yCAAuC,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAQlE;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;IAEjC;;;;;;;;;OASG;;;;;;;;;;;EAQH,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,+GAA+G;AAC/G,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAS/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAUlE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;IACnC;;;;;;;;;;OAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,mBAAmB,CAoCzF"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// this core check takes it injected (DI), staying network-free + LLM-free.
|
|
17
17
|
import { createHash } from 'node:crypto';
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import { AuthoredProvenanceRecordSchema } from '../compiler-schema.js';
|
|
19
|
+
import { AuthoredFixtureSchema, AuthoredProvenanceRecordSchema, isIso8601CalendarDate, } from '../compiler-schema.js';
|
|
20
20
|
/** The matcher engines an authored rule may declare (mirrors `CompiledRule.engine`). */
|
|
21
21
|
export const DeclaredEngineSchema = z.enum(['regex', 'ast', 'ast-grep']);
|
|
22
22
|
// The §3 eligibility-basis forms: `whitelist:<class>` (the cert-#1 deterministic basis,
|
|
@@ -106,6 +106,120 @@ export const AuthoredRuleRecordSchema = z.object({
|
|
|
106
106
|
/** Zero-trust mint (ADR-089 / ADR-112 §1) — always literally `true`. */
|
|
107
107
|
unverified: z.literal(true),
|
|
108
108
|
});
|
|
109
|
+
// ── SLICE B — the authoring INTAKE schema (ADR-112 §3/§8, FM(d)) ──────────────
|
|
110
|
+
//
|
|
111
|
+
// `AuthoredRuleInput` is the STRICT shape a human may supply in
|
|
112
|
+
// `.totem/spine/authored-rules.yaml`. It is DELIBERATELY distinct from
|
|
113
|
+
// `AuthoredRuleRecord`: the author sets ONLY the fields they legitimately own —
|
|
114
|
+
// the matcher, the declared engine + claimed structural class, the defect
|
|
115
|
+
// anchor, the fixtures, the accelerant origin. Every PRODUCER-owned field is
|
|
116
|
+
// REJECTED at parse (`.strict()` ⇒ unknown keys fail), so an author cannot
|
|
117
|
+
// hand-edit the YAML to inject a `structuralEligibility` / `decidable` / `ruleId`
|
|
118
|
+
// / `disposition` / `judgedBy` verdict — those keys are simply not expressible.
|
|
119
|
+
// The reader (slice B, CLI) re-runs `evaluateStructuralEligibility` over the DI
|
|
120
|
+
// whitelist and mints/upserts the id ITSELF; the author's `structuralClass` is a
|
|
121
|
+
// CLAIM that the independent check decides, never a self-certification (FM(d) /
|
|
122
|
+
// the greptile-#3 trust boundary). A file that already looks like an
|
|
123
|
+
// `AuthoredRuleRecord[]` (carrying `structuralEligibility`/`ruleId`/…) therefore
|
|
124
|
+
// fails the read as the WRONG SHAPE — it is never accepted as an "advanced" form.
|
|
125
|
+
//
|
|
126
|
+
// Identity/metadata strings are `.transform(trim)` BEFORE the refine (GCA-high
|
|
127
|
+
// diff-review): a non-mutating `.refine` would let `"alice "` (trailing space)
|
|
128
|
+
// bypass the `judgedBy !== author` independence check and mint a DIFFERENT ruleId
|
|
129
|
+
// for a semantically-identical input. `dslSource` is the one string NOT trimmed —
|
|
130
|
+
// trimming a matcher could change its meaning (leading/trailing pattern chars).
|
|
131
|
+
export const AuthoredRuleInputSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
/** Agent-id or operator handle — attributable (mirrors the provenance field). Trimmed. */
|
|
134
|
+
author: z
|
|
135
|
+
.string()
|
|
136
|
+
.transform((s) => s.trim())
|
|
137
|
+
.refine((s) => s.length > 0, { message: 'author must be a non-empty, attributable handle' }),
|
|
138
|
+
/**
|
|
139
|
+
* ISO-8601 authoring date — trimmed + calendar-validated at the INTAKE boundary
|
|
140
|
+
* (CR diff-review): the same `isIso8601CalendarDate` the record provenance uses,
|
|
141
|
+
* so a malformed `not-a-date` fails here with a clean `CONFIG_INVALID` instead of
|
|
142
|
+
* escaping to a raw ZodError at record construction (pass 1).
|
|
143
|
+
*/
|
|
144
|
+
authoredAt: z
|
|
145
|
+
.string()
|
|
146
|
+
.transform((s) => s.trim())
|
|
147
|
+
.refine(isIso8601CalendarDate, {
|
|
148
|
+
message: 'authoredAt must be a valid ISO-8601 calendar date (YYYY-MM-DD or a full timestamp)',
|
|
149
|
+
}),
|
|
150
|
+
/** The declared DEFECT the rule targets — the pre-image, not its fix (ADR-110 §4 TP-def). Trimmed. */
|
|
151
|
+
targetDefect: z
|
|
152
|
+
.string()
|
|
153
|
+
.transform((s) => s.trim())
|
|
154
|
+
.refine((s) => s.length > 0, {
|
|
155
|
+
message: 'targetDefect must be a non-empty defect description',
|
|
156
|
+
}),
|
|
157
|
+
/** The matcher engine the author declares; the eligibility check confirms it can represent the class. */
|
|
158
|
+
declaredEngine: DeclaredEngineSchema,
|
|
159
|
+
/**
|
|
160
|
+
* The structural rule-CLASS the author CLAIMS. Fed to the INDEPENDENT
|
|
161
|
+
* `evaluateStructuralEligibility` against the DI whitelist; it is NOT stored
|
|
162
|
+
* verbatim on the record — the *verdict* (`structuralEligibility`, basis
|
|
163
|
+
* `whitelist:<class>`) is. Naming a class is a claim the check adjudicates,
|
|
164
|
+
* never a self-certification of `decidable`. Trimmed so a stray space can't
|
|
165
|
+
* cause an exact-match miss against the registry.
|
|
166
|
+
*/
|
|
167
|
+
structuralClass: z
|
|
168
|
+
.string()
|
|
169
|
+
.transform((s) => s.trim())
|
|
170
|
+
.refine((s) => s.length > 0, {
|
|
171
|
+
message: 'structuralClass must be a non-empty rule-class for the whitelist to decide',
|
|
172
|
+
}),
|
|
173
|
+
/** The human-written matcher (same DSL the compiler accepts from the miner). */
|
|
174
|
+
dslSource: z.string().refine((s) => s.trim().length > 0, {
|
|
175
|
+
message: 'dslSource must be non-empty',
|
|
176
|
+
}),
|
|
177
|
+
/** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
|
|
178
|
+
positiveFixtures: z.array(AuthoredFixtureSchema).min(1, {
|
|
179
|
+
message: 'an authored rule must declare ≥1 positive fixture (ADR-112 §3)',
|
|
180
|
+
}),
|
|
181
|
+
/** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
|
|
182
|
+
negativeFixtures: z.array(AuthoredFixtureSchema).optional(),
|
|
183
|
+
/**
|
|
184
|
+
* Accelerant lineage (§7). Optional in the YAML; the reader defaults an
|
|
185
|
+
* absent value to `{ kind: 'from-scratch' }` when constructing the record, so
|
|
186
|
+
* the persisted `origin` is always explicit (§7 lineage is never erased).
|
|
187
|
+
*/
|
|
188
|
+
origin: AuthoredOriginSchema.optional(),
|
|
189
|
+
})
|
|
190
|
+
.strict();
|
|
191
|
+
/**
|
|
192
|
+
* SLICE B — the on-disk shape of `.totem/spine/authored-rules.yaml`. A file-level
|
|
193
|
+
* authoring header carries the §5/§8 leakage-guard ATTESTATIONS once for the
|
|
194
|
+
* session (not per-rule, since all rules in one file are authored under one
|
|
195
|
+
* frozen split), followed by the rules. Slice B RECORDS these faithfully into the
|
|
196
|
+
* authoring-ledger (strategy's boundary confirm: B records `splitRef` /
|
|
197
|
+
* `authoredAfterSplit` / `fixturePrs`); the MECHANICAL verification — the split
|
|
198
|
+
* was frozen BEFORE authoring (§5.1/FM(g)), fixtures resolve train-side (§5.2),
|
|
199
|
+
* the harness is sandboxed (§5.4) — is the cert-run harness in SLICE C. The
|
|
200
|
+
* attestations are `literal(true)`: an author who cannot attest them is not
|
|
201
|
+
* authoring legitimately, so a `false` fails the read rather than recording a
|
|
202
|
+
* self-defeating attestation. `.strict()` rejects unknown header keys.
|
|
203
|
+
*/
|
|
204
|
+
export const AuthoredRulesFileSchema = z
|
|
205
|
+
.object({
|
|
206
|
+
/** The frozen split (ADR-110 §6) the rules were authored under (recorded; verified in C). Trimmed (GCA) so stray whitespace can't bypass the non-empty check or perturb the revision fingerprint. */
|
|
207
|
+
splitRef: z
|
|
208
|
+
.string()
|
|
209
|
+
.transform((s) => s.trim())
|
|
210
|
+
.refine((s) => s.length > 0, {
|
|
211
|
+
message: 'splitRef must name the frozen split the rules were authored under (ADR-112 §5.1)',
|
|
212
|
+
}),
|
|
213
|
+
/** §1(g) embargo attestation — authored AFTER the split was frozen. Always `true`; verified in C. */
|
|
214
|
+
authoredAfterSplit: z.literal(true),
|
|
215
|
+
/** §5 attestation — the author did not inspect the held-out slice. Always `true`; sandboxed in C. */
|
|
216
|
+
heldOutNonInspectionAttestation: z.literal(true),
|
|
217
|
+
/** The authored rules (≥1). */
|
|
218
|
+
rules: z.array(AuthoredRuleInputSchema).min(1, {
|
|
219
|
+
message: 'authored-rules.yaml must declare ≥1 rule',
|
|
220
|
+
}),
|
|
221
|
+
})
|
|
222
|
+
.strict();
|
|
109
223
|
/**
|
|
110
224
|
* ADR-112 §3 — the INDEPENDENT structural-eligibility check. A CLOSED registry
|
|
111
225
|
* predicate, NOT prose: `decidable` is true iff EXACTLY ONE whitelist entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-rule.js","sourceRoot":"","sources":["../../src/spine/authored-rule.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,gFAAgF;AAChF,6EAA6E;AAC7E,mEAAmE;AACnE,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,iFAAiF;AACjF,wEAAwE;AACxE,oFAAoF;AACpF,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"authored-rule.js","sourceRoot":"","sources":["../../src/spine/authored-rule.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,gFAAgF;AAChF,6EAA6E;AAC7E,mEAAmE;AACnE,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,iFAAiF;AACjF,wEAAwE;AACxE,oFAAoF;AACpF,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEx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11 @@ describe('AuthoredRuleRecord schema (ADR-112 §3)', () => {
|
|
|
47
47
|
positiveFixtures: [
|
|
48
48
|
{
|
|
49
49
|
pr: 100,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
preimageSource: {
|
|
51
|
+
kind: 'commit',
|
|
52
|
+
preimageCommitSha: 'c'.repeat(40),
|
|
53
|
+
mergeCommitSha: 'b'.repeat(40),
|
|
54
|
+
},
|
|
52
55
|
filePath: 'src/physics/step.ts',
|
|
53
56
|
matchedSpan: 'L10-L12',
|
|
54
57
|
contentHash: 'deadbeefcafe',
|
|
@@ -171,8 +174,11 @@ describe('toCompileFeed (ADR-112 §2/§8 — authored → compile-stage input)',
|
|
|
171
174
|
positiveFixtures: [
|
|
172
175
|
{
|
|
173
176
|
pr: 1,
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
preimageSource: {
|
|
178
|
+
kind: 'commit',
|
|
179
|
+
preimageCommitSha: 'b'.repeat(40),
|
|
180
|
+
mergeCommitSha: 'a'.repeat(40),
|
|
181
|
+
},
|
|
176
182
|
filePath: 'src/a.ts',
|
|
177
183
|
matchedSpan: 'L1',
|
|
178
184
|
contentHash: 'h1',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-rule.test.js","sourceRoot":"","sources":["../../src/spine/authored-rule.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAEL,wBAAwB,EACxB,6BAA6B,EAC7B,kBAAkB,EAClB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,SAAS,GAA8B;IAC3C,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE;IAC3D,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE;CAC3D,CAAC;AAEF,QAAQ,CAAC,+DAA+D,EAAE,GAAG,EAAE;IAC7E,EAAE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 'zod';
|
|
2
|
+
/** The spine subdirectory + filename the authoring-ledger lives at, under `.totem/`. */
|
|
3
|
+
export declare const AUTHORING_LEDGER_DIR = "spine";
|
|
4
|
+
export declare const AUTHORING_LEDGER_FILE = "authoring-ledger.ndjson";
|
|
5
|
+
/**
|
|
6
|
+
* ADR-112 §8 — one authoring-ledger row. `.strict()` so a malformed/extra-field
|
|
7
|
+
* row fails the read loudly (the attestation chain must not silently degrade).
|
|
8
|
+
*/
|
|
9
|
+
export declare const AuthoringLedgerEntrySchema: z.ZodObject<{
|
|
10
|
+
ruleId: z.ZodEffects<z.ZodString, string, string>;
|
|
11
|
+
author: z.ZodEffects<z.ZodString, string, string>;
|
|
12
|
+
/** Identity component — `ruleId` is seeded from `sha256(author·targetDefect)`; recorded so the upsert index can resolve a re-read to its persisted id. */
|
|
13
|
+
targetDefect: z.ZodEffects<z.ZodString, string, string>;
|
|
14
|
+
authoredAt: z.ZodEffects<z.ZodString, string, string>;
|
|
15
|
+
declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
|
|
16
|
+
splitRef: z.ZodEffects<z.ZodString, string, string>;
|
|
17
|
+
authoredAfterSplit: z.ZodLiteral<true>;
|
|
18
|
+
heldOutNonInspectionAttestation: z.ZodLiteral<true>;
|
|
19
|
+
structuralEligibility: z.ZodObject<{
|
|
20
|
+
decidable: z.ZodBoolean;
|
|
21
|
+
basis: z.ZodEffects<z.ZodString, string, string>;
|
|
22
|
+
judgedBy: z.ZodEffects<z.ZodString, string, string>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
decidable: boolean;
|
|
25
|
+
basis: string;
|
|
26
|
+
judgedBy: string;
|
|
27
|
+
}, {
|
|
28
|
+
decidable: boolean;
|
|
29
|
+
basis: string;
|
|
30
|
+
judgedBy: string;
|
|
31
|
+
}>;
|
|
32
|
+
origin: z.ZodUnion<[z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"from-scratch">;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
kind: "from-scratch";
|
|
36
|
+
}, {
|
|
37
|
+
kind: "from-scratch";
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"mined-accelerant">;
|
|
40
|
+
sourceRunId: z.ZodEffects<z.ZodString, string, string>;
|
|
41
|
+
suggestionHash: z.ZodEffects<z.ZodString, string, string>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
kind: "mined-accelerant";
|
|
44
|
+
sourceRunId: string;
|
|
45
|
+
suggestionHash: string;
|
|
46
|
+
}, {
|
|
47
|
+
kind: "mined-accelerant";
|
|
48
|
+
sourceRunId: string;
|
|
49
|
+
suggestionHash: string;
|
|
50
|
+
}>]>;
|
|
51
|
+
/**
|
|
52
|
+
* The fixture PRs bound by this rule, split by control role (codex diff-review):
|
|
53
|
+
* positive fixtures the matcher must CATCH (§4 preimage-differential) and negative
|
|
54
|
+
* near-misses it must STAY SILENT on (§6). BOTH are part of the legitimacy surface C
|
|
55
|
+
* must resolve to the train slice, so the ledger — the CI-observable FM(e) attestation
|
|
56
|
+
* artifact — must enumerate BOTH, not positives only (a C that trusted a single list
|
|
57
|
+
* would miss the negatives). `negativeFixturePrs` is `[]` when none were declared.
|
|
58
|
+
*/
|
|
59
|
+
positiveFixturePrs: z.ZodArray<z.ZodNumber, "many">;
|
|
60
|
+
negativeFixturePrs: z.ZodArray<z.ZodNumber, "many">;
|
|
61
|
+
/**
|
|
62
|
+
* Fingerprint of the MATERIAL author input (engine / class / matcher /
|
|
63
|
+
* fixtures / origin) — identity (`author`/`targetDefect`/`ruleId`) AND
|
|
64
|
+
* `authoredAt` EXCLUDED, so a pure timestamp refresh is a no-op (§8: a
|
|
65
|
+
* timestamp drift must not churn the rule) while a matcher/fixture edit
|
|
66
|
+
* appends a new revision row under the SAME `ruleId`. Equal hash on re-read ⇒
|
|
67
|
+
* no append.
|
|
68
|
+
*/
|
|
69
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
70
|
+
}, "strict", z.ZodTypeAny, {
|
|
71
|
+
contentHash: string;
|
|
72
|
+
author: string;
|
|
73
|
+
authoredAt: string;
|
|
74
|
+
targetDefect: string;
|
|
75
|
+
ruleId: string;
|
|
76
|
+
origin: {
|
|
77
|
+
kind: "from-scratch";
|
|
78
|
+
} | {
|
|
79
|
+
kind: "mined-accelerant";
|
|
80
|
+
sourceRunId: string;
|
|
81
|
+
suggestionHash: string;
|
|
82
|
+
};
|
|
83
|
+
structuralEligibility: {
|
|
84
|
+
decidable: boolean;
|
|
85
|
+
basis: string;
|
|
86
|
+
judgedBy: string;
|
|
87
|
+
};
|
|
88
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
89
|
+
splitRef: string;
|
|
90
|
+
authoredAfterSplit: true;
|
|
91
|
+
heldOutNonInspectionAttestation: true;
|
|
92
|
+
positiveFixturePrs: number[];
|
|
93
|
+
negativeFixturePrs: number[];
|
|
94
|
+
}, {
|
|
95
|
+
contentHash: string;
|
|
96
|
+
author: string;
|
|
97
|
+
authoredAt: string;
|
|
98
|
+
targetDefect: string;
|
|
99
|
+
ruleId: string;
|
|
100
|
+
origin: {
|
|
101
|
+
kind: "from-scratch";
|
|
102
|
+
} | {
|
|
103
|
+
kind: "mined-accelerant";
|
|
104
|
+
sourceRunId: string;
|
|
105
|
+
suggestionHash: string;
|
|
106
|
+
};
|
|
107
|
+
structuralEligibility: {
|
|
108
|
+
decidable: boolean;
|
|
109
|
+
basis: string;
|
|
110
|
+
judgedBy: string;
|
|
111
|
+
};
|
|
112
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
113
|
+
splitRef: string;
|
|
114
|
+
authoredAfterSplit: true;
|
|
115
|
+
heldOutNonInspectionAttestation: true;
|
|
116
|
+
positiveFixturePrs: number[];
|
|
117
|
+
negativeFixturePrs: number[];
|
|
118
|
+
}>;
|
|
119
|
+
export type AuthoringLedgerEntry = z.infer<typeof AuthoringLedgerEntrySchema>;
|
|
120
|
+
/**
|
|
121
|
+
* Deterministic fingerprint of the MATERIAL author fields (§8 idempotency).
|
|
122
|
+
* SELF-normalizes newlines (CRLF→LF) on every string it hashes, so a Windows-
|
|
123
|
+
* authored and an LF-authored identical rule hash identically REGARDLESS of the
|
|
124
|
+
* caller — the determinism is single-homed in the hash, not the reader (Tenet-20,
|
|
125
|
+
* gemini diff-review). Identity + `authoredAt` are NOT part of the material (see
|
|
126
|
+
* `AuthoringLedgerEntrySchema.contentHash`).
|
|
127
|
+
*
|
|
128
|
+
* The file-level ATTESTATIONS (`splitRef` + the booleans) ARE part of the material
|
|
129
|
+
* (greptile-P1 + CR diff-review): they are what this command records, so an
|
|
130
|
+
* attestation-only change (e.g. the split was re-frozen) must trigger a revision
|
|
131
|
+
* row — otherwise the rule reads `unchanged`, no row is appended, and the ledger
|
|
132
|
+
* keeps the STALE split. `authoredAt` stays excluded (a timestamp refresh is a
|
|
133
|
+
* no-op, §8); every OTHER ledger-attested mutable field is covered here.
|
|
134
|
+
*/
|
|
135
|
+
export declare function authoringContentHash(material: {
|
|
136
|
+
declaredEngine: string;
|
|
137
|
+
structuralClass: string;
|
|
138
|
+
dslSource: string;
|
|
139
|
+
positiveFixtures: unknown;
|
|
140
|
+
negativeFixtures?: unknown;
|
|
141
|
+
origin: unknown;
|
|
142
|
+
splitRef: string;
|
|
143
|
+
authoredAfterSplit: boolean;
|
|
144
|
+
heldOutNonInspectionAttestation: boolean;
|
|
145
|
+
/** The producer VERDICT (CR diff-review) — incl. `judgedBy`/`basis`; a verdict change must revise. */
|
|
146
|
+
structuralEligibility: unknown;
|
|
147
|
+
}): string;
|
|
148
|
+
/**
|
|
149
|
+
* Read the full authoring-ledger (append order = revision order; the LAST entry
|
|
150
|
+
* per `ruleId` is effective). FAIL-LOUD on a malformed/invalid row — a corrupt
|
|
151
|
+
* attestation chain must never be silently skipped. Returns `[]` if the ledger
|
|
152
|
+
* does not exist yet (first author).
|
|
153
|
+
*/
|
|
154
|
+
export declare function readAuthoringLedger(totemDir: string): AuthoringLedgerEntry[];
|
|
155
|
+
/**
|
|
156
|
+
* Append one §8 entry, FAIL-LOUD + READ-BACK-VERIFIED. Validates the entry
|
|
157
|
+
* (throws on an incomplete row — FM(e)), appends canonically, then re-reads the
|
|
158
|
+
* ledger and asserts the last row round-trips byte-identically. Any failure
|
|
159
|
+
* THROWS so the caller never lets the rule reach compile feed on an unpersisted
|
|
160
|
+
* attestation. (Distinct from `appendLedgerEvent`'s warn-and-continue.)
|
|
161
|
+
*
|
|
162
|
+
* Semantics are APPEND-ONLY, not transactional (codex diff-review): a read-back
|
|
163
|
+
* mismatch on a row that did persist correctly is a report/state mismatch, not a
|
|
164
|
+
* corrupt record — the next run reads the (valid) row as effective state. The
|
|
165
|
+
* throw is the honest signal that THIS write could not be confirmed; it is never
|
|
166
|
+
* a path to an invalid record (an actually-wrong row fails the schema re-read). A
|
|
167
|
+
* heavier temp-file/lock/transaction story is deferred unless the cert demands it.
|
|
168
|
+
*/
|
|
169
|
+
export declare function appendAuthoringLedgerEntry(totemDir: string, entry: AuthoringLedgerEntry): void;
|
|
170
|
+
/**
|
|
171
|
+
* The effective state of one authored rule, folded from its ledger lineage: the
|
|
172
|
+
* persisted `ruleId` + the latest material `contentHash`. Keyed by the identity
|
|
173
|
+
* pair so the reader can upsert a re-read `(author,targetDefect)` onto its
|
|
174
|
+
* existing id instead of self-colliding to a fresh `-N`.
|
|
175
|
+
*/
|
|
176
|
+
export interface AuthoredIdentity {
|
|
177
|
+
ruleId: string;
|
|
178
|
+
contentHash: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The upsert identity key. Uses the SAME injective encoding as mintAuthoredRuleId's seed
|
|
182
|
+
* (JSON.stringify of [author, targetDefect]) so the upsert key and the minted id agree on
|
|
183
|
+
* what "one identity" is. A naive author-space-targetDefect join is NON-injective: a space
|
|
184
|
+
* in either free-text field aliases distinct identities -- ('alice','off by one') and
|
|
185
|
+
* ('alice off','by one') collapse onto one key (the #2259 CR-major class the mint already
|
|
186
|
+
* fixed; strategy-claude flagged the upsert-key inconsistency on the slice-B seam review).
|
|
187
|
+
* JSON.stringify of the pair can never collide across distinct inputs.
|
|
188
|
+
*/
|
|
189
|
+
export declare function identityKey(author: string, targetDefect: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Fold the ledger into the upsert index: `(author,targetDefect)` → the effective
|
|
192
|
+
* `{ruleId, contentHash}` (append order means the LAST row per identity wins —
|
|
193
|
+
* the latest revision). Also returns every persisted `ruleId` so a genuinely NEW
|
|
194
|
+
* identity mints against the full set. FAIL-LOUD on BOTH uniqueness violations
|
|
195
|
+
* (codex diff-review): one `(author,targetDefect)` mapping to two `ruleId`s, AND
|
|
196
|
+
* one `ruleId` shared by two distinct identities — the reverse would let one
|
|
197
|
+
* authoring run materialize two records sharing an authored identity (both with
|
|
198
|
+
* `authoringLedgerRef = ruleId`), which the fail-loud reader must reject too.
|
|
199
|
+
*/
|
|
200
|
+
export declare function buildAuthoredIdentityIndex(entries: readonly AuthoringLedgerEntry[]): {
|
|
201
|
+
byIdentity: Map<string, AuthoredIdentity>;
|
|
202
|
+
allRuleIds: Set<string>;
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=authoring-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-ledger.d.ts","sourceRoot":"","sources":["../../src/spine/authoring-ledger.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;IAInC,0JAA0J;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAS1J;;;;;;;OAOG;;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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