@codemem/core 0.49.0-beta.2 → 0.49.0-beta.4

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 (179) hide show
  1. package/dist/better-sqlite-coordinator-store.d.ts +21 -2
  2. package/dist/better-sqlite-coordinator-store.d.ts.map +1 -1
  3. package/dist/coordinator-account-change-authority.d.ts +56 -0
  4. package/dist/coordinator-account-change-authority.d.ts.map +1 -0
  5. package/dist/coordinator-account-change-decision.d.ts +141 -0
  6. package/dist/coordinator-account-change-decision.d.ts.map +1 -0
  7. package/dist/coordinator-account-change-http-test-fixtures.d.ts +3 -1
  8. package/dist/coordinator-account-change-http-test-fixtures.d.ts.map +1 -1
  9. package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts +61 -0
  10. package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts.map +1 -0
  11. package/dist/coordinator-account-change.d.ts +7 -1
  12. package/dist/coordinator-account-change.d.ts.map +1 -1
  13. package/dist/coordinator-account-connection-schema.d.ts +31 -0
  14. package/dist/coordinator-account-connection-schema.d.ts.map +1 -1
  15. package/dist/coordinator-account-connection-session.d.ts +9 -0
  16. package/dist/coordinator-account-connection-session.d.ts.map +1 -1
  17. package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts +7 -0
  18. package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts.map +1 -0
  19. package/dist/coordinator-account-historical-revoke.d.ts +8 -2
  20. package/dist/coordinator-account-historical-revoke.d.ts.map +1 -1
  21. package/dist/coordinator-account-link-status.d.ts.map +1 -1
  22. package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts +58 -0
  23. package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts.map +1 -0
  24. package/dist/coordinator-account-schema-test-fixtures.d.ts +20 -0
  25. package/dist/coordinator-account-schema-test-fixtures.d.ts.map +1 -0
  26. package/dist/coordinator-auth-browser-owner-purpose-test-harness.d.ts.map +1 -1
  27. package/dist/coordinator-auth-browser-transaction-test-fixtures.d.ts.map +1 -1
  28. package/dist/coordinator-auth-browser-transaction.d.ts.map +1 -1
  29. package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts +5 -1
  30. package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts.map +1 -1
  31. package/dist/coordinator-auth-controller-history.d.ts +0 -1
  32. package/dist/coordinator-auth-controller-history.d.ts.map +1 -1
  33. package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts +41 -0
  34. package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts.map +1 -0
  35. package/dist/coordinator-auth-controller-owner.d.ts +0 -6
  36. package/dist/coordinator-auth-controller-owner.d.ts.map +1 -1
  37. package/dist/coordinator-auth-controller-race-test-fixtures.d.ts +38 -0
  38. package/dist/coordinator-auth-controller-race-test-fixtures.d.ts.map +1 -0
  39. package/dist/coordinator-auth-controller-read-set.d.ts +47 -0
  40. package/dist/coordinator-auth-controller-read-set.d.ts.map +1 -0
  41. package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts +8 -0
  42. package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts.map +1 -0
  43. package/dist/coordinator-auth-controller.d.ts +1 -21
  44. package/dist/coordinator-auth-controller.d.ts.map +1 -1
  45. package/dist/coordinator-auth-device-claim-eligibility.d.ts +39 -1
  46. package/dist/coordinator-auth-device-claim-eligibility.d.ts.map +1 -1
  47. package/dist/coordinator-auth-historical-store-test-fixture.d.ts +2 -0
  48. package/dist/coordinator-auth-historical-store-test-fixture.d.ts.map +1 -1
  49. package/dist/coordinator-auth-legacy-assignment.d.ts +4 -2
  50. package/dist/coordinator-auth-legacy-assignment.d.ts.map +1 -1
  51. package/dist/coordinator-auth-link-authority-upgrade.d.ts +5 -0
  52. package/dist/coordinator-auth-link-authority-upgrade.d.ts.map +1 -1
  53. package/dist/coordinator-auth-link-maintenance-fixtures.d.ts +2 -2
  54. package/dist/coordinator-auth-link-maintenance-fixtures.d.ts.map +1 -1
  55. package/dist/coordinator-auth-link-provenance.d.ts.map +1 -1
  56. package/dist/coordinator-auth-link-revocation-test-harness.d.ts.map +1 -1
  57. package/dist/coordinator-auth-link-test-fixtures.d.ts +26 -4
  58. package/dist/coordinator-auth-link-test-fixtures.d.ts.map +1 -1
  59. package/dist/coordinator-auth-link.d.ts +4 -0
  60. package/dist/coordinator-auth-link.d.ts.map +1 -1
  61. package/dist/coordinator-auth-read-set.d.ts +99 -0
  62. package/dist/coordinator-auth-read-set.d.ts.map +1 -0
  63. package/dist/coordinator-auth-schema-stage.d.ts +36 -0
  64. package/dist/coordinator-auth-schema-stage.d.ts.map +1 -0
  65. package/dist/coordinator-auth-schema.d.ts.map +1 -1
  66. package/dist/coordinator-auth-session.d.ts.map +1 -1
  67. package/dist/coordinator-auth-store-test-fixtures.d.ts +12 -0
  68. package/dist/coordinator-auth-store-test-fixtures.d.ts.map +1 -1
  69. package/dist/coordinator-controller-revocation-test-harness.d.ts.map +1 -1
  70. package/dist/coordinator-d1-schema-inventory.d.ts +10 -0
  71. package/dist/coordinator-d1-schema-inventory.d.ts.map +1 -0
  72. package/dist/coordinator-device-claim-binding-reuse.d.ts +2 -0
  73. package/dist/coordinator-device-claim-binding-reuse.d.ts.map +1 -1
  74. package/dist/coordinator-device-claim-binding-sql.d.ts +8 -0
  75. package/dist/coordinator-device-claim-binding-sql.d.ts.map +1 -1
  76. package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts +88 -0
  77. package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts.map +1 -0
  78. package/dist/coordinator-device-ownership-evidence-queries.d.ts +4 -14
  79. package/dist/coordinator-device-ownership-evidence-queries.d.ts.map +1 -1
  80. package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts +10 -0
  81. package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts.map +1 -1
  82. package/dist/coordinator-device-ownership-evidence.d.ts +11 -3
  83. package/dist/coordinator-device-ownership-evidence.d.ts.map +1 -1
  84. package/dist/coordinator-device-rebind-browser.d.ts +1 -1
  85. package/dist/coordinator-device-rebind-ceremony.d.ts +2 -1
  86. package/dist/coordinator-device-rebind-ceremony.d.ts.map +1 -1
  87. package/dist/coordinator-device-rebind-commit.d.ts.map +1 -1
  88. package/dist/coordinator-device-rebind-test-fixtures.d.ts.map +1 -1
  89. package/dist/coordinator-device-self-bind-authority.d.ts +11 -2
  90. package/dist/coordinator-device-self-bind-authority.d.ts.map +1 -1
  91. package/dist/coordinator-device-self-bind-decision.d.ts +84 -0
  92. package/dist/coordinator-device-self-bind-decision.d.ts.map +1 -0
  93. package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts +17 -0
  94. package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts.map +1 -0
  95. package/dist/coordinator-device-self-bind-reviewed-history.d.ts +10 -0
  96. package/dist/coordinator-device-self-bind-reviewed-history.d.ts.map +1 -0
  97. package/dist/coordinator-device-self-bind-test-fixtures.d.ts +15 -1
  98. package/dist/coordinator-device-self-bind-test-fixtures.d.ts.map +1 -1
  99. package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts +6 -2
  100. package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts.map +1 -1
  101. package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts +77 -0
  102. package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts.map +1 -0
  103. package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts +46 -0
  104. package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts.map +1 -0
  105. package/dist/coordinator-legacy-completion-owner-proof.d.ts +19 -2
  106. package/dist/coordinator-legacy-completion-owner-proof.d.ts.map +1 -1
  107. package/dist/coordinator-legacy-owner-compatibility.d.ts +23 -0
  108. package/dist/coordinator-legacy-owner-compatibility.d.ts.map +1 -1
  109. package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts +63 -0
  110. package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts.map +1 -0
  111. package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts +3 -1
  112. package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts.map +1 -1
  113. package/dist/coordinator-legacy-owner-resolution-commit.d.ts.map +1 -1
  114. package/dist/coordinator-owner-enrollment-commit.d.ts.map +1 -1
  115. package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts +2 -0
  116. package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts.map +1 -1
  117. package/dist/coordinator-owner-enrollment-start-test-fixtures.d.ts.map +1 -1
  118. package/dist/coordinator-owner-negative-consistency.d.ts +11 -17
  119. package/dist/coordinator-owner-negative-consistency.d.ts.map +1 -1
  120. package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts +44 -0
  121. package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts.map +1 -0
  122. package/dist/coordinator-owner-negative-race-test-fixtures.d.ts +26 -0
  123. package/dist/coordinator-owner-negative-race-test-fixtures.d.ts.map +1 -0
  124. package/dist/coordinator-owner-negative-read-set.d.ts +43 -0
  125. package/dist/coordinator-owner-negative-read-set.d.ts.map +1 -0
  126. package/dist/coordinator-owner-negative-reads.d.ts +32 -0
  127. package/dist/coordinator-owner-negative-reads.d.ts.map +1 -0
  128. package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts +26 -0
  129. package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts.map +1 -0
  130. package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts +1 -0
  131. package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts.map +1 -1
  132. package/dist/coordinator-owner-resolution-review.d.ts +1 -0
  133. package/dist/coordinator-owner-resolution-review.d.ts.map +1 -1
  134. package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts +8 -2
  135. package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts.map +1 -1
  136. package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts +54 -0
  137. package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts.map +1 -0
  138. package/dist/coordinator-recipient-owner-consistency.d.ts +4 -5
  139. package/dist/coordinator-recipient-owner-consistency.d.ts.map +1 -1
  140. package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts +30 -0
  141. package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts.map +1 -0
  142. package/dist/coordinator-resolved-account-owner-status-query.d.ts +4 -1
  143. package/dist/coordinator-resolved-account-owner-status-query.d.ts.map +1 -1
  144. package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts +1 -0
  145. package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts.map +1 -1
  146. package/dist/coordinator-resolved-account-owner-status.d.ts +2 -0
  147. package/dist/coordinator-resolved-account-owner-status.d.ts.map +1 -1
  148. package/dist/{coordinator-runtime-kbPwxxKq.js → coordinator-runtime-BXJQAKFD.js} +3 -3
  149. package/dist/{coordinator-runtime-kbPwxxKq.js.map → coordinator-runtime-BXJQAKFD.js.map} +1 -1
  150. package/dist/coordinator-sql-compare.d.ts +22 -0
  151. package/dist/coordinator-sql-compare.d.ts.map +1 -0
  152. package/dist/d1-coordinator-store.d.ts +16 -1
  153. package/dist/d1-coordinator-store.d.ts.map +1 -1
  154. package/dist/index.d.ts +2 -1
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +8907 -8434
  157. package/dist/index.js.map +1 -1
  158. package/dist/internal/cloudflare-coordinator.js +1070 -1065
  159. package/dist/internal/cloudflare-coordinator.js.map +1 -1
  160. package/dist/internal/relay-runtime.js +2 -2
  161. package/dist/linked-legacy-setup-test-fixtures.d.ts +2 -0
  162. package/dist/linked-legacy-setup-test-fixtures.d.ts.map +1 -1
  163. package/dist/{owner-enrollment-start-BtoRKf3z.js → owner-enrollment-start-BsDwgxAh.js} +2660 -2438
  164. package/dist/owner-enrollment-start-BsDwgxAh.js.map +1 -0
  165. package/dist/owner-enrollment-start.d.ts.map +1 -1
  166. package/dist/relay-admission-table-keys-test-fixtures.d.ts +2 -1
  167. package/dist/relay-admission-table-keys-test-fixtures.d.ts.map +1 -1
  168. package/dist/{relay-peer-client-0XpekgnZ.js → relay-peer-client-DrTb2oZt.js} +2631 -2617
  169. package/dist/relay-peer-client-DrTb2oZt.js.map +1 -0
  170. package/dist/{sync-auth-constants-DvALG0T0.js → sync-auth-constants-BVzVfSmn.js} +4019 -3416
  171. package/dist/sync-auth-constants-BVzVfSmn.js.map +1 -0
  172. package/dist/{sync-reachability-pass-BpDt2z4y.js → sync-reachability-pass-CUe5bK61.js} +12 -12
  173. package/dist/{sync-reachability-pass-BpDt2z4y.js.map → sync-reachability-pass-CUe5bK61.js.map} +1 -1
  174. package/dist/sync-reachability-pass-D9cA54fj.js +2 -0
  175. package/package.json +3 -3
  176. package/dist/owner-enrollment-start-BtoRKf3z.js.map +0 -1
  177. package/dist/relay-peer-client-0XpekgnZ.js.map +0 -1
  178. package/dist/sync-auth-constants-DvALG0T0.js.map +0 -1
  179. package/dist/sync-reachability-pass-Bi4GBi-x.js +0 -2
