@unerr-ai/unerr 0.1.6 → 0.1.7
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.md +70 -194
- package/dist/cli.js +39149 -36991
- package/package.json +9 -2
- package/dist/__tests__/architecture-guard.test.js +0 -122
- package/dist/__tests__/arg-validator.test.js +0 -205
- package/dist/__tests__/ast-extractor.test.js +0 -203
- package/dist/__tests__/auto-bootstrap.test.js +0 -280
- package/dist/__tests__/background-indexer.test.js +0 -228
- package/dist/__tests__/blast-radius-engine.test.js +0 -200
- package/dist/__tests__/bridge-isolation.test.js +0 -37
- package/dist/__tests__/budget-enforcer.test.js +0 -53
- package/dist/__tests__/cfg-test-detection-perf.test.js +0 -82
- package/dist/__tests__/change-narrative.test.js +0 -190
- package/dist/__tests__/check-commit.test.js +0 -258
- package/dist/__tests__/checksum.test.js +0 -34
- package/dist/__tests__/commit-watcher.test.js +0 -154
- package/dist/__tests__/community-detection.test.js +0 -179
- package/dist/__tests__/community-tools.test.js +0 -299
- package/dist/__tests__/components.test.js +0 -449
- package/dist/__tests__/compression-log.test.js +0 -174
- package/dist/__tests__/compression-quality-monitor.test.js +0 -40
- package/dist/__tests__/config-healer.test.js +0 -165
- package/dist/__tests__/context-ledger.test.js +0 -58
- package/dist/__tests__/convention-detector.test.js +0 -99
- package/dist/__tests__/convention-learner.test.js +0 -86
- package/dist/__tests__/correction-detector.test.js +0 -330
- package/dist/__tests__/daemon-autostart-install.test.js +0 -283
- package/dist/__tests__/daemon-bridge.test.js +0 -222
- package/dist/__tests__/daemon-dashboard.test.js +0 -202
- package/dist/__tests__/daemon-registry.test.js +0 -240
- package/dist/__tests__/daemon-supervisor.test.js +0 -318
- package/dist/__tests__/daemon-version-check.test.js +0 -275
- package/dist/__tests__/decision-point-detector.test.js +0 -98
- package/dist/__tests__/deep-link.test.js +0 -143
- package/dist/__tests__/disallowed-tools.test.js +0 -115
- package/dist/__tests__/drift-tracker.test.js +0 -582
- package/dist/__tests__/durability-scorer.test.js +0 -152
- package/dist/__tests__/efficiency-tracker.test.js +0 -65
- package/dist/__tests__/enrich.test.js +0 -144
- package/dist/__tests__/entity-rewind.test.js +0 -248
- package/dist/__tests__/ephemeral.test.js +0 -111
- package/dist/__tests__/exploration-cost.test.js +0 -93
- package/dist/__tests__/fact-generator.test.js +0 -197
- package/dist/__tests__/file-l0-graph.test.js +0 -244
- package/dist/__tests__/file-logger.test.js +0 -82
- package/dist/__tests__/file-outline.test.js +0 -141
- package/dist/__tests__/file-read-protocol.test.js +0 -188
- package/dist/__tests__/format-encoder.test.js +0 -233
- package/dist/__tests__/git-attribution.test.js +0 -259
- package/dist/__tests__/graph-temporal-joiner.test.js +0 -219
- package/dist/__tests__/health-grade-enhanced.test.js +0 -138
- package/dist/__tests__/health-map-data.test.js +0 -173
- package/dist/__tests__/helpers/mcp-harness.js +0 -45
- package/dist/__tests__/helpers/mcp-harness.test.js +0 -68
- package/dist/__tests__/hook-dedup.test.js +0 -112
- package/dist/__tests__/hook-runner.test.js +0 -253
- package/dist/__tests__/indexer-cfg.test.js +0 -185
- package/dist/__tests__/indexer-cross-file.test.js +0 -172
- package/dist/__tests__/indexer-extraction.test.js +0 -245
- package/dist/__tests__/indexer-incremental.test.js +0 -232
- package/dist/__tests__/indexer-language-expansion.test.js +0 -165
- package/dist/__tests__/init-push.test.js +0 -131
- package/dist/__tests__/instruction-writer.test.js +0 -179
- package/dist/__tests__/intelligence-integration.test.js +0 -217
- package/dist/__tests__/intent-correlator.test.js +0 -175
- package/dist/__tests__/intent-detector.test.js +0 -235
- package/dist/__tests__/intent-encoder.test.js +0 -167
- package/dist/__tests__/java-build-tool-detection.test.js +0 -174
- package/dist/__tests__/layer3-sprint-q.test.js +0 -160
- package/dist/__tests__/layer3-sprint-r.test.js +0 -91
- package/dist/__tests__/layer3-sprint-s.test.js +0 -183
- package/dist/__tests__/layer3-sprint-t.test.js +0 -201
- package/dist/__tests__/layer3-sprint-u.test.js +0 -174
- package/dist/__tests__/layer4-sprint-ba2.test.js +0 -354
- package/dist/__tests__/layer4-sprint-ba4.test.js +0 -84
- package/dist/__tests__/layer4-sprint-vs.test.js +0 -105
- package/dist/__tests__/ledger-chains.test.js +0 -162
- package/dist/__tests__/lifecycle-machine.test.js +0 -226
- package/dist/__tests__/local-chat-provider.test.js +0 -170
- package/dist/__tests__/local-convention-detector.test.js +0 -308
- package/dist/__tests__/local-embeddings.test.js +0 -422
- package/dist/__tests__/local-graph.test.js +0 -540
- package/dist/__tests__/local-indexer.test.js +0 -228
- package/dist/__tests__/local-intelligence-l3.test.js +0 -332
- package/dist/__tests__/local-llm.test.js +0 -253
- package/dist/__tests__/local-mode-offline.test.js +0 -187
- package/dist/__tests__/local-mode-stats.test.js +0 -273
- package/dist/__tests__/local-mode-tui.test.js +0 -343
- package/dist/__tests__/local-parse.test.js +0 -199
- package/dist/__tests__/log-tailer.test.js +0 -208
- package/dist/__tests__/loop-breaker.test.js +0 -276
- package/dist/__tests__/loop-miner.test.js +0 -226
- package/dist/__tests__/mcp-config.test.js +0 -126
- package/dist/__tests__/mcp-content-json.test.js +0 -10
- package/dist/__tests__/mcp-envelope.test.js +0 -124
- package/dist/__tests__/metrics-store.test.js +0 -223
- package/dist/__tests__/native-watcher.test.js +0 -191
- package/dist/__tests__/navigation-hooks-agent-aware.test.js +0 -145
- package/dist/__tests__/negative-knowledge.test.js +0 -116
- package/dist/__tests__/network-boundary.test.js +0 -190
- package/dist/__tests__/network-firewall.test.js +0 -112
- package/dist/__tests__/nudge-invariants.test.js +0 -160
- package/dist/__tests__/nudge-v2.test.js +0 -225
- package/dist/__tests__/offline-rewind.test.js +0 -251
- package/dist/__tests__/open-threads.test.js +0 -89
- package/dist/__tests__/output-compressor.test.js +0 -93
- package/dist/__tests__/pending-violations.test.js +0 -112
- package/dist/__tests__/persistence-effectiveness.test.js +0 -143
- package/dist/__tests__/provider-factory.test.js +0 -42
- package/dist/__tests__/providers.test.js +0 -24
- package/dist/__tests__/proxy.test.js +0 -314
- package/dist/__tests__/query-router.test.js +0 -1018
- package/dist/__tests__/reasoning-quality-route.test.js +0 -138
- package/dist/__tests__/redactor.test.js +0 -120
- package/dist/__tests__/resource-monitor.test.js +0 -57
- package/dist/__tests__/response-envelope.test.js +0 -100
- package/dist/__tests__/risk-classifier.test.js +0 -101
- package/dist/__tests__/risk-signal-scope.test.js +0 -75
- package/dist/__tests__/rule-evaluator.test.js +0 -280
- package/dist/__tests__/scip-decoder.test.js +0 -49
- package/dist/__tests__/scip-downloader.test.js +0 -201
- package/dist/__tests__/scip-merger.test.js +0 -103
- package/dist/__tests__/search-index.test.js +0 -422
- package/dist/__tests__/semantic-enrichment.test.js +0 -360
- package/dist/__tests__/session-brief-builder.test.js +0 -187
- package/dist/__tests__/session-context.test.js +0 -221
- package/dist/__tests__/session-continuity.test.js +0 -144
- package/dist/__tests__/session-dedup.test.js +0 -74
- package/dist/__tests__/session-event-wiring.test.js +0 -206
- package/dist/__tests__/session-events.test.js +0 -149
- package/dist/__tests__/session-legend.test.js +0 -20
- package/dist/__tests__/session-persistence.test.js +0 -131
- package/dist/__tests__/session-resume-block.test.js +0 -107
- package/dist/__tests__/session-resume.test.js +0 -97
- package/dist/__tests__/session-summary-writer.test.js +0 -134
- package/dist/__tests__/shadow-ledger.test.js +0 -203
- package/dist/__tests__/shell-classifier.test.js +0 -151
- package/dist/__tests__/shell-compression-floor.test.js +0 -189
- package/dist/__tests__/shell-compression-v2.test.js +0 -339
- package/dist/__tests__/shell-compressor.test.js +0 -35
- package/dist/__tests__/shell-hooks.test.js +0 -128
- package/dist/__tests__/shell-strategies.test.js +0 -644
- package/dist/__tests__/shell-tee.test.js +0 -133
- package/dist/__tests__/signal-dedup.test.js +0 -158
- package/dist/__tests__/signal-reinforcer.test.js +0 -77
- package/dist/__tests__/signal-scorer.test.js +0 -251
- package/dist/__tests__/signal-show-store.test.js +0 -108
- package/dist/__tests__/smart-truncate.test.js +0 -215
- package/dist/__tests__/snapshot-v2.test.js +0 -113
- package/dist/__tests__/sprint-l1-local-mode.test.js +0 -130
- package/dist/__tests__/sprint-l10-boot.test.js +0 -220
- package/dist/__tests__/sprint-l9-offline-commands.test.js +0 -189
- package/dist/__tests__/sprint-q-persistent-context.test.js +0 -198
- package/dist/__tests__/sprint-s1-wiring.test.js +0 -215
- package/dist/__tests__/sprint-s2-wiring.test.js +0 -256
- package/dist/__tests__/sprint-s3-wiring.test.js +0 -195
- package/dist/__tests__/sprint-s4-wiring.test.js +0 -213
- package/dist/__tests__/sprint-s6-hooks.test.js +0 -222
- package/dist/__tests__/sprint-s7-persistent.test.js +0 -263
- package/dist/__tests__/sprint-s8-value.test.js +0 -167
- package/dist/__tests__/sprint-s9-behavioral.test.js +0 -179
- package/dist/__tests__/sprint3-intelligence.test.js +0 -297
- package/dist/__tests__/sprint5-mcp-server.test.js +0 -136
- package/dist/__tests__/startup-display.test.js +0 -302
- package/dist/__tests__/startup-log-file.test.js +0 -97
- package/dist/__tests__/stash-manager.test.js +0 -229
- package/dist/__tests__/state-detector.test.js +0 -92
- package/dist/__tests__/status-dashboard.test.js +0 -142
- package/dist/__tests__/temporal-facts.test.js +0 -292
- package/dist/__tests__/temporal-routes.test.js +0 -142
- package/dist/__tests__/test-detector.test.js +0 -174
- package/dist/__tests__/theme.test.js +0 -72
- package/dist/__tests__/timeline-agents.test.js +0 -122
- package/dist/__tests__/timeline-bootstrap.test.js +0 -176
- package/dist/__tests__/timeline-filters.test.js +0 -193
- package/dist/__tests__/timeline-markers.test.js +0 -151
- package/dist/__tests__/timeline-routes.test.js +0 -156
- package/dist/__tests__/timeline-store.test.js +0 -171
- package/dist/__tests__/token-counter.test.js +0 -86
- package/dist/__tests__/token-estimator.test.js +0 -96
- package/dist/__tests__/token-flow-api.test.js +0 -239
- package/dist/__tests__/token-flow-instrumentation.test.js +0 -437
- package/dist/__tests__/token-flow-persistence.test.js +0 -356
- package/dist/__tests__/token-flow-routes.test.js +0 -199
- package/dist/__tests__/token-flow.test.js +0 -695
- package/dist/__tests__/tool-clusters.test.js +0 -177
- package/dist/__tests__/transport-mux.test.js +0 -283
- package/dist/__tests__/turn-segmenter.test.js +0 -166
- package/dist/__tests__/uninstall.test.js +0 -141
- package/dist/__tests__/warm-start-policy.test.js +0 -271
- package/dist/__tests__/wire-cap-nudge.test.js +0 -77
- package/dist/__tests__/worker-pool.test.js +0 -101
- package/dist/ui/assets/index-7gl3mIuY.css +0 -1
- package/dist/ui/assets/index-CX4FCWGT.js +0 -10
- package/dist/ui/assets/rolldown-runtime-S-ySWqyJ.js +0 -1
- package/dist/ui/assets/vis-network-NIJHUFI3.js +0 -908
- package/dist/ui/fonts/jetbrains-mono-latin-400-normal.woff +0 -0
- package/dist/ui/icon-wordmark.png +0 -0
- package/dist/ui/icon-wordmark.svg +0 -30
- package/dist/ui/icon.png +0 -0
- package/dist/ui/icon.svg +0 -25
- package/dist/ui/index.html +0 -15
- package/dist/ui/prototype-sandbox/index.html +0 -257
- package/dist/ui/screenshots/activity.png +0 -0
- package/dist/ui/screenshots/code-base-intelligence.png +0 -0
- package/dist/ui/screenshots/dashboard.png +0 -0
- package/dist/ui/screenshots/project-memory.png +0 -0
- package/dist/ui/screenshots/reasoning-quality.png +0 -0
- package/dist/ui/screenshots/reasoning-session.png +0 -0
- package/dist/ui/screenshots/token-session.png +0 -0
- package/dist/ui/screenshots/token-trace-main.png +0 -0
- package/dist/ui/screenshots/token-turn.png +0 -0
- package/dist/ui/unerr-wordmark.png +0 -0
- package/dist/ui/unerr-wordmark.svg +0 -9
- package/dist/ui/unerr.png +0 -0
- package/dist/ui/unerr.svg +0 -25
- package/dist/ui/web-app-manifest-192x192.png +0 -0
- package/dist/ui/web-app-manifest-512x512.png +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifies the /reasoning-quality routes surface persistent-memory metrics
|
|
3
|
-
* derived from token-flow events with mechanism: "persistent_memory".
|
|
4
|
-
*/
|
|
5
|
-
import { mkdirSync, rmSync } from "node:fs";
|
|
6
|
-
import os from "node:os";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
9
|
-
import { createReasoningQualityRoutes } from "../server/routes/reasoning-quality.js";
|
|
10
|
-
import { PersistenceEffectivenessTracker } from "../tracking/persistence-effectiveness.js";
|
|
11
|
-
import { TokenFlowWriter } from "../tracking/token-flow.js";
|
|
12
|
-
async function getGlobal(app) {
|
|
13
|
-
const res = await app.fetch(new Request("http://localhost/global"));
|
|
14
|
-
const body = (await res.json());
|
|
15
|
-
return body.data;
|
|
16
|
-
}
|
|
17
|
-
describe("reasoning-quality route — persistent memory metrics", () => {
|
|
18
|
-
let tmpDir;
|
|
19
|
-
let unerrDir;
|
|
20
|
-
let writer;
|
|
21
|
-
let tracker;
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
tmpDir = join(os.tmpdir(), `unerr-rq-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
|
|
24
|
-
unerrDir = join(tmpDir, ".unerr");
|
|
25
|
-
mkdirSync(unerrDir, { recursive: true });
|
|
26
|
-
writer = new TokenFlowWriter(unerrDir, "rq-session");
|
|
27
|
-
tracker = new PersistenceEffectivenessTracker(writer, { windowTurns: 3 });
|
|
28
|
-
});
|
|
29
|
-
afterEach(() => {
|
|
30
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
31
|
-
});
|
|
32
|
-
it("returns zero memory metrics when no persistent_memory events exist", async () => {
|
|
33
|
-
writer.record({
|
|
34
|
-
session_id: "rq-session",
|
|
35
|
-
turn: 1,
|
|
36
|
-
mechanism: "graph_query",
|
|
37
|
-
tool: "search_code",
|
|
38
|
-
tokens_without: 1000,
|
|
39
|
-
tokens_with: 200,
|
|
40
|
-
tokens_saved: 800,
|
|
41
|
-
});
|
|
42
|
-
const app = createReasoningQualityRoutes({
|
|
43
|
-
unerrDir,
|
|
44
|
-
getTokenFlowWriter: () => writer,
|
|
45
|
-
});
|
|
46
|
-
const data = await getGlobal(app);
|
|
47
|
-
expect(data.memory_signals_fired).toBe(0);
|
|
48
|
-
expect(data.memory_verdicts_total).toBe(0);
|
|
49
|
-
expect(data.memory_effectiveness_pct).toBe(0);
|
|
50
|
-
});
|
|
51
|
-
it("computes effectiveness when verdicts resolve", async () => {
|
|
52
|
-
// 1 reinforced (re-fired + no correction)
|
|
53
|
-
tracker.recordSignalFired({
|
|
54
|
-
kind: "fact_injected",
|
|
55
|
-
signal_id: "f-reinforced",
|
|
56
|
-
entity_key: "EntityR",
|
|
57
|
-
turn: 1,
|
|
58
|
-
});
|
|
59
|
-
tracker.recordSignalFired({
|
|
60
|
-
kind: "fact_injected",
|
|
61
|
-
signal_id: "f-reinforced",
|
|
62
|
-
entity_key: "EntityR",
|
|
63
|
-
turn: 2,
|
|
64
|
-
});
|
|
65
|
-
// 1 acted_on (edit observed + no correction)
|
|
66
|
-
tracker.recordSignalFired({
|
|
67
|
-
kind: "convention_injected",
|
|
68
|
-
signal_id: "c-acted",
|
|
69
|
-
entity_key: "EntityA",
|
|
70
|
-
turn: 1,
|
|
71
|
-
});
|
|
72
|
-
tracker.recordEdit("EntityA");
|
|
73
|
-
// 1 caught (negative warning + no correction)
|
|
74
|
-
tracker.recordSignalFired({
|
|
75
|
-
kind: "negative_warned",
|
|
76
|
-
signal_id: "n-caught",
|
|
77
|
-
entity_key: "EntityN",
|
|
78
|
-
turn: 1,
|
|
79
|
-
});
|
|
80
|
-
// 1 corrected (signal fired + correction observed)
|
|
81
|
-
tracker.recordSignalFired({
|
|
82
|
-
kind: "convention_injected",
|
|
83
|
-
signal_id: "c-corrected",
|
|
84
|
-
entity_key: "EntityX",
|
|
85
|
-
turn: 1,
|
|
86
|
-
});
|
|
87
|
-
tracker.recordCorrection("EntityX", "circuit_breaker");
|
|
88
|
-
// 1 ignored
|
|
89
|
-
tracker.recordSignalFired({
|
|
90
|
-
kind: "fact_injected",
|
|
91
|
-
signal_id: "f-ignored",
|
|
92
|
-
entity_key: "EntityI",
|
|
93
|
-
turn: 1,
|
|
94
|
-
});
|
|
95
|
-
// 1 resume + 1 fact_recalled — verdict counts
|
|
96
|
-
tracker.recordSignalFired({
|
|
97
|
-
kind: "resume_injected",
|
|
98
|
-
signal_id: "resume-1",
|
|
99
|
-
entity_key: null,
|
|
100
|
-
turn: 1,
|
|
101
|
-
});
|
|
102
|
-
tracker.recordSignalFired({
|
|
103
|
-
kind: "fact_recalled",
|
|
104
|
-
signal_id: "r-1",
|
|
105
|
-
entity_key: "EntityRec",
|
|
106
|
-
turn: 1,
|
|
107
|
-
});
|
|
108
|
-
tracker.recordSignalFired({
|
|
109
|
-
kind: "fact_recorded",
|
|
110
|
-
signal_id: "rec-1",
|
|
111
|
-
entity_key: "EntitySub",
|
|
112
|
-
turn: 1,
|
|
113
|
-
});
|
|
114
|
-
tracker.closeWindow(10);
|
|
115
|
-
const app = createReasoningQualityRoutes({
|
|
116
|
-
unerrDir,
|
|
117
|
-
getTokenFlowWriter: () => writer,
|
|
118
|
-
});
|
|
119
|
-
const data = await getGlobal(app);
|
|
120
|
-
// Fired counts by kind
|
|
121
|
-
expect(data.facts_surfaced).toBe(2); // f-reinforced, f-ignored
|
|
122
|
-
expect(data.facts_recalled).toBe(1);
|
|
123
|
-
expect(data.facts_recorded).toBe(1);
|
|
124
|
-
expect(data.conventions_surfaced).toBe(2);
|
|
125
|
-
expect(data.resume_hits).toBe(1);
|
|
126
|
-
expect(data.negative_warnings).toBe(1);
|
|
127
|
-
expect(data.memory_signals_fired).toBe(8);
|
|
128
|
-
// Verdict tallies (8 total verdicts after closeWindow)
|
|
129
|
-
expect(data.verdicts_reinforced).toBe(1);
|
|
130
|
-
expect(data.verdicts_acted_on).toBe(1);
|
|
131
|
-
expect(data.verdicts_caught).toBe(1);
|
|
132
|
-
expect(data.verdicts_corrected).toBe(1);
|
|
133
|
-
expect(data.verdicts_ignored).toBe(4); // c-acted no-edit-target, others with no signals
|
|
134
|
-
expect(data.memory_verdicts_total).toBe(8);
|
|
135
|
-
// Effectiveness = (reinforced + acted_on + caught) / total = 3/8 = 38%
|
|
136
|
-
expect(data.memory_effectiveness_pct).toBe(38);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ST-6: Redactor + archive job.
|
|
3
|
-
*/
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { gunzipSync } from "node:zlib";
|
|
8
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
9
|
-
import { archiveShadowLedger } from "../tracking/ledger-archiver.js";
|
|
10
|
-
import { redactArgs, redactString } from "../tracking/redactor.js";
|
|
11
|
-
import { ShadowLedger } from "../tracking/shadow-ledger.js";
|
|
12
|
-
describe("redactString", () => {
|
|
13
|
-
it("redacts Anthropic-style sk-... keys", () => {
|
|
14
|
-
expect(redactString("API key: sk-abc123def456ghi789jklmno")).toBe("API key: <redacted>");
|
|
15
|
-
});
|
|
16
|
-
it("redacts GitHub PATs", () => {
|
|
17
|
-
expect(redactString("ghp_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")).toBe("<redacted>");
|
|
18
|
-
});
|
|
19
|
-
it("redacts Bearer headers", () => {
|
|
20
|
-
expect(redactString("Authorization: Bearer abc.def.ghi=")).toContain("<redacted>");
|
|
21
|
-
});
|
|
22
|
-
it("redacts password assignments", () => {
|
|
23
|
-
expect(redactString('password="hunter2"')).toContain("<redacted>");
|
|
24
|
-
expect(redactString("api_key=verysecret123")).toContain("<redacted>");
|
|
25
|
-
});
|
|
26
|
-
it("does not touch unrelated text", () => {
|
|
27
|
-
expect(redactString("just some normal log line")).toBe("just some normal log line");
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe("redactArgs", () => {
|
|
31
|
-
it("walks nested objects", () => {
|
|
32
|
-
const out = redactArgs({
|
|
33
|
-
file_path: "src/auth.ts",
|
|
34
|
-
env: { TOKEN: "ghp_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" },
|
|
35
|
-
list: ["plain", "Bearer abcdefghijklmno12345"],
|
|
36
|
-
});
|
|
37
|
-
expect(out.file_path).toBe("src/auth.ts");
|
|
38
|
-
expect(out.env.TOKEN).toBe("<redacted>");
|
|
39
|
-
expect(out.list[1]).toContain("<redacted>");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe("ShadowLedger redacts on record", () => {
|
|
43
|
-
let tempDir;
|
|
44
|
-
let unerrDir;
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
tempDir = join(tmpdir(), `unerr-redact-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
47
|
-
unerrDir = join(tempDir, ".unerr");
|
|
48
|
-
mkdirSync(unerrDir, { recursive: true });
|
|
49
|
-
});
|
|
50
|
-
afterEach(() => {
|
|
51
|
-
try {
|
|
52
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
/* ignore */
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
it("redacts a secret-looking arg before persisting", () => {
|
|
59
|
-
const ledger = new ShadowLedger(unerrDir);
|
|
60
|
-
ledger.record("shell", { command: "curl -H 'Authorization: Bearer abcdef0123456789'" }, {}, "main", "x");
|
|
61
|
-
const line = readFileSync(join(unerrDir, "ledger", "shadow.jsonl"), "utf-8").trim();
|
|
62
|
-
expect(line).toContain("<redacted>");
|
|
63
|
-
expect(line).not.toContain("abcdef0123456789");
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe("archiveShadowLedger", () => {
|
|
67
|
-
let tempDir;
|
|
68
|
-
let unerrDir;
|
|
69
|
-
beforeEach(() => {
|
|
70
|
-
tempDir = join(tmpdir(), `unerr-arch-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
71
|
-
unerrDir = join(tempDir, ".unerr");
|
|
72
|
-
mkdirSync(join(unerrDir, "ledger"), { recursive: true });
|
|
73
|
-
});
|
|
74
|
-
afterEach(() => {
|
|
75
|
-
try {
|
|
76
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
/* ignore */
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
it("splits old entries into a gzipped archive and keeps recent ones", () => {
|
|
83
|
-
const filePath = join(unerrDir, "ledger", "shadow.jsonl");
|
|
84
|
-
const now = Date.parse("2026-05-12T00:00:00Z");
|
|
85
|
-
const old = JSON.stringify({
|
|
86
|
-
id: "1",
|
|
87
|
-
ts: new Date(now - 10 * 24 * 60 * 60_000).toISOString(),
|
|
88
|
-
tool: "file_read",
|
|
89
|
-
});
|
|
90
|
-
const recent = JSON.stringify({
|
|
91
|
-
id: "2",
|
|
92
|
-
ts: new Date(now - 60_000).toISOString(),
|
|
93
|
-
tool: "file_read",
|
|
94
|
-
});
|
|
95
|
-
writeFileSync(filePath, `${old}\n${recent}\n`, "utf-8");
|
|
96
|
-
const result = archiveShadowLedger(unerrDir, { nowMs: now });
|
|
97
|
-
expect(result.archived).toBe(1);
|
|
98
|
-
expect(result.kept).toBe(1);
|
|
99
|
-
expect(result.archivePath).not.toBeNull();
|
|
100
|
-
expect(existsSync(result.archivePath)).toBe(true);
|
|
101
|
-
const decoded = gunzipSync(readFileSync(result.archivePath)).toString("utf-8");
|
|
102
|
-
expect(decoded).toContain('"id":"1"');
|
|
103
|
-
const remaining = readFileSync(filePath, "utf-8").trim();
|
|
104
|
-
expect(remaining).toContain('"id":"2"');
|
|
105
|
-
expect(remaining).not.toContain('"id":"1"');
|
|
106
|
-
});
|
|
107
|
-
it("is a no-op when nothing is older than the cutoff", () => {
|
|
108
|
-
const filePath = join(unerrDir, "ledger", "shadow.jsonl");
|
|
109
|
-
const now = Date.parse("2026-05-12T00:00:00Z");
|
|
110
|
-
const line = JSON.stringify({
|
|
111
|
-
id: "1",
|
|
112
|
-
ts: new Date(now - 60_000).toISOString(),
|
|
113
|
-
tool: "file_read",
|
|
114
|
-
});
|
|
115
|
-
writeFileSync(filePath, `${line}\n`, "utf-8");
|
|
116
|
-
const result = archiveShadowLedger(unerrDir, { nowMs: now });
|
|
117
|
-
expect(result.archived).toBe(0);
|
|
118
|
-
expect(result.archivePath).toBeNull();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { createResourceMonitor, getDegradationConfig, getResourceSnapshot, } from "../intelligence/indexer/resource-monitor.js";
|
|
3
|
-
describe("Resource Monitor (L2.6)", () => {
|
|
4
|
-
it("produces a valid resource snapshot", () => {
|
|
5
|
-
const snap = getResourceSnapshot();
|
|
6
|
-
expect(snap.heapUsedMB).toBeGreaterThan(0);
|
|
7
|
-
expect(snap.heapTotalMB).toBeGreaterThan(0);
|
|
8
|
-
expect(snap.heapPercentage).toBeGreaterThanOrEqual(0);
|
|
9
|
-
expect(snap.heapPercentage).toBeLessThanOrEqual(1);
|
|
10
|
-
expect(snap.rss).toBeGreaterThan(0);
|
|
11
|
-
expect([0, 1, 2, 3]).toContain(snap.degradationLevel);
|
|
12
|
-
});
|
|
13
|
-
it("creates and stops monitor without errors", () => {
|
|
14
|
-
const monitor = createResourceMonitor(60_000);
|
|
15
|
-
monitor.start();
|
|
16
|
-
const snap = monitor.getSnapshot();
|
|
17
|
-
expect(snap.heapUsedMB).toBeGreaterThan(0);
|
|
18
|
-
monitor.stop();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe("Progressive Degradation (L2.7)", () => {
|
|
22
|
-
it("level 0: full parallelism", () => {
|
|
23
|
-
const config = getDegradationConfig(0, 4);
|
|
24
|
-
expect(config.maxWorkers).toBe(4);
|
|
25
|
-
expect(config.scipEnabled).toBe(true);
|
|
26
|
-
expect(config.batchSize).toBe(50);
|
|
27
|
-
});
|
|
28
|
-
it("level 1: reduced workers", () => {
|
|
29
|
-
const config = getDegradationConfig(1, 4);
|
|
30
|
-
expect(config.maxWorkers).toBe(2);
|
|
31
|
-
expect(config.scipEnabled).toBe(true);
|
|
32
|
-
expect(config.batchSize).toBe(25);
|
|
33
|
-
});
|
|
34
|
-
it("level 2: single worker, SCIP paused", () => {
|
|
35
|
-
const config = getDegradationConfig(2, 4);
|
|
36
|
-
expect(config.maxWorkers).toBe(1);
|
|
37
|
-
expect(config.scipEnabled).toBe(false);
|
|
38
|
-
expect(config.batchSize).toBe(10);
|
|
39
|
-
});
|
|
40
|
-
it("level 3: emergency mode", () => {
|
|
41
|
-
const config = getDegradationConfig(3, 4);
|
|
42
|
-
expect(config.maxWorkers).toBe(1);
|
|
43
|
-
expect(config.scipEnabled).toBe(false);
|
|
44
|
-
expect(config.batchSize).toBe(5);
|
|
45
|
-
});
|
|
46
|
-
it("degradation callback fires on level change", () => {
|
|
47
|
-
const monitor = createResourceMonitor(100_000);
|
|
48
|
-
let lastLevel = null;
|
|
49
|
-
monitor.onDegradationChange((level) => {
|
|
50
|
-
lastLevel = level;
|
|
51
|
-
});
|
|
52
|
-
monitor.start();
|
|
53
|
-
const config = monitor.getConfig();
|
|
54
|
-
expect(config.maxWorkers).toBeGreaterThanOrEqual(1);
|
|
55
|
-
monitor.stop();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { createEnvelopePipeline, estimateTokens, wrapResponse, } from "../proxy/response-envelope.js";
|
|
3
|
-
describe("estimateTokens", () => {
|
|
4
|
-
it("estimates tokens for a short string", () => {
|
|
5
|
-
const tokens = estimateTokens("hello world");
|
|
6
|
-
expect(tokens).toBeGreaterThan(0);
|
|
7
|
-
expect(tokens).toBeLessThan(20);
|
|
8
|
-
});
|
|
9
|
-
it("handles objects by serializing to JSON", () => {
|
|
10
|
-
const obj = { key: "value", nested: { a: 1 } };
|
|
11
|
-
const tokens = estimateTokens(obj);
|
|
12
|
-
expect(tokens).toBeGreaterThan(0);
|
|
13
|
-
});
|
|
14
|
-
it("returns 0 for null/undefined", () => {
|
|
15
|
-
expect(estimateTokens(null)).toBe(0);
|
|
16
|
-
expect(estimateTokens(undefined)).toBe(0);
|
|
17
|
-
});
|
|
18
|
-
it("handles empty string", () => {
|
|
19
|
-
expect(estimateTokens("")).toBe(0);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
describe("wrapResponse", () => {
|
|
23
|
-
it("wraps content with _meta fields", async () => {
|
|
24
|
-
const result = await wrapResponse({ data: "test" }, 5.2);
|
|
25
|
-
expect(result.content).toEqual({ data: "test" });
|
|
26
|
-
expect(result._meta["dev.unerr/version"]).toBe("0.1.0");
|
|
27
|
-
expect(result._meta["dev.unerr/latency_ms"]).toBe(5.2);
|
|
28
|
-
expect(result._meta["dev.unerr/tokens_saved"]).toBeGreaterThanOrEqual(0);
|
|
29
|
-
});
|
|
30
|
-
it("calculates token savings when originalTokens provided", async () => {
|
|
31
|
-
const result = await wrapResponse("short", 1, 1000);
|
|
32
|
-
expect(result._meta["dev.unerr/tokens_saved"]).toBeGreaterThan(0);
|
|
33
|
-
});
|
|
34
|
-
it("never returns negative token savings", async () => {
|
|
35
|
-
const result = await wrapResponse("a very long response string", 1, 1);
|
|
36
|
-
expect(result._meta["dev.unerr/tokens_saved"]).toBe(0);
|
|
37
|
-
});
|
|
38
|
-
it("does not include _context when no injectors provide data", async () => {
|
|
39
|
-
const result = await wrapResponse("test", 1);
|
|
40
|
-
expect(result._context).toBeUndefined();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
describe("createEnvelopePipeline", () => {
|
|
44
|
-
it("runs injectors and merges _context", async () => {
|
|
45
|
-
const injector = {
|
|
46
|
-
key: "test",
|
|
47
|
-
inject: () => ({ "dev.unerr/test": { hello: "world" } }),
|
|
48
|
-
};
|
|
49
|
-
const pipeline = createEnvelopePipeline([injector]);
|
|
50
|
-
const result = await pipeline.wrapResponse("content", 1);
|
|
51
|
-
expect(result._context).toBeDefined();
|
|
52
|
-
expect(result._context?.["dev.unerr/test"]).toEqual({ hello: "world" });
|
|
53
|
-
});
|
|
54
|
-
it("handles injector returning null", async () => {
|
|
55
|
-
const injector = {
|
|
56
|
-
key: "noop",
|
|
57
|
-
inject: () => null,
|
|
58
|
-
};
|
|
59
|
-
const pipeline = createEnvelopePipeline([injector]);
|
|
60
|
-
const result = await pipeline.wrapResponse("content", 1);
|
|
61
|
-
expect(result._context).toBeUndefined();
|
|
62
|
-
});
|
|
63
|
-
it("swallows injector errors silently", async () => {
|
|
64
|
-
const injector = {
|
|
65
|
-
key: "boom",
|
|
66
|
-
inject: () => {
|
|
67
|
-
throw new Error("injector crashed");
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
const pipeline = createEnvelopePipeline([injector]);
|
|
71
|
-
const result = await pipeline.wrapResponse("content", 1);
|
|
72
|
-
expect(result.content).toBe("content");
|
|
73
|
-
expect(result._meta["dev.unerr/version"]).toBe("0.1.0");
|
|
74
|
-
});
|
|
75
|
-
it("merges multiple injectors", async () => {
|
|
76
|
-
const injectors = [
|
|
77
|
-
{ key: "a", inject: () => ({ alpha: 1 }) },
|
|
78
|
-
{ key: "b", inject: () => ({ beta: 2 }) },
|
|
79
|
-
];
|
|
80
|
-
const pipeline = createEnvelopePipeline(injectors);
|
|
81
|
-
const result = await pipeline.wrapResponse("content", 1);
|
|
82
|
-
expect(result._context?.alpha).toBe(1);
|
|
83
|
-
expect(result._context?.beta).toBe(2);
|
|
84
|
-
});
|
|
85
|
-
it("passes tool metadata to injectors", async () => {
|
|
86
|
-
let capturedArgs;
|
|
87
|
-
const injector = {
|
|
88
|
-
key: "spy",
|
|
89
|
-
inject: (args) => {
|
|
90
|
-
capturedArgs = args;
|
|
91
|
-
return null;
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
const pipeline = createEnvelopePipeline([injector]);
|
|
95
|
-
await pipeline.wrapResponse("content", 5, "get_function", { key: "abc" }, 100);
|
|
96
|
-
const args = capturedArgs;
|
|
97
|
-
expect(args.toolName).toBe("get_function");
|
|
98
|
-
expect(args.toolArgs.key).toBe("abc");
|
|
99
|
-
});
|
|
100
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { classifyAllRisks, classifyRisk, detectBridges, } from "../intelligence/risk-classifier.js";
|
|
3
|
-
describe("Risk Classifier (M.4)", () => {
|
|
4
|
-
it("classifies high fan-in entity as critical", () => {
|
|
5
|
-
const result = classifyRisk("hub", 60, false, false, false);
|
|
6
|
-
expect(result.level).toBe("critical");
|
|
7
|
-
expect(result.score).toBeGreaterThanOrEqual(35);
|
|
8
|
-
expect(result.reasoning).toContain("chokepoint");
|
|
9
|
-
});
|
|
10
|
-
it("classifies bridge entity with elevated risk", () => {
|
|
11
|
-
const result = classifyRisk("bridge", 10, true, false, false);
|
|
12
|
-
expect(["high", "medium"]).toContain(result.level);
|
|
13
|
-
expect(result.reasoning).toContain("bridges");
|
|
14
|
-
});
|
|
15
|
-
it("classifies entity with mutations as higher risk", () => {
|
|
16
|
-
const result = classifyRisk("mutator", 5, false, true, false);
|
|
17
|
-
expect(result.score).toBeGreaterThan(classifyRisk("pure", 5, false, false, false).score);
|
|
18
|
-
});
|
|
19
|
-
it("reduces risk when entity is guarded", () => {
|
|
20
|
-
const unguarded = classifyRisk("fn", 30, false, false, false);
|
|
21
|
-
const guarded = classifyRisk("fn", 30, false, false, true);
|
|
22
|
-
expect(guarded.score).toBeLessThanOrEqual(unguarded.score);
|
|
23
|
-
});
|
|
24
|
-
it("classifies low-risk entity as low", () => {
|
|
25
|
-
const result = classifyRisk("simple", 2, false, false, false);
|
|
26
|
-
expect(result.level).toBe("low");
|
|
27
|
-
expect(result.score).toBeLessThan(25);
|
|
28
|
-
});
|
|
29
|
-
it("fan-in of 20+ triggers high classification", () => {
|
|
30
|
-
const result = classifyRisk("busy", 25, false, false, false);
|
|
31
|
-
expect(["high", "medium"]).toContain(result.level);
|
|
32
|
-
expect(result.reasoning).toContain("callers");
|
|
33
|
-
});
|
|
34
|
-
it("combines multiple factors", () => {
|
|
35
|
-
const result = classifyRisk("dangerous", 40, true, true, false);
|
|
36
|
-
expect(result.level).toBe("critical");
|
|
37
|
-
expect(result.factors.fanIn).toBeGreaterThan(0);
|
|
38
|
-
expect(result.factors.bridgeScore).toBeGreaterThan(0);
|
|
39
|
-
expect(result.factors.mutationScore).toBeGreaterThan(0);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe("Bridge Detection (M.4)", () => {
|
|
43
|
-
it("detects entity bridging two communities", () => {
|
|
44
|
-
const edges = [
|
|
45
|
-
{
|
|
46
|
-
from_key: "bridge",
|
|
47
|
-
to_key: "a",
|
|
48
|
-
type: "calls",
|
|
49
|
-
file_path: "f.ts",
|
|
50
|
-
line: 1,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
from_key: "bridge",
|
|
54
|
-
to_key: "b",
|
|
55
|
-
type: "calls",
|
|
56
|
-
file_path: "f.ts",
|
|
57
|
-
line: 2,
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
const assignments = new Map([
|
|
61
|
-
["bridge", 0],
|
|
62
|
-
["a", 0],
|
|
63
|
-
["b", 1],
|
|
64
|
-
]);
|
|
65
|
-
expect(detectBridges("bridge", edges, assignments)).toBe(true);
|
|
66
|
-
});
|
|
67
|
-
it("non-bridge entity returns false", () => {
|
|
68
|
-
const edges = [
|
|
69
|
-
{
|
|
70
|
-
from_key: "local",
|
|
71
|
-
to_key: "neighbor",
|
|
72
|
-
type: "calls",
|
|
73
|
-
file_path: "f.ts",
|
|
74
|
-
line: 1,
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
const assignments = new Map([
|
|
78
|
-
["local", 0],
|
|
79
|
-
["neighbor", 0],
|
|
80
|
-
]);
|
|
81
|
-
expect(detectBridges("local", edges, assignments)).toBe(false);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
describe("Batch Risk Classification", () => {
|
|
85
|
-
it("classifies all entities", () => {
|
|
86
|
-
const entities = [{ key: "a" }, { key: "b" }, { key: "c" }];
|
|
87
|
-
const fanInMap = new Map([
|
|
88
|
-
["a", 50],
|
|
89
|
-
["b", 5],
|
|
90
|
-
["c", 0],
|
|
91
|
-
]);
|
|
92
|
-
const edges = [];
|
|
93
|
-
const assignments = new Map();
|
|
94
|
-
const mutations = new Set(["b"]);
|
|
95
|
-
const guarded = new Set(["c"]);
|
|
96
|
-
const results = classifyAllRisks(entities, fanInMap, edges, assignments, mutations, guarded);
|
|
97
|
-
expect(results).toHaveLength(3);
|
|
98
|
-
expect(results[0]?.level).toBe("critical");
|
|
99
|
-
expect(results[1]?.factors.mutationScore).toBeGreaterThan(0);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ur|rsk` signal scope tests — verifies that array-shaped tool results
|
|
3
|
-
* (e.g. `get_references`) tag risk metadata with the max-risk neighbor's
|
|
4
|
-
* `entity_key`, and that `buildSignalPrefix` uses a composite dedup key
|
|
5
|
-
* so each new high-risk reference re-fires the signal instead of being
|
|
6
|
-
* suppressed by the queried entity's scope.
|
|
7
|
-
*/
|
|
8
|
-
import { beforeEach, describe, expect, it } from "vitest";
|
|
9
|
-
import { buildSignalPrefix } from "../proxy/response-envelope.js";
|
|
10
|
-
import { resetSignalDedupSingleton } from "../proxy/signal-dedup.js";
|
|
11
|
-
describe("ur|rsk scope for reference-shaped results", () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
resetSignalDedupSingleton();
|
|
14
|
-
});
|
|
15
|
-
it("emits ur|rsk when a high-risk caller is present (queried entity itself is low)", () => {
|
|
16
|
-
// Target is the queried entity (low risk). One of its callers is high risk.
|
|
17
|
-
// Without the envelope-aware extractor, this would emit no rsk at all.
|
|
18
|
-
const meta = {
|
|
19
|
-
entity_risk: {
|
|
20
|
-
fan_in: 24,
|
|
21
|
-
fan_out: 1,
|
|
22
|
-
risk_level: "high",
|
|
23
|
-
entity_key: "callerHigh",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
const prefix = buildSignalPrefix(meta, undefined, "targetLow");
|
|
27
|
-
expect(prefix).toContain("ur|rsk");
|
|
28
|
-
expect(prefix).toContain("fan_in=24");
|
|
29
|
-
});
|
|
30
|
-
it("does not emit ur|rsk when no caller is high-risk", () => {
|
|
31
|
-
// No entity_risk on meta at all — extractor returned undefined for the
|
|
32
|
-
// all-normal-refs case.
|
|
33
|
-
const prefix = buildSignalPrefix({}, undefined, "targetLow");
|
|
34
|
-
expect(prefix).not.toContain("ur|rsk");
|
|
35
|
-
});
|
|
36
|
-
it("suppresses identical re-emission for the same target+ref pair (on_change dedup)", () => {
|
|
37
|
-
const meta = {
|
|
38
|
-
entity_risk: {
|
|
39
|
-
fan_in: 24,
|
|
40
|
-
fan_out: 1,
|
|
41
|
-
risk_level: "high",
|
|
42
|
-
entity_key: "callerHigh",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const first = buildSignalPrefix(meta, undefined, "targetLow");
|
|
46
|
-
const second = buildSignalPrefix(meta, undefined, "targetLow");
|
|
47
|
-
expect(first).toContain("ur|rsk");
|
|
48
|
-
expect(second).not.toContain("ur|rsk");
|
|
49
|
-
});
|
|
50
|
-
it("re-fires ur|rsk when the max-risk neighbor changes for the same queried entity", () => {
|
|
51
|
-
// First call: callerHigh1 is the worst offender.
|
|
52
|
-
const first = buildSignalPrefix({
|
|
53
|
-
entity_risk: {
|
|
54
|
-
fan_in: 24,
|
|
55
|
-
fan_out: 1,
|
|
56
|
-
risk_level: "high",
|
|
57
|
-
entity_key: "callerHigh1",
|
|
58
|
-
},
|
|
59
|
-
}, undefined, "targetLow");
|
|
60
|
-
// Second call (e.g. limit-paginated get_references): a different caller now
|
|
61
|
-
// tops the list. Composite key (target:ref:callerHigh2) is fresh, so emit.
|
|
62
|
-
const second = buildSignalPrefix({
|
|
63
|
-
entity_risk: {
|
|
64
|
-
fan_in: 30,
|
|
65
|
-
fan_out: 2,
|
|
66
|
-
risk_level: "high",
|
|
67
|
-
entity_key: "callerHigh2",
|
|
68
|
-
},
|
|
69
|
-
}, undefined, "targetLow");
|
|
70
|
-
expect(first).toContain("ur|rsk");
|
|
71
|
-
expect(first).toContain("fan_in=24");
|
|
72
|
-
expect(second).toContain("ur|rsk");
|
|
73
|
-
expect(second).toContain("fan_in=30");
|
|
74
|
-
});
|
|
75
|
-
});
|