@cobol-ts/validation-execution 0.0.0-stage → 0.0.57

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 (174) hide show
  1. package/README.md +256 -3
  2. package/dist/index.d.ts +41 -0
  3. package/dist/index.js +59 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/compaction.prepare.d.ts +10 -0
  6. package/dist/src/compaction.prepare.js +60 -0
  7. package/dist/src/compaction.prepare.js.map +1 -0
  8. package/dist/src/compaction.project.d.ts +28 -0
  9. package/dist/src/compaction.project.js +81 -0
  10. package/dist/src/compaction.project.js.map +1 -0
  11. package/dist/src/compaction.project.memory.d.ts +12 -0
  12. package/dist/src/compaction.project.memory.js +70 -0
  13. package/dist/src/compaction.project.memory.js.map +1 -0
  14. package/dist/src/compaction.project.spec.d.ts +1 -0
  15. package/dist/src/compaction.project.spec.js +44 -0
  16. package/dist/src/compaction.project.spec.js.map +1 -0
  17. package/dist/src/compaction.project.storage.d.ts +21 -0
  18. package/dist/src/compaction.project.storage.js +3 -0
  19. package/dist/src/compaction.project.storage.js.map +1 -0
  20. package/dist/src/identification.candidate.d.ts +16 -0
  21. package/dist/src/identification.candidate.js +40 -0
  22. package/dist/src/identification.candidate.js.map +1 -0
  23. package/dist/src/identification.context.d.ts +8 -0
  24. package/dist/src/identification.context.js +3 -0
  25. package/dist/src/identification.context.js.map +1 -0
  26. package/dist/src/identification.selection.d.ts +4 -0
  27. package/dist/src/identification.selection.js +3 -0
  28. package/dist/src/identification.selection.js.map +1 -0
  29. package/dist/src/identified.state.publication.d.ts +14 -0
  30. package/dist/src/identified.state.publication.js +3 -0
  31. package/dist/src/identified.state.publication.js.map +1 -0
  32. package/dist/src/identified.state.reader.spec.d.ts +1 -0
  33. package/dist/src/identified.state.reader.spec.js +101 -0
  34. package/dist/src/identified.state.reader.spec.js.map +1 -0
  35. package/dist/src/identified.state.source.d.ts +20 -0
  36. package/dist/src/identified.state.source.js +5 -0
  37. package/dist/src/identified.state.source.js.map +1 -0
  38. package/dist/src/projected.entity.d.ts +8 -0
  39. package/dist/src/projected.entity.js +55 -0
  40. package/dist/src/projected.entity.js.map +1 -0
  41. package/dist/src/validation.candidate.execution.d.ts +6 -0
  42. package/dist/src/validation.candidate.execution.js +31 -0
  43. package/dist/src/validation.candidate.execution.js.map +1 -0
  44. package/dist/src/validation.candidate.failure.d.ts +5 -0
  45. package/dist/src/validation.candidate.failure.js +22 -0
  46. package/dist/src/validation.candidate.failure.js.map +1 -0
  47. package/dist/src/validation.candidate.policy.d.ts +16 -0
  48. package/dist/src/validation.candidate.policy.js +43 -0
  49. package/dist/src/validation.candidate.policy.js.map +1 -0
  50. package/dist/src/validation.candidate.policy.spec.d.ts +1 -0
  51. package/dist/src/validation.candidate.policy.spec.js +32 -0
  52. package/dist/src/validation.candidate.policy.spec.js.map +1 -0
  53. package/dist/src/validation.cursors.d.ts +23 -0
  54. package/dist/src/validation.cursors.js +117 -0
  55. package/dist/src/validation.cursors.js.map +1 -0
  56. package/dist/src/validation.display.d.ts +13 -0
  57. package/dist/src/validation.display.js +45 -0
  58. package/dist/src/validation.display.js.map +1 -0
  59. package/dist/src/validation.display.project.d.ts +4 -0
  60. package/dist/src/validation.display.project.js +20 -0
  61. package/dist/src/validation.display.project.js.map +1 -0
  62. package/dist/src/validation.identification.cutoffs.spec.d.ts +1 -0
  63. package/dist/src/validation.identification.cutoffs.spec.js +124 -0
  64. package/dist/src/validation.identification.cutoffs.spec.js.map +1 -0
  65. package/dist/src/validation.identification.execution.d.ts +11 -0
  66. package/dist/src/validation.identification.execution.js +36 -0
  67. package/dist/src/validation.identification.execution.js.map +1 -0
  68. package/dist/src/validation.identification.inspect.recovered.d.ts +9 -0
  69. package/dist/src/validation.identification.inspect.recovered.js +101 -0
  70. package/dist/src/validation.identification.inspect.recovered.js.map +1 -0
  71. package/dist/src/validation.identification.materialise.d.ts +26 -0
  72. package/dist/src/validation.identification.materialise.js +67 -0
  73. package/dist/src/validation.identification.materialise.js.map +1 -0
  74. package/dist/src/validation.identification.observation.d.ts +15 -0
  75. package/dist/src/validation.identification.observation.js +51 -0
  76. package/dist/src/validation.identification.observation.js.map +1 -0
  77. package/dist/src/validation.identification.observation.spec.d.ts +1 -0
  78. package/dist/src/validation.identification.observation.spec.js +29 -0
  79. package/dist/src/validation.identification.observation.spec.js.map +1 -0
  80. package/dist/src/validation.identification.physical.d.ts +26 -0
  81. package/dist/src/validation.identification.physical.js +79 -0
  82. package/dist/src/validation.identification.physical.js.map +1 -0
  83. package/dist/src/validation.identification.prefix.d.ts +27 -0
  84. package/dist/src/validation.identification.prefix.js +62 -0
  85. package/dist/src/validation.identification.prefix.js.map +1 -0
  86. package/dist/src/validation.identification.prefix.spec.d.ts +1 -0
  87. package/dist/src/validation.identification.prefix.spec.js +76 -0
  88. package/dist/src/validation.identification.prefix.spec.js.map +1 -0
  89. package/dist/src/validation.identification.projection.d.ts +6 -0
  90. package/dist/src/validation.identification.projection.js +21 -0
  91. package/dist/src/validation.identification.projection.js.map +1 -0
  92. package/dist/src/validation.identification.replay.d.ts +18 -0
  93. package/dist/src/validation.identification.replay.js +110 -0
  94. package/dist/src/validation.identification.replay.js.map +1 -0
  95. package/dist/src/validation.identification.satisfaction.d.ts +49 -0
  96. package/dist/src/validation.identification.satisfaction.js +116 -0
  97. package/dist/src/validation.identification.satisfaction.js.map +1 -0
  98. package/dist/src/validation.identification.scope.d.ts +7 -0
  99. package/dist/src/validation.identification.scope.js +60 -0
  100. package/dist/src/validation.identification.scope.js.map +1 -0
  101. package/dist/src/validation.identification.shard.d.ts +23 -0
  102. package/dist/src/validation.identification.shard.js +56 -0
  103. package/dist/src/validation.identification.shard.js.map +1 -0
  104. package/dist/src/validation.identification.strategy.d.ts +6 -0
  105. package/dist/src/validation.identification.strategy.js +26 -0
  106. package/dist/src/validation.identification.strategy.js.map +1 -0
  107. package/dist/src/validation.identification.strategy.spec.d.ts +1 -0
  108. package/dist/src/validation.identification.strategy.spec.js +31 -0
  109. package/dist/src/validation.identification.strategy.spec.js.map +1 -0
  110. package/dist/src/validation.identified.state.d.ts +34 -0
  111. package/dist/src/validation.identified.state.js +90 -0
  112. package/dist/src/validation.identified.state.js.map +1 -0
  113. package/dist/src/validation.investigation.d.ts +32 -0
  114. package/dist/src/validation.investigation.js +57 -0
  115. package/dist/src/validation.investigation.js.map +1 -0
  116. package/dist/src/validation.layouts.d.ts +26 -0
  117. package/dist/src/validation.layouts.js +78 -0
  118. package/dist/src/validation.layouts.js.map +1 -0
  119. package/dist/src/validation.manifest.reader.d.ts +16 -0
  120. package/dist/src/validation.manifest.reader.js +37 -0
  121. package/dist/src/validation.manifest.reader.js.map +1 -0
  122. package/dist/src/validation.observation.d.ts +58 -0
  123. package/dist/src/validation.observation.js +234 -0
  124. package/dist/src/validation.observation.js.map +1 -0
  125. package/dist/src/validation.oracle.dependencies.d.ts +29 -0
  126. package/dist/src/validation.oracle.dependencies.js +108 -0
  127. package/dist/src/validation.oracle.dependencies.js.map +1 -0
  128. package/dist/src/validation.oracle.dependencies.spec.d.ts +1 -0
  129. package/dist/src/validation.oracle.dependencies.spec.js +40 -0
  130. package/dist/src/validation.oracle.dependencies.spec.js.map +1 -0
  131. package/dist/src/validation.project.access.d.ts +23 -0
  132. package/dist/src/validation.project.access.js +13 -0
  133. package/dist/src/validation.project.access.js.map +1 -0
  134. package/dist/src/validation.reader.d.ts +17 -0
  135. package/dist/src/validation.reader.js +181 -0
  136. package/dist/src/validation.reader.js.map +1 -0
  137. package/dist/src/validation.reader.types.d.ts +23 -0
  138. package/dist/src/validation.reader.types.js +3 -0
  139. package/dist/src/validation.reader.types.js.map +1 -0
  140. package/dist/src/validation.recovered.shard.d.ts +8 -0
  141. package/dist/src/validation.recovered.shard.js +3 -0
  142. package/dist/src/validation.recovered.shard.js.map +1 -0
  143. package/dist/src/validation.reference.d.ts +5 -0
  144. package/dist/src/validation.reference.js +3 -0
  145. package/dist/src/validation.reference.js.map +1 -0
  146. package/dist/src/validation.replay.d.ts +27 -0
  147. package/dist/src/validation.replay.js +137 -0
  148. package/dist/src/validation.replay.js.map +1 -0
  149. package/dist/src/validation.report.d.ts +59 -0
  150. package/dist/src/validation.report.js +118 -0
  151. package/dist/src/validation.report.js.map +1 -0
  152. package/dist/src/validation.report.spec.d.ts +1 -0
  153. package/dist/src/validation.report.spec.js +75 -0
  154. package/dist/src/validation.report.spec.js.map +1 -0
  155. package/dist/src/validation.run.d.ts +10 -0
  156. package/dist/src/validation.run.js +20 -0
  157. package/dist/src/validation.run.js.map +1 -0
  158. package/dist/src/validation.run.project.d.ts +5 -0
  159. package/dist/src/validation.run.project.js +57 -0
  160. package/dist/src/validation.run.project.js.map +1 -0
  161. package/dist/src/validation.sequence.d.ts +11 -0
  162. package/dist/src/validation.sequence.js +59 -0
  163. package/dist/src/validation.sequence.js.map +1 -0
  164. package/dist/src/validation.sources.d.ts +11 -0
  165. package/dist/src/validation.sources.js +3 -0
  166. package/dist/src/validation.sources.js.map +1 -0
  167. package/dist/src/validation.sources.spec.d.ts +1 -0
  168. package/dist/src/validation.sources.spec.js +36 -0
  169. package/dist/src/validation.sources.spec.js.map +1 -0
  170. package/dist/src/validation.synchronous.spec.d.ts +1 -0
  171. package/dist/src/validation.synchronous.spec.js +173 -0
  172. package/dist/src/validation.synchronous.spec.js.map +1 -0
  173. package/index.ts +48 -0
  174. package/package.json +79 -3
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_vm_1 = require("node:vm");
4
+ const validation_identification_prefix_1 = require("./validation.identification.prefix");
5
+ const observation = (expected) => ({
6
+ composition: 'monthly', event: { customerId: '1', date: '20260101', periodicity: 'monthly', counts: {} }, expected: { 'oracle.jsonl': { total: expected } },
7
+ observation: { date: '2026-01-01', periodicity: 'monthly', input: {}, output: { total: expected } }
8
+ });
9
+ const replay = (start) => ({
10
+ prepare: async () => undefined,
11
+ startInspection: () => { throw new Error('Inspection is not used in prefix satisfaction'); },
12
+ start
13
+ });
14
+ test('prefix satisfaction extends an unchanged seed and restarts on a changed seed', () => {
15
+ let starts = 0, executions = 0;
16
+ const history = [];
17
+ const score = (0, validation_identification_prefix_1.prefixSatisfaction)(replay(seed => { starts++; let value = Number(seed.total); return () => { executions++; value++; return () => value; }; }), ['total'], history);
18
+ history.push(observation(2));
19
+ expect(score({ total: 1 })).toEqual({ status: 'matched', matched: 1, compared: 1, covered: 1, outputs: 1 });
20
+ history.push(observation(3));
21
+ expect(score({ total: 1 })).toEqual({ status: 'matched', matched: 2, compared: 2, covered: 1, outputs: 1 });
22
+ expect([starts, executions]).toEqual([1, 2]);
23
+ history.push(observation(4));
24
+ expect(score({ total: 2 })).toEqual({ status: 'mismatched', matched: 0, compared: 3, covered: 1, outputs: 1 });
25
+ expect([starts, executions]).toEqual([2, 5]);
26
+ expect(score(undefined).status).toBe('unavailable');
27
+ expect(score({ total: 1 })).toEqual({ status: 'matched', matched: 3, compared: 3, covered: 1, outputs: 1 });
28
+ expect([starts, executions]).toEqual([3, 8]);
29
+ });
30
+ test('prefix satisfaction never reports missing characteristic coverage as success', () => {
31
+ const history = [observation(2)];
32
+ const score = (0, validation_identification_prefix_1.prefixSatisfaction)(replay(() => () => () => 2), ['total', 'other'], history);
33
+ expect(score({ total: 1 })).toEqual({ status: 'incomplete', matched: 1, compared: 1, covered: 1, outputs: 2 });
34
+ });
35
+ test('prefix satisfaction stays incomplete when any execution lacks expected results', () => {
36
+ const history = [observation(2)];
37
+ const score = (0, validation_identification_prefix_1.prefixSatisfaction)(replay(() => () => () => 2), ['total'], history);
38
+ expect(score({ total: 1 })).toEqual({ status: 'matched', matched: 1, compared: 1, covered: 1, outputs: 1 });
39
+ history.push({ ...observation(2), expected: {} });
40
+ expect(score({ total: 1 })).toEqual({ status: 'incomplete', matched: 1, compared: 1, covered: 1, outputs: 1 });
41
+ history.push(observation(2));
42
+ expect(score({ total: 1 })).toEqual({ status: 'incomplete', matched: 2, compared: 2, covered: 1, outputs: 1 });
43
+ expect(score({ total: 3 })).toEqual({ status: 'incomplete', matched: 2, compared: 2, covered: 1, outputs: 1 });
44
+ history.push(observation(99));
45
+ expect(score({ total: 3 })).toEqual({ status: 'mismatched', matched: 2, compared: 3, covered: 1, outputs: 1 });
46
+ });
47
+ test('unrelated oracle results do not count as evidence for the selected outputs', () => {
48
+ const history = [observation(2), { ...observation(2), expected: { 'oracle.jsonl': { unrelated: 2 } } }];
49
+ const score = (0, validation_identification_prefix_1.prefixSatisfaction)(replay(() => () => () => 2), ['total'], history);
50
+ expect(score({ total: 1 })).toEqual({ status: 'incomplete', matched: 1, compared: 1, covered: 1, outputs: 1 });
51
+ });
52
+ test('prefix replay reuses equal scalar and window seeds across realms and restarts after mutation', () => {
53
+ let starts = 0, executions = 0;
54
+ const history = [observation(2)];
55
+ const score = (0, validation_identification_prefix_1.prefixSatisfaction)(replay(seed => {
56
+ starts++;
57
+ let value = Number(seed.total);
58
+ return () => { executions++; value++; return () => value; };
59
+ }), ['total'], history);
60
+ const window = [9007199254740993n, 0, null, false, 'x'];
61
+ const seed = { total: 1, window };
62
+ expect(score(seed).status).toBe('matched');
63
+ history.push(observation(3));
64
+ const foreignSeed = (0, node_vm_1.runInNewContext)("({window:[9007199254740993n, 0, null, false, 'x'], total:1})");
65
+ expect(score(foreignSeed).status).toBe('matched');
66
+ expect([starts, executions]).toEqual([1, 2]);
67
+ // Same caller object, but a changed logical history must invalidate the cache.
68
+ window[0] = 9007199254740994n;
69
+ expect(score(seed).status).toBe('matched');
70
+ expect([starts, executions]).toEqual([2, 4]);
71
+ // Number and bigint representations must not silently compare equal.
72
+ window[1] = 0n;
73
+ expect(score(seed).status).toBe('matched');
74
+ expect([starts, executions]).toEqual([3, 6]);
75
+ });
76
+ //# sourceMappingURL=validation.identification.prefix.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.prefix.spec.js","sourceRoot":"","sources":["../../src/validation.identification.prefix.spec.ts"],"names":[],"m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CAAC,EAAC,CAAC,CAAC,CAAC,CAAA;AAC9C,CAAC,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ProjectionAuthoring } from '@cobol-ts/cursor-loader-types';
2
+ import type { CompositeRecord, PreparedSource } from '@cobol-ts/cursor-composition';
3
+ /** Materialised values are keyed by projected names, not physical paths. */
4
+ export declare function logicalProjection(projection: ProjectionAuthoring): ProjectionAuthoring;
5
+ /** The same typed scalar access as CEL, copied into ordinary owned objects and arrays. */
6
+ export declare function ownedProjectedInput(sources: readonly PreparedSource[], row: CompositeRecord): Record<string, unknown>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logicalProjection = logicalProjection;
4
+ exports.ownedProjectedInput = ownedProjectedInput;
5
+ const project_execution_1 = require("@cobol-ts/project-execution");
6
+ /** Materialised values are keyed by projected names, not physical paths. */
7
+ function logicalProjection(projection) {
8
+ return Object.fromEntries(Object.entries(projection).map(([name, node]) => [name,
9
+ node.type === 'object' ? { type: 'object', fields: logicalProjection(node.fields) } :
10
+ node.type === 'array' ? { type: 'array', element: logicalProjection(node.element) } : { type: node.type }]));
11
+ }
12
+ /** The same typed scalar access as CEL, copied into ordinary owned objects and arrays. */
13
+ function ownedProjectedInput(sources, row) {
14
+ return Object.fromEntries(sources.map((source, slot) => {
15
+ const count = row.count(slot);
16
+ const member = (index) => (0, project_execution_1.debugProjectedInput)(source.projection, source.access, row.entry(slot, index).representation);
17
+ return [source.name, source.cardinality === 'many' || source.cardinality === 'manyOptional'
18
+ ? Array.from({ length: count }, (_, index) => member(index)) : count === 0 ? null : member(0)];
19
+ }));
20
+ }
21
+ //# sourceMappingURL=validation.identification.projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.projection.js","sourceRoot":"","sources":["../../src/validation.identification.projection.ts"],"names":[],"mappings":";;AAKA,8CAIC;AAGD,kDAOC;AAjBD,mEAA+D;AAE/D,4EAA4E;AAC5E,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MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACpG,CAAC,CAAC,CAAC,CAAA;AACP,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type CompositeRecord } from '@cobol-ts/cursor-composition';
2
+ import { type CompositionFileFactory } from '@cobol-ts/composition-definition';
3
+ import { type AuthoringGraph, type AccumulatorInitial } from '@cobol-ts/cel-graph-runtime';
4
+ import type { ValidationPreparation, ValidationObservation } from './validation.reader';
5
+ import type { ProjectedIdentificationObservation } from './validation.identification.observation';
6
+ import type { ReplayValues } from './validation.replay';
7
+ type ReplayObservation = Pick<ValidationObservation, 'event' | 'composition' | 'expected'>;
8
+ export type IdentificationReplay<T extends ReplayObservation = ProjectedIdentificationObservation> = {
9
+ readonly prepare: ValidationPreparation;
10
+ startInspection(seed: AccumulatorInitial): (observation: T) => ReplayValues;
11
+ /** Output lookup is borrowed until the next evaluation of this session. */
12
+ start(seed: AccumulatorInitial): (observation: T) => (name: string) => unknown;
13
+ };
14
+ /** Detached replay remains available for diagnostic inspection and materialisation. */
15
+ export declare function prepareIdentificationReplay(authored: AuthoringGraph, openReference: CompositionFileFactory): IdentificationReplay;
16
+ /** Execute directly against the reader-owned composite, without projection. */
17
+ export declare function preparePhysicalIdentificationReplay<T extends ReplayObservation>(authored: AuthoringGraph, openReference: CompositionFileFactory, input: (item: T) => CompositeRecord): IdentificationReplay<T>;
18
+ export {};
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareIdentificationReplay = prepareIdentificationReplay;
4
+ exports.preparePhysicalIdentificationReplay = preparePhysicalIdentificationReplay;
5
+ const cursor_composition_1 = require("@cobol-ts/cursor-composition");
6
+ const composition_definition_1 = require("@cobol-ts/composition-definition");
7
+ const cel_access_1 = require("@cobol-ts/cel-access");
8
+ const cel_graph_runtime_1 = require("@cobol-ts/cel-graph-runtime");
9
+ const errors_1 = require("@cobol-ts/errors");
10
+ const project_execution_1 = require("@cobol-ts/project-execution");
11
+ const validation_identification_projection_1 = require("./validation.identification.projection");
12
+ const validation_candidate_failure_1 = require("./validation.candidate.failure");
13
+ const validation_report_1 = require("./validation.report");
14
+ /** Detached replay remains available for diagnostic inspection and materialisation. */
15
+ function prepareIdentificationReplay(authored, openReference) {
16
+ return prepareReplay(authored, openReference, (sources, projection) => {
17
+ const physical = (0, cursor_composition_1.compositeAccessCompiler)(sources);
18
+ const logical = (0, cel_access_1.jsonAccessCompiler)(projection);
19
+ return { ...logical, compileScalar(path) {
20
+ const original = physical.compileScalar(path);
21
+ if ('errors' in original)
22
+ return original;
23
+ const detached = logical.compileScalar(path);
24
+ if ('errors' in detached)
25
+ return detached;
26
+ return { value: { ...detached.value, integerStorage: original.value.integerStorage } };
27
+ } };
28
+ }, (item) => item.observation.input);
29
+ }
30
+ /** Execute directly against the reader-owned composite, without projection. */
31
+ function preparePhysicalIdentificationReplay(authored, openReference, input) {
32
+ return prepareReplay(authored, openReference, sources => {
33
+ const physical = (0, cursor_composition_1.compositeAccessCompiler)(sources);
34
+ // Detached replay allowed an array inside an optional source when that
35
+ // source was present. Preserve that array access without relaxing the
36
+ // existing physical scalar compilation policy for optional sources.
37
+ if (!sources.some(source => source.cardinality === 'optional'))
38
+ return physical;
39
+ const arrays = (0, cursor_composition_1.compositeAccessCompiler)(sources.map(source => source.cardinality === 'optional'
40
+ ? { ...source, cardinality: 'one' } : source));
41
+ return { ...physical, compileArray: arrays.compileArray };
42
+ }, input);
43
+ }
44
+ function prepareReplay(authored, openReference, access, input) {
45
+ const canonical = (0, errors_1.valueOrThrow)((0, cel_graph_runtime_1.canonicaliseCelGraph)(authored));
46
+ const layouts = new Map();
47
+ const referenceCache = new Map();
48
+ let schema;
49
+ const prepare = async (definition, sources) => {
50
+ const ref = definition.composition.referenceData;
51
+ let references;
52
+ if (ref) {
53
+ const key = JSON.stringify(Object.entries(ref).sort(([a], [b]) => a.localeCompare(b)));
54
+ references = referenceCache.get(key);
55
+ if (!references) {
56
+ references = await (0, composition_definition_1.loadReferenceData)(ref, openReference);
57
+ referenceCache.set(key, references);
58
+ }
59
+ }
60
+ const projection = (0, validation_identification_projection_1.logicalProjection)((0, cursor_composition_1.createComposition)(sources, definition.composition.master).projection);
61
+ const prepared = (0, errors_1.valueOrThrow)((0, cel_graph_runtime_1.prepareCelGraph)(authored, projection, {
62
+ ...access(sources, projection),
63
+ ...(references ? { referenceTables: references.tables } : {})
64
+ }));
65
+ if (schema !== undefined && JSON.stringify(schema) !== JSON.stringify(prepared.schema))
66
+ throw new Error('Replay compositions have incompatible accumulator schemas');
67
+ schema = prepared.schema;
68
+ layouts.set(definition.name, { execute: prepared.createExecutor(undefined, undefined, (name, error) => { throw new validation_candidate_failure_1.CandidateExecutionException(name, error); }),
69
+ positions: new Map(schema.nodes.map((node, index) => [node.name, index])) });
70
+ return references?.data;
71
+ };
72
+ function initialise(seed) {
73
+ if (!schema)
74
+ throw new Error('No prepared replay layout');
75
+ const activeSchema = schema;
76
+ const state = (0, project_execution_1.indexedStateFromInitial)(activeSchema, (0, errors_1.valueOrThrow)((0, cel_graph_runtime_1.validateInitialAccumulator)(seed, authored, canonical)));
77
+ const variables = { periodicity: '' };
78
+ function execute(observation) {
79
+ const layout = layouts.get(observation.composition);
80
+ if (!layout)
81
+ throw new Error(`Replay layout was not prepared: ${observation.composition}`);
82
+ variables.periodicity = observation.event.periodicity;
83
+ layout.execute(input(observation), state, variables);
84
+ return layout;
85
+ }
86
+ return { state, execute, snapshot: () => (0, project_execution_1.snapshotIndexedState)(activeSchema, state) };
87
+ }
88
+ return { prepare, start(seed) {
89
+ const { state, execute } = initialise(seed);
90
+ let positions;
91
+ function readOutput(name) {
92
+ const index = positions?.get(name);
93
+ return index === undefined ? undefined : state.values[index];
94
+ }
95
+ return observation => {
96
+ positions = undefined;
97
+ positions = execute(observation).positions;
98
+ return readOutput;
99
+ };
100
+ }, startInspection(seed) {
101
+ const { state, execute, snapshot } = initialise(seed);
102
+ return observation => {
103
+ const accumulatorIn = snapshot();
104
+ const layout = execute(observation);
105
+ return { accumulatorIn, accumulatorOut: snapshot(),
106
+ comparisons: (0, validation_report_1.publishedComparisons)(observation.expected, layout.positions, name => state.values[layout.positions.get(name)]) };
107
+ };
108
+ } };
109
+ }
110
+ //# sourceMappingURL=validation.identification.replay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.replay.js","sourceRoot":"","sources":["../../src/validation.identification.replay.ts"],"names":[],"mappings":";;AA0BA,kEAYC;AAGD,kFAYC;AArDD,qEAAkI;AAClI,6EAA+F;AAE/F,qDAA4G;AAC5G,mEAA+K;AAE/K,6CAA6C;AAC7C,mEAAyF;AACzF,iGAAwE;AAIxE,iFAA0E;AAC1E,2DAAwD;AAYxD,uFAAuF;AACvF,SAAgB,2BAA2B,CAAC,QAAwB,EAAE,aAAqC;IACvG,OAAO,aAAa,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;QAClE,MAAM,QAAQ,GAAG,IAAA,4CAAuB,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,IAAA,+BAAkB,EAAC,UAAU,CAAC,CAAA;QAC9C,OAAO,EAAC,GAAG,OAAO,EAAE,aAAa,CAAC,IAAI;gBAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBAC7C,IAAI,QAAQ,IAAI,QAAQ;oBAAE,OAAO,QAAQ,CAAA;gBACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBAC5C,IAAI,QAAQ,IAAI,QAAQ;oBAAE,OAAO,QAAQ,CAAA;gBACzC,OAAO,EAAC,KAAK,EAAE,EAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE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C,CAAC,EAAC,CAAA;YAChI,CAAC,CAAA;QACL,CAAC,EAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { AccumulatorInitial } from '@cobol-ts/cel-graph-runtime';
2
+ import type { ErrorsOr } from '@cobol-ts/errors';
3
+ import type { ValidationObservation } from './validation.reader';
4
+ import { type ValidationReport } from './validation.report';
5
+ import { type IdentificationStrategy } from './validation.identification.strategy';
6
+ /** Local statistics only. Never include a customer identity, expected or actual
7
+ * value, seed, or raw execution error in the agent's validation message. */
8
+ export interface IdentificationSatisfactionReport {
9
+ readonly entitiesTested: number;
10
+ readonly entitiesSatisfied: number;
11
+ readonly identificationFailures: number;
12
+ readonly replayFailures: number;
13
+ readonly incompleteEntities: number;
14
+ readonly compared: number;
15
+ readonly matched: number;
16
+ readonly characteristics: readonly {
17
+ characteristic: string;
18
+ compared: number;
19
+ matched: number;
20
+ mismatched: number;
21
+ missing: number;
22
+ }[];
23
+ readonly strategy?: IdentificationStrategy;
24
+ readonly prefixes?: {
25
+ tested: number;
26
+ satisfied: number;
27
+ identificationFailures: number;
28
+ replayFailures: number;
29
+ incomplete: number;
30
+ mismatched: number;
31
+ compared: number;
32
+ matched: number;
33
+ };
34
+ }
35
+ export declare function identificationSatisfactionPassed(report: IdentificationSatisfactionReport): boolean;
36
+ export declare function identificationSatisfaction(outputs: readonly string[], strategy?: IdentificationStrategy): {
37
+ outputs: readonly string[];
38
+ strategy: IdentificationStrategy;
39
+ recordSeed: (seed: ErrorsOr<AccumulatorInitial>) => AccumulatorInitial | undefined;
40
+ report: () => IdentificationSatisfactionReport;
41
+ beginReplay(): void;
42
+ replayFailed(): void;
43
+ observe(observation: Pick<ValidationObservation, "event" | "composition" | "expected">, read: (name: string) => unknown): void;
44
+ /** Record one selected prefix, retaining the original full-history counters
45
+ * separately from repeated comparisons in shorter prefixes. */
46
+ recordCutoff(seed: ErrorsOr<AccumulatorInitial>, report: ValidationReport | undefined, replayFailed: boolean, final: boolean): void;
47
+ result(): ErrorsOr<string>;
48
+ };
49
+ export declare function formatIdentificationSatisfaction(report: IdentificationSatisfactionReport): ErrorsOr<string>;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.identificationSatisfactionPassed = identificationSatisfactionPassed;
4
+ exports.identificationSatisfaction = identificationSatisfaction;
5
+ exports.formatIdentificationSatisfaction = formatIdentificationSatisfaction;
6
+ const validation_report_1 = require("./validation.report");
7
+ const validation_identification_strategy_1 = require("./validation.identification.strategy");
8
+ /** Every dependent output must have coverage over the tested history. Individual
9
+ * compositions may legitimately omit selected outputs on some observations. */
10
+ function replayOutcome(seed, report, failed) {
11
+ if (seed === undefined)
12
+ return 'identification-failure';
13
+ if (failed)
14
+ return 'replay-failure';
15
+ if (!report || !report.compared || report.characteristics.some(c => c.compared === 0))
16
+ return 'incomplete';
17
+ return report.mismatched ? 'mismatched' : 'matched';
18
+ }
19
+ function identificationSatisfactionPassed(report) {
20
+ return report.entitiesTested > 0 && report.entitiesSatisfied === report.entitiesTested &&
21
+ (!report.prefixes || report.prefixes.satisfied === report.prefixes.tested);
22
+ }
23
+ function identificationSatisfaction(outputs, strategy = validation_identification_strategy_1.fullHistory) {
24
+ let entitiesTested = 0, entitiesSatisfied = 0, identificationFailures = 0, replayFailures = 0, incompleteEntities = 0;
25
+ const totals = [...new Set(outputs)].sort().map(characteristic => ({ characteristic, compared: 0, matched: 0, mismatched: 0, missing: 0 }));
26
+ let entity, failed = false;
27
+ const prefixes = { tested: 0, satisfied: 0, identificationFailures: 0, replayFailures: 0, incomplete: 0, mismatched: 0, compared: 0, matched: 0 };
28
+ function addReplay(report, outcome) {
29
+ if (report)
30
+ for (const [i, c] of report.characteristics.entries()) {
31
+ const total = totals[i];
32
+ total.compared += c.compared;
33
+ total.matched += c.matched;
34
+ total.mismatched += c.mismatched;
35
+ total.missing += c.missing;
36
+ }
37
+ if (outcome === 'matched')
38
+ entitiesSatisfied++;
39
+ else if (outcome === 'incomplete')
40
+ incompleteEntities++;
41
+ else if (outcome === 'replay-failure')
42
+ replayFailures++;
43
+ }
44
+ function finishEntity() {
45
+ if (!entity)
46
+ return;
47
+ const report = entity.report(0);
48
+ addReplay(report, replayOutcome({}, report, failed));
49
+ entity = undefined;
50
+ }
51
+ function recordSeed(seed) {
52
+ entitiesTested++;
53
+ if ('errors' in seed) {
54
+ identificationFailures++;
55
+ return undefined;
56
+ }
57
+ return seed.value;
58
+ }
59
+ function report() {
60
+ finishEntity();
61
+ const compared = totals.reduce((sum, c) => sum + c.compared, 0), matched = totals.reduce((sum, c) => sum + c.matched, 0);
62
+ return { entitiesTested, entitiesSatisfied, identificationFailures, replayFailures, incompleteEntities, compared, matched,
63
+ characteristics: totals.map(c => ({ ...c })), ...(strategy.type === 'full' ? {} : { strategy, prefixes: { ...prefixes } }) };
64
+ }
65
+ return {
66
+ outputs, strategy, recordSeed, report,
67
+ beginReplay() { finishEntity(); entity = (0, validation_report_1.validationStatistics)(outputs, { maxCounterexamples: 0 }); failed = false; },
68
+ replayFailed() { failed = true; },
69
+ observe(observation, read) {
70
+ if (!entity)
71
+ throw new Error('No active identification replay entity');
72
+ entity.observe(observation, read);
73
+ },
74
+ /** Record one selected prefix, retaining the original full-history counters
75
+ * separately from repeated comparisons in shorter prefixes. */
76
+ recordCutoff(seed, report, replayFailed, final) {
77
+ const initial = 'value' in seed ? seed.value : undefined;
78
+ const outcome = replayOutcome(initial, report, replayFailed);
79
+ if (final) {
80
+ recordSeed(seed);
81
+ if (initial !== undefined)
82
+ addReplay(report, outcome);
83
+ }
84
+ if (strategy.type === 'full')
85
+ return;
86
+ prefixes.tested++;
87
+ prefixes.compared += report?.compared ?? 0;
88
+ prefixes.matched += report?.matched ?? 0;
89
+ switch (outcome) {
90
+ case 'matched':
91
+ prefixes.satisfied++;
92
+ break;
93
+ case 'identification-failure':
94
+ prefixes.identificationFailures++;
95
+ break;
96
+ case 'replay-failure':
97
+ prefixes.replayFailures++;
98
+ break;
99
+ case 'incomplete':
100
+ prefixes.incomplete++;
101
+ break;
102
+ case 'mismatched':
103
+ prefixes.mismatched++;
104
+ break;
105
+ }
106
+ },
107
+ result() {
108
+ return formatIdentificationSatisfaction(report());
109
+ }
110
+ };
111
+ }
112
+ function formatIdentificationSatisfaction(report) {
113
+ const message = `Identification satisfaction (fitting observations only): ${JSON.stringify(report)}`;
114
+ return identificationSatisfactionPassed(report) ? { value: message } : { errors: [message] };
115
+ }
116
+ //# sourceMappingURL=validation.identification.satisfaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.satisfaction.js","sourceRoot":"","sources":["../../src/validation.identification.satisfaction.ts"],"names":[],"mappings":";;AAgCA,4EAGC;AAED,gEA+DC;AAED,4EAGC;AAtGD,2DAA+E;AAC/E,6FAA6F;AAI7F;+EAC+E;AAC/E,SAAS,aAAa,CAAC,IAAoC,EAAE,MAAoC,EAAE,MAAe;IAC9G,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,wBAAwB,CAAA;IACvD,IAAI,MAAM;QAAE,OAAO,gBAAgB,CAAA;IACnC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC;QAAE,OAAO,YAAY,CAAA;IAC1G,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC;AAiBD,SAAgB,gCAAgC,CAAC,MAAwC;IACrF,OAAO,MAAM,CAAC,cAAc,GAAG,CAAC,IAAI,MAAM,CAAC,iBAAiB,KAAK,MAAM,CAAC,cAAc;QAClF,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAClF,CAAC;AAED,S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pF,QAAQ,OAAO,EAAE,CAAC;gBACd,KAAK,SAAS;oBAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;oBAAC,MAAK;gBAC3C,KAAK,wBAAwB;oBAAE,QAAQ,CAAC,sBAAsB,EAAE,CAAC;oBAAC,MAAK;gBACvE,KAAK,gBAAgB;oBAAE,QAAQ,CAAC,cAAc,EAAE,CAAC;oBAAC,MAAK;gBACvD,KAAK,YAAY;oBAAE,QAAQ,CAAC,UAAU,EAAE,CAAC;oBAAC,MAAK;gBAC/C,KAAK,YAAY;oBAAE,QAAQ,CAAC,UAAU,EAAE,CAAC;oBAAC,MAAK;YACnD,CAAC;QACL,CAAC;QACD,MAAM;YACF,OAAO,gCAAgC,CAAC,MAAM,EAAE,CAAC,CAAA;QACrD,CAAC;KACJ,CAAA;AACL,CAAC;AAED,SAAgB,gCAAgC,CAAC,MAAwC;IACrF,MAAM,OAAO,GAAG,4DAA4D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IACpG,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAC,CAAA;AAC5F,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type AuthoringGraph } from '@cobol-ts/cel-graph-runtime';
2
+ /** Only compare published consumers of this seed, and execute their dependency closure.
3
+ * A second unidentified seed is not silently replaced by a default. */
4
+ export declare function identificationReplayScope(business: AuthoringGraph, target: string | readonly string[], published: readonly string[]): {
5
+ graph: AuthoringGraph;
6
+ outputs: string[];
7
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.identificationReplayScope = identificationReplayScope;
4
+ const cel_graph_runtime_1 = require("@cobol-ts/cel-graph-runtime");
5
+ const system_identification_1 = require("@cobol-ts/system-identification");
6
+ const errors_1 = require("@cobol-ts/errors");
7
+ /** Only compare published consumers of this seed, and execute their dependency closure.
8
+ * A second unidentified seed is not silently replaced by a default. */
9
+ function identificationReplayScope(business, target, published) {
10
+ const nodes = (0, errors_1.valueOrThrow)((0, cel_graph_runtime_1.canonicaliseCelGraph)(business));
11
+ const requirements = (0, errors_1.valueOrThrow)((0, system_identification_1.discoverIdentificationRequirements)(business));
12
+ const targets = typeof target === 'string' ? [target] : target;
13
+ if (!targets.length)
14
+ throw new Error('No identification targets');
15
+ for (const name of targets)
16
+ if (!requirements.some(item => item.name === name))
17
+ throw new Error(`Unknown identification target '${name}'`);
18
+ const dependencies = new Map();
19
+ const affected = new Set();
20
+ for (const requirement of requirements)
21
+ if (targets.includes(requirement.name) && requirement.valueType.kind === 'rolling-window')
22
+ affected.add(requirement.name);
23
+ for (const node of nodes) {
24
+ const name = node.metadata.name;
25
+ const prev = (0, errors_1.valueOrThrow)((0, system_identification_1.previousReferences)([node]));
26
+ if (prev.some(name => targets.includes(name)))
27
+ affected.add(name);
28
+ dependencies.set(name, new Set([...prev, ...node.dependsOn.filter(path => path[0] === 'now' || path[0] === 'prev').map(path => String(path[1]))]));
29
+ }
30
+ let changed = true;
31
+ while (changed) {
32
+ changed = false;
33
+ for (const [name, refs] of dependencies)
34
+ if (!affected.has(name) && [...refs].some(ref => affected.has(ref))) {
35
+ affected.add(name);
36
+ changed = true;
37
+ }
38
+ }
39
+ const outputs = [...new Set(published)].filter(name => affected.has(name) && nodes.some(node => node.metadata.name === name && node.valueType.kind === 'scalar'));
40
+ if (!outputs.length)
41
+ throw new Error(`Identification target '${target}' has no published dependent output`);
42
+ const selected = new Set(targets), pending = [...outputs, ...targets];
43
+ while (pending.length) {
44
+ const name = pending.pop();
45
+ selected.add(name);
46
+ for (const ref of dependencies.get(name) ?? [])
47
+ if (!selected.has(ref)) {
48
+ selected.add(ref);
49
+ pending.push(ref);
50
+ }
51
+ }
52
+ const graph = Object.fromEntries(Object.entries(business).filter(([name]) => selected.has(name)));
53
+ const other = (0, errors_1.valueOrThrow)((0, system_identification_1.discoverIdentificationRequirements)(graph)).filter(item => !targets.includes(item.name)).map(item => item.name);
54
+ if (other.length)
55
+ throw new Error(`Identification target '${target}' requires other historical state: ${other.join(', ')}`);
56
+ if (Object.values(graph).some(node => node.type === 'failure'))
57
+ throw new Error(`Identification target '${target}' has unresolved business dependencies`);
58
+ return { graph, outputs };
59
+ }
60
+ //# sourceMappingURL=validation.identification.scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.scope.js","sourceRoot":"","sources":["../../src/validation.identification.scope.ts"],"names":[],"mappings":";;AAMA,8DAmCC;AAzCD,mEAAqF;AACrF,2EAAsG;AACtG,6CAA6C;AAE7C;uEACuE;AACvE,SAAgB,yBAAyB,CAAC,QAAwB,EAAE,MAAkC,EAAE,SAA4B;IAChI,MAAM,KAAK,GAAG,IAAA,qBAAY,EAAC,IAAA,wCAAoB,EAAC,QAAQ,CAAC,CAAC,CAAA;IAC1D,MAAM,YAAY,GAAG,IAAA,qBAAY,EAAC,IAAA,0DAAkC,EAAC,QAAQ,CAAC,CAAC,CAAA;IAC/E,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAC9D,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IACjE,KAAK,MAAM,IAAI,IAAI,OAAO;QAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,GAAG,CAAC,CAAA;IAC1I,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAA;IACnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAA;IAClC,KAAK,MAAM,WAAW,IAAI,YAAY;QAAE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AAI,CAAC,CAAC,CAAC,CAAA;IACjH,MAAM,KAAK,GAAG,IAAA,qBAAY,EAAC,IAAA,0DAAkC,EAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzI,IAAI,KAAK,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,sCAAsC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3H,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,wCAAwC,CAAC,CAAA;IACzJ,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { IdentificationSession } from '@cobol-ts/system-identification';
2
+ import type { ProjectionAuthoring } from '@cobol-ts/cursor-loader-types';
3
+ import type { ValidationObservation, ValidationPreparation } from './validation.reader';
4
+ import type { scanValidationCustomersWith } from './validation.reader';
5
+ import type { completeHistoryLimit } from './validation.candidate.policy';
6
+ import type { identificationSatisfaction } from './validation.identification.satisfaction';
7
+ import { type IdentificationObservation } from './validation.identification.observation';
8
+ import type { IdentificationReplay } from './validation.identification.replay';
9
+ type Scan = (visit: Parameters<typeof scanValidationCustomersWith>[4], select: NonNullable<Parameters<typeof scanValidationCustomersWith>[5]>, prepare?: Parameters<typeof scanValidationCustomersWith>[6]) => Promise<void>;
10
+ type Fitting = {
11
+ start: () => IdentificationSession;
12
+ projections: ReadonlyMap<string, ProjectionAuthoring>;
13
+ };
14
+ /** Identify and replay within the reader-owned customer history callback.
15
+ * Detached adapter retained for equivalence and diagnostic tests. */
16
+ export declare function compareIdentificationShard(scan: Scan, replay: IdentificationReplay, fitting: Fitting, limit: ReturnType<typeof completeHistoryLimit>, statistics: ReturnType<typeof identificationSatisfaction>): Promise<void>;
17
+ /** The prefix algorithm is independent of the observation representation. */
18
+ export declare function comparePreparedIdentificationShard<E, T extends IdentificationObservation<E>>(scan: Scan, replay: IdentificationReplay<T>, fitting: {
19
+ start: () => IdentificationSession<E>;
20
+ project: (observation: ValidationObservation) => T;
21
+ prepare?: ValidationPreparation;
22
+ }, limit: ReturnType<typeof completeHistoryLimit>, statistics: ReturnType<typeof identificationSatisfaction>): Promise<void>;
23
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compareIdentificationShard = compareIdentificationShard;
4
+ exports.comparePreparedIdentificationShard = comparePreparedIdentificationShard;
5
+ const validation_identification_observation_1 = require("./validation.identification.observation");
6
+ const validation_identification_prefix_1 = require("./validation.identification.prefix");
7
+ const validation_identification_strategy_1 = require("./validation.identification.strategy");
8
+ const validation_candidate_failure_1 = require("./validation.candidate.failure");
9
+ /** Identify and replay within the reader-owned customer history callback.
10
+ * Detached adapter retained for equivalence and diagnostic tests. */
11
+ async function compareIdentificationShard(scan, replay, fitting, limit, statistics) {
12
+ return comparePreparedIdentificationShard(scan, replay, { ...fitting, project(observation) {
13
+ const projection = fitting.projections.get(observation.composition);
14
+ if (!projection)
15
+ throw new Error('Validation composition is absent from identification snapshot');
16
+ return (0, validation_identification_observation_1.projectIdentificationObservation)(observation, projection);
17
+ } }, limit, statistics);
18
+ }
19
+ /** The prefix algorithm is independent of the observation representation. */
20
+ async function comparePreparedIdentificationShard(scan, replay, fitting, limit, statistics) {
21
+ limit.startShard();
22
+ await scan(observations => {
23
+ if (!observations.length)
24
+ return;
25
+ const history = observations.map(fitting.project);
26
+ const session = fitting.start();
27
+ const runner = (0, validation_identification_prefix_1.prefixReplay)(replay, statistics.outputs, history);
28
+ const cutoffs = (0, validation_identification_strategy_1.identificationCutoffs)(statistics.strategy, history.map(item => item.event));
29
+ let next = 0;
30
+ for (const end of cutoffs) {
31
+ while (next < end) {
32
+ const item = history[next++];
33
+ session.observe(item.composition, item.observation);
34
+ }
35
+ const seed = session.finish();
36
+ if ('errors' in seed) {
37
+ runner.reset();
38
+ statistics.recordCutoff(seed, undefined, false, end === history.length);
39
+ continue;
40
+ }
41
+ try {
42
+ statistics.recordCutoff(seed, runner.evaluate(seed.value, end), false, end === history.length);
43
+ }
44
+ catch (error) {
45
+ if (!(0, validation_candidate_failure_1.findCandidateExecutionException)(error))
46
+ throw error;
47
+ statistics.recordCutoff(seed, runner.report(), true, end === history.length);
48
+ runner.reset();
49
+ }
50
+ }
51
+ }, limit.select, fitting.prepare ? async (definition, sources) => {
52
+ await fitting.prepare(definition, sources);
53
+ return replay.prepare(definition, sources);
54
+ } : replay.prepare);
55
+ }
56
+ //# sourceMappingURL=validation.identification.shard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.shard.js","sourceRoot":"","sources":["../../src/validation.identification.shard.ts"],"names":[],"mappings":";;AAkBA,gEAOC;AAGD,gFAkCC;AAxDD,mGAAwH;AAExH,yFAA+D;AAC/D,6FAA0E;AAC1E,iFAA8E;AAM9E;qEACqE;AAC9D,KAAK,UAAU,0BAA0B,CAAC,IAAU,EAAE,MAA4B,EACrF,OAAgB,EAAE,KAA8C,EAAE,UAAyD;IAC3H,OAAO,kCAAkC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAC,GAAG,OAAO,EAAE,OAAO,CAAC,WAAW;YACpF,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;YACnE,IAAI,CAAC,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;YACjG,OAAO,IAAA,wEAAgC,EAAC,WAAW,EAAE,UAA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BACvE,SAAQ;YACZ,CAAC;YACD,IAAI,CAAC;gBACD,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;YAClG,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,IAAA,8DAA+B,EAAC,KAAK,CAAC;oBAAE,MAAM,KAAK,CAAA;gBACxD,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;gBAC5E,MAAM,CAAC,KAAK,EAAE,CAAA;YAClB,CAAC;QACL,CAAC;IACL,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QAC7D,MAAM,OAAO,CAAC,OAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC3C,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { IdentificationStrategy } from '@cobol-ts/validation-policy';
2
+ export { identificationExecutionPolicy, fullHistory, type IdentificationStrategy } from '@cobol-ts/validation-policy';
3
+ /** Return increasing, inclusive prefix lengths. Never filter the evidence itself. */
4
+ export declare function identificationCutoffs(strategy: IdentificationStrategy, observations: readonly {
5
+ readonly periodicity: string;
6
+ }[]): readonly number[];