@@ -0,0 +1,46 @@
1
+ import type { LinkFixture } from "./coordinator-auth-link-test-fixtures.js";
2
+ import type { Backend } from "./coordinator-auth-store-test-fixtures.js";
3
+ import type { CoordinatorLegacyTeamCompletionManifestV1 } from "./coordinator-legacy-team-completion.js";
4
+ export declare const futureGroup = "future-completion";
5
+ export declare const completions = "coordinator_legacy_team_completions";
6
+ export declare const resolutions = "coordinator_legacy_owner_resolutions";
7
+ export declare const controllers = "coordinator_auth_controller_attestations";
8
+ export declare function manifest(f: LinkFixture, owner?: string, options?: {
9
+ deviceId?: string;
10
+ publicKey?: string;
11
+ groupId?: string;
12
+ }): CoordinatorLegacyTeamCompletionManifestV1;
13
+ export declare function ordinary(f: LinkFixture): Promise<CoordinatorLegacyTeamCompletionManifestV1>;
14
+ export declare function recovery(f: LinkFixture, kind: Backend): Promise<{
15
+ h: {
16
+ backend: import("./coordinator-auth-link.js").AuthLinkBackend & Required<Pick<import("./coordinator-auth-link.js").AuthLinkBackend, "readBatch">>;
17
+ hooks: {
18
+ beforeBatch?: () => void;
19
+ mapStatement?: (statement: import("./coordinator-auth-link.js").AuthLinkStatement) => import("./coordinator-auth-link.js").AuthLinkStatement;
20
+ afterBatch?: () => void;
21
+ beforeFirst?: (statement: import("./coordinator-auth-link.js").AuthLinkStatement) => void;
22
+ };
23
+ batchCount: () => number;
24
+ resetBatchCount: () => void;
25
+ evidence: import("./coordinator-device-ownership-evidence.js").CoordinatorDeviceOwnershipEvidence;
26
+ };
27
+ result: {
28
+ controller: import("./coordinator-auth-controller.js").CoordinatorAuthControllerAttestation;
29
+ controllerDisposition: "created" | "reused";
30
+ resolution: import("./coordinator-legacy-owner-resolution-metadata.js").LegacyOwnerResolutionRecord;
31
+ resolutionDisposition: "created" | "reused";
32
+ };
33
+ value: CoordinatorLegacyTeamCompletionManifestV1;
34
+ }>;
35
+ export declare const WINNING_INSERT: RegExp;
36
+ export declare const GUARD_MARKER = "auth_snapshot_changed";
37
+ /**
38
+ * Runs `inject` once, just before the winning transaction starts. Both stores write the
39
+ * completion in one transaction the capture's guards lead (the D1 batch is one), so this
40
+ * is the last moment a concurrent write can land. A hook inside it would be rolled back
41
+ * with the batch, or would model an interleaving neither store allows.
42
+ */
43
+ export declare function beforeWinningBatch(f: LinkFixture, inject: () => void): {
44
+ injected: () => boolean;
45
+ };
46
+ //# sourceMappingURL=coordinator-legacy-completion-owner-proof-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-legacy-completion-owner-proof-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAUzE,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,yCAAyC,CAAC;AAOzG,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,WAAW,wCAAwC,CAAC;AACjE,eAAO,MAAM,WAAW,yCAAyC,CAAC;AAClE,eAAO,MAAM,WAAW,6CAA6C,CAAC;AAEtE,wBAAgB,QAAQ,CACvB,CAAC,EAAE,WAAW,EACd,KAAK,SAAe,EACpB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACvE,yCAAyC,CA+B3C;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,WAAW,sDAQ5C;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;GA8D3D;AAED,eAAO,MAAM,cAAc,QACqD,CAAC;AACjF,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI;IAuB3D,QAAQ;EACjB"}
@@ -15,8 +15,14 @@ interface Subject extends EvidenceSubject {
15
15
  fingerprints: string[];
16
16
  }
