@conarium-ai/core 0.2.38 → 0.2.40

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 (86) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/bin/conarium-coverage.mjs +20 -19
  4. package/bin/conarium-init.mjs +10 -9
  5. package/bin/conarium-reconcile.mjs +6 -6
  6. package/bin/conarium-verify.mjs +63 -42
  7. package/dist/audit-hash.d.ts +1 -1
  8. package/dist/audit-hash.d.ts.map +1 -1
  9. package/dist/audit-hash.js +1 -1
  10. package/dist/audit-hash.js.map +1 -1
  11. package/dist/audit.d.ts +22 -21
  12. package/dist/audit.d.ts.map +1 -1
  13. package/dist/audit.js +104 -88
  14. package/dist/audit.js.map +1 -1
  15. package/dist/config.d.ts +69 -433
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/config.js +7 -4
  18. package/dist/config.js.map +1 -1
  19. package/dist/connectors/supabase_rest.d.ts +2 -2
  20. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  21. package/dist/connectors/supabase_rest.js +7 -5
  22. package/dist/connectors/supabase_rest.js.map +1 -1
  23. package/dist/console-receipts.d.ts +2 -2
  24. package/dist/console-receipts.d.ts.map +1 -1
  25. package/dist/console-receipts.js +2 -2
  26. package/dist/console-receipts.js.map +1 -1
  27. package/dist/console.d.ts +6 -22
  28. package/dist/console.d.ts.map +1 -1
  29. package/dist/console.js +13 -12
  30. package/dist/console.js.map +1 -1
  31. package/dist/coverage.d.ts +32 -30
  32. package/dist/coverage.d.ts.map +1 -1
  33. package/dist/coverage.js +39 -36
  34. package/dist/coverage.js.map +1 -1
  35. package/dist/governance.d.ts +14 -13
  36. package/dist/governance.d.ts.map +1 -1
  37. package/dist/governance.js +52 -48
  38. package/dist/governance.js.map +1 -1
  39. package/dist/http.d.ts +6 -5
  40. package/dist/http.d.ts.map +1 -1
  41. package/dist/http.js +45 -41
  42. package/dist/http.js.map +1 -1
  43. package/dist/iban.d.ts.map +1 -1
  44. package/dist/iban.js +13 -12
  45. package/dist/iban.js.map +1 -1
  46. package/dist/llm-gate.d.ts +6 -6
  47. package/dist/llm-gate.js +6 -6
  48. package/dist/pseudonymize.d.ts +8 -8
  49. package/dist/pseudonymize.d.ts.map +1 -1
  50. package/dist/pseudonymize.js +7 -7
  51. package/dist/pseudonymize.js.map +1 -1
  52. package/dist/receipt-view.d.ts +1 -1
  53. package/dist/receipt-view.d.ts.map +1 -1
  54. package/dist/receipt-view.js +52 -51
  55. package/dist/receipt-view.js.map +1 -1
  56. package/dist/receipt.d.ts +32 -28
  57. package/dist/receipt.d.ts.map +1 -1
  58. package/dist/receipt.js +23 -20
  59. package/dist/receipt.js.map +1 -1
  60. package/dist/scripts/discover_schema.js +14 -12
  61. package/dist/scripts/discover_schema.js.map +1 -1
  62. package/dist/scripts/dogfood_prove.js +16 -16
  63. package/dist/scripts/dogfood_prove.js.map +1 -1
  64. package/dist/server.d.ts +5 -4
  65. package/dist/server.d.ts.map +1 -1
  66. package/dist/server.js +44 -34
  67. package/dist/server.js.map +1 -1
  68. package/dist/sql-gate/rules.d.ts +8 -7
  69. package/dist/sql-gate/rules.d.ts.map +1 -1
  70. package/dist/sql-gate/rules.js +11 -9
  71. package/dist/sql-gate/rules.js.map +1 -1
  72. package/dist/tokens.d.ts +3 -3
  73. package/dist/tokens.d.ts.map +1 -1
  74. package/dist/tokens.js +18 -18
  75. package/dist/tokens.js.map +1 -1
  76. package/docs/RECEIPT-SPEC.md +200 -3
  77. package/docs/claims/reviews/0.2.39.md +90 -0
  78. package/docs/claims/reviews/0.2.40.md +70 -0
  79. package/package.json +6 -4
  80. package/public/app.js +6 -6
  81. package/public/index.html +7 -7
  82. package/public/receipts-panel.js +7 -7
  83. package/scripts/audit-chain-check.mjs +6 -6
  84. package/scripts/benchmark-overhead.mjs +4 -4
  85. package/scripts/conarium_sabah_brief.mjs +11 -11
  86. package/test-vectors/README.md +15 -0
@@ -1 +1 @@
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CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,GAAG,SAAS,CASpB;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyCpD"}
@@ -36,14 +36,15 @@ export const SAFE_BUILTIN_FUNCTIONS = new Set([
36
36
  'upper',
37
37
  ]);
