惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
有赞技术团队
有赞技术团队
博客园_首页
IT之家
IT之家
爱范儿
爱范儿
量子位
小众软件
小众软件
Jina AI
Jina AI
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
The Cloudflare Blog
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
雷峰网
雷峰网
V
Visual Studio Blog
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: tighten jsonl resolver assertions · openclaw/opencl...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import { describe, expect, it } from "vitest";

2+

import type { JsoncValue } from "../../jsonc/ast.js";

23

import { parseJsonl } from "../../jsonl/parse.js";

34

import { resolveJsonlOcPath } from "../../jsonl/resolve.js";

45

import { parseOcPath } from "../../oc-path.js";

@@ -7,6 +8,20 @@ function rs(raw: string, ocPath: string) {

78

return resolveJsonlOcPath(parseJsonl(raw).ast, parseOcPath(ocPath));

89

}

91011+

function expectNumberValue(node: JsoncValue, value: number) {

12+

expect(node.kind).toBe("number");

13+

if (node.kind === "number") {

14+

expect(node.value).toBe(value);

15+

}

16+

}

17+18+

function expectStringValue(node: JsoncValue, value: string) {

19+

expect(node.kind).toBe("string");

20+

if (node.kind === "string") {

21+

expect(node.value).toBe(value);

22+

}

23+

}

24+1025

describe("jsonl resolver edges", () => {

1126

it("root resolves with no segments", () => {

1227

expect(rs('{"a":1}\n', "oc://log")?.kind).toBe("root");

@@ -25,15 +40,15 @@ describe("jsonl resolver edges", () => {

2540

const m = rs('{"a":1}\n{"a":2}\n{"a":3}\n', "oc://log/$last/a");

2641

expect(m?.kind).toBe("object-entry");

2742

if (m?.kind === "object-entry") {

28-

expect(m.node.value).toMatchObject({ kind: "number", value: 3 });

43+

expectNumberValue(m.node.value, 3);

2944

}

3045

});

31463247

it("$last skips trailing blank lines", () => {

3348

const m = rs('{"a":1}\n\n\n', "oc://log/$last/a");

3449

expect(m?.kind).toBe("object-entry");

3550

if (m?.kind === "object-entry") {

36-

expect(m.node.value).toMatchObject({ kind: "number", value: 1 });

51+

expectNumberValue(m.node.value, 1);

3752

}

3853

});

3954

@@ -76,30 +91,30 @@ describe("jsonl resolver edges", () => {

7691

const m = rs('{"r":{"ok":true,"d":"x"}}\n', "oc://log/L1/r.d");

7792

expect(m?.kind).toBe("object-entry");

7893

if (m?.kind === "object-entry") {

79-

expect(m.node.value).toMatchObject({ kind: "string", value: "x" });

94+

expectStringValue(m.node.value, "x");

8095

}

8196

});

82978398

it("array index inside a line resolves", () => {

8499

const m = rs('{"items":["a","b","c"]}\n', "oc://log/L1/items.2");

85100

expect(m?.kind).toBe("value");

86101

if (m?.kind === "value") {

87-

expect(m.node).toMatchObject({ kind: "string", value: "c" });

102+

expectStringValue(m.node, "c");

88103

}

89104

});

9010591106

it("line numbers are 1-indexed", () => {

92107

const m = rs('{"a":1}\n{"a":2}\n', "oc://log/L1/a");

93108

if (m?.kind === "object-entry") {

94-

expect(m.node.value).toMatchObject({ kind: "number", value: 1 });

109+

expectNumberValue(m.node.value, 1);

95110

}

96111

});

9711298113

it("line numbers preserved across blank/malformed entries", () => {

99114

const m = rs('{"a":1}\n\nbroken\n{"a":4}\n', "oc://log/L4/a");

100115

expect(m?.kind).toBe("object-entry");

101116

if (m?.kind === "object-entry") {

102-

expect(m.node.value).toMatchObject({ kind: "number", value: 4 });

117+

expectNumberValue(m.node.value, 4);

103118

}

104119

});

105120