@hypequery/protocol-conformance 0.11.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/adapters/generators.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAkBpC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAuC1D;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMxD;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAoCzD;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CA2BrD;AAgBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAuB7D;AA4CD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAsFjE;AAkBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAyBpD;AAeD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAoB1D;AAmBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAmBrD;AAaD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAgBtD"}
1
+ {"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/adapters/generators.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAkBpC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAuC1D;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMxD;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CA0CzD;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CA2BrD;AAgBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAuB7D;AA4CD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAsFjE;AAkBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAyBpD;AAeD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAoB1D;AAmBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAmBrD;AAaD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAgBtD"}
@@ -89,6 +89,12 @@ export function materializeExpression(spec) {
89
89
  operands: Array.from({ length: groupIndex === 9 ? spec.lastGroupItems : 100 }, () => ({ ...EXPR_LITERAL })),
90
90
  })),
91
91
  };
92
+ case 'segments':
93
+ return {
94
+ kind: 'dataset',
95
+ dataset: 'orders',
96
+ segments: Array.from({ length: spec.count }, (_, index) => `s${index}`),
97
+ };
92
98
  case 'unsafe-accessor': {
93
99
  const value = { kind: 'reference' };
94
100
  Object.defineProperty(value, 'name', { enumerable: true, get: () => 'orders' });
@@ -9,7 +9,7 @@ export declare const REFERENCE_HOSTILE_OBJECT_SUITE: {
9
9
  readonly count: 7;
10
10
  readonly mechanisms: readonly ["getter", "toJSON", "proxy", "custom-prototype", "symbol-key", "sparse-array", "cycle"];
11
11
  };
12
- export declare const REFERENCE_FAMILIES: readonly ["cache-keys-v1", "tagged-values-v1", "identifiers-v1", "expressions-v1", "query-schemas-v1", "query-implementations-v1", "query-events-v1", "query-diagnostics-v1", "deployments-v2", "deployment-bundles-v1", "deployment-releases-v1", "semantic-invocations-v1"];
12
+ export declare const REFERENCE_FAMILIES: readonly ["cache-keys-v1", "tagged-values-v1", "identifiers-v1", "expressions-v1", "expressions-v2", "query-schemas-v1", "query-implementations-v1", "query-events-v1", "query-diagnostics-v1", "deployments-v2", "deployments-v3", "deployment-bundles-v1", "deployment-releases-v1", "semantic-invocations-v1", "semantic-invocations-v2"];
13
13
  export declare function referenceHandle(family: string, role: FixtureRole, c: Case, section?: string): HandlerResult;
14
14
  export {};
15
15
  //# sourceMappingURL=reference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/adapters/reference.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAc9D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA0BpC;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;CAWjC,CAAC;AAEX,eAAO,MAAM,kBAAkB,+QAarB,CAAC;AAEX,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,CAAC,EAAE,IAAI,EACP,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,CAsCf"}
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/adapters/reference.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAc9D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA0BpC;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;CAWjC,CAAC;AAEX,eAAO,MAAM,kBAAkB,8UAgBrB,CAAC;AAEX,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,CAAC,EAAE,IAAI,EACP,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,CA4Cf"}
@@ -2,7 +2,7 @@
2
2
  // root export of @hypequery/protocol and returns a wire result. Every operation
3
3
  // goes through the package's supported surface — this is exactly what a second
4
4
  // implementation must reproduce.
5
- import { decodeCanonicalValue, deriveProtocolCacheKey, deriveProtocolCacheNamespaceToken, encodeCanonicalValue, hashCanonicalValue, parseProtocolIdentifier, parseProtocolQualifiedIdentifier, prepareProtocolDeploymentBundleManifest, prepareProtocolDeploymentContract, prepareProtocolDeploymentReleaseEnvelope, splitProtocolQualifiedIdentifier, validateCanonicalValue, validateProtocolDeploymentBundleManifest, validateProtocolDeploymentContract, validateProtocolDeploymentReleaseEnvelope, validateProtocolExpression, validateProtocolQueryDiagnostics, validateProtocolQueryEvent, validateProtocolQueryImplementation, validateProtocolSchema, validateProtocolSemanticInvocation, validateProtocolSemanticInvocationFailure, validateProtocolSemanticInvocationResult, validateProtocolSemanticQuery, validateProtocolSqlExpression, } from '@hypequery/protocol';
5
+ import { decodeCanonicalValue, deriveProtocolCacheKey, deriveProtocolCacheNamespaceToken, encodeCanonicalValue, hashCanonicalValue, parseProtocolIdentifier, parseProtocolQualifiedIdentifier, prepareProtocolDeploymentBundleManifest, prepareProtocolDeploymentContract, prepareProtocolDeploymentContractV3, prepareProtocolDeploymentReleaseEnvelope, splitProtocolQualifiedIdentifier, validateCanonicalValue, validateProtocolDeploymentBundleManifest, validateProtocolDeploymentContract, validateProtocolDeploymentContractV3, validateProtocolDeploymentReleaseEnvelope, validateProtocolExpression, validateProtocolQueryDiagnostics, validateProtocolQueryEvent, validateProtocolQueryImplementation, validateProtocolSchema, validateProtocolSemanticInvocation, validateProtocolSemanticInvocationFailure, validateProtocolSemanticInvocationResult, validateProtocolSemanticInvocationV2, validateProtocolSemanticQuery, validateProtocolSqlExpression, } from '@hypequery/protocol';
6
6
  import { materializeBundle, materializeDiagnostics, materializeEvent, materializeSemanticInvocation, materializeExpression, materializeIdentifier, materializeImplementation, materializeRelease, materializeSchema, materializeTaggedValue, } from './generators.js';
7
7
  const STABLE_CODE = /^HQ_[A-Z0-9_]+$/;
8
8
  /** Turns a thrown protocol error into a wire rejection; rethrows anything else. */
@@ -47,14 +47,17 @@ export const REFERENCE_FAMILIES = [
47
47
  'tagged-values-v1',
48
48
  'identifiers-v1',
49
49
  'expressions-v1',
50
+ 'expressions-v2',
50
51
  'query-schemas-v1',
51
52
  'query-implementations-v1',
52
53
  'query-events-v1',
53
54
  'query-diagnostics-v1',
54
55
  'deployments-v2',
56
+ 'deployments-v3',
55
57
  'deployment-bundles-v1',
56
58
  'deployment-releases-v1',
57
59
  'semantic-invocations-v1',
60
+ 'semantic-invocations-v2',
58
61
  ];
59
62
  export function referenceHandle(family, role, c, section) {
60
63
  switch (family) {
@@ -63,7 +66,9 @@ export function referenceHandle(family, role, c, section) {
63
66
  case 'identifiers-v1':
64
67
  return handleIdentifier(role, c);
65
68
  case 'expressions-v1':
66
- return handleExpression(role, c, section);
69
+ return handleExpression(role, c, section, 1);
70
+ case 'expressions-v2':
71
+ return handleExpression(role, c, section, 2);
67
72
  case 'query-schemas-v1':
68
73
  return attempt(() => {
69
74
  validateProtocolSchema(validationInput(c, materializeSchema));
@@ -83,12 +88,16 @@ export function referenceHandle(family, role, c, section) {
83
88
  });
84
89
  case 'deployments-v2':
85
90
  return handleDeploymentV2(role, c);
91
+ case 'deployments-v3':
92
+ return handleDeploymentV3(role, c);
86
93
  case 'deployment-bundles-v1':
87
94
  return handleBundle(role, c);
88
95
  case 'deployment-releases-v1':
89
96
  return handleRelease(role, c);
90
97
  case 'semantic-invocations-v1':
91
- return handleSemanticInvocation(c);
98
+ return handleSemanticInvocation(c, 1);
99
+ case 'semantic-invocations-v2':
100
+ return handleSemanticInvocation(c, 2);
92
101
  case 'cache-keys-v1':
93
102
  return handleCacheKey(role, c);
94
103
  default:
@@ -99,9 +108,9 @@ export function referenceHandle(family, role, c, section) {
99
108
  * One family covers the invocation, result, and failure records, so each case
100
109
  * names which one it validates against.
101
110
  */
102
- function handleSemanticInvocation(c) {
111
+ function handleSemanticInvocation(c, version) {
103
112
  const validators = {
104
- invocation: validateProtocolSemanticInvocation,
113
+ invocation: version === 2 ? validateProtocolSemanticInvocationV2 : validateProtocolSemanticInvocation,
105
114
  result: validateProtocolSemanticInvocationResult,
106
115
  failure: validateProtocolSemanticInvocationFailure,
107
116
  };
@@ -185,17 +194,17 @@ function handleIdentifier(role, c) {
185
194
  return ACCEPT;
186
195
  });
187
196
  }
188
- function handleExpression(role, c, section) {
197
+ function handleExpression(role, c, section, extension) {
189
198
  const isQuery = section === '/queries' || c.mode === 'query';
190
199
  const validate = isQuery ? validateProtocolSemanticQuery : validateProtocolExpression;
191
200
  if (role === 'success') {
192
201
  return attempt(() => {
193
- validate(validationInput(c, materializeExpression));
202
+ validate(validationInput(c, materializeExpression), { extension });
194
203
  return ACCEPT;
195
204
  });
196
205
  }
197
206
  return attempt(() => {
198
- validate(validationInput(c, materializeExpression));
207
+ validate(validationInput(c, materializeExpression), { extension });
199
208
  return ACCEPT;
200
209
  });
201
210
  }
@@ -220,6 +229,18 @@ function handleDeploymentV2(role, c) {
220
229
  return ACCEPT;
221
230
  });
222
231
  }
232
+ function handleDeploymentV3(role, c) {
233
+ if (role === 'identity') {
234
+ return attempt(() => {
235
+ const prepared = prepareProtocolDeploymentContractV3(c.value);
236
+ return { ok: true, output: { canonical: prepared.canonical, sha256: prepared.identity } };
237
+ });
238
+ }
239
+ return attempt(() => {
240
+ validateProtocolDeploymentContractV3(c.value);
241
+ return ACCEPT;
242
+ });
243
+ }
223
244
  function handleBundle(role, c) {
224
245
  if (role === 'identity') {
225
246
  return attempt(() => {
@@ -0,0 +1,15 @@
1
+ # Deployment contract v2 fixtures
2
+
3
+ `success.json` holds contracts every implementation must accept, `identity.json`
4
+ pins the canonical bytes and SHA-256 of the success case sharing its id, and
5
+ `rejections.json` pins a stable failure code for each rule the contract states.
6
+
7
+ Acceptance of RFC 0006 added the rejection corpus. Before it, the family had one
8
+ success and one identity case, which cannot tell a faithful validator from one
9
+ that accepts contracts another implementation rejects — the corpus now covers
10
+ the envelope's forbidden fields, the null-versus-absent distinction, relationship
11
+ and tenant agreement, measure shape, semantic metadata, defaults, endpoint
12
+ policy, and derived-measure rules.
13
+
14
+ Every case was checked against both the TypeScript and Python implementations
15
+ before being recorded; none of them changed either implementation's behaviour.