Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions core/test/report-command-paths.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import assert from 'node:assert/strict'
import { existsSync, readFileSync, statSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { test } from 'node:test'
import { fileURLToPath } from 'node:url'

const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
const REPORT = join(ROOT, 'docs', 'reports', '2026-10-26-turn-input-split.md')

// Every `node <script> ...` token a report prints, with the line it sits on, so a
// reader who copies a command gets one the tree can actually run.
function nodeCommands(text) {
const found = []
text.split('\n').forEach((line, index) => {
for (const match of line.matchAll(/\bnode\s+([\w./-]+\.(?:mjs|cjs|js))\b/g)) {
found.push({ line: index + 1, path: match[1] })
}
})
return found
}

test('the node-command reader finds a script and its line', () => {
assert.deepEqual(nodeCommands('run: node dev/x.mjs --flag'), [{ line: 1, path: 'dev/x.mjs' }])
// A bare interpreter invocation with no script after it is not a command path.
assert.deepEqual(nodeCommands('node --version'), [])
})

test('every node command in the turn-split report names a script that exists at the tree root', () => {
const commands = nodeCommands(readFileSync(REPORT, 'utf8'))
assert.ok(commands.length > 0, 'the report prints at least one node command; finding none proves nothing')

const missing = commands
.filter((command) => !existsSync(join(ROOT, command.path)) || !statSync(join(ROOT, command.path)).isFile())
.map((command) => `line ${command.line}: node ${command.path}`)
assert.deepEqual(missing, [], `commands the report prints but the tree cannot run:\n${missing.join('\n')}`)
})
6 changes: 3 additions & 3 deletions docs/reports/2026-10-26-turn-input-split.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The tool schemas are **79%** of the fixed block's characters. The group notice p

## 5. Tool results

`node dev/turn-split.mjs --stats` prints the `## Tool results` block: the `tool/result` count, the characters added across the turn, the largest single result, the share by tool, what is still on the last call's surface, and the derived tokens carried.
`node core/dev/turn-split.mjs --stats` prints the `## Tool results` block: the `tool/result` count, the characters added across the turn, the largest single result, the share by tool, what is still on the last call's surface, and the derived tokens carried.

| Measure | Value | Source |
| --- | --- | --- |
Expand Down Expand Up @@ -162,7 +162,7 @@ A checkpoint buys back roughly twenty minutes of growth at this rate; the fixed

## 7. Fan-out in the group

`node dev/turn-split.mjs --stats --room <room session id>` prints the `## Fan-out` block: per-message member-Bot and member-turn counts (10-minute window), the day totals of the member Sessions that name the room, and the fixed block per user message.
`node core/dev/turn-split.mjs --stats --room <room session id>` prints the `## Fan-out` block: per-message member-Bot and member-turn counts (10-minute window), the day totals of the member Sessions that name the room, and the fixed block per user message.

FlyBot 交付组, 2026-10-25, 511 user messages in the room (one per `turn/start` of the room's own relay Session):

Expand All @@ -179,7 +179,7 @@ One message in the delivery group costs its members **21.7 calls** and **1.17 mi

## 8. Retries and repeated work

`node dev/turn-split.mjs --stats` prints the `## Retries` block: `llm/retry` and `assistant/attempt` counts by local day, and how many attempts carried a non-zero usage chunk.
`node core/dev/turn-split.mjs --stats` prints the `## Retries` block: `llm/retry` and `assistant/attempt` counts by local day, and how many attempts carried a non-zero usage chunk.

| Measure | 2026-10-25 | 2026-10-26 (partial) | Source |
| --- | --- | --- | --- |
Expand Down
36 changes: 36 additions & 0 deletions patches/ds-bot/files/test/report-command-paths.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import assert from 'node:assert/strict'
import { existsSync, readFileSync, statSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { test } from 'node:test'
import { fileURLToPath } from 'node:url'

const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
const REPORT = join(ROOT, 'docs', 'reports', '2026-10-26-turn-input-split.md')

// Every `node <script> ...` token a report prints, with the line it sits on, so a
// reader who copies a command gets one the tree can actually run.
function nodeCommands(text) {
const found = []
text.split('\n').forEach((line, index) => {
for (const match of line.matchAll(/\bnode\s+([\w./-]+\.(?:mjs|cjs|js))\b/g)) {
found.push({ line: index + 1, path: match[1] })
}
})
return found
}

test('the node-command reader finds a script and its line', () => {
assert.deepEqual(nodeCommands('run: node dev/x.mjs --flag'), [{ line: 1, path: 'dev/x.mjs' }])
// A bare interpreter invocation with no script after it is not a command path.
assert.deepEqual(nodeCommands('node --version'), [])
})

test('every node command in the turn-split report names a script that exists at the tree root', () => {
const commands = nodeCommands(readFileSync(REPORT, 'utf8'))
assert.ok(commands.length > 0, 'the report prints at least one node command; finding none proves nothing')

const missing = commands
.filter((command) => !existsSync(join(ROOT, command.path)) || !statSync(join(ROOT, command.path)).isFile())
.map((command) => `line ${command.line}: node ${command.path}`)
assert.deepEqual(missing, [], `commands the report prints but the tree cannot run:\n${missing.join('\n')}`)
})
Loading