@cobol-ts/cobolts 0.0.14 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.benchmark-formats.md +52 -0
- package/README.benchmark-reporting.md +16 -0
- package/README.benchmark.md +199 -0
- package/README.cel.md +112 -57
- package/README.md +450 -21
- package/README.periodic-verification.md +83 -0
- package/dist/src/benchmark.access.spec.d.ts +1 -0
- package/dist/src/benchmark.access.spec.js +30 -0
- package/dist/src/benchmark.access.spec.js.map +1 -0
- package/dist/src/benchmark.aggregate.fixture.d.ts +10 -0
- package/dist/src/benchmark.aggregate.fixture.js +108 -0
- package/dist/src/benchmark.aggregate.fixture.js.map +1 -0
- package/dist/src/benchmark.aggregate.fixture.spec.d.ts +1 -0
- package/dist/src/benchmark.aggregate.fixture.spec.js +116 -0
- package/dist/src/benchmark.aggregate.fixture.spec.js.map +1 -0
- package/dist/src/benchmark.allocations.cli.spec.d.ts +1 -0
- package/dist/src/benchmark.allocations.cli.spec.js +60 -0
- package/dist/src/benchmark.allocations.cli.spec.js.map +1 -0
- package/dist/src/benchmark.allocations.d.ts +19 -0
- package/dist/src/benchmark.allocations.js +82 -0
- package/dist/src/benchmark.allocations.js.map +1 -0
- package/dist/src/benchmark.allocations.spec.d.ts +1 -0
- package/dist/src/benchmark.allocations.spec.js +64 -0
- package/dist/src/benchmark.allocations.spec.js.map +1 -0
- package/dist/src/benchmark.cli.functional.spec.d.ts +1 -0
- package/dist/src/benchmark.cli.functional.spec.js +370 -0
- package/dist/src/benchmark.cli.functional.spec.js.map +1 -0
- package/dist/src/benchmark.cli.golden.spec.d.ts +1 -0
- package/dist/src/benchmark.cli.golden.spec.js +194 -0
- package/dist/src/benchmark.cli.golden.spec.js.map +1 -0
- package/dist/src/benchmark.composed.execution.spec.d.ts +1 -0
- package/dist/src/benchmark.composed.execution.spec.js +120 -0
- package/dist/src/benchmark.composed.execution.spec.js.map +1 -0
- package/dist/src/benchmark.composed.fixture.d.ts +4 -0
- package/dist/src/benchmark.composed.fixture.js +77 -0
- package/dist/src/benchmark.composed.fixture.js.map +1 -0
- package/dist/src/benchmark.composed.fixture.spec.d.ts +1 -0
- package/dist/src/benchmark.composed.fixture.spec.js +50 -0
- package/dist/src/benchmark.composed.fixture.spec.js.map +1 -0
- package/dist/src/benchmark.composed.runner.d.ts +13 -0
- package/dist/src/benchmark.composed.runner.js +221 -0
- package/dist/src/benchmark.composed.runner.js.map +1 -0
- package/dist/src/benchmark.composed.two.fixture.d.ts +5 -0
- package/dist/src/benchmark.composed.two.fixture.js +111 -0
- package/dist/src/benchmark.composed.two.fixture.js.map +1 -0
- package/dist/src/benchmark.composed.two.spec.d.ts +1 -0
- package/dist/src/benchmark.composed.two.spec.js +86 -0
- package/dist/src/benchmark.composed.two.spec.js.map +1 -0
- package/dist/src/benchmark.format.cli.functional.spec.d.ts +1 -0
- package/dist/src/benchmark.format.cli.functional.spec.js +44 -0
- package/dist/src/benchmark.format.cli.functional.spec.js.map +1 -0
- package/dist/src/benchmark.format.composition.spec.d.ts +1 -0
- package/dist/src/benchmark.format.composition.spec.js +196 -0
- package/dist/src/benchmark.format.composition.spec.js.map +1 -0
- package/dist/src/benchmark.format.family.cli.functional.spec.d.ts +1 -0
- package/dist/src/benchmark.format.family.cli.functional.spec.js +102 -0
- package/dist/src/benchmark.format.family.cli.functional.spec.js.map +1 -0
- package/dist/src/benchmark.format.fixture.d.ts +26 -0
- package/dist/src/benchmark.format.fixture.js +181 -0
- package/dist/src/benchmark.format.fixture.js.map +1 -0
- package/dist/src/benchmark.format.oracle.d.ts +8 -0
- package/dist/src/benchmark.format.oracle.js +30 -0
- package/dist/src/benchmark.format.oracle.js.map +1 -0
- package/dist/src/benchmark.format.runner.d.ts +6 -0
- package/dist/src/benchmark.format.runner.js +271 -0
- package/dist/src/benchmark.format.runner.js.map +1 -0
- package/dist/src/benchmark.format.source.d.ts +6 -0
- package/dist/src/benchmark.format.source.js +15 -0
- package/dist/src/benchmark.format.source.js.map +1 -0
- package/dist/src/benchmark.format.spec.d.ts +1 -0
- package/dist/src/benchmark.format.spec.js +85 -0
- package/dist/src/benchmark.format.spec.js.map +1 -0
- package/dist/src/benchmark.format.stateful.spec.d.ts +1 -0
- package/dist/src/benchmark.format.stateful.spec.js +120 -0
- package/dist/src/benchmark.format.stateful.spec.js.map +1 -0
- package/dist/src/benchmark.gc.d.ts +26 -0
- package/dist/src/benchmark.gc.js +62 -0
- package/dist/src/benchmark.gc.js.map +1 -0
- package/dist/src/benchmark.gc.spec.d.ts +1 -0
- package/dist/src/benchmark.gc.spec.js +26 -0
- package/dist/src/benchmark.gc.spec.js.map +1 -0
- package/dist/src/benchmark.periodic.execution.spec.d.ts +1 -0
- package/dist/src/benchmark.periodic.execution.spec.js +166 -0
- package/dist/src/benchmark.periodic.execution.spec.js.map +1 -0
- package/dist/src/benchmark.periodic.fixture.d.ts +5 -0
- package/dist/src/benchmark.periodic.fixture.js +69 -0
- package/dist/src/benchmark.periodic.fixture.js.map +1 -0
- package/dist/src/benchmark.periodic.fixture.spec.d.ts +1 -0
- package/dist/src/benchmark.periodic.fixture.spec.js +96 -0
- package/dist/src/benchmark.periodic.fixture.spec.js.map +1 -0
- package/dist/src/benchmark.profile.d.ts +8 -0
- package/dist/src/benchmark.profile.js +62 -0
- package/dist/src/benchmark.profile.js.map +1 -0
- package/dist/src/benchmark.profile.spec.d.ts +1 -0
- package/dist/src/benchmark.profile.spec.js +65 -0
- package/dist/src/benchmark.profile.spec.js.map +1 -0
- package/dist/src/benchmark.report.d.ts +113 -0
- package/dist/src/benchmark.report.js +279 -0
- package/dist/src/benchmark.report.js.map +1 -0
- package/dist/src/benchmark.report.spec.d.ts +1 -0
- package/dist/src/benchmark.report.spec.js +271 -0
- package/dist/src/benchmark.report.spec.js.map +1 -0
- package/dist/src/benchmark.runner.d.ts +74 -0
- package/dist/src/benchmark.runner.js +371 -0
- package/dist/src/benchmark.runner.js.map +1 -0
- package/dist/src/benchmark.runner.spec.d.ts +1 -0
- package/dist/src/benchmark.runner.spec.js +241 -0
- package/dist/src/benchmark.runner.spec.js.map +1 -0
- package/dist/src/benchmark.strategy.spec.d.ts +1 -0
- package/dist/src/benchmark.strategy.spec.js +66 -0
- package/dist/src/benchmark.strategy.spec.js.map +1 -0
- package/dist/src/cel.composition.integration.spec.d.ts +1 -0
- package/dist/src/cel.composition.integration.spec.js +110 -0
- package/dist/src/cel.composition.integration.spec.js.map +1 -0
- package/dist/src/cel.entity.d.ts +12 -0
- package/dist/src/cel.entity.js +98 -0
- package/dist/src/cel.entity.js.map +1 -0
- package/dist/src/cel.entity.spec.d.ts +1 -0
- package/dist/src/cel.entity.spec.js +82 -0
- package/dist/src/cel.entity.spec.js.map +1 -0
- package/dist/src/cel.evaluate.cli.spec.d.ts +1 -0
- package/dist/src/cel.evaluate.cli.spec.js +63 -0
- package/dist/src/cel.evaluate.cli.spec.js.map +1 -0
- package/dist/src/cel.evaluate.integration.spec.d.ts +1 -0
- package/dist/src/cel.evaluate.integration.spec.js +128 -0
- package/dist/src/cel.evaluate.integration.spec.js.map +1 -0
- package/dist/src/cel.integration.spec.js +227 -38
- package/dist/src/cel.integration.spec.js.map +1 -1
- package/dist/src/cel.result.ownership.spec.d.ts +1 -0
- package/dist/src/cel.result.ownership.spec.js +52 -0
- package/dist/src/cel.result.ownership.spec.js.map +1 -0
- package/dist/src/cel.shared.execution.d.ts +20 -0
- package/dist/src/cel.shared.execution.js +49 -0
- package/dist/src/cel.shared.execution.js.map +1 -0
- package/dist/src/cel.stats.d.ts +5 -0
- package/dist/src/cel.stats.js +73 -0
- package/dist/src/cel.stats.js.map +1 -0
- package/dist/src/cel.stats.spec.d.ts +1 -0
- package/dist/src/cel.stats.spec.js +85 -0
- package/dist/src/cel.stats.spec.js.map +1 -0
- package/dist/src/cli.integration.spec.js +14 -2
- package/dist/src/cli.integration.spec.js.map +1 -1
- package/dist/src/cli.js +12 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/cli.spec.js +46 -6
- package/dist/src/cli.spec.js.map +1 -1
- package/dist/src/commands/ai.d.ts +12 -0
- package/dist/src/commands/ai.demo.spec.d.ts +1 -0
- package/dist/src/commands/ai.demo.spec.js +242 -0
- package/dist/src/commands/ai.demo.spec.js.map +1 -0
- package/dist/src/commands/ai.js +125 -0
- package/dist/src/commands/ai.js.map +1 -0
- package/dist/src/commands/ai.spec.d.ts +1 -0
- package/dist/src/commands/ai.spec.js +170 -0
- package/dist/src/commands/ai.spec.js.map +1 -0
- package/dist/src/commands/benchmark.d.ts +3 -0
- package/dist/src/commands/benchmark.js +300 -0
- package/dist/src/commands/benchmark.js.map +1 -0
- package/dist/src/commands/cel.d.ts +1 -1
- package/dist/src/commands/cel.js +38 -5
- package/dist/src/commands/cel.js.map +1 -1
- package/dist/src/commands/characteristics.d.ts +3 -0
- package/dist/src/commands/characteristics.js +107 -0
- package/dist/src/commands/characteristics.js.map +1 -0
- package/dist/src/commands/characteristics.spec.d.ts +1 -0
- package/dist/src/commands/characteristics.spec.js +242 -0
- package/dist/src/commands/characteristics.spec.js.map +1 -0
- package/dist/src/commands/config.validate.js +8 -4
- package/dist/src/commands/config.validate.js.map +1 -1
- package/dist/src/commands/extract.d.ts +14 -0
- package/dist/src/commands/extract.js +85 -0
- package/dist/src/commands/extract.js.map +1 -0
- package/dist/src/commands/extract.spec.d.ts +1 -0
- package/dist/src/commands/extract.spec.js +179 -0
- package/dist/src/commands/extract.spec.js.map +1 -0
- package/dist/src/commands/graph.d.ts +9 -0
- package/dist/src/commands/graph.js +98 -0
- package/dist/src/commands/graph.js.map +1 -0
- package/dist/src/commands/graph.report.d.ts +26 -0
- package/dist/src/commands/graph.report.js +75 -0
- package/dist/src/commands/graph.report.js.map +1 -0
- package/dist/src/commands/graph.spec.d.ts +1 -0
- package/dist/src/commands/graph.spec.js +215 -0
- package/dist/src/commands/graph.spec.js.map +1 -0
- package/dist/src/commands/periodicity.d.ts +3 -0
- package/dist/src/commands/periodicity.js +11 -0
- package/dist/src/commands/periodicity.js.map +1 -0
- package/dist/src/commands/validate.all.d.ts +7 -0
- package/dist/src/commands/validate.all.integration.spec.d.ts +1 -0
- package/dist/src/commands/validate.all.integration.spec.js +43 -0
- package/dist/src/commands/validate.all.integration.spec.js.map +1 -0
- package/dist/src/commands/validate.all.js +75 -0
- package/dist/src/commands/validate.all.js.map +1 -0
- package/dist/src/commands/validate.all.spec.d.ts +1 -0
- package/dist/src/commands/validate.all.spec.js +70 -0
- package/dist/src/commands/validate.all.spec.js.map +1 -0
- package/dist/src/context.d.ts +40 -6
- package/dist/src/context.js +582 -21
- package/dist/src/context.js.map +1 -1
- package/dist/src/indexed.accumulator.d.ts +18 -0
- package/dist/src/indexed.accumulator.js +107 -0
- package/dist/src/indexed.accumulator.js.map +1 -0
- package/dist/src/indexed.accumulator.spec.d.ts +1 -0
- package/dist/src/indexed.accumulator.spec.js +81 -0
- package/dist/src/indexed.accumulator.spec.js.map +1 -0
- package/package.json +27 -11
package/README.md
CHANGED
|
@@ -1,6 +1,218 @@
|
|
|
1
|
-
# cobolts
|
|
1
|
+
# @cobol-ts/cobolts
|
|
2
2
|
|
|
3
|
-
Commander-based CLI for inspecting configured files, generating TypeScript contracts, displaying physical data, and compiling or executing CEL dependency graphs. Code generation uses `@cobol-ts/codegen`; neither `display` nor `cel execute` requires or executes generated TypeScript.
|
|
3
|
+
Commander-based CLI for inspecting configured files and input/output characteristic metadata, extracting Excel characteristics, serving read-only characteristic APIs, generating TypeScript contracts, displaying physical data, and compiling or executing CEL dependency graphs, and generating AI-assisted graph experiments. Code generation uses `@cobol-ts/codegen`; neither `display` nor `cel execute` requires or executes generated TypeScript.
|
|
4
|
+
|
|
5
|
+
## Quick orientation
|
|
6
|
+
|
|
7
|
+
**In this README:** [Layout](#layout) · [Excel → AI experiment → graph walkthrough](#excel--ai-experiment--graph-walkthrough) · [Commands](#commands) · [Characteristic metadata repository](#characteristic-metadata-repository) · [Characteristic metadata HTTP API](#characteristic-metadata-http-api) · [Display data (no generated TypeScript)](#display-data-no-generated-typescript) · [CEL dependency graphs](#cel-dependency-graphs) · [Benchmark allocation diagnostics](#benchmark-allocation-diagnostics)
|
|
8
|
+
|
|
9
|
+
**Responsibility.** Provide the Commander CLI for configuration inspection, validation, generation, data display, graph execution and benchmarks.
|
|
10
|
+
|
|
11
|
+
**Boundary.** The CLI orchestrates the same production readers and graph executors used by library consumers; generating TypeScript is not required to display or execute records.
|
|
12
|
+
|
|
13
|
+
**Public modules.** [cli.ts](./src/cli.ts), [context.ts](./src/context.ts).
|
|
14
|
+
|
|
15
|
+
**Tests.** [benchmark.access.spec.ts](src/benchmark.access.spec.ts), [benchmark.allocations.cli.spec.ts](src/benchmark.allocations.cli.spec.ts), [benchmark.allocations.spec.ts](src/benchmark.allocations.spec.ts) (+27 more)
|
|
16
|
+
|
|
17
|
+
**Related packages.** [@cobol-ts/file-catalogue](../../config/file-catalogue/README.md) · [@cobol-ts/cel-graph-runtime](../../cel/graph-runtime/README.md).
|
|
18
|
+
|
|
19
|
+
## Excel → AI experiment → graph walkthrough
|
|
20
|
+
|
|
21
|
+
This is the complete **mock-AI demonstration sequence**, from characteristic
|
|
22
|
+
metadata in a workbook to a reviewable experiment report and an ordinary
|
|
23
|
+
`graph.yaml`-format authoring graph. Run all commands **from the repository root**.
|
|
24
|
+
The demo uses 27 output characteristics, including `C7030` (six-month
|
|
25
|
+
order-line count spread) and `C7200` (six-month order-unit spread). The order-count input uses `input.customers.orderCount`; graph
|
|
26
|
+
building does not execute or compare the equations against legacy data.
|
|
27
|
+
|
|
28
|
+
### 1. Configure the Excel source
|
|
29
|
+
|
|
30
|
+
Save **`Demo characteristics.xlsx`** in `modules/examples/example/definitions/`
|
|
31
|
+
(the workbook has `Basic` and `Sheet2` worksheets with characteristic IDs in
|
|
32
|
+
column A, descriptions in `Basic!B`, optional short business names in `Basic!C`,
|
|
33
|
+
and types in `Sheet2!B`). The checked-in file
|
|
34
|
+
[`modules/examples/example/definitions/.cobolts/extractions.yaml`](../../examples/example/definitions/.cobolts/extractions.yaml)
|
|
35
|
+
contains the following mapping. Configure this **before** running `extract`:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
extractions:
|
|
39
|
+
demo-characteristics:
|
|
40
|
+
type: excel
|
|
41
|
+
file: ../Demo characteristics.xlsx # relative to .cobolts
|
|
42
|
+
join: left
|
|
43
|
+
sheets:
|
|
44
|
+
- name: Basic
|
|
45
|
+
idColumn: A
|
|
46
|
+
firstDataRow: 2
|
|
47
|
+
columns:
|
|
48
|
+
description: B
|
|
49
|
+
name: C
|
|
50
|
+
- name: Sheet2
|
|
51
|
+
idColumn: A
|
|
52
|
+
firstDataRow: 2
|
|
53
|
+
columns:
|
|
54
|
+
type: B
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The checked-in
|
|
58
|
+
[`characteristics.yaml`](../../examples/example/definitions/.cobolts/characteristics.yaml)
|
|
59
|
+
then configures **where extracted output and hand-authored input metadata are
|
|
60
|
+
loaded from**:
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
files: .
|
|
64
|
+
input:
|
|
65
|
+
sources:
|
|
66
|
+
demo:
|
|
67
|
+
type: yaml
|
|
68
|
+
file: input-characteristics.yaml
|
|
69
|
+
path: characteristics
|
|
70
|
+
output:
|
|
71
|
+
sources:
|
|
72
|
+
demo:
|
|
73
|
+
type: yaml
|
|
74
|
+
file: demo-characteristics.yaml
|
|
75
|
+
path: characteristics
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Both filenames resolve from `.cobolts` via `files: .`; the `path` selects the
|
|
79
|
+
`characteristics` key inside each YAML document. The output catalogue is
|
|
80
|
+
regenerated from Excel; the illustrative input catalogue is maintained
|
|
81
|
+
separately. If you change the configuration, check the filenames, sheet names,
|
|
82
|
+
columns and mapping path before continuing.
|
|
83
|
+
|
|
84
|
+
### 2. Extract and inspect metadata
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
yarn cobolts -d modules/examples/example/definitions extract demo-characteristics --raw --noSources --output modules/examples/example/definitions/.cobolts/demo-characteristics.yaml
|
|
88
|
+
yarn cobolts -d modules/examples/example/definitions characteristics list
|
|
89
|
+
yarn cobolts -d modules/examples/example/definitions characteristics show C7200
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`extract` **overwrites** the output metadata YAML, not the Excel workbook or
|
|
93
|
+
input metadata. It reads `.cobolts/extractions.yaml`; `characteristics list/show`
|
|
94
|
+
read `.cobolts/characteristics.yaml` and the two configured sources. The
|
|
95
|
+
`--noSources` flag omits worksheet provenance in the generated file; omit it
|
|
96
|
+
if you want to retain Excel source rows in the characteristic metadata.
|
|
97
|
+
|
|
98
|
+
### 3. Configure the mock AI and inspect a hypothesis
|
|
99
|
+
|
|
100
|
+
The checked-in [`.cobolts/ai.yaml`](../../examples/example/definitions/.cobolts/ai.yaml)
|
|
101
|
+
specifies the mock implementation of the OpenAI-shaped chat port, its response
|
|
102
|
+
lookup file and **external prompt templates**:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
provider: mock
|
|
106
|
+
model: mock-characteristic-graph
|
|
107
|
+
responses: mock.ai.yaml
|
|
108
|
+
prompts:
|
|
109
|
+
system: prompts/generate-system.md
|
|
110
|
+
inputs: prompts/available-inputs.md
|
|
111
|
+
target: prompts/target-characteristic.md
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`mock.ai.yaml` maps each **output** ID to one authoring subgraph. For `C7030`
|
|
115
|
+
it supplies a six-month rolling order-line count, native `min` and `max` aggregates,
|
|
116
|
+
and a final CEL subtraction. For `C7200` the mock uses the physical
|
|
117
|
+
`input.customers.orders` path and the same monthly min/max/spread pattern.
|
|
118
|
+
There are also mock experiments for daily aggregates, window collection
|
|
119
|
+
calculations, accumulated totals and initially empty monthly histories.
|
|
120
|
+
The first two prompt messages are identical for
|
|
121
|
+
all targets (system and input catalogue); only the last target message varies.
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
yarn cobolts -d modules/examples/example/definitions ai prompt C7200
|
|
125
|
+
yarn cobolts -d modules/examples/example/definitions ai exchange C7200
|
|
126
|
+
yarn cobolts -d modules/examples/example/definitions ai response C7200
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
These commands show respectively the full request, the request and model
|
|
130
|
+
response, and just the graph fragment. They do **not** write experiment files.
|
|
131
|
+
|
|
132
|
+
### 4. Generate and review experiments
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
# Single experiment for inspection (stdout)
|
|
136
|
+
yarn cobolts -d modules/examples/example/definitions ai do C7200
|
|
137
|
+
|
|
138
|
+
# All output characteristics as one versioned, reviewable YAML report
|
|
139
|
+
yarn cobolts -d modules/examples/example/definitions ai all --file experiments.yaml
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`experiments.yaml` is written in the repository root by `--file`. Each record
|
|
143
|
+
contains `characteristic`, its original **output metadata**, derived **findings**
|
|
144
|
+
(input paths, matched input characteristics, windows, aggregates and final
|
|
145
|
+
calculation), `generation`, the complete proposed `graph` fragment and
|
|
146
|
+
`history: []`. Findings are derived from graph structure and CEL dependencies,
|
|
147
|
+
not independent claims by the model. The file is a **hypothesis report**, not
|
|
148
|
+
an executable graph or evidence of correctness. A missing match to input
|
|
149
|
+
metadata does not mean an expression has no input dependencies.
|
|
150
|
+
|
|
151
|
+
### 5. Build a normal graph.yaml from the experiments
|
|
152
|
+
|
|
153
|
+
```powershell
|
|
154
|
+
# Build only the AI-generated fragments; stdout is plain graph YAML
|
|
155
|
+
yarn cobolts -d modules/examples/example/definitions graph build experiments.yaml
|
|
156
|
+
|
|
157
|
+
# Save the assembled graph and report coverage against the output catalogue
|
|
158
|
+
yarn cobolts -d modules/examples/example/definitions graph build experiments.yaml --file modules/examples/example/definitions/.cobolts/generated-graph.yaml --report
|
|
159
|
+
|
|
160
|
+
# Show which outputs came from experiments, existing graphs or are missing,
|
|
161
|
+
# including every characteristic ID and node counts by contributing source
|
|
162
|
+
yarn cobolts -d modules/examples/example/definitions graph build experiments.yaml --file modules/examples/example/definitions/.cobolts/generated-graph.yaml --detailed
|
|
163
|
+
|
|
164
|
+
# Optional: mix generated nodes with a separately authored graph
|
|
165
|
+
# (repeat --with for multiple inputs; duplicate names fail)
|
|
166
|
+
yarn cobolts -d modules/examples/example/definitions graph build experiments.yaml --with modules/examples/example/definitions/.cobolts/graph.yaml --file modules/examples/example/definitions/.cobolts/combined-graph.yaml
|
|
167
|
+
|
|
168
|
+
# Check the assembled authoring graph before execution
|
|
169
|
+
yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel validate --graph generated-graph.yaml
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`graph build` accepts a version-1 experiment dossier and optional existing
|
|
173
|
+
`graph.yaml` files, composes their node mappings **without copying report
|
|
174
|
+
metadata, findings or history**, checks for duplicate node names and validates
|
|
175
|
+
the complete graph's CEL dependencies. The graph inputs and `--file` path are
|
|
176
|
+
relative to the **current working directory**; `cel --graph`, by contrast, is
|
|
177
|
+
relative to the discovered `.cobolts` directory. The command can later accept
|
|
178
|
+
other source types without coupling graph composition to the AI provider.
|
|
179
|
+
|
|
180
|
+
`--report` writes a concise **build report to stderr** and leaves stdout (or
|
|
181
|
+
`--file`) as pure `graph.yaml` YAML. With all 27 mock experiments,
|
|
182
|
+
the graph contains 54 nodes and the coverage report should show zero lost
|
|
183
|
+
characteristics. It counts experiment fragments, existing
|
|
184
|
+
sources, CEL and aggregate nodes and registered **output** characteristics
|
|
185
|
+
included in the graph. The three outcome groups are **from experiments**,
|
|
186
|
+
**from existing graphs**, and **lost**. Here *lost* means a catalogued output
|
|
187
|
+
whose named output node is **absent from the composed graph** (for example,
|
|
188
|
+
because only one characteristic was generated), not a node silently discarded
|
|
189
|
+
by the build. Duplicate nodes or invalid dependencies fail the build instead
|
|
190
|
+
of being lost. An experiment targeting an ID absent from the current output
|
|
191
|
+
catalogue is counted separately as **uncatalogued**. `--detailed` implies
|
|
192
|
+
`--report` and prints each group’s characteristic IDs plus per-source node
|
|
193
|
+
counts. Reporting uses `.cobolts/characteristics.yaml`, so rerun the Excel
|
|
194
|
+
extraction first when the workbook changes. Neither option changes the graph.
|
|
195
|
+
|
|
196
|
+
The generated graph's accumulator seeds are in
|
|
197
|
+
[`accumulator.generated.yaml`](../../examples/example/definitions/.cobolts/accumulator.generated.yaml).
|
|
198
|
+
It retains the sample daily and monthly histories under new, characteristic-prefixed
|
|
199
|
+
window names, and seeds `C7240` with the previous customer lifetime volume. For
|
|
200
|
+
an eventual evaluation, select the matching seed using the **root-level** option:
|
|
201
|
+
|
|
202
|
+
```powershell
|
|
203
|
+
yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel evaluate 1001 --graph generated-graph.yaml --periodicity monthly
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The customer order-count field is already in the example projection. Do not
|
|
207
|
+
replace `graph.yaml` independently of its accumulator configuration: use the
|
|
208
|
+
matching `accumulator.generated.yaml` seed as shown. The generated experiments intentionally repeat some rolling windows
|
|
209
|
+
across different output characteristics; graph deduplication comes later.
|
|
210
|
+
|
|
211
|
+
Input `I7000` now describes the existing `input.customers.orderCount` physical
|
|
212
|
+
projection. Its six monthly seed values are synthetic demonstration history;
|
|
213
|
+
advancing `--periodicity monthly` inserts the current record's `orderCount`.
|
|
214
|
+
See the [example `.cobolts` walkthrough](../../examples/example/definitions/.cobolts/README.md)
|
|
215
|
+
for complete executable commands and the required spreadsheet rows.
|
|
4
216
|
|
|
5
217
|
## Layout
|
|
6
218
|
|
|
@@ -13,38 +225,72 @@ example/
|
|
|
13
225
|
data.yaml
|
|
14
226
|
graph.yaml
|
|
15
227
|
accumulator.yaml
|
|
228
|
+
accumulator.generated.yaml
|
|
229
|
+
extractions.yaml
|
|
230
|
+
characteristics.yaml
|
|
231
|
+
ai.yaml
|
|
232
|
+
mock.ai.yaml
|
|
233
|
+
prompts/
|
|
234
|
+
input-characteristics.yaml
|
|
235
|
+
demo-characteristics.yaml
|
|
16
236
|
copybooks/
|
|
17
237
|
CUSTOMER.cpy
|
|
18
238
|
application/
|
|
19
239
|
src/generated/
|
|
20
240
|
```
|
|
21
241
|
|
|
22
|
-
The closest `.cobolts` directory found by walking upwards from the current working directory is the **configuration directory**. It is discovered, not configured. `files.yaml` contains a `root` and `files` map; `generation.yaml` contains a separate `root`, filename templates, optional manual overrides, and code-generation naming. Relative roots are interpreted from `.cobolts` and may point into separate workspace packages; absolute roots are also permitted.
|
|
242
|
+
The example above shows the main configuration files and metadata examples (not every graph fixture). The closest `.cobolts` directory found by walking upwards from the current working directory is the **configuration directory**. It is discovered, not configured. `files.yaml` contains a `root` and `files` map; `generation.yaml` contains a separate `root`, filename templates, optional manual overrides, and code-generation naming. Relative roots are interpreted from `.cobolts` and may point into separate workspace packages; absolute roots are also permitted.
|
|
23
243
|
|
|
24
244
|
Source filenames are relative to `files.root`; generated filenames are relative to `generation.root`. Manual override paths are interpreted relative to `.cobolts`.
|
|
25
245
|
|
|
26
246
|
## Commands
|
|
27
247
|
|
|
248
|
+
The normal execution model is a composition declared in `.cobolts/files.yaml`. A composition may contain only one physical source. Entity keys are declared with `key` and `keyPath` on its source; do not assume a `customerId` field exists in arbitrary input files. `generation.yaml` is needed for code generation, not CEL execution or workspace validation.
|
|
249
|
+
|
|
250
|
+
From the repository root (PowerShell):
|
|
251
|
+
|
|
252
|
+
```powershell
|
|
253
|
+
# Discover and validate all projects below this directory
|
|
254
|
+
yarn cobolts -d benchmarks validate all
|
|
255
|
+
yarn cobolts -d modules/examples validate all
|
|
256
|
+
|
|
257
|
+
# Inspect the authoring-to-planned pipeline
|
|
258
|
+
yarn cobolts -d benchmarks/graph-10 cel graph --short
|
|
259
|
+
yarn cobolts -d benchmarks/graph-10 cel canonical --short
|
|
260
|
+
yarn cobolts -d benchmarks/graph-10 cel sorted --short
|
|
261
|
+
yarn cobolts -d benchmarks/graph-10 cel planned --short
|
|
262
|
+
|
|
263
|
+
# Validate and execute a composed project
|
|
264
|
+
yarn cobolts -d benchmarks/baseline cel validate
|
|
265
|
+
yarn cobolts -d benchmarks/baseline cel execute --count 1 --raw
|
|
266
|
+
yarn cobolts -d benchmarks/baseline cel evaluate 1 --debug
|
|
267
|
+
|
|
268
|
+
# Execute the two-file EBCDIC example
|
|
269
|
+
yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --debug
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Commands (`[ ]` marks optional arguments):
|
|
273
|
+
|
|
28
274
|
```text
|
|
29
|
-
cobolts
|
|
30
|
-
cobolts
|
|
31
|
-
cobolts config list
|
|
32
|
-
cobolts config names
|
|
33
|
-
cobolts config view
|
|
34
|
-
cobolts config validate
|
|
35
|
-
cobolts generate all [logicalName]
|
|
36
|
-
cobolts generate copybook [logicalName]
|
|
37
|
-
cobolts generate projectionDefn [logicalName]
|
|
38
|
-
cobolts generate projection [logicalName]
|
|
275
|
+
cobolts config files|list|names|view|validate
|
|
276
|
+
cobolts generate all|copybook|projectionDefn|projection [logical-name]
|
|
39
277
|
cobolts display <logical-name> [--count N | --all] [--skip N] [--raw] [--input file]
|
|
40
|
-
cobolts
|
|
41
|
-
cobolts cel canonical [--graph file]
|
|
42
|
-
cobolts cel sorted [--graph file]
|
|
278
|
+
cobolts graph build <experiments.yaml> [--with existing-graph.yaml] [--file graph.yaml] [--report] [--detailed]
|
|
279
|
+
cobolts cel graph|canonical|sorted|planned [--graph file] [--short]
|
|
43
280
|
cobolts cel validate [logical-name] [--graph file]
|
|
44
|
-
cobolts cel execute
|
|
281
|
+
cobolts cel execute [logical-name] [--count N | --all] [--skip N] [--raw] [--on-error throw|continue]
|
|
282
|
+
cobolts cel evaluate <entity-id> [logical-name] [--debug] [--debug-node name]
|
|
283
|
+
cobolts validate all
|
|
284
|
+
cobolts ai prompt|exchange|response <output-id>
|
|
285
|
+
cobolts ai do <output-id> [--file file]
|
|
286
|
+
cobolts ai all [--file file]
|
|
45
287
|
```
|
|
46
288
|
|
|
47
|
-
|
|
289
|
+
For composed projects, omit `[logical-name]` and the CLI uses `files.yaml` composition. The optional logical-name form supports the legacy single-file route. `--on-error continue` is **not supported for composed execution** until rollback semantics are implemented; `throw` remains the default. `cel evaluate` selects the configured entity key, whereas `cel execute --count 1` executes the first available record.
|
|
290
|
+
|
|
291
|
+
Benchmark projects use `yarn cobolts benchmark list` to enumerate all 21 registered fixtures, and `yarn cobolts benchmark init all --force` to regenerate them, including `graph-1000-periodic`. Generated accumulator files explicitly select safe-integer numeric customer IDs; see [README.benchmark.md](README.benchmark.md).
|
|
292
|
+
|
|
293
|
+
`-d` normally starts upward search for the nearest `.cobolts` directory. On `validate all`, it instead identifies the directory recursively scanned for projects. This command validates each project's catalogue, source files, configured data, accumulator and CEL graph. If a `generation.yaml` is present it additionally validates the generation manifest. Missing `generation.yaml` is valid for execution-only projects. `config validate` follows the same optional-policy rule, but does not validate the CEL graph. Explicit `--policy` is used for code generation.
|
|
48
294
|
|
|
49
295
|
For each COBOL logical file, provide the declaration and export names under `names` in `generation.yaml`:
|
|
50
296
|
|
|
@@ -83,8 +329,191 @@ Normally stdout begins with `# <physical-filename>` followed by JSONL. `--raw` s
|
|
|
83
329
|
|
|
84
330
|
## CEL dependency graphs
|
|
85
331
|
|
|
86
|
-
The separate `graph.yaml` file declares the calculations. `cel graph`, `canonical`, and `
|
|
332
|
+
The separate `graph.yaml` file declares the calculations. `cel graph`, `canonical`, `sorted`, and `planned` show authoring nodes, normalised dependencies, topological generations, and indexed downstream links without reading records. Add `--short` to any of the four commands for a compact dependency view. `cel validate` checks graph syntax, missing `now`/`prev` graph targets, ordering cycles, and configured accumulator seed values; supplying a logical file additionally compiles projected field accesses without scanning the data. `cel execute` compiles once and evaluates the configured composed cursor (which may include COBOL, CSV, JSONL and other configured sources), producing one accumulator JSON value per entity.
|
|
333
|
+
|
|
334
|
+
In the default `throw` mode, an evaluation error stops processing and makes the command fail with a nonzero exit code; a failed record does not produce an accumulator JSON line. For the legacy single-file executor, `continue` writes an `errors` JSON line and proceeds, retaining the previous successful accumulator. Composed execution rejects `continue` because transactional rollback is not yet supported. The physical filename header is printed only after successful graph compilation, and `--raw` omits it.
|
|
335
|
+
|
|
336
|
+
See [README.cel.md](README.cel.md) for `now`/`prev` ordering semantics, a three-node example, the difference between structural validation and runtime missing values, and accumulator limitations for partial graphs.
|
|
337
|
+
|
|
338
|
+
## Benchmark allocation diagnostics
|
|
339
|
+
|
|
340
|
+
Use the existing `yarn cobolts` entry point from the repository root. No separate
|
|
341
|
+
Node command or dependency is required:
|
|
342
|
+
|
|
343
|
+
```powershell
|
|
344
|
+
# Capture a V8 allocation-sampling profile of the first measured CEL pass.
|
|
345
|
+
yarn cobolts benchmark run graph-1000-chain -n 10000 --allocation-profile
|
|
346
|
+
|
|
347
|
+
# Summarise the profile under benchmarks/graph-1000-chain/cel.heapprofile.
|
|
348
|
+
yarn cobolts benchmark allocations graph-1000-chain --top 30
|
|
349
|
+
|
|
350
|
+
# Include one representative calling stack for each ranked allocation site.
|
|
351
|
+
yarn cobolts benchmark allocations graph-1000-chain --top 30 --stacks
|
|
352
|
+
|
|
353
|
+
# Select the profile from another mode or analyse an arbitrary saved profile.
|
|
354
|
+
yarn cobolts benchmark allocations graph-1000-chain --mode read
|
|
355
|
+
yarn cobolts benchmark allocations --file "C:\git\cobol-ts\benchmarks\graph-1000-chain\cel.heapprofile"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
The report ranks **sampled self sizes** by source location. These are neither
|
|
359
|
+
retained heap sizes nor exact allocation totals. In particular, the benchmark
|
|
360
|
+
currently includes graph preparation and compilation in each measured CEL pass;
|
|
361
|
+
the profile therefore contains both setup and steady-state allocations. Use
|
|
362
|
+
unprofiled runs for performance comparisons because sampling affects timings.
|
|
363
|
+
|
|
364
|
+
## Named characteristic extraction
|
|
365
|
+
|
|
366
|
+
`cobolts extract <name>` reads one extraction from `.cobolts/extractions.yaml`. Source worksheet provenance is included by default; `--noSources` suppresses that field in either YAML or JSON output without affecting the join.
|
|
367
|
+
The `extractions` mapping can contain several named, type-tagged definitions. Currently
|
|
368
|
+
`type: excel` is implemented; other types (including Word) can be added later.
|
|
369
|
+
|
|
370
|
+
For the `Demo characteristics` spreadsheet, save the exported `.xlsx` in
|
|
371
|
+
`source/demo-characteristics.xlsx`, and configure:
|
|
372
|
+
|
|
373
|
+
```yaml
|
|
374
|
+
extractions:
|
|
375
|
+
demo-characteristics:
|
|
376
|
+
type: excel
|
|
377
|
+
file: ../source/demo-characteristics.xlsx # relative to .cobolts
|
|
378
|
+
join: left # optional; full is also supported
|
|
379
|
+
sheets:
|
|
380
|
+
- name: Basic
|
|
381
|
+
idColumn: A
|
|
382
|
+
firstDataRow: 2
|
|
383
|
+
columns:
|
|
384
|
+
description: B
|
|
385
|
+
name: C
|
|
386
|
+
- name: Sheet2
|
|
387
|
+
idColumn: A
|
|
388
|
+
firstDataRow: 2
|
|
389
|
+
columns:
|
|
390
|
+
type: B
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Run:
|
|
394
|
+
|
|
395
|
+
```sh
|
|
396
|
+
cobolts -d /path/to/project extract demo-characteristics
|
|
397
|
+
cobolts -d /path/to/project extract demo-characteristics --output metadata.yaml
|
|
398
|
+
cobolts -d /path/to/project extract demo-characteristics --format json
|
|
399
|
+
cobolts -d /path/to/project extract demo-characteristics --noSources
|
|
400
|
+
cobolts -d /path/to/project extract demo-characteristics --raw
|
|
401
|
+
cobolts -d /path/to/project extract demo-characteristics --raw --noSources
|
|
402
|
+
cobolts -d /path/to/project extract demo-characteristics --config another-extractions.yaml
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
The initial worksheet supplies characteristic IDs and output order. Data from later
|
|
406
|
+
worksheets is joined on trimmed IDs; a `left` join discards and counts IDs not in
|
|
407
|
+
that first worksheet. `full` includes them. Duplicate IDs within a worksheet and
|
|
408
|
+
repeated metadata field names across worksheets fail with precise diagnostics.
|
|
409
|
+
|
|
410
|
+
Default output is YAML on stdout; `--output` writes a named file relative to the
|
|
411
|
+
working directory. Diagnostics go to stderr unless `--raw` suppresses the trailing extraction summary.
|
|
412
|
+
The output includes the source file,
|
|
413
|
+
sheet and row for each matched record. Extraction does not mutate experiment dossiers.
|
|
414
|
+
|
|
415
|
+
## Characteristic metadata repository
|
|
416
|
+
|
|
417
|
+
`.cobolts/characteristics.yaml` declares a global `files` directory prefix and independent `input` and `output` sets of named `type: yaml` metadata sources. Each source selects a dotted `path` to a map of characteristic IDs or the list emitted by `cobolts extract`. Sources within each kind join by characteristic ID. An ID may appear in both kinds with different metadata.
|
|
418
|
+
|
|
419
|
+
```yaml
|
|
420
|
+
files: .
|
|
421
|
+
input:
|
|
422
|
+
sources:
|
|
423
|
+
incoming:
|
|
424
|
+
type: yaml
|
|
425
|
+
file: input-characteristics.yaml
|
|
426
|
+
path: characteristics
|
|
427
|
+
output:
|
|
428
|
+
sources:
|
|
429
|
+
demo:
|
|
430
|
+
type: yaml
|
|
431
|
+
file: demo-characteristics.yaml
|
|
432
|
+
path: characteristics
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
```sh
|
|
436
|
+
# By default display both input and output, in separate named sections
|
|
437
|
+
cobolts -d modules/examples/example/definitions characteristics list
|
|
438
|
+
cobolts -d modules/examples/example/definitions characteristics show C0010
|
|
439
|
+
cobolts -d modules/examples/example/definitions characteristics list --ids
|
|
440
|
+
|
|
441
|
+
# Explicit input/output selection
|
|
442
|
+
cobolts -d modules/examples/example/definitions characteristics list --kind input
|
|
443
|
+
cobolts -d modules/examples/example/definitions characteristics show C0010 --kind input
|
|
444
|
+
cobolts -d modules/examples/example/definitions characteristics list --kind output --ids
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Regenerate the output example metadata from Excel with:
|
|
448
|
+
|
|
449
|
+
```sh
|
|
450
|
+
cobolts -d modules/examples/example/definitions extract demo-characteristics \
|
|
451
|
+
--raw --noSources --output modules/examples/example/definitions/.cobolts/demo-characteristics.yaml
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Use `--format json` for JSON. Without `--kind`, `list` produces separate `input` and `output` arrays; `show` produces both records with an explicit `null` for a kind where the ID is absent. `list --ids` prefixes each ID with its kind (`input:C0010`, `output:C0010`) so repeated identifiers remain unambiguous. `--kind input` or `--kind output` limits output to that catalogue and preserves the single-catalogue response shape. Both inspection commands accept `--config`. The internal metadata query port remains `list()`/`get(id)` for each kind.
|
|
455
|
+
|
|
456
|
+
## Characteristic metadata HTTP API
|
|
457
|
+
|
|
458
|
+
Read-only metadata is available over localhost without an MCP server:
|
|
459
|
+
|
|
460
|
+
```powershell
|
|
461
|
+
cobolts -d modules/examples/example/definitions characteristics serve --port 3000
|
|
462
|
+
cobolts -d modules/examples/example/definitions characteristics serve --port 3000 --quiet
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
By default the server prints its base URL and the API endpoints to stderr. `--quiet` suppresses only this startup information; errors remain visible.
|
|
466
|
+
|
|
467
|
+
`GET /api` links to `/api/characteristics`, whose sitemap links to the input and output collections. Those collections each provide self-links for every characteristic, with detail endpoints under `/api/characteristics/input/:id` and `/api/characteristics/output/:id`. All links are root-relative and characteristic IDs are URL-encoded. There is no authentication: do not expose the server outside the trusted developer machine. Restart it to load edits to the source YAML files.
|
|
468
|
+
|
|
469
|
+
## AI characteristic experiment loop (mock provider)
|
|
470
|
+
|
|
471
|
+
`.cobolts/ai.yaml` selects the provider (`mock` for now), the model identifier,
|
|
472
|
+
`mock.ai.yaml`, and the three **external prompt files**. The first two messages of
|
|
473
|
+
the OpenAI Chat Completions request contain unchanged system instructions and a
|
|
474
|
+
sorted, recursively canonicalised snapshot of **all input characteristic metadata**.
|
|
475
|
+
The third message contains the selected output characteristic in a
|
|
476
|
+
`<target-characteristic>` JSON block. All targets therefore share an identical,
|
|
477
|
+
cacheable prefix.
|
|
478
|
+
|
|
479
|
+
The mock is an implementation of `@cobol-ts/ai` and uses the last user message
|
|
480
|
+
to select `responses.<output-id>.graph` from `mock.ai.yaml`. A real provider will
|
|
481
|
+
use the same `chat.completions.create({model, messages})` port. Responses are
|
|
482
|
+
parsed with the existing `parseAuthoringGraph()` validator before they become
|
|
483
|
+
experiments. Every fragment must declare an output node whose name is its target
|
|
484
|
+
characteristic ID; `ai all` also rejects node-name collisions across fragments.
|
|
485
|
+
The example hypotheses are **illustrative, not verified equations**.
|
|
486
|
+
|
|
487
|
+
```powershell
|
|
488
|
+
# Inspect actual request, request+OpenAI-shaped reply, or just the raw graph reply
|
|
489
|
+
yarn cobolts -d modules/examples/example/definitions ai prompt C0010
|
|
490
|
+
yarn cobolts -d modules/examples/example/definitions ai exchange C0010
|
|
491
|
+
yarn cobolts -d modules/examples/example/definitions ai response C0010
|
|
492
|
+
|
|
493
|
+
# Generate a versioned experiment document (stdout unless --file is given)
|
|
494
|
+
yarn cobolts -d modules/examples/example/definitions ai do C0010
|
|
495
|
+
yarn cobolts -d modules/examples/example/definitions ai all --file experiments.yaml
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
The result is `version: 1` with an `experiments` array of
|
|
499
|
+
`{characteristic, metadata, findings, generation, graph, history: []}` records. No execution,
|
|
500
|
+
legacy-oracle comparison, history persistence or AI credentials are involved yet.
|
|
501
|
+
Use `graph build experiments.yaml [--with existing.yaml] [--file output.yaml] [--report] [--detailed]`
|
|
502
|
+
to assemble graph fragments into executable authoring YAML; see the
|
|
503
|
+
[complete walkthrough](#excel--ai-experiment--graph-walkthrough).
|
|
504
|
+
See [`@cobol-ts/ai-experiments`](../../ai/ai-experiments/README.md) for the
|
|
505
|
+
application boundary and [`@cobol-ts/ai`](../../ai/ai/README.md) for the provider port.
|
|
506
|
+
|
|
507
|
+
## Characteristic metadata HTTP API
|
|
508
|
+
|
|
509
|
+
Read-only metadata is available over localhost without introducing an MCP server:
|
|
510
|
+
|
|
511
|
+
```powershell
|
|
512
|
+
# Load .cobolts/characteristics.yaml once and serve a snapshot
|
|
513
|
+
cobolts -d modules/examples/example/definitions characteristics serve --port 3000
|
|
514
|
+
```
|
|
87
515
|
|
|
88
|
-
|
|
516
|
+
`GET http://127.0.0.1:3000/api/characteristics` returns `{ "characteristics": [...] }`.
|
|
517
|
+
`GET http://127.0.0.1:3000/api/characteristics/C0010` returns one characteristic, or a JSON 404 when absent.
|
|
89
518
|
|
|
90
|
-
|
|
519
|
+
The CLI `characteristics list` and `characteristics show` use the same internal `CharacteristicQueries` port. The server deliberately binds only to `127.0.0.1` and has no authentication; do not expose it to other machines. Restart it to load edited source YAML files.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Rolling windows: end-to-end verification
|
|
2
|
+
|
|
3
|
+
The `graph-1000-periodic` project is included in `benchmark init all` and
|
|
4
|
+
`benchmark list`. Regenerating it with
|
|
5
|
+
`benchmark init graph-1000-periodic -n 10000 --force` (or `init all --force`)
|
|
6
|
+
writes `.cobolts/accumulator.yaml` with `customerId.field: recordId` and
|
|
7
|
+
`customerId.type: number`. Applying a source patch alone does not rewrite an
|
|
8
|
+
existing generated project.
|
|
9
|
+
|
|
10
|
+
The `graph-1000-periodic` project contains exactly 1,000 nodes: 100 daily scalar
|
|
11
|
+
counters, 100 monthly six-observation rings, 100 CEL `sum()` consumers, 70
|
|
12
|
+
ordinary consumers of those sums, and 630 input-derived scalars. The fixture
|
|
13
|
+
starts each customer with six active monthly values (2–7), an expired value
|
|
14
|
+
(1), and a nonzero daily count (30 + customer ID modulo 5).
|
|
15
|
+
|
|
16
|
+
## Run the regression tests
|
|
17
|
+
|
|
18
|
+
From the repository root:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
yarn jest modules/cel/graph-runtime/src/cel.graph.periodic.integration.spec.ts --runInBand
|
|
22
|
+
yarn jest modules/cel/graph-runtime/src/cel.graph.periodicity.spec.ts --runInBand
|
|
23
|
+
yarn jest modules/cel/graph-runtime/src/cel.graph.scalar.periodicity.spec.ts --runInBand
|
|
24
|
+
yarn jest modules/cobolts/cobolts/src/benchmark.periodic.fixture.spec.ts --runInBand
|
|
25
|
+
yarn jest modules/cobolts/cobolts/src/benchmark.periodic.execution.spec.ts --runInBand
|
|
26
|
+
yarn jest modules/cursor-loader/cursor-loader-protobuf/src/protobuf.rolling.spec.ts --runInBand
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The integration checks compare every window, sum, reset and dependent addition;
|
|
30
|
+
compare indexed and object results; verify the expired observation and physical
|
|
31
|
+
ring layout; recover from a persisted indexed checkpoint; and ensure that a
|
|
32
|
+
failed indexed transition cannot be retried against partially mutated state.
|
|
33
|
+
The existing Protobuf tests cover native and number-backed round trips (not a
|
|
34
|
+
separate Protobuf graph interpreter).
|
|
35
|
+
|
|
36
|
+
## Run the production benchmark
|
|
37
|
+
|
|
38
|
+
The generated historical fixture is read afresh for each pass; neither the
|
|
39
|
+
benchmark nor `cel execute` writes an updated checkpoint into that fixture.
|
|
40
|
+
If the project already exists, do **not** reinitialise it unless you mean to
|
|
41
|
+
replace the generated data.
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --periodicity daily --accumulator-strategy indexed --gc
|
|
45
|
+
yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --periodicity monthly --accumulator-strategy indexed --gc
|
|
46
|
+
yarn cobolts benchmark run graph-1000-no-map -n 10000 --runs 5 --accumulator-strategy indexed --gc
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For the per-generation diagnostic, run each period **separately**, with
|
|
50
|
+
`--graph-timing --timing-sample-every 100`. These timings include instrumentation
|
|
51
|
+
overhead and should not be compared to uninstrumented throughput. Use
|
|
52
|
+
`--allocation-profile` on a separate pass to write a heap sampling profile;
|
|
53
|
+
profiled timings are not baseline timings.
|
|
54
|
+
|
|
55
|
+
Expected state for the first customer's initial six-month history:
|
|
56
|
+
|
|
57
|
+
| Run | Daily counter | Logical monthly history | Expired | Window sum |
|
|
58
|
+
| --- | ---: | --- | ---: | ---: |
|
|
59
|
+
| Before execution | 31 | 2, 3, 4, 5, 6, 7 | 1 | 27 |
|
|
60
|
+
| Daily | 32 | 2, 3, 4, 5, 6, 7 | 1 | 27 |
|
|
61
|
+
| Monthly (from original fixture) | 0 | 3, 4, 5, 6, 7, 31 | 2 | 56 |
|
|
62
|
+
| Next daily (after that monthly transition) | 1 | 3, 4, 5, 6, 7, 31 | 2 | 56 |
|
|
63
|
+
|
|
64
|
+
The monthly benchmark runs **from the original fixture**, not from the result
|
|
65
|
+
of the preceding daily benchmark; therefore the first monthly insertion is 31,
|
|
66
|
+
not 32. The chronological daily-then-monthly transition is tested separately
|
|
67
|
+
by the integration tests.
|
|
68
|
+
|
|
69
|
+
## Failure and lifecycle boundary
|
|
70
|
+
|
|
71
|
+
Indexed evaluation deliberately mutates the working record in place. If it
|
|
72
|
+
throws after advancing a ring, that record is not rolled back. The session is
|
|
73
|
+
invalidated and the caller must abort the job and reload from the **last
|
|
74
|
+
committed checkpoint**. The source historical indexed file remains unchanged;
|
|
75
|
+
there is no automatic checkpoint writer in these commands. Object execution
|
|
76
|
+
uses an independent result and copy-on-write for matching windows.
|
|
77
|
+
|
|
78
|
+
`variables.periodicity` is optional. It accepts `daily` and `monthly` at the
|
|
79
|
+
CLI boundary; other graph-level periodicity strings are not prohibited by the
|
|
80
|
+
value type. There is still no period identity or exactly-once calendar policy,
|
|
81
|
+
so callers must not run the same logical monthly transition twice. Specialised
|
|
82
|
+
incremental aggregators are also outside this work: window sums use the
|
|
83
|
+
existing CEL collection visitor.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const benchmark_runner_1 = require("./benchmark.runner");
|
|
4
|
+
describe('compiled benchmark projection access', () => {
|
|
5
|
+
it('uses one compiled path against successive projected records', () => {
|
|
6
|
+
const access = (0, benchmark_runner_1.compileProjectedFieldAccess)('statusCode');
|
|
7
|
+
expect(access({ statusCode: () => 'A' })).toEqual('A');
|
|
8
|
+
expect(access({ statusCode: () => 'B' })).toEqual('B');
|
|
9
|
+
expect((0, benchmark_runner_1.accessField)({ statusCode: () => 'C' }, 'statusCode')).toEqual('C');
|
|
10
|
+
});
|
|
11
|
+
it('traverses every member of a projected array without retaining a previous record', () => {
|
|
12
|
+
const calls = [];
|
|
13
|
+
const access = (0, benchmark_runner_1.compileProjectedFieldAccess)('items.amount');
|
|
14
|
+
const first = { items: [
|
|
15
|
+
{ amount: () => { calls.push(12); return 12; } },
|
|
16
|
+
{ amount: () => { calls.push(34); return 34; } }
|
|
17
|
+
] };
|
|
18
|
+
const second = { items: [
|
|
19
|
+
{ amount: () => { calls.push(56); return 56; } }
|
|
20
|
+
] };
|
|
21
|
+
expect(access(first)).toBe(first.items);
|
|
22
|
+
expect(access(second)).toBe(second.items);
|
|
23
|
+
expect(calls).toEqual([12, 34, 56]);
|
|
24
|
+
});
|
|
25
|
+
it('reports the original path when a compiled path is missing', () => {
|
|
26
|
+
const access = (0, benchmark_runner_1.compileProjectedFieldAccess)('items.amount');
|
|
27
|
+
expect(() => access({ items: [{ other: () => 1 }] })).toThrow('Projected field "items.amount" is unavailable');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=benchmark.access.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmark.access.spec.js","sourceRoot":"","sources":["../../src/benchmark.access.spec.ts"],"names":[],"mappings":";;AAAA,yDAA2E;AAE3E,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IAClD,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,8CAA2B,EAAC,YAAY,CAAC,CAAA;QACxD,MAAM,CAAC,MAAM,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACpD,MAAM,CAAC,MAAM,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACpD,MAAM,CAAC,IAAA,8BAAW,EAAC,EAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAC,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iFAAiF,EAAE,GAAG,EAAE;QACvF,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,MAAM,MAAM,GAAG,IAAA,8CAA2B,EAAC,cAAc,CAAC,CAAA;QAC1D,MAAM,KAAK,GAAG,EAAC,KAAK,EAAE;gBAClB,EAAC,MAAM,EAAE,GAAG,EAAE,GAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA,CAAA,CAAC,EAAC;gBAC3C,EAAC,MAAM,EAAE,GAAG,EAAE,GAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA,CAAA,CAAC,EAAC;aAC9C,EAAC,CAAA;QACF,MAAM,MAAM,GAAG,EAAC,KAAK,EAAE;gBACnB,EAAC,MAAM,EAAE,GAAG,EAAE,GAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA,CAAA,CAAC,EAAC;aAC9C,EAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACvC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACzC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACjE,MAAM,MAAM,GAAG,IAAA,8CAA2B,EAAC,cAAc,CAAC,CAAA;QAC1D,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CACrD,+CAA+C,CAClD,CAAA;IACL,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const AGGREGATE_BENCHMARK: "graph-1000-aggregates";
|
|
2
|
+
/** 100 daily windows + 100 native sums + 100 monthly windows + 200 native aggregates
|
|
3
|
+
* + 500 CEL consumers which combine three independent aggregate results = 1000 nodes.
|
|
4
|
+
* Daily and monthly runs activate different parts of the same compiled graph.
|
|
5
|
+
*/
|
|
6
|
+
export declare function aggregateGraphYaml(): string;
|
|
7
|
+
/** A committed non-empty baseline keeps benchmark results about incremental work,
|
|
8
|
+
* not first-use initialisation. The same file is reloaded for every measured pass.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateAggregateBenchmarkProject(base: string, records: number, force?: boolean): Promise<string>;
|