17
17
  interface ProofSql {
18
+ /**
19
+ * One per capture read. Each re-runs its read and aborts its batch unless the rows are
20
+ * still the captured set. They lead the winning INSERT's batch, and the denial read.
21
+ */
22
+ readonly guards: readonly AuthLinkStatement[];
18
23
  /** Append after LEGACY_OWNER_INPUT_SQL, which already starts WITH. */
19
24
  readonly ctes: string;
25
+ /** "1" once captured; "0" when the capture is unavailable, so nothing can be written. */
20
26
  readonly currentSql: string;
21
27
  readonly compatibleSql: string;
22
28
  /** Bind after the three LEGACY_OWNER_INPUT_SQL values. */
@@ -30,6 +36,16 @@ export declare function prepareCompletionHistory(rows: EvidenceRow[], decode?: (
30
36
  }[];
31
37
  /** Internal subject view; canonical validation remains subject-specific. */
32
38
  export declare function subjectHistory(rows: EvidenceRows, subject: Subject, keys: Map<string, string>, prepared: ReturnType<typeof prepareCompletionHistory>): ControllerHistorySnapshot;
39
+ /**
40
+ * Internal; exported for its tests. Re-runs one read, `prefix` then a SELECT of distinct
41
+ * `row` texts, and aborts its batch unless those rows are exactly `rows`: equal as sorted
42
+ * text, so each original JSON lexeme must match, and none may be added or removed.
43
+ */
44
+ export declare function capturedRowsGuard(read: {
45
+ prefix: string;
46
+ sql: string;
47
+ values: readonly string[];
48
+ }, rows: readonly string[]): AuthLinkStatement;
33
49
  /** Read-only capture. No submitted approved-subject list or source reference is accepted.
34
50
  * Call only after the stores validate the canonical manifest and its source binding.
35
51
  */
@@ -39,8 +55,9 @@ export declare function captureLegacyCompletionOwnerProof(input: {
39
55
  manifestJson: string;
40
56
  keyMetadata: string;
41
57
  }): Promise<LegacyCompletionOwnerProof>;
42
- /** The winning INSERT must use both predicates. A token by itself grants nothing.
43
- * Keep LEGACY_OWNER_SOURCE_CURRENT_SQL and all ordinary completion checks as well.
58
+ /** The winning INSERT must use both predicates, in one batch its guards lead. A token
59
+ * by itself grants nothing. Keep LEGACY_OWNER_SOURCE_CURRENT_SQL and all ordinary
60
+ * completion checks as well.
44
61
  */
45
62
  export declare function legacyCompletionOwnerProofSql(proof: LegacyCompletionOwnerProof): ProofSql;
46
63
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-completion-owner-proof.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAG9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAGpB,MAAM,qDAAqD,CAAC;AAoB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AC,0BAA0B,CAAC,CAyBtC;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,QAAQ,CAEzF"}
1
+ {"version":3,"file":"coordinator-legacy-completion-owner-proof.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAG9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAGpB,MAAM,qDAAqD,CAAC;AAoB7D,UAAU,OAAO;IAChB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACnD;AAED,qEAAqE;AACrE,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACpB;AAED,UAAU,OAAQ,SAAQ,eAAe;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAcD,UAAU,QAAQ;IACjB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC9C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AA6VD,8EAA8E;AAC9E,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,WAAW,EAAE,EACnB,MAAM,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB;;;;IAsB9C;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzB,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GACnD,yBAAyB,CA8C3B;AA8HD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAChE,IAAI,EAAE,SAAS,MAAM,EAAE,GACrB,iBAAiB,CAMnB;AAyID;;GAEG;AACH,wBAAsB,iCAAiC,CAAC,KAAK,EAAE;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAwBtC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,QAAQ,CAEzF"}
@@ -1,3 +1,4 @@
1
+ import type { AuthLinkStatement } from "./coordinator-auth-link.js";
1
2
  import { type CoordinatorLegacyTeamCompletionWriteResult } from "./coordinator-legacy-team-completion.js";
2
3
  /** Both the early replay and the post-INSERT winner retain the canonical row. */
3
4
  export declare function legacyCompletionWriteResult(storedJson: string, requestedJson: string, status: CoordinatorLegacyTeamCompletionWriteResult["status"]): CoordinatorLegacyTeamCompletionWriteResult;
@@ -30,4 +31,26 @@ export declare const LEGACY_OWNER_SOURCE_CURRENT_SQL = "(NOT EXISTS (SELECT 1 FR
30
31
  export declare const LEGACY_OWNER_COMPATIBLE_SQL: string;
31
32
  /** Used only to explain a refused INSERT; this cannot authorize a write. */
32
33
  export declare const LEGACY_OWNER_DENIAL_SQL: string;
34
+ /**
35
+ * The winning completion INSERT. Every ordinary completion check and both owner checks
36
+ * run in it, so they decide at write time; the capture's guards lead its batch. `proof`
37
+ * starts with the three LEGACY_OWNER_INPUT_SQL values.
38
+ */
39
+ export declare function legacyCompletionInsertStatement(input: {
40
+ proof: {
41
+ ctes: string;
42
+ currentSql: string;
43
+ compatibleSql: string;
44
+ values: readonly (string | number | null)[];
45
+ };
46
+ groupId: string;
47
+ manifest: {
48
+ candidate_ref: string;
49
+ version: number;
50
+ completed_at: string;
51
+ };
52
+ manifestJson: string;
53
+ coordinatorId: string | null;
54
+ createdAt: string;
55
+ }): AuthLinkStatement;
33
56
  //# sourceMappingURL=coordinator-legacy-owner-compatibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-compatibility.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-compatibility.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,0CAA0C,EAG/C,MAAM,yCAAyC,CAAC;AAKjD,iFAAiF;AACjF,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,0CAA0C,CAAC,QAAQ,CAAC,GAC1D,0CAA0C,CAM5C;AA4BD,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,QAMS,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,SAAS;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAqBjC,CAAC;AAGH,eAAO,MAAM,+BAA+B,4PAGmC,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAqBtC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,QAGkB,CAAC"}
1
+ {"version":3,"file":"coordinator-legacy-owner-compatibility.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAIN,KAAK,0CAA0C,EAG/C,MAAM,yCAAyC,CAAC;AAKjD,iFAAiF;AACjF,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,0CAA0C,CAAC,QAAQ,CAAC,GAC1D,0CAA0C,CAM5C;AA4BD,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,QAMS,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,SAAS;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAqBjC,CAAC;AAGH,eAAO,MAAM,+BAA+B,4PAGmC,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAqBtC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,QAGkB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACtD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;KAC5C,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,iBAAiB,CA4DpB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Test-only. This file exists only to pin equivalence with the pre-port SQL.
3
+ *
4
+ * Between the markers are, copied verbatim from main at 075d46647 before the owner
5
+ * resolution commit moved to read-set guards: the snapshot, owner and resolution stages
6
+ * of coordinator-auth-controller.ts with the statements built on them, and the commit
7
+ * half of coordinator-legacy-owner-resolution-commit.ts. Only the commit's entry point
8
+ * was renamed, and its evidence collector type now names the verbatim pre-port collector.
9
+ * The review capture it reads is imported: it is unchanged since that commit. Its unused
10
+ * `digest` helper was dropped. Do not edit
11
+ * the copy to follow later changes; delete this file with
12
+ * coordinator-legacy-owner-resolution-commit-equivalence.test.ts.
13
+ */
14
+ import type { CoordinatorAuthControllerAttestation, CoordinatorAuthControllerReviewInput } from "./coordinator-auth-controller.js";
15
+ import type { AuthLinkBackend } from "./coordinator-auth-link.js";
16
+ import type { OriginalDeviceOwnershipEvidence } from "./coordinator-device-ownership-evidence-original-sql-test-fixtures.js";
17
+ import { type LegacyOwnerResolutionRecord } from "./coordinator-legacy-owner-resolution-metadata.js";
18
+ /** Pin the actual enrollment used to derive the revocation key across async reads. */
19
+ export declare function authControllerAuthorityValues(source: {
20
+ group_id: string;
21
+ device_id: string;
22
+ public_key: string;
23
+ fingerprint: string;
24
+ identity_id: string | null;
25
+ }, keyId: string | null): (string | null)[];
26
+ export declare const AUTH_CONTROLLER_ENROLLMENT_SQL = "\n\tSELECT e.* FROM enrolled_devices e WHERE e.group_id = ? AND e.device_id = ?";
27
+ export declare const AUTH_CONTROLLER_INSERT_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\tINSERT INTO coordinator_auth_controller_attestations (\n\t\tattestation_id, coordinator_id, identity_id, group_id, device_id, public_key,\n\t\tfingerprint, review_receipt_id, evidence_digest, enrollment_identity_id, revision, created_at, revoked_at\n\t)\n\tSELECT ?, ?, ?, e.group_id, e.device_id, e.public_key, e.fingerprint, ?, ?, e.identity_id, 1, ?, NULL\n\tFROM enrolled_devices e JOIN groups g ON g.group_id = e.group_id\n\tWHERE e.group_id = ? AND e.device_id = ? AND e.enabled = 1 AND g.archived_at IS NULL\n\t\tAND e.public_key = ? AND e.fingerprint = ? AND (e.identity_id IS NULL OR e.identity_id = ?)\n\t\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))\n\t\t\n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
28
+ /** Retry eligibility is read atomically with all the same live evidence guards. */
29
+ export declare const AUTH_CONTROLLER_RETRY_ELIGIBLE_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\tSELECT 1 AS eligible FROM enrolled_devices e JOIN groups g ON g.group_id = e.group_id\n\tWHERE e.group_id = ? AND e.device_id = ? AND e.enabled = 1 AND g.archived_at IS NULL\n\t\tAND e.public_key = ? AND e.fingerprint = ? AND (e.identity_id IS NULL OR e.identity_id = ?)\n\t\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))\n\t\t\n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
30
+ /** Named builder keeps ordinary exported SQL unchanged and usable without connection tables. */
31
+ export declare function authControllerReviewSql(base: string, input: CoordinatorAuthControllerReviewInput): string;
32
+ /** Internal explicit-resolution path only. The collector must first prove the
33
+ * current label weak; snapshot and authority guards still pin that exact label.
34
+ * Ordinary creation, retries and mutation readers retain their original SQL.
35
+ */
36
+ export declare function authControllerOwnerResolutionSql(mode: "create" | "eligible", input: CoordinatorAuthControllerReviewInput): string;
37
+ /** Keep eligibility proof roots flat when composing a checked batch assertion. */
38
+ export declare function authControllerOwnerResolutionStages(mode: "create" | "eligible", input: CoordinatorAuthControllerReviewInput): {
39
+ ctes: string;
40
+ statement: string;
41
+ };
42
+ export declare function authControllerRetryEligibleValues(input: CoordinatorAuthControllerReviewInput, authority: (string | null)[]): (string | null)[];
43
+ export declare function authControllerInsertValues(input: CoordinatorAuthControllerReviewInput, createdAt: string, authority: (string | null)[]): (string | null)[];
44
+ export declare const AUTH_CONTROLLER_CURRENT_ENROLLMENT_SQL: string;
45
+ export declare const AUTH_CONTROLLER_ACTIVE_SQL = "\n\t\n\tSELECT a.* FROM coordinator_auth_controller_attestations a\n\tJOIN enrolled_devices e ON e.group_id = a.group_id AND e.device_id = a.device_id\n\tJOIN groups g ON g.group_id = a.group_id\n\tWHERE a.coordinator_id = ? AND a.attestation_id = ? AND a.revoked_at IS NULL\n\t\tAND e.enabled = 1 AND g.archived_at IS NULL AND e.public_key = a.public_key\n\t\tAND e.fingerprint = a.fingerprint\n\t\tAND (e.identity_id IS NULL OR e.identity_id = a.identity_id) \n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
46
+ /** D1 retries must return the row checked against live authority in this statement. */
47
+ export declare const AUTH_CONTROLLER_RETRY_ACTIVE_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\t\n\t\n\tSELECT a.* FROM coordinator_auth_controller_attestations a\n\tJOIN enrolled_devices e ON e.group_id = a.group_id AND e.device_id = a.device_id\n\tJOIN groups g ON g.group_id = a.group_id\n\tWHERE a.coordinator_id = ? AND a.attestation_id = ? AND a.revoked_at IS NULL\n\t\tAND e.enabled = 1 AND g.archived_at IS NULL AND e.public_key = a.public_key\n\t\tAND e.fingerprint = a.fingerprint\n\t\tAND (e.identity_id IS NULL OR e.identity_id = a.identity_id) \n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))\n\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))";
48
+ export declare function authControllerRetryActiveValues(input: CoordinatorAuthControllerReviewInput, authority: (string | null)[]): (string | null)[];
49
+ /** Exactly one checked backend batch. A postcommit read failure is a persistence
50
+ * error, never a claim that the successful transaction changed nothing.
51
+ */
52
+ export declare function commitOriginalReviewedOwnerResolution(options: {
53
+ backend: AuthLinkBackend;
54
+ evidence: OriginalDeviceOwnershipEvidence;
55
+ review: unknown;
56
+ now: string;
57
+ }): Promise<{
58
+ controller: CoordinatorAuthControllerAttestation;
59
+ controllerDisposition: "created" | "reused";
60
+ resolution: LegacyOwnerResolutionRecord;
61
+ resolutionDisposition: "created" | "reused";
62
+ }>;
63
+ //# sourceMappingURL=coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uEAAuE,CAAC;AAM7H,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAgD3D,sFAAsF;AACtF,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,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AAK,EAAE,oCAAoC,EAC3C,SAAS,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAC1B,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAQnB;AA4TD;;GAEG;AACH,wBAAsB,qCAAqC,CAAC,OAAO,EAAE;IACpE,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
@@ -28,7 +28,7 @@ export interface InternalReviewFixture {
28
28
  }