38
38
  /**
39
- * Lehçeye özgü skaler fonksiyonlar. Ortak liste Postgres adlarını taşır; MSSQL ve
40
- * Oracle kapıları da o listeye bağlanınca `GETDATE`/`NVL` gibi en sıradan çağrılar
41
- * reddedilir hâle gelmişti — açık kapanırken meşru kullanım kırılıyordu.
39
+ * Dialect-specific scalar functions. The shared list carries Postgres names; once
40
+ * the MSSQL and Oracle gates bound to that list, the most ordinary calls like
41
+ * `GETDATE`/`NVL` started being rejected — the gate closed while legitimate use
42
+ * broke.
42
43
  *
43
- * Kural: buraya YALNIZ saf, okuma amaçlı, satır sayısını değiştirmeyen skaler
44
- * dönüşümler girer. Satır toplayan/serileştiren her şey BLOCKED_DUMP_FUNCTIONS'ın
45
- * işidir; dinamik SQL üreten, dosya/ağ/OS'a uzanan aileler (DBMS_*, UTL_*, xp_*,
46
- * sp_*, OPENROWSET/OPENJSON) hiçbir koşulda buraya yazılmaz.
44
+ * Rule: only pure, read-oriented scalar transforms that do not change row count
45
+ * go here. Anything that aggregates/serializes rows is BLOCKED_DUMP_FUNCTIONS'
46
+ * job; families that produce dynamic SQL or reach file/network/OS (DBMS_*, UTL_*,
47
+ * xp_*, sp_*, OPENROWSET/OPENJSON) must never be written here.
47
48
  */
