aontu 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aontu.d.ts +3 -2
- package/dist/aontu.js +36 -7
- package/dist/aontu.js.map +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +500 -8
- package/dist/cli.js.map +1 -1
- package/dist/ctx.d.ts +5 -0
- package/dist/ctx.js +1 -0
- package/dist/ctx.js.map +1 -1
- package/dist/diff.js.map +1 -1
- package/dist/err.js +7 -1
- package/dist/err.js.map +1 -1
- package/dist/graph.d.ts +2 -5
- package/dist/graph.js +83 -46
- package/dist/graph.js.map +1 -1
- package/dist/hcanon.js +9 -10
- package/dist/hcanon.js.map +1 -1
- package/dist/hints.js +94 -26
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.js +34 -0
- package/dist/jsonschema.js.map +1 -1
- package/dist/lang.js +593 -191
- package/dist/lang.js.map +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +86 -6
- package/dist/lsp.js.map +1 -1
- package/dist/mcp.js +153 -6
- package/dist/mcp.js.map +1 -1
- package/dist/mod-tool.js +42 -8
- package/dist/mod-tool.js.map +1 -1
- package/dist/mod.d.ts +4 -0
- package/dist/mod.js +97 -2
- package/dist/mod.js.map +1 -1
- package/dist/patch.d.ts +5 -0
- package/dist/patch.js +25 -25
- package/dist/patch.js.map +1 -1
- package/dist/provenance.d.ts +1 -0
- package/dist/provenance.js +2 -1
- package/dist/provenance.js.map +1 -1
- package/dist/query.js.map +1 -1
- package/dist/reach.d.ts +1 -0
- package/dist/reach.js +49 -21
- package/dist/reach.js.map +1 -1
- package/dist/relation.d.ts +4 -0
- package/dist/relation.js +125 -200
- package/dist/relation.js.map +1 -1
- package/dist/sig.d.ts +25 -0
- package/dist/sig.js +277 -0
- package/dist/sig.js.map +1 -0
- package/dist/sigdecl.d.ts +2 -0
- package/dist/sigdecl.js +11 -0
- package/dist/sigdecl.js.map +1 -0
- package/dist/siggate.d.ts +4 -0
- package/dist/siggate.js +90 -0
- package/dist/siggate.js.map +1 -0
- package/dist/std.js +75 -16
- package/dist/std.js.map +1 -1
- package/dist/subsume.js +57 -10
- package/dist/subsume.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/unify.d.ts +2 -2
- package/dist/unify.js +93 -114
- package/dist/unify.js.map +1 -1
- package/dist/utility.d.ts +1 -2
- package/dist/utility.js +7 -61
- package/dist/utility.js.map +1 -1
- package/dist/val/AggFuncVal.d.ts +12 -1
- package/dist/val/AggFuncVal.js +165 -3
- package/dist/val/AggFuncVal.js.map +1 -1
- package/dist/val/BagVal.d.ts +2 -0
- package/dist/val/BagVal.js +56 -8
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/ConstraintVal.js +33 -5
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/ContainerKindVal.d.ts +35 -0
- package/dist/val/ContainerKindVal.js +99 -0
- package/dist/val/ContainerKindVal.js.map +1 -0
- package/dist/val/CopyFuncVal.js +0 -7
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/DisjunctVal.d.ts +1 -2
- package/dist/val/DisjunctVal.js +146 -39
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/ExpectVal.js +37 -2
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FuncBaseVal.d.ts +1 -0
- package/dist/val/FuncBaseVal.js +19 -8
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/GraphAtomVal.d.ts +39 -0
- package/dist/val/GraphAtomVal.js +184 -0
- package/dist/val/GraphAtomVal.js.map +1 -0
- package/dist/val/JunctionVal.js +22 -5
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/ListVal.js +27 -34
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/MapVal.d.ts +1 -0
- package/dist/val/MapVal.js +82 -35
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/PathFuncVal.d.ts +2 -2
- package/dist/val/PathFuncVal.js +75 -16
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PathVal.d.ts +25 -0
- package/dist/val/PathVal.js +150 -0
- package/dist/val/PathVal.js.map +1 -0
- package/dist/val/PlusOpVal.d.ts +2 -1
- package/dist/val/PlusOpVal.js +50 -35
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefVal.d.ts +2 -0
- package/dist/val/PrefVal.js +159 -32
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RecurseVal.d.ts +19 -0
- package/dist/val/RecurseVal.js +217 -0
- package/dist/val/RecurseVal.js.map +1 -0
- package/dist/val/RefVal.d.ts +2 -1
- package/dist/val/RefVal.js +105 -72
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.d.ts +30 -7
- package/dist/val/ReferFuncVal.js +395 -94
- package/dist/val/ReferFuncVal.js.map +1 -1
- package/dist/val/ScalarKindVal.d.ts +4 -2
- package/dist/val/ScalarKindVal.js +12 -1
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/SuperFuncVal.d.ts +4 -2
- package/dist/val/SuperFuncVal.js +118 -14
- package/dist/val/SuperFuncVal.js.map +1 -1
- package/dist/val/TopVal.d.ts +1 -1
- package/dist/val/Val.d.ts +2 -3
- package/dist/val/Val.js +39 -20
- package/dist/val/Val.js.map +1 -1
- package/dist/val/arith.js +4 -1
- package/dist/val/arith.js.map +1 -1
- package/dist/vet.d.ts +1 -0
- package/dist/vet.js +32 -1
- package/dist/vet.js.map +1 -1
- package/dist/view.d.ts +90 -0
- package/dist/view.js +2168 -0
- package/dist/view.js.map +1 -0
- package/grammar/aontu.gbnf +18 -10
- package/grammar/aontu.lark +15 -10
- package/grammar/aontu.tmLanguage.json +184 -0
- package/package.json +10 -3
- package/skill/grammar-card.md +1 -2
- package/src/aontu.ts +37 -7
- package/src/cli.ts +553 -8
- package/src/ctx.ts +20 -0
- package/src/diff.ts +4 -2
- package/src/err.ts +8 -1
- package/src/graph.ts +125 -75
- package/src/hcanon.ts +9 -11
- package/src/hints.ts +112 -29
- package/src/jsonschema.ts +41 -0
- package/src/lang.ts +642 -203
- package/src/lsp.ts +75 -6
- package/src/mcp.ts +164 -6
- package/src/mod-tool.ts +48 -9
- package/src/mod.ts +110 -1
- package/src/patch.ts +31 -27
- package/src/provenance.ts +8 -1
- package/src/query.ts +4 -2
- package/src/reach.ts +52 -23
- package/src/relation.ts +139 -236
- package/src/sig.ts +345 -0
- package/src/sigdecl.ts +11 -0
- package/src/siggate.ts +144 -0
- package/src/std.ts +77 -16
- package/src/subsume.ts +59 -10
- package/src/unify.ts +102 -125
- package/src/utility.ts +7 -67
- package/src/val/AggFuncVal.ts +231 -4
- package/src/val/BagVal.ts +58 -9
- package/src/val/ConstraintVal.ts +34 -5
- package/src/val/ContainerKindVal.ts +158 -0
- package/src/val/CopyFuncVal.ts +0 -7
- package/src/val/DisjunctVal.ts +152 -40
- package/src/val/ExpectVal.ts +39 -4
- package/src/val/FuncBaseVal.ts +21 -8
- package/src/val/GraphAtomVal.ts +264 -0
- package/src/val/JunctionVal.ts +23 -6
- package/src/val/ListVal.ts +30 -37
- package/src/val/MapVal.ts +87 -39
- package/src/val/PathFuncVal.ts +107 -19
- package/src/val/PathVal.ts +221 -0
- package/src/val/PlusOpVal.ts +56 -37
- package/src/val/PrefVal.ts +186 -38
- package/src/val/RecurseVal.ts +285 -0
- package/src/val/RefVal.ts +105 -83
- package/src/val/ReferFuncVal.ts +445 -100
- package/src/val/ScalarKindVal.ts +12 -0
- package/src/val/SuperFuncVal.ts +137 -13
- package/src/val/TopVal.ts +1 -1
- package/src/val/Val.ts +44 -35
- package/src/val/arith.ts +4 -1
- package/src/vet.ts +41 -4
- package/src/view.ts +2882 -0
- package/dist/val/IdFuncVal.d.ts +0 -13
- package/dist/val/IdFuncVal.js +0 -54
- package/dist/val/IdFuncVal.js.map +0 -1
- package/src/val/IdFuncVal.ts +0 -91
package/dist/relation.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.relationFindings = relationFindings;
|
|
5
|
+
exports.relationErrors = relationErrors;
|
|
4
6
|
exports.relationCheck = relationCheck;
|
|
5
|
-
// RELATION GRAPH
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
7
|
+
// RELATION GRAPH VERDICTS (RELATIONS.0.md §3.3, replacing the G4
|
|
8
|
+
// phase 5 magic-key pass): acyclicity and inverse consistency over
|
|
9
|
+
// the edge set, DECLARED by the graph atoms -- `acyclic()` and
|
|
10
|
+
// `inverse(name)` conjoined at the field whose key is the predicate
|
|
11
|
+
// -- and decided AFTER unification, never by it.
|
|
9
12
|
//
|
|
10
13
|
// Why not in the lattice. Both properties are GLOBAL and NON-MONOTONE:
|
|
11
14
|
// an acyclic graph becomes cyclic when one more edge unifies in, and an
|
|
@@ -13,134 +16,23 @@ exports.relationCheck = relationCheck;
|
|
|
13
16
|
// The lattice guarantee is that more information never falsifies what
|
|
14
17
|
// has been observed, so a constraint that could be true and then false
|
|
15
18
|
// is not a constraint the lattice may hold. These are facts about the
|
|
16
|
-
// finished model,
|
|
17
|
-
//
|
|
19
|
+
// finished model, so the atoms only REGISTER during unification
|
|
20
|
+
// (GraphAtomVal.register, onto ctx._reldecls), and the verdict lands
|
|
21
|
+
// at GENERATION -- the sizing atoms' model -- where no more
|
|
22
|
+
// information can arrive. The `relations` verb reports the same
|
|
23
|
+
// verdict from the same declarations: one decision, two surfaces.
|
|
18
24
|
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// }
|
|
25
|
-
//
|
|
26
|
-
// Nothing in the engine knows the name `relations`; this pass does,
|
|
27
|
-
// and says so.
|
|
25
|
+
// The old declaration channel -- a `relations:` key at the document
|
|
26
|
+
// root, read by name -- is GONE, discharging ADR-010's grandfather
|
|
27
|
+
// clause: the engine no longer knows any spellable key. The target
|
|
28
|
+
// half of the old declaration is `rel(t)`'s flow at the site, which
|
|
29
|
+
// checks by unifying rather than by a report-layer probe.
|
|
28
30
|
const aontu_1 = require("./aontu");
|
|
29
31
|
const vet_1 = require("./vet");
|
|
30
32
|
const graph_1 = require("./graph");
|
|
31
33
|
const keyorder_1 = require("./keyorder");
|
|
32
|
-
const
|
|
33
|
-
// The
|
|
34
|
-
// edge into `svc/auth.ports.http` is an edge to `svc/auth`: a relation
|
|
35
|
-
// holds between ENTITIES, and the path inside one says which part of it
|
|
36
|
-
// the link reaches.
|
|
37
|
-
function entityOf(addr) {
|
|
38
|
-
const dot = addr.indexOf('.');
|
|
39
|
-
return dot < 0 ? addr : addr.slice(0, dot);
|
|
40
|
-
}
|
|
41
|
-
// The node an address names, or undefined. The entity's own position
|
|
42
|
-
// comes from the graph (a merged entity sits at every position that
|
|
43
|
-
// declared it, and they hold the same value, so the FIRST in the
|
|
44
|
-
// graph's sorted list is as good as any and is the same one in both
|
|
45
|
-
// ports); the rest of the address walks into it, exactly as the
|
|
46
|
-
// address's own grammar says.
|
|
47
|
-
// NO GUARD ON THE LOOKUP OR THE WALK. An edge exists only because
|
|
48
|
-
// `refer()` RESOLVED its full address, so `find` cannot miss and no
|
|
49
|
-
// segment can fall off: an address that does not walk is
|
|
50
|
-
// `refer_unresolved` at unification and the document never reaches the
|
|
51
|
-
// graph (probed for a missing key, a scalar mid-path and an
|
|
52
|
-
// out-of-range index, in both ports). An unreachable `if` is a branch
|
|
53
|
-
// arm the ADR-002 gate counts and no marker suppresses, so the Go twin
|
|
54
|
-
// keeps its guards — where a nil would PANIC rather than propagate,
|
|
55
|
-
// and where the marker mechanism can carry them — and this one relies
|
|
56
|
-
// on optional chaining instead.
|
|
57
|
-
function addressed(root, graph, addr) {
|
|
58
|
-
const dot = addr.indexOf('.');
|
|
59
|
-
const name = dot < 0 ? addr : addr.slice(0, dot);
|
|
60
|
-
const entry = graph.entities.find((e) => e.id === name);
|
|
61
|
-
const segs = entry.paths[0].slice(2).split('.')
|
|
62
|
-
.concat(dot < 0 ? [] : addr.slice(dot + 1).split('.'));
|
|
63
|
-
let node = root;
|
|
64
|
-
for (const seg of segs) {
|
|
65
|
-
node = node?.peg?.[seg];
|
|
66
|
-
}
|
|
67
|
-
return node;
|
|
68
|
-
}
|
|
69
|
-
// Does the far end satisfy the declared target? A TEST, never a flow:
|
|
70
|
-
// the check reports on a finished model and writing into it would be
|
|
71
|
-
// generation, which `relations` does not do (the same rule that keeps
|
|
72
|
-
// it from writing an author's inverse for them). So both sides are
|
|
73
|
-
// CLONED into a throwaway context and the meet is taken there; what
|
|
74
|
-
// the document holds is untouched either way.
|
|
75
|
-
//
|
|
76
|
-
// `refer(t)` is the other half of this and does flow, at the site. The
|
|
77
|
-
// two agree on what "satisfies" means -- a meet that is not a nil --
|
|
78
|
-
// which is what lets a relation declare once what every site would
|
|
79
|
-
// otherwise repeat.
|
|
80
|
-
// `root` is the DOCUMENT, not the node: a target lifted out of the
|
|
81
|
-
// model (`target: $.std.Service`) can still hold a reference that
|
|
82
|
-
// resolves against the document, and a probe rooted at the far end
|
|
83
|
-
// answers `no_path` for it -- which the worked example in
|
|
84
|
-
// test/spec/relation.tsv caught the moment this check existed.
|
|
85
|
-
function meets(aontu, root, node, target) {
|
|
86
|
-
const ctx = aontu.ctx({ collect: true });
|
|
87
|
-
ctx.root = root;
|
|
88
|
-
const out = (0, unify_1.unite)(ctx, node.clone(ctx), target.clone(ctx), 'relation-target');
|
|
89
|
-
if (true === out?.isNil) {
|
|
90
|
-
return out.why;
|
|
91
|
-
}
|
|
92
|
-
if (0 < ctx.err.length) {
|
|
93
|
-
return ctx.err[0].why;
|
|
94
|
-
}
|
|
95
|
-
// A MEET THAT LEAVES A HOLE IS NOT SATISFACTION. `target:
|
|
96
|
-
// {kind: service, port: integer}` against a far end with no `port`
|
|
97
|
-
// does not CONFLICT -- the meet simply carries `integer` into a key
|
|
98
|
-
// that had none -- and a check that stopped at "no conflict" would
|
|
99
|
-
// pass a far end that is missing half of what the relation demands.
|
|
100
|
-
//
|
|
101
|
-
// What `refer(t)` does at the site is the yardstick: it flows `t` in,
|
|
102
|
-
// and the document then fails to generate, because `integer` is not a
|
|
103
|
-
// value. So the same question is asked here -- can the far end still
|
|
104
|
-
// generate once the target is met? -- and the answer is compared with
|
|
105
|
-
// the far end ALONE, so a node that was already incomplete for its
|
|
106
|
-
// own reasons is not blamed on the relation that points at it.
|
|
107
|
-
// The REASON reported is the engine's own -- the code `refer(t)` at
|
|
108
|
-
// the site would have raised -- rather than a name invented here.
|
|
109
|
-
const probe = (v) => {
|
|
110
|
-
const gctx = aontu.ctx({ collect: true });
|
|
111
|
-
gctx.root = root;
|
|
112
|
-
v.gen(gctx);
|
|
113
|
-
return 0 === gctx.err.length ? undefined : gctx.err[0].why;
|
|
114
|
-
};
|
|
115
|
-
const alone = probe(node.clone(aontu.ctx({ collect: true })));
|
|
116
|
-
const met = probe(out);
|
|
117
|
-
return undefined === alone && undefined !== met ? met : undefined;
|
|
118
|
-
}
|
|
119
|
-
function declaredRelations(root) {
|
|
120
|
-
const rels = root?.peg?.relations;
|
|
121
|
-
if (true !== rels?.isMap) {
|
|
122
|
-
return [];
|
|
123
|
-
}
|
|
124
|
-
const out = [];
|
|
125
|
-
for (const name of Object.keys(rels.peg).sort(keyorder_1.cmpCodePoint)) {
|
|
126
|
-
const r = rels.peg[name];
|
|
127
|
-
if (true !== r?.isMap) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
const inv = r.peg.inverse;
|
|
131
|
-
const acy = r.peg.acyclic;
|
|
132
|
-
const tgt = r.peg.target;
|
|
133
|
-
out.push({
|
|
134
|
-
name,
|
|
135
|
-
inverse: true === inv?.isScalar && 'string' === typeof inv.peg
|
|
136
|
-
? inv.peg : undefined,
|
|
137
|
-
acyclic: true === acy?.isScalar && true === acy.peg,
|
|
138
|
-
target: true === tgt?.isVal && true !== tgt.isTop ? tgt : undefined,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return out;
|
|
142
|
-
}
|
|
143
|
-
// The first cycle reachable from `start`, as the entities it runs
|
|
34
|
+
const err_1 = require("./err");
|
|
35
|
+
// The first cycle reachable from `start`, as the node paths it runs
|
|
144
36
|
// through, or undefined. Depth-first with the path as the stack, and
|
|
145
37
|
// the successors visited in sorted order, so the cycle a report names
|
|
146
38
|
// is the same one in both ports.
|
|
@@ -169,38 +61,16 @@ function findCycle(start, succ, done) {
|
|
|
169
61
|
};
|
|
170
62
|
return walk(start);
|
|
171
63
|
}
|
|
172
|
-
// The
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const parseOpts = null == options.path ? undefined : { path: options.path };
|
|
178
|
-
const root = aontu.unify(src, parseOpts, ctx);
|
|
179
|
-
// A document that does not stand up is not a document with a bad
|
|
180
|
-
// graph: the errors it already has are the answer, and blaming its
|
|
181
|
-
// relations on top would be noise.
|
|
182
|
-
if (0 < ctx.err.length || true === root?.isNil) {
|
|
183
|
-
return {
|
|
184
|
-
verdict: 'error',
|
|
185
|
-
findings: [],
|
|
186
|
-
errors: [(0, vet_1.failureFinding)(ctx, options.path, root)],
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
const declared = declaredRelations(root);
|
|
190
|
-
if (0 === declared.length) {
|
|
191
|
-
return { verdict: 'pass', findings: [] };
|
|
192
|
-
}
|
|
193
|
-
const graph = (0, graph_1.graphOf)(root);
|
|
194
|
-
const edges = graph.edges;
|
|
64
|
+
// The verdict itself, pure over what the evaluation produced: the
|
|
65
|
+
// registered declarations and the edge set. Shared by the generation
|
|
66
|
+
// hook (relationErrors) and the `relations` verb, so the two surfaces
|
|
67
|
+
// cannot disagree.
|
|
68
|
+
function relationFindings(decls, graph) {
|
|
195
69
|
const findings = [];
|
|
196
70
|
// The edge set, indexed the two ways the checks read it.
|
|
197
71
|
const byRelation = new Map();
|
|
198
72
|
const pairs = new Set();
|
|
199
|
-
for (const e of edges) {
|
|
200
|
-
if ('' === e.from) {
|
|
201
|
-
// An edge outside every entity has no source to be a relation OF.
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
73
|
+
for (const e of graph.edges) {
|
|
204
74
|
const list = byRelation.get(e.key);
|
|
205
75
|
if (undefined === list) {
|
|
206
76
|
byRelation.set(e.key, [e]);
|
|
@@ -208,15 +78,20 @@ function relationCheck(src, opts) {
|
|
|
208
78
|
else {
|
|
209
79
|
list.push(e);
|
|
210
80
|
}
|
|
211
|
-
pairs.add(e.key + ' ' + e.from + ' ' +
|
|
81
|
+
pairs.add(e.key + ' ' + e.from + ' ' + e.to);
|
|
212
82
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
83
|
+
// Predicates in sorted order, so the findings arrive the same way
|
|
84
|
+
// in both ports (the registry is insertion-ordered here, random in
|
|
85
|
+
// Go).
|
|
86
|
+
const names = [...decls.keys()].sort(keyorder_1.cmpCodePoint);
|
|
87
|
+
for (const name of names) {
|
|
88
|
+
const decl = decls.get(name);
|
|
89
|
+
const mine = byRelation.get(name) ?? [];
|
|
90
|
+
if (true === decl.acyclic) {
|
|
216
91
|
const succ = new Map();
|
|
217
92
|
for (const e of mine) {
|
|
218
93
|
const list = succ.get(e.from);
|
|
219
|
-
const to =
|
|
94
|
+
const to = e.to;
|
|
220
95
|
if (undefined === list) {
|
|
221
96
|
succ.set(e.from, [to]);
|
|
222
97
|
}
|
|
@@ -240,7 +115,7 @@ function relationCheck(src, opts) {
|
|
|
240
115
|
const at = mine.find((e) => e.from === cycle[0]);
|
|
241
116
|
findings.push({
|
|
242
117
|
code: 'relation_cycle',
|
|
243
|
-
relation:
|
|
118
|
+
relation: name,
|
|
244
119
|
at: at.at,
|
|
245
120
|
detail: cycle,
|
|
246
121
|
});
|
|
@@ -248,55 +123,105 @@ function relationCheck(src, opts) {
|
|
|
248
123
|
}
|
|
249
124
|
}
|
|
250
125
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// by nothing, on the reasoning that `refer(t)` already flows the
|
|
254
|
-
// type in at the site. It does, and that is exactly why the
|
|
255
|
-
// declaration was worth nothing: the site has to REPEAT it, and the
|
|
256
|
-
// idiom that avoids repeating it (`refer($.std.Service)`) tripped
|
|
257
|
-
// the fixpoint until §19 was fixed, so every real model wrote bare
|
|
258
|
-
// `refer()` and a typed-endpoint declaration checked nothing.
|
|
259
|
-
//
|
|
260
|
-
// Reported per EDGE, not per entity: an entity reached by two
|
|
261
|
-
// relations must satisfy both, and the report points at the link
|
|
262
|
-
// that made the demand.
|
|
263
|
-
if (undefined !== rel.target) {
|
|
264
|
-
for (const e of mine) {
|
|
265
|
-
// No guard on the node either, and for the same reason
|
|
266
|
-
// `addressed` needs none: an unresolved link is a nil in the
|
|
267
|
-
// tree, so this document would not have reached the graph.
|
|
268
|
-
const why = meets(aontu, root, addressed(root, graph, e.to), rel.target);
|
|
269
|
-
if (undefined !== why) {
|
|
270
|
-
findings.push({
|
|
271
|
-
code: 'relation_target_unmet',
|
|
272
|
-
relation: rel.name,
|
|
273
|
-
at: e.at,
|
|
274
|
-
detail: [e.from, e.to, why],
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (undefined !== rel.inverse) {
|
|
126
|
+
const inverses = [...decl.inverses].sort(keyorder_1.cmpCodePoint);
|
|
127
|
+
for (const inv of inverses) {
|
|
280
128
|
for (const e of mine) {
|
|
281
|
-
const to =
|
|
282
|
-
if (!pairs.has(
|
|
129
|
+
const to = e.to;
|
|
130
|
+
if (!pairs.has(inv + ' ' + to + ' ' + e.from)) {
|
|
283
131
|
findings.push({
|
|
284
132
|
code: 'relation_inverse_missing',
|
|
285
|
-
relation:
|
|
133
|
+
relation: name,
|
|
286
134
|
at: e.at,
|
|
287
|
-
detail: [e.from, to,
|
|
135
|
+
detail: [e.from, to, inv],
|
|
288
136
|
});
|
|
289
137
|
}
|
|
290
138
|
}
|
|
291
139
|
}
|
|
292
140
|
}
|
|
293
141
|
// SORTED, because a report is read by a machine that diffs it: by the
|
|
294
|
-
// position the offending edge is written at, then by code
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
142
|
+
// position the offending edge is written at, then by code, then by
|
|
143
|
+
// the detail (two inverse declarations on one predicate can flag one
|
|
144
|
+
// edge twice). The sort is STABLE and the predicates were iterated
|
|
145
|
+
// in sorted order, so what order remains is fixed anyway.
|
|
146
|
+
findings.sort((a, b) => (0, keyorder_1.cmpCodePoint)(a.at, b.at) || (0, keyorder_1.cmpCodePoint)(a.code, b.code)
|
|
147
|
+
|| (0, keyorder_1.cmpCodePoint)(a.detail.join(' '), b.detail.join(' ')));
|
|
148
|
+
return findings;
|
|
149
|
+
}
|
|
150
|
+
// The generation hook (Aontu.generate, between unification success
|
|
151
|
+
// and value generation): each finding becomes a LOCATED evaluation
|
|
152
|
+
// error at the offending edge, exactly as an unmet sizing atom
|
|
153
|
+
// refuses at generation. Findings name node paths and positions the
|
|
154
|
+
// document spelled, so the walk to the site cannot miss.
|
|
155
|
+
function relationErrors(ctx, root) {
|
|
156
|
+
const decls = ctx._reldecls;
|
|
157
|
+
if (0 === decls.size) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const findings = relationFindings(decls, (0, graph_1.graphOf)(root));
|
|
161
|
+
for (const f of findings) {
|
|
162
|
+
let node = root;
|
|
163
|
+
for (const seg of f.at.slice(2).split('.')) {
|
|
164
|
+
// Graph atoms hold the field's value -- possibly nested, one
|
|
165
|
+
// atom carrying another -- and the path steps through them
|
|
166
|
+
// exactly as the graph walk does.
|
|
167
|
+
while (true === node?.isGraphAtom) {
|
|
168
|
+
node = node.held;
|
|
169
|
+
}
|
|
170
|
+
node = node?.peg?.[seg];
|
|
171
|
+
}
|
|
172
|
+
// No unwrap AFTER the walk: a finding's `at` names an edge
|
|
173
|
+
// element, and an edge's element is a string -- an atom-wrapped
|
|
174
|
+
// element mints no edge in the first place (the graph visit
|
|
175
|
+
// descends atoms only at field values), so the walk cannot end on
|
|
176
|
+
// an atom.
|
|
177
|
+
ctx.adderr((0, err_1.makeNilErr)(ctx, f.code, node, undefined, 'relate', {
|
|
178
|
+
relation: f.relation,
|
|
179
|
+
detail: f.detail.join(' -> '),
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// The relation checks for one document: evaluate, then report the
|
|
184
|
+
// same verdict generation enforces.
|
|
185
|
+
function relationCheck(src, opts) {
|
|
186
|
+
const options = opts ?? {};
|
|
187
|
+
const aontu = new aontu_1.Aontu(null == options.trust ? undefined : { trust: options.trust });
|
|
188
|
+
const ctx = aontu.ctx({ collect: true });
|
|
189
|
+
const parseOpts = null == options.path ? undefined : { path: options.path };
|
|
190
|
+
const root = aontu.unify(src, parseOpts, ctx);
|
|
191
|
+
// A document that does not stand up is not a document with a bad
|
|
192
|
+
// graph: the errors it already has are the answer, and blaming its
|
|
193
|
+
// relations on top would be noise.
|
|
194
|
+
if (0 < ctx.err.length || true === root?.isNil) {
|
|
195
|
+
return {
|
|
196
|
+
verdict: 'error',
|
|
197
|
+
findings: [],
|
|
198
|
+
errors: [(0, vet_1.failureFinding)(ctx, options.path, root)],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const decls = ctx._reldecls;
|
|
202
|
+
if (0 === decls.size) {
|
|
203
|
+
return { verdict: 'pass', findings: [] };
|
|
204
|
+
}
|
|
205
|
+
// NOR IS A DOCUMENT THAT CANNOT BE GENERATED. Unification can
|
|
206
|
+
// succeed over a tree that still holds an unsettled disjunction --
|
|
207
|
+
// more than one alternative admitted, which `disjunct_no_gen`
|
|
208
|
+
// refuses at generation -- and the graph walk cannot read inside
|
|
209
|
+
// one: the links in every alternative are invisible, so a mirror
|
|
210
|
+
// the document plainly writes is missing from the edge set and
|
|
211
|
+
// `inverse(n)` calls it missing. Generation is therefore asked
|
|
212
|
+
// FIRST, on a collecting context of its own, and what it says is
|
|
213
|
+
// the answer. Generation is what the atoms' verdict lands at, so
|
|
214
|
+
// this is the same order the engine itself now runs in.
|
|
215
|
+
const gctx = ctx.clone({ err: [], collect: true });
|
|
216
|
+
root.gen(gctx);
|
|
217
|
+
if (0 < gctx.err.length) {
|
|
218
|
+
return {
|
|
219
|
+
verdict: 'error',
|
|
220
|
+
findings: [],
|
|
221
|
+
errors: [(0, vet_1.failureFinding)(gctx, options.path, root)],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const findings = relationFindings(decls, (0, graph_1.graphOf)(root));
|
|
300
225
|
return {
|
|
301
226
|
verdict: 0 === findings.length ? 'pass' : 'fail',
|
|
302
227
|
findings,
|
package/dist/relation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":";AAAA,oDAAoD
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;AAEpD,iEAAiE;AACjE,mEAAmE;AACnE,+DAA+D;AAC/D,oEAAoE;AACpE,iDAAiD;AACjD,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,sEAAsE;AACtE,gEAAgE;AAChE,qEAAqE;AACrE,4DAA4D;AAC5D,gEAAgE;AAChE,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,mEAAmE;AACnE,mEAAmE;AACnE,oEAAoE;AACpE,0DAA0D;AAE1D,mCAA+B;AAC/B,+BAAsC;AAGtC,mCAAiC;AAEjC,yCAAyC;AACzC,+BAAkC;AA0ClC,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,iCAAiC;AACjC,SAAS,SAAS,CAChB,KAAa,EACb,IAA2B,EAC3B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,eAAO,EAAC,IAAI,CAAC,CAAC,CAAA;IACvD,OAAO;QACL,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QAChD,QAAQ;KACT,CAAA;AACH,CAAC"}
|
package/dist/sig.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type ArgMode = 'value' | 'capture' | 'template' | 'trial' | 'projector' | 'text';
|
|
2
|
+
type GroupSig = {
|
|
3
|
+
mode: ArgMode;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
type ArgSig = {
|
|
7
|
+
name: string;
|
|
8
|
+
mode: ArgMode;
|
|
9
|
+
type: string;
|
|
10
|
+
opt?: boolean;
|
|
11
|
+
rest?: boolean;
|
|
12
|
+
group?: GroupSig[];
|
|
13
|
+
};
|
|
14
|
+
type FuncSig = {
|
|
15
|
+
name: string;
|
|
16
|
+
args: ArgSig[];
|
|
17
|
+
out: string;
|
|
18
|
+
};
|
|
19
|
+
declare function parseSigLine(line: string): FuncSig;
|
|
20
|
+
declare function renderSigArg(a: ArgSig): string;
|
|
21
|
+
declare function renderSig(sig: FuncSig): string;
|
|
22
|
+
declare function parseSigText(text: string): Record<string, FuncSig>;
|
|
23
|
+
export type { ArgMode, ArgSig, GroupSig, FuncSig, };
|
|
24
|
+
declare const funcSig: Record<string, FuncSig>;
|
|
25
|
+
export { funcSig, parseSigLine, parseSigText, renderSig, renderSigArg, };
|