29
29
  export declare function snapshot(f: LinkFixture, except?: string[]): (string | unknown[])[][];
30
30
  export declare function backendFor(f: LinkFixture, kind: Backend): {
31
- backend: AuthLinkBackend;
31
+ backend: AuthLinkBackend & Required<Pick<AuthLinkBackend, "readBatch">>;
32
32
  hooks: {
33
33
  beforeBatch?: () => void;
34
34
  mapStatement?: (statement: AuthLinkStatement) => AuthLinkStatement;
@@ -48,6 +48,8 @@ export declare function buildReview(f: LinkFixture, options?: {
48
48
  existingController?: CoordinatorAuthControllerAttestation | null;
49
49
  existingResolution?: LegacyOwnerResolutionRecord | null;
50
50
  resolutionId?: string;
51
+ /** Runs after the requester's enrollment label is read, before evidence is collected. */
52
+ afterRequester?: () => void;
51
53
  }): Promise<InternalReviewFixture>;
52
54
  export declare function originalController(f: LinkFixture, groupId?: string, publicKey?: string): Promise<CoordinatorAuthControllerAttestation>;
53
55
  export declare function revoke(f: LinkFixture, subject: "device_id" | "ed25519_key", origin?: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-test-fixtures.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE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AW,EAAE,OAAO,SAAc,EAAE,UAAU,SAAe,QAmCvF;AAED,wBAAsB,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0B7F;AAyDD,wBAAsB,WAAW,CAChC,CAAC,EAAE,WAAW,EACd,OAAO,GAAE;IACR,kBAAkB,CAAC,EAAE,oCAAoC,GAAG,IAAI,CAAC;IACjE,kBAAkB,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACjB,GACJ,OAAO,CAAC,qBAAqB,CAAC,CAsDhC;AAED,wBAAsB,kBAAkB,CACvC,CAAC,EAAE,WAAW,EACd,OAAO,SAAiB,EACxB,SAAS,SAAmB,iDAkB5B;AAED,wBAAsB,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,MAAM,UAAQ,iBAsBhG"}
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAO,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGhG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAQrG,eAAO,MAAM,GAAG,QAA8B,CAAC;AAC/C,eAAO,MAAM,MAAM;IAClB,OAAO;IACP,QAAQ;IACR,SAA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CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GACJ,OAAO,CAAC,qBAAqB,CAAC,CAwDhC;AAED,wBAAsB,kBAAkB,CACvC,CAAC,EAAE,WAAW,EACd,OAAO,SAAiB,EACxB,SAAS,SAAmB,iDAkB5B;AAED,wBAAsB,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,MAAM,UAAQ,iBAsBhG"}
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-resolution-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAGzC,MAAM,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAErG,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,EAAE,oCAAoC,CAAC;IACvD,kBAAkB,EAAE,oCAAoC,GAAG,IAAI,CAAC;IAChE,kBAAkB,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE;QACR,OAAO,EAAE,wBAAwB,CAAC;QAClC,KAAK,EAAE,uCAAuC,CAAC;QAC/C,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;CACF;AA0MD,gFAAgF;AAChF,wBAAgB,oCAAoC,CACnD,KAAK,EAAE,OAAO,GACZ,6BAA6B,GAAG,IAAI,CA+CtC;AA8QD;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC5D,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,kCAAkC,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAGzC,MAAM,kCAAkC,CAAC;AAU1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAErG,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,EAAE,oCAAoC,CAAC;IACvD,kBAAkB,EAAE,oCAAoC,GAAG,IAAI,CAAC;IAChE,kBAAkB,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE;QACR,OAAO,EAAE,wBAAwB,CAAC;QAClC,KAAK,EAAE,uCAAuC,CAAC;QAC/C,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;CACF;AA0MD,gFAAgF;AAChF,wBAAgB,oCAAoC,CACnD,KAAK,EAAE,OAAO,GACZ,6BAA6B,GAAG,IAAI,CA+CtC;AA0QD;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC5D,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,kCAAkC,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-owner-enrollment-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-commit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAMrF,OAAO,EACN,KAAK,qBAAqB,IAAI,YAAY,EAI1C,MAAM,yCAAyC,CAAC;AAQjD,OAAO,EACN,KAAK,YAAY,EACjB,8BAA8B,GAC9B,MAAM,yCAAyC,CAAC;AAEjD,oEAAoE;AACpE,eAAO,MAAM,6CAA6C,oYAMvD,CAAC;AAEJ,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,6hBAKqD,CAAC;AAGxF,wBAAgB,8BAA8B,CAC7C,eAAe,EAAE,YAAY,GAAG,mCAAmC,GACjE,MAAM,CAOR;AAwDD,UAAU,0BAA0B;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,GAAG,EAAE,YAAY,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,CA4D/F;AA+OD,4GAA4G;AAC5G,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,YAAY,GACf,OAAO,CAAC,OAAO,CAAC,CAelB"}
1
+ {"version":3,"file":"coordinator-owner-enrollment-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-commit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAOrF,OAAO,EACN,KAAK,qBAAqB,IAAI,YAAY,EAI1C,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EACN,KAAK,YAAY,EACjB,8BAA8B,GAC9B,MAAM,yCAAyC,CAAC;AAEjD,oEAAoE;AACpE,eAAO,MAAM,6CAA6C,oYAMvD,CAAC;AAEJ,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,6hBAKqD,CAAC;AAGxF,wBAAgB,8BAA8B,CAC7C,eAAe,EAAE,YAAY,GAAG,mCAAmC,GACjE,MAAM,CAOR;AAwDD,UAAU,0BAA0B;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,GAAG,EAAE,YAAY,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,CAyD/F;AAmOD,4GAA4G;AAC5G,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,YAAY,GACf,OAAO,CAAC,OAAO,CAAC,CAelB"}
@@ -3,6 +3,8 @@ import { seedOwnerCallbackGroups } from "./coordinator-owner-enrollment-start-te
3
3
  export interface OwnerAccountHistoryOptions {
4
4
  authority?: "controller_attestation" | "device_claim";
5
5
  defect?: HistoricalAccountDefect;
6
+ /** `v2` keeps the coordinator as a V2 release left it, for tests of that schema. */
7
+ accountSchema?: "current" | "v2";
6
8
  }
7
9
  export declare function ownerStartFixture(options?: OwnerAccountHistoryOptions): import("./coordinator-owner-enrollment-start-test-fixtures.js").OwnerStartFixture;
8
10
  /** Grants are independent historical controller receipts, including in device-claim exclusion tests. */
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-owner-enrollment-historical-test-fixture.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-historical-test-fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAG7F,OAAO,EAGN,uBAAuB,EACvB,MAAM,uDAAuD,CAAC;AAG/D,MAAM,WAAW,0BAA0B;IAC1C,SAAS,CAAC,EAAE,wBAAwB,GAAG,cAAc,CAAC;IACtD,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACjC;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,0BAA+B,qFAiBzE;AAED,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,gCAA0B,CAAC;AAElE,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,iGAiBjF"}
1
+ {"version":3,"file":"coordinator-owner-enrollment-historical-test-fixture.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-historical-test-fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAG7F,OAAO,EAGN,uBAAuB,EACvB,MAAM,uDAAuD,CAAC;AAG/D,MAAM,WAAW,0BAA0B;IAC1C,SAAS,CAAC,EAAE,wBAAwB,GAAG,cAAc,CAAC;IACtD,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,oFAAoF;IACpF,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjC;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,0BAA+B,qFAkBzE;AAED,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,gCAA0B,CAAC;AAElE,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,iGAiBjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-owner-enrollment-start-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-start-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAErF,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACN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EAAE;IAC5C,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;CACd,GAAG,iBAAiB,CAkDpB;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;CAClG;AACD,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAyB5F;AAID,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAiBrE;AAED,wGAAwG;AACxG,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAwBlE;AAGD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,iBAAiB,GAAG,OAAO,EAAE,CAOtE"}
1
+ {"version":3,"file":"coordinator-owner-enrollment-start-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-start-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAGtC,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAErF,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACN,KAAK,cAAc,EAGnB,MAAM,+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AQ,CAAC,QAAQ,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;CACd,GAAG,iBAAiB,CAkDpB;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;CAClG;AACD,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAyB5F;AAID,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CA0BrE;AAED,wGAAwG;AACxG,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAwBlE;AAGD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,iBAAiB,GAAG,OAAO,EAAE,CAOtE"}
@@ -1,13 +1,14 @@
1
- import { type ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
1
+ import type { ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
2
2
  import type { AuthLinkStatement } from "./coordinator-auth-link.js";
3
+ import type { EvidenceRow } from "./coordinator-device-ownership-evidence-classify.js";
4
+ /**
5
+ * Helpers the negative owner read set shares: the subject it checks, the resolution
6
+ * catalog's classification, evidence row parsing, and the original-source pin.
7
+ */
3
8
  interface Backend {
4
9
  first<T>(statement: AuthLinkStatement): Promise<T | null>;
5
10
  all?<T>(statement: AuthLinkStatement): Promise<T[]>;
6
11
  }
7
- export interface NegativeOwnerConsistency extends AuthLinkStatement {
8
- /** Catalog, retained facts and original source only; unaffected by producer output. */
9
- retainedRecheck: AuthLinkStatement;
10
- }
11
12
  /** Trusted subject metadata, not authority. Enrollment is optional for future
12
13
  * new-device producers; those producers must independently prove admission.
13
14
  */
@@ -22,17 +23,10 @@ export interface NegativeOwnerSubject {
22
23
  };
23
24
  verifiedHistory?: ControllerHistorySnapshot;
24
25
  }
25
- /** Returns only a negative write predicate. No result grants owner authority.
26
- * The missing-schema predicate deliberately never names the absent table.
27
- */
28
- export declare function prepareNegativeOwnerConsistency(backend: Backend, input: NegativeOwnerSubject): Promise<NegativeOwnerConsistency | null>;
29
- /** Compatibility for old internal callers, never infer a coordinator namespace. */
30
- export declare function prepareUnknownNamespaceOwnerConsistency(backend: Backend, input: Pick<NegativeOwnerSubject, "deviceId" | "publicKey">): Promise<NegativeOwnerConsistency | null>;
31
- /** Keep the ordinary authority and evidence trees in independent materialized
32
- * root stages instead of nesting one predicate beneath the other's SQL tree.
33
- */
34
- export declare function withNegativeOwnerConsistency(statement: AuthLinkStatement, predicate: AuthLinkStatement): AuthLinkStatement;
35
- /** Compose only trusted producer statements; all captured data remains bound. */
36
- export declare function withNegativeOwnerWrite(statement: AuthLinkStatement, predicate: AuthLinkStatement): AuthLinkStatement;
26
+ export declare function capturedCatalogState(encoded: string): import("./coordinator-legacy-owner-resolution-metadata.js").LegacyOwnerResolutionSchemaState;
27
+ export declare function parseEvidenceRows(values: {
28
+ row: string | null;
29
+ }[]): EvidenceRow[];
30
+ export declare function sourcePins(backend: Backend, rows: EvidenceRow[]): Promise<AuthLinkStatement>;
37
31
  export {};
38
32
  //# sourceMappingURL=coordinator-owner-negative-consistency.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-owner-negative-consistency.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-negative-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,yBAAyB,EAE9B,MAAM,0CAA0C,C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B"}
1
+ {"version":3,"file":"coordinator-owner-negative-consistency.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-negative-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAWvF;;;GAGG;AAEH,UAAU,OAAO;IAChB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,eAAe,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,gGAmBnD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,GAAG,WAAW,EAAE,CAYjF;AAED,wBAAsB,UAAU,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EAAE,GACjB,OAAO,CAAC,iBAAiB,CAAC,CAqC5B"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Test-only. This file exists only to pin equivalence with the pre-port SQL.
3
+ *
4
+ * Between the markers are the negative owner consistency builder from
5
+ * coordinator-owner-negative-consistency.ts and the evidence statements it used from
6
+ * coordinator-device-ownership-evidence-queries.ts, as they were on main at cab27c54e,
7
+ * before the port to read-set validation, copied verbatim. Only the entry point's name
8
+ * changed, and `export` was dropped from the copied evidence helpers. Code that is not
9
+ * a statement builder (history capture, classification, schema and record checks) is
10
+ * imported, as the original imported it. coordinator-owner-negative-equivalence.test.ts
11
+ * runs it beside the read set and requires the same answers. Do not edit the copy to
12
+ * follow later changes; delete this file with that test when the equivalence no longer
13
+ * needs pinning.
14
+ */
15
+ import { type ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
16
+ import type { AuthLinkStatement } from "./coordinator-auth-link.js";
17
+ interface Backend {
18
+ first<T>(statement: AuthLinkStatement): Promise<T | null>;
19
+ all?<T>(statement: AuthLinkStatement): Promise<T[]>;
20
+ }
21
+ export interface NegativeOwnerConsistency extends AuthLinkStatement {
22
+ /** Catalog, retained facts and original source only; unaffected by producer output. */
23
+ retainedRecheck: AuthLinkStatement;
24
+ }
25
+ /** Trusted subject metadata, not authority. Enrollment is optional for future
26
+ * new-device producers; those producers must independently prove admission.
27
+ */
28
+ export interface NegativeOwnerSubject {
29
+ coordinatorId: string;
30
+ deviceId: string;
31
+ publicKey: string;
32
+ fingerprint: string;
33
+ ownerIdentityId: string;
34
+ enrollment?: {
35
+ groupId: string;
36
+ };
37
+ verifiedHistory?: ControllerHistorySnapshot;
38
+ }
39
+ /** Returns only a negative write predicate. No result grants owner authority.
40
+ * The missing-schema predicate deliberately never names the absent table.
41
+ */
42
+ export declare function prepareOriginalNegativeOwnerConsistency(backend: Backend, input: NegativeOwnerSubject): Promise<NegativeOwnerConsistency | null>;
43
+ export {};
44
+ //# sourceMappingURL=coordinator-owner-negative-original-sql-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-owner-negative-original-sql-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-negative-original-sql-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEN,KAAK,yBAAyB,EAE9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA0JpE,UAAU,OAAO;IAChB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAClE,uFAAuF;IACvF,eAAe,EAAE,iBAAiB,CAAC;CACnC;AAcD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,eAAe,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAkHD;;GAEG;AACH,wBAAsB,uCAAuC,CAC5D,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CA2B1C"}
@@ -0,0 +1,26 @@
1
+ import type { Database } from "better-sqlite3";
2
+ /** The device whose retained legacy ownership is checked, as the race changes see it. */
3
+ export interface RaceSubject {
4
+ coordinatorId: string;
5
+ groupId: string;
6
+ deviceId: string;
7
+ publicKey: string;
8
+ fingerprint: string;
9
+ ownerIdentityId: string;
10
+ }
11
+ export interface NegativeOwnerChange {
12
+ /** The fact that changes, and the reads of the negative owner check that select it. */
13
+ fact: string;
14
+ reads: string;
15
+ /** Optional setup before the reads, so the fact exists to change. */
16
+ arrange?(db: Database, s: RaceSubject): void;
17
+ change(db: Database, s: RaceSubject): void;
18
+ /** Sites where the fact cannot change, with the reason. */
19
+ skip?: Partial<Record<"binding", string>>;
20
+ }
21
+ /**
22
+ * One change per read of the negative owner check, each made after the reads and before
23
+ * the write. Several facts are selected by more than one read; `reads` names them all.
24
+ */
25
+ export declare const NEGATIVE_OWNER_CHANGES: NegativeOwnerChange[];
26
+ //# sourceMappingURL=coordinator-owner-negative-race-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-owner-negative-race-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-negative-race-test-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IACnC,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,OAAO,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7C,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,2DAA2D;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1C;AAgCD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,mBAAmB,EA+IvD,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
2
+ import type { AuthLinkBackend, AuthLinkStatement } from "./coordinator-auth-link.js";
3
+ import { type ReadSnapshotOptions } from "./coordinator-auth-read-set.js";
4
+ import { type EvidenceRows, type EvidenceSubject } from "./coordinator-device-ownership-evidence-classify.js";
5
+ import { type NegativeOwnerSubject } from "./coordinator-owner-negative-consistency.js";
6
+ /**
7
+ * Negative owner consistency as a read set: evidence reads, the shared
8
+ * classification, and guards that pin the rows the classification used.
9
+ *
10
+ * The result never grants owner authority. It only says that no
11
+ * retained legacy owner fact for the subject contradicts the producer's owner.
12
+ */
13
+ export interface NegativeOwnerGuards {
14
+ /** Re-run every read the decision used. They go in the batch that writes. */
15
+ guards: AuthLinkStatement[];
16
+ /**
17
+ * Re-run only the resolution catalog, the subject's retained resolutions and their
18
+ * original sources. A producer's own writes never change these, so they may run after
19
+ * them. They match the old pin's retained recheck.
20
+ */
21
+ retainedGuards: AuthLinkStatement[];
22
+ }
23
+ type Backend = Pick<AuthLinkBackend, "first" | "all" | "readBatch">;
24
+ /** Returns null when the subject's retained ownership forbids the owner or cannot be read. */
25
+ export declare function readNegativeOwnerConsistency(backend: Backend, input: NegativeOwnerSubject, options?: ReadSnapshotOptions): Promise<NegativeOwnerGuards | null>;
26
+ /**
27
+ * The negative owner check for old internal callers that name no coordinator. It allows
28
+ * only a device with no retained resolution anywhere, and never infers a namespace.
29
+ */
30
+ export declare function readUnknownNamespaceOwnerConsistency(backend: Backend, input: Pick<NegativeOwnerSubject, "deviceId" | "publicKey">): Promise<NegativeOwnerGuards | null>;
31
+ /**
32
+ * Reads every evidence category, then the controllers and invites among the discovered
33
+ * keys. Fails like the old reader on too many rows, too many bytes or malformed rows.
34
+ * The ownership evidence collector reads its categories the same way.
35
+ */
36
+ export declare function readEvidence(backend: Backend, subject: EvidenceSubject, history: ControllerHistorySnapshot, options: ReadSnapshotOptions): Promise<{
37
+ rows: EvidenceRows;
38
+ guards: AuthLinkStatement[];
39
+ /** The guard of the resolutions category alone. */
40
+ resolutionsGuard: AuthLinkStatement;
41
+ }>;
42
+ export {};
43
+ //# sourceMappingURL=coordinator-owner-negative-read-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-owner-negative-read-set.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-negative-read-set.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,yBAAyB,EAE9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EAEN,KAAK,oBAAoB,EAGzB,MAAM,6CAA6C,CAAC;AAWrD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IACnC,6EAA6E;IAC7E,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B;;;;OAIG;IACH,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACpC;AAED,KAAK,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC,CAAC;AAgBpE,8FAA8F;AAC9F,wBAAsB,4BAA4B,CACjD,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,mBAAwB,GAC/B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAwBrC;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CACzD,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,WAAW,CAAC,GACzD,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAiBrC;AAkHD;;;;GAIG;AACH,wBAAsB,YAAY,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC;IACV,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,mDAAmD;IACnD,gBAAgB,EAAE,iBAAiB,CAAC;CACpC,CAAC,CA+BD"}
@@ -0,0 +1,32 @@
1
+ import type { ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
2
+ import type { AuthRead } from "./coordinator-auth-read-set.js";
3
+ import type { EvidenceSubject } from "./coordinator-device-ownership-evidence-classify.js";
4
+ /** The resolution table's schema objects, in creation order as the old pin compared them. */
5
+ export declare const NEGATIVE_CATALOG_READ: AuthRead;
6
+ /** Retained resolutions of the subject. A NULL key ID matches only by device. */
7
+ export declare function retainedResolutionsRead(subject: {
8
+ coordinatorId: string;
9
+ deviceId: string;
10
+ }, keyId: string | null): AuthRead;
11
+ /** Resolutions of the device or key in any coordinator, for callers with no namespace. */
12
+ export declare function anyNamespaceResolutionsRead(deviceId: string, keyId: string | null): AuthRead;
13
+ export interface EvidenceReadInput {
14
+ subject: EvidenceSubject;
15
+ history: ControllerHistorySnapshot;
16
+ }
17
+ /**
18
+ * The rows the controller review's history guard compared with the reviewed snapshot,
19
+ * with that guard's own limits: one more row than the snapshot may hold, so a larger live
20
+ * set can never equal it. Plain rows ordered by their whole text; no byte cap applies.
21
+ */
22
+ export declare function controllerHistoryReads(h: ControllerHistorySnapshot): Record<string, AuthRead>;
23
+ /** Every category but controllers and invites, which depend on the discovered IDs. */
24
+ export declare function evidenceReads({ subject, history }: EvidenceReadInput): Record<string, AuthRead>;
25
+ /** Controller reviews and consumed invites among the discovered keys, as the old stages joined them. */
26
+ export declare function discoveredReads(subject: EvidenceSubject, discovered: {
27
+ controllers: string[];
28
+ invites: string[];
29
+ }): Record<string, AuthRead>;
30
+ /** Whether one of the resolutions' original sources is still exactly as reviewed. */
31
+ export declare function sourcesRead(pin: AuthRead): AuthRead;
32
+ //# sourceMappingURL=coordinator-owner-negative-reads.d.ts.map
@@ -0,0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GAAG,EAAE,QAAQ,GAAG,QAAQ,CAKnD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Test-only. This file exists only to pin equivalence with the pre-port SQL.
3
+ *
4
+ * Between the markers are `withNegativeOwnerWrite` from
5
+ * coordinator-owner-negative-consistency.ts and `withEnrollmentNegativeOwner` from
6
+ * coordinator-owner-enrollment-commit.ts as they were on main at 9a9bf301f, before the
7
+ * producers moved to read-set guards, copied verbatim. Only `export` was added to the
8
+ * second. The functions after the markers rebuild each producer's old batch from the
9
+ * statements the ported producer writes, the way the old call sites composed them:
10
+ * the first account link pinned its first two statements, and owner enrollment pinned
11
+ * its winning update and its binding insert. Do not edit the copy to follow later
12
+ * changes; delete this file with coordinator-owner-producer-equivalence.test.ts.
13
+ */
14
+ import type { AuthLinkStatement } from "./coordinator-auth-link.js";
15
+ /** Compose only trusted producer statements; all captured data remains bound. */
16
+ export declare function withNegativeOwnerWrite(statement: AuthLinkStatement, predicate: AuthLinkStatement): AuthLinkStatement;
17
+ /** Join the already materialized negative result rather than adding its SELECT
18
+ * tree beneath the UPDATE's long chain of ordinary pins (native D1 depth 100).
19
+ * These markers belong only to this module's trusted winning UPDATE template.
20
+ */
21
+ export declare function withEnrollmentNegativeOwner(update: AuthLinkStatement, consistency: AuthLinkStatement): AuthLinkStatement;
22
+ /** The first account link's old batch: its attempt update and claim insert carried the pin. */
23
+ export declare function originalFirstLinkBatch(writes: AuthLinkStatement[], pin: AuthLinkStatement): AuthLinkStatement[];
24
+ /** Owner enrollment's old batch: its winning update and binding insert carried the pin. */
25
+ export declare function originalOwnerEnrollmentBatch(writes: AuthLinkStatement[], pin: AuthLinkStatement): AuthLinkStatement[];
26
+ //# sourceMappingURL=coordinator-owner-producer-original-sql-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-owner-producer-original-sql-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-producer-original-sql-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,iFAAiF;AACjF,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,iBAAiB,GAC1B,iBAAiB,CAWnB;AACD;;;GAGG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,iBAAiB,GAC5B,iBAAiB,CAYnB;AAGD,+FAA+F;AAC/F,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,iBAAiB,EAAE,EAC3B,GAAG,EAAE,iBAAiB,GACpB,iBAAiB,EAAE,CAIrB;AAED,2FAA2F;AAC3F,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,iBAAiB,EAAE,EAC3B,GAAG,EAAE,iBAAiB,GACpB,iBAAiB,EAAE,CAMrB"}