48
49
  export const DIALECT_SAFE_FUNCTIONS = {
49
50
  mssql: new Set([
@@ -109,8 +110,9 @@ export function hasRowLockClause(norm) {
109
110
  export function isSafeBuiltinFunction(baseName, schema, dialect) {
110
111
  if (SAFE_BUILTIN_FUNCTIONS.has(baseName) && (!schema || schema === 'pg_catalog'))
111
112
  return true;
112
- // Lehçe listesi YALNIZ şemasız çağrıyı karşılar: `app.pkg.nvl` kullanıcı paketidir,
113
- // yerleşik değil — şema niteleyicisi varsa lehçe listesi devreye girmez.
113
+ // The dialect list covers ONLY un-schema-qualified calls: `app.pkg.nvl` is a
114
+ // user package, not a builtin — if a schema qualifier is present the dialect
115
+ // list does not apply.
114
116
  if (schema)
115
117
  return false;
116
118
  if (dialect === 'mssql' || dialect === 'oracle') {
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/sql-gate/rules.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS;IAC1E,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS;CACzD,CAAA;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,SAAS;IACT,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,QAAQ;IACR,cAAc;IACd,gBAAgB;IAChB,uBAAuB;IACvB,SAAS;IACT,OAAO;IACP,OAAO;IACP,YAAY;IACZ,KAAK;IACL,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAoD;IACrF,KAAK,EAAE,IAAI,GAAG,CAAC;QACb,WAAW;QACX,SAAS;QACT,SAAS;QACT,UAAU;QACV,UAAU;QACV,SAAS;QACT,QAAQ;QACR,MAAM;QACN,KAAK;QACL,OAAO;QACP,WAAW;QAC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AAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;gBAAE,CAAC,IAAI,CAAC,CAAA;YACxE,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM;gBAAE,CAAC,IAAI,CAAC,CAAA;YAC1B,GAAG,IAAI,GAAG,CAAA;YACV,SAAQ;QACV,CAAC;QACD,GAAG,IAAI,CAAC,CAAA;QACR,CAAC,IAAI,CAAC,CAAA;IACR,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
package/dist/tokens.d.ts CHANGED
@@ -4,11 +4,11 @@ export interface ResolvedActor {
4
4
  assurance: ActorAssurance;
5
5
  isUser: boolean;
6
6
  }
7
- /** karma → kişi id. Dosya yoksa null = kişi bazlı kimlik kapalı (hata değil). */
7
+ /** hash → person id. If the file is missing, null = per-person identity is off (not an error). */
8
8
  export declare function loadTokenStore(path?: string): Map<string, string> | null;
9
9
  /**
10
- * Gelen token'ı kişiye çözer. Eşleşme yoksa ASLA kişi kimliği üretmez —
11
- * paylaşılan token davranışına düşer.
10
+ * Resolves the incoming token to a person. If there is no match it NEVER
11
+ * invents a person identity — it falls back to shared-token behavior.
12
12
  */
13
13
  export declare function resolveActor(supplied: string, store: Map<string, string> | null, fallbackId: string): ResolvedActor;
14
14
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,cAAc,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAChB;AAYD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkBzF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,GACjB,aAAa,CAOf"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,cAAc,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAChB;AAYD,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkBzF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,GACjB,aAAa,CAOf"}
package/dist/tokens.js CHANGED
@@ -1,26 +1,26 @@
1
1
  /**
2
- * Kişi bazlı kimlik — token deposu.
2
+ * Per-person identity — token store.
3
3
  *
4
- * Neden beyan değil token: istemcinin gönderdiği isim (X-Conarium-Actor gibi)
5
- * kimse tarafından doğrulanmamıştır; onu imzalayıp makbuza yazmak, dürüst
6
- * 'service' değerinden kötüdür. Token'ı Conarium zaten doğruluyor, dolayısıyla
7
- * kimin bağlandığını BİLİR.
4
+ * Why a token, not a declaration: a name the client sends (such as
5
+ * X-Conarium-Actor) has not been verified by anyone; signing it onto the
6
+ * receipt is worse than an honest 'service' value. Conarium already verifies
7
+ * the token, so it KNOWS who connected.
8
8
  *
9
- * Token'lar düz metin saklanmaz — yalnızca SHA-256 karması. Dosya sızsa bile
10
- * kimsenin token'ı ele geçmez.
9
+ * Tokens are not stored in plaintext — only a SHA-256 hash. Even if the
10
+ * file leaks, nobody's token is captured.
11
11
  */
12
12
  import { createHash } from 'node:crypto';
13
13
  import { existsSync, readFileSync } from 'node:fs';
14
14
  /**
15
- * Yol her çağrıda okunur, modül yüklenirken DEĞİL.
16
- * Sabit olarak yakalansaydı `CONARIUM_TOKENS_FILE`'ı sonradan değiştirmek
17
- * hiçbir şeyi etkilemezdi — testler dahil, ki bu sessizce yanlış şeyi ölçmek
18
- * demek olurdu.
15
+ * The path is read on every call, NOT at module load.
16
+ * If it were captured as a constant, changing `CONARIUM_TOKENS_FILE`
17
+ * afterwards would affect nothing — including tests, which would silently
18
+ * measure the wrong thing.
19
19
  */
20
20
  function varsayilanYol() {
21
21
  return process.env.CONARIUM_TOKENS_FILE || 'conarium.tokens.json';
22
22
  }
23
- /** karma → kişi id. Dosya yoksa null = kişi bazlı kimlik kapalı (hata değil). */
23
+ /** hash → person id. If the file is missing, null = per-person identity is off (not an error). */
24
24
  export function loadTokenStore(path = varsayilanYol()) {
25
25
  if (!existsSync(path))
26
26
  return null;
@@ -29,10 +29,10 @@ export function loadTokenStore(path = varsayilanYol()) {
29
29
  raw = JSON.parse(readFileSync(path, 'utf8'));
30
30
  }
31
31
  catch (e) {
32
- // Bilerek FIRLATIYORUZ, sessizce null dönmüyoruz: null dönmek kişi bazlı
33
- // kimliği fark edilmeden kapatır ve herkes yeniden 'service' olur —
34
- // sessiz düşüş, gürültülü hatadan çok daha tehlikelidir.
35
- throw new Error(`loadTokenStore: ${path} okunamadı/bozuk JSON — ${e.message}`);
32
+ // We THROW on purpose, we do not silently return null: returning null
33
+ // would turn off per-person identity unnoticed and everyone would become
34
+ // 'service' again — a silent drop is far more dangerous than a noisy error.
35
+ throw new Error(`loadTokenStore: ${path} unreadable or invalid JSON — ${e.message}`);
36
36
  }
37
37
  const map = new Map();
38
38
  for (const t of raw.tokens ?? []) {
@@ -43,8 +43,8 @@ export function loadTokenStore(path = varsayilanYol()) {
43
43
  return map;
44
44
  }
45
45
  /**
46
- * Gelen token'ı kişiye çözer. Eşleşme yoksa ASLA kişi kimliği üretmez —
47
- * paylaşılan token davranışına düşer.
46
+ * Resolves the incoming token to a person. If there is no match it NEVER
47
+ * invents a person identity — it falls back to shared-token behavior.
48
48
  */
49
49
  export function resolveActor(supplied, store, fallbackId) {
50
50
  if (store && supplied) {
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAUlD;;;;;GAKG;AACH,SAAS,aAAa;IACpB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,sBAAsB,CAAA;AACnE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,IAAI,GAAW,aAAa,EAAE;IAC3D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,GAAoD,CAAA;IACxD,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,yEAAyE;QACzE,oEAAoE;QACpE,yDAAyD;QACzD,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,2BAA4B,CAAW,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;IACrC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC,MA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12 +193,22 @@ are unchanged.
193
193
  | 11 | `prevHash` break — deleted or inserted; also `--expect-count` / `--expect-last-hash` mismatch |
194
194
  | 12 | `seq` gap / non-increasing — missing or reordered |
195
195
  | 13 | Signature invalid / pubkey missing (fail-closed) |
196
- | 14 | Claimed anchor invalid under `--anchor-check`, or `--require-head-anchor` when the head is unanchored. `anchor:null` receipts are skipped (periodic anchoring). |
197
- | 15 | Anchor **could not be checked** — calendar unreachable, or the OpenTimestamps verifier is not installed. Deliberately distinct from 14: "I could not verify this" is not "this is invalid". The digest comparison is performed offline and still holds; only the timestamp attestation is unconfirmed. A verifier that collapsed the two would be asserting something it did not measure. |
196
+ | 14 | Claimed anchor invalid under `--anchor-check`, or `--require-head-anchor` when the head is unanchored. An individual `anchor:null` receipt is skipped, not failed — periodic anchoring leaves most of them null. |
197
+ | 15 | Anchor **could not be checked** — calendar unreachable, the OpenTimestamps verifier is not installed, or `--anchor-check` reached no anchor at all because every receipt in the chain is unanchored. Deliberately distinct from 14: "I could not verify this" is not "this is invalid". The digest comparison is performed offline and still holds; only the timestamp attestation is unconfirmed. A verifier that collapsed the two would be asserting something it did not measure. |
198
198
  | 20 | Schema invalid |
199
199
 
200
200
  Fail-closed: if the verifier is unsure, it does not exit 0.
201
201
 
202
+ ⚠️ `--anchor-check` over a chain where **no** receipt carries an anchor is exit
203
+ **15**, not 0. Each null is still skipped rather than failed, which is right —
204
+ but skipping all of them and then reporting success answers the caller's question
205
+ from a path that never reached an anchor. The summary line always printed
206
+ `0/N anchored`; the exit code was the part that claimed more than was examined,
207
+ and the exit code is what a machine reads. `--require-head-anchor` stays 14: the
208
+ caller asserted an anchor must be there, and its absence is a failed assertion
209
+ rather than an unread one. *Changed in 0.2.40; it was 0 before, and a test had
210
+ written the old answer down.*
211
+
202
212
  ⚠️ Under `--anchor-check`, an OpenTimestamps **calendar** that cannot be
203
213
  reached is exit **15** (`anchor could not be checked`) — not 14. Digest
204
214
  comparison is offline and still holds. A `verify()` error that is *not*
@@ -207,10 +217,197 @@ block-explorer client in this repository; `ignoreBitcoinNode: true` is set.
207
217
  Tracked remainder: unclassified network-shaped errors still share 14 with
208
218
  "proof does not hold".
209
219
 
220
+ ## Wire format for a second implementation
221
+
222
+ An independent implementer built a verifier from the published vectors and the
223
+ IETF draft alone. They reached 13/13 — but only after opening this repository's
224
+ source, because four things were nowhere in the documents: what the signature
225
+ actually covers, that `seq` must advance by exactly one, which absent fields are
226
+ schema errors rather than hash mismatches, and in what order the checks run.
227
+ A specification that has to be read alongside its own implementation is not
228
+ finished. What they had to guess is written down below.
229
+
230
+ Parts of this section are asserted against the shipped verifier by
231
+ `test/spec_wire_contract.mjs` and are marked **measured** where they appear:
232
+ the signed payload and its byte length, the order the checks run in, the
233
+ required-field table row by row, and the vector counts quoted in prose. If the
234
+ code moves and one of those sentences does not, the check fails.
235
+
236
+ The rest of this section is prose. It describes behaviour the verifier has, and
237
+ nothing in the test suite compares it to the code — the same gap the
238
+ Implementation Status guard was written to close one document over. Read it as
239
+ accurate on the revision that shipped it, not as pinned.
240
+
241
+ ### What the signature covers — measured
242
+
243
+ `sig.value` is base64 of an Ed25519 signature over the **UTF-8 bytes of the
244
+ `chain.hash` string, `sha256:` prefix included** — 71 bytes for a SHA-256
245
+ digest (`sha256:` plus 64 hex characters).
246
+
247
+ It is not the raw 32-byte digest, not the hex without the prefix, and not the
248
+ canonical JSON of the receipt. Those are the three natural guesses, and the
249
+ guard verifies that a correct signature fails against all three: an
250
+ implementation that picks one of them produces receipts nobody else can check,
251
+ and discovers this only when a second party tries.
252
+
253
+ ```
254
+ payload = utf8("sha256:" + hex(SHA-256(canonical bytes))) # 71 bytes
255
+ sig.value = base64(Ed25519-sign(payload))
256
+ ```
257
+
258
+ The three paragraphs that follow are prose, not measured. `sig.alg` is
259
+ `Ed25519` — any other value is rejected before the key is loaded.
260
+ `sig.keyId` selects the public key from the caller's trust set; an unknown
261
+ `keyId` is a signature failure, not a "skip". `sig.value` must be canonical
262
+ base64: a re-encodable variant is refused rather than normalised.
263
+
264
+ The signature covers the hash, and the hash covers the receipt. `hash`, `sig`
265
+ and `anchor` are excluded from the bytes that are hashed — which is what lets a
266
+ transparency-log anchor be attached after signing, and is also the limit
267
+ recorded under **Known gaps**.
268
+
269
+ ### `seq` advances by exactly one
270
+
271
+ **Measured:** that a gap yields exit 12, and that it is diagnosed before the
272
+ signature check. **Not measured:** the non-increasing case and
273
+ `--expect-seq-from`, which no vector exercises — stated here rather than left
274
+ to be discovered.
275
+
276
+ `chain.seq` is an integer that increases by **exactly one** between consecutive
277
+ receipts. Both failure shapes are exit **12**:
278
+
279
+ - `seq` not greater than its predecessor — reordered or duplicated;
280
+ - `seq` greater by more than one — a receipt is missing.
281
+
282
+ `prevHash` alone does not catch the second case. A chain with a deleted receipt
283
+ can still link correctly if the deletion happened before the successors were
284
+ written; only the counter reveals the hole. That is what vector
285
+ `005-seq-gap` is for, and a verifier that checks hashes but not `seq` passes it
286
+ and is wrong.
287
+
288
+ `--expect-seq-from N` pins the first receipt of the file to `N`. Without it, a
289
+ file whose first receipt is `seq: 7` verifies as a valid *suffix* — the
290
+ verifier reports what it can prove, and where a chain starts is not something a
291
+ single file can prove.
292
+
293
+ ### Fields whose absence is a schema error (exit 20) — measured
294
+
295
+ A receipt missing one of these is not a tampered receipt — it is not a receipt.
296
+ The distinction matters because the exit code is a diagnosis: reporting exit 10
297
+ ("record altered") for a document that never had the field would name the wrong
298
+ event.
299
+
300
+ Each row is checked by removing exactly that path from the named vector and
301
+ requiring exit 20.
302
+
303
+ | Path | Checked against |
304
+ |---|---|
305
+ | `v` | 001-single-receipt |
306
+ | `id` | 001-single-receipt |
307
+ | `ts` | 001-single-receipt |
308
+ | `period` | 001-single-receipt |
309
+ | `request` | 001-single-receipt |
310
+ | `dataRefs` | 001-single-receipt |
311
+ | `policy` | 001-single-receipt |
312
+ | `policy.decision` | 001-single-receipt |
313
+ | `flags` | 001-single-receipt |
314
+ | `masking` | 001-single-receipt |
315
+ | `outcome` | 001-single-receipt |
316
+ | `actor` | 001-single-receipt |
317
+ | `actor.type` | 001-single-receipt |
318
+ | `actor.assurance` | 001-single-receipt |
319
+ | `chain` | 001-single-receipt |
320
+ | `chain.seq` | 001-single-receipt |
321
+ | `chain.prevHash` | 001-single-receipt |
322
+ | `chain.hash` | 001-single-receipt |
323
+ | `consentRef` | 001-single-receipt |
324
+ | `anchor` | 001-single-receipt |
325
+ | `model` | 001-single-receipt |
326
+ | `model.source` | 001-single-receipt |
327
+ | `client` | 001-single-receipt |
328
+ | `client.source` | 001-single-receipt |
329
+ | `disclosure` | 010-disclosure-commitment |
330
+ | `disclosure.source` | 010-disclosure-commitment |
331
+ | `disclosure.hash` | 010-disclosure-commitment |
332
+ | `disclosure.bytes` | 010-disclosure-commitment |
333
+ | `destination` | 010-disclosure-commitment |
334
+ | `destination.source` | 010-disclosure-commitment |
335
+ | `destination.value` | 010-disclosure-commitment |
336
+
337
+ `consentRef` and `anchor` must be **present and null**, not absent: the two
338
+ carry different meanings, and a reader who cannot tell "declared empty" from
339
+ "never written" is guessing. The same rule governs `disclosure` and
340
+ `destination` under `source: "undeclared"` — the value keys stay, holding
341
+ `null`. Vector `013-disclosure-keys-omitted` locks that case.
342
+
343
+ `model` and `client` are required from v0.3 onward; `disclosure` and
344
+ `destination` from v0.4. An older receipt that lacks them is valid at its own
345
+ version — the version field decides which rows apply, which is why a v0.3
346
+ receipt in a v0.4 chain still verifies (`012-mixed-chain`).
347
+
348
+ `sig` is deliberately not in this table. A receipt without a signature is a
349
+ well-formed receipt that cannot be trusted — exit **13**, not 20.
350
+
351
+ ### Check order — measured
352
+
353
+ The order is part of the contract, because the exit code is a diagnosis and the
354
+ wrong order produces a true verdict with a false reason.
355
+
356
+ | Order | Check | Exit on failure |
357
+ |---|---|---|
358
+ | 1st | Schema | 20 |
359
+ | 2nd | Recomputed content hash | 10 |
360
+ | 3rd | `prevHash` link to the previous receipt | 11 |
361
+ | 4th | `seq` advances by exactly one | 12 |
362
+ | 5th | Ed25519 signature | 13 |
363
+ | 6th | Anchor, only under `--anchor-check` | 14 / 15 |
364
+
365
+ Receipts are processed in file order, and the first failure ends the run — so
366
+ the exit code names the first defective receipt, not the worst one.
367
+
368
+ Put the signature check first and a deleted receipt (`004`) or a sequence gap
369
+ (`005`) reports as a bad signature whenever the offending receipt is also
370
+ unsigned. The verdict "do not trust this chain" is unchanged; the operator is
371
+ sent to look at the wrong thing. The guard builds exactly that case — it
372
+ removes the signature from the one receipt that already breaks the chain — and
373
+ requires 11 and 12 rather than 13.
374
+
375
+ ### Canonical form, and what the vectors do not measure — prose
376
+
377
+ Content bytes are canonicalised with **JCS (RFC 8785)** and digested with
378
+ SHA-256, prefixed `sha256:`. `hash`, `sig` and `anchor` are removed first,
379
+ including the nested `chain.hash`.
380
+
381
+ `expected-hashes.json` publishes those digests, so a second implementation can
382
+ compare canonical bytes without holding our private key. Matching them is what
383
+ interoperability actually requires; signing is RFC 8032 and none of it is ours.
384
+
385
+ ⚠️ **Stated limit.** The published vectors are ASCII-keyed with integer and
386
+ string values. A naive sorted-key serialiser reproduces every one of their
387
+ hashes, so passing them does **not** demonstrate a conforming JCS
388
+ implementation. The number formatting rules (RFC 8785 §3.2.2.3) and the
389
+ UTF-16 code-unit sort order over non-ASCII keys are unexercised. A receipt
390
+ carrying a float, a large integer, or a non-ASCII key is where two
391
+ implementations will first disagree, and this repository does not currently
392
+ publish a vector that would catch it.
393
+
394
+ ### Which document is normative for what — prose
395
+
396
+ The IETF draft (`standards/`) defines Transformation Evidence and Coverage
397
+ Reconciliation, and states that signature and chain verification are **out of
398
+ scope** for it. That is deliberate: those belong to the receipt format, not to
399
+ the evidence structures layered on top.
400
+
401
+ So the draft is normative for the evidence structures; **this document is
402
+ normative for the receipt wire format** — signature payload, canonical form,
403
+ sequence rule, schema requirements and check order. An implementer who reads
404
+ only the draft has not been told how to verify a receipt, and should not
405
+ conclude the format leaves it open.
406
+
210
407
  ## Conformance vectors
211
408
 
212
409
  A specification that cannot be implemented from the document alone is a blog
213
- post. [`test-vectors/`](../test-vectors/) is the difference: twelve frozen cases,
410
+ post. [`test-vectors/`](../test-vectors/) is the difference: thirteen frozen cases,
214
411
  the public key, and a machine-readable manifest.
215
412
 
216
413
  ```
@@ -0,0 +1,90 @@
1
+ # Claims review — 0.2.39
2
+
3
+ - base: d46b00d
4
+ - head: e182d9a
5
+ - surface: sha256:66ceac7f7ddc9957d3b4c1ec117f88b5a127b55c5c43ad121a3aa02f9e53bf5e
6
+ - verdict: pass
7
+ - reviewer: maintainer, re-reading the surfaces after the wire-format section and
8
+ the second locale pass were merged
9
+
10
+ The version was reviewed once already, before publication, on the translation
11
+ pass. That review recorded two limits for the next reader — that the locale
12
+ check tests for letters rather than language, and that Turkish markdown still
13
+ ships beside the code. Both were acted on before the version left the tree, so
14
+ this record supersedes the earlier one rather than repeating it.
15
+
16
+ The gate stopped the release, which is the first time it has stopped anything,
17
+ and the finding below is the one it produced.
18
+
19
+ ## Findings
20
+
21
+ ### 1. docs/RECEIPT-SPEC.md:220 — a section against overclaiming, overclaiming
22
+
23
+ - Claim: "Every statement in this section is asserted against the shipped
24
+ verifier by `test/spec_wire_contract.mjs`. If the code moves and a sentence
25
+ does not, that check fails — the sentences are measured, not remembered."
26
+ - Mechanism: `test/spec_wire_contract.mjs`, which makes fourteen assertions: the
27
+ signed payload against four candidate encodings, the payload byte length
28
+ against the number in the document, the order of the checks against receipts
29
+ built to fail two at once, the required-field table row by row, the vector
30
+ counts quoted in prose, that every manifest case is described, and that the
31
+ deep-link into this section resolves.
32
+ - Why it falls short: the section contains statements none of those touch —
33
+ that `sig.alg` other than `Ed25519` is rejected before the key is loaded, that
34
+ an unknown `keyId` is a failure rather than a skip, that a non-canonical
35
+ base64 signature is refused rather than normalised, what `--expect-seq-from`
36
+ pins, the JCS limits paragraph, and the whole section on which document is
37
+ normative for what. "Every statement" asserted a property over a section when
38
+ it held over part of it, which is the same shape as a conformance runner
39
+ reporting a class it sampled — the failure this repository has been arguing
40
+ about on the SCITT list for three days, in its own document.
41
+ - Disposition: reworded in e182d9a. The four measured parts are labelled
42
+ **measured** in their headings; the two that are not are labelled **prose**;
43
+ and the introduction states that the prose is not compared to the code by
44
+ anything in the test suite.
45
+
46
+ ### 2. docs/RECEIPT-SPEC.md — `seq`, where the label needed splitting
47
+
48
+ - Claim: `### seq advances by exactly one — measured` (the first correction's
49
+ own first attempt).
50
+ - Mechanism: the order test runs `005-seq-gap` and requires exit 12 with the
51
+ signature removed from the receipt that fails.
52
+ - Why it falls short: that measures the gap case and its position in the check
53
+ order. The non-increasing case and `--expect-seq-from` are exercised by no
54
+ vector, so labelling the whole section "measured" would have repeated the
55
+ first finding one heading down.
56
+ - Disposition: reworded in e182d9a. The section now states which half is
57
+ measured and names the two behaviours no vector exercises.
58
+
59
+ ### 3. README.md:347 — a count that had been wrong in two files
60
+
61
+ - Claim: "conformance vectors — twelve frozen cases plus a machine-readable
62
+ manifest".
63
+ - Mechanism: `test-vectors/manifest.json`, which carries thirteen cases.
64
+ - Why it falls short: the same claim appeared in `README.md` and
65
+ `docs/RECEIPT-SPEC.md`, and the test suite stayed green because each file was
66
+ internally consistent. A reader counting the table in `test-vectors/README.md`
67
+ would have found thirteen and had no way to tell which number was the stale
68
+ one.
69
+ - Disposition: corrected, and the recurrence closed — prose counts in all three
70
+ files are now compared against the manifest by `test/spec_wire_contract.mjs`,
71
+ and every manifest case must appear in the vector README's table.
72
+
73
+ ## Limits recorded rather than left to be found
74
+
75
+ - The prose half of the wire-format section is accurate on this revision and
76
+ pinned by nothing. It is marked as such in the document; a reader who wants a
77
+ guarantee has the four measured parts and the vectors.
78
+ - `test/spec_wire_contract.mjs` compares any prose "N cases" in three files
79
+ against the manifest. A future sentence in one of those files about some other
80
+ document's vector count will fail this check wrongly. The message names the
81
+ file and the phrase, so the cost is one edit, but it is a known edge rather
82
+ than a discovered one.
83
+ - The locale check now reads words as well as letters, and the word list is
84
+ deliberately small: it excludes every Turkish word that is also English. A
85
+ Turkish sentence built only from words outside that list still passes.
86
+ - Turkish design history under `docs/` still ships in the package — 308 word
87
+ occurrences across 19 packed files at the time of this review. The check
88
+ prints that number on every green run rather than passing over it. Whether
89
+ that history belongs in a tarball is a packaging decision, not a claim defect,
90
+ and it is not made here.
@@ -0,0 +1,70 @@
1
+ # Claims review — 0.2.40
2
+
3
+ - base: v0.2.39
4
+ - head: 0c2239c
5
+ - surface: sha256:976a388eaaa1069876dcc0aaeb2f626abfe3fd731a69c4dc51cbe06c8a02d57d
6
+ - verdict: pass
7
+ - reviewer: maintainer, reading the exit-code table against a behaviour change it
8
+ is describing for the first time
9
+
10
+ The surface change is two rows of one table. The finding below is about what the
11
+ old row said rather than what the new one does, and it is the reason the code
12
+ moved.
13
+
14
+ ## Findings
15
+
16
+ ### 1. docs/RECEIPT-SPEC.md — exit 14's row described a skip and let a verdict follow it
17
+
18
+ - Claim: "`anchor:null` receipts are skipped (periodic anchoring)."
19
+ - Mechanism: `conarium-verify --anchor-check` skips each receipt whose `anchor`
20
+ is null rather than failing it, and prints `0/N anchored` in its summary.
21
+ - Why it falls short: the sentence is true of each receipt and silent about the
22
+ run. Skipping every receipt in a chain leaves nothing compared, and the tool
23
+ then exited 0 — which a caller reads as "the anchors hold". The claim describes
24
+ a per-receipt policy; the exit code asserted a per-chain result that no
25
+ comparison supported. Two tests had written the old answer down
26
+ (`test/anchor_verify.mjs` A6.5 and `src/receipt.test.ts` T5.8), so this was a
27
+ decision rather than an oversight, and it had to be argued rather than
28
+ corrected on sight.
29
+ - Disposition: behaviour changed in 0c2239c. A chain under `--anchor-check` where
30
+ no receipt carries an anchor is exit **15** — the value that already means
31
+ "could not be checked". Both rows now say what they cover: 14 keeps the
32
+ per-receipt skip and the `--require-head-anchor` failure, 15 gains the
33
+ nothing-reached case. The expectations were corrected along with the code, and
34
+ the direction of that correction is recorded in both tests rather than left to
35
+ the next reader to reconstruct.
36
+
37
+ ### 2. The summary line was never silent, and the report of this said less than it should
38
+
39
+ - Claim: the description of this defect, as first written and sent to the SCITT
40
+ list, said the tool "reports success, having compared nothing".
41
+ - Mechanism: the run prints `0/N anchored, head anchored: no` on every
42
+ `--anchor-check` invocation, before this change and after it.
43
+ - Why it falls short: the statement is accurate about the exit code and
44
+ incomplete about the output. A reader watching the terminal could always see
45
+ that nothing was anchored. What could not see it was anything consuming the
46
+ exit code, which is the interface that matters for a checker.
47
+ - Disposition: recorded here rather than corrected in flight. The spec, the
48
+ changelog and both tests now state the distinction explicitly — the count was
49
+ always printed, the exit code was the part that claimed more than had been
50
+ examined.
51
+
52
+ ## Limits recorded rather than left to be found
53
+
54
+ - **This is a breaking change for one caller shape.** Anyone running
55
+ `--anchor-check` over chains that are never anchored, and treating 0 as
56
+ success, now gets 15. That is the intent, and it is stated in the changelog
57
+ under its own heading rather than buried in a list.
58
+ - A chain with at least one anchored receipt is unaffected. A run without
59
+ `--anchor-check` is unaffected. Both have a control test, because a fix that
60
+ quietly widened its blast radius would be the same class of defect it was
61
+ written to close.
62
+ - The locale word list grew for the second time by being wrong: four identifiers
63
+ in the shipped verifier (`modelBildirilmemis`, `clientBildirilmemis`, `notlar`,
64
+ `ek`) carried no Turkish-specific letter and were not in the list either. They
65
+ are translated and the words added. The list remains a list of what this
66
+ codebase reached for, not a language detector, and the next miss is expected to
67
+ arrive the same way.
68
+ - Turkish design history under `docs/` still ships in the package. Unchanged from
69
+ 0.2.39, still counted on every green run of `test/pack_locale.mjs`, still a
70
+ packaging decision that has not been made.
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@conarium-ai/core",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "mcpName": "io.github.dogrucanemek-alt/conarium",
5
- "//files-artefakt": "examples/ altindaki uretilmis dosyalar (ozel anahtar, makbuz/denetim JSONL) ELENIR. .gitignore npm'i baglamaz: izin listesinde 'examples' oldugu icin demoyu kosturmus bir makinede 'npm publish' _keys/audit-ed25519.pem'i (OZEL ANAHTAR) ve makbuzlari yayinliyordu. test/pack_artefakt.mjs bunu kilitler. Elemeler examples/ ile SINIRLI: test-vectors/ altindaki receipts.jsonl ve .pub.pem YAYINLANMAK ZORUNDA, yoksa ucuncu taraf konformans vektorlerini kosturamaz.",
6
- "//files": "Pakete NE gireceginin izin listesi. Liste olmadan npm her seyi gonderiyordu: 296 dosya / 1.5 MB — CI workflowlari, gitleaks ayari, 137 KB pazarlama gorseli, sitenin api/chat.js dosyasi. Bir bankanin guvenlik ekibi tarball'i acip bunlari gorur. scripts/ BILEREK var: conarium-reconcile calisirken scripts/pg-snapshot.sql'e atif yapiyor, olmazsa kullanici destek maili yazar.",
5
+ "//files-artefakt": "Generated files under examples/ (private key, receipt/audit JSONL) are EXCLUDED. .gitignore does not bind npm: because the allow-list contained 'examples', `npm publish` on a machine that had run the demo was shipping _keys/audit-ed25519.pem (PRIVATE KEY) and the receipts. test/pack_artefakt.mjs locks this. The exclusions are LIMITED to examples/: receipts.jsonl and .pub.pem under test-vectors/ MUST ship, or a third party cannot run the conformance vectors.",
6
+ "//files": "Allow-list of what enters the package. Without it npm sent everything: 296 files / 1.5 MB — CI workflows, gitleaks config, a 137 KB marketing image, the site's api/chat.js. A bank security team opens the tarball and sees those. scripts/ is here ON PURPOSE: conarium-reconcile references scripts/pg-snapshot.sql at runtime; without it the user files a support mail.",
7
7
  "files": [
8
8
  "dist",
9
9
  "bin",
10
10
  "scripts",
11
11
  "docs",
12
12
  "!docs/reviews",
13
+ "!docs/teaching",
14
+ "!docs/teaching/**",
13
15
  "!docs/benchmarks/*.cpuprofile",
14
16
  "public",
15
17
  "assets",
@@ -105,7 +107,7 @@
105
107
  "node-sql-parser": "^5.4.0",
106
108
  "pgsql-ast-parser": "^12.0.2",
107
109
  "postgres": "^3.4.4",
108
- "zod": "^3.23.8"
110
+ "zod": "4.4.3"
109
111
  },
110
112
  "devDependencies": {
111
113
  "@jazzer.js/core": "^4.0.0",
package/public/app.js CHANGED
@@ -22,7 +22,7 @@ document.addEventListener('DOMContentLoaded', () => {
22
22
  const empty = document.getElementById('receipt-empty')
23
23
  if (empty && name === 'receipts') {
24
24
  empty.hidden = false
25
- empty.textContent = 'Makbuzlar alanı bulunamadı.'
25
+ empty.textContent = 'Receipts panel not found.'
26
26
  }
27
27
  }
28
28
  }
@@ -223,7 +223,7 @@ document.addEventListener('DOMContentLoaded', () => {
223
223
  try {
224
224
  const res = await apiFetch('/api/receipts')
225
225
  if (!res.ok) {
226
- ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı (' + res.status + ').')
226
+ ConariumReceiptsPanel.showError(ui, 'Could not load the receipt list (' + res.status + ').')
227
227
  return
228
228
  }
229
229
  const data = await res.json()
@@ -237,7 +237,7 @@ document.addEventListener('DOMContentLoaded', () => {
237
237
  },
238
238
  })
239
239
  } catch (e) {
240
- ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı.')
240
+ ConariumReceiptsPanel.showError(ui, 'Could not load the receipt list.')
241
241
  }
242
242
  }
243
243
 
@@ -249,18 +249,18 @@ document.addEventListener('DOMContentLoaded', () => {
249
249
  const res = await apiFetch('/api/receipts/' + encodeURIComponent(id))
250
250
  if (!res.ok) {
251
251
  detail.hidden = false
252
- detail.textContent = 'Makbuz okunamadı (' + res.status + ').'
252
+ detail.textContent = 'Could not read the receipt (' + res.status + ').'
253
253
  return
254
254
  }
255
255
  const data = await res.json()
256
256
  detail.hidden = false
257
257
  detail.innerHTML = data.html || ''
258
258
  if (data.html && /BEGIN PRIVATE KEY|BEGIN.*PRIVATE/.test(data.html)) {
259
- detail.textContent = 'özel anahtar panele düştü — gösterilmedi'
259
+ detail.textContent = 'a private key reached the panel — not shown'
260
260
  }
261
261
  } catch (e) {
262
262
  detail.hidden = false
263
- detail.textContent = 'Makbuz okunamadı.'
263
+ detail.textContent = 'Could not read the receipt.'
264
264
  }
265
265
  }
266
266