diff --git a/.github/workflows/performance-contracts.yml b/.github/workflows/performance-contracts.yml index ea711005b06..28ece6796e7 100644 --- a/.github/workflows/performance-contracts.yml +++ b/.github/workflows/performance-contracts.yml @@ -27,6 +27,8 @@ on: - 'src/renderer/src/components/editor/rich-markdown-lowlight-cache.test.ts' - 'src/renderer/src/components/terminal-pane/agent-completion-coordinator-queued-inspection-disposal.test.ts' - 'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts' + - 'src/main/claude-usage/scanner-incremental-append.test.ts' + - 'src/main/claude-usage/store-checkpoint-persistence.test.ts' permissions: contents: read diff --git a/config/performance-audit.md b/config/performance-audit.md index a9b8b669c6e..9c42dd3654b 100644 --- a/config/performance-audit.md +++ b/config/performance-audit.md @@ -25,6 +25,8 @@ and inherit the full suite's setup and forced-GC support. This makes existing regression coverage easy to run and attribute; it does not create new workload coverage by itself. +Incremental Claude scans and persisted Claude cache checkpoints are also included. + `.github/workflows/performance-contracts.yml` runs daily and manually on Linux, macOS and Windows, and on PRs changing this tooling or any listed contract file. It uploads per-OS JSON test results, plus the source inventory once from Linux diff --git a/config/scripts/claude-usage-append-benchmark.mjs b/config/scripts/claude-usage-append-benchmark.mjs new file mode 100644 index 00000000000..6ec4cac5249 --- /dev/null +++ b/config/scripts/claude-usage-append-benchmark.mjs @@ -0,0 +1,399 @@ +#!/usr/bin/env node +// --compare counterbalances HEAD/current; --verify checks current byte/state budgets. +import assert from 'node:assert/strict' +import { appendFile, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' +import { cpus, release, tmpdir } from 'node:os' +import { join } from 'node:path' +import { buildCounterbalancedSchedule } from './counterbalanced-benchmark-schedule.mjs' +import { + describeClaudeUsageBenchmarkTooling, + loadClaudeUsageBenchmarkScanner, + measureClaudeUsageBenchmarkScan as measure, + readClaudeUsageBenchmarkBaselineSources, + verifyClaudeUsageBenchmarkReadAccounting +} from './claude-usage-benchmark-scanner.mjs' + +const ROUNDS = Number(process.env.ORCA_CLAUDE_USAGE_APPEND_BENCH_ROUNDS ?? '8') +assert(Number.isSafeInteger(ROUNDS) && ROUNDS > 0, 'benchmark rounds must be a positive integer') +const VERIFY = process.argv.includes('--verify') +const BASELINE = process.argv.includes('--baseline') +const COMPARE = process.argv.includes('--compare') +assert(!(VERIFY && BASELINE), '--verify and --baseline cannot be combined') +assert(!(COMPARE && BASELINE), '--compare and --baseline cannot be combined') +assert(!COMPARE || ROUNDS % 2 === 0, '--compare requires an even round count') +const TURN_COUNT = 256 +const NEW_TURN_COUNT = 8 +const MIB = 1024 * 1024 + +function usageRecord(cwd, index, inputTokens = 100, cacheReadTokens = 0) { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: inputTokens, + output_tokens: 10, + cache_read_input_tokens: cacheReadTokens, + cache_creation_input_tokens: 20, + cache_creation: { ephemeral_1h_input_tokens: 5 } + } + } + })}\n` +} + +function userRecord(content) { + return `${JSON.stringify({ + type: 'user', + message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: 'tool', content }] } + })}\n` +} + +function createHistory(cwd, toolMiB, turnCount) { + const piece = '工具結果 🌊 benchmark tool output\n' + const tool = userRecord(piece.repeat(Math.ceil((2 * MIB) / Buffer.byteLength(piece)))) + const rows = Array.from({ length: toolMiB / 2 }, () => tool) + for (let index = 0; index < turnCount; index++) { + rows.push(usageRecord(cwd, index)) + if (index % 7 === 0) { + rows.push(usageRecord(cwd, index, 150)) + } + } + return { content: rows.join(''), lineCount: rows.length } +} + +function createAppend(cwd, turnCount) { + const rows = [userRecord('新しい入力 🐳'), usageRecord(cwd, 7, 2_000, 60)] + for (let index = turnCount; index < turnCount + NEW_TURN_COUNT; index++) { + rows.push(usageRecord(cwd, index)) + } + rows.push(usageRecord(cwd, turnCount, 225, 40)) + return { content: rows.join(''), lineCount: rows.length } +} + +function median(values) { + const sorted = [...values].sort((left, right) => left - right) + const middle = Math.floor(sorted.length / 2) + return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2 +} + +function summarize(samples) { + return Object.fromEntries( + Object.keys(samples[0]).map((key) => [ + key, + Number(median(samples.map((sample) => sample[key])).toFixed(3)) + ]) + ) +} + +function measurementSchedule(arms) { + const names = Object.keys(arms) + return names.length === 2 + ? buildCounterbalancedSchedule(ROUNDS, names[0], names[1]) + : Array.from({ length: ROUNDS }, () => names) +} + +function behaviorSnapshot(result) { + return { + sessions: result.sessions, + dailyAggregates: result.dailyAggregates, + processedFiles: result.processedFiles.map((file) => ({ + path: file.path, + size: file.size, + lineCount: file.lineCount, + sessions: file.sessions, + dailyAggregates: file.dailyAggregates, + ownedDedupeKeys: file.ownedDedupeKeys, + hasDeferredClaims: file.hasDeferredClaims + })) + } +} + +function recordRound(samples, measurements, arm, round, order, reference) { + const behavior = Object.fromEntries( + Object.entries(measurements).map(([phase, measurement]) => [ + phase, + behaviorSnapshot(measurement.result) + ]) + ) + if (reference) { + assert.deepEqual(behavior, reference, `cross-arm behavior differs in round ${round + 1}`) + } + samples.push({ + arm, + round: round + 1, + order, + phases: Object.fromEntries( + Object.entries(measurements).map(([phase, measurement]) => [phase, measurement.metrics]) + ) + }) + return behavior +} + +function finishSamples(samples) { + return Object.fromEntries( + [...new Set(samples.map((sample) => sample.arm))].map((arm) => { + const rawSamples = samples.filter((sample) => sample.arm === arm) + return [ + arm, + { + phases: Object.fromEntries( + Object.keys(rawSamples[0].phases).map((phase) => [ + phase, + summarize(rawSamples.map((sample) => sample.phases[phase])) + ]) + ), + rawSamples + } + ] + }) + ) +} + +async function runScenario(arms, transcriptPath, cwd, toolMiB, turnCount = TURN_COUNT) { + const history = createHistory(cwd, toolMiB, turnCount) + const append = createAppend(cwd, turnCount) + const historyBytes = Buffer.byteLength(history.content) + const appendBytes = Buffer.byteLength(append.content) + const samples = [] + for (const [round, order] of measurementSchedule(arms).entries()) { + let reference = null + for (const arm of order) { + const scanner = arms[arm].scanner + await writeFile(transcriptPath, history.content) + const cold = await measure(scanner, transcriptPath) + const warm = await measure(scanner, transcriptPath, cold.cache) + assert.deepEqual(warm.result, cold.result, 'warm scan differs from a fresh scan') + assert.equal(cold.result.sessions[0]?.turnCount, turnCount) + assert.equal(cold.result.processedFiles[0]?.lineCount, history.lineCount) + assert(cold.metrics.bytesRead >= historyBytes, 'cold scan skipped transcript bytes') + assert.equal(warm.metrics.bytesRead, 0, 'unchanged scan reread transcript bytes') + + await appendFile(transcriptPath, append.content) + const appended = await measure(scanner, transcriptPath, warm.cache) + const fresh = await measure(scanner, transcriptPath) + assert.deepEqual(appended.result, fresh.result, 'append scan differs from a fresh scan') + assert.equal(appended.result.sessions[0]?.turnCount, turnCount + NEW_TURN_COUNT) + assert.equal( + appended.result.sessions[0]?.totalInputTokens, + turnCount * 100 + Math.ceil(turnCount / 7) * 50 + 1_850 + NEW_TURN_COUNT * 100 + 125 + ) + assert.equal(appended.result.sessions[0]?.totalCacheReadTokens, 100) + assert.equal( + appended.result.dailyAggregates.reduce( + (sum, daily) => sum + daily.zeroCacheReadTurnCount, + 0 + ), + turnCount + NEW_TURN_COUNT - 2 + ) + assert.equal( + appended.result.processedFiles[0]?.lineCount, + history.lineCount + append.lineCount + ) + if (VERIFY && arm === 'current') { + assert( + appended.metrics.bytesRead <= appendBytes + 64 * 1024, + 'append reread transcript history' + ) + } + reference = recordRound( + samples, + { cold, warm, append: appended, freshAfterAppend: fresh }, + arm, + round, + order, + reference + ) + } + } + return { toolMiB, usageKeys: turnCount, historyBytes, appendBytes, arms: finishSamples(samples) } +} + +async function runSmallCorpus(arms, project, cwd) { + const directory = join(project, 'small-transcripts') + await mkdir(directory) + const files = Array.from({ length: 1_000 }, (_, index) => ({ + path: join(directory, `${String(index).padStart(4, '0')}.jsonl`), + prefix: usageRecord(cwd, index), + append: usageRecord(cwd, index, 200, 30) + })) + const paths = files.map((file) => file.path) + const historyBytes = files.reduce((sum, file) => sum + Buffer.byteLength(file.prefix), 0) + const appendBytes = files.reduce((sum, file) => sum + Buffer.byteLength(file.append), 0) + const samples = [] + try { + for (const [round, order] of measurementSchedule(arms).entries()) { + let reference = null + for (const arm of order) { + const scanner = arms[arm].scanner + for (let start = 0; start < files.length; start += 64) { + await Promise.all( + files.slice(start, start + 64).map((file) => writeFile(file.path, file.prefix)) + ) + } + const cold = await measure(scanner, paths) + const warm = await measure(scanner, paths, cold.cache) + assert.deepEqual(warm.result, cold.result) + assert.equal(cold.result.sessions[0]?.turnCount, files.length) + assert.equal(warm.metrics.bytesRead, 0) + for (let start = 0; start < files.length; start += 64) { + await Promise.all( + files.slice(start, start + 64).map((file) => appendFile(file.path, file.append)) + ) + } + const changed = await measure(scanner, paths, warm.cache) + const fresh = await measure(scanner, paths) + assert.deepEqual(changed.result, fresh.result) + assert.equal(changed.result.sessions[0]?.turnCount, files.length) + assert.equal(changed.result.sessions[0]?.totalInputTokens, files.length * 200) + if (VERIFY && arm === 'current') { + // A small snapshot needs its parse and one content recheck. + assert( + cold.metrics.bytesRead <= historyBytes * 2, + 'tiny cold files paid repeated checkpoint overhead' + ) + assert( + changed.metrics.bytesRead <= (historyBytes + appendBytes) * 2, + 'tiny changed files paid repeated checkpoint overhead' + ) + } + reference = recordRound( + samples, + { cold, warm, changed, freshAfterChange: fresh }, + arm, + round, + order, + reference + ) + } + } + return { + scenario: 'small-transcript-corpus', + files: files.length, + historyBytes, + appendBytes, + arms: finishSamples(samples) + } + } finally { + await rm(directory, { recursive: true, force: true }) + } +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-usage-append-benchmark-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const baseline = BASELINE || COMPARE ? await readClaudeUsageBenchmarkBaselineSources() : null + const names = BASELINE ? ['baseline'] : COMPARE ? ['baseline', 'current'] : ['current'] + const worktreeSources = new Map() + const arms = Object.fromEntries( + await Promise.all( + names.map(async (name) => [ + name, + await loadClaudeUsageBenchmarkScanner( + home, + name === 'baseline' ? baseline.sources : new Map(), + worktreeSources, + name === 'baseline' ? baseline.baselineCommit : null + ) + ]) + ) + ) + for (const { scanner } of Object.values(arms)) { + await verifyClaudeUsageBenchmarkReadAccounting(scanner, transcriptPath) + } + await rm(transcriptPath) + const processors = cpus() + console.log( + JSON.stringify({ + node: process.version, + nodeFlags: process.execArgv, + platform: process.platform, + osRelease: release(), + arch: process.arch, + cpuModel: processors[0]?.model, + cpuCount: processors.length, + timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, + rounds: ROUNDS, + verify: VERIFY, + mode: COMPARE ? 'compare' : names[0], + baselineRef: baseline?.baselineRef ?? null, + baselineCommit: baseline?.baselineCommit ?? null, + tooling: await describeClaudeUsageBenchmarkTooling(), + bundleSha256: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [name, arm.bundleSha256]) + ), + sourceFingerprints: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [name, arm.sourceFingerprints]) + ), + measurement: { + cold: 'scanner-cache cold; fixtures freshly written and page-cache warm', + durationMs: 'production scan only; excludes fixture I/O and cache serialization', + totalDurationMs: 'production scan plus cache stringify; excludes JSON.parse hydration', + bytesRead: 'raw filesystem API bytes including checkpoint windows; excludes metadata calls', + behaviorParity: + 'exact legacy per-file and aggregate projections; excludes mtime and additive cache metadata' + } + }) + ) + console.log(JSON.stringify(await runSmallCorpus(arms, project, cwd))) + const results = [] + for (const toolMiB of [2, 32]) { + const result = await runScenario(arms, transcriptPath, cwd, toolMiB) + results.push(result) + console.log(JSON.stringify({ scenario: 'history-scaling', ...result })) + } + const [small, large] = results + const scaling = Object.fromEntries( + names.map((arm) => [ + arm, + { + historyByteRatio: large.historyBytes / small.historyBytes, + appendReadByteRatio: + large.arms[arm].phases.append.bytesRead / small.arms[arm].phases.append.bytesRead, + appendDurationRatio: + large.arms[arm].phases.append.durationMs / small.arms[arm].phases.append.durationMs, + cachedStateByteRatio: + large.arms[arm].phases.append.cachedStateBytes / + small.arms[arm].phases.append.cachedStateBytes + } + ]) + ) + console.log(JSON.stringify({ scaling, exactColdParity: true, crossArmBehaviorParity: COMPARE })) + if (VERIFY) { + assert( + scaling.current.appendReadByteRatio <= 1.1, + 'append reads scale with raw transcript history' + ) + assert( + large.arms.current.phases.append.cachedStateBytes <= + small.arms.current.phases.append.cachedStateBytes + 512, + 'cache retained raw tool history' + ) + } + const keyResults = [large] + for (const usageKeys of [4_096, 16_384]) { + const result = await runScenario(arms, transcriptPath, cwd, 32, usageKeys) + keyResults.push(result) + console.log(JSON.stringify({ scenario: 'usage-key-scaling', ...result })) + } + console.log( + JSON.stringify({ + keyScaling: keyResults.map((result) => ({ + usageKeys: result.usageKeys, + historyBytes: result.historyBytes, + arms: Object.fromEntries(names.map((arm) => [arm, result.arms[arm].phases.append])) + })) + }) + ) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-benchmark-persistence.mjs b/config/scripts/claude-usage-benchmark-persistence.mjs new file mode 100644 index 00000000000..a6e3d71e229 --- /dev/null +++ b/config/scripts/claude-usage-benchmark-persistence.mjs @@ -0,0 +1,212 @@ +import assert from 'node:assert/strict' +import { createHash } from 'node:crypto' +import { readFile } from 'node:fs/promises' +import { dirname, extname, relative, sep } from 'node:path' +import { fileURLToPath } from 'node:url' +import { build, version } from 'esbuild' +import { runProcessSync } from '@orca/process-host' + +const ROOT = fileURLToPath(new URL('../..', import.meta.url)) +const MIB = 1024 * 1024 + +export function claudeBenchmarkSha256(value) { + return createHash('sha256').update(value).digest('hex') +} + +export function resolveClaudeBenchmarkCommit(ref) { + const result = runProcessSync({ + program: 'git', + args: ['rev-parse', '--verify', `${ref}^{commit}`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: MIB, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(result.code, 0, result.stderr) + return result.stdout.trim() +} + +function persistenceEntry(mode) { + const exports = [ + `export { UsageCacheSnapshotWriter } from './src/main/usage-cache-snapshot-writer';`, + `export { UsageProviderStoreLifecycle } from './src/main/usage/usage-provider-store-lifecycle';` + ] + if (mode === 'published') { + exports.push(`export { validatePersistedClaudeUsageProjections } + from './src/main/claude-usage/persisted-projection-validation';`) + } else if (mode === 'main') { + exports.push(`export { readUsageSourceCache as readSourceCache, + writeUsageSourceCache as writeSourceCache, splitUsageCacheFile as splitCacheFile } + from './src/main/usage/usage-source-cache-file';`) + } else { + exports.push(`export { readClaudeUsageSourceCache as readSourceCache, + writeClaudeUsageSourceCache as writeSourceCache, persistClaudeUsageSourceCache as persistSourceCache, + splitClaudeUsageCacheFile as splitCacheFile } + from './src/main/claude-usage/persisted-source-cache'; + export { parseClaudeUsageReport as parseReport, serializeClaudeUsageReport as serializeReport } + from './src/main/claude-usage/persisted-usage-report'; + export { encodeClaudeUsagePersistedState } + from './src/main/claude-usage/persisted-token-columns';`) + } + return exports.join('\n') +} + +const INACTIVE_LIFECYCLE_IMPORTS = new Map([ + [ + 'agent-token-usage-reporter', + 'export class AgentTokenUsageReporter { constructor() { throw new Error("Inactive telemetry reached"); } }' + ], + [ + 'analytics-session-id-store', + 'export class AnalyticsSessionIdStore { constructor() { throw new Error("Inactive analytics reached"); } }' + ], + ['telemetry/client', 'export const isTelemetryEnabled = () => false;'], + [ + 'usage-worktree-metadata', + 'export const loadKnownUsageWorktreesByRepo = () => { throw new Error("Startup accessed worktrees"); };' + ] +]) + +export async function loadClaudeUsageBenchmarkPersistence(mode, commit = null, frozen = new Map()) { + const sourceFingerprints = {} + const stubFingerprints = {} + const result = await build({ + stdin: { contents: persistenceEntry(mode), loader: 'ts', resolveDir: ROOT }, + platform: 'node', + format: 'esm', + bundle: true, + write: false, + plugins: [ + { + name: 'pinned-usage-persistence', + setup(bundler) { + bundler.onResolve( + { + filter: + /agent-token-usage-reporter$|analytics-session-id-store$|telemetry\/client$|usage-worktree-metadata$/ + }, + (args) => { + const match = [...INACTIVE_LIFECYCLE_IMPORTS.keys()].find((path) => + args.path.endsWith(path) + ) + return match ? { path: match, namespace: 'inactive-lifecycle' } : undefined + } + ) + bundler.onLoad({ filter: /.*/, namespace: 'inactive-lifecycle' }, (args) => { + const contents = INACTIVE_LIFECYCLE_IMPORTS.get(args.path) + stubFingerprints[args.path] = claudeBenchmarkSha256(contents) + return { contents, loader: 'js' } + }) + bundler.onLoad({ filter: /[/\\]src[/\\].*\.[cm]?[jt]sx?$/ }, async ({ path }) => { + const modulePath = relative(ROOT, path).split(sep).join('/') + if (!modulePath.startsWith('src/')) { + return undefined + } + if (!frozen.has(path)) { + if (typeof commit === 'string') { + const pinned = runProcessSync({ + program: 'git', + args: ['show', `${String(commit)}:${modulePath}`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: MIB, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(pinned.code, 0, pinned.stderr) + assert.equal(pinned.outputTruncated, false, modulePath) + frozen.set(path, pinned.stdout) + } else { + frozen.set(path, readFile(path, 'utf8')) + } + } + const contents = await frozen.get(path) + sourceFingerprints[modulePath] = { + source: commit ?? 'worktree', + sha256: claudeBenchmarkSha256(contents) + } + const extension = extname(path).slice(1) + const loader = + extension === 'tsx' || extension === 'jsx' + ? extension + : extension.endsWith('ts') + ? 'ts' + : 'js' + return { contents, loader, resolveDir: dirname(path) } + }) + } + } + ] + }) + const code = result.outputFiles[0].text + return { + module: await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`), + moduleUrl: `data:text/javascript;base64,${Buffer.from(code).toString('base64')}`, + bundleSha256: claudeBenchmarkSha256(code), + esbuildVersion: version, + sourceFingerprints: Object.fromEntries(Object.entries(sourceFingerprints).sort()), + stubFingerprints + } +} + +export function claudeBenchmarkState(result, schemaVersion = 6) { + return { + schemaVersion, + worktreeFingerprint: '[]', + processedFiles: result.processedFiles, + sessions: result.sessions, + dailyAggregates: result.dailyAggregates, + scanState: { enabled: false, lastScanStartedAt: 1, lastScanCompletedAt: 2, lastScanError: null } + } +} + +export function serializeClaudeBenchmarkReport(arm, state) { + if (arm.mode === 'current') { + return arm.persistence.module.serializeReport(state) + } + if (arm.mode === 'published') { + return JSON.stringify(state) + } + const { processedFiles: _sources, ...report } = state + return JSON.stringify(report) +} + +export function createClaudeBenchmarkStore(arm, cacheFile, splitCacheFile, parseReport) { + const implementation = arm.persistence.module + class BenchmarkStore extends implementation.UsageProviderStoreLifecycle { + constructor() { + super( + { getRepos: () => [], getAllWorktreeMeta: () => ({}) }, + { + logTag: '[claude-persistence-benchmark]', + resolveCacheFile: () => cacheFile, + createDefaultState: () => + claudeBenchmarkState( + { processedFiles: [], sessions: [], dailyAggregates: [] }, + arm.mode === 'current' ? 7 : 6 + ), + normalizeState: + arm.mode === 'published' + ? implementation.validatePersistedClaudeUsageProjections + : (state) => state, + sourceKey: 'processedFiles', + dataPresenceKey: 'hasAnyClaudeData', + scan: async () => { + throw new Error('Startup initiated a scan') + }, + splitCacheFile, + ...(arm.mode === 'current' + ? { + providerId: 'claude', + parseReport: parseReport ?? implementation.parseReport, + serializeReport: implementation.serializeReport + } + : {}) + } + ) + } + reportState() { + return this.state + } + } + return new BenchmarkStore() +} diff --git a/config/scripts/claude-usage-benchmark-readiness.mjs b/config/scripts/claude-usage-benchmark-readiness.mjs new file mode 100644 index 00000000000..231db6f3fed --- /dev/null +++ b/config/scripts/claude-usage-benchmark-readiness.mjs @@ -0,0 +1,179 @@ +import assert from 'node:assert/strict' +import { performance } from 'node:perf_hooks' +import { Worker } from 'node:worker_threads' +import { createClaudeBenchmarkStore } from './claude-usage-benchmark-persistence.mjs' + +export async function createClaudeBenchmarkSplitWorker(arm) { + const code = `const { parentPort } = require('node:worker_threads'); + const { performance } = require('node:perf_hooks'); + import(${JSON.stringify(arm.persistence.moduleUrl)}).then((implementation) => { + parentPort.on('message', async ({id, request}) => { + const start = performance.now(); + try { + const result = await implementation.splitCacheFile(request); + parentPort.postMessage({ id, result, workerMs: performance.now() - start }); + } catch (error) { + parentPort.postMessage({ id, error: String(error) }); + } + }); + parentPort.postMessage({ready:true}); + }).catch((error) => { throw error; });` + const worker = new Worker(code, { + eval: true, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + const waiting = new Map() + await new Promise((resolve, reject) => { + worker.once('error', reject) + worker.once('message', (message) => { + assert.equal(message.ready, true) + resolve() + }) + }) + worker.on('message', (message) => { + const pending = waiting.get(message.id) + if (!pending) { + return + } + waiting.delete(message.id) + if (message.error) { + pending.reject(new Error(message.error)) + } else { + pending.resolve(message) + } + }) + worker.on('error', (error) => { + for (const pending of waiting.values()) { + pending.reject(error) + } + waiting.clear() + }) + let id = 0 + return { + split: (request) => + new Promise((resolve, reject) => { + id += 1 + waiting.set(id, { resolve, reject }) + worker.postMessage({ id, request }) + }), + close: () => worker.terminate(), + bootstrapSha256Input: code + } +} + +export async function measureClaudeBenchmarkReadiness(arm, cacheFile, options = {}) { + let workerMs = 0 + let mainResumeAt = null + let mainParseAndValidationMs = 0 + let parseReportCalls = 0 + let mainJsonParseMs = 0 + let mainWorkerResponseJsonParseMs = 0 + let latestJsonParseMs = 0 + let productionYieldCount = 0 + const validationSegments = [] + let validationResumeAt = null + const originalImmediate = globalThis.setImmediate + const originalParse = JSON.parse + const originalWarn = console.warn + JSON.parse = (...args) => { + const started = performance.now() + const parsed = originalParse(...args) + latestJsonParseMs = performance.now() - started + mainJsonParseMs += latestJsonParseMs + if (mainResumeAt !== null) { + mainWorkerResponseJsonParseMs = performance.now() - mainResumeAt + } + return parsed + } + globalThis.setImmediate = (callback, ...args) => { + const validationYield = validationResumeAt !== null + if (validationYield) { + validationSegments.push(performance.now() - validationResumeAt) + validationResumeAt = null + productionYieldCount += 1 + } + return originalImmediate(() => { + if (validationYield) { + validationResumeAt = performance.now() + } + callback(...args) + }) + } + if (options.fallback) { + console.warn = () => {} + } + const split = async (request) => { + if (options.fallback) { + throw new Error('Intentional benchmark worker unavailability') + } + const reply = await options.worker.split(request) + workerMs += reply.workerMs + mainResumeAt = performance.now() + return reply.result + } + const parser = + arm.mode === 'current' + ? (text, parsed, verified) => { + parseReportCalls += 1 + validationResumeAt = performance.now() + const start = mainResumeAt ?? validationResumeAt + const result = arm.persistence.module.parseReport( + text, + parsed, + options.repeatMainVerification ? false : verified + ) + mainParseAndValidationMs += + performance.now() - start + (mainResumeAt === null ? latestJsonParseMs : 0) + if (!(result instanceof Promise)) { + validationResumeAt = null + } + return result + } + : undefined + let store + const started = performance.now() + try { + store = createClaudeBenchmarkStore(arm, cacheFile, split, parser) + const constructedAt = performance.now() + if (store.whenLoaded) { + await store.whenLoaded() + } + const readyAt = performance.now() + if (validationResumeAt !== null) { + validationSegments.push(readyAt - validationResumeAt) + } + validationResumeAt = null + const state = store.reportState() + const enabled = state.scanState.enabled + const output = { + constructorSyncMs: constructedAt - started, + whenLoadedMs: readyAt - started, + workerReadParseVerifyMigrateMs: workerMs, + mainParseAndValidationMs, + mainJsonParseMs, + mainWorkerResponseJsonParseMs, + maxObservedValidationSegmentMs: Math.max(0, ...validationSegments), + maxObservedMainSynchronousSegmentMs: Math.max( + constructedAt - started, + mainWorkerResponseJsonParseMs, + mainParseAndValidationMs, + ...validationSegments + ), + productionYieldCount, + parseReportCalls, + sessions: state.sessions.length, + mainRetainedSourceCount: state.processedFiles.length, + enabled + } + await store.flush() + return { metrics: output, state } + } finally { + validationResumeAt = null + globalThis.setImmediate = originalImmediate + JSON.parse = originalParse + console.warn = originalWarn + if (store) { + await store.flush() + } + } +} diff --git a/config/scripts/claude-usage-benchmark-scanner.mjs b/config/scripts/claude-usage-benchmark-scanner.mjs new file mode 100644 index 00000000000..a01cfffe3e6 --- /dev/null +++ b/config/scripts/claude-usage-benchmark-scanner.mjs @@ -0,0 +1,298 @@ +import assert from 'node:assert/strict' +import { createHash } from 'node:crypto' +import { readFile, writeFile } from 'node:fs/promises' +import { dirname, extname, join, relative, sep } from 'node:path' +import { performance } from 'node:perf_hooks' +import { fileURLToPath } from 'node:url' +import { build, version } from 'esbuild' + +const MIB = 1024 * 1024 +const ROOT = fileURLToPath(new URL('../..', import.meta.url)) +const BASELINE_MODULES = [ + 'src/main/claude-usage/scanner.ts', + 'src/main/claude-usage/transcript-record-parser.ts', + 'src/main/claude-usage/usage-aggregation.ts', + 'src/main/claude-usage/worktree-attribution.ts', + 'src/main/claude-usage/transcript-file-discovery.ts' +] + +export async function describeClaudeUsageBenchmarkTooling() { + const paths = [ + 'config/scripts/claude-usage-append-benchmark.mjs', + 'config/scripts/claude-usage-benchmark-scanner.mjs', + 'config/scripts/counterbalanced-benchmark-schedule.mjs', + 'src/packages/process-host/src/run-process.ts', + 'src/packages/process-host/dist/run-process.js' + ] + return { + esbuildVersion: version, + baselineModules: BASELINE_MODULES, + sha256: Object.fromEntries( + await Promise.all( + paths.map(async (path) => [ + path, + createHash('sha256') + .update(await readFile(join(ROOT, ...path.split('/')))) + .digest('hex') + ]) + ) + ) + } +} + +export async function readClaudeUsageBenchmarkBaselineSources() { + const { runProcessSync } = await import('@orca/process-host') + const readGit = (args) => { + const result = runProcessSync({ + program: 'git', + args, + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: MIB, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(result.code, 0, `Git baseline read failed: ${result.stderr}`) + return result.stdout + } + const baselineRef = process.env.ORCA_CLAUDE_USAGE_APPEND_BENCH_BASELINE ?? 'HEAD' + const baselineCommit = readGit(['rev-parse', '--verify', `${baselineRef}^{commit}`]).trim() + const sources = new Map( + BASELINE_MODULES.map((modulePath) => [ + join(ROOT, ...modulePath.split('/')), + readGit(['show', `${baselineCommit}:${modulePath}`]) + ]) + ) + return { baselineRef, baselineCommit, sources } +} + +export async function loadClaudeUsageBenchmarkScanner( + home, + baselineSources = new Map(), + worktreeSources = new Map(), + baselineCommit = null +) { + const sourceFingerprints = {} + const { runProcessSync } = await import('@orca/process-host') + const result = await build({ + stdin: { + contents: `export { scanClaudeUsageFiles } from './src/main/claude-usage/scanner'; + export { resetReadMetrics, readMetrics } from 'orca-benchmark-fs'; + export { open as openForBenchmark } from 'node:fs/promises'; + export { createReadStream as createReadStreamForBenchmark } from 'node:fs';`, + resolveDir: ROOT, + loader: 'ts' + }, + platform: 'node', + format: 'esm', + bundle: true, + write: false, + plugins: [ + { + name: 'isolated-transcript-filesystem', + setup(bundler) { + bundler.onLoad({ filter: /[/\\]src[/\\].*\.[cm]?[jt]sx?$/ }, async (args) => { + const modulePath = relative(ROOT, args.path).split(sep).join('/') + if (!modulePath.startsWith('src/')) { + return undefined + } + if (typeof baselineCommit === 'string' && !baselineSources.has(args.path)) { + const pinned = runProcessSync({ + program: 'git', + args: ['show', `${String(baselineCommit)}:${modulePath}`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: MIB, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(pinned.code, 0, `Pinned source read failed: ${pinned.stderr}`) + assert.equal(pinned.outputTruncated, false, `Pinned source truncated: ${modulePath}`) + baselineSources.set(args.path, pinned.stdout) + } + if (!baselineSources.has(args.path) && !worktreeSources.has(args.path)) { + worktreeSources.set(args.path, readFile(args.path, 'utf8')) + } + const contents = + baselineSources.get(args.path) ?? (await worktreeSources.get(args.path)) + sourceFingerprints[modulePath] = { + source: baselineSources.has(args.path) + ? (baselineCommit ?? 'baseline-map') + : 'worktree', + sha256: createHash('sha256').update(contents).digest('hex') + } + const extension = extname(args.path).slice(1) + const loader = + extension === 'tsx' || extension === 'jsx' + ? extension + : extension.endsWith('ts') + ? 'ts' + : 'js' + return { contents, loader, resolveDir: dirname(args.path) } + }) + bundler.onResolve( + { filter: /^node:(fs(?:\/promises)?|os)$|^orca-benchmark-fs$/ }, + (args) => { + if (args.path === 'orca-benchmark-fs') { + return { path: 'node:fs', namespace: 'benchmark' } + } + if (args.namespace === 'benchmark') { + return { path: args.path, external: true } + } + return { path: args.path, namespace: 'benchmark' } + } + ) + bundler.onResolve({ filter: /claude-profile-installed-router$/ }, () => ({ + path: 'profiles', + namespace: 'benchmark' + })) + bundler.onLoad({ filter: /.*/, namespace: 'benchmark' }, (args) => { + if (args.path === 'profiles') { + return { contents: 'export const claudeProfileHistoryDirs = () => [];' } + } + if (args.path === 'node:os') { + return { + contents: `export * from 'node:os'; + export const homedir = () => ${JSON.stringify(home)};` + } + } + if (args.path === 'node:fs/promises') { + return { + contents: `import * as fs from 'node:fs/promises'; + import { recordStream, recordRead } from 'orca-benchmark-fs'; + export * from 'node:fs/promises'; + export function readFile() { + throw new Error('Extend benchmark accounting before using fs.promises.readFile'); + } + export async function open(path, ...args) { + const handle = await fs.open(path, ...args); + return new Proxy(handle, { + get(target, key) { + if (key === 'readFile' || key === 'readv') { + throw new Error('Extend benchmark accounting before using FileHandle.' + key); + } + const value = Reflect.get(target, key, target); + if (key === 'createReadStream') { + return (options) => recordStream(path, options, value.call(target, options)); + } + if (key === 'read') { + return async (...readArgs) => { + const result = await value.apply(target, readArgs); + const options = Buffer.isBuffer(readArgs[0]) ? null : readArgs[0]; + recordRead(path, options?.position ?? readArgs[3] ?? null, result.bytesRead); + return result; + }; + } + return typeof value === 'function' ? value.bind(target) : value; + } + }); + }` + } + } + return { + contents: `import * as fs from 'node:fs'; + export * from 'node:fs'; + let reads = []; + export function readFile() { + throw new Error('Extend benchmark accounting before using fs.readFile'); + } + export function readFileSync() { + throw new Error('Extend benchmark accounting before using fs.readFileSync'); + } + export function recordStream(path, options, stream) { + reads.push({ stream, kind: 'stream', path: String(path), start: options?.start ?? 0, + end: options?.end ?? null }); + return stream; + } + export function recordRead(path, start, bytes) { + reads.push({ kind: 'read', path: String(path), start, bytes }); + } + export function createReadStream(path, options) { + return recordStream(path, options, fs.createReadStream(path, options)); + } + export function resetReadMetrics() { reads = []; } + export function readMetrics() { + return reads.map(({ stream, ...range }) => ({ ...range, bytes: stream?.bytesRead ?? range.bytes })); + }` + } + }) + } + } + ] + }) + return { + bundleSha256: createHash('sha256').update(result.outputFiles[0].text).digest('hex'), + scanner: await import( + `data:text/javascript;base64,${Buffer.from(result.outputFiles[0].text).toString('base64')}` + ), + sourceFingerprints: Object.fromEntries( + Object.entries(sourceFingerprints).sort(([left], [right]) => left.localeCompare(right)) + ) + } +} + +export async function verifyClaudeUsageBenchmarkReadAccounting(scanner, transcriptPath) { + const payload = Buffer.from('工具結果 🌊'.repeat(5_000)) + await writeFile(transcriptPath, payload) + scanner.resetReadMetrics() + const handle = await scanner.openForBenchmark(transcriptPath, 'r') + try { + await handle.read(Buffer.alloc(11), 0, 11, 1) + const stream = handle.createReadStream({ start: 0, end: payload.length - 1, autoClose: false }) + for await (const chunk of stream) { + void chunk + } + const reads = scanner.readMetrics() + assert.equal( + reads.reduce((sum, read) => sum + read.bytes, 0), + payload.length + 11 + ) + assert.equal(reads.filter((read) => read.kind === 'read').length, 1) + assert.equal(reads.filter((read) => read.kind === 'stream').length, 1) + } finally { + await handle.close() + } + for await (const chunk of scanner.createReadStreamForBenchmark(transcriptPath)) { + void chunk + } + assert.equal( + scanner.readMetrics().reduce((sum, read) => sum + read.bytes, 0), + payload.length * 2 + 11 + ) +} + +export async function measureClaudeUsageBenchmarkScan( + scanner, + transcriptPaths, + previousProcessedFiles = [] +) { + scanner.resetReadMetrics() + const start = performance.now() + const result = await scanner.scanClaudeUsageFiles([], previousProcessedFiles, undefined, []) + const durationMs = performance.now() - start + const reads = scanner.readMetrics() + const allowedPaths = new Set( + typeof transcriptPaths === 'string' ? [transcriptPaths] : transcriptPaths + ) + assert( + reads.every((read) => allowedPaths.has(read.path)), + 'scanner read an unexpected file' + ) + const serializationStart = performance.now() + const serializedCache = JSON.stringify(result.processedFiles) + const cacheSerializationMs = performance.now() - serializationStart + return { + result, + cache: JSON.parse(serializedCache), + metrics: { + durationMs, + cacheSerializationMs, + totalDurationMs: durationMs + cacheSerializationMs, + bytesRead: reads.reduce((sum, read) => sum + read.bytes, 0), + directReadBytes: reads + .filter((read) => read.kind === 'read') + .reduce((sum, read) => sum + read.bytes, 0), + readCount: reads.length, + streamCount: reads.filter((read) => read.kind === 'stream').length, + cachedStateBytes: Buffer.byteLength(serializedCache) + } + } +} diff --git a/config/scripts/claude-usage-cache-representation-check.mjs b/config/scripts/claude-usage-cache-representation-check.mjs new file mode 100644 index 00000000000..f7235701f44 --- /dev/null +++ b/config/scripts/claude-usage-cache-representation-check.mjs @@ -0,0 +1,162 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { appendFile, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { createHash } from 'node:crypto' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { parseArgs } from 'node:util' +import { runProcessSync } from '@orca/process-host' +import { + loadClaudeUsageBenchmarkScanner, + readClaudeUsageBenchmarkBaselineSources +} from './claude-usage-benchmark-scanner.mjs' + +const ROOT = fileURLToPath(new URL('../..', import.meta.url)) +const STORE_PATH = 'src/main/claude-usage/store.ts' +const { values } = parseArgs({ + options: { + 'baseline-ref': { type: 'string', default: '51e7181850b022bae2d41091fe1229accef4bd50' }, + 'usage-keys': { type: 'string', default: '16384' }, + output: { type: 'string' } + } +}) +const usageKeys = Number(values['usage-keys']) +assert( + Number.isSafeInteger(usageKeys) && usageKeys > 7, + 'usage-keys must be an integer above seven' +) +process.env.ORCA_CLAUDE_USAGE_APPEND_BENCH_BASELINE = values['baseline-ref'] + +function serializationIndent(source) { + const indent = /jsonIndent:\s*(\d+)/.exec(source) + return indent ? Number(indent[1]) : undefined +} + +function sourceHash(source) { + return createHash('sha256').update(source).digest('hex') +} + +function persistedState(result) { + return { + schemaVersion: 6, + worktreeFingerprint: '[]', + processedFiles: result.processedFiles, + sessions: result.sessions, + dailyAggregates: result.dailyAggregates, + scanState: { + enabled: true, + lastScanStartedAt: 1, + lastScanCompletedAt: 2, + lastScanError: null + } + } +} + +function usageRecord(cwd, index, inputTokens = 100) { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: inputTokens, + output_tokens: 10, + cache_read_input_tokens: 0, + cache_creation_input_tokens: 20, + cache_creation: { ephemeral_1h_input_tokens: 5 } + } + } + })}\n` +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-cache-representation-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const history = Array.from({ length: usageKeys }, (_, index) => usageRecord(cwd, index)).join('') + const baseline = await readClaudeUsageBenchmarkBaselineSources() + const storeRead = runProcessSync({ + program: 'git', + args: ['show', `${baseline.baselineCommit}:${STORE_PATH}`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: 1024 * 1024, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(storeRead.code, 0, storeRead.stderr) + const currentStore = await readFile(join(ROOT, ...STORE_PATH.split('/')), 'utf8') + const stores = { baseline: storeRead.stdout, current: currentStore } + const loaded = await Promise.all([ + loadClaudeUsageBenchmarkScanner(home, baseline.sources, new Map(), baseline.baselineCommit), + loadClaudeUsageBenchmarkScanner(home) + ]) + const arms = {} + const results = [] + for (const [index, arm] of ['baseline', 'current'].entries()) { + const { scanner, bundleSha256, sourceFingerprints } = loaded[index] + await writeFile(transcriptPath, history) + const cold = await scanner.scanClaudeUsageFiles([], [], undefined, []) + await appendFile(transcriptPath, usageRecord(cwd, 7, 2_000)) + const result = await scanner.scanClaudeUsageFiles( + [], + JSON.parse(JSON.stringify(cold.processedFiles)), + undefined, + [] + ) + const fresh = await scanner.scanClaudeUsageFiles([], [], undefined, []) + assert.deepEqual(result, fresh, `${arm} resume differs from a fresh scan`) + assert.equal(result.processedFiles[0].ownedDedupeKeys.length, usageKeys) + assert.equal(result.sessions[0].totalInputTokens, usageKeys * 100 + 1_900) + const state = persistedState(result) + const compact = JSON.stringify(state) + const indented = JSON.stringify(state, null, 2) + const indent = serializationIndent(stores[arm]) + assert.deepEqual(JSON.parse(compact), JSON.parse(indented)) + assert.deepEqual(structuredClone(state), state) + arms[arm] = { + compactFullStateBytes: Buffer.byteLength(compact), + indentedFullStateBytes: Buffer.byteLength(indented), + productionFullStateBytes: Buffer.byteLength(JSON.stringify(state, null, indent)), + productionIndent: indent ?? null, + storeSha256: sourceHash(stores[arm]), + ownedKeys: result.processedFiles[0].ownedDedupeKeys.length, + bundleSha256, + sourceFingerprints + } + results.push(result) + } + assert.deepEqual(results[0].sessions, results[1].sessions) + assert.deepEqual(results[0].dailyAggregates, results[1].dailyAggregates) + const report = { + purpose: 'Actual scanner cache representation byte counts; no timing or peak-memory claim.', + node: process.version, + platform: process.platform, + arch: process.arch, + baselineRef: baseline.baselineRef, + baselineCommit: baseline.baselineCommit, + usageKeys, + historyBytes: Buffer.byteLength(history), + stateFields: 'schema v6; source cache, session/daily projections and fixed scan-state metadata', + exactColdParity: true, + crossArmProjectionParity: true, + serializationParity: true, + structuredCloneParity: true, + toolingSha256: sourceHash(await readFile(import.meta.filename)), + arms + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-discovery-coverage-check.mjs b/config/scripts/claude-usage-discovery-coverage-check.mjs new file mode 100644 index 00000000000..96b98784323 --- /dev/null +++ b/config/scripts/claude-usage-discovery-coverage-check.mjs @@ -0,0 +1,127 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { createHash } from 'node:crypto' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { parseArgs } from 'node:util' +import { + loadClaudeUsageBenchmarkScanner, + readClaudeUsageBenchmarkBaselineSources +} from './claude-usage-benchmark-scanner.mjs' + +const { values } = parseArgs({ + options: { + 'baseline-ref': { type: 'string', default: '51e7181850b022bae2d41091fe1229accef4bd50' }, + output: { type: 'string' } + } +}) +process.env.ORCA_CLAUDE_USAGE_APPEND_BENCH_BASELINE = values['baseline-ref'] + +function writeReport(report) { + console.log(JSON.stringify(report)) + return values.output + ? writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + : Promise.resolve() +} + +if (process.platform === 'win32' || process.getuid?.() === 0) { + await writeReport({ + purpose: 'Real filesystem permission denial check.', + skipped: true, + reason: + process.platform === 'win32' + ? 'POSIX chmod does not deny Windows ACL access; mocked EACCES contracts cover Windows.' + : 'Root can read chmod-denied directories; mocked EACCES contracts cover privileged runs.', + platform: process.platform + }) +} else { + const home = await mkdtemp(join(tmpdir(), 'orca-claude-discovery-coverage-')) + const denied = join(home, '.claude', 'projects', 'denied') + try { + const project = join(home, '.claude', 'projects', 'valid') + await mkdir(project, { recursive: true }) + await mkdir(denied) + await writeFile( + join(project, 'session.jsonl'), + `${JSON.stringify({ + type: 'assistant', + sessionId: 'session', + timestamp: '2026-10-09T00:00:00Z', + message: { id: 'message', usage: { input_tokens: 10, output_tokens: 1 } } + })}\n` + ) + const baseline = await readClaudeUsageBenchmarkBaselineSources() + const loaded = await Promise.all([ + loadClaudeUsageBenchmarkScanner(home, baseline.sources, new Map(), baseline.baselineCommit), + loadClaudeUsageBenchmarkScanner(home) + ]) + const arms = {} + for (const [index, arm] of ['baseline', 'current'].entries()) { + const { scanner, bundleSha256, sourceFingerprints } = loaded[index] + const complete = await scanner.scanClaudeUsageFiles([], [], undefined, []) + assert.equal(complete.processedFiles.length, 1) + await chmod(denied, 0) + let outcome + try { + const result = await scanner.scanClaudeUsageFiles( + [], + complete.processedFiles, + undefined, + [] + ) + outcome = { + resolved: true, + processedFiles: result.processedFiles.length, + sessions: result.sessions.length + } + } catch (error) { + outcome = { + resolved: false, + code: error.code ?? null, + message: error.message.replace(home, '') + } + } finally { + await chmod(denied, 0o700) + } + const recovered = await scanner.scanClaudeUsageFiles( + [], + complete.processedFiles, + undefined, + [] + ) + assert.deepEqual(recovered.sessions, complete.sessions) + arms[arm] = { + baselineProcessedFiles: complete.processedFiles.length, + outcome, + recoveredProcessedFiles: recovered.processedFiles.length, + bundleSha256, + sourceFingerprints + } + } + assert.deepEqual(arms.baseline.outcome, { resolved: true, processedFiles: 0, sessions: 0 }) + assert.equal( + arms.current.outcome.resolved, + false, + 'unreadable history must not publish empty totals' + ) + assert.equal(arms.current.outcome.code, 'EACCES') + await writeReport({ + purpose: 'Actual bundled scanner under a real unreadable sibling directory; no timing claim.', + node: process.version, + platform: process.platform, + arch: process.arch, + baselineRef: baseline.baselineRef, + baselineCommit: baseline.baselineCommit, + existingCacheSupplied: true, + exactRecoveryParity: true, + toolingSha256: createHash('sha256') + .update(await readFile(import.meta.filename)) + .digest('hex'), + arms + }) + } finally { + await chmod(denied, 0o700).catch(() => {}) + await rm(home, { recursive: true, force: true }) + } +} diff --git a/config/scripts/claude-usage-hardening-cost-benchmark.mjs b/config/scripts/claude-usage-hardening-cost-benchmark.mjs new file mode 100644 index 00000000000..3e05a5ed52a --- /dev/null +++ b/config/scripts/claude-usage-hardening-cost-benchmark.mjs @@ -0,0 +1,316 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { appendFile, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { createHash } from 'node:crypto' +import { cpus, tmpdir } from 'node:os' +import { dirname, join, relative, sep } from 'node:path' +import { performance } from 'node:perf_hooks' +import { parseArgs } from 'node:util' +import { build } from 'esbuild' +import { buildCounterbalancedSchedule } from './counterbalanced-benchmark-schedule.mjs' +import { runProcessSync } from '@orca/process-host' +import { + loadClaudeUsageBenchmarkScanner, + readClaudeUsageBenchmarkBaselineSources +} from './claude-usage-benchmark-scanner.mjs' + +const ROOT = join(import.meta.dirname, '../..') +const { values } = parseArgs({ + options: { + 'baseline-ref': { type: 'string', default: '51e7181850b022bae2d41091fe1229accef4bd50' }, + 'usage-keys': { type: 'string', default: '16384' }, + rounds: { type: 'string', default: '8' }, + output: { type: 'string' } + } +}) +const usageKeys = Number(values['usage-keys']) +const rounds = Number(values.rounds) +assert(Number.isSafeInteger(usageKeys) && usageKeys > 7) +assert(Number.isSafeInteger(rounds) && rounds > 0 && rounds % 2 === 0) +process.env.ORCA_CLAUDE_USAGE_APPEND_BENCH_BASELINE = values['baseline-ref'] + +function sha256(source) { + return createHash('sha256').update(source).digest('hex') +} + +function productionIndent(source) { + const match = /jsonIndent:\s*(\d+)/.exec(source) + return match ? Number(match[1]) : undefined +} + +function persistedState(result) { + return { + schemaVersion: 6, + worktreeFingerprint: '[]', + processedFiles: result.processedFiles, + sessions: result.sessions, + dailyAggregates: result.dailyAggregates, + scanState: { + enabled: true, + lastScanStartedAt: 1, + lastScanCompletedAt: 2, + lastScanError: null + } + } +} + +function usageRecord(cwd, index, maximaPattern, correction = false) { + const unique = maximaPattern === 'unique-maxima' + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: correction ? 2_000 : 100 + (unique ? index : 0), + output_tokens: 10 + (unique ? index : 0), + cache_read_input_tokens: unique ? index : 0, + cache_creation_input_tokens: 20 + (unique ? index : 0), + cache_creation: { ephemeral_1h_input_tokens: 5 + (unique ? index : 0) } + } + } + })}\n` +} + +async function loadValidation(frozenSources) { + const fingerprints = {} + const bundled = await build({ + stdin: { + contents: `export { validatePersistedClaudeUsageProjections } from './src/main/claude-usage/persisted-projection-validation'; + export { buildClaudeUsageProjectionIntegrity } from './src/main/claude-usage/transcript-projection-integrity'; + export { hasClaudeUsageResumeProjection } from './src/main/claude-usage/transcript-resume-projection';`, + loader: 'ts', + resolveDir: ROOT + }, + platform: 'node', + format: 'esm', + bundle: true, + write: false, + plugins: [ + { + name: 'frozen-validation-source', + setup(bundler) { + bundler.onLoad({ filter: /[/\\]src[/\\].*\.ts$/ }, async ({ path }) => { + if (!frozenSources.has(path)) { + frozenSources.set(path, readFile(path, 'utf8')) + } + const contents = await frozenSources.get(path) + fingerprints[relative(ROOT, path).split(sep).join('/')] = sha256(contents) + return { contents, loader: 'ts', resolveDir: dirname(path) } + }) + } + } + ] + }) + const code = bundled.outputFiles[0].text + return { + module: await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`), + bundleSha256: sha256(code), + sourceFingerprints: fingerprints + } +} + +function measureSerialization(result, indent, validation) { + const state = persistedState(result) + const start = performance.now() + const serialized = JSON.stringify(state, null, indent) + const serializedAt = performance.now() + const parsed = JSON.parse(serialized) + const parsedAt = performance.now() + const loaded = validation ? validation.validatePersistedClaudeUsageProjections(parsed) : parsed + const validatedAt = performance.now() + assert.deepEqual(loaded.sessions, result.sessions) + assert.deepEqual(loaded.dailyAggregates, result.dailyAggregates) + return { + cache: parsed.processedFiles, + metrics: { + productionStateBytes: Buffer.byteLength(serialized), + serializeMs: serializedAt - start, + parseMs: parsedAt - serializedAt, + loadValidationMs: validatedAt - parsedAt, + totalLoadMs: validatedAt - serializedAt + } + } +} + +function median(values) { + const sorted = [...values].sort((a, b) => a - b) + const middle = sorted.length / 2 + return (sorted[middle - 1] + sorted[middle]) / 2 +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-hardening-cost-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const baseline = await readClaudeUsageBenchmarkBaselineSources() + const storeRead = runProcessSync({ + program: 'git', + args: ['show', `${baseline.baselineCommit}:src/main/claude-usage/store.ts`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: 1024 * 1024, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(storeRead.code, 0, storeRead.stderr) + const currentStore = await readFile(join(ROOT, 'src/main/claude-usage/store.ts'), 'utf8') + const frozenSources = new Map() + const [oldScanner, currentScanner] = await Promise.all([ + loadClaudeUsageBenchmarkScanner(home, baseline.sources, new Map(), baseline.baselineCommit), + loadClaudeUsageBenchmarkScanner(home, new Map(), frozenSources) + ]) + const validation = await loadValidation(frozenSources) + const arms = { + baseline: { ...oldScanner, indent: productionIndent(storeRead.stdout) }, + current: { ...currentScanner, indent: productionIndent(currentStore) } + } + const scenarios = [] + for (const maximaPattern of ['repeated-maxima', 'unique-maxima']) { + const history = Array.from({ length: usageKeys }, (_, index) => + usageRecord(cwd, index, maximaPattern) + ).join('') + const suffix = usageRecord(cwd, 7, maximaPattern, true) + const samples = [] + for (const arm of Object.values(arms)) { + await writeFile(transcriptPath, history) + const warmup = await arm.scanner.scanClaudeUsageFiles([], [], undefined, []) + measureSerialization(warmup, arm.indent, arm === arms.current ? validation.module : null) + } + for (const [round, order] of buildCounterbalancedSchedule( + rounds, + 'baseline', + 'current' + ).entries()) { + let reference + for (const name of order) { + const arm = arms[name] + const check = name === 'current' ? validation.module : null + await writeFile(transcriptPath, history) + const started = performance.now() + const cold = await arm.scanner.scanClaudeUsageFiles([], [], undefined, []) + const coldAt = performance.now() + const coldState = measureSerialization(cold, arm.indent, check) + await appendFile(transcriptPath, suffix) + arm.scanner.resetReadMetrics() + const appendStart = performance.now() + const appended = await arm.scanner.scanClaudeUsageFiles([], coldState.cache, undefined, []) + const appendAt = performance.now() + const appendBytesRead = arm.scanner.readMetrics().reduce((sum, read) => sum + read.bytes, 0) + const appendedState = measureSerialization(appended, arm.indent, check) + const fresh = await arm.scanner.scanClaudeUsageFiles([], [], undefined, []) + assert.deepEqual(appended, fresh) + const projection = { + sessions: appended.sessions, + dailyAggregates: appended.dailyAggregates + } + if (reference) { + assert.deepEqual(projection, reference) + } + reference = projection + let integrityBuildMs = 0 + let integrityValidateMs = 0 + if (check) { + const file = appended.processedFiles[0] + const buildStart = performance.now() + const integrity = check.buildClaudeUsageProjectionIntegrity(file) + const builtAt = performance.now() + const valid = check.hasClaudeUsageResumeProjection(file) + const validatedAt = performance.now() + assert.equal(integrity, file.parseResumeState.projectionIntegrity) + assert.equal(valid, true) + integrityBuildMs = builtAt - buildStart + integrityValidateMs = validatedAt - builtAt + } + samples.push({ + arm: name, + round: round + 1, + order, + metrics: { + coldScanMs: coldAt - started, + coldTotalLoadMs: coldState.metrics.totalLoadMs, + appendScanMs: appendAt - appendStart, + appendScanAndPersistSerializationMs: + appendAt - appendStart + appendedState.metrics.serializeMs, + appendBytesRead, + ...appendedState.metrics, + integrityBuildMs, + integrityValidateMs + } + }) + } + } + scenarios.push({ + maximaPattern, + usageKeys, + historyBytes: Buffer.byteLength(history), + appendBytes: Buffer.byteLength(suffix), + arms: Object.fromEntries( + Object.keys(arms).map((name) => { + const rawSamples = samples.filter((sample) => sample.arm === name) + return [ + name, + { + medians: Object.fromEntries( + Object.keys(rawSamples[0].metrics).map((metric) => [ + metric, + Number(median(rawSamples.map((sample) => sample.metrics[metric])).toFixed(3)) + ]) + ), + rawSamples + } + ] + }) + ) + }) + } + const report = { + purpose: + 'Counterbalanced actual scanner and synchronous production cache-load costs after hardening.', + node: process.version, + platform: process.platform, + arch: process.arch, + cpuModel: cpus()[0]?.model, + rounds, + baselineCommit: baseline.baselineCommit, + methodology: { + fixture: + 'Fresh temporary transcripts with page-cache-warm I/O; source-cache cold before each round.', + timing: + 'Scanner timings include checkpoint build/verify. Serialization follows actual store indent. Load includes JSON.parse and current on-load integrity validation; fs cache read/durable write are excluded.', + integrityTiming: + 'Separate actual checksum build and full checkpoint validation calls after parity checks; these are diagnostic components, not additional production scan cost.', + correctness: + 'Exact append/fresh parity each arm, cross-arm sessions/daily equality, and loaded aggregate equality.' + }, + toolingSha256: sha256(await readFile(import.meta.filename)), + storeSha256: { baseline: sha256(storeRead.stdout), current: sha256(currentStore) }, + scannerSources: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [ + name, + { + bundleSha256: arm.bundleSha256, + sourceFingerprints: arm.sourceFingerprints + } + ]) + ), + validationSources: { + bundleSha256: validation.bundleSha256, + sourceFingerprints: validation.sourceFingerprints + }, + scenarios + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-persisted-bytes-check.mjs b/config/scripts/claude-usage-persisted-bytes-check.mjs new file mode 100644 index 00000000000..1192686881b --- /dev/null +++ b/config/scripts/claude-usage-persisted-bytes-check.mjs @@ -0,0 +1,215 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { gunzipSync } from 'node:zlib' +import { appendFile, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { parseArgs } from 'node:util' +import { runProcessSync } from '@orca/process-host' +import { loadClaudeUsageBenchmarkScanner } from './claude-usage-benchmark-scanner.mjs' +import { + claudeBenchmarkSha256, + claudeBenchmarkState, + loadClaudeUsageBenchmarkPersistence, + resolveClaudeBenchmarkCommit, + serializeClaudeBenchmarkReport +} from './claude-usage-benchmark-persistence.mjs' + +const ROOT = join(import.meta.dirname, '../..') +const { values } = parseArgs({ options: { output: { type: 'string' } } }) +const refs = { + original: resolveClaudeBenchmarkCommit('51e7181850b022bae2d41091fe1229accef4bd50'), + published: resolveClaudeBenchmarkCommit('8467877ed92aba2ef59737aebf461e9cab52c273'), + main: resolveClaudeBenchmarkCommit('b44a5796c1154de84efa25cc09f3dae2b61eb4b5'), + current: null +} + +function record(cwd, index, usageKeys, unique, correction = false) { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: correction ? usageKeys + 2_000 : 100 + (unique ? index : 0), + output_tokens: 10 + (unique ? index : 0), + cache_read_input_tokens: unique ? index : 0, + cache_creation_input_tokens: 20 + (unique ? index : 0), + cache_creation: { ephemeral_1h_input_tokens: 5 + (unique ? index : 0) } + } + } + })}\n` +} + +function readStore(mode, commit) { + if (!commit) { + return readFile(join(ROOT, 'src/main/claude-usage/store.ts'), 'utf8') + } + const result = runProcessSync({ + program: 'git', + args: ['show', `${commit}:src/main/claude-usage/store.ts`], + cwd: ROOT, + timeoutMs: 10_000, + maxOutputBytes: 1024 * 1024, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' } + }) + assert.equal(result.code, 0, `${mode}: ${result.stderr}`) + return result.stdout +} + +function fileComponents(file) { + const bytes = (value) => Buffer.byteLength(JSON.stringify(value)) + const checkpoint = file.parseResumeState + return { + fileBytes: bytes(file), + ownedKeyListBytes: bytes(file.ownedDedupeKeys), + tokenColumnsBytes: checkpoint?.ownedTokenColumns ? bytes(checkpoint.ownedTokenColumns) : null, + tokenRowsBytes: checkpoint?.ownedTokenMaxima ? bytes(checkpoint.ownedTokenMaxima) : null, + columnValueCounts: + checkpoint?.ownedTokenColumns?.map((column) => (Array.isArray(column) ? column.length : 1)) ?? + null, + projectionCount: checkpoint?.projections?.length ?? null + } +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-persisted-bytes-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const arms = {} + for (const mode of Object.keys(refs)) { + const sources = new Map() + const scanner = await loadClaudeUsageBenchmarkScanner(home, new Map(), sources, refs[mode]) + const persistence = + mode === 'original' + ? null + : await loadClaudeUsageBenchmarkPersistence(mode, refs[mode], sources) + const store = await readStore(mode, refs[mode]) + const indent = /jsonIndent:\s*(\d+)/.exec(store) + arms[mode] = { + mode, + scanner, + persistence, + indent: indent ? Number(indent[1]) : undefined, + storeSha256: claudeBenchmarkSha256(store) + } + } + const scenarios = [] + for (const [usageKeys, unique] of [ + [16384, false], + [100000, true] + ]) { + const history = Array.from({ length: usageKeys }, (_, index) => + record(cwd, index, usageKeys, unique) + ).join('') + const suffix = record(cwd, 7, usageKeys, unique, true) + let reference + const measurements = {} + for (const [name, arm] of Object.entries(arms)) { + await writeFile(transcriptPath, history) + const cold = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + let previous = { sources: cold.processedFiles } + const sourceRef = { + path: join(home, `${name}-sources.json`), + schemaVersion: name === 'current' ? 7 : 6, + worktreeFingerprint: '[]', + reuse: true + } + if (arm.persistence && name !== 'published') { + await arm.persistence.module.writeSourceCache(sourceRef, cold.processedFiles) + const loaded = await arm.persistence.module.readSourceCache(sourceRef) + previous = name === 'current' ? loaded : { sources: loaded } + } + await appendFile(transcriptPath, suffix) + const result = await arm.scanner.scanner.scanClaudeUsageFiles( + [], + previous.sources, + undefined, + [], + previous.verifiedSources + ) + const fresh = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + assert.deepEqual(result, fresh) + const projection = { sessions: result.sessions, dailyAggregates: result.dailyAggregates } + reference ??= projection + assert.deepEqual(projection, reference) + assert.equal(result.processedFiles[0].ownedDedupeKeys.length, usageKeys) + const state = claudeBenchmarkState(result, name === 'current' ? 7 : 6) + let reportText + let sourceText = null + let savedFile = result.processedFiles[0] + if (name === 'original' || name === 'published') { + reportText = JSON.stringify(state, null, arm.indent) + } else { + await arm.persistence.module.writeSourceCache(sourceRef, result.processedFiles) + sourceText = await readFile(sourceRef.path) + const decoded = + sourceText[0] === 0x1f && sourceText[1] === 0x8b ? gunzipSync(sourceText) : sourceText + savedFile = JSON.parse(decoded.toString('utf8')).sources[0] + reportText = serializeClaudeBenchmarkReport(arm, state) + } + measurements[name] = { + sourceBytes: sourceText ? Buffer.byteLength(sourceText) : 0, + reportBytes: Buffer.byteLength(reportText), + totalPersistedBytes: + (sourceText ? Buffer.byteLength(sourceText) : 0) + Buffer.byteLength(reportText), + productionIndent: arm.indent ?? null, + sourceComponents: fileComponents(savedFile) + } + } + scenarios.push({ + usageKeys, + maximaPattern: unique ? 'unique' : 'repeated', + historyBytes: Buffer.byteLength(history), + suffixBytes: Buffer.byteLength(suffix), + fixtureSha256: claudeBenchmarkSha256(history), + measurements + }) + } + const report = { + purpose: + 'Four-arm actual production persistence bytes and dominant cache fields; no timing claim.', + node: process.version, + platform: process.platform, + arch: process.arch, + exactColdParity: true, + crossArmProjectionParity: true, + methodology: + 'Original/published use their actual store indentation and full-state layout. Fixed main/current use their production source writers and report serializers. Source component lengths exclude enclosing property names and are diagnostic, not additive file sizes.', + toolingSha256: claudeBenchmarkSha256(await readFile(import.meta.filename)), + arms: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [ + name, + { + commit: refs[name], + storeSha256: arm.storeSha256, + scanner: { + bundleSha256: arm.scanner.bundleSha256, + sourceFingerprints: arm.scanner.sourceFingerprints + }, + persistence: arm.persistence + ? { + bundleSha256: arm.persistence.bundleSha256, + sourceFingerprints: arm.persistence.sourceFingerprints + } + : null + } + ]) + ), + scenarios + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-persistence-cost-benchmark.mjs b/config/scripts/claude-usage-persistence-cost-benchmark.mjs new file mode 100644 index 00000000000..f1cd1de82c1 --- /dev/null +++ b/config/scripts/claude-usage-persistence-cost-benchmark.mjs @@ -0,0 +1,330 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { appendFile, mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises' +import { cpus, tmpdir } from 'node:os' +import { join } from 'node:path' +import { performance } from 'node:perf_hooks' +import { parseArgs } from 'node:util' +import { loadClaudeUsageBenchmarkScanner } from './claude-usage-benchmark-scanner.mjs' +import { + claudeBenchmarkSha256, + claudeBenchmarkState, + loadClaudeUsageBenchmarkPersistence, + resolveClaudeBenchmarkCommit, + serializeClaudeBenchmarkReport +} from './claude-usage-benchmark-persistence.mjs' + +const { values } = parseArgs({ + options: { + 'published-ref': { type: 'string', default: '8467877ed92aba2ef59737aebf461e9cab52c273' }, + 'main-ref': { type: 'string', default: 'b44a5796c1154de84efa25cc09f3dae2b61eb4b5' }, + 'usage-keys': { type: 'string', default: '16384' }, + 'maxima-pattern': { type: 'string', default: 'repeated' }, + rounds: { type: 'string', default: '6' }, + output: { type: 'string' } + } +}) +const usageKeys = Number(values['usage-keys']) +const rounds = Number(values.rounds) +const unique = values['maxima-pattern'] === 'unique' +assert(Number.isSafeInteger(usageKeys) && usageKeys > 7) +assert(Number.isSafeInteger(rounds) && rounds > 0 && rounds % 6 === 0) +assert(['repeated', 'unique'].includes(values['maxima-pattern'])) + +function record(cwd, index, correction = false) { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: correction ? usageKeys + 2_000 : 100 + (unique ? index : 0), + output_tokens: 10 + (unique ? index : 0), + cache_read_input_tokens: unique ? index : 0, + cache_creation_input_tokens: 20 + (unique ? index : 0), + cache_creation: { ephemeral_1h_input_tokens: 5 + (unique ? index : 0) } + } + } + })}\n` +} + +function projection(result) { + return { sessions: result.sessions, dailyAggregates: result.dailyAggregates } +} + +function median(input) { + const sorted = [...input].sort((a, b) => a - b) + const middle = Math.floor(sorted.length / 2) + return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2 +} + +const ORDERS = [ + ['published', 'main', 'current'], + ['current', 'main', 'published'], + ['main', 'published', 'current'], + ['current', 'published', 'main'], + ['published', 'current', 'main'], + ['main', 'current', 'published'] +] + +async function loadArm(home, mode, commit) { + const sources = new Map() + const [scanner, persistence] = await Promise.all([ + loadClaudeUsageBenchmarkScanner(home, new Map(), sources, commit), + loadClaudeUsageBenchmarkPersistence(mode, commit, sources) + ]) + const cacheFile = join(home, `${mode}-usage.json`) + const sourceRef = { + path: join(home, `${mode}-usage-sources.json`), + schemaVersion: mode === 'current' ? 7 : 6, + worktreeFingerprint: '[]', + reuse: true + } + const writer = new persistence.module.UsageCacheSnapshotWriter( + '[persistence-benchmark]', + () => cacheFile + ) + await writer.flush() + return { mode, commit, scanner, persistence, cacheFile, sourceRef, writer, savedSources: [] } +} + +async function persist(arm, result, previous) { + const started = performance.now() + if (arm.mode === 'current') { + await arm.persistence.module.persistSourceCache( + arm.sourceRef, + result.processedFiles, + previous ?? { sources: [] } + ) + } else if (arm.mode !== 'published') { + await arm.persistence.module.writeSourceCache(arm.sourceRef, result.processedFiles) + } + const sourceWrittenAt = performance.now() + const state = claudeBenchmarkState(result, arm.mode === 'current' ? 7 : 6) + let reportSerializeMs = 0 + let reportBytes = 0 + await arm.writer.write(() => { + const serializeStart = performance.now() + const text = serializeClaudeBenchmarkReport(arm, state) + reportSerializeMs = performance.now() - serializeStart + reportBytes = Buffer.byteLength(text) + return text + }) + const completedAt = performance.now() + arm.savedSources = arm.mode === 'published' ? result.processedFiles : [] + const sourceStat = + arm.mode === 'published' ? null : await stat(arm.sourceRef.path, { bigint: true }) + const sourceBytes = sourceStat ? Number(sourceStat.size) : 0 + const sourceBytesWritten = !sourceStat + ? 0 + : sourceStat.ino === 0n + ? null + : arm.persistedSourceGeneration?.dev === sourceStat.dev && + arm.persistedSourceGeneration?.ino === sourceStat.ino + ? 0 + : sourceBytes + arm.persistedSourceGeneration = sourceStat + arm.persistedSourceBytes = sourceBytes + return { + sourceWritePackSealDurableMs: sourceWrittenAt - started, + reportSerializeSealMs: reportSerializeMs, + reportDurableWriteMs: completedAt - sourceWrittenAt - reportSerializeMs, + totalPersistMs: completedAt - started, + sourceBytes, + sourceBytesWritten, + reportBytes, + totalWrittenBytes: sourceBytesWritten === null ? null : sourceBytesWritten + reportBytes, + totalPersistedBytes: sourceBytes + reportBytes + } +} + +async function refresh(arm, transcriptPath, expected) { + const sourceBytesRead = arm.persistedSourceBytes + const readStart = performance.now() + let previous + if (arm.mode === 'published') { + previous = { sources: arm.savedSources } + } else { + const loaded = await arm.persistence.module.readSourceCache(arm.sourceRef) + previous = arm.mode === 'current' ? loaded : { sources: loaded } + } + const readAt = performance.now() + assert.equal(previous.sources.length, 1) + arm.scanner.scanner.resetReadMetrics() + const result = await arm.scanner.scanner.scanClaudeUsageFiles( + [], + previous.sources, + undefined, + [], + previous.verifiedSources + ) + const scannedAt = performance.now() + const transcriptBytesRead = arm.scanner.scanner + .readMetrics() + .reduce((sum, read) => sum + read.bytes, 0) + const persisted = await persist(arm, result, previous) + assert.deepEqual(projection(result), expected) + assert.equal(result.processedFiles[0].ownedDedupeKeys.length, usageKeys) + return { + sourceReadVerifyDecodeMs: readAt - readStart, + scanMs: scannedAt - readAt, + completeRefreshMs: scannedAt - readStart + persisted.totalPersistMs, + transcriptBytesRead, + sourceBytesRead, + totalReadBytes: transcriptBytesRead + sourceBytesRead, + ...persisted, + transcriptPath + } +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-persistence-cost-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const history = Array.from({ length: usageKeys }, (_, index) => record(cwd, index)).join('') + const suffix = record(cwd, 7, true) + const refs = { + published: resolveClaudeBenchmarkCommit(values['published-ref']), + main: resolveClaudeBenchmarkCommit(values['main-ref']), + current: null + } + const arms = {} + for (const mode of Object.keys(refs)) { + arms[mode] = await loadArm(home, mode, refs[mode]) + } + const samples = [] + let referenceCold + let referenceAppend + for (let round = -1; round < rounds; round += 1) { + const order = ORDERS[(round + 6) % 6] + for (const name of order) { + const arm = arms[name] + await writeFile(transcriptPath, history) + arm.scanner.scanner.resetReadMetrics() + const coldStart = performance.now() + let cold = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + const coldAt = performance.now() + const coldTranscriptBytes = arm.scanner.scanner + .readMetrics() + .reduce((sum, read) => sum + read.bytes, 0) + const coldPersist = await persist(arm, cold) + referenceCold ??= projection(cold) + assert.deepEqual(projection(cold), referenceCold) + cold = null + const warm = await refresh(arm, transcriptPath, referenceCold) + await appendFile(transcriptPath, suffix) + let fresh = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + referenceAppend ??= projection(fresh) + assert.deepEqual(projection(fresh), referenceAppend) + fresh = null + const appended = await refresh(arm, transcriptPath, referenceAppend) + if (round >= 0) { + samples.push({ + arm: name, + round: round + 1, + order, + cold: { + scanMs: coldAt - coldStart, + completeRefreshMs: coldAt - coldStart + coldPersist.totalPersistMs, + transcriptBytesRead: coldTranscriptBytes, + sourceBytesRead: 0, + totalReadBytes: coldTranscriptBytes, + ...coldPersist + }, + warm, + append: appended + }) + } + } + } + const summary = Object.fromEntries( + Object.keys(arms).map((name) => [ + name, + Object.fromEntries( + ['cold', 'warm', 'append'].map((phase) => [ + phase, + Object.fromEntries( + Object.entries(samples.find((sample) => sample.arm === name)[phase]) + .filter(([, value]) => typeof value === 'number') + .map(([metric]) => [ + metric, + Number( + median( + samples + .filter((sample) => sample.arm === name) + .map((sample) => sample[phase][metric]) + ).toFixed(3) + ) + ]) + ) + ]) + ) + ]) + ) + const report = { + purpose: 'Actual pinned Claude scanner, source-cache and durable report persistence costs.', + node: process.version, + platform: process.platform, + arch: process.arch, + cpuModel: cpus()[0]?.model, + usageKeys, + maximaPattern: values['maxima-pattern'], + rounds, + historyBytes: Buffer.byteLength(history), + suffixBytes: Buffer.byteLength(suffix), + fixtureSha256: claudeBenchmarkSha256(history), + methodology: { + timing: + 'Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.', + refresh: + 'Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.', + published: + 'Published B keeps source records in memory; sourceReadBytes=0 reflects that architecture. Its report contains those records.', + exclusions: + 'Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.', + attribution: + 'Merged-main source/report ownership is inherited; compare current to fixed main to isolate this PR, and published to current for the combined user-visible change.', + correctness: + 'Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.', + writtenBytes: + 'Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals.' + }, + toolingSha256: claudeBenchmarkSha256(await readFile(import.meta.filename)), + supportToolingSha256: claudeBenchmarkSha256( + await readFile(new URL('./claude-usage-benchmark-persistence.mjs', import.meta.url)) + ), + arms: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [ + name, + { + commit: arm.commit, + scanner: { + bundleSha256: arm.scanner.bundleSha256, + sourceFingerprints: arm.scanner.sourceFingerprints + }, + persistence: { + bundleSha256: arm.persistence.bundleSha256, + sourceFingerprints: arm.persistence.sourceFingerprints, + inactiveLifecycleStubFingerprints: arm.persistence.stubFingerprints + } + } + ]) + ), + summary, + samples + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-readiness-cost-benchmark.mjs b/config/scripts/claude-usage-readiness-cost-benchmark.mjs new file mode 100644 index 00000000000..f3254a7c81c --- /dev/null +++ b/config/scripts/claude-usage-readiness-cost-benchmark.mjs @@ -0,0 +1,307 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { cpus, tmpdir } from 'node:os' +import { join } from 'node:path' +import { performance } from 'node:perf_hooks' +import { parseArgs } from 'node:util' +import { loadClaudeUsageBenchmarkScanner } from './claude-usage-benchmark-scanner.mjs' +import { + claudeBenchmarkSha256, + claudeBenchmarkState, + loadClaudeUsageBenchmarkPersistence, + resolveClaudeBenchmarkCommit, + serializeClaudeBenchmarkReport +} from './claude-usage-benchmark-persistence.mjs' +import { + createClaudeBenchmarkSplitWorker, + measureClaudeBenchmarkReadiness +} from './claude-usage-benchmark-readiness.mjs' + +const { values } = parseArgs({ + options: { + 'published-ref': { type: 'string', default: '8467877ed92aba2ef59737aebf461e9cab52c273' }, + 'main-ref': { type: 'string', default: 'b44a5796c1154de84efa25cc09f3dae2b61eb4b5' }, + 'usage-keys': { type: 'string', default: '100000' }, + 'large-report-mib': { type: 'string', default: '13' }, + rounds: { type: 'string', default: '6' }, + output: { type: 'string' } + } +}) +const usageKeys = Number(values['usage-keys']) +const rounds = Number(values.rounds) +const largeReportBytes = Number(values['large-report-mib']) * 1024 * 1024 +assert(Number.isSafeInteger(usageKeys) && usageKeys > 7) +assert(Number.isSafeInteger(rounds) && rounds > 0 && rounds % 6 === 0) +assert(Number.isSafeInteger(largeReportBytes) && largeReportBytes > 8 * 1024 * 1024) + +function historyRow(cwd, index) { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + requestId: `request-${index}`, + timestamp: '2026-10-09T12:00:00.000Z', + cwd, + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: 100 + index, + output_tokens: 10 + index, + cache_read_input_tokens: index, + cache_creation_input_tokens: 20 + index, + cache_creation: { ephemeral_1h_input_tokens: 5 + index } + } + } + })}\n` +} + +function largeRollups(result) { + const session = (index) => ({ + ...result.sessions[0], + sessionId: `historical-session-${index}`, + lastCwd: `/historical/project-${index}`, + locationBreakdown: result.sessions[0].locationBreakdown.map((location) => ({ + ...location, + locationKey: `project-${index}`, + projectLabel: `project-${index}` + })) + }) + const daily = (index) => ({ + ...result.dailyAggregates[0], + projectKey: `project-${index}`, + projectLabel: `project-${index}` + }) + const unit = JSON.stringify([session(0), daily(0)]) + const count = Math.ceil(largeReportBytes / Buffer.byteLength(unit)) + return { + processedFiles: [], + sessions: Array.from({ length: count }, (_, index) => session(index)), + dailyAggregates: Array.from({ length: count }, (_, index) => daily(index)) + } +} + +function median(input) { + const sorted = [...input].sort((a, b) => a - b) + const middle = Math.floor(sorted.length / 2) + return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2 +} + +const ORDERS = [ + ['published', 'main', 'current'], + ['current', 'main', 'published'], + ['main', 'published', 'current'], + ['current', 'published', 'main'], + ['published', 'current', 'main'], + ['main', 'current', 'published'] +] + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-readiness-cost-')) +const workers = [] +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const history = Array.from({ length: usageKeys }, (_, index) => historyRow(cwd, index)).join('') + await writeFile(transcriptPath, history) + const refs = { + published: resolveClaudeBenchmarkCommit(values['published-ref']), + main: resolveClaudeBenchmarkCommit(values['main-ref']), + current: null + } + const arms = {} + for (const mode of Object.keys(refs)) { + const sources = new Map() + const scanner = await loadClaudeUsageBenchmarkScanner(home, new Map(), sources, refs[mode]) + const persistence = await loadClaudeUsageBenchmarkPersistence(mode, refs[mode], sources) + const result = await scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + const arm = { mode, commit: refs[mode], scanner, persistence, result } + arm.stableText = serializeClaudeBenchmarkReport( + arm, + claudeBenchmarkState(result, mode === 'current' ? 7 : 6) + ) + if (mode !== 'published') { + arm.worker = await createClaudeBenchmarkSplitWorker(arm) + workers.push(arm.worker) + } + arms[mode] = arm + } + assert.deepEqual(arms.published.result.sessions, arms.current.result.sessions) + assert.deepEqual(arms.main.result.sessions, arms.current.result.sessions) + const inlineText = JSON.stringify(claudeBenchmarkState(arms.published.result)) + const reportResult = largeRollups(arms.current.result) + const samples = [] + const inputReceipts = { + legacyInlineBytes: Buffer.byteLength(inlineText), + legacyInlineSha256: claudeBenchmarkSha256(inlineText), + stableReportBytes: {}, + largeReportBytes: {}, + largeReportSessions: reportResult.sessions.length + } + for (const name of Object.keys(arms)) { + const arm = arms[name] + inputReceipts.stableReportBytes[name] = Buffer.byteLength(arm.stableText) + const state = claudeBenchmarkState(reportResult, name === 'current' ? 7 : 6) + arm.largeReportText = serializeClaudeBenchmarkReport(arm, state) + inputReceipts.largeReportBytes[name] = Buffer.byteLength(arm.largeReportText) + assert(inputReceipts.largeReportBytes[name] >= largeReportBytes) + } + async function sample(arm, scenario, text, round, order, options = {}) { + const cacheFile = join(home, `${arm.mode}-${scenario}.json`) + await rm(join(home, `${arm.mode}-${scenario}-sources.json`), { force: true }) + await writeFile(cacheFile, text) + const measured = await measureClaudeBenchmarkReadiness(arm, cacheFile, { + worker: arm.worker, + ...options + }) + assert.equal(measured.state.scanState.enabled, false) + const expected = scenario.startsWith('large') ? reportResult : arm.result + assert.deepEqual(measured.state.sessions, expected.sessions) + assert.deepEqual(measured.state.dailyAggregates, expected.dailyAggregates) + assert.equal( + measured.state.processedFiles.length, + arm.mode === 'published' ? expected.processedFiles.length : 0 + ) + if (round >= 0) { + samples.push({ arm: arm.mode, scenario, round: round + 1, order, metrics: measured.metrics }) + } + } + for (let round = -1; round < rounds; round += 1) { + const order = ORDERS[(round + 6) % 6] + for (const name of order) { + const arm = arms[name] + await sample(arm, 'stable-cache', arm.stableText, round, order) + if (name !== 'published') { + await sample(arm, 'legacy-inline-migration', inlineText, round, order) + } + } + const current = arms.current + await sample(current, 'legacy-inline-worker-fallback', inlineText, round, ['current'], { + fallback: true + }) + const diagnosticOrder = round % 2 ? ['trusted', 'repeat'] : ['repeat', 'trusted'] + for (const variant of diagnosticOrder) { + await sample( + current, + `large-report-${variant}-verification`, + current.largeReportText, + round, + diagnosticOrder, + { repeatMainVerification: variant === 'repeat' } + ) + } + await sample(arms.main, 'large-report-upstream', arms.main.largeReportText, round, ['main']) + await sample( + current, + 'large-report-worker-fallback', + current.largeReportText, + round, + ['current'], + { fallback: true } + ) + } + const serializeSamples = [] + for (let round = 0; round < rounds; round += 1) { + for (const name of round % 2 ? ['current', 'main'] : ['main', 'current']) { + const started = performance.now() + const text = serializeClaudeBenchmarkReport( + arms[name], + claudeBenchmarkState(reportResult, name === 'current' ? 7 : 6) + ) + const ms = performance.now() - started + assert.equal(text, arms[name].largeReportText) + serializeSamples.push({ arm: name, round: round + 1, serializeSealMs: ms }) + } + } + const groups = new Map() + for (const sample of samples) { + const key = `${sample.arm}:${sample.scenario}` + if (!groups.has(key)) { + groups.set(key, []) + } + groups.get(key).push(sample) + } + const summary = Object.fromEntries( + [...groups].map(([key, raw]) => [ + key, + Object.fromEntries( + Object.keys(raw[0].metrics) + .filter((metric) => typeof raw[0].metrics[metric] === 'number') + .map((metric) => [ + metric, + Number(median(raw.map((sample) => sample.metrics[metric])).toFixed(3)) + ]) + ) + ]) + ) + const report = { + purpose: + 'Actual store lifecycle readiness, worker migration/fallback and large aggregate-report costs.', + node: process.version, + platform: process.platform, + arch: process.arch, + cpuModel: cpus()[0]?.model, + rounds, + usageKeys, + inputReceipts, + methodology: { + actual: + 'Production lifecycle, report parser/serializer, inline migration and source durable writes. Prestarted Node workers call the actual splitter and return exact immutable reportText/proof fact.', + segments: + 'Constructor interval includes synchronous stat/read/parse. Main JSON.parse calls and production setImmediate validation yields are observed without changing their inputs/results. Segment observations exclude time waiting for the worker/filesystem.', + shortcut: + 'Large-report repeat arm deliberately re-verifies the same worker-validated text on main; trusted arm uses the private worker result fact. Both preserve exact report and disabled-history accessibility.', + largeReport: + 'About 13MiB of distinct aggregate rollups, with no source graph. This isolates a retained valid report even when its independently committed source cache is absent; it does not claim transcript parity for a generated historical corpus.', + exclusions: + 'Worker startup, application startup, rendered responsiveness, RPC queueing and telemetry are excluded. Inactive telemetry/analytics/worktree accesses throw if reached. Worker message transfer and production main parse remain included in whenLoaded.', + correctness: + 'Each loaded sessions/daily projection matches its input, remains accessible with tracking disabled, and report-only stores retain no source graph.' + }, + toolingSha256: claudeBenchmarkSha256(await readFile(import.meta.filename)), + supportToolingSha256: Object.fromEntries( + await Promise.all( + [ + 'claude-usage-benchmark-persistence.mjs', + 'claude-usage-benchmark-readiness.mjs', + 'claude-usage-benchmark-scanner.mjs' + ].map(async (path) => [ + path, + claudeBenchmarkSha256(await readFile(new URL(path, import.meta.url))) + ]) + ) + ), + arms: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [ + name, + { + commit: arm.commit, + scanner: { + bundleSha256: arm.scanner.bundleSha256, + sourceFingerprints: arm.scanner.sourceFingerprints + }, + persistence: { + bundleSha256: arm.persistence.bundleSha256, + sourceFingerprints: arm.persistence.sourceFingerprints, + inactiveLifecycleStubFingerprints: arm.persistence.stubFingerprints + }, + workerBootstrapSha256: arm.worker + ? claudeBenchmarkSha256(arm.worker.bootstrapSha256Input) + : null + } + ]) + ), + summary, + samples, + largeReportSerializeSamples: serializeSamples + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await Promise.all(workers.map((worker) => worker.close())) + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/claude-usage-source-compression-benchmark.mjs b/config/scripts/claude-usage-source-compression-benchmark.mjs new file mode 100644 index 00000000000..83196d3c810 --- /dev/null +++ b/config/scripts/claude-usage-source-compression-benchmark.mjs @@ -0,0 +1,330 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict' +import { appendFile, mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises' +import { cpus, tmpdir } from 'node:os' +import { join } from 'node:path' +import { performance } from 'node:perf_hooks' +import { parseArgs } from 'node:util' +import { loadClaudeUsageBenchmarkScanner } from './claude-usage-benchmark-scanner.mjs' +import { + claudeBenchmarkSha256, + claudeBenchmarkState, + loadClaudeUsageBenchmarkPersistence, + resolveClaudeBenchmarkCommit, + serializeClaudeBenchmarkReport +} from './claude-usage-benchmark-persistence.mjs' + +const { values } = parseArgs({ + options: { + 'uncompressed-ref': { type: 'string', default: '4102ea91dce12a3ce11104dc89729132e8674f0b' }, + 'main-ref': { type: 'string', default: 'b44a5796c1154de84efa25cc09f3dae2b61eb4b5' }, + 'usage-keys': { type: 'string', default: '16384' }, + 'maxima-pattern': { type: 'string', default: 'repeated' }, + rounds: { type: 'string', default: '6' }, + output: { type: 'string' } + } +}) +const usageKeys = Number(values['usage-keys']) +const rounds = Number(values.rounds) +const unique = values['maxima-pattern'] === 'unique' +assert(Number.isSafeInteger(usageKeys) && usageKeys > 7) +assert(Number.isSafeInteger(rounds) && rounds > 0 && rounds % 6 === 0) +assert(['repeated', 'unique', 'varied'].includes(values['maxima-pattern'])) + +function record(cwd, index, correction = false) { + const varied = values['maxima-pattern'] === 'varied' + const identity = claudeBenchmarkSha256(`usage-${index}`) + const count = (offset, fallback) => + varied ? Number.parseInt(identity.slice(offset, offset + 5), 16) : fallback + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: new Date(Date.UTC(2026, 9, 9, 12, 0, index)).toISOString(), + requestId: varied ? identity.slice(0, 32) : `request-${index}`, + cwd, + gitBranch: 'benchmark', + message: { + id: varied ? identity.slice(32) : `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: correction + ? varied + ? 2_000_000 + : usageKeys + 2_000 + : count(0, 100 + (unique ? index : 0)), + output_tokens: count(5, 10 + (unique ? index : 0)), + cache_read_input_tokens: count(10, unique ? index : 0), + cache_creation_input_tokens: count(15, 20 + (unique ? index : 0)), + cache_creation: { ephemeral_1h_input_tokens: count(20, 5 + (unique ? index : 0)) } + } + } + })}\n` +} + +function projection(result) { + return { sessions: result.sessions, dailyAggregates: result.dailyAggregates } +} + +function median(input) { + const sorted = [...input].sort((a, b) => a - b) + const middle = Math.floor(sorted.length / 2) + return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2 +} + +const ORDERS = [ + ['uncompressed', 'main', 'current'], + ['current', 'main', 'uncompressed'], + ['main', 'uncompressed', 'current'], + ['current', 'uncompressed', 'main'], + ['uncompressed', 'current', 'main'], + ['main', 'current', 'uncompressed'] +] + +async function loadArm(home, mode, commit) { + const sources = new Map() + const [scanner, persistence] = await Promise.all([ + loadClaudeUsageBenchmarkScanner(home, new Map(), sources, commit), + loadClaudeUsageBenchmarkPersistence(mode === 'main' ? 'main' : 'current', commit, sources) + ]) + const cacheFile = join(home, `${mode}-usage.json`) + const sourceRef = { + path: join(home, `${mode}-usage-sources.json`), + schemaVersion: mode !== 'main' ? 7 : 6, + worktreeFingerprint: '[]', + reuse: true + } + const writer = new persistence.module.UsageCacheSnapshotWriter( + '[persistence-benchmark]', + () => cacheFile + ) + await writer.flush() + return { mode, commit, scanner, persistence, cacheFile, sourceRef, writer } +} + +async function persist(arm, result, previous) { + const started = performance.now() + await (arm.mode !== 'main' + ? arm.persistence.module.persistSourceCache( + arm.sourceRef, + result.processedFiles, + previous ?? { sources: [] } + ) + : arm.persistence.module.writeSourceCache(arm.sourceRef, result.processedFiles)) + const sourceWrittenAt = performance.now() + const state = claudeBenchmarkState(result, arm.mode !== 'main' ? 7 : 6) + let reportSerializeMs = 0 + let reportBytes = 0 + await arm.writer.write(() => { + const serializeStart = performance.now() + const text = serializeClaudeBenchmarkReport(arm, state) + reportSerializeMs = performance.now() - serializeStart + reportBytes = Buffer.byteLength(text) + return text + }) + const completedAt = performance.now() + const sourceStat = await stat(arm.sourceRef.path, { bigint: true }) + const sourceBytes = sourceStat ? Number(sourceStat.size) : 0 + const sourceBytesWritten = !sourceStat + ? 0 + : sourceStat.ino === 0n + ? null + : arm.persistedSourceGeneration?.dev === sourceStat.dev && + arm.persistedSourceGeneration?.ino === sourceStat.ino + ? 0 + : sourceBytes + arm.persistedSourceGeneration = sourceStat + arm.persistedSourceBytes = sourceBytes + return { + sourceWritePackSealDurableMs: sourceWrittenAt - started, + reportSerializeSealMs: reportSerializeMs, + reportDurableWriteMs: completedAt - sourceWrittenAt - reportSerializeMs, + totalPersistMs: completedAt - started, + sourceBytes, + sourceBytesWritten, + reportBytes, + totalWrittenBytes: sourceBytesWritten === null ? null : sourceBytesWritten + reportBytes, + totalPersistedBytes: sourceBytes + reportBytes + } +} + +async function refresh(arm, transcriptPath, expected) { + const sourceBytesRead = arm.persistedSourceBytes + const readStart = performance.now() + const loaded = await arm.persistence.module.readSourceCache(arm.sourceRef) + const previous = arm.mode !== 'main' ? loaded : { sources: loaded } + const readAt = performance.now() + assert.equal(previous.sources.length, 1) + arm.scanner.scanner.resetReadMetrics() + const result = await arm.scanner.scanner.scanClaudeUsageFiles( + [], + previous.sources, + undefined, + [], + previous.verifiedSources + ) + const scannedAt = performance.now() + const transcriptBytesRead = arm.scanner.scanner + .readMetrics() + .reduce((sum, read) => sum + read.bytes, 0) + const persisted = await persist(arm, result, previous) + assert.deepEqual(projection(result), expected) + assert.equal(result.processedFiles[0].ownedDedupeKeys.length, usageKeys) + return { + sourceReadVerifyDecodeMs: readAt - readStart, + scanMs: scannedAt - readAt, + completeRefreshMs: scannedAt - readStart + persisted.totalPersistMs, + transcriptBytesRead, + sourceBytesRead, + totalReadBytes: transcriptBytesRead + sourceBytesRead, + ...persisted, + transcriptPath + } +} + +const home = await mkdtemp(join(tmpdir(), 'orca-claude-source-compression-')) +try { + const project = join(home, '.claude', 'projects', 'benchmark') + const cwd = join(home, 'repo') + await mkdir(project, { recursive: true }) + await mkdir(cwd) + const transcriptPath = join(project, 'active-session.jsonl') + const history = Array.from({ length: usageKeys }, (_, index) => record(cwd, index)).join('') + const suffix = record(cwd, 7, true) + const refs = { + uncompressed: resolveClaudeBenchmarkCommit(values['uncompressed-ref']), + main: resolveClaudeBenchmarkCommit(values['main-ref']), + current: null + } + const arms = {} + for (const mode of Object.keys(refs)) { + arms[mode] = await loadArm(home, mode, refs[mode]) + } + const samples = [] + let referenceCold + let referenceAppend + for (let round = -1; round < rounds; round += 1) { + const order = ORDERS[(round + 6) % 6] + for (const name of order) { + const arm = arms[name] + await writeFile(transcriptPath, history) + arm.scanner.scanner.resetReadMetrics() + const coldStart = performance.now() + let cold = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + const coldAt = performance.now() + const coldTranscriptBytes = arm.scanner.scanner + .readMetrics() + .reduce((sum, read) => sum + read.bytes, 0) + const coldPersist = await persist(arm, cold) + referenceCold ??= projection(cold) + assert.deepEqual(projection(cold), referenceCold) + cold = null + const warm = await refresh(arm, transcriptPath, referenceCold) + await appendFile(transcriptPath, suffix) + let fresh = await arm.scanner.scanner.scanClaudeUsageFiles([], [], undefined, []) + referenceAppend ??= projection(fresh) + assert.deepEqual(projection(fresh), referenceAppend) + fresh = null + const appended = await refresh(arm, transcriptPath, referenceAppend) + if (round >= 0) { + samples.push({ + arm: name, + round: round + 1, + order, + cold: { + scanMs: coldAt - coldStart, + completeRefreshMs: coldAt - coldStart + coldPersist.totalPersistMs, + transcriptBytesRead: coldTranscriptBytes, + sourceBytesRead: 0, + totalReadBytes: coldTranscriptBytes, + ...coldPersist + }, + warm, + append: appended + }) + } + } + } + const summary = Object.fromEntries( + Object.keys(arms).map((name) => [ + name, + Object.fromEntries( + ['cold', 'warm', 'append'].map((phase) => [ + phase, + Object.fromEntries( + Object.entries(samples.find((sample) => sample.arm === name)[phase]) + .filter(([, value]) => typeof value === 'number') + .map(([metric]) => [ + metric, + Number( + median( + samples + .filter((sample) => sample.arm === name) + .map((sample) => sample[phase][metric]) + ).toFixed(3) + ) + ]) + ) + ]) + ) + ]) + ) + const report = { + purpose: + 'Lossless Claude source compression: actual pinned scanner, cache and durable report persistence costs.', + node: process.version, + platform: process.platform, + arch: process.arch, + cpuModel: cpus()[0]?.model, + usageKeys, + maximaPattern: values['maxima-pattern'], + rounds, + historyBytes: Buffer.byteLength(history), + suffixBytes: Buffer.byteLength(suffix), + fixtureSha256: claudeBenchmarkSha256(history), + methodology: { + timing: + 'Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.', + refresh: + 'Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.', + uncompressed: + 'Uncompressed uses uncompressed B4102; current compresses its source sidecar with asynchronous gzip level 1. Both retain identical usage history.', + exclusions: + 'Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.', + attribution: + 'Main is fixed b44a5796; uncompressed is previously published B4102; current adds lossless source compression.', + correctness: + 'Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.', + writtenBytes: + 'Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals.' + }, + toolingSha256: claudeBenchmarkSha256(await readFile(import.meta.filename)), + supportToolingSha256: claudeBenchmarkSha256( + await readFile(new URL('./claude-usage-benchmark-persistence.mjs', import.meta.url)) + ), + arms: Object.fromEntries( + Object.entries(arms).map(([name, arm]) => [ + name, + { + commit: arm.commit, + scanner: { + bundleSha256: arm.scanner.bundleSha256, + sourceFingerprints: arm.scanner.sourceFingerprints + }, + persistence: { + bundleSha256: arm.persistence.bundleSha256, + sourceFingerprints: arm.persistence.sourceFingerprints, + inactiveLifecycleStubFingerprints: arm.persistence.stubFingerprints + } + } + ]) + ), + summary, + samples + } + if (values.output) { + await writeFile(values.output, `${JSON.stringify(report, null, 2)}\n`) + } + console.log(JSON.stringify(report)) +} finally { + await rm(home, { recursive: true, force: true }) +} diff --git a/config/scripts/native-chat-fold-benchmark.mjs b/config/scripts/native-chat-fold-benchmark.mjs index 1181aee7d41..6dcc743f305 100644 --- a/config/scripts/native-chat-fold-benchmark.mjs +++ b/config/scripts/native-chat-fold-benchmark.mjs @@ -56,6 +56,10 @@ function measureOutputMemory(run, messages, check) { } } +if (!global.gc) { + throw new Error('Memory measurements require node --expose-gc') +} + if (process.argv.includes('--memory-control')) { const samples = Array.from({ length: 5 }, () => measureOutputMemory( @@ -125,9 +129,6 @@ async function load(ref) { } } -if (!global.gc) { - throw new Error('Memory measurements require node --expose-gc') -} const loaded = Object.fromEntries( await Promise.all(Object.entries(refs).map(async ([arm, ref]) => [arm, await load(ref)])) ) diff --git a/config/vitest.performance.config.ts b/config/vitest.performance.config.ts index b233a929214..7bec6789172 100644 --- a/config/vitest.performance.config.ts +++ b/config/vitest.performance.config.ts @@ -21,7 +21,9 @@ const contracts = [ 'src/renderer/src/store/store-identity-churn-probe.test.ts', 'config/scripts/app-store-performance-plugin.test.mjs', 'config/scripts/quadratic-buffer-concat-plugin.test.mjs', - 'config/scripts/sort-comparator-performance-plugin.test.mjs' + 'config/scripts/sort-comparator-performance-plugin.test.mjs', + 'src/main/claude-usage/scanner-incremental-append.test.ts', + 'src/main/claude-usage/store-checkpoint-persistence.test.ts' ] for (const contract of contracts) { diff --git a/docs/bug-reproductions/usage-scan-append/README.md b/docs/bug-reproductions/usage-scan-append/README.md new file mode 100644 index 00000000000..12a08d7ad70 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/README.md @@ -0,0 +1,168 @@ +# Usage scans after a transcript append + +Latest follow-up: [lossless source compression](./source-compression.md) removes the disk increase in three measured histories, with CPU costs reported. Earlier tables below describe the uncompressed implementation. + +Claude usage refresh previously cached a transcript only while its modification time and size were unchanged. Appending one usage row invalidated that cache and parsed every earlier user, tool and assistant row again. The production route is `ClaudeUsageStore` → `UsageProviderStoreLifecycle.runScan` → the usage worker → `scanClaudeUsageFiles`. Long tool output therefore made a small usage refresh expensive even when the number of usage records stayed fixed. + +The regression is deterministic: the append test measures bytes returned by the real filesystem reader. Before the fix, a 424-byte append to a 1,083,929-byte transcript read 1,084,353 bytes. The new scan reads a verified suffix and a fixed amount of prefix evidence. It retains all usage history and places no new cap on transcripts, rows or tokens. + +## Reproduce + +From the repository root: + +```sh +ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/claude-usage src/main/usage/jsonl-line-offsets.test.ts +ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/codex-usage +ORCA_BACKGROUND_LAUNCH=1 ORCA_CLAUDE_USAGE_APPEND_BENCH_ROUNDS=8 ORCA_CLAUDE_USAGE_APPEND_BENCH_BASELINE=51e7181850b022bae2d41091fe1229accef4bd50 node config/scripts/claude-usage-append-benchmark.mjs --compare --verify +``` + +Run the timing benchmark while builds, test suites and other benchmarks are idle. It uses temporary transcript directories and loads the actual scanner through an esbuild bundle. Account/profile discovery is isolated; transcript reads remain real. The I/O wrapper records stream bytes and descriptor window reads without counting descriptor stream internals twice. Its accounting smoke check verifies one complete file read plus an eleven-byte descriptor read. Unaccounted `readFile` and `readv` APIs fail the benchmark. + +The current comparison loader pins every project dependency to its named baseline commit and freezes the current source graph. The historical comparison below overlaid named Claude modules; the original scanner's five-module graph came entirely from the original commit. Fixtures are identical across arms. Arm order alternates across rounds; each round records scanner-cache-cold, unchanged, append and fresh-after-append phases. “Cold” describes the scanner cache: newly written fixtures can already be in the operating system page cache. Raw samples include read counts, bytes, scanner duration, cache serialization duration, serialized state bytes, source hashes and environment. Separate scanner and serialization values prevent a cursor from merely moving work into persistence. + +The fixture set includes one thousand small transcripts; two and thirty-two MiB of UTF-8 user/tool output with the same 256 usage keys; and thirty-two MiB with 4,096 and 16,384 usage keys. Every appended result must match a fresh scan of the same bytes. Across baseline/current arms, additive checkpoint and generation metadata are excluded from behavioral comparisons; sessions, daily aggregates, per-file aggregates, line counts and owned keys are compared. + +## Initial controlled results + +This comparison records the original append fix before the later protected source-sidecar and column-storage refinement. Its source hashes and raw samples remain unchanged; the later persistence measurements below use their own complete source graphs. + +The final [comparison.jsonl](./comparison.jsonl) contains eight counterbalanced rounds per scenario on Node v24.20.0, macOS arm64, Apple M4 Max. Baseline is commit `51e7181850b022bae2d41091fe1229accef4bd50`. Each arm ran first four times. No builds, tests, app or competing benchmark ran during the measurement. All eleven recorded current runtime-source hashes and four tool hashes were checked against the frozen worktree after the run. Exact within-arm cold parity, cross-arm behavioral parity and byte budgets passed. + +The table shows medians. Time is the scanner plus compact cache serialization; the raw artifact records these separately and retains every unrounded sample. + +| Tool payload / owned usage keys | Appended bytes | Before bytes read | After bytes read | Before time | After time | Before serialized cache | After serialized cache | +| ------------------------------- | -------------: | ----------------: | ---------------: | ----------: | ---------: | ----------------------: | ---------------------: | +| 2 MiB / 256 | 4,730 | 2,288,956 | 29,306 | 5.943 ms | 0.616 ms | 8,196 B | 13,689 B | +| 32 MiB / 256 | 4,730 | 34,534,456 | 29,306 | 81.513 ms | 0.741 ms | 8,197 B | 13,691 B | +| 32 MiB / 4,096 | 4,748 | 36,560,492 | 29,324 | 92.323 ms | 3.093 ms | 114,262 B | 188,877 B | +| 32 MiB / 16,384 | 4,766 | 43,062,968 | 29,342 | 124.310 ms | 10.651 ms | 471,124 B | 766,924 B | + +For the 256-key large transcript, scanner time alone fell from 81.494 ms to 0.724 ms, and append bytes read fell by 99.915%. Increasing transcript payload by 15.117× left appended reads unchanged. Increasing owned keys still increased scanner and serialization work, as expected. The cache is larger than the original aggregate-only cache because five old maxima must remain available to update a repeated historical key correctly. + +The cold full-scan path also improved on these large fixtures: the 32-MiB/256-key scan took 82.270 ms before and 35.014 ms after, with sixteen KiB of extra evidence reads. The new raw-buffer line reader builds each complete line once, while retaining exact byte offsets. This timing includes the projection and checkpoint cost; it is not a separate parser microbenchmark. + +The small-file tradeoff is visible. A thousand initial transcripts contain 459,780 bytes in total; appending a repeated maximum to each raises their total to 920,560 bytes. Full snapshot verification requires one additional read of each small file. + +| Thousand-file phase | Before scan | After scan | Before bytes read | After bytes read | +| ------------------- | ----------: | ---------: | ----------------: | ---------------: | +| Cold | 73.233 ms | 94.872 ms | 459,780 | 919,560 | +| Unchanged | 9.176 ms | 9.400 ms | 0 | 0 | +| Changed | 71.938 ms | 94.933 ms | 920,560 | 1,841,120 | + +Small-file cold scans cost about 21.6 ms more across this thousand-file fixture, a 29.5% increase. Unchanged refreshes retain zero transcript reads. This verification cost prevents a short, rotated or rewritten snapshot from being published under complete-file metadata; it is not hidden by excluding tiny files or adding a history cap. Scanner execution remains on the existing usage worker. + +At 16,384 keys, the normalized cache is 766,924 bytes, compared with 6,203,025 bytes in the retained pre-normalization artifact: 87.6% fewer serialized bytes. The older run is evidence for the removed duplication, not a controlled timing comparison. Final scanner-plus-serialization time remains 10.651 ms at that key count, so the result does not claim constant total cost. + +## Shared reader before provider-specific projection + +The durable byte reader and checkpoint evidence were extracted from Codex into `src/main/usage/jsonl-file-checkpoint.ts` and reused by both providers. The persisted Codex checkpoint fields remain compatible. The extraction also repairs a demonstrated race: path verification followed by a new path open could merge an old prefix with a replacement file, then publish the replacement's metadata over those old totals and reuse the result indefinitely. + +Verification, initial stat, parsing and checkpoint creation now use one pinned descriptor. Parsing ends at the initial file size, so an append after the scan starts is picked up by the next refresh. Before publishing, the reader proves the complete requested byte range was consumed, checks the current path still names the opened generation, validates its original byte evidence and rejects truncation or changed snapshot evidence. Failed generations discard speculative projection and ownership before a cold retry. A short stream, digest window or legacy-prefix read on an unchanged snapshot propagates an error instead of publishing partial totals or retrying forever. Reopening requires positive generation or metadata change and closes each failed attempt once. Normal completion closes the owning handle; borrowed descriptor streams are not destroyed independently because that closes the descriptor on Node as well. + +The inherited 12-KiB resumable-prefix crossover avoids paying more evidence work than a full read on tiny files. Tiny files hash the bytes actually parsed and verify them with one post-read descriptor read, including deliberately skipped legacy prefixes. They therefore read twice on a cold or changed scan, while unchanged files read zero bytes. Large cold scans add four 4-KiB evidence pages; a normal large append adds six pages. These costs are measured explicitly. + +## Claude projection and cache compatibility + +Claude assistant rows are deduplicated by their existing request/message key. A repeated key keeps its first session, timestamp, model and location attribution, while each of the five token counters takes its independent maximum. The incremental projection applies only the token difference to the original session, day, model and location. It does not create another turn. A zero-cache-read turn is decremented once when that key's cache-read maximum changes from zero to positive. An invalid first timestamp remains invalid even when a later repeated row has a valid timestamp. + +The persisted encounter order preserves cold-scan sorting when a token update creates a tie between locations, or a new row creates a timestamp tie between sessions. Keyless rows remain ordinary counted turns. Completed-line count is stored separately from the exposed line count: an unterminated fragment is counted once and read again after completion. A parseable unterminated usage row, including a duplicate that only raises maxima, suppresses resume until its provisional contribution can be parsed safely. + +Cached cross-file ownership is retained while a changed owner is being read. Once that read validates, actual deleted or dropped keys are released and deferred forks reclaim them. A small owner's ordinary append therefore does not force every unchanged deferred fork to reread its history. Deletion, truncation and replacement that actually lose an owned key still recover that history from a surviving fork. + +Generation metadata is stored independently of a resumable checkpoint, including for small files and parseable partial tails. Same-size replacement with a restored modification time is invalidated by physical identity; same-size in-place change with a restored modification time is invalidated by change time where available. Old cache entries lacking this metadata are cold-scanned once, then use unchanged zero-read reuse. Missing or unrecognized incremental state falls back to a full parse without discarding tracking preferences. + +Resume state is validated at the boundary. It checks key coverage, compact tuple shape, finite token values, projection indexes and routing, and full session/location encounter-order coverage. Malformed state falls back to a cold scan instead of losing rows, double counting repeated keys or throwing during a correction. + +## Retained state and remaining scaling + +The first implementation repeated each key and its full routing metadata in an owned-turn map. The isolated pre-normalization run measured 6,203,025 serialized bytes at 16,384 usage keys, with 4.306 ms spent serializing one appended scan. That exposed a second cost before finalizing the fix. + +The normalized state reuses the existing ordered `ownedDedupeKeys` array. Parallel tuples store five maxima and a routing index; session/day/model/location routes are interned once. Existing-key updates retain their positions; new keys append. Tests include reversed suffix key order and JSON persistence between updates. Appends now use the tuples directly, replacing only corrected rows and sharing unchanged rows without mutating prior state. This removes the historical owned-turn object hydration and full tuple re-encoding pass. + +Transcript-payload growth no longer determines append reads. Hydration, key validation, aggregate cloning and serialization still scale with the number of owned usage keys and rollups. The benchmark reports these costs rather than claiming constant total time or constant retained state. It also reports the small-file verification overhead rather than hiding it in a large-file average. + +`pre-normalization.jsonl` retains the earlier same-source measurement that motivated the compact codec. It is not the final baseline/current timing comparison; source and method changes prevent treating those separate runs as controlled timing evidence. + +## Protected worker cache and visible report + +The final implementation reuses upstream's worker-owned source sidecar and `whenLoaded` barrier. Per-file ownership, token maxima and checkpoint routes stay on the usage worker; main retains the session/day report. The disk codec packs each of six token columns as one scalar when all values match, or an exact dense column otherwise. It changes no worker or public usage-report shape, keeps every key and maximum, and serializes one file's columns at a time. + +Unchanged refreshes retain the sidecar only after verified schema 7, clean normalization and identical file count, order and references. Any change, repair or legacy upgrade writes a new source generation. Report completion and report persistence still run. + +Schema 7 source files and reports have separate SHA-256 guards over their exact JSON bytes. The source guard includes small files that have no resumable checkpoint. The worker verifies its source bytes before granting a request-local reuse proof; direct scanner callers and genuine older signed files still pass the coupled key/maxima/route/rollup validation. A malformed owner also invalidates deferred forks so the next scan can reclaim copied history. The checksum detects accidental drift; it does not authenticate a cache deliberately changed and re-sealed by another writer. + +The report is authoritative for startup independently of the sidecar. A failed source write may leave an older sidecar, and a crash before report commit may leave a newer sidecar. Neither case replaces displayed report totals with another generation's totals. Legacy inline migration verifies protected files and reconstructs its report before splitting; invalid projections clear all visible totals and completion rather than presenting a partial history. An existing compatible newer sidecar survives a repeated migration after a failed report write. + +Genuine unsigned schema 6 reports remain readable with their existing cache-trust policy until a successful source scan creates schema 7. Older signed tuple checkpoints migrate through their original coupled guard. Schema 7 requires valid integrity framing, including when a digest is removed. Downgrading to a schema 6 app causes a one-time cold rebuild while preserving tracking preferences. + +Small reports keep upstream's synchronous load. Reports above its eight-MiB threshold use the existing worker operation; the verification fact is attached to the exact returned report text, so main does not hash those bytes again. Main still parses and serializes its visible rollups. If the worker is unavailable, `whenLoaded` covers the exceptional inline validation on main, including disabled cached history. Preference writes preserve that original inline source generation until a successful scan, and shutdown still drains writes after a failed preference write. This fallback can be slower, but does not retain the historical source graph in main. + +Source-cache parsing, column decoding, key indexing, rollup cloning and durable sidecar writes still scale with cached history. The refinement moves this work off main and removes redundant representations; it does not claim constant total refresh time, bounded history, or universal detection of transcript rewrites. + +## Final Claude persistence measurements + +The [final evidence receipt](./claude-resource-evidence-receipt.json) verifies every captured production dependency, tool and artifact. [Detailed costs and limits](./hardening-summary.md) distinguish the original commit, published PR, merged upstream main and final worktree. The final timing drivers use six counterbalanced rounds with complete pinned source graphs and actual source-cache read/verification/decoding, scanning and durable source/report writes. Worker startup, IPC transport/queueing, telemetry, worktree discovery and rendering are excluded. + +| Owned keys / phase | Published PR | Upstream main | Final | +| --------------------------- | -----------: | ------------: | ---------: | +| 16,384 repeated / cold | 72.455 ms | 61.117 ms | 83.160 ms | +| 16,384 repeated / unchanged | 13.106 ms | 21.844 ms | 12.290 ms | +| 16,384 repeated / append | 28.000 ms | 61.131 ms | 28.876 ms | +| 100,000 unique / cold | 385.203 ms | 265.264 ms | 390.682 ms | +| 100,000 unique / unchanged | 34.915 ms | 36.950 ms | 30.662 ms | +| 100,000 unique / append | 128.631 ms | 267.204 ms | 84.152 ms | + +The [16k](./claude-persistence-cost-final-16k.json) and [100k](./claude-persistence-cost-final-100k.json) measurements retain every sample. Each unchanged final scan writes zero source-cache bytes, while still reading 471,838 or 6,126,038 source bytes and persisting a small report. At 100k, appended transcript reads fall from 47,323,259 to 25,030 bytes; including the source sidecar, total logical payload reads fall from approximately 50,303,147 to 6,151,068 bytes. These are measured operation costs, rather than whole-app latency or physical device I/O. + +The [four-arm byte check](./claude-persisted-bytes-final.json) uses actual production layouts and indentation. At 16k repeated maxima, final report plus sources take 538,876 bytes: 29.8% below the published PR, 14.1% above main and 13.2% below original source. At 100k unique maxima, final state takes 6,128,046 bytes: 3.2% below the published PR, 105.5% above main and 57.8% above original source. One ownership-key list and the six dense token/routing columns dominate that adverse case; no duplicate key list remains. Dense cold rebuilding also remains slower than main, and the 16k complete append is slightly slower than the published PR despite a faster scanner. + +The [readiness diagnostic](./claude-readiness-cost-final.json) retains disabled history with zero per-source records on main. Upstream's report-only startup already removes the large source graph from main, so that improvement is inherited. First legacy migration becomes ready in 94.434 ms versus main's 63.060 ms. Exceptional validation yields 293 times, but its initial legacy parse still occupies main. A separate 13.87 MB report still requires a 16.512 ms observed main parse segment, and final serialization/checksum costs 20.628 ms versus main's 16.183 ms. These observations do not establish universal latency bounds. + +Reproduce final evidence while other builds, tests, apps and benchmarks are idle: + +```sh +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persistence-cost-benchmark.mjs --usage-keys 16384 --maxima-pattern repeated --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persistence-cost-benchmark.mjs --usage-keys 100000 --maxima-pattern unique --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-readiness-cost-benchmark.mjs --usage-keys 100000 --large-report-mib 13 --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persisted-bytes-check.mjs +``` + +Each tool accepts `--output`; the timing tools also accept `--published-ref` and `--main-ref`. Default immutable refs and complete provenance appear in the artifacts. Equivalent environment-variable launchers work on Windows. These macOS measurements make no Windows or SSH latency claim. + +## Codex parser retained memory + +Codex folds each owned event into the existing session/day accumulator while reading. It keeps ownership keys and rollups, instead of an attributed-event array for the whole transcript. Claims are published only after descriptor validation; rejected reads discard their speculative rollups. Deferred records still advance cumulative token context. + +Run the separate memory comparison while other benchmarks and builds are idle: + +```sh +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/codex-usage-parser-memory-benchmark.mjs --baseline-ref 51e7181850b022bae2d41091fe1229accef4bd50 --events 100000 --pairs 2 --sample-ms 35 --output docs/bug-reproductions/usage-scan-append/codex-parser-memory.json +``` + +The baseline bundles every project source dependency of the actual parser from the named commit; the current arm bundles and hashes the worktree dependency graph before starting workers. Each arm, scenario and round runs in a fresh Node process. Two rounds alternate baseline/current and current/baseline. The 100,000-record fixture has distinct timestamps and fixed token values. One scenario owns every record; the other defers 90% to a simulated prior owner. Both arms must preserve identical sessions, daily aggregates, owned keys and deferred state, with exact event and token totals. + +Workers force two full garbage collections before parsing, every 35 ms during parsing, and after parsing with the returned result retained. Raw snapshots include heap, RSS, external buffers and elapsed time. The reported peak is the largest **sampled retained heap** increase; it does not measure absolute peak allocation or total process memory. Forced GC affects elapsed times, so this is a memory comparison rather than a speed benchmark. The artifact records runtime/platform details, fixture hash, all bundled source hashes, bundle hashes, instrumentation hashes, arm order and correctness counts. + +The final [`codex-parser-memory.json`](./codex-parser-memory.json) comparison used Node 24.20.0 on darwin/arm64, an Apple M4 Max, and the 20,200,079-byte fixture. All eight fresh workers collected samples during parsing (3–12 per worker). The two counterbalanced runs measured these retained-heap increases: + +| Owned records | Baseline sampled peak (MiB) | Current sampled peak (MiB) | +| ------------------------- | --------------------------: | -------------------------: | +| All 100,000 | 44.681, 44.953 | 9.071, 7.964 | +| 10,000, with 90% deferred | 3.692, 3.746 | 1.233, 1.251 | + +Every arm retained exactly 100,000 or 10,000 keys and counted events, with identical full usage-projection hashes and exact token totals. Final returned-result retention stayed approximately 6.49 → 6.51 MiB with all keys owned and 0.97 → 1.00 MiB with 90% deferred: the improvement removes intermediate event retention while preserving the result. Raw artifacts include all 16 baseline and 18 current source-module hashes; each current source and instrumentation hash matched the frozen worktree after the run. Snapshot records themselves add small duration-dependent observer overhead. A separate 1,000-record smoke passed parity but correctly flagged every measurement as final-only, so it is not used as peak-memory evidence. + +`codex-memory-exploration.json` preserves the earlier actual-parser exploratory measurements: approximately 45.5 → 7.6 MiB sampled retained heap with all 100,000 keys owned, and 3.7 → 0.9 MiB with 10,000 keys owned. That earlier run overlaid only the baseline parser onto current dependencies and did not save source hashes or individual snapshots. Its limitations are explicit; the pinned full-graph comparison provides reproducible final evidence. + +## Correctness coverage and limits + +The final [validation record](./validation.json) captures the frozen source hashes, +8,278 passing integrated tests across 839 files, 118 performance contracts, +full typechecking, changed-code quality, formatting and artifact hash checks. +The contract workflow is configured for Linux, macOS and Windows; this local run +used macOS. [Rendered Electron evidence](https://github.com/stablyai/orca/blob/nwparker/perf-native-chat-tool-pairing/docs/bug-reproductions/native-chat-tool-pairing/rendered-validation.json) +records the rebuilt hidden app, output/task ownership and process cleanup. + +Focused suites cover UTF-8 byte offsets, CRLF and tiny chunks; duplicate maxima and first metadata; keyless rows; malformed and parseable partial tails; restart after JSON persistence; location and session ties; worktree/folder attribution; owner deletion and key loss; truncation while opening; replacement and rewrite races; appends after the pinned stat; old-cache upgrade; malformed resume state; and stable short reads with single-handle cleanup and no partial ownership publication. An independent actual-source differential check ran 24 seeded append phases with 512 assistant rows, five sessions, three locations, three models, duplicate maxima, shifting metadata, invalid first dates and a JSON round trip before each resume. Sessions, daily aggregates and line counts matched cold scans after every phase. + +Head and committed-boundary digests are evidence for the append-only contract, not a universal proof of every byte. Arbitrary middle-only rewrites that also grow a file while preserving the sampled windows can evade bounded evidence. Same-length dirty files take the full-parse path; changed same-length metadata during a read rejects the snapshot, and small-file validation hashes the full bytes. No new arbitrary history bound is used to conceal this limitation. diff --git a/docs/bug-reproductions/usage-scan-append/claude-cache-representation-final.json b/docs/bug-reproductions/usage-scan-append/claude-cache-representation-final.json new file mode 100644 index 00000000000..3bde3c0b338 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-cache-representation-final.json @@ -0,0 +1,108 @@ +{ + "purpose": "Actual scanner cache representation byte counts; no timing or peak-memory claim.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "baselineRef": "51e7181850b022bae2d41091fe1229accef4bd50", + "baselineCommit": "51e7181850b022bae2d41091fe1229accef4bd50", + "usageKeys": 16384, + "historyBytes": 7547188, + "stateFields": "schema v6; source cache, session/daily projections and fixed scan-state metadata", + "exactColdParity": true, + "crossArmProjectionParity": true, + "serializationParity": true, + "structuredCloneParity": true, + "toolingSha256": "81c89dcf3878d24b94e96f532e123eb513abc753612505fb4f21809bf6dbfe5e", + "arms": { + "baseline": { + "compactFullStateBytes": 472333, + "indentedFullStateBytes": 620903, + "productionFullStateBytes": 620903, + "productionIndent": 2, + "storeSha256": "c2457e55948c1982fd1a1cd045d847c1e6cecb6eb5e9eadfc3647da8c6a226c2", + "ownedKeys": 16384, + "bundleSha256": "907d14f28794e297361ef12724f137d2a4a165a6407a79c7d18e5be51863fb3f", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "HEAD", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "HEAD", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "HEAD", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "HEAD", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "HEAD", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "current": { + "compactFullStateBytes": 768071, + "indentedFullStateBytes": 2555345, + "productionFullStateBytes": 768071, + "productionIndent": null, + "storeSha256": "cd0305c4ed01af5bc8c11c8247feb9bf92d6e9df00551a87574cdff8e7389d0b", + "ownedKeys": 16384, + "bundleSha256": "a2192bd594a8404deabde5036297f47533012edda702466111a547fe40cbb902", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + } + } + } + } +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-discovery-coverage.json b/docs/bug-reproductions/usage-scan-append/claude-discovery-coverage.json new file mode 100644 index 00000000000..77605982351 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-discovery-coverage.json @@ -0,0 +1,105 @@ +{ + "purpose": "Actual bundled scanner under a real unreadable sibling directory; no timing claim.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "baselineRef": "51e7181850b022bae2d41091fe1229accef4bd50", + "baselineCommit": "51e7181850b022bae2d41091fe1229accef4bd50", + "existingCacheSupplied": true, + "exactRecoveryParity": true, + "toolingSha256": "cd988e3a182179144fca36e84ea55add44af4a535e82b79a6e6c1a8c7f5588ba", + "arms": { + "baseline": { + "baselineProcessedFiles": 1, + "outcome": { + "resolved": true, + "processedFiles": 0, + "sessions": 0 + }, + "recoveredProcessedFiles": 1, + "bundleSha256": "fc542d7a8463bf1971ed0fd9244ea16ca124614a2bf18dc9af6f5e723399daab", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "HEAD", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "HEAD", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "HEAD", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "HEAD", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "HEAD", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "current": { + "baselineProcessedFiles": 1, + "outcome": { + "resolved": false, + "code": "EACCES", + "message": "EACCES: permission denied, scandir '/.claude/projects/denied'" + }, + "recoveredProcessedFiles": 1, + "bundleSha256": "f535733732624694dcb761b2c07641c9cca999f1d9d90b9478efc7fc4189ac21", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + } + } + } + } +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-100k.json b/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-100k.json new file mode 100644 index 00000000000..a53028f2b2e --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-100k.json @@ -0,0 +1,509 @@ +{ + "purpose": "Counterbalanced actual scanner and synchronous production cache-load costs after hardening.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "rounds": 4, + "baselineCommit": "51e7181850b022bae2d41091fe1229accef4bd50", + "methodology": { + "fixture": "Fresh temporary transcripts with page-cache-warm I/O; source-cache cold before each round.", + "timing": "Scanner timings include checkpoint build/verify. Serialization follows actual store indent. Load includes JSON.parse and current on-load integrity validation; fs cache read/durable write are excluded.", + "integrityTiming": "Separate actual checksum build and full checkpoint validation calls after parity checks; these are diagnostic components, not additional production scan cost.", + "correctness": "Exact append/fresh parity each arm, cross-arm sessions/daily equality, and loaded aggregate equality." + }, + "toolingSha256": "920c7f5bc20e856ddf73f4f2ec5d47b9e2810b222a378b1a2e3c00650972247e", + "reproductionTool": { + "path": "config/scripts/claude-usage-hardening-cost-benchmark.mjs", + "sha256": "f0b6cd7a16512fb42be591f2cc9baa607cf55ae1870e9aed0bb9163b366b2825", + "differenceFromMeasuredTool": "The shape identifier and output property were renamed to maximaPattern for lint. Replacing all six maximaPattern occurrences with shape in the final tool reconstructs toolingSha256 exactly. Fixtures, timing operations, source graphs, ordering and assertions are unchanged.", + "reversedRenameSha256": "920c7f5bc20e856ddf73f4f2ec5d47b9e2810b222a378b1a2e3c00650972247e" + }, + "storeSha256": { + "baseline": "c2457e55948c1982fd1a1cd045d847c1e6cecb6eb5e9eadfc3647da8c6a226c2", + "current": "cd0305c4ed01af5bc8c11c8247feb9bf92d6e9df00551a87574cdff8e7389d0b" + }, + "scannerSources": { + "baseline": { + "bundleSha256": "8fa164852b09d88c42881945df1244ebba0f5780c5b8ede62ae1826b142a189f", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "HEAD", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "HEAD", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "HEAD", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "HEAD", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "HEAD", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "current": { + "bundleSha256": "e09b4de1d51268c352c70bab0825e25332b48285e3eded65a6870126718e7ffd", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + } + } + } + }, + "validationSources": { + "bundleSha256": "f14a93f752868172797d895f8c1f8224df4ab32e8b6a15ad7d1ea1eac9e71f70", + "sourceFingerprints": { + "src/main/claude-usage/transcript-resume-projection.ts": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153", + "src/main/claude-usage/transcript-projection-integrity.ts": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2", + "src/main/claude-usage/persisted-projection-validation.ts": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94", + "src/main/claude-usage/usage-aggregation.ts": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + } + }, + "scenarios": [ + { + "shape": "repeated-maxima", + "usageKeys": 100000, + "historyBytes": 45577780, + "appendBytes": 449, + "arms": { + "baseline": { + "medians": { + "coldScanMs": 252.208, + "coldTotalLoadMs": 2.344, + "appendScanMs": 242.139, + "appendScanAndPersistSerializationMs": 248.679, + "appendBytesRead": 45578229, + "productionStateBytes": 3882997, + "serializeMs": 5.903, + "parseMs": 2.447, + "loadValidationMs": 0, + "totalLoadMs": 2.447, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + }, + "rawSamples": [ + { + "arm": "baseline", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 244.69212500000003, + "coldTotalLoadMs": 2.2502090000000408, + "appendScanMs": 240.15662500000008, + "appendScanAndPersistSerializationMs": 246.25241600000004, + "appendBytesRead": 45578229, + "productionStateBytes": 3882997, + "serializeMs": 6.095790999999963, + "parseMs": 2.4299590000000535, + "loadValidationMs": 0.0002500000000509317, + "totalLoadMs": 2.4302090000001044, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 257.3152909999999, + "coldTotalLoadMs": 2.476082999999562, + "appendScanMs": 653.5890000000009, + "appendScanAndPersistSerializationMs": 659.2992500000009, + "appendBytesRead": 45578229, + "productionStateBytes": 3882997, + "serializeMs": 5.710250000000087, + "parseMs": 2.309249999999338, + "loadValidationMs": 0.0005410000003394089, + "totalLoadMs": 2.3097909999996773, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 257.255459, + "coldTotalLoadMs": 2.1943750000000364, + "appendScanMs": 244.12229099999968, + "appendScanAndPersistSerializationMs": 251.10512499999913, + "appendBytesRead": 45578229, + "productionStateBytes": 3882997, + "serializeMs": 6.982833999999457, + "parseMs": 2.5047080000003916, + "loadValidationMs": 0.0006249999996725819, + "totalLoadMs": 2.505333000000064, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 247.1598329999997, + "coldTotalLoadMs": 2.438333000000057, + "appendScanMs": 236.5707910000001, + "appendScanAndPersistSerializationMs": 241.675666000001, + "appendBytesRead": 45578229, + "productionStateBytes": 3882996, + "serializeMs": 5.104875000000902, + "parseMs": 2.4630830000005517, + "loadValidationMs": 0.00016700000014679972, + "totalLoadMs": 2.4632500000006985, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + } + ] + }, + "current": { + "medians": { + "coldScanMs": 351.264, + "coldTotalLoadMs": 34.363, + "appendScanMs": 92.349, + "appendScanAndPersistSerializationMs": 96.882, + "appendBytesRead": 25025, + "productionStateBytes": 4782596, + "serializeMs": 4.597, + "parseMs": 6.994, + "loadValidationMs": 21.611, + "totalLoadMs": 28.572, + "integrityBuildMs": 12.419, + "integrityValidateMs": 21.943 + }, + "rawSamples": [ + { + "arm": "current", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 363.798, + "coldTotalLoadMs": 37.02550000000019, + "appendScanMs": 90.91575000000012, + "appendScanAndPersistSerializationMs": 95.35391600000003, + "appendBytesRead": 25025, + "productionStateBytes": 4782596, + "serializeMs": 4.43816599999991, + "parseMs": 6.754249999999956, + "loadValidationMs": 21.650959000000057, + "totalLoadMs": 28.405209000000013, + "integrityBuildMs": 14.753624999999829, + "integrityValidateMs": 25.137666999999965 + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 350.3935839999999, + "coldTotalLoadMs": 30.364207999999962, + "appendScanMs": 93.78304200000002, + "appendScanAndPersistSerializationMs": 98.41070900000022, + "appendBytesRead": 25025, + "productionStateBytes": 4782596, + "serializeMs": 4.627667000000201, + "parseMs": 7.060374999999567, + "loadValidationMs": 20.73075000000017, + "totalLoadMs": 27.791124999999738, + "integrityBuildMs": 12.121792000000369, + "integrityValidateMs": 17.06737499999963 + } + }, + { + "arm": "current", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 352.1350000000002, + "coldTotalLoadMs": 36.62175000000025, + "appendScanMs": 107.52350000000024, + "appendScanAndPersistSerializationMs": 112.09029200000077, + "appendBytesRead": 25025, + "productionStateBytes": 4782596, + "serializeMs": 4.566792000000532, + "parseMs": 6.9273749999993015, + "loadValidationMs": 22.39862500000072, + "totalLoadMs": 29.326000000000022, + "integrityBuildMs": 12.029959000000417, + "integrityValidateMs": 20.325040999999146 + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 341.9473339999995, + "coldTotalLoadMs": 32.10491700000057, + "appendScanMs": 85.23504199999934, + "appendScanAndPersistSerializationMs": 89.97920899999917, + "appendBytesRead": 25025, + "productionStateBytes": 4782596, + "serializeMs": 4.744166999999834, + "parseMs": 7.166833000000224, + "loadValidationMs": 21.57116700000006, + "totalLoadMs": 28.738000000000284, + "integrityBuildMs": 12.717040999999881, + "integrityValidateMs": 23.561249999999745 + } + } + ] + } + } + }, + { + "shape": "unique-maxima", + "usageKeys": 100000, + "historyBytes": 47122805, + "appendBytes": 450, + "arms": { + "baseline": { + "medians": { + "coldScanMs": 250.051, + "coldTotalLoadMs": 2.45, + "appendScanMs": 245.988, + "appendScanAndPersistSerializationMs": 251.654, + "appendBytesRead": 47123255, + "productionStateBytes": 3883159, + "serializeMs": 5.666, + "parseMs": 2.422, + "loadValidationMs": 0, + "totalLoadMs": 2.422, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + }, + "rawSamples": [ + { + "arm": "baseline", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 252.89137500000106, + "coldTotalLoadMs": 2.6044590000001335, + "appendScanMs": 240.32820900000115, + "appendScanAndPersistSerializationMs": 245.81670900000063, + "appendBytesRead": 47123255, + "productionStateBytes": 3883159, + "serializeMs": 5.488499999999476, + "parseMs": 2.243416999999681, + "loadValidationMs": 0.0001250000004802132, + "totalLoadMs": 2.2435420000001614, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 251.0910840000015, + "coldTotalLoadMs": 2.5352080000011483, + "appendScanMs": 251.64820900000086, + "appendScanAndPersistSerializationMs": 257.4912920000006, + "appendBytesRead": 47123255, + "productionStateBytes": 3883159, + "serializeMs": 5.843082999999751, + "parseMs": 2.432667000000947, + "loadValidationMs": 0.00008299999899463728, + "totalLoadMs": 2.432749999999942, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 236.60333399999945, + "coldTotalLoadMs": 2.3370840000006865, + "appendScanMs": 279.01674999999886, + "appendScanAndPersistSerializationMs": 285.58491700000013, + "appendBytesRead": 47123255, + "productionStateBytes": 3883159, + "serializeMs": 6.568167000001267, + "parseMs": 2.4549999999999272, + "loadValidationMs": 0.00016700000014679972, + "totalLoadMs": 2.455167000000074, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 249.01095800000076, + "coldTotalLoadMs": 2.365084000000934, + "appendScanMs": 238.88487499999974, + "appendScanAndPersistSerializationMs": 244.02179199999955, + "appendBytesRead": 47123255, + "productionStateBytes": 3883158, + "serializeMs": 5.136916999999812, + "parseMs": 2.410707999999431, + "loadValidationMs": 0.0005420000015874393, + "totalLoadMs": 2.4112500000010186, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + } + ] + }, + "current": { + "medians": { + "coldScanMs": 376.321, + "coldTotalLoadMs": 34.048, + "appendScanMs": 103.344, + "appendScanAndPersistSerializationMs": 109.479, + "appendBytesRead": 25026, + "productionStateBytes": 6327783, + "serializeMs": 5.971, + "parseMs": 7.33, + "loadValidationMs": 26.131, + "totalLoadMs": 33.42, + "integrityBuildMs": 13.777, + "integrityValidateMs": 19.675 + }, + "rawSamples": [ + { + "arm": "current", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 380.6284579999992, + "coldTotalLoadMs": 35.59991700000137, + "appendScanMs": 108.01837499999965, + "appendScanAndPersistSerializationMs": 114.36554199999955, + "appendBytesRead": 25026, + "productionStateBytes": 6327783, + "serializeMs": 6.347166999999899, + "parseMs": 7.367791999999099, + "loadValidationMs": 26.726082999999562, + "totalLoadMs": 34.09387499999866, + "integrityBuildMs": 13.372209000001021, + "integrityValidateMs": 26.753790999999183 + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 355.4134579999991, + "coldTotalLoadMs": 30.82720800000061, + "appendScanMs": 98.66912499999853, + "appendScanAndPersistSerializationMs": 104.59262499999932, + "appendBytesRead": 25026, + "productionStateBytes": 6327783, + "serializeMs": 5.923500000000786, + "parseMs": 7.30712499999936, + "loadValidationMs": 26.61158400000022, + "totalLoadMs": 33.91870899999958, + "integrityBuildMs": 13.743916999999783, + "integrityValidateMs": 19.450458000001163 + } + }, + { + "arm": "current", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 393.20004100000006, + "coldTotalLoadMs": 33.65516600000046, + "appendScanMs": 120.03058400000009, + "appendScanAndPersistSerializationMs": 125.81766700000117, + "appendBytesRead": 25026, + "productionStateBytes": 6327783, + "serializeMs": 5.787083000001076, + "parseMs": 7.270249999999578, + "loadValidationMs": 25.65058399999907, + "totalLoadMs": 32.92083399999865, + "integrityBuildMs": 13.837499999999636, + "integrityValidateMs": 19.89983299999949 + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 372.01324999999997, + "coldTotalLoadMs": 34.44166699999914, + "appendScanMs": 90.55004200000076, + "appendScanAndPersistSerializationMs": 96.56775000000016, + "appendBytesRead": 25026, + "productionStateBytes": 6327783, + "serializeMs": 6.017707999999402, + "parseMs": 7.353084000000308, + "loadValidationMs": 23.45329099999981, + "totalLoadMs": 30.806375000000116, + "integrityBuildMs": 13.810583000000406, + "integrityValidateMs": 18.219208999998955 + } + } + ] + } + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-16k.json b/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-16k.json new file mode 100644 index 00000000000..03eb9a5295b --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-hardening-cost-16k.json @@ -0,0 +1,813 @@ +{ + "purpose": "Counterbalanced actual scanner and synchronous production cache-load costs after hardening.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "rounds": 8, + "baselineCommit": "51e7181850b022bae2d41091fe1229accef4bd50", + "methodology": { + "fixture": "Fresh temporary transcripts with page-cache-warm I/O; source-cache cold before each round.", + "timing": "Scanner timings include checkpoint build/verify. Serialization follows actual store indent. Load includes JSON.parse and current on-load integrity validation; fs cache read/durable write are excluded.", + "integrityTiming": "Separate actual checksum build and full checkpoint validation calls after parity checks; these are diagnostic components, not additional production scan cost.", + "correctness": "Exact append/fresh parity each arm, cross-arm sessions/daily equality, and loaded aggregate equality." + }, + "toolingSha256": "920c7f5bc20e856ddf73f4f2ec5d47b9e2810b222a378b1a2e3c00650972247e", + "reproductionTool": { + "path": "config/scripts/claude-usage-hardening-cost-benchmark.mjs", + "sha256": "f0b6cd7a16512fb42be591f2cc9baa607cf55ae1870e9aed0bb9163b366b2825", + "differenceFromMeasuredTool": "The shape identifier and output property were renamed to maximaPattern for lint. Replacing all six maximaPattern occurrences with shape in the final tool reconstructs toolingSha256 exactly. Fixtures, timing operations, source graphs, ordering and assertions are unchanged.", + "reversedRenameSha256": "920c7f5bc20e856ddf73f4f2ec5d47b9e2810b222a378b1a2e3c00650972247e" + }, + "storeSha256": { + "baseline": "c2457e55948c1982fd1a1cd045d847c1e6cecb6eb5e9eadfc3647da8c6a226c2", + "current": "cd0305c4ed01af5bc8c11c8247feb9bf92d6e9df00551a87574cdff8e7389d0b" + }, + "scannerSources": { + "baseline": { + "bundleSha256": "5d4538ed011ed038b6959df18be48552282dcc58d9e43e45cdc5a92a58b9b68f", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "HEAD", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "HEAD", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "HEAD", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "HEAD", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "HEAD", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "current": { + "bundleSha256": "aa7e19a6517f9fb8422b146951f89d479fefcd2b20098a4c90f038588fe608cf", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + } + } + } + }, + "validationSources": { + "bundleSha256": "f14a93f752868172797d895f8c1f8224df4ab32e8b6a15ad7d1ea1eac9e71f70", + "sourceFingerprints": { + "src/main/claude-usage/transcript-resume-projection.ts": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153", + "src/main/claude-usage/transcript-projection-integrity.ts": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2", + "src/main/claude-usage/persisted-projection-validation.ts": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94", + "src/main/claude-usage/usage-aggregation.ts": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + } + }, + "scenarios": [ + { + "shape": "repeated-maxima", + "usageKeys": 16384, + "historyBytes": 7448884, + "appendBytes": 449, + "arms": { + "baseline": { + "medians": { + "coldScanMs": 37.752, + "coldTotalLoadMs": 0.421, + "appendScanMs": 37.116, + "appendScanAndPersistSerializationMs": 38.941, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 2.047, + "parseMs": 0.417, + "loadValidationMs": 0, + "totalLoadMs": 0.417, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + }, + "rawSamples": [ + { + "arm": "baseline", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 44.742999999999995, + "coldTotalLoadMs": 0.4714999999999918, + "appendScanMs": 47.346833000000004, + "appendScanAndPersistSerializationMs": 48.30983299999997, + "appendBytesRead": 7449333, + "productionStateBytes": 620836, + "serializeMs": 0.9629999999999654, + "parseMs": 0.4680420000000254, + "loadValidationMs": 0.00016599999997879422, + "totalLoadMs": 0.4682080000000042, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 37.952334000000064, + "coldTotalLoadMs": 0.40362500000003365, + "appendScanMs": 35.702749999999924, + "appendScanAndPersistSerializationMs": 37.89533299999994, + "appendBytesRead": 7449333, + "productionStateBytes": 620836, + "serializeMs": 2.1925830000000133, + "parseMs": 0.41466699999989487, + "loadValidationMs": 0.00008300000001781882, + "totalLoadMs": 0.4147499999999127, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 36.665416999999934, + "coldTotalLoadMs": 0.4542500000000018, + "appendScanMs": 37.70425, + "appendScanAndPersistSerializationMs": 40.04933399999982, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 2.345083999999815, + "parseMs": 0.44604100000015023, + "loadValidationMs": 0.00012500000002546585, + "totalLoadMs": 0.4461660000001757, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 38.048333000000184, + "coldTotalLoadMs": 0.49966600000016115, + "appendScanMs": 36.15591699999982, + "appendScanAndPersistSerializationMs": 38.056707999999844, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 1.9007910000000265, + "parseMs": 0.38012499999990723, + "loadValidationMs": 0.00004200000012133387, + "totalLoadMs": 0.38016700000002857, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 5, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 34.67145800000003, + "coldTotalLoadMs": 0.40829200000007404, + "appendScanMs": 35.23712499999988, + "appendScanAndPersistSerializationMs": 37.448875000000044, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 2.2117500000001655, + "parseMs": 0.44404199999985394, + "loadValidationMs": 0.00008300000013150566, + "totalLoadMs": 0.44412499999998545, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 6, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 43.71345900000006, + "coldTotalLoadMs": 0.43308299999989686, + "appendScanMs": 40.50920899999983, + "appendScanAndPersistSerializationMs": 41.33020899999974, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 0.8209999999999127, + "parseMs": 0.4189169999999649, + "loadValidationMs": 0.00016700000014679972, + "totalLoadMs": 0.4190840000001117, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 7, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 35.495584000000235, + "coldTotalLoadMs": 0.40870799999993324, + "appendScanMs": 37.22674999999981, + "appendScanAndPersistSerializationMs": 38.65425000000005, + "appendBytesRead": 7449333, + "productionStateBytes": 620837, + "serializeMs": 1.4275000000002365, + "parseMs": 0.39220899999963876, + "loadValidationMs": 0.00008300000035887933, + "totalLoadMs": 0.39229199999999764, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 8, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 37.552042000000256, + "coldTotalLoadMs": 0.3859579999998459, + "appendScanMs": 37.00608299999976, + "appendScanAndPersistSerializationMs": 39.22695799999974, + "appendBytesRead": 7449333, + "productionStateBytes": 620836, + "serializeMs": 2.220874999999978, + "parseMs": 0.3993329999998423, + "loadValidationMs": 0.0002090000002681336, + "totalLoadMs": 0.3995420000001104, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + } + ] + }, + "current": { + "medians": { + "coldScanMs": 67.349, + "coldTotalLoadMs": 5.061, + "appendScanMs": 13.969, + "appendScanAndPersistSerializationMs": 14.766, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.776, + "parseMs": 1.256, + "loadValidationMs": 3.807, + "totalLoadMs": 5.015, + "integrityBuildMs": 2.015, + "integrityValidateMs": 3.502 + }, + "rawSamples": [ + { + "arm": "current", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 67.609375, + "coldTotalLoadMs": 6.358833000000004, + "appendScanMs": 17.94291700000008, + "appendScanAndPersistSerializationMs": 18.767917000000125, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.8250000000000455, + "parseMs": 1.1690419999999904, + "loadValidationMs": 3.7737919999999576, + "totalLoadMs": 4.942833999999948, + "integrityBuildMs": 4.206624999999917, + "integrityValidateMs": 4.717417000000069 + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 68.33954100000005, + "coldTotalLoadMs": 5.232917000000043, + "appendScanMs": 14.430000000000064, + "appendScanAndPersistSerializationMs": 15.274833000000058, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.8448329999999942, + "parseMs": 1.2095839999999498, + "loadValidationMs": 6.225250000000074, + "totalLoadMs": 7.4348340000000235, + "integrityBuildMs": 1.83787499999994, + "integrityValidateMs": 2.9342080000000124 + } + }, + { + "arm": "current", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 66.62920800000006, + "coldTotalLoadMs": 6.085083999999824, + "appendScanMs": 16.03120799999988, + "appendScanAndPersistSerializationMs": 16.761999999999944, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.730792000000065, + "parseMs": 1.2905409999998483, + "loadValidationMs": 3.4082499999999527, + "totalLoadMs": 4.698790999999801, + "integrityBuildMs": 1.9406249999999545, + "integrityValidateMs": 3.9299170000001595 + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 65.32433399999991, + "coldTotalLoadMs": 4.888124999999945, + "appendScanMs": 13.508249999999862, + "appendScanAndPersistSerializationMs": 14.256415999999717, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.7481659999998556, + "parseMs": 1.2214170000002014, + "loadValidationMs": 3.5818749999998545, + "totalLoadMs": 4.803292000000056, + "integrityBuildMs": 2.049209000000019, + "integrityValidateMs": 3.073124999999891 + } + }, + { + "arm": "current", + "round": 5, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 68.996625, + "coldTotalLoadMs": 7.901791000000003, + "appendScanMs": 14.517166000000088, + "appendScanAndPersistSerializationMs": 15.28174899999999, + "appendBytesRead": 25025, + "productionStateBytes": 767991, + "serializeMs": 0.7645829999999023, + "parseMs": 1.312750000000051, + "loadValidationMs": 4.205459000000019, + "totalLoadMs": 5.51820900000007, + "integrityBuildMs": 6.7356660000000375, + "integrityValidateMs": 10.99433399999998 + } + }, + { + "arm": "current", + "round": 6, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 83.23908300000016, + "coldTotalLoadMs": 4.842542000000094, + "appendScanMs": 13.15341699999999, + "appendScanAndPersistSerializationMs": 13.945083999999952, + "appendBytesRead": 25025, + "productionStateBytes": 767991, + "serializeMs": 0.7916669999999613, + "parseMs": 1.2651250000001255, + "loadValidationMs": 5.360707999999931, + "totalLoadMs": 6.625833000000057, + "integrityBuildMs": 2.2442080000000715, + "integrityValidateMs": 5.222541999999976 + } + }, + { + "arm": "current", + "round": 7, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 65.10058400000025, + "coldTotalLoadMs": 4.817915999999968, + "appendScanMs": 13.17687500000011, + "appendScanAndPersistSerializationMs": 13.964042000000063, + "appendBytesRead": 25025, + "productionStateBytes": 767991, + "serializeMs": 0.787166999999954, + "parseMs": 1.2459579999999733, + "loadValidationMs": 3.8404170000003433, + "totalLoadMs": 5.0863750000003165, + "integrityBuildMs": 1.9802079999999478, + "integrityValidateMs": 2.5614999999997963 + } + }, + { + "arm": "current", + "round": 8, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 67.08950000000004, + "coldTotalLoadMs": 4.859875000000102, + "appendScanMs": 12.91858400000001, + "appendScanAndPersistSerializationMs": 13.657416999999896, + "appendBytesRead": 25025, + "productionStateBytes": 767993, + "serializeMs": 0.7388329999998859, + "parseMs": 1.300083000000086, + "loadValidationMs": 3.4739999999997053, + "totalLoadMs": 4.774082999999791, + "integrityBuildMs": 1.9511250000000473, + "integrityValidateMs": 2.7612080000003516 + } + } + ] + } + } + }, + { + "shape": "unique-maxima", + "usageKeys": 16384, + "historyBytes": 7655918, + "appendBytes": 450, + "arms": { + "baseline": { + "medians": { + "coldScanMs": 38.944, + "coldTotalLoadMs": 0.396, + "appendScanMs": 36.612, + "appendScanAndPersistSerializationMs": 38.47, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 2.236, + "parseMs": 0.414, + "loadValidationMs": 0, + "totalLoadMs": 0.415, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + }, + "rawSamples": [ + { + "arm": "baseline", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 38.0874160000003, + "coldTotalLoadMs": 0.41608399999995527, + "appendScanMs": 36.59429100000034, + "appendScanAndPersistSerializationMs": 38.360499000000345, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 1.766208000000006, + "parseMs": 0.39458399999966787, + "loadValidationMs": 0.00012500000002546585, + "totalLoadMs": 0.39470899999969333, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 38.75774999999976, + "coldTotalLoadMs": 0.37887499999987995, + "appendScanMs": 35.18437499999982, + "appendScanAndPersistSerializationMs": 37.423707999999806, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 2.239332999999988, + "parseMs": 0.4572499999999309, + "loadValidationMs": 0.00012500000002546585, + "totalLoadMs": 0.45737499999995634, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 35.229707999999846, + "coldTotalLoadMs": 0.39225000000033106, + "appendScanMs": 35.52741699999979, + "appendScanAndPersistSerializationMs": 37.81195799999978, + "appendBytesRead": 7656368, + "productionStateBytes": 620948, + "serializeMs": 2.28454099999999, + "parseMs": 0.4282499999999345, + "loadValidationMs": 0.0002500000000509317, + "totalLoadMs": 0.42849999999998545, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 39.13066699999945, + "coldTotalLoadMs": 0.39333299999998417, + "appendScanMs": 36.79058299999997, + "appendScanAndPersistSerializationMs": 38.57945800000016, + "appendBytesRead": 7656368, + "productionStateBytes": 620947, + "serializeMs": 1.7888750000001892, + "parseMs": 0.39562499999919964, + "loadValidationMs": 0.00020800000038434519, + "totalLoadMs": 0.395832999999584, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 5, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 53.61479099999997, + "coldTotalLoadMs": 1.1569580000004862, + "appendScanMs": 110.8402500000002, + "appendScanAndPersistSerializationMs": 113.0722910000004, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 2.2320410000002084, + "parseMs": 0.44279199999982666, + "loadValidationMs": 0.0002500000000509317, + "totalLoadMs": 0.4430419999998776, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 6, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 40.08420800000022, + "coldTotalLoadMs": 0.3982080000005226, + "appendScanMs": 57.06658299999981, + "appendScanAndPersistSerializationMs": 59.362333000000035, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 2.2957500000002256, + "parseMs": 0.4005409999999756, + "loadValidationMs": 0.00008399999933317304, + "totalLoadMs": 0.4006249999993088, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 7, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 52.99920800000018, + "coldTotalLoadMs": 0.38966699999946286, + "appendScanMs": 36.63041599999997, + "appendScanAndPersistSerializationMs": 40.35299899999973, + "appendBytesRead": 7656368, + "productionStateBytes": 620949, + "serializeMs": 3.7225829999997586, + "parseMs": 0.4888340000006792, + "loadValidationMs": 0.00016599999980826396, + "totalLoadMs": 0.4890000000004875, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + }, + { + "arm": "baseline", + "round": 8, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 38.40016699999978, + "coldTotalLoadMs": 0.41808300000047893, + "appendScanMs": 36.11170799999945, + "appendScanAndPersistSerializationMs": 37.786707999999635, + "appendBytesRead": 7656368, + "productionStateBytes": 620948, + "serializeMs": 1.675000000000182, + "parseMs": 0.39637499999935244, + "loadValidationMs": 0.00016600000071775867, + "totalLoadMs": 0.3965410000000702, + "integrityBuildMs": 0, + "integrityValidateMs": 0 + } + } + ] + }, + "current": { + "medians": { + "coldScanMs": 67.817, + "coldTotalLoadMs": 4.719, + "appendScanMs": 13.49, + "appendScanAndPersistSerializationMs": 14.434, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 0.955, + "parseMs": 1.302, + "loadValidationMs": 3.663, + "totalLoadMs": 4.967, + "integrityBuildMs": 2.281, + "integrityValidateMs": 2.947 + }, + "rawSamples": [ + { + "arm": "current", + "round": 1, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 66.22291599999971, + "coldTotalLoadMs": 4.71408399999973, + "appendScanMs": 13.514040999999906, + "appendScanAndPersistSerializationMs": 14.436999000000014, + "appendBytesRead": 25026, + "productionStateBytes": 975137, + "serializeMs": 0.9229580000001079, + "parseMs": 1.2377089999999953, + "loadValidationMs": 3.3647500000001855, + "totalLoadMs": 4.602459000000181, + "integrityBuildMs": 2.1331670000004124, + "integrityValidateMs": 2.662166999999954 + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 59.488292, + "coldTotalLoadMs": 4.399667000000136, + "appendScanMs": 13.37091700000019, + "appendScanAndPersistSerializationMs": 14.318125000000236, + "appendBytesRead": 25026, + "productionStateBytes": 975135, + "serializeMs": 0.947208000000046, + "parseMs": 1.4998749999999745, + "loadValidationMs": 5.851749999999811, + "totalLoadMs": 7.351624999999785, + "integrityBuildMs": 2.081499999999778, + "integrityValidateMs": 2.815042000000176 + } + }, + { + "arm": "current", + "round": 3, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 67.3109999999997, + "coldTotalLoadMs": 5.846125000000029, + "appendScanMs": 14.361457999999857, + "appendScanAndPersistSerializationMs": 15.341374999999971, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 0.9799170000001141, + "parseMs": 1.3232499999999163, + "loadValidationMs": 3.9736250000000837, + "totalLoadMs": 5.296875, + "integrityBuildMs": 2.6837499999996908, + "integrityValidateMs": 3.4579170000001795 + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 70.90108399999963, + "coldTotalLoadMs": 5.18887500000028, + "appendScanMs": 14.66675000000032, + "appendScanAndPersistSerializationMs": 15.72729100000015, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 1.06054099999983, + "parseMs": 1.2460000000000946, + "loadValidationMs": 3.9899170000003323, + "totalLoadMs": 5.235917000000427, + "integrityBuildMs": 3.01575000000048, + "integrityValidateMs": 2.925833999999668 + } + }, + { + "arm": "current", + "round": 5, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 64.8296249999994, + "coldTotalLoadMs": 4.7841660000003685, + "appendScanMs": 13.329332999999679, + "appendScanAndPersistSerializationMs": 14.248665999999503, + "appendBytesRead": 25026, + "productionStateBytes": 975137, + "serializeMs": 0.9193329999998241, + "parseMs": 1.3276670000004742, + "loadValidationMs": 3.5367499999993015, + "totalLoadMs": 4.864416999999776, + "integrityBuildMs": 2.7073749999999563, + "integrityValidateMs": 2.967250000000604 + } + }, + { + "arm": "current", + "round": 6, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 68.32275000000027, + "coldTotalLoadMs": 4.5650830000004134, + "appendScanMs": 13.466667000000598, + "appendScanAndPersistSerializationMs": 14.430209000001014, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 0.963542000000416, + "parseMs": 1.2813749999995707, + "loadValidationMs": 3.7887080000000424, + "totalLoadMs": 5.070082999999613, + "integrityBuildMs": 2.2954579999995985, + "integrityValidateMs": 3.236167000000023 + } + }, + { + "arm": "current", + "round": 7, + "order": ["baseline", "current"], + "metrics": { + "coldScanMs": 69.52191700000003, + "coldTotalLoadMs": 4.724457999999686, + "appendScanMs": 13.275791000000027, + "appendScanAndPersistSerializationMs": 14.2417489999998, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 0.9659579999997732, + "parseMs": 1.199416999999812, + "loadValidationMs": 3.3308750000005602, + "totalLoadMs": 4.530292000000372, + "integrityBuildMs": 2.143332999999984, + "integrityValidateMs": 2.789708000000246 + } + }, + { + "arm": "current", + "round": 8, + "order": ["current", "baseline"], + "metrics": { + "coldScanMs": 71.58233300000029, + "coldTotalLoadMs": 4.53650000000016, + "appendScanMs": 13.611042000000452, + "appendScanAndPersistSerializationMs": 14.511583999999857, + "appendBytesRead": 25026, + "productionStateBytes": 975139, + "serializeMs": 0.9005419999994047, + "parseMs": 1.3917499999997744, + "loadValidationMs": 3.3744580000002316, + "totalLoadMs": 4.766208000000006, + "integrityBuildMs": 2.266791000000012, + "integrityValidateMs": 3.43158399999993 + } + } + ] + } + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-persisted-bytes-final.json b/docs/bug-reproductions/usage-scan-append/claude-persisted-bytes-final.json new file mode 100644 index 00000000000..02a8a5fe432 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-persisted-bytes-final.json @@ -0,0 +1,524 @@ +{ + "purpose": "Four-arm actual production persistence bytes and dominant cache fields; no timing claim.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "exactColdParity": true, + "crossArmProjectionParity": true, + "methodology": "Original/published use their actual store indentation and full-state layout. Fixed main/current use their production source writers and report serializers. Source component lengths exclude enclosing property names and are diagnostic, not additive file sizes.", + "toolingSha256": "21f2027141170c14fec6d99d2e05a3e2a8c96398d5ac0f010bf46e2189937210", + "arms": { + "original": { + "commit": "51e7181850b022bae2d41091fe1229accef4bd50", + "storeSha256": "c2457e55948c1982fd1a1cd045d847c1e6cecb6eb5e9eadfc3647da8c6a226c2", + "scanner": { + "bundleSha256": "175af54a3682272a1150a20d95aac86e844d4584ec0d3fe0e2df94ad61f2d50a", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": null + }, + "published": { + "commit": "8467877ed92aba2ef59737aebf461e9cab52c273", + "storeSha256": "cd0305c4ed01af5bc8c11c8247feb9bf92d6e9df00551a87574cdff8e7389d0b", + "scanner": { + "bundleSha256": "7a33f4baae56fbd792c3b9c357b524b35f86842fcd8d0f7953b6e5bbf69c448e", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + } + } + }, + "persistence": { + "bundleSha256": "4534b3ff429df50140595ee536507c33f0a8b45434f09d7446f4592a37dbe2fb", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7df97e1a448696348cf89506085ea4959a7e876dae1a03b8ef02e32346feb295" + }, + "src/main/durable-file-write.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "baffe60b5c403b0d65afc7608c1903f726dee12d61a597c1d9525c82b4ed7bc4" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "49759bda2ba0efb81ac785eb13d4c51685dac505f5aa245144d441353793b5b0" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1ecfcf5f829617792a2b16615001aee4c888cc80c3e8156191378c4a57d637b6" + }, + "src/shared/node-file-content-equality.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "storeSha256": "7247d4f8288249a95085a2150048c76b797d64d7e21bf432802b5881c2a0f2ab", + "scanner": { + "bundleSha256": "175af54a3682272a1150a20d95aac86e844d4584ec0d3fe0e2df94ad61f2d50a", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + }, + "current": { + "commit": null, + "storeSha256": "5beb17f973fbd12b70408e7c8526fda9486ca3fdba2acc89dccb3b0f6d3e8b39", + "scanner": { + "bundleSha256": "a24af33ca4e1136d226138b5d72d87e5c14d5e036ac5b423d82849369af4d27e", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + } + }, + "scenarios": [ + { + "usageKeys": 16384, + "maximaPattern": "repeated", + "historyBytes": 7465268, + "suffixBytes": 451, + "fixtureSha256": "163097e7bfa38f448092dcbb0504fd1dd84ec764817ec832d108a47477e46bc7", + "measurements": { + "original": { + "sourceBytes": 0, + "reportBytes": 620849, + "totalPersistedBytes": 620849, + "productionIndent": 2, + "sourceComponents": { + "fileBytes": 470833, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "published": { + "sourceBytes": 0, + "reportBytes": 768008, + "totalPersistedBytes": 768008, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 766562, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": 294915, + "columnValueCounts": null, + "projectionCount": 1 + } + }, + "main": { + "sourceBytes": 470892, + "reportBytes": 1426, + "totalPersistedBytes": 472318, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 470833, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "current": { + "sourceBytes": 537366, + "reportBytes": 1510, + "totalPersistedBytes": 538876, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 537223, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": 65553, + "tokenRowsBytes": null, + "columnValueCounts": [16384, 1, 1, 1, 1, 1], + "projectionCount": 1 + } + } + } + }, + { + "usageKeys": 100000, + "maximaPattern": "unique", + "historyBytes": 47222805, + "suffixBytes": 453, + "fixtureSha256": "163d23cf818509bbff5809e45d0a21d3ace7ea929a90a531b4634ab7da992f48", + "measurements": { + "original": { + "sourceBytes": 0, + "reportBytes": 3883175, + "totalPersistedBytes": 3883175, + "productionIndent": 2, + "sourceComponents": { + "fileBytes": 2979821, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "published": { + "sourceBytes": 0, + "reportBytes": 6327802, + "totalPersistedBytes": 6327802, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 6325850, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": 3345029, + "columnValueCounts": null, + "projectionCount": 2 + } + }, + "main": { + "sourceBytes": 2979880, + "reportBytes": 1932, + "totalPersistedBytes": 2981812, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 2979821, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "current": { + "sourceBytes": 6126030, + "reportBytes": 2016, + "totalPersistedBytes": 6128046, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 6125887, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": 3145041, + "tokenRowsBytes": null, + "columnValueCounts": [100000, 100000, 100000, 100000, 100000, 100000], + "projectionCount": 2 + } + } + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-100k.json b/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-100k.json new file mode 100644 index 00000000000..6d3287286a5 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-100k.json @@ -0,0 +1,1577 @@ +{ + "purpose": "Actual pinned Claude scanner, source-cache and durable report persistence costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "usageKeys": 100000, + "maximaPattern": "unique", + "rounds": 6, + "historyBytes": 47322805, + "suffixBytes": 454, + "fixtureSha256": "611c1359a4b2a8d9a9f313af0470d43864ea7aee1ff9e653e1ec6ebbaadca0bb", + "methodology": { + "timing": "Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.", + "refresh": "Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.", + "published": "Published B keeps source records in memory; sourceReadBytes=0 reflects that architecture. Its report contains those records.", + "exclusions": "Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.", + "attribution": "Merged-main source/report ownership is inherited; compare current to fixed main to isolate this PR, and published to current for the combined user-visible change.", + "correctness": "Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.", + "writtenBytes": "Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals." + }, + "toolingSha256": "858f4418ee5a099fb566285538b511827b4367b006a4805b16093ef42732efa5", + "supportToolingSha256": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "arms": { + "published": { + "commit": "8467877ed92aba2ef59737aebf461e9cab52c273", + "scanner": { + "bundleSha256": "da0dbbc43d545ad27beea044d3a2c11e6370c0136bb92fd94edc93ff1296b764", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + } + } + }, + "persistence": { + "bundleSha256": "4534b3ff429df50140595ee536507c33f0a8b45434f09d7446f4592a37dbe2fb", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7df97e1a448696348cf89506085ea4959a7e876dae1a03b8ef02e32346feb295" + }, + "src/main/durable-file-write.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "baffe60b5c403b0d65afc7608c1903f726dee12d61a597c1d9525c82b4ed7bc4" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "49759bda2ba0efb81ac785eb13d4c51685dac505f5aa245144d441353793b5b0" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1ecfcf5f829617792a2b16615001aee4c888cc80c3e8156191378c4a57d637b6" + }, + "src/shared/node-file-content-equality.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549" + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "c53167b520273be858d3b9318840aa7380c5c1e5d5f00c8404fab0606fda84e9", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549" + } + } + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "e90f01e776b3eddae71b022bd34e828ae2a994c0ba2fc663526768d55d9018a6", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + } + }, + "summary": { + "published": { + "cold": { + "scanMs": 354.908, + "completeRefreshMs": 385.203, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 6.696, + "reportDurableWriteMs": 21.016, + "totalPersistMs": 27.61, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.001, + "scanMs": 9.438, + "completeRefreshMs": 34.915, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 6.8, + "reportDurableWriteMs": 18.064, + "totalPersistMs": 25.879, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "append": { + "sourceReadVerifyDecodeMs": 0.001, + "scanMs": 105.96, + "completeRefreshMs": 128.631, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 6.677, + "reportDurableWriteMs": 16.07, + "totalPersistMs": 22.83, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822 + } + }, + "main": { + "cold": { + "scanMs": 231.64, + "completeRefreshMs": 265.264, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 20.554, + "reportSerializeSealMs": 0.023, + "reportDurableWriteMs": 13.23, + "totalPersistMs": 33.803, + "sourceBytes": 2979887.5, + "sourceBytesWritten": 2979887.5, + "reportBytes": 1939, + "totalWrittenBytes": 2981826.5, + "totalPersistedBytes": 2981826.5 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.214, + "scanMs": 9.065, + "completeRefreshMs": 36.95, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979887.5, + "totalReadBytes": 2979887.5, + "sourceWritePackSealDurableMs": 14.061, + "reportSerializeSealMs": 0.014, + "reportDurableWriteMs": 9.981, + "totalPersistMs": 23.913, + "sourceBytes": 2979887.5, + "sourceBytesWritten": 2979887.5, + "reportBytes": 1939, + "totalWrittenBytes": 2981826.5, + "totalPersistedBytes": 2981826.5 + }, + "append": { + "sourceReadVerifyDecodeMs": 3.226, + "scanMs": 232.277, + "completeRefreshMs": 267.204, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979887.5, + "totalReadBytes": 50303146.5, + "sourceWritePackSealDurableMs": 19.51, + "reportSerializeSealMs": 0.022, + "reportDurableWriteMs": 10.977, + "totalPersistMs": 30.339, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827 + } + }, + "current": { + "cold": { + "scanMs": 344.475, + "completeRefreshMs": 390.682, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 32.709, + "reportSerializeSealMs": 0.047, + "reportDurableWriteMs": 12.23, + "totalPersistMs": 45.735, + "sourceBytes": 6126038, + "sourceBytesWritten": 6126038, + "reportBytes": 2023, + "totalWrittenBytes": 6128061, + "totalPersistedBytes": 6128061 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.701, + "scanMs": 9.677, + "completeRefreshMs": 30.662, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126038, + "totalReadBytes": 6126038, + "sourceWritePackSealDurableMs": 0.004, + "reportSerializeSealMs": 0.025, + "reportDurableWriteMs": 10.135, + "totalPersistMs": 10.17, + "sourceBytes": 6126038, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128061 + }, + "append": { + "sourceReadVerifyDecodeMs": 10.766, + "scanMs": 36.869, + "completeRefreshMs": 84.152, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126038, + "totalReadBytes": 6151068, + "sourceWritePackSealDurableMs": 27.307, + "reportSerializeSealMs": 0.042, + "reportDurableWriteMs": 10.648, + "totalPersistMs": 38.406, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064 + } + } + }, + "samples": [ + { + "arm": "published", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 350.2035420000002, + "completeRefreshMs": 383.6320000000005, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0008750000006330083, + "reportSerializeSealMs": 6.112374999999702, + "reportDurableWriteMs": 27.315207999999984, + "totalPersistMs": 33.42845800000032, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.006166999999550171, + "scanMs": 11.312458000000333, + "completeRefreshMs": 34.12587500000063, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00020800000038434519, + "reportSerializeSealMs": 6.3252080000002024, + "reportDurableWriteMs": 16.481834000000163, + "totalPersistMs": 22.80725000000075, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.00429100000019389, + "scanMs": 90.98154199999954, + "completeRefreshMs": 113.47541599999931, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.000249999999141437, + "reportSerializeSealMs": 6.344000000000051, + "reportDurableWriteMs": 16.14533300000039, + "totalPersistMs": 22.489582999999584, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 226.69566699999996, + "completeRefreshMs": 253.9801669999997, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 15.857790999999452, + "reportSerializeSealMs": 0.025791999999455584, + "reportDurableWriteMs": 11.400917000000845, + "totalPersistMs": 27.284499999999753, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.2851250000003347, + "scanMs": 11.226166999999805, + "completeRefreshMs": 38.32037599999967, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979887, + "totalReadBytes": 2979887, + "sourceWritePackSealDurableMs": 14.280334000000039, + "reportSerializeSealMs": 0.016833000000588072, + "reportDurableWriteMs": 9.511916999998903, + "totalPersistMs": 23.80908399999953, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.3949579999998605, + "scanMs": 227.79216700000052, + "completeRefreshMs": 257.99516700000004, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979887, + "totalReadBytes": 50303146, + "sourceWritePackSealDurableMs": 16.42883299999994, + "reportSerializeSealMs": 0.017291000000113854, + "reportDurableWriteMs": 10.361917999999605, + "totalPersistMs": 26.80804199999966, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 347.4517910000004, + "completeRefreshMs": 394.0812910000004, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 32.281958000000486, + "reportSerializeSealMs": 0.050917000000481494, + "reportDurableWriteMs": 14.29662499999904, + "totalPersistMs": 46.62950000000001, + "sourceBytes": 6126036, + "sourceBytesWritten": 6126036, + "reportBytes": 2023, + "totalWrittenBytes": 6128059, + "totalPersistedBytes": 6128059 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.455040999999255, + "scanMs": 10.550459000000046, + "completeRefreshMs": 30.576500000000124, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126036, + "totalReadBytes": 6126036, + "sourceWritePackSealDurableMs": 0.0027500000005602487, + "reportSerializeSealMs": 0.02529199999935372, + "reportDurableWriteMs": 9.542958000000908, + "totalPersistMs": 9.571000000000822, + "sourceBytes": 6126036, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128059, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.941291999999521, + "scanMs": 40.36629200000061, + "completeRefreshMs": 90.28750099999979, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126036, + "totalReadBytes": 6151066, + "sourceWritePackSealDurableMs": 28.436499999999796, + "reportSerializeSealMs": 0.048374999999396096, + "reportDurableWriteMs": 10.495042000000467, + "totalPersistMs": 38.97991699999966, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 338.9710420000001, + "completeRefreshMs": 379.9277920000004, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 28.706250000000182, + "reportSerializeSealMs": 0.04320900000038819, + "reportDurableWriteMs": 12.207290999999714, + "totalPersistMs": 40.956750000000284, + "sourceBytes": 6126038, + "sourceBytesWritten": 6126038, + "reportBytes": 2023, + "totalWrittenBytes": 6128061, + "totalPersistedBytes": 6128061 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.33849999999984, + "scanMs": 9.764291999999841, + "completeRefreshMs": 31.621874999999818, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126038, + "totalReadBytes": 6126038, + "sourceWritePackSealDurableMs": 0.003208000000086031, + "reportSerializeSealMs": 0.023541999999906693, + "reportDurableWriteMs": 11.492333000000144, + "totalPersistMs": 11.519083000000137, + "sourceBytes": 6126038, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128061, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 11.625958000000537, + "scanMs": 32.50983300000007, + "completeRefreshMs": 82.70912400000088, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126038, + "totalReadBytes": 6151068, + "sourceWritePackSealDurableMs": 27.815166000000318, + "reportSerializeSealMs": 0.047040999999808264, + "reportDurableWriteMs": 10.71112600000015, + "totalPersistMs": 38.573333000000275, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 229.4298749999998, + "completeRefreshMs": 261.60208299999977, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 19.927875000000313, + "reportSerializeSealMs": 0.02020899999934045, + "reportDurableWriteMs": 12.224124000000302, + "totalPersistMs": 32.172207999999955, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.9987920000003214, + "scanMs": 10.980249999999614, + "completeRefreshMs": 37.499291999999514, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979888, + "totalReadBytes": 2979888, + "sourceWritePackSealDurableMs": 13.89929200000006, + "reportSerializeSealMs": 0.017124999999396096, + "reportDurableWriteMs": 9.603833000000122, + "totalPersistMs": 23.520249999999578, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.0389160000004267, + "scanMs": 230.7146670000002, + "completeRefreshMs": 262.31487500000003, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979888, + "totalReadBytes": 50303147, + "sourceWritePackSealDurableMs": 19.185333999999784, + "reportSerializeSealMs": 0.019790999999713677, + "reportDurableWriteMs": 9.356166999999914, + "totalPersistMs": 28.561291999999412, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 336.290500000001, + "completeRefreshMs": 360.93916700000227, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0001250000004802132, + "reportSerializeSealMs": 5.901332999999795, + "reportDurableWriteMs": 18.74720900000102, + "totalPersistMs": 24.648667000001296, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.005875000000742148, + "scanMs": 7.807208000000173, + "completeRefreshMs": 30.284041000000798, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00020799999947485048, + "reportSerializeSealMs": 5.994916999999987, + "reportDurableWriteMs": 16.47583300000042, + "totalPersistMs": 22.470957999999882, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.004665999998906045, + "scanMs": 100.06158400000095, + "completeRefreshMs": 124.68233399999917, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.00033399999847461004, + "reportSerializeSealMs": 6.26508400000057, + "reportDurableWriteMs": 18.350666000000274, + "totalPersistMs": 24.61608399999932, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 236.2081249999992, + "completeRefreshMs": 268.9262089999993, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 20.16029200000048, + "reportSerializeSealMs": 0.023165999999037012, + "reportDurableWriteMs": 12.534626000000571, + "totalPersistMs": 32.71808400000009, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.204458000000159, + "scanMs": 9.155833000000712, + "completeRefreshMs": 38.323333000002094, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979887, + "totalReadBytes": 2979887, + "sourceWritePackSealDurableMs": 14.883333000001585, + "reportSerializeSealMs": 0.014624999999796273, + "reportDurableWriteMs": 11.065083999999842, + "totalPersistMs": 25.963042000001224, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.223915999999008, + "scanMs": 233.838667, + "completeRefreshMs": 272.092290999999, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979887, + "totalReadBytes": 50303146, + "sourceWritePackSealDurableMs": 21.75641700000051, + "reportSerializeSealMs": 0.028667000000496046, + "reportDurableWriteMs": 13.244623999999021, + "totalPersistMs": 35.02970800000003, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 358.1082499999993, + "completeRefreshMs": 386.7738329999993, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0003329999999550637, + "reportSerializeSealMs": 7.2796670000007, + "reportDurableWriteMs": 21.385582999999315, + "totalPersistMs": 28.66558299999997, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.00112500000068394, + "scanMs": 12.035832999999911, + "completeRefreshMs": 38.23333300000013, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.0003329999999550637, + "reportSerializeSealMs": 7.807624999999462, + "reportDurableWriteMs": 18.388417000000118, + "totalPersistMs": 26.196374999999534, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0004169999992882367, + "scanMs": 116.20254100000056, + "completeRefreshMs": 140.03004099999998, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.00020799999947485048, + "reportSerializeSealMs": 7.009792000000743, + "reportDurableWriteMs": 16.81708299999991, + "totalPersistMs": 23.82708300000013, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 344.9873750000006, + "completeRefreshMs": 389.8274170000004, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 33.135167000000365, + "reportSerializeSealMs": 0.04754099999991013, + "reportDurableWriteMs": 11.657333999999537, + "totalPersistMs": 44.84004199999981, + "sourceBytes": 6126036, + "sourceBytesWritten": 6126036, + "reportBytes": 2023, + "totalWrittenBytes": 6128059, + "totalPersistedBytes": 6128059 + }, + "warm": { + "sourceReadVerifyDecodeMs": 11.467792000001282, + "scanMs": 9.817250000000058, + "completeRefreshMs": 31.275625000002037, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126036, + "totalReadBytes": 6126036, + "sourceWritePackSealDurableMs": 0.017583000000740867, + "reportSerializeSealMs": 0.02508300000044983, + "reportDurableWriteMs": 9.947916999999507, + "totalPersistMs": 9.990583000000697, + "sourceBytes": 6126036, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128059, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.920333000000028, + "scanMs": 38.87437499999942, + "completeRefreshMs": 87.09399900000062, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126036, + "totalReadBytes": 6151066, + "sourceWritePackSealDurableMs": 25.940207999999984, + "reportSerializeSealMs": 0.042457999999896856, + "reportDurableWriteMs": 11.316625000001295, + "totalPersistMs": 37.299291000001176, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 351.1566249999996, + "completeRefreshMs": 398.47208300000057, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 35.94225000000006, + "reportSerializeSealMs": 0.05783300000075542, + "reportDurableWriteMs": 11.315375000000131, + "totalPersistMs": 47.315458000000945, + "sourceBytes": 6126038, + "sourceBytesWritten": 6126038, + "reportBytes": 2023, + "totalWrittenBytes": 6128061, + "totalPersistedBytes": 6128061 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.441208000000188, + "scanMs": 9.03070900000057, + "completeRefreshMs": 29.643251000001328, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126038, + "totalReadBytes": 6126038, + "sourceWritePackSealDurableMs": 0.004541999998764368, + "reportSerializeSealMs": 0.02299999999922875, + "reportDurableWriteMs": 10.143792000002577, + "totalPersistMs": 10.17133400000057, + "sourceBytes": 6126038, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128061, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.1110830000016, + "scanMs": 38.49858399999903, + "completeRefreshMs": 83.94974999999977, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126038, + "totalReadBytes": 6151068, + "sourceWritePackSealDurableMs": 24.713332999999693, + "reportSerializeSealMs": 0.042457999999896856, + "reportDurableWriteMs": 10.58429199999955, + "totalPersistMs": 35.34008299999914, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 367.27279199999975, + "completeRefreshMs": 393.19429200000013, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0002500000009604264, + "reportSerializeSealMs": 7.982665999999881, + "reportDurableWriteMs": 17.938583999999537, + "totalPersistMs": 25.92150000000038, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327815, + "totalWrittenBytes": 6327815, + "totalPersistedBytes": 6327815 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0012080000014975667, + "scanMs": 10.169957999998587, + "completeRefreshMs": 35.73295700000017, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00029100000028847717, + "reportSerializeSealMs": 7.82183299999997, + "reportDurableWriteMs": 17.739666999999827, + "totalPersistMs": 25.561791000000085, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327815, + "totalWrittenBytes": 6327815, + "totalPersistedBytes": 6327815, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0008749999997235136, + "scanMs": 111.85774999999921, + "completeRefreshMs": 132.57979200000045, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.0002500000009604264, + "reportSerializeSealMs": 7.163708000000042, + "reportDurableWriteMs": 13.557209000000512, + "totalPersistMs": 20.721167000001515, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 233.8501670000005, + "completeRefreshMs": 272.65220800000134, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 24.10008299999936, + "reportSerializeSealMs": 0.02200000000084401, + "reportDurableWriteMs": 14.679958000000624, + "totalPersistMs": 38.80204100000083, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.222916000000623, + "scanMs": 8.97333400000025, + "completeRefreshMs": 36.212625000000116, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979888, + "totalReadBytes": 2979888, + "sourceWritePackSealDurableMs": 13.69170800000029, + "reportSerializeSealMs": 0.01004099999954633, + "reportDurableWriteMs": 10.314625999999407, + "totalPersistMs": 24.016374999999243, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.228917000000365, + "scanMs": 219.78587499999958, + "completeRefreshMs": 253.1582499999986, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979888, + "totalReadBytes": 50303147, + "sourceWritePackSealDurableMs": 18.40570800000023, + "reportSerializeSealMs": 0.025166999999783002, + "reportDurableWriteMs": 11.71258299999863, + "totalPersistMs": 30.143457999998645, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 369.7090420000004, + "completeRefreshMs": 399.33770800000093, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0003329999999550637, + "reportSerializeSealMs": 7.525292000000263, + "reportDurableWriteMs": 22.103041000000303, + "totalPersistMs": 29.62866600000052, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0014580000006390037, + "scanMs": 8.705500000000029, + "completeRefreshMs": 35.70312500000182, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.0002080000012938399, + "reportSerializeSealMs": 7.273916999998619, + "reportDurableWriteMs": 19.722042000001238, + "totalPersistMs": 26.99616700000115, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0006250000005820766, + "scanMs": 113.08437500000036, + "completeRefreshMs": 136.2551250000015, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.000249999999141437, + "reportSerializeSealMs": 7.176124999999956, + "reportDurableWriteMs": 15.993750000001455, + "totalPersistMs": 23.170125000000553, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327820, + "totalWrittenBytes": 6327820, + "totalPersistedBytes": 6327820, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 343.96287499999926, + "completeRefreshMs": 391.5357499999991, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 34.47570900000028, + "reportSerializeSealMs": 0.04650000000037835, + "reportDurableWriteMs": 13.050665999999183, + "totalPersistMs": 47.57287499999984, + "sourceBytes": 6126038, + "sourceBytesWritten": 6126038, + "reportBytes": 2023, + "totalWrittenBytes": 6128061, + "totalPersistedBytes": 6128061 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.947625000000698, + "scanMs": 9.589082999998936, + "completeRefreshMs": 30.70587499999965, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126038, + "totalReadBytes": 6126038, + "sourceWritePackSealDurableMs": 0.009500000000116415, + "reportSerializeSealMs": 0.034416000000419444, + "reportDurableWriteMs": 10.12525099999948, + "totalPersistMs": 10.169167000000016, + "sourceBytes": 6126038, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128061, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.612542000000758, + "scanMs": 35.24012499999844, + "completeRefreshMs": 84.3552499999987, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126038, + "totalReadBytes": 6151068, + "sourceWritePackSealDurableMs": 26.799457999999504, + "reportSerializeSealMs": 0.03449999999975262, + "reportDurableWriteMs": 11.668625000000247, + "totalPersistMs": 38.502582999999504, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 240.898459, + "completeRefreshMs": 281.77287500000057, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 26.448625000000902, + "reportSerializeSealMs": 0.038875000000189175, + "reportDurableWriteMs": 14.386915999999474, + "totalPersistMs": 40.874416000000565, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.9943750000002183, + "scanMs": 8.793666999999914, + "completeRefreshMs": 36.4007500000007, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979888, + "totalReadBytes": 2979888, + "sourceWritePackSealDurableMs": 14.028207999999722, + "reportSerializeSealMs": 0.010792000000947155, + "reportDurableWriteMs": 10.573707999999897, + "totalPersistMs": 24.612708000000566, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.1365420000001905, + "scanMs": 242.77212500000314, + "completeRefreshMs": 276.44387500000084, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979888, + "totalReadBytes": 50303147, + "sourceWritePackSealDurableMs": 19.834165999996912, + "reportSerializeSealMs": 0.025416000000404892, + "reportDurableWriteMs": 10.675626000000193, + "totalPersistMs": 30.53520799999751, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 225.02695900000253, + "completeRefreshMs": 259.91554299999916, + "transcriptBytesRead": 47322805, + "sourceBytesRead": 0, + "totalReadBytes": 47322805, + "sourceWritePackSealDurableMs": 20.946874999997817, + "reportSerializeSealMs": 0.016249999996944098, + "reportDurableWriteMs": 13.925459000001865, + "totalPersistMs": 34.88858399999663, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.2577909999999974, + "scanMs": 8.897250000001804, + "completeRefreshMs": 35.90929099999994, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979887, + "totalReadBytes": 2979887, + "sourceWritePackSealDurableMs": 14.093333000000712, + "reportSerializeSealMs": 0.013499999997293344, + "reportDurableWriteMs": 9.647417000000132, + "totalPersistMs": 23.754249999998137, + "sourceBytes": 2979887, + "sourceBytesWritten": 2979887, + "reportBytes": 1939, + "totalWrittenBytes": 2981826, + "totalPersistedBytes": 2981826, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 5.0783749999973224, + "scanMs": 239.13716600000043, + "completeRefreshMs": 277.4498319999984, + "transcriptBytesRead": 47323259, + "sourceBytesRead": 2979887, + "totalReadBytes": 50303146, + "sourceWritePackSealDurableMs": 21.93775000000096, + "reportSerializeSealMs": 0.01729200000045239, + "reportDurableWriteMs": 11.279248999999254, + "totalPersistMs": 33.23429100000067, + "sourceBytes": 2979888, + "sourceBytesWritten": 2979888, + "reportBytes": 1939, + "totalWrittenBytes": 2981827, + "totalPersistedBytes": 2981827, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 329.71512500000244, + "completeRefreshMs": 372.609083000003, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 30.6059580000001, + "reportSerializeSealMs": 0.035707999999431195, + "reportDurableWriteMs": 12.252292000001034, + "totalPersistMs": 42.893958000000566, + "sourceBytes": 6126038, + "sourceBytesWritten": 6126038, + "reportBytes": 2023, + "totalWrittenBytes": 6128061, + "totalPersistedBytes": 6128061 + }, + "warm": { + "sourceReadVerifyDecodeMs": 11.22583400000076, + "scanMs": 9.028833000000304, + "completeRefreshMs": 30.61762500000259, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126038, + "totalReadBytes": 6126038, + "sourceWritePackSealDurableMs": 0.004417000000103144, + "reportSerializeSealMs": 0.03454100000089966, + "reportDurableWriteMs": 10.324000000000524, + "totalPersistMs": 10.362958000001527, + "sourceBytes": 6126038, + "sourceBytesWritten": 0, + "reportBytes": 2023, + "totalWrittenBytes": 2023, + "totalPersistedBytes": 6128061, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.307583000001614, + "scanMs": 30.713584000000992, + "completeRefreshMs": 79.32962600000246, + "transcriptBytesRead": 25030, + "sourceBytesRead": 6126038, + "totalReadBytes": 6151068, + "sourceWritePackSealDurableMs": 28.485250000001543, + "reportSerializeSealMs": 0.04158300000199233, + "reportDurableWriteMs": 9.781625999996322, + "totalPersistMs": 38.30845899999986, + "sourceBytes": 6126041, + "sourceBytesWritten": 6126041, + "reportBytes": 2023, + "totalWrittenBytes": 6128064, + "totalPersistedBytes": 6128064, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 351.70816600000035, + "completeRefreshMs": 378.26337400000193, + "transcriptBytesRead": 47339189, + "sourceBytesRead": 0, + "totalReadBytes": 47339189, + "sourceWritePackSealDurableMs": 0.0002080000012938399, + "reportSerializeSealMs": 5.908833000001323, + "reportDurableWriteMs": 20.646166999998968, + "totalPersistMs": 26.555208000001585, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0005420000015874393, + "scanMs": 6.3897499999984575, + "completeRefreshMs": 32.742291999999, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.0002499999973224476, + "reportSerializeSealMs": 5.89287499999773, + "reportDurableWriteMs": 20.4588750000039, + "totalPersistMs": 26.351999999998952, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327819, + "totalWrittenBytes": 6327819, + "totalPersistedBytes": 6327819, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0005000000019208528, + "scanMs": 89.00145799999882, + "completeRefreshMs": 110.046792000001, + "transcriptBytesRead": 25030, + "sourceBytesRead": 0, + "totalReadBytes": 25030, + "sourceWritePackSealDurableMs": 0.0001249999986612238, + "reportSerializeSealMs": 6.019500000002154, + "reportDurableWriteMs": 15.02520899999945, + "totalPersistMs": 21.044834000000264, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 6327822, + "totalWrittenBytes": 6327822, + "totalPersistedBytes": 6327822, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-JLOKNi/.claude/projects/benchmark/active-session.jsonl" + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-16k.json b/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-16k.json new file mode 100644 index 00000000000..2ffb465d361 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-16k.json @@ -0,0 +1,1577 @@ +{ + "purpose": "Actual pinned Claude scanner, source-cache and durable report persistence costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "usageKeys": 16384, + "maximaPattern": "repeated", + "rounds": 6, + "historyBytes": 7481652, + "suffixBytes": 452, + "fixtureSha256": "205be0c5b238447bd975a7a9cda26381ffc906d5192796681de0b81bc51226d7", + "methodology": { + "timing": "Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.", + "refresh": "Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.", + "published": "Published B keeps source records in memory; sourceReadBytes=0 reflects that architecture. Its report contains those records.", + "exclusions": "Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.", + "attribution": "Merged-main source/report ownership is inherited; compare current to fixed main to isolate this PR, and published to current for the combined user-visible change.", + "correctness": "Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.", + "writtenBytes": "Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals." + }, + "toolingSha256": "858f4418ee5a099fb566285538b511827b4367b006a4805b16093ef42732efa5", + "supportToolingSha256": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "arms": { + "published": { + "commit": "8467877ed92aba2ef59737aebf461e9cab52c273", + "scanner": { + "bundleSha256": "99e5b592f4386bf0f9c68a29877e7788f2d8c4b9bdb15fadf81d1326423e6dd3", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + } + } + }, + "persistence": { + "bundleSha256": "4534b3ff429df50140595ee536507c33f0a8b45434f09d7446f4592a37dbe2fb", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7df97e1a448696348cf89506085ea4959a7e876dae1a03b8ef02e32346feb295" + }, + "src/main/durable-file-write.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "baffe60b5c403b0d65afc7608c1903f726dee12d61a597c1d9525c82b4ed7bc4" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "49759bda2ba0efb81ac785eb13d4c51685dac505f5aa245144d441353793b5b0" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1ecfcf5f829617792a2b16615001aee4c888cc80c3e8156191378c4a57d637b6" + }, + "src/shared/node-file-content-equality.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "d3c773d602731953d0d57d6227ce277d1a1dd21a4ddc39ba10995040072a5291", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + } + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "0457542f4daf15c4a8bde1cb73cec13577fe06f39c00ffe2b89ed5b3faa64905", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + } + } + }, + "summary": { + "published": { + "cold": { + "scanMs": 59.005, + "completeRefreshMs": 72.455, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 0.849, + "reportDurableWriteMs": 12.122, + "totalPersistMs": 12.97, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.001, + "scanMs": 1.206, + "completeRefreshMs": 13.106, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 0.901, + "reportDurableWriteMs": 10.777, + "totalPersistMs": 11.717, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "append": { + "sourceReadVerifyDecodeMs": 0.001, + "scanMs": 15.849, + "completeRefreshMs": 28, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0, + "reportSerializeSealMs": 0.792, + "reportDurableWriteMs": 11.285, + "totalPersistMs": 12.051, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021 + } + }, + "main": { + "cold": { + "scanMs": 36.831, + "completeRefreshMs": 61.117, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 13.23, + "reportSerializeSealMs": 0.018, + "reportDurableWriteMs": 11.341, + "totalPersistMs": 24.641, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.525, + "scanMs": 1.521, + "completeRefreshMs": 21.844, + "transcriptBytesRead": 0, + "sourceBytesRead": 470898, + "totalReadBytes": 470898, + "sourceWritePackSealDurableMs": 9.674, + "reportSerializeSealMs": 0.009, + "reportDurableWriteMs": 10.286, + "totalPersistMs": 19.722, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "append": { + "sourceReadVerifyDecodeMs": 1.656, + "scanMs": 35.36, + "completeRefreshMs": 61.131, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470898, + "totalReadBytes": 7953002, + "sourceWritePackSealDurableMs": 13.606, + "reportSerializeSealMs": 0.01, + "reportDurableWriteMs": 10.292, + "totalPersistMs": 23.35, + "sourceBytes": 470897.5, + "sourceBytesWritten": 470897.5, + "reportBytes": 1431, + "totalWrittenBytes": 472328.5, + "totalPersistedBytes": 472328.5 + } + }, + "current": { + "cold": { + "scanMs": 58.935, + "completeRefreshMs": 83.16, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 12.904, + "reportSerializeSealMs": 0.024, + "reportDurableWriteMs": 10.497, + "totalPersistMs": 23.754, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.931, + "scanMs": 1.583, + "completeRefreshMs": 12.29, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.002, + "reportSerializeSealMs": 0.013, + "reportDurableWriteMs": 9.775, + "totalPersistMs": 9.788, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353 + }, + "append": { + "sourceReadVerifyDecodeMs": 1.293, + "scanMs": 5.03, + "completeRefreshMs": 28.876, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 12.478, + "reportSerializeSealMs": 0.015, + "reportDurableWriteMs": 9.967, + "totalPersistMs": 22.689, + "sourceBytes": 537374, + "sourceBytesWritten": 537374, + "reportBytes": 1515, + "totalWrittenBytes": 538889, + "totalPersistedBytes": 538889 + } + } + }, + "samples": [ + { + "arm": "published", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 72.32012499999996, + "completeRefreshMs": 88.60354099999995, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.0004999999998744897, + "reportSerializeSealMs": 0.8522090000001299, + "reportDurableWriteMs": 15.430706999999984, + "totalPersistMs": 16.28341599999999, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768017, + "totalWrittenBytes": 768017, + "totalPersistedBytes": 768017 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.008542000000034022, + "scanMs": 1.5074580000000424, + "completeRefreshMs": 12.932874999999967, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00024999999982355803, + "reportSerializeSealMs": 0.9435840000001008, + "reportDurableWriteMs": 10.473040999999967, + "totalPersistMs": 11.41687499999989, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768017, + "totalWrittenBytes": 768017, + "totalPersistedBytes": 768017, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.003958000000011452, + "scanMs": 16.08458399999995, + "completeRefreshMs": 30.821500000000015, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.8125, + "reportDurableWriteMs": 13.920208000000002, + "totalPersistMs": 14.732958000000053, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 37.24541700000009, + "completeRefreshMs": 63.43387600000028, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 14.776042000000189, + "reportSerializeSealMs": 0.01541599999995924, + "reportDurableWriteMs": 11.397001000000046, + "totalPersistMs": 26.188459000000194, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5957080000000587, + "scanMs": 1.6277079999999842, + "completeRefreshMs": 21.80604100000005, + "transcriptBytesRead": 0, + "sourceBytesRead": 470898, + "totalReadBytes": 470898, + "sourceWritePackSealDurableMs": 9.30925000000002, + "reportSerializeSealMs": 0.009291000000075655, + "reportDurableWriteMs": 10.264083999999912, + "totalPersistMs": 19.582625000000007, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.744457999999895, + "scanMs": 37.2537920000002, + "completeRefreshMs": 61.589792000000216, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470898, + "totalReadBytes": 7953002, + "sourceWritePackSealDurableMs": 11.672167000000172, + "reportSerializeSealMs": 0.018708000000060565, + "reportDurableWriteMs": 10.900666999999885, + "totalPersistMs": 22.591542000000118, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 1, + "order": ["published", "main", "current"], + "cold": { + "scanMs": 61.7856670000001, + "completeRefreshMs": 85.2966250000004, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 12.791167000000314, + "reportSerializeSealMs": 0.023457999999664025, + "reportDurableWriteMs": 10.696333000000322, + "totalPersistMs": 23.5109580000003, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.549083000000337, + "scanMs": 1.8092499999997926, + "completeRefreshMs": 13.22604100000035, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.0016249999998763087, + "reportSerializeSealMs": 0.010416999999961263, + "reportDurableWriteMs": 9.855666000000383, + "totalPersistMs": 9.86770800000022, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.7092090000001008, + "scanMs": 9.060375000000022, + "completeRefreshMs": 33.64887499999986, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 12.582832999999937, + "reportSerializeSealMs": 0.021542000000408734, + "reportDurableWriteMs": 10.274915999999394, + "totalPersistMs": 22.87929099999974, + "sourceBytes": 537372, + "sourceBytesWritten": 537372, + "reportBytes": 1515, + "totalWrittenBytes": 538887, + "totalPersistedBytes": 538887, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 54.195458000000144, + "completeRefreshMs": 77.52729099999988, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 13.017374999999902, + "reportSerializeSealMs": 0.016374999999698048, + "reportDurableWriteMs": 10.298083000000133, + "totalPersistMs": 23.331832999999733, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.617917000000034, + "scanMs": 1.6077919999997903, + "completeRefreshMs": 13.546833999999762, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.0022089999997660925, + "reportSerializeSealMs": 0.015833999999813386, + "reportDurableWriteMs": 10.303082000000359, + "totalPersistMs": 10.321124999999938, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 16.472208000000137, + "scanMs": 19.033874999999625, + "completeRefreshMs": 58.59949999999981, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 14.952707999999802, + "reportSerializeSealMs": 0.03812500000003638, + "reportDurableWriteMs": 8.102584000000206, + "totalPersistMs": 23.093417000000045, + "sourceBytes": 537374, + "sourceBytesWritten": 537374, + "reportBytes": 1515, + "totalWrittenBytes": 538889, + "totalPersistedBytes": 538889, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 40.4970000000003, + "completeRefreshMs": 66.78116600000021, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 15.96245799999997, + "reportSerializeSealMs": 0.024332999999842286, + "reportDurableWriteMs": 10.297375000000102, + "totalPersistMs": 26.284165999999914, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.49608400000033726, + "scanMs": 1.5237499999998363, + "completeRefreshMs": 21.881584000000203, + "transcriptBytesRead": 0, + "sourceBytesRead": 470897, + "totalReadBytes": 470897, + "sourceWritePackSealDurableMs": 9.545208999999886, + "reportSerializeSealMs": 0.007708999999977095, + "reportDurableWriteMs": 10.308832000000166, + "totalPersistMs": 19.86175000000003, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.653874999999971, + "scanMs": 35.2807499999999, + "completeRefreshMs": 60.67233299999998, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470897, + "totalReadBytes": 7953001, + "sourceWritePackSealDurableMs": 13.663457999999991, + "reportSerializeSealMs": 0.010916000000179338, + "reportDurableWriteMs": 10.06333399999994, + "totalPersistMs": 23.73770800000011, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 2, + "order": ["current", "main", "published"], + "cold": { + "scanMs": 63.24879199999987, + "completeRefreshMs": 76.06083399999989, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.8947079999998095, + "reportDurableWriteMs": 11.917084000000159, + "totalPersistMs": 12.81204200000002, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.00858299999981682, + "scanMs": 1.2533750000002328, + "completeRefreshMs": 13.279457999999977, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.0003329999999550637, + "reportSerializeSealMs": 0.9366669999999431, + "reportDurableWriteMs": 11.080500000000029, + "totalPersistMs": 12.017499999999927, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.002207999999882304, + "scanMs": 15.613000000000284, + "completeRefreshMs": 27.619666999999936, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.0002919999997175182, + "reportSerializeSealMs": 0.7577080000000933, + "reportDurableWriteMs": 11.246458999999959, + "totalPersistMs": 12.00445899999977, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 35.02795900000001, + "completeRefreshMs": 57.35258399999975, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 12.30724999999984, + "reportSerializeSealMs": 0.007583000000067841, + "reportDurableWriteMs": 10.009791999999834, + "totalPersistMs": 22.32462499999974, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5079999999998108, + "scanMs": 1.4295419999998558, + "completeRefreshMs": 21.00537499999973, + "transcriptBytesRead": 0, + "sourceBytesRead": 470898, + "totalReadBytes": 470898, + "sourceWritePackSealDurableMs": 9.802999999999884, + "reportSerializeSealMs": 0.014125000000149157, + "reportDurableWriteMs": 9.250708000000031, + "totalPersistMs": 19.067833000000064, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.5029170000002523, + "scanMs": 33.695166999999856, + "completeRefreshMs": 58.15970900000002, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470898, + "totalReadBytes": 7953002, + "sourceWritePackSealDurableMs": 13.549332999999933, + "reportSerializeSealMs": 0.006915999999819178, + "reportDurableWriteMs": 9.40537600000016, + "totalPersistMs": 22.961624999999913, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 57.22037500000033, + "completeRefreshMs": 71.17470800000046, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.8077499999999418, + "reportDurableWriteMs": 13.14633300000014, + "totalPersistMs": 13.954333000000133, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0006669999997939158, + "scanMs": 1.0206250000001091, + "completeRefreshMs": 13.545125999999982, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00020899999981338624, + "reportSerializeSealMs": 0.7711249999997563, + "reportDurableWriteMs": 11.75250000000051, + "totalPersistMs": 12.523834000000079, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0006249999996725819, + "scanMs": 13.566000000000258, + "completeRefreshMs": 25.10699999999997, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.00029200000017226557, + "reportSerializeSealMs": 0.7715829999997368, + "reportDurableWriteMs": 10.768500000000131, + "totalPersistMs": 11.54037500000004, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 3, + "order": ["main", "published", "current"], + "cold": { + "scanMs": 62.05841700000019, + "completeRefreshMs": 87.41433400000051, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 15.077416999999969, + "reportSerializeSealMs": 0.042374999999992724, + "reportDurableWriteMs": 10.236125000000357, + "totalPersistMs": 25.355917000000318, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9149590000001808, + "scanMs": 1.6323750000001382, + "completeRefreshMs": 11.650542000000314, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.00483299999996234, + "reportSerializeSealMs": 0.020208999999795196, + "reportDurableWriteMs": 9.078166000000238, + "totalPersistMs": 9.103207999999995, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.9239590000001954, + "scanMs": 4.9658330000002024, + "completeRefreshMs": 27.446167000000514, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 11.839166000000205, + "reportSerializeSealMs": 0.011582999999973254, + "reportDurableWriteMs": 9.705625999999938, + "totalPersistMs": 21.556375000000116, + "sourceBytes": 537374, + "sourceBytesWritten": 537374, + "reportBytes": 1515, + "totalWrittenBytes": 538889, + "totalPersistedBytes": 538889, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 58.640957999999955, + "completeRefreshMs": 83.09370800000033, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 14.940209000000323, + "reportSerializeSealMs": 0.03187500000012733, + "reportDurableWriteMs": 9.480665999999928, + "totalPersistMs": 24.45275000000038, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9132920000001832, + "scanMs": 1.469583000000057, + "completeRefreshMs": 12.365250000000287, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.001708000000235188, + "reportSerializeSealMs": 0.01195899999993344, + "reportDurableWriteMs": 9.968707999999879, + "totalPersistMs": 9.982375000000047, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.9201669999997648, + "scanMs": 4.748417000000245, + "completeRefreshMs": 25.577624999999898, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 9.664291000000048, + "reportSerializeSealMs": 0.01679100000001199, + "reportDurableWriteMs": 10.227958999999828, + "totalPersistMs": 19.90904099999989, + "sourceBytes": 537374, + "sourceBytesWritten": 537374, + "reportBytes": 1515, + "totalWrittenBytes": 538889, + "totalPersistedBytes": 538889, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 60.774875000000065, + "completeRefreshMs": 73.73545800000011, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.0004170000001977314, + "reportSerializeSealMs": 0.8422500000001492, + "reportDurableWriteMs": 12.117915999999695, + "totalPersistMs": 12.960583000000042, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0006250000001273293, + "scanMs": 1.1355830000002243, + "completeRefreshMs": 13.525375000000167, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00016700000014679972, + "reportSerializeSealMs": 0.9022079999999733, + "reportDurableWriteMs": 11.486791999999696, + "totalPersistMs": 12.389166999999816, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0004999999996471161, + "scanMs": 17.51279199999999, + "completeRefreshMs": 29.312541999999667, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.8206669999999576, + "reportDurableWriteMs": 10.97833300000002, + "totalPersistMs": 11.799250000000029, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 4, + "order": ["current", "published", "main"], + "cold": { + "scanMs": 37.41724999999997, + "completeRefreshMs": 61.68145800000002, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 12.771832999999788, + "reportSerializeSealMs": 0.01966599999968821, + "reportDurableWriteMs": 11.472709000000577, + "totalPersistMs": 24.264208000000053, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.538792000000285, + "scanMs": 1.53899999999976, + "completeRefreshMs": 22.795251000000007, + "transcriptBytesRead": 0, + "sourceBytesRead": 470897, + "totalReadBytes": 470897, + "sourceWritePackSealDurableMs": 10.328375000000051, + "reportSerializeSealMs": 0.007000000000061846, + "reportDurableWriteMs": 10.38208399999985, + "totalPersistMs": 20.717458999999963, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.583625000000211, + "scanMs": 35.44016699999975, + "completeRefreshMs": 56.81362599999966, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470897, + "totalReadBytes": 7953001, + "sourceWritePackSealDurableMs": 10.383041999999932, + "reportSerializeSealMs": 0.010041000000001077, + "reportDurableWriteMs": 10.396750999999767, + "totalPersistMs": 20.7898339999997, + "sourceBytes": 470897, + "sourceBytesWritten": 470897, + "reportBytes": 1431, + "totalWrittenBytes": 472328, + "totalPersistedBytes": 472328, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 55.81837499999983, + "completeRefreshMs": 68.24800000000005, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.00016700000014679972, + "reportSerializeSealMs": 0.8452080000001843, + "reportDurableWriteMs": 11.584249999999884, + "totalPersistMs": 12.429625000000215, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.000792000000274129, + "scanMs": 1.4856249999998, + "completeRefreshMs": 11.576751000000058, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.7789170000000922, + "reportDurableWriteMs": 9.311166999999841, + "totalPersistMs": 10.090333999999984, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0005419999997684499, + "scanMs": 12.756333000000268, + "completeRefreshMs": 24.85375000000022, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.00016700000014679972, + "reportSerializeSealMs": 0.7722920000005615, + "reportDurableWriteMs": 11.324415999999474, + "totalPersistMs": 12.096875000000182, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 59.228250000000116, + "completeRefreshMs": 83.22579099999984, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 12.780416000000514, + "reportSerializeSealMs": 0.019999999999527063, + "reportDurableWriteMs": 11.197124999999687, + "totalPersistMs": 23.99754099999973, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.8271250000007058, + "scanMs": 1.5093749999996362, + "completeRefreshMs": 11.749458000000232, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.002292000000124972, + "reportSerializeSealMs": 0.007708000000093307, + "reportDurableWriteMs": 9.402957999999671, + "totalPersistMs": 9.41295799999989, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.9248330000000351, + "scanMs": 4.694832999999562, + "completeRefreshMs": 28.330665999999837, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 13.068916999999601, + "reportSerializeSealMs": 0.012708000000202446, + "reportDurableWriteMs": 9.629375000000437, + "totalPersistMs": 22.71100000000024, + "sourceBytes": 537374, + "sourceBytesWritten": 537374, + "reportBytes": 1515, + "totalWrittenBytes": 538889, + "totalPersistedBytes": 538889, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 5, + "order": ["published", "current", "main"], + "cold": { + "scanMs": 34.483249999999316, + "completeRefreshMs": 59.501915999999255, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 13.687582999999904, + "reportSerializeSealMs": 0.0075839999999516294, + "reportDurableWriteMs": 11.323499000000083, + "totalPersistMs": 25.01866599999994, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5115000000005239, + "scanMs": 1.5184170000002268, + "completeRefreshMs": 20.873125000000073, + "transcriptBytesRead": 0, + "sourceBytesRead": 470898, + "totalReadBytes": 470898, + "sourceWritePackSealDurableMs": 9.534458000000086, + "reportSerializeSealMs": 0.0070420000001831795, + "reportDurableWriteMs": 9.301707999999053, + "totalPersistMs": 18.843207999999322, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.390875000000051, + "scanMs": 34.759665999999925, + "completeRefreshMs": 62.39991599999939, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470898, + "totalReadBytes": 7953002, + "sourceWritePackSealDurableMs": 14.052040999999917, + "reportSerializeSealMs": 0.009707999999591266, + "reportDurableWriteMs": 10.18762599999991, + "totalPersistMs": 24.249374999999418, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 36.416291999999885, + "completeRefreshMs": 60.55254199999945, + "transcriptBytesRead": 7481652, + "sourceBytesRead": 0, + "totalReadBytes": 7481652, + "sourceWritePackSealDurableMs": 12.754167000000052, + "reportSerializeSealMs": 0.022625000000516593, + "reportDurableWriteMs": 11.359457999998995, + "totalPersistMs": 24.136249999999563, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.6486249999998108, + "scanMs": 1.511000000000422, + "completeRefreshMs": 22.87183300000015, + "transcriptBytesRead": 0, + "sourceBytesRead": 470898, + "totalReadBytes": 470898, + "sourceWritePackSealDurableMs": 10.283666000000267, + "reportSerializeSealMs": 0.011167000000568805, + "reportDurableWriteMs": 10.417374999999083, + "totalPersistMs": 20.71220799999992, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.657709000000068, + "scanMs": 80.70166599999993, + "completeRefreshMs": 118.4057499999999, + "transcriptBytesRead": 7482104, + "sourceBytesRead": 470898, + "totalReadBytes": 7953002, + "sourceWritePackSealDurableMs": 20.968540999999277, + "reportSerializeSealMs": 0.014041999999790278, + "reportDurableWriteMs": 15.06379200000083, + "totalPersistMs": 36.0463749999999, + "sourceBytes": 470898, + "sourceBytesWritten": 470898, + "reportBytes": 1431, + "totalWrittenBytes": 472329, + "totalPersistedBytes": 472329, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 57.95808399999987, + "completeRefreshMs": 79.84400100000039, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 11.109833999999864, + "reportSerializeSealMs": 0.023709000000053493, + "reportDurableWriteMs": 10.7523740000006, + "totalPersistMs": 21.885917000000518, + "sourceBytes": 471838, + "sourceBytesWritten": 471838, + "reportBytes": 1515, + "totalWrittenBytes": 473353, + "totalPersistedBytes": 473353 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9472079999995913, + "scanMs": 1.5589170000002923, + "completeRefreshMs": 12.214582999999948, + "transcriptBytesRead": 0, + "sourceBytesRead": 471838, + "totalReadBytes": 471838, + "sourceWritePackSealDurableMs": 0.0016660000001138542, + "reportSerializeSealMs": 0.01337500000045111, + "reportDurableWriteMs": 9.6934169999995, + "totalPersistMs": 9.708458000000064, + "sourceBytes": 471838, + "sourceBytesWritten": 0, + "reportBytes": 1515, + "totalWrittenBytes": 1515, + "totalPersistedBytes": 473353, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.6604589999997188, + "scanMs": 5.093958000000384, + "completeRefreshMs": 29.421000000000276, + "transcriptBytesRead": 25028, + "sourceBytesRead": 471838, + "totalReadBytes": 496866, + "sourceWritePackSealDurableMs": 12.37341699999979, + "reportSerializeSealMs": 0.01391700000021956, + "reportDurableWriteMs": 10.279249000000164, + "totalPersistMs": 22.666583000000173, + "sourceBytes": 537372, + "sourceBytesWritten": 537372, + "reportBytes": 1515, + "totalWrittenBytes": 538887, + "totalPersistedBytes": 538887, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "published", + "round": 6, + "order": ["main", "current", "published"], + "cold": { + "scanMs": 57.235915999999634, + "completeRefreshMs": 70.21600000000035, + "transcriptBytesRead": 7498036, + "sourceBytesRead": 0, + "totalReadBytes": 7498036, + "sourceWritePackSealDurableMs": 0.0002920000006270129, + "reportSerializeSealMs": 0.8542499999994106, + "reportDurableWriteMs": 12.125542000000678, + "totalPersistMs": 12.980084000000716, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.0005000000001018634, + "scanMs": 1.1582089999992604, + "completeRefreshMs": 12.323750999998992, + "transcriptBytesRead": 0, + "sourceBytesRead": 0, + "totalReadBytes": 0, + "sourceWritePackSealDurableMs": 0.00033399999938410474, + "reportSerializeSealMs": 0.899333000000297, + "reportDurableWriteMs": 10.265374999999949, + "totalPersistMs": 11.16504199999963, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768019, + "totalWrittenBytes": 768019, + "totalPersistedBytes": 768019, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.0009169999993901001, + "scanMs": 16.120915999999852, + "completeRefreshMs": 28.380582999999206, + "transcriptBytesRead": 25028, + "sourceBytesRead": 0, + "totalReadBytes": 25028, + "sourceWritePackSealDurableMs": 0.0002500000000509317, + "reportSerializeSealMs": 0.8347499999999854, + "reportDurableWriteMs": 11.423749999999927, + "totalPersistMs": 12.258749999999964, + "sourceBytes": 0, + "sourceBytesWritten": 0, + "reportBytes": 768021, + "totalWrittenBytes": 768021, + "totalPersistedBytes": 768021, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-persistence-cost-oPzJf5/.claude/projects/benchmark/active-session.jsonl" + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-readiness-cost-final.json b/docs/bug-reproductions/usage-scan-append/claude-readiness-cost-final.json new file mode 100644 index 00000000000..938c13f9ed9 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-readiness-cost-final.json @@ -0,0 +1,1874 @@ +{ + "purpose": "Actual store lifecycle readiness, worker migration/fallback and large aggregate-report costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "rounds": 6, + "usageKeys": 100000, + "inputReceipts": { + "legacyInlineBytes": 6326724, + "legacyInlineSha256": "c26dfb42e1975d0832a85c5764e2b2d18b6e30229c0b7274e3ac62606d842761", + "stableReportBytes": { + "published": 6326724, + "main": 1488, + "current": 1572 + }, + "largeReportBytes": { + "published": 13869524, + "main": 13869504, + "current": 13869588 + }, + "largeReportSessions": 13222 + }, + "methodology": { + "actual": "Production lifecycle, report parser/serializer, inline migration and source durable writes. Prestarted Node workers call the actual splitter and return exact immutable reportText/proof fact.", + "segments": "Constructor interval includes synchronous stat/read/parse. Main JSON.parse calls and production setImmediate validation yields are observed without changing their inputs/results. Segment observations exclude time waiting for the worker/filesystem.", + "shortcut": "Large-report repeat arm deliberately re-verifies the same worker-validated text on main; trusted arm uses the private worker result fact. Both preserve exact report and disabled-history accessibility.", + "largeReport": "About 13MiB of distinct aggregate rollups, with no source graph. This isolates a retained valid report even when its independently committed source cache is absent; it does not claim transcript parity for a generated historical corpus.", + "exclusions": "Worker startup, application startup, rendered responsiveness, RPC queueing and telemetry are excluded. Inactive telemetry/analytics/worktree accesses throw if reached. Worker message transfer and production main parse remain included in whenLoaded.", + "correctness": "Each loaded sessions/daily projection matches its input, remains accessible with tracking disabled, and report-only stores retain no source graph." + }, + "toolingSha256": "b1d77e6bca0f0f56d5a192400675caa6993339936a744d9979ae5c416c0449bc", + "supportToolingSha256": { + "claude-usage-benchmark-persistence.mjs": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "claude-usage-benchmark-readiness.mjs": "4927c6ca51f43645cb2faa48804d4d80da4eab52b547f8e997b4c92451c27088", + "claude-usage-benchmark-scanner.mjs": "cbaf8140fd02f617419548db76bc46eb8235568d61b8ee06cdef6ed104b048a0" + }, + "arms": { + "published": { + "commit": "8467877ed92aba2ef59737aebf461e9cab52c273", + "scanner": { + "bundleSha256": "5268ad6672da5a53533e72a92648639b1015c8b378097a3cf4c0d907d9b3f393", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + } + } + }, + "persistence": { + "bundleSha256": "4534b3ff429df50140595ee536507c33f0a8b45434f09d7446f4592a37dbe2fb", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7df97e1a448696348cf89506085ea4959a7e876dae1a03b8ef02e32346feb295" + }, + "src/main/durable-file-write.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "baffe60b5c403b0d65afc7608c1903f726dee12d61a597c1d9525c82b4ed7bc4" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "49759bda2ba0efb81ac785eb13d4c51685dac505f5aa245144d441353793b5b0" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1ecfcf5f829617792a2b16615001aee4c888cc80c3e8156191378c4a57d637b6" + }, + "src/shared/node-file-content-equality.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + }, + "workerBootstrapSha256": null + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "afe7856890c4992bdc518344842478f8ec3ed398077cb083d0b14cc00af25fc6", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + }, + "workerBootstrapSha256": "653ad06eac9a0f111b74aa6d198ec548c7a40ecd4ee234a8bc1a4d64288c50f4" + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "20e5f37c5735564876e5566d419d4d8687f141f560cea6878a67a75785499544", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + }, + "workerBootstrapSha256": "be709916acff3b28fb4130e4c4a8a82fd089223e598b8c00b4abb624b70d3506" + } + }, + "summary": { + "published:stable-cache": { + "constructorSyncMs": 36.034, + "whenLoadedMs": 36.036, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.838, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 36.034, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1 + }, + "main:stable-cache": { + "constructorSyncMs": 0.092, + "whenLoadedMs": 0.094, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.011, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.092, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0 + }, + "main:legacy-inline-migration": { + "constructorSyncMs": 8.453, + "whenLoadedMs": 63.06, + "workerReadParseVerifyMigrateMs": 38.079, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.819, + "mainWorkerResponseJsonParseMs": 0.019, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.453, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0 + }, + "current:stable-cache": { + "constructorSyncMs": 0.116, + "whenLoadedMs": 0.117, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.03, + "mainJsonParseMs": 0.011, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.116, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0 + }, + "current:legacy-inline-migration": { + "constructorSyncMs": 8.752, + "whenLoadedMs": 94.434, + "workerReadParseVerifyMigrateMs": 70.842, + "mainParseAndValidationMs": 0.027, + "mainJsonParseMs": 6.916, + "mainWorkerResponseJsonParseMs": 0.02, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.752, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0 + }, + "current:legacy-inline-worker-fallback": { + "constructorSyncMs": 8.574, + "whenLoadedMs": 49.287, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.27, + "mainJsonParseMs": 14.189, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.493, + "maxObservedMainSynchronousSegmentMs": 8.574, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0 + }, + "current:large-report-repeat-verification": { + "constructorSyncMs": 0.067, + "whenLoadedMs": 48.871, + "workerReadParseVerifyMigrateMs": 25.787, + "mainParseAndValidationMs": 21.393, + "mainJsonParseMs": 16.659, + "mainWorkerResponseJsonParseMs": 16.662, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.393, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0 + }, + "current:large-report-trusted-verification": { + "constructorSyncMs": 0.061, + "whenLoadedMs": 44.394, + "workerReadParseVerifyMigrateMs": 25.367, + "mainParseAndValidationMs": 16.512, + "mainJsonParseMs": 16.499, + "mainWorkerResponseJsonParseMs": 16.502, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.512, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0 + }, + "main:large-report-upstream": { + "constructorSyncMs": 0.094, + "whenLoadedMs": 39.592, + "workerReadParseVerifyMigrateMs": 20.478, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.684, + "mainWorkerResponseJsonParseMs": 16.69, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.69, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0 + }, + "current:large-report-worker-fallback": { + "constructorSyncMs": 0.065, + "whenLoadedMs": 25.187, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 22.326, + "mainJsonParseMs": 17.496, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 22.326, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0 + } + }, + "samples": [ + { + "arm": "published", + "scenario": "stable-cache", + "round": 1, + "order": ["published", "main", "current"], + "metrics": { + "constructorSyncMs": 35.65758300000016, + "whenLoadedMs": 35.660791000000245, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.920500000000175, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 35.65758300000016, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 1, + "order": ["published", "main", "current"], + "metrics": { + "constructorSyncMs": 0.09304100000008475, + "whenLoadedMs": 0.09487499999977445, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.010958000000300672, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.09304100000008475, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 1, + "order": ["published", "main", "current"], + "metrics": { + "constructorSyncMs": 8.287499999999909, + "whenLoadedMs": 68.49016699999993, + "workerReadParseVerifyMigrateMs": 44.751624999999876, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.722208999999566, + "mainWorkerResponseJsonParseMs": 0.017915999999786436, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.287499999999909, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 1, + "order": ["published", "main", "current"], + "metrics": { + "constructorSyncMs": 0.10320799999999508, + "whenLoadedMs": 0.10575000000017099, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.02820800000017698, + "mainJsonParseMs": 0.007875000000240107, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.10320799999999508, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 1, + "order": ["published", "main", "current"], + "metrics": { + "constructorSyncMs": 9.002040999999736, + "whenLoadedMs": 97.22658300000012, + "workerReadParseVerifyMigrateMs": 76.85220900000013, + "mainParseAndValidationMs": 0.025291999999808468, + "mainJsonParseMs": 7.090000999999575, + "mainWorkerResponseJsonParseMs": 0.01908400000002075, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 9.002040999999736, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 1, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.870832999999948, + "whenLoadedMs": 51.87975000000006, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.263500000000022, + "mainJsonParseMs": 14.462416000000303, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.47595899999987523, + "maxObservedMainSynchronousSegmentMs": 8.870832999999948, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 1, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.06179199999996854, + "whenLoadedMs": 48.852334000000155, + "workerReadParseVerifyMigrateMs": 25.76033299999972, + "mainParseAndValidationMs": 21.684749999999894, + "mainJsonParseMs": 16.800583000000188, + "mainWorkerResponseJsonParseMs": 16.804041999999754, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.684749999999894, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 1, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.071458999999777, + "whenLoadedMs": 45.11954199999991, + "workerReadParseVerifyMigrateMs": 27.10879100000011, + "mainParseAndValidationMs": 16.595250000000306, + "mainJsonParseMs": 16.582625000000007, + "mainWorkerResponseJsonParseMs": 16.585833000000093, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.595250000000306, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 1, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.09349999999994907, + "whenLoadedMs": 39.55158299999994, + "workerReadParseVerifyMigrateMs": 20.307749999999942, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.781957999999577, + "mainWorkerResponseJsonParseMs": 16.785624999999982, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.785624999999982, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 1, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.07029199999988123, + "whenLoadedMs": 25.27841699999999, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 22.356207000000722, + "mainJsonParseMs": 17.442666000000372, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 22.356207000000722, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 2, + "order": ["current", "main", "published"], + "metrics": { + "constructorSyncMs": 0.1187499999996362, + "whenLoadedMs": 0.11999999999989086, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.03420899999991889, + "mainJsonParseMs": 0.011292000000139524, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.1187499999996362, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 2, + "order": ["current", "main", "published"], + "metrics": { + "constructorSyncMs": 8.82012500000019, + "whenLoadedMs": 102.74075000000039, + "workerReadParseVerifyMigrateMs": 77.28399999999965, + "mainParseAndValidationMs": 0.0284999999998945, + "mainJsonParseMs": 6.930707999999868, + "mainWorkerResponseJsonParseMs": 0.02041700000017954, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.82012500000019, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 2, + "order": ["current", "main", "published"], + "metrics": { + "constructorSyncMs": 0.07579200000009223, + "whenLoadedMs": 0.07799999999997453, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.007499999999708962, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.07579200000009223, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 2, + "order": ["current", "main", "published"], + "metrics": { + "constructorSyncMs": 8.522750000000087, + "whenLoadedMs": 47.7204999999999, + "workerReadParseVerifyMigrateMs": 27.546125000000302, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.907915999999659, + "mainWorkerResponseJsonParseMs": 0.017334000000118976, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.522750000000087, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "published", + "scenario": "stable-cache", + "round": 2, + "order": ["current", "main", "published"], + "metrics": { + "constructorSyncMs": 34.6984580000003, + "whenLoadedMs": 34.70120799999995, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 7.161000000000058, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 34.6984580000003, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 2, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.365125000000262, + "whenLoadedMs": 48.46266700000024, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.11645899999985, + "mainJsonParseMs": 13.830708000000413, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.5020829999998568, + "maxObservedMainSynchronousSegmentMs": 8.365125000000262, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 2, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.05641599999989921, + "whenLoadedMs": 43.66750000000002, + "workerReadParseVerifyMigrateMs": 25.479917000000114, + "mainParseAndValidationMs": 16.359333999999762, + "mainJsonParseMs": 16.34787499999993, + "mainWorkerResponseJsonParseMs": 16.3505839999998, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.359333999999762, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 2, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.0683750000002874, + "whenLoadedMs": 54.293458999999984, + "workerReadParseVerifyMigrateMs": 31.02624999999989, + "mainParseAndValidationMs": 21.812875000000076, + "mainJsonParseMs": 17.111041999999998, + "mainWorkerResponseJsonParseMs": 17.11437500000011, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.812875000000076, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 2, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.09491699999989578, + "whenLoadedMs": 39.6674579999999, + "workerReadParseVerifyMigrateMs": 21.524167000000034, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.629875000000084, + "mainWorkerResponseJsonParseMs": 16.63304100000005, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.63304100000005, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 2, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.06520899999986796, + "whenLoadedMs": 25.096500000000106, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 22.296792000000096, + "mainJsonParseMs": 17.594374999999673, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 22.296792000000096, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 3, + "order": ["main", "published", "current"], + "metrics": { + "constructorSyncMs": 0.1117500000000291, + "whenLoadedMs": 0.11299999999982901, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.012291999999888503, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.1117500000000291, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 3, + "order": ["main", "published", "current"], + "metrics": { + "constructorSyncMs": 8.735709000000043, + "whenLoadedMs": 65.77287500000011, + "workerReadParseVerifyMigrateMs": 38.5972499999998, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 7.097416000000067, + "mainWorkerResponseJsonParseMs": 0.021666999999979453, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.735709000000043, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "published", + "scenario": "stable-cache", + "round": 3, + "order": ["main", "published", "current"], + "metrics": { + "constructorSyncMs": 34.229709000000184, + "whenLoadedMs": 34.233834000000115, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.72616700000026, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 34.229709000000184, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 3, + "order": ["main", "published", "current"], + "metrics": { + "constructorSyncMs": 0.10512499999958891, + "whenLoadedMs": 0.1062499999998181, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.026415999999699125, + "mainJsonParseMs": 0.010082999999667663, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.10512499999958891, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 3, + "order": ["main", "published", "current"], + "metrics": { + "constructorSyncMs": 8.684374999999818, + "whenLoadedMs": 86.96129199999996, + "workerReadParseVerifyMigrateMs": 64.88591699999961, + "mainParseAndValidationMs": 0.027791999999863037, + "mainJsonParseMs": 6.78020800000013, + "mainWorkerResponseJsonParseMs": 0.021582999999736785, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.684374999999818, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 3, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.158292000000074, + "whenLoadedMs": 46.74912500000028, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 6.9382080000000315, + "mainJsonParseMs": 13.468708000000333, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.4404580000000351, + "maxObservedMainSynchronousSegmentMs": 8.158292000000074, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 3, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.05437500000016371, + "whenLoadedMs": 47.481166999999914, + "workerReadParseVerifyMigrateMs": 24.933084000000235, + "mainParseAndValidationMs": 21.11429100000032, + "mainJsonParseMs": 16.44733300000007, + "mainWorkerResponseJsonParseMs": 16.45037500000035, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.11429100000032, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 3, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.07579200000009223, + "whenLoadedMs": 49.25145900000007, + "workerReadParseVerifyMigrateMs": 30.923541000000114, + "mainParseAndValidationMs": 16.7204999999999, + "mainJsonParseMs": 16.701542000000245, + "mainWorkerResponseJsonParseMs": 16.707374999999956, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.7204999999999, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 3, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.09508400000049733, + "whenLoadedMs": 37.460667000000285, + "workerReadParseVerifyMigrateMs": 19.651834000000235, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.382291999999325, + "mainWorkerResponseJsonParseMs": 16.387416999999914, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.387416999999914, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 3, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.05141599999933533, + "whenLoadedMs": 24.764000000000124, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 21.924417000000176, + "mainJsonParseMs": 17.32129200000054, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.924417000000176, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 4, + "order": ["current", "published", "main"], + "metrics": { + "constructorSyncMs": 0.13079199999992852, + "whenLoadedMs": 0.13225000000056752, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.044833999999355, + "mainJsonParseMs": 0.012166999999863037, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.13079199999992852, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 4, + "order": ["current", "published", "main"], + "metrics": { + "constructorSyncMs": 8.410707999999431, + "whenLoadedMs": 91.64145800000006, + "workerReadParseVerifyMigrateMs": 67.43720799999937, + "mainParseAndValidationMs": 0.028874999999970896, + "mainJsonParseMs": 6.7993749999996, + "mainWorkerResponseJsonParseMs": 0.022417000000132248, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.410707999999431, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "published", + "scenario": "stable-cache", + "round": 4, + "order": ["current", "published", "main"], + "metrics": { + "constructorSyncMs": 38.509791000000405, + "whenLoadedMs": 38.51299999999992, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.54516700000022, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 38.509791000000405, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 4, + "order": ["current", "published", "main"], + "metrics": { + "constructorSyncMs": 0.09133300000030431, + "whenLoadedMs": 0.09262500000022555, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.009917000000314147, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.09133300000030431, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 4, + "order": ["current", "published", "main"], + "metrics": { + "constructorSyncMs": 8.242874999999913, + "whenLoadedMs": 52.822290999999495, + "workerReadParseVerifyMigrateMs": 32.83262500000001, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.690293000000565, + "mainWorkerResponseJsonParseMs": 0.01641699999981938, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.242874999999913, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 4, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.263832999999977, + "whenLoadedMs": 47.878624999999374, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.2763759999998, + "mainJsonParseMs": 13.915708999999879, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.48395799999980227, + "maxObservedMainSynchronousSegmentMs": 8.263832999999977, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 4, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.06070799999997689, + "whenLoadedMs": 42.85579199999938, + "workerReadParseVerifyMigrateMs": 25.253915999999663, + "mainParseAndValidationMs": 16.260083000000122, + "mainJsonParseMs": 16.248875000000226, + "mainWorkerResponseJsonParseMs": 16.251667000000452, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.260083000000122, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 4, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.06583399999999529, + "whenLoadedMs": 47.15870900000027, + "workerReadParseVerifyMigrateMs": 24.356249999999818, + "mainParseAndValidationMs": 21.168624999999338, + "mainJsonParseMs": 16.460374999999658, + "mainWorkerResponseJsonParseMs": 16.463791999999557, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.168624999999338, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 4, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.09691699999984849, + "whenLoadedMs": 39.632792000000336, + "workerReadParseVerifyMigrateMs": 20.64812499999971, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.738749999999527, + "mainWorkerResponseJsonParseMs": 16.74774999999954, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.74774999999954, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 4, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.0667089999997188, + "whenLoadedMs": 25.94024999999965, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 22.875041000000238, + "mainJsonParseMs": 17.9320000000007, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 22.875041000000238, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "published", + "scenario": "stable-cache", + "round": 5, + "order": ["published", "current", "main"], + "metrics": { + "constructorSyncMs": 36.40962500000023, + "whenLoadedMs": 36.41187499999978, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 7.316792000000532, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 36.40962500000023, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 5, + "order": ["published", "current", "main"], + "metrics": { + "constructorSyncMs": 0.1124999999992724, + "whenLoadedMs": 0.11354200000005221, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.0308340000010503, + "mainJsonParseMs": 0.012417000000823464, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.1124999999992724, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 5, + "order": ["published", "current", "main"], + "metrics": { + "constructorSyncMs": 8.905249999999796, + "whenLoadedMs": 99.34195900000032, + "workerReadParseVerifyMigrateMs": 74.2465830000001, + "mainParseAndValidationMs": 0.02416700000048877, + "mainJsonParseMs": 7.330457999999453, + "mainWorkerResponseJsonParseMs": 0.017917000000124972, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.905249999999796, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 5, + "order": ["published", "current", "main"], + "metrics": { + "constructorSyncMs": 0.11124999999992724, + "whenLoadedMs": 0.11283300000013696, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.012999999999919964, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.11124999999992724, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 5, + "order": ["published", "current", "main"], + "metrics": { + "constructorSyncMs": 8.504249999999956, + "whenLoadedMs": 64.52520899999945, + "workerReadParseVerifyMigrateMs": 45.554416999999376, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.816417000000001, + "mainWorkerResponseJsonParseMs": 0.022249999999985448, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.504249999999956, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 5, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.78216699999939, + "whenLoadedMs": 50.111917000000176, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.4256249999998545, + "mainJsonParseMs": 14.583582999999635, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0.5342090000003736, + "maxObservedMainSynchronousSegmentMs": 8.78216699999939, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 5, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.07191700000021228, + "whenLoadedMs": 48.88983300000018, + "workerReadParseVerifyMigrateMs": 25.813208999999915, + "mainParseAndValidationMs": 21.599167000000307, + "mainJsonParseMs": 16.796957999999904, + "mainWorkerResponseJsonParseMs": 16.800250000000233, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.599167000000307, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 5, + "order": ["repeat", "trusted"], + "metrics": { + "constructorSyncMs": 0.06204199999956472, + "whenLoadedMs": 42.63987499999985, + "workerReadParseVerifyMigrateMs": 24.836833999999726, + "mainParseAndValidationMs": 16.42779100000007, + "mainJsonParseMs": 16.41491599999972, + "mainWorkerResponseJsonParseMs": 16.417958, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.42779100000007, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 5, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.08583399999952235, + "whenLoadedMs": 37.79441700000007, + "workerReadParseVerifyMigrateMs": 19.551540999999816, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.29266700000062, + "mainWorkerResponseJsonParseMs": 16.300583000000188, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.300583000000188, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 5, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.059750000000349246, + "whenLoadedMs": 24.617541999999958, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 21.78599999999915, + "mainJsonParseMs": 17.215499999999338, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.78599999999915, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "stable-cache", + "round": 6, + "order": ["main", "current", "published"], + "metrics": { + "constructorSyncMs": 0.08674999999948341, + "whenLoadedMs": 0.08799999999973807, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 0.011541000000761414, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.08674999999948341, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "legacy-inline-migration", + "round": 6, + "order": ["main", "current", "published"], + "metrics": { + "constructorSyncMs": 8.401625000000422, + "whenLoadedMs": 61.594334000000345, + "workerReadParseVerifyMigrateMs": 37.561375000000226, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.821415999998862, + "mainWorkerResponseJsonParseMs": 0.020332999999482126, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.401625000000422, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "stable-cache", + "round": 6, + "order": ["main", "current", "published"], + "metrics": { + "constructorSyncMs": 0.1214589999999589, + "whenLoadedMs": 0.12258399999973335, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0.02933399999892572, + "mainJsonParseMs": 0.010833999999704247, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 0.1214589999999589, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-migration", + "round": 6, + "order": ["main", "current", "published"], + "metrics": { + "constructorSyncMs": 8.476791999999477, + "whenLoadedMs": 87.28620799999953, + "workerReadParseVerifyMigrateMs": 67.13983400000052, + "mainParseAndValidationMs": 0.021499999999832653, + "mainJsonParseMs": 6.901249999999891, + "mainWorkerResponseJsonParseMs": 0.01641699999981938, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 8.476791999999477, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "published", + "scenario": "stable-cache", + "round": 6, + "order": ["main", "current", "published"], + "metrics": { + "constructorSyncMs": 37.16779200000019, + "whenLoadedMs": 37.170208999999886, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 6.755125000000589, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 37.16779200000019, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 1, + "mainRetainedSourceCount": 1, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "legacy-inline-worker-fallback", + "round": 6, + "order": ["current"], + "metrics": { + "constructorSyncMs": 8.938917000000401, + "whenLoadedMs": 80.49279200000001, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 7.359416999999667, + "mainJsonParseMs": 14.694083999999748, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 16.96454099999937, + "maxObservedMainSynchronousSegmentMs": 16.96454099999937, + "productionYieldCount": 293, + "parseReportCalls": 1, + "sessions": 1, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-trusted-verification", + "round": 6, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.057291999999506515, + "whenLoadedMs": 45.624416999999994, + "workerReadParseVerifyMigrateMs": 25.19262500000059, + "mainParseAndValidationMs": 18.31633299999976, + "mainJsonParseMs": 18.301375000000007, + "mainWorkerResponseJsonParseMs": 18.304791999999907, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 18.31633299999976, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-repeat-verification", + "round": 6, + "order": ["trusted", "repeat"], + "metrics": { + "constructorSyncMs": 0.07620799999949668, + "whenLoadedMs": 50.26850000000013, + "workerReadParseVerifyMigrateMs": 27.578082999999424, + "mainParseAndValidationMs": 21.18604199999936, + "mainJsonParseMs": 16.520166000000245, + "mainWorkerResponseJsonParseMs": 16.523666999999477, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 21.18604199999936, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "main", + "scenario": "large-report-upstream", + "round": 6, + "order": ["main"], + "metrics": { + "constructorSyncMs": 0.08845900000051188, + "whenLoadedMs": 40.09645900000032, + "workerReadParseVerifyMigrateMs": 21.627792000000227, + "mainParseAndValidationMs": 0, + "mainJsonParseMs": 16.958082999999533, + "mainWorkerResponseJsonParseMs": 16.966457999999875, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 16.966457999999875, + "productionYieldCount": 0, + "parseReportCalls": 0, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + }, + { + "arm": "current", + "scenario": "large-report-worker-fallback", + "round": 6, + "order": ["current"], + "metrics": { + "constructorSyncMs": 0.06445900000016991, + "whenLoadedMs": 25.516125000000102, + "workerReadParseVerifyMigrateMs": 0, + "mainParseAndValidationMs": 22.466334000000643, + "mainJsonParseMs": 17.548749999999927, + "mainWorkerResponseJsonParseMs": 0, + "maxObservedValidationSegmentMs": 0, + "maxObservedMainSynchronousSegmentMs": 22.466334000000643, + "productionYieldCount": 0, + "parseReportCalls": 1, + "sessions": 13222, + "mainRetainedSourceCount": 0, + "enabled": false + } + } + ], + "largeReportSerializeSamples": [ + { + "arm": "main", + "round": 1, + "serializeSealMs": 16.582915999999386 + }, + { + "arm": "current", + "round": 1, + "serializeSealMs": 20.60699999999997 + }, + { + "arm": "current", + "round": 2, + "serializeSealMs": 21.30395800000042 + }, + { + "arm": "main", + "round": 2, + "serializeSealMs": 16.002000000000407 + }, + { + "arm": "main", + "round": 3, + "serializeSealMs": 17.33245899999929 + }, + { + "arm": "current", + "round": 3, + "serializeSealMs": 21.145375000000058 + }, + { + "arm": "current", + "round": 4, + "serializeSealMs": 20.628374999999323 + }, + { + "arm": "main", + "round": 4, + "serializeSealMs": 15.834375000000364 + }, + { + "arm": "main", + "round": 5, + "serializeSealMs": 16.36341700000048 + }, + { + "arm": "current", + "round": 5, + "serializeSealMs": 20.321666999999252 + }, + { + "arm": "current", + "round": 6, + "serializeSealMs": 20.62787500000013 + }, + { + "arm": "main", + "round": 6, + "serializeSealMs": 15.646083999999973 + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-resource-evidence-receipt.json b/docs/bug-reproductions/usage-scan-append/claude-resource-evidence-receipt.json new file mode 100644 index 00000000000..80bddee4831 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-resource-evidence-receipt.json @@ -0,0 +1,233 @@ +{ + "purpose": "Final Claude resource evidence provenance; no timing thresholds or whole-app latency claims.", + "worktreeHeadDuringCapture": "bcfbb8cb6d543aca516fca346c32c47ec880019f", + "runtimeSourceFreeze": { + "sha256": "30b34e60311d125d4179edce422b84ffd900c6650915b72f072f24515132cf6c", + "fileCount": 56, + "allFileHashesVerified": true, + "sources": { + "src/main/claude-usage/claude-model-pricing.test.ts": "0a2a518fb508a20cd8ceae76e9e0798e18363712bc6e8af7428c6a9f93446492", + "src/main/claude-usage/claude-model-pricing.ts": "873e35e9a4f93893828efbcab2c9f2c772633823cf8c7adf7386f6dc53a8b155", + "src/main/claude-usage/claude-usage-automation-attribution.ts": "f6674ee444e7836109a4635239205fe3161abe00cdadabb6d1219e858a9e0d38", + "src/main/claude-usage/claude-usage-report-aggregation.test.ts": "a467522328a840d712113f7fdb69dcb37a8d711024da43655a1029a1babebb43", + "src/main/claude-usage/claude-usage-report-aggregation.ts": "81eef9ee48747653b057342d28a0b029826b9affc2b21948e3f3e34f5f46963d", + "src/main/claude-usage/claude-usage-scope-filters.ts": "ef9d3016ce4e912c938134f2854bdedf1675c3eb4a41afb15bde109b2922e416", + "src/main/claude-usage/claude-usage-session-rows.ts": "1d4466ba6264a26f7434ce65de2504c096f98f191399bcf446e7b1b7fb8f51e9", + "src/main/claude-usage/persisted-projection-validation.ts": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160", + "src/main/claude-usage/persisted-source-authority.test.ts": "c1764fb85f10557b23b6fbf2de1fcffd78ebff3dd37780c6a12b23bfbbdb9001", + "src/main/claude-usage/persisted-source-cache.ts": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2", + "src/main/claude-usage/persisted-token-columns-store.test.ts": "0ea09ea83a5b94048e6930bf7ff7747f58fd5495e85e6064efb53a354459b662", + "src/main/claude-usage/persisted-token-columns.test.ts": "f138ca7993f549d0b92b59c396f8b2917aa359ce3aa0e9826b36ebc662c39f75", + "src/main/claude-usage/persisted-token-columns.ts": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855", + "src/main/claude-usage/persisted-usage-report.ts": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04", + "src/main/claude-usage/persisted-usage-test-fixture.ts": "f05c20c42a0caa4dc5da7bf58d856cba8e060b82a8b9d51da6aa1da9a2b970fe", + "src/main/claude-usage/scanner-incremental-append.test.ts": "d060c8232adae13e568abe289c673e0818082b9e7b7f607adf2172d7a02194b0", + "src/main/claude-usage/scanner-incremental-ownership.test.ts": "e96be4afb64ad1bf1368f8f6cf85cd7a3d84140b4201d44f14759b8113d2e411", + "src/main/claude-usage/scanner-incremental-reader.test.ts": "7c8d42e1d7d4c0cce28a6e23a2533f65b5751d03f2c8001f90895aafcc34207c", + "src/main/claude-usage/scanner-large-directory.test.ts": "0d1b2f5906f5d6851aad676242b3605e343774df93ee84d4409bf863e42df979", + "src/main/claude-usage/scanner-scan.test.ts": "d33a4f5178d37ffec5f22b4469f37ca7942a577bda9044c098695248eb08c09f", + "src/main/claude-usage/scanner.test.ts": "e37c105867db03057b95d4bf728f12ac99fb17e0a0fe3a683e0b3f5b50d29a54", + "src/main/claude-usage/scanner.ts": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e", + "src/main/claude-usage/source-cache-write-retention.test.ts": "0a576e94f71834c690bc9b86a3d9bf69c1c2ca37ff80c64e7f8b437e267638d7", + "src/main/claude-usage/store-checkpoint-persistence.test.ts": "790250603ddb4d66c21d252d302a489171748ff7985dd03a35ceb575a7bb0937", + "src/main/claude-usage/store-source-authority.test.ts": "8e984f7a3e115276f0a85509f34b2e613aab46fbe6ed2adb892b7ccf261c0ad7", + "src/main/claude-usage/store.test.ts": "fd0399132325c4a063a9fe54fb845711eaea600884e1e033fdc42d2d3ed9abb2", + "src/main/claude-usage/store.ts": "5beb17f973fbd12b70408e7c8526fda9486ca3fdba2acc89dccb3b0f6d3e8b39", + "src/main/claude-usage/transcript-file-discovery-errors.test.ts": "8545264c62296943b46e7b07b1246bc2e69f7f816f651502d47a2ecca8e7e61f", + "src/main/claude-usage/transcript-file-discovery.ts": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401", + "src/main/claude-usage/transcript-projection-integrity.test.ts": "fa3436b68da877af6a2f37ef6465cafaad7e1f9dc047b4d6dee6ca282ac1211f", + "src/main/claude-usage/transcript-projection-integrity.ts": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef", + "src/main/claude-usage/transcript-reader-lifetime.test.ts": "2deee32300e3a2682f6211f7345be6e481d0543ea4d5c57750d25a7ba7f19f16", + "src/main/claude-usage/transcript-record-parser-prefilter.test.ts": "900ca943a86c79c91cc6e534e86c27d157c559b7f19b040c0e47c8cc4d1a9096", + "src/main/claude-usage/transcript-record-parser.ts": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b", + "src/main/claude-usage/transcript-resume-projection.ts": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db", + "src/main/claude-usage/transcript-token-checkpoint.ts": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86", + "src/main/claude-usage/transcript-tuple-append.test.ts": "8552ec587d95eeb468951a3c86380bc2ae5ef2a6f6b1c8d9e515576c8548ecb1", + "src/main/claude-usage/transcript-usage-projection.ts": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c", + "src/main/claude-usage/types.ts": "900f26e7aa69707b9141cd8ef0d27c72ec7c6aab187140d0ec08cd770afe27bf", + "src/main/claude-usage/usage-aggregation.ts": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509", + "src/main/claude-usage/worktree-attribution-scaling.test.ts": "865805dbb21e59331408ffaaf7f5974630c147226544a2bc34442bd54357f0d3", + "src/main/claude-usage/worktree-attribution.ts": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213", + "src/main/ipc/usage-provider-handlers-readiness.test.ts": "c82302bfb010cc9b19af685ca407ade48752009dbbe8e0d56546e5fdf7d2b26d", + "src/main/ipc/usage-provider-handlers.ts": "4e9402d219ccec926c59aef922395715c8450b61eb9441d69e2faf3a6fddffc0", + "src/main/usage/usage-cache-json-integrity.ts": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7", + "src/main/usage/usage-inline-cache-preservation.ts": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf", + "src/main/usage/usage-provider-store-initialization.test.ts": "46d39af83e86af1f3b4dbc52ed210e43d71a600b55cc2ea8b566d66230154eed", + "src/main/usage/usage-provider-store-lifecycle.test.ts": "99b22e881efdd2adbdbc779f870ff207c592b8ee36833ff4daf5e5814827a87d", + "src/main/usage/usage-provider-store-lifecycle.ts": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901", + "src/main/usage/usage-scan-worker-client.test.ts": "c4475d97e4adcea8b4a4562ee5267dc1ebc6d915a1719736dc3a9faef50cbc87", + "src/main/usage/usage-scan-worker-client.ts": "fe18350d29970d9100af6518c3d7982308f8e5e232bd956c6d2e07849e8a0386", + "src/main/usage/usage-scan-worker-entry.ts": "c21b14b9cfb454422bdfb4acae1252d050b7fa5b00c2e2f938758fcde9854bf3", + "src/main/usage/usage-scan-worker-protocol.ts": "5c106a8dea30eed40b2e7deee03af7949ac474bb796089f6e38e3768105dc807", + "src/main/usage/usage-scan-worker-spawn.ts": "0aaf1c06dd256c31c481690be518ce16903f8334a9cef489e059f0ebd0f8b4f1", + "src/main/usage/usage-source-cache-file.test.ts": "2734ee35f76e2daca1cc9553ffbf3c8f4e47917a126108d345c07742ebfed12e", + "src/main/usage/usage-source-cache-file.ts": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "verificationTime": "Captured source and test hashes verified after measurement; later test-only changes are recorded in postCaptureTestWiring." + }, + "baselines": { + "original": "51e7181850b022bae2d41091fe1229accef4bd50", + "published": "8467877ed92aba2ef59737aebf461e9cab52c273", + "main": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5" + }, + "esbuildVersion": "0.28.2", + "toolsSha256": { + "config/scripts/claude-usage-append-benchmark.mjs": "d4f75710ab8c05b473b65a07e402b20588d98fab8091640a7777e575108224bc", + "config/scripts/claude-usage-benchmark-scanner.mjs": "cbaf8140fd02f617419548db76bc46eb8235568d61b8ee06cdef6ed104b048a0", + "config/scripts/claude-usage-hardening-cost-benchmark.mjs": "6beeed58fe2b4f4a34edafe22bd99364c07103cc1a33989eba4f17f527de7579", + "config/scripts/claude-usage-cache-representation-check.mjs": "bc0773e1fd5155bdc74430dc90ba9855b48dccee73e58cba63535b78e8c30e64", + "config/scripts/claude-usage-discovery-coverage-check.mjs": "6c33bc67bccf5180f19733a4832538df71549c973a475176368bfa69bfbfa9f9", + "config/scripts/claude-usage-benchmark-persistence.mjs": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "config/scripts/claude-usage-persistence-cost-benchmark.mjs": "858f4418ee5a099fb566285538b511827b4367b006a4805b16093ef42732efa5", + "config/scripts/claude-usage-benchmark-readiness.mjs": "4927c6ca51f43645cb2faa48804d4d80da4eab52b547f8e997b4c92451c27088", + "config/scripts/claude-usage-readiness-cost-benchmark.mjs": "b1d77e6bca0f0f56d5a192400675caa6993339936a744d9979ae5c416c0449bc", + "config/scripts/claude-usage-persisted-bytes-check.mjs": "21f2027141170c14fec6d99d2e05a3e2a8c96398d5ac0f010bf46e2189937210", + "config/scripts/script-child-process.mjs": "a7441428bf7b5c9a897b6a3c057c50f46acca24c4f218a4b849de5aec53c4173", + "config/scripts/counterbalanced-benchmark-schedule.mjs": "bc35b40e954fa7ddec0225ed375bd3b113c2e05b8554bc50734d14f89987294d" + }, + "artifacts": { + "docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-16k.json": { + "sha256": "84ada1f73b452cfa50f80a6f64b038c0aeec7eb8650fb510ea298f6318890579", + "driver": "config/scripts/claude-usage-persistence-cost-benchmark.mjs", + "capturedDriverMatchesFinalFile": true, + "sourceGraphs": { + "published:scanner": "8467877ed92aba2ef59737aebf461e9cab52c273:scanner", + "published:persistence": "8467877ed92aba2ef59737aebf461e9cab52c273:persistence", + "main:scanner": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:scanner", + "main:persistence": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:persistence", + "current:scanner": "worktree:scanner", + "current:persistence": "worktree:persistence" + } + }, + "docs/bug-reproductions/usage-scan-append/claude-persistence-cost-final-100k.json": { + "sha256": "257e792a4e509ed2cbbeec924eb62f7f2b19ecae64e4678f92ec8db619fa6350", + "driver": "config/scripts/claude-usage-persistence-cost-benchmark.mjs", + "capturedDriverMatchesFinalFile": true, + "sourceGraphs": { + "published:scanner": "8467877ed92aba2ef59737aebf461e9cab52c273:scanner", + "published:persistence": "8467877ed92aba2ef59737aebf461e9cab52c273:persistence", + "main:scanner": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:scanner", + "main:persistence": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:persistence", + "current:scanner": "worktree:scanner", + "current:persistence": "worktree:persistence" + } + }, + "docs/bug-reproductions/usage-scan-append/claude-readiness-cost-final.json": { + "sha256": "2f161f8fd9f9673c35fad6e21ca510b41601b3d021ef1cf0b89093c66921b597", + "driver": "config/scripts/claude-usage-readiness-cost-benchmark.mjs", + "capturedDriverMatchesFinalFile": true, + "sourceGraphs": { + "published:scanner": "8467877ed92aba2ef59737aebf461e9cab52c273:scanner", + "published:persistence": "8467877ed92aba2ef59737aebf461e9cab52c273:persistence", + "main:scanner": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:scanner", + "main:persistence": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:persistence", + "current:scanner": "worktree:scanner", + "current:persistence": "worktree:persistence" + } + }, + "docs/bug-reproductions/usage-scan-append/claude-persisted-bytes-final.json": { + "sha256": "05454eb7359a337c92480b0edbacfdfc6c0baf09f7741cab89e6891899189ece", + "driver": "config/scripts/claude-usage-persisted-bytes-check.mjs", + "capturedDriverMatchesFinalFile": true, + "sourceGraphs": { + "original:scanner": "51e7181850b022bae2d41091fe1229accef4bd50:scanner", + "published:scanner": "8467877ed92aba2ef59737aebf461e9cab52c273:scanner", + "published:persistence": "8467877ed92aba2ef59737aebf461e9cab52c273:persistence", + "main:scanner": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:scanner", + "main:persistence": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:persistence", + "current:scanner": "worktree:scanner", + "current:persistence": "worktree:persistence" + } + } + }, + "sourceGraphVerification": { + "8467877ed92aba2ef59737aebf461e9cab52c273:scanner": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "kind": "scanner", + "fileCount": 13, + "fingerprintsSha256": "88f777056a7c2d78cdeac2515496ca35f8180e2c2f93f35c83f648f9591c397a", + "allFileHashesVerified": true + }, + "8467877ed92aba2ef59737aebf461e9cab52c273:persistence": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "kind": "persistence", + "fileCount": 13, + "fingerprintsSha256": "431eddbd9f8cf0eb0be30500dc04c60fa84e60e7bec60e5155a1e635c66db6b6", + "allFileHashesVerified": true + }, + "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:scanner": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "kind": "scanner", + "fileCount": 5, + "fingerprintsSha256": "af32b131f5ad0af253e5e9366cd9d004ee4c2762a9c1890bfe0d16a1a498801b", + "allFileHashesVerified": true + }, + "b44a5796c1154de84efa25cc09f3dae2b61eb4b5:persistence": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "kind": "persistence", + "fileCount": 10, + "fingerprintsSha256": "143777a549c71beb0e609a439dafba8faf16010909a8546c6c037430ef80fcdc", + "allFileHashesVerified": true + }, + "worktree:scanner": { + "source": "worktree", + "kind": "scanner", + "fileCount": 16, + "fingerprintsSha256": "f97089ffb6992c84089e96e6708f4397f11835cfe12e5e2a237fcff7bbd58e7c", + "allFileHashesVerified": true + }, + "worktree:persistence": { + "source": "worktree", + "kind": "persistence", + "fileCount": 20, + "fingerprintsSha256": "41ad155f6d608f922666097400f18062967d6f8b0fae4d3a348add1e8b06785b", + "allFileHashesVerified": true + }, + "51e7181850b022bae2d41091fe1229accef4bd50:scanner": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "kind": "scanner", + "fileCount": 5, + "fingerprintsSha256": "46eebf00139f54e19b8c25bcf8a39cbaca84e5be60576612f88a392ad6424c57", + "allFileHashesVerified": true + } + }, + "documentationSha256": { + "docs/bug-reproductions/usage-scan-append/README.md": "f7b6333c8b92946bef3221acb1e748c60646c2516c8d71f9b887cf9b250f9946", + "docs/bug-reproductions/usage-scan-append/hardening-summary.md": "3988f58dee9010b98a7011758fe04cf02732b31badb6213afc4214f940b7adff" + }, + "scope": [ + "Each artifact retains complete source fingerprints and bundle hashes; this receipt verifies each fingerprint against its named Git commit or final worktree.", + "Artifact JSON was formatted before its receipt hash was captured. Captured tool hashes still match final files; no runtime or tool edits occurred after measurement.", + "Previously published comparison and hardening artifacts retain their historical source/layout receipts.", + "Persistence timings exclude real worker IPC/startup/queueing and rendering; readiness uses prestarted real Node workers and includes message transfer but excludes worker startup.", + "Six counterbalanced rounds per timing scenario; scanner-cache cold, operating-system-page-cache warm; logical payload I/O is distinct from physical device I/O." + ], + "postCaptureTestWiring": { + "reason": "Move Electron, worker and discovery mock registrations from the shared test fixture into its three test consumers; inject the checked getPath mock. CI requires mock registration in actual test files.", + "changes": { + "src/main/claude-usage/persisted-usage-test-fixture.ts": { + "capturedSha256": "f05c20c42a0caa4dc5da7bf58d856cba8e060b82a8b9d51da6aa1da9a2b970fe", + "finalSha256": "e10b2821f9ef0562ffbe93dffcb3bc0270a5269bcd41c9a5dbc45bb46fcb2cf1" + }, + "src/main/claude-usage/store-checkpoint-persistence.test.ts": { + "capturedSha256": "790250603ddb4d66c21d252d302a489171748ff7985dd03a35ceb575a7bb0937", + "finalSha256": "e8413312cfeb2da7b41c9d5dd41a3ff1bb321df3457867f73e5ff613b37e6a87" + }, + "src/main/claude-usage/store-source-authority.test.ts": { + "capturedSha256": "8e984f7a3e115276f0a85509f34b2e613aab46fbe6ed2adb892b7ccf261c0ad7", + "finalSha256": "a907ccf2804569083100fb2580d0bad839bb4ae6dbf39f7137737a496bbde361" + }, + "src/main/claude-usage/persisted-token-columns-store.test.ts": { + "capturedSha256": "0ea09ea83a5b94048e6930bf7ff7747f58fd5495e85e6064efb53a354459b662", + "finalSha256": "d526a4a8b74e9f0163dec4ed30e315bbb591c75d2f2604af86c09e8db7a6948a" + } + }, + "unchangedCapturedFreezeFileCount": 52, + "capturedProductionGraphFileCount": 30, + "capturedProductionGraphHashesVerifiedUnchanged": true, + "capturedToolHashesVerifiedUnchanged": true, + "capturedArtifactHashesVerifiedUnchanged": true, + "benchmarkRerunRequired": false, + "validation": "17 affected tests, Node typecheck, anti-slop, changed-code quality and formatting passed after the test-wiring change." + } +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-source-compression-100k.json b/docs/bug-reproductions/usage-scan-append/claude-source-compression-100k.json new file mode 100644 index 00000000000..878d3946512 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-source-compression-100k.json @@ -0,0 +1,1621 @@ +{ + "purpose": "Lossless Claude source compression: actual pinned scanner, cache and durable report persistence costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "usageKeys": 100000, + "maximaPattern": "unique", + "rounds": 6, + "historyBytes": 47522805, + "suffixBytes": 456, + "fixtureSha256": "a3dbe544f34669c3a434b6e16c8cbf906e501e2ad16c64dd81f2f032c0d26bcb", + "methodology": { + "timing": "Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.", + "refresh": "Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.", + "uncompressed": "Uncompressed uses uncompressed B4102; current compresses its source sidecar with asynchronous gzip level 1. Both retain identical usage history.", + "exclusions": "Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.", + "attribution": "Main is fixed b44a5796; uncompressed is previously published B4102; current adds lossless source compression.", + "correctness": "Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.", + "writtenBytes": "Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals." + }, + "toolingSha256": "e745a37bbd4161cab061062bb30adc0158d1856d198981d04c5b1f503f1bd5eb", + "supportToolingSha256": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "arms": { + "uncompressed": { + "commit": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "scanner": { + "bundleSha256": "613f2359cdfe1c335cc7928e654da1423204614448bf9bf4edde2e5af01bb511", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549" + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "5c15df2de9e06f24280c1e9e5b083ef241af808614768e692f532242c2858123", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549" + } + } + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "613f2359cdfe1c335cc7928e654da1423204614448bf9bf4edde2e5af01bb511", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "cc18078db9f4fa4632e9653ee3e963fc7d559d05f063a5e1b87c34e43ccca948", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "9b4de097982b7b2d705647456e319ab9cab8b11c786e244fb19349fe63931ab5" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/source-cache-compression.ts": { + "source": "worktree", + "sha256": "b6a0d3ad3bb447905d056dd98ded0a58c6e4750048c5a530c5ca09a7ce63328f" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "33b18046e3a2b68fcfc5c3654ff0ad1f70888113ea21420d5db24f32109b82a9" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "4f2cee1b76a034153fd9c24ef7e2701e0831bf19d1d4c1f817772e8597cdf17e" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + } + }, + "summary": { + "uncompressed": { + "cold": { + "scanMs": 349.85, + "completeRefreshMs": 392.935, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 32.588, + "reportSerializeSealMs": 0.022, + "reportDurableWriteMs": 13.194, + "totalPersistMs": 45.537, + "sourceBytes": 6126060, + "sourceBytesWritten": 6126060, + "reportBytes": 1953, + "totalWrittenBytes": 6128013, + "totalPersistedBytes": 6128013 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.719, + "scanMs": 9.152, + "completeRefreshMs": 30.527, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126060, + "totalReadBytes": 6126060, + "sourceWritePackSealDurableMs": 0.006, + "reportSerializeSealMs": 0.011, + "reportDurableWriteMs": 10.704, + "totalPersistMs": 10.727, + "sourceBytes": 6126060, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128013 + }, + "append": { + "sourceReadVerifyDecodeMs": 10.821, + "scanMs": 32.693, + "completeRefreshMs": 83.012, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126060, + "totalReadBytes": 6151092, + "sourceWritePackSealDurableMs": 26.064, + "reportSerializeSealMs": 0.017, + "reportDurableWriteMs": 10.64, + "totalPersistMs": 37.506, + "sourceBytes": 6126063, + "sourceBytesWritten": 6126063, + "reportBytes": 1953, + "totalWrittenBytes": 6128016, + "totalPersistedBytes": 6128016 + } + }, + "main": { + "cold": { + "scanMs": 226.544, + "completeRefreshMs": 260.822, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 19.799, + "reportSerializeSealMs": 0.024, + "reportDurableWriteMs": 12.533, + "totalPersistMs": 32.355, + "sourceBytes": 2979903.5, + "sourceBytesWritten": 2979903.5, + "reportBytes": 1953, + "totalWrittenBytes": 2981856.5, + "totalPersistedBytes": 2981856.5 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.01, + "scanMs": 9.733, + "completeRefreshMs": 37.782, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979903.5, + "totalReadBytes": 2979903.5, + "sourceWritePackSealDurableMs": 15.096, + "reportSerializeSealMs": 0.014, + "reportDurableWriteMs": 10.068, + "totalPersistMs": 25.02, + "sourceBytes": 2979903.5, + "sourceBytesWritten": 2979903.5, + "reportBytes": 1953, + "totalWrittenBytes": 2981856.5, + "totalPersistedBytes": 2981856.5 + }, + "append": { + "sourceReadVerifyDecodeMs": 4.268, + "scanMs": 227.214, + "completeRefreshMs": 260.294, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979903.5, + "totalReadBytes": 50503164.5, + "sourceWritePackSealDurableMs": 19.367, + "reportSerializeSealMs": 0.021, + "reportDurableWriteMs": 10.284, + "totalPersistMs": 30.477, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857 + } + }, + "current": { + "cold": { + "scanMs": 352.94, + "completeRefreshMs": 409.932, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 44.788, + "reportSerializeSealMs": 0.039, + "reportDurableWriteMs": 12.52, + "totalPersistMs": 57.394, + "sourceBytes": 1596425, + "sourceBytesWritten": 1596425, + "reportBytes": 2037, + "totalWrittenBytes": 1598462, + "totalPersistedBytes": 1598462 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.239, + "scanMs": 9.153, + "completeRefreshMs": 36.655, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596425, + "totalReadBytes": 1596425, + "sourceWritePackSealDurableMs": 0.004, + "reportSerializeSealMs": 0.028, + "reportDurableWriteMs": 11.76, + "totalPersistMs": 11.807, + "sourceBytes": 1596425, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598462 + }, + "append": { + "sourceReadVerifyDecodeMs": 15.22, + "scanMs": 33.116, + "completeRefreshMs": 96.883, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596425, + "totalReadBytes": 1621457, + "sourceWritePackSealDurableMs": 38.945, + "reportSerializeSealMs": 0.034, + "reportDurableWriteMs": 9.919, + "totalPersistMs": 49.401, + "sourceBytes": 1596442.5, + "sourceBytesWritten": 1596442.5, + "reportBytes": 2037, + "totalWrittenBytes": 1598479.5, + "totalPersistedBytes": 1598479.5 + } + } + }, + "samples": [ + { + "arm": "uncompressed", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 321.8455409999997, + "completeRefreshMs": 381.56237500000043, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 44.59950000000026, + "reportSerializeSealMs": 0.028624999999919964, + "reportDurableWriteMs": 15.088709000000563, + "totalPersistMs": 59.716834000000745, + "sourceBytes": 6126060, + "sourceBytesWritten": 6126060, + "reportBytes": 1953, + "totalWrittenBytes": 6128013, + "totalPersistedBytes": 6128013 + }, + "warm": { + "sourceReadVerifyDecodeMs": 11.041457999999693, + "scanMs": 9.336834000000636, + "completeRefreshMs": 34.65508399999999, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126060, + "totalReadBytes": 6126060, + "sourceWritePackSealDurableMs": 0.003208000000086031, + "reportSerializeSealMs": 0.011582999999518506, + "reportDurableWriteMs": 14.262001000000055, + "totalPersistMs": 14.27679199999966, + "sourceBytes": 6126060, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128013, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.930124999999862, + "scanMs": 35.19883300000038, + "completeRefreshMs": 84.09904200000074, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126060, + "totalReadBytes": 6151092, + "sourceWritePackSealDurableMs": 25.983667000000423, + "reportSerializeSealMs": 0.0167089999995369, + "reportDurableWriteMs": 11.969708000000537, + "totalPersistMs": 37.9700840000005, + "sourceBytes": 6126061, + "sourceBytesWritten": 6126061, + "reportBytes": 1953, + "totalWrittenBytes": 6128014, + "totalPersistedBytes": 6128014, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 248.6612500000001, + "completeRefreshMs": 289.3148340000007, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 25.775500000000648, + "reportSerializeSealMs": 0.02787499999976717, + "reportDurableWriteMs": 14.850209000000177, + "totalPersistMs": 40.65358400000059, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.1069170000000668, + "scanMs": 10.961457999999766, + "completeRefreshMs": 37.88941699999941, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979904, + "totalReadBytes": 2979904, + "sourceWritePackSealDurableMs": 14.729582999999366, + "reportSerializeSealMs": 0.015041000000564964, + "reportDurableWriteMs": 9.076417999999649, + "totalPersistMs": 23.82104199999958, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 4.386750000000575, + "scanMs": 226.75, + "completeRefreshMs": 261.7922920000001, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979904, + "totalReadBytes": 50503165, + "sourceWritePackSealDurableMs": 20.788375000000087, + "reportSerializeSealMs": 0.018417000000226835, + "reportDurableWriteMs": 9.8487499999992, + "totalPersistMs": 30.655541999999514, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 340.5280839999996, + "completeRefreshMs": 395.7729589999999, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 43.62958299999991, + "reportSerializeSealMs": 0.0406250000005457, + "reportDurableWriteMs": 11.574666999999863, + "totalPersistMs": 55.24487500000032, + "sourceBytes": 1596425, + "sourceBytesWritten": 1596425, + "reportBytes": 2037, + "totalWrittenBytes": 1598462, + "totalPersistedBytes": 1598462 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.45300000000043, + "scanMs": 12.69879200000014, + "completeRefreshMs": 37.314376000000266, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596425, + "totalReadBytes": 1596425, + "sourceWritePackSealDurableMs": 0.004249999999956344, + "reportSerializeSealMs": 0.02733299999999872, + "reportDurableWriteMs": 10.131000999999742, + "totalPersistMs": 10.162583999999697, + "sourceBytes": 1596425, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598462, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 16.954541999999492, + "scanMs": 32.91429100000005, + "completeRefreshMs": 99.75512499999968, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596425, + "totalReadBytes": 1621457, + "sourceWritePackSealDurableMs": 40.00429199999962, + "reportSerializeSealMs": 0.055957999999918684, + "reportDurableWriteMs": 9.826042000000598, + "totalPersistMs": 49.88629200000014, + "sourceBytes": 1596440, + "sourceBytesWritten": 1596440, + "reportBytes": 2037, + "totalWrittenBytes": 1598477, + "totalPersistedBytes": 1598477, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 353.3240420000002, + "completeRefreshMs": 412.4925839999996, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 45.49370799999997, + "reportSerializeSealMs": 0.054917000000386906, + "reportDurableWriteMs": 13.619916999999077, + "totalPersistMs": 59.168541999999434, + "sourceBytes": 1596423, + "sourceBytesWritten": 1596423, + "reportBytes": 2037, + "totalWrittenBytes": 1598460, + "totalPersistedBytes": 1598460 + }, + "warm": { + "sourceReadVerifyDecodeMs": 13.98370899999918, + "scanMs": 8.67700000000059, + "completeRefreshMs": 36.30737599999975, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596423, + "totalReadBytes": 1596423, + "sourceWritePackSealDurableMs": 0.0037080000001878943, + "reportSerializeSealMs": 0.027749999999286956, + "reportDurableWriteMs": 13.615209000000505, + "totalPersistMs": 13.64666699999998, + "sourceBytes": 1596423, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598460, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 16.40374999999949, + "scanMs": 30.641084000000774, + "completeRefreshMs": 94.7300839999998, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596423, + "totalReadBytes": 1621455, + "sourceWritePackSealDurableMs": 37.7529999999997, + "reportSerializeSealMs": 0.03170799999952578, + "reportDurableWriteMs": 9.900542000000314, + "totalPersistMs": 47.68524999999954, + "sourceBytes": 1596446, + "sourceBytesWritten": 1596446, + "reportBytes": 2037, + "totalWrittenBytes": 1598483, + "totalPersistedBytes": 1598483, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 224.84249999999975, + "completeRefreshMs": 255.30174999999963, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 18.19170899999972, + "reportSerializeSealMs": 0.02062500000010914, + "reportDurableWriteMs": 12.246916000000056, + "totalPersistMs": 30.459249999999884, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.00329099999999, + "scanMs": 10.315583999999944, + "completeRefreshMs": 39.907083999999486, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979903, + "totalReadBytes": 2979903, + "sourceWritePackSealDurableMs": 15.462125000000015, + "reportSerializeSealMs": 0.008291999999528343, + "reportDurableWriteMs": 11.117792000000009, + "totalPersistMs": 26.58820899999955, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.0545419999998558, + "scanMs": 227.67820799999936, + "completeRefreshMs": 258.79520799999955, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979903, + "totalReadBytes": 50503164, + "sourceWritePackSealDurableMs": 16.860500000000684, + "reportSerializeSealMs": 0.037374999999883585, + "reportDurableWriteMs": 11.164582999999766, + "totalPersistMs": 28.062458000000333, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 349.7402920000004, + "completeRefreshMs": 393.27087500000016, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 30.163291999999274, + "reportSerializeSealMs": 0.024459000000206288, + "reportDurableWriteMs": 13.342832000000271, + "totalPersistMs": 43.53058299999975, + "sourceBytes": 6126058, + "sourceBytesWritten": 6126058, + "reportBytes": 1953, + "totalWrittenBytes": 6128011, + "totalPersistedBytes": 6128011 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.935874999999214, + "scanMs": 9.17395900000156, + "completeRefreshMs": 30.588666999999987, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126058, + "totalReadBytes": 6126058, + "sourceWritePackSealDurableMs": 0.03520799999932933, + "reportSerializeSealMs": 0.011291000000710483, + "reportDurableWriteMs": 10.432333999999173, + "totalPersistMs": 10.478832999999213, + "sourceBytes": 6126058, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128011, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.367334000000483, + "scanMs": 33.0284159999992, + "completeRefreshMs": 78.96104200000082, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126058, + "totalReadBytes": 6151090, + "sourceWritePackSealDurableMs": 26.143917000001238, + "reportSerializeSealMs": 0.014584000000468222, + "reportDurableWriteMs": 9.40679099999943, + "totalPersistMs": 35.565292000001136, + "sourceBytes": 6126063, + "sourceBytesWritten": 6126063, + "reportBytes": 1953, + "totalWrittenBytes": 6128016, + "totalPersistedBytes": 6128016, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 225.0432920000003, + "completeRefreshMs": 261.8642080000009, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 24.566208000000188, + "reportSerializeSealMs": 0.024166999999579275, + "reportDurableWriteMs": 12.230541000000812, + "totalPersistMs": 36.82091600000058, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.833959000001414, + "scanMs": 8.58575000000019, + "completeRefreshMs": 34.60645900000236, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979904, + "totalReadBytes": 2979904, + "sourceWritePackSealDurableMs": 13.610708000000159, + "reportSerializeSealMs": 0.010958000000755419, + "reportDurableWriteMs": 9.565083999999842, + "totalPersistMs": 23.186750000000757, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 4.149124999999913, + "scanMs": 221.77570899999955, + "completeRefreshMs": 257.4642509999994, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979904, + "totalReadBytes": 50503165, + "sourceWritePackSealDurableMs": 21.23700000000099, + "reportSerializeSealMs": 0.02124999999978172, + "reportDurableWriteMs": 10.281166999999186, + "totalPersistMs": 31.539416999999958, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 328.63279200000034, + "completeRefreshMs": 374.0316670000011, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 32.9783750000006, + "reportSerializeSealMs": 0.01808299999902374, + "reportDurableWriteMs": 12.40241700000115, + "totalPersistMs": 45.39887500000077, + "sourceBytes": 6126060, + "sourceBytesWritten": 6126060, + "reportBytes": 1953, + "totalWrittenBytes": 6128013, + "totalPersistedBytes": 6128013 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.50250000000051, + "scanMs": 8.875, + "completeRefreshMs": 29.36591700000099, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126060, + "totalReadBytes": 6126060, + "sourceWritePackSealDurableMs": 0.005959000000075321, + "reportSerializeSealMs": 0.009332999999969616, + "reportDurableWriteMs": 9.973125000000437, + "totalPersistMs": 9.988417000000481, + "sourceBytes": 6126060, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128013, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 13.206916999999521, + "scanMs": 32.281457999999475, + "completeRefreshMs": 80.39016699999956, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126060, + "totalReadBytes": 6151092, + "sourceWritePackSealDurableMs": 25.300375000000713, + "reportSerializeSealMs": 0.024583000000347965, + "reportDurableWriteMs": 9.576833999999508, + "totalPersistMs": 34.90179200000057, + "sourceBytes": 6126063, + "sourceBytesWritten": 6126063, + "reportBytes": 1953, + "totalWrittenBytes": 6128016, + "totalPersistedBytes": 6128016, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 352.5550000000003, + "completeRefreshMs": 407.37225000000035, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 42.659332999999606, + "reportSerializeSealMs": 0.036082999999052845, + "reportDurableWriteMs": 12.1218340000014, + "totalPersistMs": 54.81725000000006, + "sourceBytes": 1596429, + "sourceBytesWritten": 1596429, + "reportBytes": 2037, + "totalWrittenBytes": 1598466, + "totalPersistedBytes": 1598466 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.025707999999213, + "scanMs": 21.939167000000452, + "completeRefreshMs": 45.709875000000466, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596429, + "totalReadBytes": 1596429, + "sourceWritePackSealDurableMs": 0.04083300000093004, + "reportSerializeSealMs": 0.031458999999813386, + "reportDurableWriteMs": 9.672708000000057, + "totalPersistMs": 9.7450000000008, + "sourceBytes": 1596429, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598466, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 13.440624999999272, + "scanMs": 33.31700000000092, + "completeRefreshMs": 95.52358300000014, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596429, + "totalReadBytes": 1621461, + "sourceWritePackSealDurableMs": 38.889499999999316, + "reportSerializeSealMs": 0.03483300000152667, + "reportDurableWriteMs": 9.841624999999112, + "totalPersistMs": 48.765957999999955, + "sourceBytes": 1596448, + "sourceBytesWritten": 1596448, + "reportBytes": 2037, + "totalWrittenBytes": 1598485, + "totalPersistedBytes": 1598485, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 346.7522919999992, + "completeRefreshMs": 402.37162499999795, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 44.08241699999962, + "reportSerializeSealMs": 0.03820799999994051, + "reportDurableWriteMs": 11.49870799999917, + "totalPersistMs": 55.61933299999873, + "sourceBytes": 1596425, + "sourceBytesWritten": 1596425, + "reportBytes": 2037, + "totalWrittenBytes": 1598462, + "totalPersistedBytes": 1598462 + }, + "warm": { + "sourceReadVerifyDecodeMs": 13.598708999999872, + "scanMs": 8.587625000000116, + "completeRefreshMs": 35.26654199999939, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596425, + "totalReadBytes": 1596425, + "sourceWritePackSealDurableMs": 0.004167000000961707, + "reportSerializeSealMs": 0.021957999999358435, + "reportDurableWriteMs": 13.054082999999082, + "totalPersistMs": 13.080207999999402, + "sourceBytes": 1596425, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598462, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 13.560958000000028, + "scanMs": 33.836708999999246, + "completeRefreshMs": 96.31316699999843, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596425, + "totalReadBytes": 1621457, + "sourceWritePackSealDurableMs": 38.94529199999852, + "reportSerializeSealMs": 0.03254200000083074, + "reportDurableWriteMs": 9.937665999999808, + "totalPersistMs": 48.915499999999156, + "sourceBytes": 1596445, + "sourceBytesWritten": 1596445, + "reportBytes": 2037, + "totalWrittenBytes": 1598482, + "totalPersistedBytes": 1598482, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 349.95904099999825, + "completeRefreshMs": 392.59866599999805, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 29.7276669999992, + "reportSerializeSealMs": 0.025125000000116415, + "reportDurableWriteMs": 12.886833000000479, + "totalPersistMs": 42.639624999999796, + "sourceBytes": 6126060, + "sourceBytesWritten": 6126060, + "reportBytes": 1953, + "totalWrittenBytes": 6128013, + "totalPersistedBytes": 6128013 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.313749999999345, + "scanMs": 8.671124999998938, + "completeRefreshMs": 29.963332999997874, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126060, + "totalReadBytes": 6126060, + "sourceWritePackSealDurableMs": 0.006166999999550171, + "reportSerializeSealMs": 0.00908299999900919, + "reportDurableWriteMs": 10.963208000001032, + "totalPersistMs": 10.978457999999591, + "sourceBytes": 6126060, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128013, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.797457999999097, + "scanMs": 32.35725000000093, + "completeRefreshMs": 82.46095799999966, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126060, + "totalReadBytes": 6151092, + "sourceWritePackSealDurableMs": 29.10962499999914, + "reportSerializeSealMs": 0.019874999999956344, + "reportDurableWriteMs": 10.176750000000538, + "totalPersistMs": 39.306249999999636, + "sourceBytes": 6126063, + "sourceBytesWritten": 6126063, + "reportBytes": 1953, + "totalWrittenBytes": 6128016, + "totalPersistedBytes": 6128016, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 233.0477920000012, + "completeRefreshMs": 266.02254200000243, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 20.189667000000554, + "reportSerializeSealMs": 0.0232079999987036, + "reportDurableWriteMs": 12.761875000001965, + "totalPersistMs": 32.97475000000122, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.1393330000009882, + "scanMs": 23.736166999999114, + "completeRefreshMs": 58.20079199999964, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979904, + "totalReadBytes": 2979904, + "sourceWritePackSealDurableMs": 21.175959000000148, + "reportSerializeSealMs": 0.013499999999112333, + "reportDurableWriteMs": 10.135833000000275, + "totalPersistMs": 31.325291999999536, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 4.861917000000176, + "scanMs": 232.73108300000058, + "completeRefreshMs": 267.89150000000154, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979904, + "totalReadBytes": 50503165, + "sourceWritePackSealDurableMs": 17.945959000000585, + "reportSerializeSealMs": 0.02029199999924458, + "reportDurableWriteMs": 12.332249000000957, + "totalPersistMs": 30.298500000000786, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 423.300792, + "completeRefreshMs": 472.3114999999998, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 35.948333000000275, + "reportSerializeSealMs": 0.017583999999260413, + "reportDurableWriteMs": 13.04479100000026, + "totalPersistMs": 49.010707999999795, + "sourceBytes": 6126058, + "sourceBytesWritten": 6126058, + "reportBytes": 1953, + "totalWrittenBytes": 6128011, + "totalPersistedBytes": 6128011 + }, + "warm": { + "sourceReadVerifyDecodeMs": 11.21704200000022, + "scanMs": 9.979416000000128, + "completeRefreshMs": 31.775958000001992, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126058, + "totalReadBytes": 6126058, + "sourceWritePackSealDurableMs": 0.005415999999968335, + "reportSerializeSealMs": 0.011290999998891493, + "reportDurableWriteMs": 10.562793000002785, + "totalPersistMs": 10.579500000001644, + "sourceBytes": 6126058, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128011, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.843834000001152, + "scanMs": 36.66429099999914, + "completeRefreshMs": 84.5491660000007, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126058, + "totalReadBytes": 6151090, + "sourceWritePackSealDurableMs": 25.69041599999946, + "reportSerializeSealMs": 0.017957999998543528, + "reportDurableWriteMs": 11.332667000002402, + "totalPersistMs": 37.041041000000405, + "sourceBytes": 6126063, + "sourceBytesWritten": 6126063, + "reportBytes": 1953, + "totalWrittenBytes": 6128016, + "totalPersistedBytes": 6128016, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 367.3507499999996, + "completeRefreshMs": 432.70424999999886, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 50.29449999999997, + "reportSerializeSealMs": 0.05162500000005821, + "reportDurableWriteMs": 15.007374999999229, + "totalPersistMs": 65.35349999999926, + "sourceBytes": 1596419, + "sourceBytesWritten": 1596419, + "reportBytes": 2037, + "totalWrittenBytes": 1598456, + "totalPersistedBytes": 1598456 + }, + "warm": { + "sourceReadVerifyDecodeMs": 15.244125000001077, + "scanMs": 9.042499999999563, + "completeRefreshMs": 34.82137500000135, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596419, + "totalReadBytes": 1596419, + "sourceWritePackSealDurableMs": 0.03687499999978172, + "reportSerializeSealMs": 0.031790999999429914, + "reportDurableWriteMs": 10.466084000001501, + "totalPersistMs": 10.534750000000713, + "sourceBytes": 1596419, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598456, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 15.002000000000407, + "scanMs": 31.580792000000656, + "completeRefreshMs": 97.45187500000247, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596419, + "totalReadBytes": 1621451, + "sourceWritePackSealDurableMs": 38.94537500000297, + "reportSerializeSealMs": 0.03241699999853154, + "reportDurableWriteMs": 11.89129099999991, + "totalPersistMs": 50.86908300000141, + "sourceBytes": 1596433, + "sourceBytesWritten": 1596433, + "reportBytes": 2037, + "totalWrittenBytes": 1598470, + "totalPersistedBytes": 1598470, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 228.04479100000026, + "completeRefreshMs": 259.7806660000024, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 19.40883400000166, + "reportSerializeSealMs": 0.023249999998370185, + "reportDurableWriteMs": 12.303791000002093, + "totalPersistMs": 31.735875000002125, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.920165999999881, + "scanMs": 8.776458999996976, + "completeRefreshMs": 37.67504199999894, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979903, + "totalReadBytes": 2979903, + "sourceWritePackSealDurableMs": 15.963583000000654, + "reportSerializeSealMs": 0.014167000001179986, + "reportDurableWriteMs": 10.000667000000249, + "totalPersistMs": 25.978417000002082, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.0786670000015874, + "scanMs": 223.67699999999968, + "completeRefreshMs": 253.9810830000024, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979903, + "totalReadBytes": 50503164, + "sourceWritePackSealDurableMs": 17.230665999999474, + "reportSerializeSealMs": 0.028375000001688022, + "reportDurableWriteMs": 9.966374999999971, + "totalPersistMs": 27.225416000001132, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 221.3754169999993, + "completeRefreshMs": 251.89637599999696, + "transcriptBytesRead": 47522805, + "sourceBytesRead": 0, + "totalReadBytes": 47522805, + "sourceWritePackSealDurableMs": 16.84124999999767, + "reportSerializeSealMs": 0.02545800000007148, + "reportDurableWriteMs": 13.654250999999931, + "totalPersistMs": 30.520958999997674, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856 + }, + "warm": { + "sourceReadVerifyDecodeMs": 3.0177089999997406, + "scanMs": 9.150791000000027, + "completeRefreshMs": 36.23033399999986, + "transcriptBytesRead": 0, + "sourceBytesRead": 2979903, + "totalReadBytes": 2979903, + "sourceWritePackSealDurableMs": 13.729374999998981, + "reportSerializeSealMs": 0.015540999997028848, + "reportDurableWriteMs": 10.31691800000408, + "totalPersistMs": 24.06183400000009, + "sourceBytes": 2979903, + "sourceBytesWritten": 2979903, + "reportBytes": 1953, + "totalWrittenBytes": 2981856, + "totalPersistedBytes": 2981856, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 4.413415999999415, + "scanMs": 227.82091700000092, + "completeRefreshMs": 264.8092499999984, + "transcriptBytesRead": 47523261, + "sourceBytesRead": 2979903, + "totalReadBytes": 50503164, + "sourceWritePackSealDurableMs": 22.266250000000582, + "reportSerializeSealMs": 0.021000000000640284, + "reportDurableWriteMs": 10.287666999996873, + "totalPersistMs": 32.574916999998095, + "sourceBytes": 2979904, + "sourceBytesWritten": 2979904, + "reportBytes": 1953, + "totalWrittenBytes": 2981857, + "totalPersistedBytes": 2981857, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 361.6758749999972, + "completeRefreshMs": 421.838832999998, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 47.21020800000042, + "reportSerializeSealMs": 0.03512500000215368, + "reportDurableWriteMs": 12.917624999998225, + "totalPersistMs": 60.1629580000008, + "sourceBytes": 1596431, + "sourceBytesWritten": 1596431, + "reportBytes": 2037, + "totalWrittenBytes": 1598468, + "totalPersistedBytes": 1598468 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.46979199999987, + "scanMs": 9.263833000000886, + "completeRefreshMs": 37.00279199999932, + "transcriptBytesRead": 0, + "sourceBytesRead": 1596431, + "totalReadBytes": 1596431, + "sourceWritePackSealDurableMs": 0.0043750000004365575, + "reportSerializeSealMs": 0.028124999997089617, + "reportDurableWriteMs": 13.236667000001034, + "totalPersistMs": 13.26916699999856, + "sourceBytes": 1596431, + "sourceBytesWritten": 0, + "reportBytes": 2037, + "totalWrittenBytes": 2037, + "totalPersistedBytes": 1598468, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 15.4376250000023, + "scanMs": 44.570583000000624, + "completeRefreshMs": 111.48499900000024, + "transcriptBytesRead": 25032, + "sourceBytesRead": 1596431, + "totalReadBytes": 1621463, + "sourceWritePackSealDurableMs": 40.5389159999977, + "reportSerializeSealMs": 0.0406669999974838, + "reportDurableWriteMs": 10.897208000002138, + "totalPersistMs": 51.47679099999732, + "sourceBytes": 1596439, + "sourceBytesWritten": 1596439, + "reportBytes": 2037, + "totalWrittenBytes": 1598476, + "totalPersistedBytes": 1598476, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 354.2873330000002, + "completeRefreshMs": 399.96208299999853, + "transcriptBytesRead": 47539189, + "sourceBytesRead": 0, + "totalReadBytes": 47539189, + "sourceWritePackSealDurableMs": 32.19704199999978, + "reportSerializeSealMs": 0.018958000000566244, + "reportDurableWriteMs": 13.458749999997963, + "totalPersistMs": 45.67474999999831, + "sourceBytes": 6126060, + "sourceBytesWritten": 6126060, + "reportBytes": 1953, + "totalWrittenBytes": 6128013, + "totalPersistedBytes": 6128013 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.461624999999913, + "scanMs": 9.129542000002402, + "completeRefreshMs": 30.46608400000332, + "transcriptBytesRead": 0, + "sourceBytesRead": 6126060, + "totalReadBytes": 6126060, + "sourceWritePackSealDurableMs": 0.020042000000103144, + "reportSerializeSealMs": 0.01058299999931478, + "reportDurableWriteMs": 10.844292000001587, + "totalPersistMs": 10.874917000001005, + "sourceBytes": 6126060, + "sourceBytesWritten": 0, + "reportBytes": 1953, + "totalWrittenBytes": 1953, + "totalPersistedBytes": 6128013, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 10.209500000000844, + "scanMs": 30.78625000000102, + "completeRefreshMs": 83.56220800000301, + "transcriptBytesRead": 25032, + "sourceBytesRead": 6126060, + "totalReadBytes": 6151092, + "sourceWritePackSealDurableMs": 31.44645799999853, + "reportSerializeSealMs": 0.016041999999288237, + "reportDurableWriteMs": 11.103958000003331, + "totalPersistMs": 42.56645800000115, + "sourceBytes": 6126061, + "sourceBytesWritten": 6126061, + "reportBytes": 1953, + "totalWrittenBytes": 6128014, + "totalPersistedBytes": 6128014, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-zG23sT/.claude/projects/benchmark/active-session.jsonl" + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-source-compression-16k.json b/docs/bug-reproductions/usage-scan-append/claude-source-compression-16k.json new file mode 100644 index 00000000000..c4bcead984a --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-source-compression-16k.json @@ -0,0 +1,1621 @@ +{ + "purpose": "Lossless Claude source compression: actual pinned scanner, cache and durable report persistence costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "usageKeys": 16384, + "maximaPattern": "repeated", + "rounds": 6, + "historyBytes": 7514420, + "suffixBytes": 454, + "fixtureSha256": "32bbcc294e2c9a7af48a1ca1e657502534effc0124ac8aff1c4b8d655c84aa54", + "methodology": { + "timing": "Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.", + "refresh": "Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.", + "uncompressed": "Uncompressed uses uncompressed B4102; current compresses its source sidecar with asynchronous gzip level 1. Both retain identical usage history.", + "exclusions": "Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.", + "attribution": "Main is fixed b44a5796; uncompressed is previously published B4102; current adds lossless source compression.", + "correctness": "Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.", + "writtenBytes": "Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals." + }, + "toolingSha256": "e745a37bbd4161cab061062bb30adc0158d1856d198981d04c5b1f503f1bd5eb", + "supportToolingSha256": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "arms": { + "uncompressed": { + "commit": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "scanner": { + "bundleSha256": "18bd36561060e416624c6eb7d718e92b65bfe6aa8787480ffaeb2462d73f8be9", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "77a4ab666b7118ef26a012145ce96951fa55277b335650d49a9ca31ffc1b2101", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "18bd36561060e416624c6eb7d718e92b65bfe6aa8787480ffaeb2462d73f8be9", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "cc18078db9f4fa4632e9653ee3e963fc7d559d05f063a5e1b87c34e43ccca948", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "9b4de097982b7b2d705647456e319ab9cab8b11c786e244fb19349fe63931ab5" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/source-cache-compression.ts": { + "source": "worktree", + "sha256": "b6a0d3ad3bb447905d056dd98ded0a58c6e4750048c5a530c5ca09a7ce63328f" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "33b18046e3a2b68fcfc5c3654ff0ad1f70888113ea21420d5db24f32109b82a9" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "4f2cee1b76a034153fd9c24ef7e2701e0831bf19d1d4c1f817772e8597cdf17e" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + } + } + }, + "summary": { + "uncompressed": { + "cold": { + "scanMs": 58.089, + "completeRefreshMs": 82.531, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.4, + "reportSerializeSealMs": 0.014, + "reportDurableWriteMs": 10.616, + "totalPersistMs": 24.035, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.943, + "scanMs": 1.612, + "completeRefreshMs": 12.744, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.004, + "reportSerializeSealMs": 0.008, + "reportDurableWriteMs": 9.553, + "totalPersistMs": 9.563, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295 + }, + "append": { + "sourceReadVerifyDecodeMs": 1.718, + "scanMs": 5.233, + "completeRefreshMs": 28.393, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 11.193, + "reportSerializeSealMs": 0.011, + "reportDurableWriteMs": 9.788, + "totalPersistMs": 21.001, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831 + } + }, + "main": { + "cold": { + "scanMs": 36.861, + "completeRefreshMs": 61.649, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 12.974, + "reportSerializeSealMs": 0.013, + "reportDurableWriteMs": 10.23, + "totalPersistMs": 23.232, + "sourceBytes": 470909.5, + "sourceBytesWritten": 470909.5, + "reportBytes": 1441, + "totalWrittenBytes": 472350.5, + "totalPersistedBytes": 472350.5 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.536, + "scanMs": 1.68, + "completeRefreshMs": 22.005, + "transcriptBytesRead": 0, + "sourceBytesRead": 470909.5, + "totalReadBytes": 470909.5, + "sourceWritePackSealDurableMs": 10.355, + "reportSerializeSealMs": 0.008, + "reportDurableWriteMs": 10.009, + "totalPersistMs": 19.829, + "sourceBytes": 470909.5, + "sourceBytesWritten": 470909.5, + "reportBytes": 1441, + "totalWrittenBytes": 472350.5, + "totalPersistedBytes": 472350.5 + }, + "append": { + "sourceReadVerifyDecodeMs": 0.605, + "scanMs": 36.458, + "completeRefreshMs": 60.335, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470909.5, + "totalReadBytes": 7985783.5, + "sourceWritePackSealDurableMs": 12.263, + "reportSerializeSealMs": 0.014, + "reportDurableWriteMs": 10.193, + "totalPersistMs": 22.422, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351 + } + }, + "current": { + "cold": { + "scanMs": 57.556, + "completeRefreshMs": 81.978, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.631, + "reportSerializeSealMs": 0.029, + "reportDurableWriteMs": 10.3, + "totalPersistMs": 24.033, + "sourceBytes": 81832, + "sourceBytesWritten": 81832, + "reportBytes": 1525, + "totalWrittenBytes": 83357, + "totalPersistedBytes": 83357 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.417, + "scanMs": 1.632, + "completeRefreshMs": 13.164, + "transcriptBytesRead": 0, + "sourceBytesRead": 81832, + "totalReadBytes": 81832, + "sourceWritePackSealDurableMs": 0.004, + "reportSerializeSealMs": 0.017, + "reportDurableWriteMs": 9.849, + "totalPersistMs": 9.871, + "sourceBytes": 81832, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83357 + }, + "append": { + "sourceReadVerifyDecodeMs": 2.072, + "scanMs": 5.564, + "completeRefreshMs": 29.881, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81832, + "totalReadBytes": 106862, + "sourceWritePackSealDurableMs": 12.325, + "reportSerializeSealMs": 0.031, + "reportDurableWriteMs": 10.193, + "totalPersistMs": 22.422, + "sourceBytes": 82398.5, + "sourceBytesWritten": 82398.5, + "reportBytes": 1525, + "totalWrittenBytes": 83923.5, + "totalPersistedBytes": 83923.5 + } + } + }, + "samples": [ + { + "arm": "uncompressed", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 61.199916999999914, + "completeRefreshMs": 85.39250100000004, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.796499999999924, + "reportSerializeSealMs": 0.023124999999936335, + "reportDurableWriteMs": 10.372959000000264, + "totalPersistMs": 24.192584000000124, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.7257919999999558, + "scanMs": 2.032707999999957, + "completeRefreshMs": 13.358999999999924, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.0030420000000503933, + "reportSerializeSealMs": 0.007791999999881227, + "reportDurableWriteMs": 9.58966600000008, + "totalPersistMs": 9.600500000000011, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.7151670000002923, + "scanMs": 5.802582999999686, + "completeRefreshMs": 28.767291999999998, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 11.624957999999879, + "reportSerializeSealMs": 0.010332999999718595, + "reportDurableWriteMs": 9.614251000000422, + "totalPersistMs": 21.24954200000002, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 40.148583000000144, + "completeRefreshMs": 62.490291000000525, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 12.299625000000106, + "reportSerializeSealMs": 0.00837500000034197, + "reportDurableWriteMs": 10.033707999999933, + "totalPersistMs": 22.34170800000038, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5122500000002219, + "scanMs": 1.7152499999997417, + "completeRefreshMs": 22.030917000000045, + "transcriptBytesRead": 0, + "sourceBytesRead": 470909, + "totalReadBytes": 470909, + "sourceWritePackSealDurableMs": 9.643624999999702, + "reportSerializeSealMs": 0.0062499999999090505, + "reportDurableWriteMs": 10.15354200000047, + "totalPersistMs": 19.80341700000008, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.5650829999999587, + "scanMs": 37.13541699999996, + "completeRefreshMs": 61.280666999999994, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470909, + "totalReadBytes": 7985783, + "sourceWritePackSealDurableMs": 12.043709000000035, + "reportSerializeSealMs": 0.013875000000098225, + "reportDurableWriteMs": 11.52258299999994, + "totalPersistMs": 23.580167000000074, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 57.63691699999981, + "completeRefreshMs": 81.5994169999999, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 14.021583000000192, + "reportSerializeSealMs": 0.03070800000023155, + "reportDurableWriteMs": 9.910208999999668, + "totalPersistMs": 23.96250000000009, + "sourceBytes": 81827, + "sourceBytesWritten": 81827, + "reportBytes": 1525, + "totalWrittenBytes": 83352, + "totalPersistedBytes": 83352 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.1159160000001975, + "scanMs": 1.6827499999999418, + "completeRefreshMs": 12.030083000000104, + "transcriptBytesRead": 0, + "sourceBytesRead": 81827, + "totalReadBytes": 81827, + "sourceWritePackSealDurableMs": 0.0031669999998484855, + "reportSerializeSealMs": 0.0182079999999587, + "reportDurableWriteMs": 8.210042000000158, + "totalPersistMs": 8.231416999999965, + "sourceBytes": 81827, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83352, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.8291659999999865, + "scanMs": 5.35208399999965, + "completeRefreshMs": 33.55262499999981, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81827, + "totalReadBytes": 106857, + "sourceWritePackSealDurableMs": 14.272082999999839, + "reportSerializeSealMs": 0.03212500000017826, + "reportDurableWriteMs": 11.067167000000154, + "totalPersistMs": 25.37137500000017, + "sourceBytes": 82411, + "sourceBytesWritten": 82411, + "reportBytes": 1525, + "totalWrittenBytes": 83936, + "totalPersistedBytes": 83936, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 58.932500000000346, + "completeRefreshMs": 83.11654200000066, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 12.918083999999908, + "reportSerializeSealMs": 0.03570900000022448, + "reportDurableWriteMs": 11.230249000000185, + "totalPersistMs": 24.184042000000318, + "sourceBytes": 81834, + "sourceBytesWritten": 81834, + "reportBytes": 1525, + "totalWrittenBytes": 83359, + "totalPersistedBytes": 83359 + }, + "warm": { + "sourceReadVerifyDecodeMs": 2.5720000000001164, + "scanMs": 1.6065410000001066, + "completeRefreshMs": 13.495499000000109, + "transcriptBytesRead": 0, + "sourceBytesRead": 81834, + "totalReadBytes": 81834, + "sourceWritePackSealDurableMs": 0.0038749999998799467, + "reportSerializeSealMs": 0.024125000000367436, + "reportDurableWriteMs": 9.288957999999639, + "totalPersistMs": 9.316957999999886, + "sourceBytes": 81834, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83359, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.0697919999997794, + "scanMs": 5.142083000000184, + "completeRefreshMs": 29.678541999999652, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81834, + "totalReadBytes": 106864, + "sourceWritePackSealDurableMs": 12.880166999999801, + "reportSerializeSealMs": 0.033249999999952706, + "reportDurableWriteMs": 9.553249999999935, + "totalPersistMs": 22.46666699999969, + "sourceBytes": 82398, + "sourceBytesWritten": 82398, + "reportBytes": 1525, + "totalWrittenBytes": 83923, + "totalPersistedBytes": 83923, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 35.84779200000003, + "completeRefreshMs": 58.683208999999806, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 12.690541999999823, + "reportSerializeSealMs": 0.010499999999865395, + "reportDurableWriteMs": 10.134375000000091, + "totalPersistMs": 22.83541699999978, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5275000000001455, + "scanMs": 1.7709170000002814, + "completeRefreshMs": 21.979291999999987, + "transcriptBytesRead": 0, + "sourceBytesRead": 470910, + "totalReadBytes": 470910, + "sourceWritePackSealDurableMs": 10.59020799999962, + "reportSerializeSealMs": 0.008874999999989086, + "reportDurableWriteMs": 9.08179199999995, + "totalPersistMs": 19.68087499999956, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.5951250000002801, + "scanMs": 36.17574999999988, + "completeRefreshMs": 59.28620799999999, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470910, + "totalReadBytes": 7985784, + "sourceWritePackSealDurableMs": 12.48195799999985, + "reportSerializeSealMs": 0.010042000000339613, + "reportDurableWriteMs": 10.023332999999639, + "totalPersistMs": 22.515332999999828, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 56.75704199999973, + "completeRefreshMs": 81.48699999999963, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 11.383417000000009, + "reportSerializeSealMs": 0.010666000000128406, + "reportDurableWriteMs": 13.33587499999976, + "totalPersistMs": 24.729957999999897, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 10.898541000000023, + "scanMs": 17.60312500000009, + "completeRefreshMs": 37.39762400000018, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.009583000000020547, + "reportSerializeSealMs": 0.01116600000023027, + "reportDurableWriteMs": 8.875208999999813, + "totalPersistMs": 8.895958000000064, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 3.5323749999997744, + "scanMs": 6.341042000000016, + "completeRefreshMs": 29.508750999999393, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 11.053249999999935, + "reportSerializeSealMs": 0.014541999999892141, + "reportDurableWriteMs": 8.567541999999776, + "totalPersistMs": 19.635333999999602, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 36.85916700000007, + "completeRefreshMs": 61.626000000000204, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 14.701000000000022, + "reportSerializeSealMs": 0.014584000000013475, + "reportDurableWriteMs": 10.051249000000098, + "totalPersistMs": 24.766833000000133, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.6520829999999478, + "scanMs": 1.6451250000000073, + "completeRefreshMs": 21.951874999999745, + "transcriptBytesRead": 0, + "sourceBytesRead": 470909, + "totalReadBytes": 470909, + "sourceWritePackSealDurableMs": 10.595792000000074, + "reportSerializeSealMs": 0.012333000000126049, + "reportDurableWriteMs": 9.04654199999959, + "totalPersistMs": 19.65466699999979, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.0405000000000655, + "scanMs": 35.626042000000325, + "completeRefreshMs": 60.93537500000048, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470909, + "totalReadBytes": 7985783, + "sourceWritePackSealDurableMs": 13.162374999999884, + "reportSerializeSealMs": 0.014833000000180618, + "reportDurableWriteMs": 10.091625000000022, + "totalPersistMs": 23.268833000000086, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 57.6005839999998, + "completeRefreshMs": 79.23658399999977, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 11.28145799999993, + "reportSerializeSealMs": 0.010041000000001077, + "reportDurableWriteMs": 10.344501000000037, + "totalPersistMs": 21.635999999999967, + "sourceBytes": 471852, + "sourceBytesWritten": 471852, + "reportBytes": 1441, + "totalWrittenBytes": 473293, + "totalPersistedBytes": 473293 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9592090000001008, + "scanMs": 1.6092079999998532, + "completeRefreshMs": 12.497292000000016, + "transcriptBytesRead": 0, + "sourceBytesRead": 471852, + "totalReadBytes": 471852, + "sourceWritePackSealDurableMs": 0.00687500000003638, + "reportSerializeSealMs": 0.00845900000012989, + "reportDurableWriteMs": 9.913540999999896, + "totalPersistMs": 9.928875000000062, + "sourceBytes": 471852, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473293, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.7198750000002292, + "scanMs": 5.155917000000045, + "completeRefreshMs": 28.01895900000045, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471852, + "totalReadBytes": 496882, + "sourceWritePackSealDurableMs": 11.522750000000087, + "reportSerializeSealMs": 0.012165999999979249, + "reportDurableWriteMs": 9.60825100000011, + "totalPersistMs": 21.143167000000176, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 62.79833299999973, + "completeRefreshMs": 86.31566599999996, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.53304100000014, + "reportSerializeSealMs": 0.04349999999976717, + "reportDurableWriteMs": 9.940792000000329, + "totalPersistMs": 23.517333000000235, + "sourceBytes": 81835, + "sourceBytesWritten": 81835, + "reportBytes": 1525, + "totalWrittenBytes": 83360, + "totalPersistedBytes": 83360 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.4374170000000959, + "scanMs": 1.632333000000017, + "completeRefreshMs": 12.793875000000298, + "transcriptBytesRead": 0, + "sourceBytesRead": 81835, + "totalReadBytes": 81835, + "sourceWritePackSealDurableMs": 0.00466599999981554, + "reportSerializeSealMs": 0.015459000000191736, + "reportDurableWriteMs": 9.704000000000178, + "totalPersistMs": 9.724125000000186, + "sourceBytes": 81835, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83360, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.4622909999998228, + "scanMs": 6.243667000000187, + "completeRefreshMs": 30.084207999999762, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81835, + "totalReadBytes": 106865, + "sourceWritePackSealDurableMs": 12.43158399999993, + "reportSerializeSealMs": 0.03000000000020009, + "reportDurableWriteMs": 9.916665999999623, + "totalPersistMs": 22.378249999999753, + "sourceBytes": 82399, + "sourceBytesWritten": 82399, + "reportBytes": 1525, + "totalWrittenBytes": 83924, + "totalPersistedBytes": 83924, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 56.27591600000005, + "completeRefreshMs": 79.7303750000001, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.72845899999993, + "reportSerializeSealMs": 0.02712500000006912, + "reportDurableWriteMs": 9.698875000000044, + "totalPersistMs": 23.454459000000043, + "sourceBytes": 81821, + "sourceBytesWritten": 81821, + "reportBytes": 1525, + "totalWrittenBytes": 83346, + "totalPersistedBytes": 83346 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.328874999999698, + "scanMs": 1.893500000000131, + "completeRefreshMs": 13.241125000000011, + "transcriptBytesRead": 0, + "sourceBytesRead": 81821, + "totalReadBytes": 81821, + "sourceWritePackSealDurableMs": 0.004417000000103144, + "reportSerializeSealMs": 0.019957999999860476, + "reportDurableWriteMs": 9.994375000000218, + "totalPersistMs": 10.018750000000182, + "sourceBytes": 81821, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83346, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.4642909999997755, + "scanMs": 5.9794590000001335, + "completeRefreshMs": 29.499291000000085, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81821, + "totalReadBytes": 106851, + "sourceWritePackSealDurableMs": 11.636582999999973, + "reportSerializeSealMs": 0.029290999999830092, + "reportDurableWriteMs": 10.389667000000372, + "totalPersistMs": 22.055541000000176, + "sourceBytes": 82397, + "sourceBytesWritten": 82397, + "reportBytes": 1525, + "totalWrittenBytes": 83922, + "totalPersistedBytes": 83922, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 57.17083400000001, + "completeRefreshMs": 81.04841800000031, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.003959000000123, + "reportSerializeSealMs": 0.013667000000168628, + "reportDurableWriteMs": 10.859958000000006, + "totalPersistMs": 23.877584000000297, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9277499999998327, + "scanMs": 1.573334000000159, + "completeRefreshMs": 12.010084000000006, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.00454200000012861, + "reportSerializeSealMs": 0.006624999999985448, + "reportDurableWriteMs": 9.4978329999999, + "totalPersistMs": 9.509000000000015, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.74474999999984, + "scanMs": 5.21704200000022, + "completeRefreshMs": 27.684250000000247, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 10.604125000000295, + "reportSerializeSealMs": 0.011750000000120053, + "reportDurableWriteMs": 10.106582999999773, + "totalPersistMs": 20.722458000000188, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 39.53983299999982, + "completeRefreshMs": 61.672540999999455, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 11.795708000000104, + "reportSerializeSealMs": 0.011916999999812106, + "reportDurableWriteMs": 10.325082999999722, + "totalPersistMs": 22.13270799999964, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.5443749999994907, + "scanMs": 1.5526660000004995, + "completeRefreshMs": 21.951665999999932, + "transcriptBytesRead": 0, + "sourceBytesRead": 470909, + "totalReadBytes": 470909, + "sourceWritePackSealDurableMs": 9.489833999999973, + "reportSerializeSealMs": 0.008082999999714957, + "reportDurableWriteMs": 10.356708000000253, + "totalPersistMs": 19.854624999999942, + "sourceBytes": 470909, + "sourceBytesWritten": 470909, + "reportBytes": 1441, + "totalWrittenBytes": 472350, + "totalPersistedBytes": 472350, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.6146669999998267, + "scanMs": 38.27420799999982, + "completeRefreshMs": 61.139540999999554, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470909, + "totalReadBytes": 7985783, + "sourceWritePackSealDurableMs": 11.88550000000032, + "reportSerializeSealMs": 0.017208000000209722, + "reportDurableWriteMs": 10.34795799999938, + "totalPersistMs": 22.25066599999991, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 58.578333000000384, + "completeRefreshMs": 83.57583300000078, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 14.071708999999828, + "reportSerializeSealMs": 0.0147080000006099, + "reportDurableWriteMs": 10.911082999999962, + "totalPersistMs": 24.9975000000004, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.9217919999991864, + "scanMs": 1.5406250000005457, + "completeRefreshMs": 11.98870799999986, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.0031660000004194444, + "reportSerializeSealMs": 0.006582999999409367, + "reportDurableWriteMs": 9.5165420000003, + "totalPersistMs": 9.526291000000128, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 1.643750000000182, + "scanMs": 5.248125000000073, + "completeRefreshMs": 30.316875000000437, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 11.3329590000003, + "reportSerializeSealMs": 0.009500000000116415, + "reportDurableWriteMs": 12.082540999999765, + "totalPersistMs": 23.425000000000182, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 55.12304200000017, + "completeRefreshMs": 79.22691700000087, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.209625000000415, + "reportSerializeSealMs": 0.023624999999810825, + "reportDurableWriteMs": 10.870625000000473, + "totalPersistMs": 24.1038750000007, + "sourceBytes": 81834, + "sourceBytesWritten": 81834, + "reportBytes": 1525, + "totalWrittenBytes": 83359, + "totalPersistedBytes": 83359 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.3965420000004087, + "scanMs": 1.5771669999994629, + "completeRefreshMs": 13.087375999999495, + "transcriptBytesRead": 0, + "sourceBytesRead": 81834, + "totalReadBytes": 81834, + "sourceWritePackSealDurableMs": 0.0029999999997016857, + "reportSerializeSealMs": 0.011249999999563443, + "reportDurableWriteMs": 10.099417000000358, + "totalPersistMs": 10.113666999999623, + "sourceBytes": 81834, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83359, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.074416999999812, + "scanMs": 4.953458000000865, + "completeRefreshMs": 28.68475000000126, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81834, + "totalReadBytes": 106864, + "sourceWritePackSealDurableMs": 11.556540999999925, + "reportSerializeSealMs": 0.016959000000497326, + "reportDurableWriteMs": 10.08337500000016, + "totalPersistMs": 21.656875000000582, + "sourceBytes": 82397, + "sourceBytesWritten": 82397, + "reportBytes": 1525, + "totalWrittenBytes": 83922, + "totalPersistedBytes": 83922, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 36.85908300000028, + "completeRefreshMs": 60.48700000000099, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 13.257500000000618, + "reportSerializeSealMs": 0.015124999999898137, + "reportDurableWriteMs": 10.35529200000019, + "totalPersistMs": 23.627917000000707, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.524000000000342, + "scanMs": 3.9704579999997804, + "completeRefreshMs": 25.023208000000523, + "transcriptBytesRead": 0, + "sourceBytesRead": 470910, + "totalReadBytes": 470910, + "sourceWritePackSealDurableMs": 10.120249999999942, + "reportSerializeSealMs": 0.007874999999330612, + "reportDurableWriteMs": 10.400625000001128, + "totalPersistMs": 20.5287500000004, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.5856250000006185, + "scanMs": 36.74104100000022, + "completeRefreshMs": 59.15587400000095, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470910, + "totalReadBytes": 7985784, + "sourceWritePackSealDurableMs": 11.521249999999782, + "reportSerializeSealMs": 0.013915999999881024, + "reportDurableWriteMs": 10.294042000000445, + "totalPersistMs": 21.829208000000108, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 36.86316600000009, + "completeRefreshMs": 62.01224900000034, + "transcriptBytesRead": 7514420, + "sourceBytesRead": 0, + "totalReadBytes": 7514420, + "sourceWritePackSealDurableMs": 13.42595799999981, + "reportSerializeSealMs": 0.021458000000166066, + "reportDurableWriteMs": 11.70166700000027, + "totalPersistMs": 25.149083000000246, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.608791999999994, + "scanMs": 1.6340420000005906, + "completeRefreshMs": 22.931917000000794, + "transcriptBytesRead": 0, + "sourceBytesRead": 470910, + "totalReadBytes": 470910, + "sourceWritePackSealDurableMs": 10.81445800000074, + "reportSerializeSealMs": 0.01058299999931478, + "reportDurableWriteMs": 9.864042000000154, + "totalPersistMs": 20.68908300000021, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.0316670000001977, + "scanMs": 35.37566700000025, + "completeRefreshMs": 59.7352920000003, + "transcriptBytesRead": 7514874, + "sourceBytesRead": 470910, + "totalReadBytes": 7985784, + "sourceWritePackSealDurableMs": 12.530958000000282, + "reportSerializeSealMs": 0.013708999999835214, + "reportDurableWriteMs": 9.783290999999736, + "totalPersistMs": 22.327957999999853, + "sourceBytes": 470910, + "sourceBytesWritten": 470910, + "reportBytes": 1441, + "totalWrittenBytes": 472351, + "totalPersistedBytes": 472351, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 57.47533399999975, + "completeRefreshMs": 82.35612499999934, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 14.202249999999367, + "reportSerializeSealMs": 0.01954200000000128, + "reportDurableWriteMs": 10.658999000000222, + "totalPersistMs": 24.88079099999959, + "sourceBytes": 81830, + "sourceBytesWritten": 81830, + "reportBytes": 1525, + "totalWrittenBytes": 83355, + "totalPersistedBytes": 83355 + }, + "warm": { + "sourceReadVerifyDecodeMs": 1.353541000000405, + "scanMs": 1.6310419999999795, + "completeRefreshMs": 13.276625000000422, + "transcriptBytesRead": 0, + "sourceBytesRead": 81830, + "totalReadBytes": 81830, + "sourceWritePackSealDurableMs": 0.0021670000005542533, + "reportSerializeSealMs": 0.012874999999439751, + "reportDurableWriteMs": 10.277000000000044, + "totalPersistMs": 10.292042000000038, + "sourceBytes": 81830, + "sourceBytesWritten": 0, + "reportBytes": 1525, + "totalWrittenBytes": 1525, + "totalPersistedBytes": 83355, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 2.193833999999697, + "scanMs": 5.775708000000122, + "completeRefreshMs": 30.522334000000228, + "transcriptBytesRead": 25030, + "sourceBytesRead": 81830, + "totalReadBytes": 106860, + "sourceWritePackSealDurableMs": 12.217542000000321, + "reportSerializeSealMs": 0.031833000000005995, + "reportDurableWriteMs": 10.303417000000081, + "totalPersistMs": 22.55279200000041, + "sourceBytes": 82399, + "sourceBytesWritten": 82399, + "reportBytes": 1525, + "totalWrittenBytes": 83924, + "totalPersistedBytes": 83924, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 61.0341669999998, + "completeRefreshMs": 84.81062499999916, + "transcriptBytesRead": 7530804, + "sourceBytesRead": 0, + "totalReadBytes": 7530804, + "sourceWritePackSealDurableMs": 13.840416999999434, + "reportSerializeSealMs": 0.01766700000007404, + "reportDurableWriteMs": 9.918373999999858, + "totalPersistMs": 23.776457999999366, + "sourceBytes": 471854, + "sourceBytesWritten": 471854, + "reportBytes": 1441, + "totalWrittenBytes": 473295, + "totalPersistedBytes": 473295 + }, + "warm": { + "sourceReadVerifyDecodeMs": 0.907416999999441, + "scanMs": 1.6146670000007362, + "completeRefreshMs": 12.990375999999742, + "transcriptBytesRead": 0, + "sourceBytesRead": 471854, + "totalReadBytes": 471854, + "sourceWritePackSealDurableMs": 0.0027919999993173406, + "reportSerializeSealMs": 0.007375000000138243, + "reportDurableWriteMs": 10.45812500000011, + "totalPersistMs": 10.468291999999565, + "sourceBytes": 471854, + "sourceBytesWritten": 0, + "reportBytes": 1441, + "totalWrittenBytes": 1441, + "totalPersistedBytes": 473295, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 0.9312079999999696, + "scanMs": 5.197457999999642, + "completeRefreshMs": 26.987457999999606, + "transcriptBytesRead": 25030, + "sourceBytesRead": 471854, + "totalReadBytes": 496884, + "sourceWritePackSealDurableMs": 10.886874999999236, + "reportSerializeSealMs": 0.009791999999833934, + "reportDurableWriteMs": 9.962125000000924, + "totalPersistMs": 20.858791999999994, + "sourceBytes": 537390, + "sourceBytesWritten": 537390, + "reportBytes": 1441, + "totalWrittenBytes": 538831, + "totalPersistedBytes": 538831, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-bF6Z9e/.claude/projects/benchmark/active-session.jsonl" + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-source-compression-four-arm-bytes.json b/docs/bug-reproductions/usage-scan-append/claude-source-compression-four-arm-bytes.json new file mode 100644 index 00000000000..705210033e1 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-source-compression-four-arm-bytes.json @@ -0,0 +1,528 @@ +{ + "purpose": "Four-arm actual production persistence bytes and dominant cache fields; no timing claim.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "exactColdParity": true, + "crossArmProjectionParity": true, + "methodology": "Original/published use their actual store indentation and full-state layout. Fixed main/current use their production source writers and report serializers. Source component lengths exclude enclosing property names and are diagnostic, not additive file sizes.", + "toolingSha256": "9ce36bf6c213f05a00f97e54e088027afa3f4404651604907c325b3f149d3a6a", + "arms": { + "original": { + "commit": "51e7181850b022bae2d41091fe1229accef4bd50", + "storeSha256": "c2457e55948c1982fd1a1cd045d847c1e6cecb6eb5e9eadfc3647da8c6a226c2", + "scanner": { + "bundleSha256": "ff7da33319be01f944cee557d1a0b326b2445f0c898b6b5f466cab61953dc8da", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "51e7181850b022bae2d41091fe1229accef4bd50", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": null + }, + "published": { + "commit": "8467877ed92aba2ef59737aebf461e9cab52c273", + "storeSha256": "cd0305c4ed01af5bc8c11c8247feb9bf92d6e9df00551a87574cdff8e7389d0b", + "scanner": { + "bundleSha256": "8bb88b61faf2cf1131631c37dd89d16dcdedfeb5d3c2f925dd5ebb550b573e20", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + } + } + }, + "persistence": { + "bundleSha256": "4534b3ff429df50140595ee536507c33f0a8b45434f09d7446f4592a37dbe2fb", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b03bc2db9f1f93e9d26ba31b8a469f85f27237498a520ea5cc128df397d1ff94" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "7df97e1a448696348cf89506085ea4959a7e876dae1a03b8ef02e32346feb295" + }, + "src/main/durable-file-write.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "baffe60b5c403b0d65afc7608c1903f726dee12d61a597c1d9525c82b4ed7bc4" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "49759bda2ba0efb81ac785eb13d4c51685dac505f5aa245144d441353793b5b0" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1ecfcf5f829617792a2b16615001aee4c888cc80c3e8156191378c4a57d637b6" + }, + "src/shared/node-file-content-equality.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "8467877ed92aba2ef59737aebf461e9cab52c273", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "storeSha256": "7247d4f8288249a95085a2150048c76b797d64d7e21bf432802b5881c2a0f2ab", + "scanner": { + "bundleSha256": "ff7da33319be01f944cee557d1a0b326b2445f0c898b6b5f466cab61953dc8da", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + }, + "current": { + "commit": null, + "storeSha256": "5beb17f973fbd12b70408e7c8526fda9486ca3fdba2acc89dccb3b0f6d3e8b39", + "scanner": { + "bundleSha256": "46154f2200b925b31db4103fc5a6abf52e70f66a014d867667819e60e0855bce", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "cc18078db9f4fa4632e9653ee3e963fc7d559d05f063a5e1b87c34e43ccca948", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "9b4de097982b7b2d705647456e319ab9cab8b11c786e244fb19349fe63931ab5" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/source-cache-compression.ts": { + "source": "worktree", + "sha256": "b6a0d3ad3bb447905d056dd98ded0a58c6e4750048c5a530c5ca09a7ce63328f" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "33b18046e3a2b68fcfc5c3654ff0ad1f70888113ea21420d5db24f32109b82a9" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "4f2cee1b76a034153fd9c24ef7e2701e0831bf19d1d4c1f817772e8597cdf17e" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + } + } + } + }, + "scenarios": [ + { + "usageKeys": 16384, + "maximaPattern": "repeated", + "historyBytes": 7465268, + "suffixBytes": 451, + "fixtureSha256": "f3b342d71da6a2dfdd696c1bb9cf2841e4f8c548420e46632bd1e0d915eaa051", + "measurements": { + "original": { + "sourceBytes": 0, + "reportBytes": 620849, + "totalPersistedBytes": 620849, + "productionIndent": 2, + "sourceComponents": { + "fileBytes": 470833, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "published": { + "sourceBytes": 0, + "reportBytes": 768008, + "totalPersistedBytes": 768008, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 766562, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": 294915, + "columnValueCounts": null, + "projectionCount": 1 + } + }, + "main": { + "sourceBytes": 470891, + "reportBytes": 1426, + "totalPersistedBytes": 472317, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 470832, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "current": { + "sourceBytes": 82411, + "reportBytes": 1510, + "totalPersistedBytes": 83921, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 537221, + "ownedKeyListBytes": 469301, + "tokenColumnsBytes": 65553, + "tokenRowsBytes": null, + "columnValueCounts": [16384, 1, 1, 1, 1, 1], + "projectionCount": 1 + } + } + } + }, + { + "usageKeys": 100000, + "maximaPattern": "unique", + "historyBytes": 47222805, + "suffixBytes": 453, + "fixtureSha256": "af7af784522047431204709330653590043792311bdd5c40e56c1a592ec0bad8", + "measurements": { + "original": { + "sourceBytes": 0, + "reportBytes": 3883175, + "totalPersistedBytes": 3883175, + "productionIndent": 2, + "sourceComponents": { + "fileBytes": 2979821, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "published": { + "sourceBytes": 0, + "reportBytes": 6327804, + "totalPersistedBytes": 6327804, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 6325852, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": 3345029, + "columnValueCounts": null, + "projectionCount": 2 + } + }, + "main": { + "sourceBytes": 2979880, + "reportBytes": 1932, + "totalPersistedBytes": 2981812, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 2979821, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": null, + "tokenRowsBytes": null, + "columnValueCounts": null, + "projectionCount": null + } + }, + "current": { + "sourceBytes": 1596451, + "reportBytes": 2016, + "totalPersistedBytes": 1598467, + "productionIndent": null, + "sourceComponents": { + "fileBytes": 6125887, + "ownedKeyListBytes": 2977781, + "tokenColumnsBytes": 3145041, + "tokenRowsBytes": null, + "columnValueCounts": [100000, 100000, 100000, 100000, 100000, 100000], + "projectionCount": 2 + } + } + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-source-compression-receipt.json b/docs/bug-reproductions/usage-scan-append/claude-source-compression-receipt.json new file mode 100644 index 00000000000..bad7c432711 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-source-compression-receipt.json @@ -0,0 +1,53 @@ +{ + "sourceBaseline": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "mainBaseline": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "artifacts": { + "16k": { + "artifact": "claude-source-compression-16k.json", + "sha256": "c89ca2493f6939408d48404cbdbf0991b5607bd10c407fb1f252c11f32811fdd", + "currentSourceHashesVerified": true, + "sixCounterbalancedRounds": true, + "unchangedSourceWrites": 0 + }, + "100k": { + "artifact": "claude-source-compression-100k.json", + "sha256": "4de42062dafe452af3b373b7769daac0342015d3c6136c42004644a5bb955345", + "currentSourceHashesVerified": true, + "sixCounterbalancedRounds": true, + "unchangedSourceWrites": 0 + }, + "varied-100k": { + "artifact": "claude-source-compression-varied-100k.json", + "sha256": "ff196aafeb019143774536ff580c81f9130729b10eecf388ef8d7b2c9e1607b9", + "currentSourceHashesVerified": true, + "sixCounterbalancedRounds": true, + "unchangedSourceWrites": 0 + } + }, + "method": "Complete production cache read/decompress/verify/decode, scan, gzip, serialization and fsync/rename writes. Cross-arm output parity. Excludes app rendering, real worker/IPC queueing and network. Disk figures include source and report. Varied fixture has deterministic pseudo-random IDs and token totals.", + "tools": { + "config/scripts/claude-usage-source-compression-benchmark.mjs": "e745a37bbd4161cab061062bb30adc0158d1856d198981d04c5b1f503f1bd5eb", + "config/scripts/claude-usage-benchmark-persistence.mjs": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "config/scripts/claude-usage-benchmark-scanner.mjs": "cbaf8140fd02f617419548db76bc46eb8235568d61b8ee06cdef6ed104b048a0" + }, + "fourArmBytes": { + "artifact": "claude-source-compression-four-arm-bytes.json", + "sha256": "d486a559c2fc1700a7ddcab9bae8867a8a5e74f76c569a5b32de95b6008e494c", + "crossArmProjectionParity": true, + "currentSourceHashesVerified": true + }, + "localValidation": { + "typecheck": "full passed", + "quality": "all seven changed gates passed", + "tests": 413, + "mobileTests": 19, + "contracts": 163, + "antiSlop": "passed", + "binaryWrite": "exact bytes, bounded view and temp cleanup passed", + "bindingGuard": { + "focusedTests": 32, + "nodeTypecheck": "passed", + "destinationMutationDuringCompression": "original destination retained; replacement destination absent" + } + } +} diff --git a/docs/bug-reproductions/usage-scan-append/claude-source-compression-varied-100k.json b/docs/bug-reproductions/usage-scan-append/claude-source-compression-varied-100k.json new file mode 100644 index 00000000000..49cefe72960 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/claude-source-compression-varied-100k.json @@ -0,0 +1,1621 @@ +{ + "purpose": "Lossless Claude source compression: actual pinned scanner, cache and durable report persistence costs.", + "node": "v24.20.0", + "platform": "darwin", + "arch": "arm64", + "cpuModel": "Apple M4 Max", + "usageKeys": 100000, + "maximaPattern": "varied", + "rounds": 6, + "historyBytes": 51870301, + "suffixBytes": 520, + "fixtureSha256": "831274929041046938669ce69d8448e868e4469125d13feb64318a4d80c03c2e", + "methodology": { + "timing": "Six arm permutations balance position/order; one unrecorded warmup. Fixtures are scanner-cache cold and OS-page-cache warm. Durable writes use production fsync/rename writers.", + "refresh": "Actual production functions composed in the worker request order: source read/verify/decode, scanner, source pack/seal/durable write, main report serialize/seal/durable write.", + "uncompressed": "Uncompressed uses uncompressed B4102; current compresses its source sidecar with asynchronous gzip level 1. Both retain identical usage history.", + "exclusions": "Worker startup, message serialization/structured clone, IPC queueing, telemetry, worktree discovery and UI rendering are excluded. Report and source read bytes are logical filesystem payload bytes, not physical device I/O.", + "attribution": "Main is fixed b44a5796; uncompressed is previously published B4102; current adds lossless source compression.", + "correctness": "Exact cold/append cross-arm sessions and daily equality and owned-key count; every append is checked against a fresh scan.", + "writtenBytes": "Source writes are logical replacement payload bytes: production durable writers replace the inode when writing. Consecutive bigint file identities prove whether the fixture sidecar was replaced; unavailable inode IDs produce null rather than a zero-write claim. Report payload bytes are captured in the actual writer callback. Accounting stat calls occur outside measured production intervals." + }, + "toolingSha256": "e745a37bbd4161cab061062bb30adc0158d1856d198981d04c5b1f503f1bd5eb", + "supportToolingSha256": "9376c62d6ac1d7ae0697dd4584b47821c8dbe09bdeab51c6bae6f9953693f8ce", + "arms": { + "uncompressed": { + "commit": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "scanner": { + "bundleSha256": "8f265609ecb00eee093a01bbd9fc2daeec0efaec27666b4cd7197df7a2312be3", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "a5d58e164cdd9abca97628de1ea6333660f1fc0b4bf4b9244621e5b7cad81610", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "505c5274cb3d92c49b93f6eeb63164b239b6caf7baa550ef20174e60db6a4fa2" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ee53cd3c823ce5bd49892bf96486f48d285c0b4e536a295adfe5e94f147712f5" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "4102ea91dce12a3ce11104dc89729132e8674f0b", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + }, + "main": { + "commit": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "scanner": { + "bundleSha256": "51862aea36f7f201a483b6ba9dae1cd6cb26ef72766fc1ac8421e7e86ba65b05", + "sourceFingerprints": { + "src/main/claude-usage/scanner.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + } + } + }, + "persistence": { + "bundleSha256": "55d1990fb662bfd005bfbfac8a2732702aa28b8511161b6259a72cd0e9f5a265", + "sourceFingerprints": { + "src/main/codex-accounts/fs-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "009b4775505ab6a10a1e53329fdbd5444c47f4f137c52d7de6384ae31725aaec" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "d1a7041ef4e1366f7dc1c9225e663b49ebe5ef3ca60717d572bc4b9a85579232" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "657f5317536c7504416431c378bcc7a956ed5de7b7649a35f8d90674688f5da9" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/node-file-content-equality.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "b44a5796c1154de84efa25cc09f3dae2b61eb4b5", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91" + } + } + }, + "current": { + "commit": null, + "scanner": { + "bundleSha256": "8f265609ecb00eee093a01bbd9fc2daeec0efaec27666b4cd7197df7a2312be3", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/scanner.ts": { + "source": "worktree", + "sha256": "8174e231f388f5fbc73cdcc2f1216d0cdb5d7213eaa97edd59c304bf76dd219e" + }, + "src/main/claude-usage/transcript-file-discovery.ts": { + "source": "worktree", + "sha256": "54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-record-parser.ts": { + "source": "worktree", + "sha256": "bfd4608941761444fdbc53a3d86f9e401d8d088a77f5d906cc36910786ac937b" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/transcript-token-checkpoint.ts": { + "source": "worktree", + "sha256": "6e3ebb95532118730eb7c91d486e6885d429c6cc0c47f4b1078fc71afd910b86" + }, + "src/main/claude-usage/transcript-usage-projection.ts": { + "source": "worktree", + "sha256": "5711193900bcab341c110529c91c973f38dd625d045cbaaab91ac6b0903e118c" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/claude-usage/worktree-attribution.ts": { + "source": "worktree", + "sha256": "7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213" + }, + "src/main/usage/jsonl-file-checkpoint.ts": { + "source": "worktree", + "sha256": "b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4" + }, + "src/main/usage/jsonl-file-snapshot.ts": { + "source": "worktree", + "sha256": "b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe" + }, + "src/main/usage/jsonl-line-offsets.ts": { + "source": "worktree", + "sha256": "f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db" + }, + "src/shared/definitive-filesystem-absence.ts": { + "source": "worktree", + "sha256": "32344097f40a7106fa41936b23bd485e12a1c6c4aca33b8feae0f3fc73f6010a" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + } + } + }, + "persistence": { + "bundleSha256": "cc18078db9f4fa4632e9653ee3e963fc7d559d05f063a5e1b87c34e43ccca948", + "sourceFingerprints": { + "src/main/claude-usage/persisted-projection-validation.ts": { + "source": "worktree", + "sha256": "f3d4da4410ff51519660d234380b1a4fb7f31d2cc17ae9c703fccf874b329160" + }, + "src/main/claude-usage/persisted-source-cache.ts": { + "source": "worktree", + "sha256": "9b4de097982b7b2d705647456e319ab9cab8b11c786e244fb19349fe63931ab5" + }, + "src/main/claude-usage/persisted-token-columns.ts": { + "source": "worktree", + "sha256": "87c7892cd887bbfaf0ebcf2d85f460773a2070594de896eef94955c40b823855" + }, + "src/main/claude-usage/persisted-usage-report.ts": { + "source": "worktree", + "sha256": "13737060c3fde1287f194ad833e149f596842534e35eb91e8826b289f9686a04" + }, + "src/main/claude-usage/source-cache-compression.ts": { + "source": "worktree", + "sha256": "b6a0d3ad3bb447905d056dd98ded0a58c6e4750048c5a530c5ca09a7ce63328f" + }, + "src/main/claude-usage/transcript-projection-integrity.ts": { + "source": "worktree", + "sha256": "a9447fd3916484b03e60993f56bf6052c122a3774a3d91b2541aaeb51bd06aef" + }, + "src/main/claude-usage/transcript-resume-projection.ts": { + "source": "worktree", + "sha256": "d9d5fd504489a32371bcbffe0f77b5d00a8f4dd7a8aa2dea7eaeb8b63d1866db" + }, + "src/main/claude-usage/usage-aggregation.ts": { + "source": "worktree", + "sha256": "be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509" + }, + "src/main/codex-accounts/fs-utils.ts": { + "source": "worktree", + "sha256": "48093fbbd8879721ff25ff15002ab60b07517896be04fdf201bc9fdc4dadd2e7" + }, + "src/main/durable-file-write.ts": { + "source": "worktree", + "sha256": "33b18046e3a2b68fcfc5c3654ff0ad1f70888113ea21420d5db24f32109b82a9" + }, + "src/main/usage-cache-snapshot-writer.ts": { + "source": "worktree", + "sha256": "e0877d6acf2b1c32e78b0f9ab008460b990a48453e5155f8e65aa08458dfa5ed" + }, + "src/main/usage/usage-cache-json-integrity.ts": { + "source": "worktree", + "sha256": "7fbe3f92f3e59d7f6e55a4edf50899f142a313d8662587c85fdc9489976231d7" + }, + "src/main/usage/usage-inline-cache-preservation.ts": { + "source": "worktree", + "sha256": "4167fe146fb6c87e2cbed190618fcb9e79166ec60fcc495106428b9fd0eecacf" + }, + "src/main/usage/usage-provider-store-lifecycle.ts": { + "source": "worktree", + "sha256": "7dfa6cfdd487149c39c07a491ce4d327ebc366fa4809c695f7eca056e7584901" + }, + "src/main/usage/usage-source-cache-file.ts": { + "source": "worktree", + "sha256": "4f2cee1b76a034153fd9c24ef7e2701e0831bf19d1d4c1f817772e8597cdf17e" + }, + "src/main/usage/usage-worktree-refs.ts": { + "source": "worktree", + "sha256": "79a618c1385949a50afbf62439038217954f45ef0016edbfd76cf7c33fc58640" + }, + "src/main/win32-utils.ts": { + "source": "worktree", + "sha256": "0c41cd182a1a182cc4c2bb663ec9b32e50acb99bd39d4835bfad26882ca87e53" + }, + "src/shared/event-loop-yield.ts": { + "source": "worktree", + "sha256": "d291b71f09eb88f24a849d0ae310f946deb7f93b0b6b490b6ea5a605ab7a53cf" + }, + "src/shared/node-file-content-equality.ts": { + "source": "worktree", + "sha256": "1e8b91fa8afdcd9f05bfe7cddfcd148e3400429bfae2fcf8d563524b2d0b01e2" + }, + "src/shared/windows-batch-spawn.ts": { + "source": "worktree", + "sha256": "ec71689e7efc8229f980ed853120d281fc47c1431831548b5bf7baa8cb13933d" + }, + "src/shared/windows-retry-file-operations.ts": { + "source": "worktree", + "sha256": "6e0394041802f045cd54f3029b078a72c2b4af5e20664624c07ac280113eb197" + } + }, + "inactiveLifecycleStubFingerprints": { + "agent-token-usage-reporter": "7a66e3ed973ef671d6dfb37e6083d653d819a812bbf3b03af563d06bf81c2f19", + "analytics-session-id-store": "6b5b2a865385bd3c1a227f3aaea9a4a69bc3d0d6213654d78003342866a6c549", + "telemetry/client": "6425ee31de92063075c068d45dfce88ac7c007f8ed2d677987888be247eabe91", + "usage-worktree-metadata": "f08f35eb7b9d20bb4ad7b9b95dab615a6dbe7a5d1267e437e9c09de4784d4de2" + } + } + } + }, + "summary": { + "uncompressed": { + "cold": { + "scanMs": 372.21, + "completeRefreshMs": 423.704, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 39.823, + "reportSerializeSealMs": 0.025, + "reportDurableWriteMs": 13.249, + "totalPersistMs": 52.72, + "sourceBytes": 10459571, + "sourceBytesWritten": 10459571, + "reportBytes": 1973, + "totalWrittenBytes": 10461544, + "totalPersistedBytes": 10461544 + }, + "warm": { + "sourceReadVerifyDecodeMs": 15.084, + "scanMs": 13.866, + "completeRefreshMs": 40.111, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459571, + "totalReadBytes": 10459571, + "sourceWritePackSealDurableMs": 0.019, + "reportSerializeSealMs": 0.011, + "reportDurableWriteMs": 10.075, + "totalPersistMs": 10.109, + "sourceBytes": 10459571, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461544 + }, + "append": { + "sourceReadVerifyDecodeMs": 15.506, + "scanMs": 42.004, + "completeRefreshMs": 102.979, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459571, + "totalReadBytes": 10484667, + "sourceWritePackSealDurableMs": 35.126, + "reportSerializeSealMs": 0.022, + "reportDurableWriteMs": 9.757, + "totalPersistMs": 45.004, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546 + } + }, + "main": { + "cold": { + "scanMs": 244.638, + "completeRefreshMs": 280.536, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 23.624, + "reportSerializeSealMs": 0.023, + "reportDurableWriteMs": 12.049, + "totalPersistMs": 35.923, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.298, + "scanMs": 14.111, + "completeRefreshMs": 47.305, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 17.349, + "reportSerializeSealMs": 0.015, + "reportDurableWriteMs": 9.857, + "totalPersistMs": 27.195, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "append": { + "sourceReadVerifyDecodeMs": 6.83, + "scanMs": 236.443, + "completeRefreshMs": 276.141, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 19.48, + "reportSerializeSealMs": 0.023, + "reportDurableWriteMs": 10.273, + "totalPersistMs": 29.453, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + } + }, + "current": { + "cold": { + "scanMs": 380.613, + "completeRefreshMs": 533.305, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 142.019, + "reportSerializeSealMs": 0.061, + "reportDurableWriteMs": 11.911, + "totalPersistMs": 153.826, + "sourceBytes": 5388813, + "sourceBytesWritten": 5388813, + "reportBytes": 2057, + "totalWrittenBytes": 5390870, + "totalPersistedBytes": 5390870 + }, + "warm": { + "sourceReadVerifyDecodeMs": 35.464, + "scanMs": 14.357, + "completeRefreshMs": 60.13, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388813, + "totalReadBytes": 5388813, + "sourceWritePackSealDurableMs": 0.016, + "reportSerializeSealMs": 0.029, + "reportDurableWriteMs": 10.018, + "totalPersistMs": 10.062, + "sourceBytes": 5388813, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390870 + }, + "append": { + "sourceReadVerifyDecodeMs": 35.763, + "scanMs": 41.318, + "completeRefreshMs": 223.568, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388813, + "totalReadBytes": 5413909, + "sourceWritePackSealDurableMs": 137.286, + "reportSerializeSealMs": 0.039, + "reportDurableWriteMs": 10.085, + "totalPersistMs": 147.457, + "sourceBytes": 5388809.5, + "sourceBytesWritten": 5388809.5, + "reportBytes": 2057, + "totalWrittenBytes": 5390866.5, + "totalPersistedBytes": 5390866.5 + } + } + }, + "samples": [ + { + "arm": "uncompressed", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 376.5578340000002, + "completeRefreshMs": 432.416792, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 42.25237500000003, + "reportSerializeSealMs": 0.03029100000003382, + "reportDurableWriteMs": 13.57629199999974, + "totalPersistMs": 55.8589579999998, + "sourceBytes": 10459569, + "sourceBytesWritten": 10459569, + "reportBytes": 1973, + "totalWrittenBytes": 10461542, + "totalPersistedBytes": 10461542 + }, + "warm": { + "sourceReadVerifyDecodeMs": 16.87708399999974, + "scanMs": 15.423791000000165, + "completeRefreshMs": 43.23775000000023, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459569, + "totalReadBytes": 10459569, + "sourceWritePackSealDurableMs": 0.004125000000385626, + "reportSerializeSealMs": 0.012165999999524502, + "reportDurableWriteMs": 10.920584000000417, + "totalPersistMs": 10.936875000000327, + "sourceBytes": 10459569, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461542, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 16.98279099999945, + "scanMs": 42.17616700000053, + "completeRefreshMs": 104.08987499999967, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459569, + "totalReadBytes": 10484665, + "sourceWritePackSealDurableMs": 33.96324999999979, + "reportSerializeSealMs": 0.02654199999960838, + "reportDurableWriteMs": 10.941125000000284, + "totalPersistMs": 44.93091699999968, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 259.49962499999947, + "completeRefreshMs": 296.1975419999999, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 25.066125000000284, + "reportSerializeSealMs": 0.02375000000029104, + "reportDurableWriteMs": 11.608041999999841, + "totalPersistMs": 36.697917000000416, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.083666999999878, + "scanMs": 15.41729099999975, + "completeRefreshMs": 47.96233299999949, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 17.791000000000167, + "reportSerializeSealMs": 0.015291999999135442, + "reportDurableWriteMs": 9.655083000000559, + "totalPersistMs": 27.46137499999986, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 6.742041999999856, + "scanMs": 234.36383300000034, + "completeRefreshMs": 269.8872500000007, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 18.541583000000173, + "reportSerializeSealMs": 0.02437499999996362, + "reportDurableWriteMs": 10.215417000000343, + "totalPersistMs": 28.78137500000048, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 1, + "order": ["uncompressed", "main", "current"], + "cold": { + "scanMs": 389.5902499999993, + "completeRefreshMs": 550.7442499999988, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 149.03449999999975, + "reportSerializeSealMs": 0.06612499999937427, + "reportDurableWriteMs": 12.053375000000415, + "totalPersistMs": 161.15399999999954, + "sourceBytes": 5388813, + "sourceBytesWritten": 5388813, + "reportBytes": 2057, + "totalWrittenBytes": 5390870, + "totalPersistedBytes": 5390870 + }, + "warm": { + "sourceReadVerifyDecodeMs": 35.103125000000546, + "scanMs": 15.748207999999977, + "completeRefreshMs": 60.914041, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388813, + "totalReadBytes": 5388813, + "sourceWritePackSealDurableMs": 0.025791000000026543, + "reportSerializeSealMs": 0.02733299999999872, + "reportDurableWriteMs": 10.00958399999945, + "totalPersistMs": 10.062707999999475, + "sourceBytes": 5388813, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390870, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 34.541291000000456, + "scanMs": 38.83033399999931, + "completeRefreshMs": 221.26749999999993, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388813, + "totalReadBytes": 5413909, + "sourceWritePackSealDurableMs": 137.6309170000004, + "reportSerializeSealMs": 0.037374999999883585, + "reportDurableWriteMs": 10.227582999999868, + "totalPersistMs": 147.89587500000016, + "sourceBytes": 5388808, + "sourceBytesWritten": 5388808, + "reportBytes": 2057, + "totalWrittenBytes": 5390865, + "totalPersistedBytes": 5390865, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 363.8489589999999, + "completeRefreshMs": 515.3290010000001, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 139.87204199999996, + "reportSerializeSealMs": 0.04250000000047294, + "reportDurableWriteMs": 11.565499999999702, + "totalPersistMs": 151.48004200000014, + "sourceBytes": 5388817, + "sourceBytesWritten": 5388817, + "reportBytes": 2057, + "totalWrittenBytes": 5390874, + "totalPersistedBytes": 5390874 + }, + "warm": { + "sourceReadVerifyDecodeMs": 35.823999999999614, + "scanMs": 13.461416999999528, + "completeRefreshMs": 59.34612499999912, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388817, + "totalReadBytes": 5388817, + "sourceWritePackSealDurableMs": 0.005041999999775726, + "reportSerializeSealMs": 0.028750000000400178, + "reportDurableWriteMs": 10.026915999999801, + "totalPersistMs": 10.060707999999977, + "sourceBytes": 5388817, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390874, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 35.204665999999634, + "scanMs": 39.44129200000134, + "completeRefreshMs": 221.6637499999997, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388817, + "totalReadBytes": 5413913, + "sourceWritePackSealDurableMs": 136.94116699999904, + "reportSerializeSealMs": 0.044708000001264736, + "reportDurableWriteMs": 10.03191699999843, + "totalPersistMs": 147.01779199999874, + "sourceBytes": 5388811, + "sourceBytesWritten": 5388811, + "reportBytes": 2057, + "totalWrittenBytes": 5390868, + "totalPersistedBytes": 5390868, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 230.69654199999968, + "completeRefreshMs": 265.84520899999916, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 23.353499999999258, + "reportSerializeSealMs": 0.02233400000113761, + "reportDurableWriteMs": 11.772832999999082, + "totalPersistMs": 35.14866699999948, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 4.942833999999493, + "scanMs": 14.814958000000843, + "completeRefreshMs": 46.6859170000007, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 17.44787499999984, + "reportSerializeSealMs": 0.014000000001033186, + "reportDurableWriteMs": 9.46624999999949, + "totalPersistMs": 26.928125000000364, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 5.756124999999884, + "scanMs": 236.32287499999984, + "completeRefreshMs": 275.50866700000006, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 22.52483299999949, + "reportSerializeSealMs": 0.022417000000132248, + "reportDurableWriteMs": 10.882417000000714, + "totalPersistMs": 33.429667000000336, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 2, + "order": ["current", "main", "uncompressed"], + "cold": { + "scanMs": 374.85204200000044, + "completeRefreshMs": 427.76595799999996, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 39.96729100000084, + "reportSerializeSealMs": 0.025041000000783242, + "reportDurableWriteMs": 12.921583999997893, + "totalPersistMs": 52.91391599999952, + "sourceBytes": 10459571, + "sourceBytesWritten": 10459571, + "reportBytes": 1973, + "totalWrittenBytes": 10461544, + "totalPersistedBytes": 10461544 + }, + "warm": { + "sourceReadVerifyDecodeMs": 16.644916000001103, + "scanMs": 13.344417000000249, + "completeRefreshMs": 39.93666600000142, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459571, + "totalReadBytes": 10459571, + "sourceWritePackSealDurableMs": 0.030542000000423286, + "reportSerializeSealMs": 0.010500000000320142, + "reportDurableWriteMs": 9.906290999999328, + "totalPersistMs": 9.947333000000071, + "sourceBytes": 10459571, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461544, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 14.124583000000712, + "scanMs": 46.02045899999939, + "completeRefreshMs": 102.382916999999, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459571, + "totalReadBytes": 10484667, + "sourceWritePackSealDurableMs": 32.68883300000016, + "reportSerializeSealMs": 0.02708399999937683, + "reportDurableWriteMs": 9.521957999999358, + "totalPersistMs": 42.237874999998894, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 241.696582999999, + "completeRefreshMs": 279.5791249999984, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 23.893833000000086, + "reportSerializeSealMs": 0.02312499999970896, + "reportDurableWriteMs": 13.96558399999958, + "totalPersistMs": 37.882541999999376, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.316417000000001, + "scanMs": 12.53808299999946, + "completeRefreshMs": 42.88012499999968, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 15.202665999999226, + "reportSerializeSealMs": 0.015917000000627013, + "reportDurableWriteMs": 9.807042000000365, + "totalPersistMs": 25.02562500000022, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 6.917458000001716, + "scanMs": 236.5625, + "completeRefreshMs": 271.65529100000094, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 18.156165999998848, + "reportSerializeSealMs": 0.03908400000000256, + "reportDurableWriteMs": 9.980083000000377, + "totalPersistMs": 28.175332999999227, + "sourceBytes": 6802142, + "sourceBytesWritten": 6802142, + "reportBytes": 1973, + "totalWrittenBytes": 6804115, + "totalPersistedBytes": 6804115, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 369.5675420000007, + "completeRefreshMs": 422.0932500000017, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 40.206208000001425, + "reportSerializeSealMs": 0.024541999999200925, + "reportDurableWriteMs": 12.294958000000406, + "totalPersistMs": 52.52570800000103, + "sourceBytes": 10459571, + "sourceBytesWritten": 10459571, + "reportBytes": 1973, + "totalWrittenBytes": 10461544, + "totalPersistedBytes": 10461544 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.23699999999917, + "scanMs": 14.387749999999869, + "completeRefreshMs": 40.62754099999984, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459571, + "totalReadBytes": 10459571, + "sourceWritePackSealDurableMs": 0.009541000001263455, + "reportSerializeSealMs": 0.011167000000568805, + "reportDurableWriteMs": 11.982082999998966, + "totalPersistMs": 12.002791000000798, + "sourceBytes": 10459571, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461544, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 14.100791999999274, + "scanMs": 41.831208000001425, + "completeRefreshMs": 103.57437500000015, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459571, + "totalReadBytes": 10484667, + "sourceWritePackSealDurableMs": 37.7271669999991, + "reportSerializeSealMs": 0.020417000001543784, + "reportDurableWriteMs": 9.894790999998804, + "totalPersistMs": 47.64237499999945, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 3, + "order": ["main", "uncompressed", "current"], + "cold": { + "scanMs": 373.25366700000086, + "completeRefreshMs": 524.1966670000002, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 138.61704199999986, + "reportSerializeSealMs": 0.06574999999975262, + "reportDurableWriteMs": 12.260207999999693, + "totalPersistMs": 150.9429999999993, + "sourceBytes": 5388815, + "sourceBytesWritten": 5388815, + "reportBytes": 2057, + "totalWrittenBytes": 5390872, + "totalPersistedBytes": 5390872 + }, + "warm": { + "sourceReadVerifyDecodeMs": 35.00199999999859, + "scanMs": 16.792250000000422, + "completeRefreshMs": 61.49095800000032, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388815, + "totalReadBytes": 5388815, + "sourceWritePackSealDurableMs": 0.036665999999968335, + "reportSerializeSealMs": 0.03012499999931606, + "reportDurableWriteMs": 9.629917000002024, + "totalPersistMs": 9.696708000001308, + "sourceBytes": 5388815, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390872, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 35.26212499999929, + "scanMs": 43.362457999999606, + "completeRefreshMs": 223.29112399999758, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388815, + "totalReadBytes": 5413911, + "sourceWritePackSealDurableMs": 135.16929100000016, + "reportSerializeSealMs": 0.038708000000042375, + "reportDurableWriteMs": 9.458541999998488, + "totalPersistMs": 144.6665409999987, + "sourceBytes": 5388807, + "sourceBytesWritten": 5388807, + "reportBytes": 2057, + "totalWrittenBytes": 5390864, + "totalPersistedBytes": 5390864, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 359.56533300000046, + "completeRefreshMs": 512.7767910000002, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 141.3715830000001, + "reportSerializeSealMs": 0.07191699999930279, + "reportDurableWriteMs": 11.767958000000363, + "totalPersistMs": 153.21145799999977, + "sourceBytes": 5388813, + "sourceBytesWritten": 5388813, + "reportBytes": 2057, + "totalWrittenBytes": 5390870, + "totalPersistedBytes": 5390870 + }, + "warm": { + "sourceReadVerifyDecodeMs": 34.60304200000064, + "scanMs": 13.290207999998529, + "completeRefreshMs": 58.12983299999905, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388813, + "totalReadBytes": 5388813, + "sourceWritePackSealDurableMs": 0.005083000000013271, + "reportSerializeSealMs": 0.0233749999988504, + "reportDurableWriteMs": 10.208125000001019, + "totalPersistMs": 10.236582999999882, + "sourceBytes": 5388813, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390870, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 38.9783750000006, + "scanMs": 44.070332999999664, + "completeRefreshMs": 247.55612499999916, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388813, + "totalReadBytes": 5413909, + "sourceWritePackSealDurableMs": 154.33016700000007, + "reportSerializeSealMs": 0.03966699999909906, + "reportDurableWriteMs": 10.137582999999722, + "totalPersistMs": 164.5074169999989, + "sourceBytes": 5388812, + "sourceBytesWritten": 5388812, + "reportBytes": 2057, + "totalWrittenBytes": 5390869, + "totalPersistedBytes": 5390869, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 376.74833299999955, + "completeRefreshMs": 425.31433300000026, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 36.637917000000016, + "reportSerializeSealMs": 0.020750000001498847, + "reportDurableWriteMs": 11.907332999999198, + "totalPersistMs": 48.56600000000071, + "sourceBytes": 10459571, + "sourceBytesWritten": 10459571, + "reportBytes": 1973, + "totalWrittenBytes": 10461544, + "totalPersistedBytes": 10461544 + }, + "warm": { + "sourceReadVerifyDecodeMs": 15.065334000000803, + "scanMs": 13.093165999998746, + "completeRefreshMs": 38.02979199999936, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459571, + "totalReadBytes": 10459571, + "sourceWritePackSealDurableMs": 0.028542000000015832, + "reportSerializeSealMs": 0.010000000000218279, + "reportDurableWriteMs": 9.832749999999578, + "totalPersistMs": 9.871291999999812, + "sourceBytes": 10459571, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461544, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 16.074875000000247, + "scanMs": 40.42912499999875, + "completeRefreshMs": 101.47595799999908, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459571, + "totalReadBytes": 10484667, + "sourceWritePackSealDurableMs": 35.33037499999955, + "reportSerializeSealMs": 0.022666999999273685, + "reportDurableWriteMs": 9.618916000001263, + "totalPersistMs": 44.971958000000086, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 4, + "order": ["current", "uncompressed", "main"], + "cold": { + "scanMs": 247.57854100000077, + "completeRefreshMs": 281.4923740000013, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 21.933000000000902, + "reportSerializeSealMs": 0.023083000000042375, + "reportDurableWriteMs": 11.957749999999578, + "totalPersistMs": 33.91383300000052, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.5396249999994325, + "scanMs": 16.78154100000029, + "completeRefreshMs": 48.80029099999956, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 16.557208000000173, + "reportSerializeSealMs": 0.014832999999271124, + "reportDurableWriteMs": 9.907084000000395, + "totalPersistMs": 26.47912499999984, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 7.537208000001556, + "scanMs": 249.40279199999895, + "completeRefreshMs": 285.8598750000001, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 19.325041000000056, + "reportSerializeSealMs": 0.021708999996917555, + "reportDurableWriteMs": 9.57312500000262, + "totalPersistMs": 28.919874999999593, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 364.5171670000018, + "completeRefreshMs": 417.8187500000022, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 39.677874999997584, + "reportSerializeSealMs": 0.021709000000555534, + "reportDurableWriteMs": 13.601999000002252, + "totalPersistMs": 53.30158300000039, + "sourceBytes": 10459569, + "sourceBytesWritten": 10459569, + "reportBytes": 1973, + "totalWrittenBytes": 10461542, + "totalPersistedBytes": 10461542 + }, + "warm": { + "sourceReadVerifyDecodeMs": 15.101833000000624, + "scanMs": 15.135958000002574, + "completeRefreshMs": 40.28454100000454, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459569, + "totalReadBytes": 10459569, + "sourceWritePackSealDurableMs": 0.008708000001206528, + "reportSerializeSealMs": 0.011832999996840954, + "reportDurableWriteMs": 10.026209000003291, + "totalPersistMs": 10.046750000001339, + "sourceBytes": 10459569, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461542, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 18.729458000001614, + "scanMs": 43.53712499999892, + "completeRefreshMs": 107.30187499999738, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459569, + "totalReadBytes": 10484665, + "sourceWritePackSealDurableMs": 34.92095899999913, + "reportSerializeSealMs": 0.02141699999992852, + "reportDurableWriteMs": 10.092915999997786, + "totalPersistMs": 45.03529199999684, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 391.5948750000025, + "completeRefreshMs": 547.8882080000003, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 142.66579199999978, + "reportSerializeSealMs": 0.05591700000150013, + "reportDurableWriteMs": 13.571623999996518, + "totalPersistMs": 156.2933329999978, + "sourceBytes": 5388812, + "sourceBytesWritten": 5388812, + "reportBytes": 2057, + "totalWrittenBytes": 5390869, + "totalPersistedBytes": 5390869 + }, + "warm": { + "sourceReadVerifyDecodeMs": 35.90129199999865, + "scanMs": 12.616666000001715, + "completeRefreshMs": 58.25212400000237, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388812, + "totalReadBytes": 5388812, + "sourceWritePackSealDurableMs": 0.026333000001613982, + "reportSerializeSealMs": 0.0316659999989497, + "reportDurableWriteMs": 9.676167000001442, + "totalPersistMs": 9.734166000002006, + "sourceBytes": 5388812, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390869, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 38.602624999999534, + "scanMs": 43.194375000002765, + "completeRefreshMs": 227.65050000000338, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388812, + "totalReadBytes": 5413908, + "sourceWritePackSealDurableMs": 135.6684580000001, + "reportSerializeSealMs": 0.03408399999898393, + "reportDurableWriteMs": 10.150958000001992, + "totalPersistMs": 145.85350000000108, + "sourceBytes": 5388805, + "sourceBytesWritten": 5388805, + "reportBytes": 2057, + "totalWrittenBytes": 5390862, + "totalPersistedBytes": 5390862, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 5, + "order": ["uncompressed", "current", "main"], + "cold": { + "scanMs": 238.90508300000147, + "completeRefreshMs": 276.14729200000147, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 25.080250000002707, + "reportSerializeSealMs": 0.021457999999256572, + "reportDurableWriteMs": 12.14050099999804, + "totalPersistMs": 37.242209, + "sourceBytes": 6802143, + "sourceBytesWritten": 6802143, + "reportBytes": 1973, + "totalWrittenBytes": 6804116, + "totalPersistedBytes": 6804116 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.4412909999991825, + "scanMs": 13.072209000001749, + "completeRefreshMs": 47.851582999999664, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802143, + "totalReadBytes": 6802143, + "sourceWritePackSealDurableMs": 17.250458000002254, + "reportSerializeSealMs": 0.012124999997467967, + "reportDurableWriteMs": 12.07549999999901, + "totalPersistMs": 29.338082999998733, + "sourceBytes": 6802143, + "sourceBytesWritten": 6802143, + "reportBytes": 1973, + "totalWrittenBytes": 6804116, + "totalPersistedBytes": 6804116, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 5.931208000001789, + "scanMs": 236.29599999999846, + "completeRefreshMs": 276.7725419999988, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802143, + "totalReadBytes": 58672964, + "sourceWritePackSealDurableMs": 22.59070900000006, + "reportSerializeSealMs": 0.030917000000044936, + "reportDurableWriteMs": 11.923707999998442, + "totalPersistMs": 34.54533399999855, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "main", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 268.74062499999854, + "completeRefreshMs": 303.2237909999967, + "transcriptBytesRead": 51870301, + "sourceBytesRead": 0, + "totalReadBytes": 51870301, + "sourceWritePackSealDurableMs": 22.02824999999939, + "reportSerializeSealMs": 0.03049999999711872, + "reportDurableWriteMs": 12.424416000001656, + "totalPersistMs": 34.483165999998164, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117 + }, + "warm": { + "sourceReadVerifyDecodeMs": 5.280542000000423, + "scanMs": 13.407500000001164, + "completeRefreshMs": 46.75825000000259, + "transcriptBytesRead": 0, + "sourceBytesRead": 6802144, + "totalReadBytes": 6802144, + "sourceWritePackSealDurableMs": 17.779624999999214, + "reportSerializeSealMs": 0.025541999999404652, + "reportDurableWriteMs": 10.265041000002384, + "totalPersistMs": 28.070208000001003, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 7.110375000000204, + "scanMs": 243.3582499999975, + "completeRefreshMs": 280.45566699999836, + "transcriptBytesRead": 51870821, + "sourceBytesRead": 6802144, + "totalReadBytes": 58672965, + "sourceWritePackSealDurableMs": 19.634417000001122, + "reportSerializeSealMs": 0.021166999998968095, + "reportDurableWriteMs": 10.331458000000566, + "totalPersistMs": 29.987042000000656, + "sourceBytes": 6802144, + "sourceBytesWritten": 6802144, + "reportBytes": 1973, + "totalWrittenBytes": 6804117, + "totalPersistedBytes": 6804117, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "current", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 387.9724590000005, + "completeRefreshMs": 542.4134590000031, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 142.84016600000177, + "reportSerializeSealMs": 0.042041999997309176, + "reportDurableWriteMs": 11.55879200000345, + "totalPersistMs": 154.44100000000253, + "sourceBytes": 5388807, + "sourceBytesWritten": 5388807, + "reportBytes": 2057, + "totalWrittenBytes": 5390864, + "totalPersistedBytes": 5390864 + }, + "warm": { + "sourceReadVerifyDecodeMs": 39.21674999999959, + "scanMs": 15.25249999999869, + "completeRefreshMs": 67.36179199999606, + "transcriptBytesRead": 0, + "sourceBytesRead": 5388807, + "totalReadBytes": 5388807, + "sourceWritePackSealDurableMs": 0.006582999998499872, + "reportSerializeSealMs": 0.03049999999711872, + "reportDurableWriteMs": 12.855459000002156, + "totalPersistMs": 12.892541999997775, + "sourceBytes": 5388807, + "sourceBytesWritten": 0, + "reportBytes": 2057, + "totalWrittenBytes": 2057, + "totalPersistedBytes": 5390864, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 36.264500000001135, + "scanMs": 38.01379100000122, + "completeRefreshMs": 223.84549900000275, + "transcriptBytesRead": 25096, + "sourceBytesRead": 5388807, + "totalReadBytes": 5413903, + "sourceWritePackSealDurableMs": 139.70054199999868, + "reportSerializeSealMs": 0.04087499999877764, + "reportDurableWriteMs": 9.825791000002937, + "totalPersistMs": 149.5672080000004, + "sourceBytes": 5388812, + "sourceBytesWritten": 5388812, + "reportBytes": 2057, + "totalWrittenBytes": 5390869, + "totalPersistedBytes": 5390869, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + }, + { + "arm": "uncompressed", + "round": 6, + "order": ["main", "current", "uncompressed"], + "cold": { + "scanMs": 367.9683339999974, + "completeRefreshMs": 419.2350009999973, + "transcriptBytesRead": 51886685, + "sourceBytesRead": 0, + "totalReadBytes": 51886685, + "sourceWritePackSealDurableMs": 37.6429590000007, + "reportSerializeSealMs": 0.02604100000098697, + "reportDurableWriteMs": 13.597666999998182, + "totalPersistMs": 51.26666699999987, + "sourceBytes": 10459571, + "sourceBytesWritten": 10459571, + "reportBytes": 1973, + "totalWrittenBytes": 10461544, + "totalPersistedBytes": 10461544 + }, + "warm": { + "sourceReadVerifyDecodeMs": 14.515625, + "scanMs": 12.481707999999344, + "completeRefreshMs": 37.167999999997846, + "transcriptBytesRead": 0, + "sourceBytesRead": 10459571, + "totalReadBytes": 10459571, + "sourceWritePackSealDurableMs": 0.035500000001775334, + "reportSerializeSealMs": 0.011290999998891493, + "reportDurableWriteMs": 10.123875999997836, + "totalPersistMs": 10.170666999998502, + "sourceBytes": 10459571, + "sourceBytesWritten": 0, + "reportBytes": 1973, + "totalWrittenBytes": 1973, + "totalPersistedBytes": 10461544, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + }, + "append": { + "sourceReadVerifyDecodeMs": 14.936165999999503, + "scanMs": 38.56825000000026, + "completeRefreshMs": 101.57895799999824, + "transcriptBytesRead": 25096, + "sourceBytesRead": 10459571, + "totalReadBytes": 10484667, + "sourceWritePackSealDurableMs": 38.44891699999789, + "reportSerializeSealMs": 0.022124999999505235, + "reportDurableWriteMs": 9.603500000001077, + "totalPersistMs": 48.07454199999847, + "sourceBytes": 10459573, + "sourceBytesWritten": 10459573, + "reportBytes": 1973, + "totalWrittenBytes": 10461546, + "totalPersistedBytes": 10461546, + "transcriptPath": "/var/folders/td/0d_w3jrs3654mtmk1gd6kpq00000gn/T/orca-claude-source-compression-6i2ENu/.claude/projects/benchmark/active-session.jsonl" + } + } + ] +} diff --git a/docs/bug-reproductions/usage-scan-append/comparison.jsonl b/docs/bug-reproductions/usage-scan-append/comparison.jsonl new file mode 100644 index 00000000000..a883d26b222 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/comparison.jsonl @@ -0,0 +1,8 @@ +{"node":"v24.20.0","nodeFlags":[],"platform":"darwin","osRelease":"25.3.0","arch":"arm64","cpuModel":"Apple M4 Max","cpuCount":16,"timezone":"America/Los_Angeles","rounds":8,"verify":true,"mode":"compare","baselineRef":"51e7181850b022bae2d41091fe1229accef4bd50","baselineCommit":"51e7181850b022bae2d41091fe1229accef4bd50","tooling":{"esbuildVersion":"0.28.2","baselineModules":["src/main/claude-usage/scanner.ts","src/main/claude-usage/transcript-record-parser.ts","src/main/claude-usage/usage-aggregation.ts","src/main/claude-usage/worktree-attribution.ts","src/main/claude-usage/transcript-file-discovery.ts"],"sha256":{"config/scripts/claude-usage-append-benchmark.mjs":"b171806ba5f58ce1ae4d2ea701be973505e7bfa27774f99d5c2408402a97f891","config/scripts/claude-usage-benchmark-scanner.mjs":"ffb6e5defb921f2ab35726a716f5e731dec439ead53cc2f3a192c7bef4df45d3","config/scripts/counterbalanced-benchmark-schedule.mjs":"bc35b40e954fa7ddec0225ed375bd3b113c2e05b8554bc50734d14f89987294d","config/scripts/script-child-process.mjs":"a7441428bf7b5c9a897b6a3c057c50f46acca24c4f218a4b849de5aec53c4173"}},"bundleSha256":{"baseline":"3027cfef686547918e0200caa9158f0b0084745c3bcc511da194a163d1fa12cd","current":"bfd66622a7a85cc32ddf4c9151ab63f973359ec882d3fe23d11507711d9c0e5a"},"sourceFingerprints":{"baseline":{"src/main/claude-usage/scanner.ts":{"source":"HEAD","sha256":"933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a"},"src/main/claude-usage/transcript-file-discovery.ts":{"source":"HEAD","sha256":"6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2"},"src/main/claude-usage/transcript-record-parser.ts":{"source":"HEAD","sha256":"ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2"},"src/main/claude-usage/usage-aggregation.ts":{"source":"HEAD","sha256":"be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509"},"src/main/claude-usage/worktree-attribution.ts":{"source":"HEAD","sha256":"7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213"}},"current":{"src/main/claude-usage/scanner.ts":{"source":"worktree","sha256":"ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5"},"src/main/claude-usage/transcript-file-discovery.ts":{"source":"worktree","sha256":"6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2"},"src/main/claude-usage/transcript-record-parser.ts":{"source":"worktree","sha256":"d4fab89434c1b6c60480a561310542246be34ef86bc13da0340c1dfdbb269854"},"src/main/claude-usage/transcript-resume-projection.ts":{"source":"worktree","sha256":"4828655a59454ee38ae46495ace531b6f149f8674c7d27828d2bbace1c549fd6"},"src/main/claude-usage/transcript-token-checkpoint.ts":{"source":"worktree","sha256":"e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2"},"src/main/claude-usage/transcript-usage-projection.ts":{"source":"worktree","sha256":"41a1c8b86244efc60e92adb1368393ed52b0bf8773e26e38a0d018780486123b"},"src/main/claude-usage/usage-aggregation.ts":{"source":"worktree","sha256":"be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509"},"src/main/claude-usage/worktree-attribution.ts":{"source":"worktree","sha256":"7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213"},"src/main/usage/jsonl-file-checkpoint.ts":{"source":"worktree","sha256":"8eb579f356e1bb23b36319f00b3d4603fff80a963222dcb8a22331319cab3a03"},"src/main/usage/jsonl-file-snapshot.ts":{"source":"worktree","sha256":"1bd98ac194f73097cd6c204238fe1db01e1e0d60a604e93c1d7841725971fe0d"},"src/main/usage/jsonl-line-offsets.ts":{"source":"worktree","sha256":"f119465fad3771acd72b128853e84eed9165f0f74b75743ad662aa5bab991273"}}},"measurement":{"cold":"scanner-cache cold; fixtures freshly written and page-cache warm","durationMs":"production scan only; excludes fixture I/O and cache serialization","totalDurationMs":"production scan plus cache stringify; excludes JSON.parse hydration","bytesRead":"raw filesystem API bytes including checkpoint windows; excludes metadata calls","behaviorParity":"exact legacy per-file and aggregate projections; excludes mtime and additive cache metadata"}} +{"scenario":"small-transcript-corpus","files":1000,"historyBytes":459780,"appendBytes":460780,"arms":{"baseline":{"phases":{"cold":{"durationMs":73.233,"cacheSerializationMs":1.457,"totalDurationMs":74.664,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537515.5},"warm":{"durationMs":9.176,"cacheSerializationMs":1.243,"totalDurationMs":10.388,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537515.5},"changed":{"durationMs":71.938,"cacheSerializationMs":1.519,"totalDurationMs":73.351,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540506},"freshAfterChange":{"durationMs":74.428,"cacheSerializationMs":1.455,"totalDurationMs":75.876,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540506}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":97.765042,"cacheSerializationMs":1.435624999999959,"totalDurationMs":99.20066699999995,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537534},"warm":{"durationMs":10.137707999999975,"cacheSerializationMs":1.31491699999998,"totalDurationMs":11.452624999999955,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537534},"changed":{"durationMs":81.76437499999997,"cacheSerializationMs":1.5310000000000628,"totalDurationMs":83.29537500000004,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540520},"freshAfterChange":{"durationMs":82.872209,"cacheSerializationMs":1.5655000000000427,"totalDurationMs":84.43770900000004,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540520}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":73.94816699999978,"cacheSerializationMs":1.494957999999997,"totalDurationMs":75.44312499999978,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537511},"warm":{"durationMs":9.321290999999974,"cacheSerializationMs":1.2235829999999623,"totalDurationMs":10.544873999999936,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537511},"changed":{"durationMs":69.39329099999986,"cacheSerializationMs":1.5489999999999782,"totalDurationMs":70.94229099999984,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540472},"freshAfterChange":{"durationMs":80.45795899999985,"cacheSerializationMs":1.466333000000077,"totalDurationMs":81.92429199999992,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540472}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":76.10479099999998,"cacheSerializationMs":1.5345839999999953,"totalDurationMs":77.63937499999997,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537525},"warm":{"durationMs":15.053625000000011,"cacheSerializationMs":1.4578749999998308,"totalDurationMs":16.51149999999984,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537525},"changed":{"durationMs":80.07137499999999,"cacheSerializationMs":1.3778749999999036,"totalDurationMs":81.44924999999989,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540509},"freshAfterChange":{"durationMs":71.93987500000003,"cacheSerializationMs":1.5191659999998137,"totalDurationMs":73.45904099999984,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540509}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":72.51695800000016,"cacheSerializationMs":1.3688750000001164,"totalDurationMs":73.88583300000028,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537520},"warm":{"durationMs":8.923875000000407,"cacheSerializationMs":1.267917000000125,"totalDurationMs":10.191792000000532,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537520},"changed":{"durationMs":75.02933299999995,"cacheSerializationMs":1.3768330000002607,"totalDurationMs":76.40616600000021,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540503},"freshAfterChange":{"durationMs":76.13570899999968,"cacheSerializationMs":1.43679099999963,"totalDurationMs":77.57249999999931,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540503}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":70.39875000000029,"cacheSerializationMs":1.480167000000165,"totalDurationMs":71.87891700000046,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537504},"warm":{"durationMs":12.410875000000033,"cacheSerializationMs":1.2615829999999733,"totalDurationMs":13.672458000000006,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537504},"changed":{"durationMs":69.77804100000003,"cacheSerializationMs":1.544832999999926,"totalDurationMs":71.32287399999996,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540519},"freshAfterChange":{"durationMs":73.48279200000025,"cacheSerializationMs":1.4443339999997988,"totalDurationMs":74.92712600000004,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540519}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":77.80899999999929,"cacheSerializationMs":1.47858400000041,"totalDurationMs":79.2875839999997,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537525},"warm":{"durationMs":8.16479100000015,"cacheSerializationMs":1.198750000000473,"totalDurationMs":9.363541000000623,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537525},"changed":{"durationMs":71.33408299999974,"cacheSerializationMs":1.521165999999539,"totalDurationMs":72.85524899999928,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540515},"freshAfterChange":{"durationMs":74.52104099999997,"cacheSerializationMs":1.4824170000001686,"totalDurationMs":76.00345800000014,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540515}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":70.35345899999993,"cacheSerializationMs":1.3678749999999127,"totalDurationMs":71.72133399999984,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537508},"warm":{"durationMs":8.247542000000067,"cacheSerializationMs":1.1658330000000205,"totalDurationMs":9.413375000000087,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537508},"changed":{"durationMs":68.93858300000011,"cacheSerializationMs":1.5160420000001977,"totalDurationMs":70.4546250000003,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540502},"freshAfterChange":{"durationMs":74.3355419999998,"cacheSerializationMs":1.4139169999998558,"totalDurationMs":75.74945899999966,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540502}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":67.77916699999969,"cacheSerializationMs":1.3171250000004875,"totalDurationMs":69.09629200000018,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537505},"warm":{"durationMs":9.029916999999841,"cacheSerializationMs":1.200875000000451,"totalDurationMs":10.230792000000292,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537505},"changed":{"durationMs":72.54179199999999,"cacheSerializationMs":1.3054169999995793,"totalDurationMs":73.84720899999957,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540503},"freshAfterChange":{"durationMs":73.8304590000007,"cacheSerializationMs":1.2869590000000244,"totalDurationMs":75.11741800000073,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540503}}}]},"current":{"phases":{"cold":{"durationMs":94.872,"cacheSerializationMs":1.662,"totalDurationMs":96.51,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629250},"warm":{"durationMs":9.4,"cacheSerializationMs":1.392,"totalDurationMs":10.755,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629250},"changed":{"durationMs":94.933,"cacheSerializationMs":1.587,"totalDurationMs":96.567,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632251},"freshAfterChange":{"durationMs":94.847,"cacheSerializationMs":1.605,"totalDurationMs":96.382,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632251}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":110.72141699999997,"cacheSerializationMs":1.7088340000000244,"totalDurationMs":112.430251,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629247},"warm":{"durationMs":10.292500000000018,"cacheSerializationMs":1.3552499999999554,"totalDurationMs":11.647749999999974,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629247},"changed":{"durationMs":97.46466700000008,"cacheSerializationMs":1.5520420000000286,"totalDurationMs":99.0167090000001,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632233},"freshAfterChange":{"durationMs":97.80558300000007,"cacheSerializationMs":1.6160829999998896,"totalDurationMs":99.42166599999996,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632233}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":95.10574999999994,"cacheSerializationMs":1.480291999999963,"totalDurationMs":96.5860419999999,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629259},"warm":{"durationMs":15.71591599999988,"cacheSerializationMs":1.504666000000043,"totalDurationMs":17.220581999999922,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629259},"changed":{"durationMs":100.2795000000001,"cacheSerializationMs":1.6475419999999303,"totalDurationMs":101.92704200000003,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632213},"freshAfterChange":{"durationMs":96.08216700000003,"cacheSerializationMs":1.3830829999999423,"totalDurationMs":97.46524999999997,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632213}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":93.96104200000036,"cacheSerializationMs":1.8035409999997682,"totalDurationMs":95.76458300000013,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629249},"warm":{"durationMs":9.130416999999852,"cacheSerializationMs":1.4103329999998095,"totalDurationMs":10.540749999999662,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629249},"changed":{"durationMs":96.87529200000017,"cacheSerializationMs":1.50912500000004,"totalDurationMs":98.38441700000021,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632321},"freshAfterChange":{"durationMs":95.71612499999992,"cacheSerializationMs":1.5943339999998898,"totalDurationMs":97.31045899999981,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632321}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":94.63816700000007,"cacheSerializationMs":1.7961669999999685,"totalDurationMs":96.43433400000004,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629237},"warm":{"durationMs":10.213874999999916,"cacheSerializationMs":1.3880410000001575,"totalDurationMs":11.601916000000074,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629237},"changed":{"durationMs":126.81962500000009,"cacheSerializationMs":1.6474169999996775,"totalDurationMs":128.46704199999976,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632239},"freshAfterChange":{"durationMs":117.79487500000005,"cacheSerializationMs":1.7186249999999745,"totalDurationMs":119.51350000000002,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632239}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":96.11529199999995,"cacheSerializationMs":1.6609999999996035,"totalDurationMs":97.77629199999956,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629281},"warm":{"durationMs":8.971833999999944,"cacheSerializationMs":1.4098330000001624,"totalDurationMs":10.381667000000107,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629281},"changed":{"durationMs":92.99166600000035,"cacheSerializationMs":1.7584170000000086,"totalDurationMs":94.75008300000036,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632263},"freshAfterChange":{"durationMs":93.97812500000009,"cacheSerializationMs":1.4744999999998072,"totalDurationMs":95.4526249999999,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632263}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":101.91566700000021,"cacheSerializationMs":1.6636250000001382,"totalDurationMs":103.57929200000035,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629235},"warm":{"durationMs":8.717124999999669,"cacheSerializationMs":1.373833999999988,"totalDurationMs":10.090958999999657,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629235},"changed":{"durationMs":91.70491700000002,"cacheSerializationMs":1.483208999999988,"totalDurationMs":93.18812600000001,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632239},"freshAfterChange":{"durationMs":92.48216599999978,"cacheSerializationMs":1.4998329999998532,"totalDurationMs":93.98199899999963,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632239}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":89.7646249999998,"cacheSerializationMs":1.5718329999999696,"totalDurationMs":91.33645799999977,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629251},"warm":{"durationMs":9.669791999999688,"cacheSerializationMs":1.2993340000002718,"totalDurationMs":10.96912599999996,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629251},"changed":{"durationMs":87.5024999999996,"cacheSerializationMs":1.5233340000004318,"totalDurationMs":89.02583400000003,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632283},"freshAfterChange":{"durationMs":90.32808300000033,"cacheSerializationMs":1.6194580000001224,"totalDurationMs":91.94754100000046,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632283}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":87.4873749999997,"cacheSerializationMs":1.4275840000000244,"totalDurationMs":88.91495899999973,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629289},"warm":{"durationMs":8.70154199999979,"cacheSerializationMs":1.3963749999993524,"totalDurationMs":10.097916999999143,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629289},"changed":{"durationMs":92.81533299999955,"cacheSerializationMs":1.6210829999999987,"totalDurationMs":94.43641599999955,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632265},"freshAfterChange":{"durationMs":91.08379100000002,"cacheSerializationMs":1.706833000000188,"totalDurationMs":92.79062400000021,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632265}}}]}}} +{"scenario":"history-scaling","toolMiB":2,"usageKeys":256,"historyBytes":2284226,"appendBytes":4730,"arms":{"baseline":{"phases":{"cold":{"durationMs":6.047,"cacheSerializationMs":0.018,"totalDurationMs":6.063,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.161,"cacheSerializationMs":0.008,"totalDurationMs":0.17,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":5.925,"cacheSerializationMs":0.019,"totalDurationMs":5.943,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.008,"cacheSerializationMs":0.019,"totalDurationMs":6.028,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":6.19629199999963,"cacheSerializationMs":0.019707999999809545,"totalDurationMs":6.21599999999944,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.16516700000011042,"cacheSerializationMs":0.008791000000201166,"totalDurationMs":0.17395800000031159,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.040917000000263,"cacheSerializationMs":0.02583299999969313,"totalDurationMs":6.066749999999956,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":5.889667000000372,"cacheSerializationMs":0.019333999999616935,"totalDurationMs":5.909000999999989,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.130625000000691,"cacheSerializationMs":0.018707999999605818,"totalDurationMs":6.149333000000297,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.21183399999972607,"cacheSerializationMs":0.008541999999579275,"totalDurationMs":0.22037599999930535,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":8.193082999999206,"cacheSerializationMs":0.018708000000515312,"totalDurationMs":8.211790999999721,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195},"freshAfterAppend":{"durationMs":5.9695840000003955,"cacheSerializationMs":0.020749999999679858,"totalDurationMs":5.990334000000075,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":5.942041999999674,"cacheSerializationMs":0.018958000000566244,"totalDurationMs":5.96100000000024,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.14079099999980826,"cacheSerializationMs":0.007790999999997439,"totalDurationMs":0.1485819999998057,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.080625000000509,"cacheSerializationMs":0.02062500000010914,"totalDurationMs":6.1012500000006185,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.04595800000061,"cacheSerializationMs":0.0193329999992784,"totalDurationMs":6.065290999999888,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":5.939124999999876,"cacheSerializationMs":0.0152909999997064,"totalDurationMs":5.954415999999583,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.1663750000006985,"cacheSerializationMs":0.007084000000759261,"totalDurationMs":0.17345900000145775,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":5.701000000000022,"cacheSerializationMs":0.014374999999745341,"totalDurationMs":5.715374999999767,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":5.890791999999237,"cacheSerializationMs":0.015583000000333413,"totalDurationMs":5.906374999999571,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":5.977415999999721,"cacheSerializationMs":0.014750000000276486,"totalDurationMs":5.992165999999997,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.15525000000070577,"cacheSerializationMs":0.007749999999759893,"totalDurationMs":0.16300000000046566,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":5.741624999999658,"cacheSerializationMs":0.013875000000552973,"totalDurationMs":5.755500000000211,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195},"freshAfterAppend":{"durationMs":6.193250000000262,"cacheSerializationMs":0.017916999999215477,"totalDurationMs":6.211166999999477,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.250208999999813,"cacheSerializationMs":0.0184159999998883,"totalDurationMs":6.268624999999702,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.16083399999934045,"cacheSerializationMs":0.009167000000161352,"totalDurationMs":0.1700009999995018,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":5.961291999999958,"cacheSerializationMs":0.018791999999848485,"totalDurationMs":5.980083999999806,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.070917000000009,"cacheSerializationMs":0.02087500000016007,"totalDurationMs":6.091792000000169,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":5.9496250000001965,"cacheSerializationMs":0.01695800000015879,"totalDurationMs":5.966583000000355,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.15408299999944575,"cacheSerializationMs":0.008874999999534339,"totalDurationMs":0.16295799999898009,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":5.760209000000032,"cacheSerializationMs":0.023375000000669388,"totalDurationMs":5.783584000000701,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.201624999999694,"cacheSerializationMs":0.019166999999470136,"totalDurationMs":6.2207919999991645,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.116833000000042,"cacheSerializationMs":0.017209000000548258,"totalDurationMs":6.134042000000591,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7981},"warm":{"durationMs":0.16129199999977573,"cacheSerializationMs":0.007832999999664025,"totalDurationMs":0.16912499999943975,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7981},"append":{"durationMs":5.889334000000417,"cacheSerializationMs":0.01700000000073487,"totalDurationMs":5.906334000001152,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195},"freshAfterAppend":{"durationMs":5.966083000000253,"cacheSerializationMs":0.018707999999605818,"totalDurationMs":5.984790999999859,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195}}}]},"current":{"phases":{"cold":{"durationMs":3.4,"cacheSerializationMs":0.025,"totalDurationMs":3.426,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.145,"cacheSerializationMs":0.016,"totalDurationMs":0.16,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.6,"cacheSerializationMs":0.017,"totalDurationMs":0.616,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":3.153,"cacheSerializationMs":0.024,"totalDurationMs":3.176,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":4.189709000000221,"cacheSerializationMs":0.02508399999987887,"totalDurationMs":4.2147930000001,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.14266700000007404,"cacheSerializationMs":0.01508300000023155,"totalDurationMs":0.1577500000003056,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.8671659999999974,"cacheSerializationMs":0.017875000000458385,"totalDurationMs":0.8850410000004558,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":3.514165999999932,"cacheSerializationMs":0.024166999999579275,"totalDurationMs":3.5383329999995112,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.4504159999996773,"cacheSerializationMs":0.026707999999416643,"totalDurationMs":3.477123999999094,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.1305419999998776,"cacheSerializationMs":0.015209000000140804,"totalDurationMs":0.1457510000000184,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.6137079999998605,"cacheSerializationMs":0.016667000000779808,"totalDurationMs":0.6303750000006403,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13687},"freshAfterAppend":{"durationMs":3.2030000000004293,"cacheSerializationMs":0.022833999999420485,"totalDurationMs":3.2258339999998498,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13687}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":3.4790830000001733,"cacheSerializationMs":0.02449999999953434,"totalDurationMs":3.5035829999997077,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.16283300000031886,"cacheSerializationMs":0.019458000000668108,"totalDurationMs":0.18229100000098697,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.5994160000000193,"cacheSerializationMs":0.016208000000005995,"totalDurationMs":0.6156240000000253,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":3.1037500000002183,"cacheSerializationMs":0.022415999999793712,"totalDurationMs":3.126166000000012,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.1605829999998605,"cacheSerializationMs":0.02454200000011042,"totalDurationMs":3.185124999999971,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.12695800000074087,"cacheSerializationMs":0.01620900000034453,"totalDurationMs":0.1431670000010854,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.6043330000002243,"cacheSerializationMs":0.018666999999368272,"totalDurationMs":0.6229999999995925,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13687},"freshAfterAppend":{"durationMs":2.9113750000005894,"cacheSerializationMs":0.023333000000093307,"totalDurationMs":2.9347080000006827,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13687}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":3.116917000000285,"cacheSerializationMs":0.022167000000081316,"totalDurationMs":3.1390840000003664,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.14354199999979755,"cacheSerializationMs":0.015625,"totalDurationMs":0.15916699999979755,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.570042000000285,"cacheSerializationMs":0.029750000000603904,"totalDurationMs":0.599792000000889,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":4.750208999999813,"cacheSerializationMs":0.027167000000190455,"totalDurationMs":4.777376000000004,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.3492499999993015,"cacheSerializationMs":0.02458299999943847,"totalDurationMs":3.37383299999874,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.1455839999998716,"cacheSerializationMs":0.015167000000474218,"totalDurationMs":0.1607510000003458,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.5935840000001917,"cacheSerializationMs":0.019750000000385626,"totalDurationMs":0.6133340000005774,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":3.5324579999996786,"cacheSerializationMs":0.03320800000074087,"totalDurationMs":3.5656660000004194,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":3.3496249999998327,"cacheSerializationMs":0.025666999999884865,"totalDurationMs":3.3752919999997175,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.23483300000043528,"cacheSerializationMs":0.018250000000080036,"totalDurationMs":0.2530830000005153,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.6001670000005106,"cacheSerializationMs":0.016249999999672582,"totalDurationMs":0.6164170000001832,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":2.9675829999996495,"cacheSerializationMs":0.02525000000059663,"totalDurationMs":2.992833000000246,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":4.750750000000153,"cacheSerializationMs":0.02437499999996362,"totalDurationMs":4.775125000000116,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.17754100000001927,"cacheSerializationMs":0.016791999999441032,"totalDurationMs":0.1943329999994603,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.5774160000000848,"cacheSerializationMs":0.016000000000531145,"totalDurationMs":0.5934160000006159,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":2.927582999999686,"cacheSerializationMs":0.021957999999358435,"totalDurationMs":2.9495409999990443,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}}]}}} +{"scenario":"history-scaling","toolMiB":32,"usageKeys":256,"historyBytes":34529726,"appendBytes":4730,"arms":{"baseline":{"phases":{"cold":{"durationMs":82.27,"cacheSerializationMs":0.019,"totalDurationMs":82.288,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.228,"cacheSerializationMs":0.009,"totalDurationMs":0.238,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":81.494,"cacheSerializationMs":0.02,"totalDurationMs":81.513,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":80.46,"cacheSerializationMs":0.02,"totalDurationMs":80.481,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":80.66304200000013,"cacheSerializationMs":0.019290999999611813,"totalDurationMs":80.68233299999974,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.20287499999994907,"cacheSerializationMs":0.00741699999980483,"totalDurationMs":0.2102919999997539,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":82.2318750000004,"cacheSerializationMs":0.020708999999442312,"totalDurationMs":82.25258399999984,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":81.23499999999967,"cacheSerializationMs":0.020167000000583357,"totalDurationMs":81.25516700000026,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":83.47879199999988,"cacheSerializationMs":0.018624999999701686,"totalDurationMs":83.49741699999959,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.218166999999994,"cacheSerializationMs":0.009207999999489402,"totalDurationMs":0.2273749999994834,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":83.64458299999933,"cacheSerializationMs":0.023624999999810825,"totalDurationMs":83.66820799999914,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195},"freshAfterAppend":{"durationMs":82.47670899999957,"cacheSerializationMs":0.019584000000577362,"totalDurationMs":82.49629300000015,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":101.5322500000002,"cacheSerializationMs":0.019333000000187894,"totalDurationMs":101.55158300000039,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.22745800000029703,"cacheSerializationMs":0.011457999999947788,"totalDurationMs":0.23891600000024482,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":85.01295899999968,"cacheSerializationMs":0.020375000000058208,"totalDurationMs":85.03333399999974,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":87.13662499999919,"cacheSerializationMs":0.01929199999995035,"totalDurationMs":87.15591699999914,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":82.46608399999968,"cacheSerializationMs":0.01954200000000128,"totalDurationMs":82.48562599999968,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.2319999999999709,"cacheSerializationMs":0.007916999999906693,"totalDurationMs":0.2399169999998776,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":84.36591700000008,"cacheSerializationMs":0.019041999999899417,"totalDurationMs":84.38495899999998,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":79.08312500000011,"cacheSerializationMs":0.018874999999752617,"totalDurationMs":79.10199999999986,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":80.96466700000019,"cacheSerializationMs":0.0189170000003287,"totalDurationMs":80.98358400000052,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.24770799999987503,"cacheSerializationMs":0.009457999999540334,"totalDurationMs":0.25716599999941536,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":79.26970799999981,"cacheSerializationMs":0.019583999999667867,"totalDurationMs":79.28929199999948,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":78.81812499999978,"cacheSerializationMs":0.02162499999940337,"totalDurationMs":78.83974999999919,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":82.2599169999994,"cacheSerializationMs":0.017625000000407454,"totalDurationMs":82.27754199999981,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.24112500000046566,"cacheSerializationMs":0.007999999999810825,"totalDurationMs":0.2491250000002765,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":80.27466599999934,"cacheSerializationMs":0.02654199999960838,"totalDurationMs":80.30120799999895,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":79.68579200000022,"cacheSerializationMs":0.020958000000973698,"totalDurationMs":79.7067500000012,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":82.28066599999875,"cacheSerializationMs":0.017792000000554253,"totalDurationMs":82.2984579999993,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.2082090000003518,"cacheSerializationMs":0.008874999999534339,"totalDurationMs":0.21708399999988615,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":79.7119590000002,"cacheSerializationMs":0.018500000000130967,"totalDurationMs":79.73045900000034,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":79.17891600000075,"cacheSerializationMs":0.021208000000115135,"totalDurationMs":79.20012400000087,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":81.6513329999998,"cacheSerializationMs":0.01783400000022084,"totalDurationMs":81.66916700000002,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.22766699999920093,"cacheSerializationMs":0.009332999999969616,"totalDurationMs":0.23699999999917054,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":80.75533300000097,"cacheSerializationMs":0.018667000000277767,"totalDurationMs":80.77400000000125,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":81.5267500000009,"cacheSerializationMs":0.019666000000142958,"totalDurationMs":81.54641600000105,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}}]},"current":{"phases":{"cold":{"durationMs":35.014,"cacheSerializationMs":0.026,"totalDurationMs":35.044,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.217,"cacheSerializationMs":0.019,"totalDurationMs":0.234,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.724,"cacheSerializationMs":0.018,"totalDurationMs":0.741,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":33.172,"cacheSerializationMs":0.028,"totalDurationMs":33.198,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":36.4985829999996,"cacheSerializationMs":0.025666999999884865,"totalDurationMs":36.52424999999948,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.1782919999996011,"cacheSerializationMs":0.01929199999995035,"totalDurationMs":0.19758399999955145,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.6560420000005251,"cacheSerializationMs":0.016582999999627646,"totalDurationMs":0.6726250000001528,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":33.20654099999956,"cacheSerializationMs":0.028250000000298314,"totalDurationMs":33.23479099999986,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":34.23624999999993,"cacheSerializationMs":0.025583999999980733,"totalDurationMs":34.26183399999991,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.3797080000003916,"cacheSerializationMs":0.017833999999311345,"totalDurationMs":0.39754199999970297,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":1.3713749999997162,"cacheSerializationMs":0.01970900000014808,"totalDurationMs":1.3910839999998643,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":32.338042000000314,"cacheSerializationMs":0.028125000000727596,"totalDurationMs":32.36616700000104,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":36.22425000000021,"cacheSerializationMs":0.028874999999970896,"totalDurationMs":36.25312500000018,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.2226249999994252,"cacheSerializationMs":0.015917000000627013,"totalDurationMs":0.2385420000000522,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.7226670000000013,"cacheSerializationMs":0.017375000000356522,"totalDurationMs":0.7400420000003578,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":32.64533399999982,"cacheSerializationMs":0.028707999999824096,"totalDurationMs":32.674041999999645,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":32.956458999999995,"cacheSerializationMs":0.025292000000263215,"totalDurationMs":32.98175100000026,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.2119169999996302,"cacheSerializationMs":0.015709000000242668,"totalDurationMs":0.22762599999987287,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.6378750000003492,"cacheSerializationMs":0.01804199999969569,"totalDurationMs":0.6559170000000449,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":33.1371250000002,"cacheSerializationMs":0.024083999999675143,"totalDurationMs":33.16120899999987,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":35.545750000000226,"cacheSerializationMs":0.02766700000029232,"totalDurationMs":35.57341700000052,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":1.1315420000000813,"cacheSerializationMs":0.019874999999956344,"totalDurationMs":1.1514170000000377,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.7425410000005286,"cacheSerializationMs":0.019500000000334694,"totalDurationMs":0.7620410000008633,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":32.249667000000045,"cacheSerializationMs":0.028040999999575433,"totalDurationMs":32.27770799999962,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":34.48133299999972,"cacheSerializationMs":0.033083000000260654,"totalDurationMs":34.51441599999998,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.26433300000098825,"cacheSerializationMs":0.020207999999911408,"totalDurationMs":0.28454100000089966,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.808999999999287,"cacheSerializationMs":0.019417000001340057,"totalDurationMs":0.828417000000627,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":34.16429099999914,"cacheSerializationMs":0.029249999999592546,"totalDurationMs":34.19354099999873,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":37.463042000001224,"cacheSerializationMs":0.024957999999969616,"totalDurationMs":37.48800000000119,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13330},"warm":{"durationMs":0.21112499999981083,"cacheSerializationMs":0.018374999999650754,"totalDurationMs":0.22949999999946158,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13330},"append":{"durationMs":0.7252909999988333,"cacheSerializationMs":0.017416000000594067,"totalDurationMs":0.7427069999994274,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13689},"freshAfterAppend":{"durationMs":33.382791,"cacheSerializationMs":0.030542000000423286,"totalDurationMs":33.41333300000042,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13689}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":32.60270799999853,"cacheSerializationMs":0.02562500000021828,"totalDurationMs":32.62833299999875,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13328},"warm":{"durationMs":0.19608300000072632,"cacheSerializationMs":0.02050000000053842,"totalDurationMs":0.21658300000126474,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13328},"append":{"durationMs":0.5667919999996229,"cacheSerializationMs":0.016166000001248904,"totalDurationMs":0.5829580000008718,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691},"freshAfterAppend":{"durationMs":33.35895799999889,"cacheSerializationMs":0.027207999999518506,"totalDurationMs":33.38616599999841,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13691}}}]}}} +{"scaling":{"baseline":{"historyByteRatio":15.116597919820544,"appendReadByteRatio":15.087426757001882,"appendDurationRatio":13.754261603375527,"cachedStateByteRatio":1.0001220107369448},"current":{"historyByteRatio":15.116597919820544,"appendReadByteRatio":1,"appendDurationRatio":1.2066666666666668,"cachedStateByteRatio":1.0001461027102052}},"exactColdParity":true,"crossArmBehaviorParity":true} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":4096,"historyBytes":36555744,"appendBytes":4748,"arms":{"baseline":{"phases":{"cold":{"durationMs":90.318,"cacheSerializationMs":0.453,"totalDurationMs":90.716,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.584,"cacheSerializationMs":0.079,"totalDurationMs":0.662,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":92.092,"cacheSerializationMs":0.285,"totalDurationMs":92.323,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":89.759,"cacheSerializationMs":0.48,"totalDurationMs":90.181,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":93.492083000001,"cacheSerializationMs":0.5732910000006086,"totalDurationMs":94.06537400000161,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.6258749999997235,"cacheSerializationMs":0.08129200000075798,"totalDurationMs":0.7071670000004815,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":150.32074999999895,"cacheSerializationMs":1.2975830000013957,"totalDurationMs":151.61833300000035,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":90.10916600000019,"cacheSerializationMs":0.5128750000003492,"totalDurationMs":90.62204100000054,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":91.234457999999,"cacheSerializationMs":0.28770799999983865,"totalDurationMs":91.52216599999883,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.6308750000007421,"cacheSerializationMs":0.09141699999963748,"totalDurationMs":0.7222920000003796,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":89.62133300000096,"cacheSerializationMs":0.2969589999993332,"totalDurationMs":89.91829200000029,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":89.09420899999895,"cacheSerializationMs":0.4642089999997552,"totalDurationMs":89.55841799999871,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":89.12379200000032,"cacheSerializationMs":0.4802909999998519,"totalDurationMs":89.60408300000017,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5661670000008598,"cacheSerializationMs":0.08016700000007404,"totalDurationMs":0.6463340000009339,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":92.53158399999847,"cacheSerializationMs":0.17683299999953306,"totalDurationMs":92.70841699999801,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":89.4091669999998,"cacheSerializationMs":0.3307910000003176,"totalDurationMs":89.73995800000012,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":89.40179199999875,"cacheSerializationMs":0.5084169999990991,"totalDurationMs":89.91020899999785,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5818749999998545,"cacheSerializationMs":0.07545800000116287,"totalDurationMs":0.6573330000010174,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":91.65329199999906,"cacheSerializationMs":0.2840830000004644,"totalDurationMs":91.93737499999952,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":88.64708300000166,"cacheSerializationMs":0.25050000000010186,"totalDurationMs":88.89758300000176,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":92.68141699999978,"cacheSerializationMs":0.36258300000008603,"totalDurationMs":93.04399999999987,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.5339999999996508,"cacheSerializationMs":0.07604099999844038,"totalDurationMs":0.6100409999980911,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":91.18975000000137,"cacheSerializationMs":0.20600000000013097,"totalDurationMs":91.3957500000015,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":90.54937500000051,"cacheSerializationMs":0.2701249999990978,"totalDurationMs":90.8194999999996,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":88.9773750000004,"cacheSerializationMs":0.5472079999999551,"totalDurationMs":89.52458300000035,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.590291000000434,"cacheSerializationMs":0.07595799999944575,"totalDurationMs":0.6662489999998797,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":92.98983399999997,"cacheSerializationMs":0.2852080000011483,"totalDurationMs":93.27504200000112,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":94.011625000001,"cacheSerializationMs":0.5310840000001917,"totalDurationMs":94.5427090000012,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":125.52808299999924,"cacheSerializationMs":0.4263749999990978,"totalDurationMs":125.95445799999834,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.5857909999995172,"cacheSerializationMs":0.08316700000068522,"totalDurationMs":0.6689580000002024,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":92.8481670000001,"cacheSerializationMs":0.3693330000005517,"totalDurationMs":93.21750000000065,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":90.17250000000058,"cacheSerializationMs":0.5476249999992433,"totalDurationMs":90.72012499999983,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":88.9702500000003,"cacheSerializationMs":0.29333299999962037,"totalDurationMs":89.26358299999993,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.5323340000013559,"cacheSerializationMs":0.078125,"totalDurationMs":0.6104590000013559,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":89.81045799999993,"cacheSerializationMs":0.18549999999959255,"totalDurationMs":89.99595799999952,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":88.43816700000025,"cacheSerializationMs":0.49620800000047893,"totalDurationMs":88.93437500000073,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}}]},"current":{"phases":{"cold":{"durationMs":49.156,"cacheSerializationMs":0.437,"totalDurationMs":49.59,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.545,"cacheSerializationMs":0.216,"totalDurationMs":0.757,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.883,"cacheSerializationMs":0.216,"totalDurationMs":3.093,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":47.908,"cacheSerializationMs":0.36,"totalDurationMs":48.27,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.609958999999435,"cacheSerializationMs":0.4359169999988808,"totalDurationMs":50.045875999998316,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.4969170000003942,"cacheSerializationMs":0.20754200000010314,"totalDurationMs":0.7044590000004973,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.9470409999994445,"cacheSerializationMs":0.21570799999972223,"totalDurationMs":3.1627489999991667,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":47.78837500000009,"cacheSerializationMs":0.36366699999962293,"totalDurationMs":48.15204199999971,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":49.32770899999923,"cacheSerializationMs":0.48741700000027777,"totalDurationMs":49.81512599999951,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.5557920000010199,"cacheSerializationMs":0.23004199999923003,"totalDurationMs":0.7858340000002499,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.8276670000013837,"cacheSerializationMs":0.21691699999973935,"totalDurationMs":3.044584000001123,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188875},"freshAfterAppend":{"durationMs":47.5502919999999,"cacheSerializationMs":0.3266249999996944,"totalDurationMs":47.876916999999594,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188875}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":48.649750000000495,"cacheSerializationMs":0.4083329999994021,"totalDurationMs":49.0580829999999,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188498},"warm":{"durationMs":0.5117090000003373,"cacheSerializationMs":0.21837500000037835,"totalDurationMs":0.7300840000007156,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188498},"append":{"durationMs":2.8362919999999576,"cacheSerializationMs":0.2184159999997064,"totalDurationMs":3.054707999999664,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":48.090000000000146,"cacheSerializationMs":0.33633300000110466,"totalDurationMs":48.42633300000125,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":49.0111250000009,"cacheSerializationMs":0.44120900000052643,"totalDurationMs":49.45233400000143,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188498},"warm":{"durationMs":0.5625419999996666,"cacheSerializationMs":0.21349999999983993,"totalDurationMs":0.7760419999995065,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188498},"append":{"durationMs":3.293666999999914,"cacheSerializationMs":0.26524999999855936,"totalDurationMs":3.5589169999984733,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188875},"freshAfterAppend":{"durationMs":48.19458300000042,"cacheSerializationMs":0.42224999999962165,"totalDurationMs":48.61683300000004,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188875}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.67183300000033,"cacheSerializationMs":0.4377500000009604,"totalDurationMs":50.109583000001294,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188498},"warm":{"durationMs":2.139999999999418,"cacheSerializationMs":0.23712499999965075,"totalDurationMs":2.3771249999990687,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188498},"append":{"durationMs":2.896500000000742,"cacheSerializationMs":0.21554199999991397,"totalDurationMs":3.112042000000656,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":46.13841700000012,"cacheSerializationMs":0.3204999999998108,"totalDurationMs":46.45891699999993,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":47.12816700000076,"cacheSerializationMs":0.5058749999989232,"totalDurationMs":47.63404199999968,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.5457920000008016,"cacheSerializationMs":0.18641700000080164,"totalDurationMs":0.7322090000016033,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.763542000000598,"cacheSerializationMs":0.2049590000005992,"totalDurationMs":2.968501000001197,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":48.02679100000023,"cacheSerializationMs":0.3618750000005093,"totalDurationMs":48.38866600000074,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.30104200000096,"cacheSerializationMs":0.42645900000024994,"totalDurationMs":49.72750100000121,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.5143329999991693,"cacheSerializationMs":0.2409170000009908,"totalDurationMs":0.7552500000001601,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.9194169999991573,"cacheSerializationMs":0.2240830000009737,"totalDurationMs":3.143500000000131,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":48.54179199999999,"cacheSerializationMs":0.467000000000553,"totalDurationMs":49.00879200000054,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":47.53899999999885,"cacheSerializationMs":0.3601250000010623,"totalDurationMs":47.89912499999991,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188500},"warm":{"durationMs":0.543416000000434,"cacheSerializationMs":0.21437500000138243,"totalDurationMs":0.7577910000018164,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188500},"append":{"durationMs":2.870375000000422,"cacheSerializationMs":0.20449999999982538,"totalDurationMs":3.0748750000002474,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877},"freshAfterAppend":{"durationMs":46.124667000000045,"cacheSerializationMs":0.3583749999997963,"totalDurationMs":46.48304199999984,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188877}}}]}}} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":16384,"historyBytes":43058202,"appendBytes":4766,"arms":{"baseline":{"phases":{"cold":{"durationMs":123.511,"cacheSerializationMs":0.628,"totalDurationMs":124.09,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.62,"cacheSerializationMs":0.34,"totalDurationMs":1.967,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":123.414,"cacheSerializationMs":0.57,"totalDurationMs":124.31,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":120.465,"cacheSerializationMs":1.18,"totalDurationMs":121.567,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":123.07216700000026,"cacheSerializationMs":0.5944579999995767,"totalDurationMs":123.66662499999984,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.71270800000093,"cacheSerializationMs":0.3324160000011034,"totalDurationMs":2.0451240000020334,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":121.359457999999,"cacheSerializationMs":0.5654169999997976,"totalDurationMs":121.92487499999879,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":116.63154099999883,"cacheSerializationMs":1.6032079999986308,"totalDurationMs":118.23474899999746,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":130.0422920000001,"cacheSerializationMs":0.5794170000008307,"totalDurationMs":130.62170900000092,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.7079579999990528,"cacheSerializationMs":0.3608750000003056,"totalDurationMs":2.0688329999993584,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":124.8135829999992,"cacheSerializationMs":0.5544580000005226,"totalDurationMs":125.36804099999972,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":119.33058299999902,"cacheSerializationMs":1.4158749999987776,"totalDurationMs":120.7464579999978,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":127.71049999999923,"cacheSerializationMs":0.9759580000009009,"totalDurationMs":128.68645800000013,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.7417910000003758,"cacheSerializationMs":0.33433400000103575,"totalDurationMs":2.0761250000014115,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":125.99808299999859,"cacheSerializationMs":0.6396670000012818,"totalDurationMs":126.63774999999987,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":125.95724999999948,"cacheSerializationMs":0.5501670000012382,"totalDurationMs":126.50741700000071,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":123.95079100000112,"cacheSerializationMs":0.5618329999997513,"totalDurationMs":124.51262400000087,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6211250000014843,"cacheSerializationMs":0.34883300000001327,"totalDurationMs":1.9699580000014976,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":121.9278749999994,"cacheSerializationMs":0.5741669999988517,"totalDurationMs":122.50204199999826,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":121.5344159999986,"cacheSerializationMs":0.6417080000028363,"totalDurationMs":122.17612400000144,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":121.09929199999897,"cacheSerializationMs":1.5926670000008016,"totalDurationMs":122.69195899999977,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470877},"warm":{"durationMs":1.5644590000010794,"cacheSerializationMs":0.3318749999998545,"totalDurationMs":1.8963340000009339,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470877},"append":{"durationMs":128.8656660000015,"cacheSerializationMs":1.1503750000010768,"totalDurationMs":130.0160410000026,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":125.96516700000211,"cacheSerializationMs":0.6113750000004075,"totalDurationMs":126.57654200000252,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":126.23033399999986,"cacheSerializationMs":0.5954579999997804,"totalDurationMs":126.82579199999964,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.619458000001032,"cacheSerializationMs":0.3450830000001588,"totalDurationMs":1.9645410000011907,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":121.83270800000173,"cacheSerializationMs":1.4197500000009313,"totalDurationMs":123.25245800000266,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":123.28649999999834,"cacheSerializationMs":0.9451249999983702,"totalDurationMs":124.23162499999671,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":120.57254199999807,"cacheSerializationMs":0.7985410000001139,"totalDurationMs":121.37108299999818,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6059170000007725,"cacheSerializationMs":0.3225419999980659,"totalDurationMs":1.9284589999988384,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":125.0358750000014,"cacheSerializationMs":0.5510409999988042,"totalDurationMs":125.5869160000002,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":119.39520900000207,"cacheSerializationMs":1.562832999999955,"totalDurationMs":120.95804200000202,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":121.21008300000176,"cacheSerializationMs":0.6614999999983411,"totalDurationMs":121.8715830000001,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.5587500000001455,"cacheSerializationMs":0.36300000000119326,"totalDurationMs":1.9217500000013388,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":122.01441700000214,"cacheSerializationMs":0.5482499999998254,"totalDurationMs":122.56266700000197,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":117.24920799999745,"cacheSerializationMs":2.451874999998836,"totalDurationMs":119.70108299999629,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}}]},"current":{"phases":{"cold":{"durationMs":96.3,"cacheSerializationMs":1.253,"totalDurationMs":97.547,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.574,"cacheSerializationMs":0.774,"totalDurationMs":2.341,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.664,"cacheSerializationMs":0.924,"totalDurationMs":10.651,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":100.417,"cacheSerializationMs":1.852,"totalDurationMs":101.986,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":101.34508300000016,"cacheSerializationMs":1.3100830000003043,"totalDurationMs":102.65516600000046,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.5852080000004207,"cacheSerializationMs":0.767083000000639,"totalDurationMs":2.3522910000010597,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":10.162250000001222,"cacheSerializationMs":0.9540410000008706,"totalDurationMs":11.116291000002093,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":100.78066699999908,"cacheSerializationMs":1.8971249999995052,"totalDurationMs":102.67779199999859,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":95.25054100000125,"cacheSerializationMs":1.192165999998906,"totalDurationMs":96.44270700000015,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.5336659999993572,"cacheSerializationMs":0.7614580000008573,"totalDurationMs":2.2951240000002144,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.9770410000001,"cacheSerializationMs":0.8769580000007409,"totalDurationMs":10.85399900000084,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766922},"freshAfterAppend":{"durationMs":95.63483300000007,"cacheSerializationMs":1.1056660000012926,"totalDurationMs":96.74049900000136,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766922}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":98.18291700000009,"cacheSerializationMs":1.2746250000000146,"totalDurationMs":99.4575420000001,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.5276670000002923,"cacheSerializationMs":0.7526249999991705,"totalDurationMs":2.280291999999463,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.680583999999726,"cacheSerializationMs":0.9963749999988067,"totalDurationMs":10.676958999998533,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":99.06912499999999,"cacheSerializationMs":1.9437500000003638,"totalDurationMs":101.01287500000035,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":96.62754099999984,"cacheSerializationMs":1.2549999999991996,"totalDurationMs":97.88254099999904,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.620999999999185,"cacheSerializationMs":0.78729199999907,"totalDurationMs":2.408291999998255,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":10.011333000000377,"cacheSerializationMs":1.0400420000005397,"totalDurationMs":11.051375000000917,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":102.29083300000093,"cacheSerializationMs":2.3472080000010465,"totalDurationMs":104.63804100000198,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":94.17379200000141,"cacheSerializationMs":1.110292000001209,"totalDurationMs":95.28408400000262,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766529},"warm":{"durationMs":1.5144169999985024,"cacheSerializationMs":0.779833000000508,"totalDurationMs":2.2942499999990105,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766529},"append":{"durationMs":9.646625000001222,"cacheSerializationMs":0.9785000000010768,"totalDurationMs":10.6251250000023,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":102.18354199999885,"cacheSerializationMs":1.8077499999999418,"totalDurationMs":103.9912919999988,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":97.5873750000028,"cacheSerializationMs":1.2746670000015001,"totalDurationMs":98.8620420000043,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.5624160000006668,"cacheSerializationMs":0.7680000000000291,"totalDurationMs":2.330416000000696,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.456833000000188,"cacheSerializationMs":0.8931669999983569,"totalDurationMs":10.349999999998545,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766922},"freshAfterAppend":{"durationMs":103.00320799999827,"cacheSerializationMs":1.3917920000021695,"totalDurationMs":104.39500000000044,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766922}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":95.97191700000258,"cacheSerializationMs":1.2386250000017753,"totalDurationMs":97.21054200000435,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.6042500000003201,"cacheSerializationMs":0.8560829999987618,"totalDurationMs":2.460332999999082,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.639166999997542,"cacheSerializationMs":0.8356669999993755,"totalDurationMs":10.474833999996918,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":100.05395800000042,"cacheSerializationMs":1.2399999999979627,"totalDurationMs":101.29395799999838,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":95.1689170000027,"cacheSerializationMs":1.2502090000016324,"totalDurationMs":96.41912600000433,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766531},"warm":{"durationMs":1.6213749999988067,"cacheSerializationMs":0.8552920000001905,"totalDurationMs":2.476666999998997,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766531},"append":{"durationMs":9.487208999998984,"cacheSerializationMs":0.8626249999979336,"totalDurationMs":10.349833999996918,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924},"freshAfterAppend":{"durationMs":98.94216700000106,"cacheSerializationMs":2.1400830000020505,"totalDurationMs":101.08225000000311,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766924}}}]}}} +{"keyScaling":[{"usageKeys":256,"historyBytes":34529726,"arms":{"baseline":{"durationMs":81.494,"cacheSerializationMs":0.02,"totalDurationMs":81.513,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"current":{"durationMs":0.724,"cacheSerializationMs":0.018,"totalDurationMs":0.741,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13691}}},{"usageKeys":4096,"historyBytes":36555744,"arms":{"baseline":{"durationMs":92.092,"cacheSerializationMs":0.285,"totalDurationMs":92.323,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"current":{"durationMs":2.883,"cacheSerializationMs":0.216,"totalDurationMs":3.093,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188877}}},{"usageKeys":16384,"historyBytes":43058202,"arms":{"baseline":{"durationMs":123.414,"cacheSerializationMs":0.57,"totalDurationMs":124.31,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"current":{"durationMs":9.664,"cacheSerializationMs":0.924,"totalDurationMs":10.651,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":766924}}}]} diff --git a/docs/bug-reproductions/usage-scan-append/hardening-comparison.jsonl b/docs/bug-reproductions/usage-scan-append/hardening-comparison.jsonl new file mode 100644 index 00000000000..b1bb17fa9bb --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/hardening-comparison.jsonl @@ -0,0 +1,8 @@ +{"node":"v24.20.0","nodeFlags":[],"platform":"darwin","osRelease":"25.3.0","arch":"arm64","cpuModel":"Apple M4 Max","cpuCount":16,"timezone":"America/Los_Angeles","rounds":8,"verify":true,"mode":"compare","baselineRef":"51e7181850b022bae2d41091fe1229accef4bd50","baselineCommit":"51e7181850b022bae2d41091fe1229accef4bd50","tooling":{"esbuildVersion":"0.28.2","baselineModules":["src/main/claude-usage/scanner.ts","src/main/claude-usage/transcript-record-parser.ts","src/main/claude-usage/usage-aggregation.ts","src/main/claude-usage/worktree-attribution.ts","src/main/claude-usage/transcript-file-discovery.ts"],"sha256":{"config/scripts/claude-usage-append-benchmark.mjs":"b171806ba5f58ce1ae4d2ea701be973505e7bfa27774f99d5c2408402a97f891","config/scripts/claude-usage-benchmark-scanner.mjs":"ffb6e5defb921f2ab35726a716f5e731dec439ead53cc2f3a192c7bef4df45d3","config/scripts/counterbalanced-benchmark-schedule.mjs":"bc35b40e954fa7ddec0225ed375bd3b113c2e05b8554bc50734d14f89987294d","config/scripts/script-child-process.mjs":"a7441428bf7b5c9a897b6a3c057c50f46acca24c4f218a4b849de5aec53c4173"}},"bundleSha256":{"baseline":"79ba89db30fcad91e492d76342264412ab9a1cd5950f1719d31777268cd69820","current":"c0f96c28f7e2e2647743bee63cf0fdaa5e08d1ea3727f161b823db6cab0776d6"},"sourceFingerprints":{"baseline":{"src/main/claude-usage/scanner.ts":{"source":"HEAD","sha256":"933e772e7d33994efa00ac37547ff8fa554dc628905011f7aff511a26f89331a"},"src/main/claude-usage/transcript-file-discovery.ts":{"source":"HEAD","sha256":"6b1f31b8d25b496ac91b104c46bc67d17efc92c5092b6997efe5ddf69430ffc2"},"src/main/claude-usage/transcript-record-parser.ts":{"source":"HEAD","sha256":"ec75f6f6f17d3f43ffa9ad7de543a80b2baf445560e80af77a44b38a63c275e2"},"src/main/claude-usage/usage-aggregation.ts":{"source":"HEAD","sha256":"be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509"},"src/main/claude-usage/worktree-attribution.ts":{"source":"HEAD","sha256":"7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213"}},"current":{"src/main/claude-usage/scanner.ts":{"source":"worktree","sha256":"ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5"},"src/main/claude-usage/transcript-file-discovery.ts":{"source":"worktree","sha256":"54c84d0b99b45c0fa13e589a1bcec2b479cb01e8b17bcbddbb65a4bc85a03401"},"src/main/claude-usage/transcript-projection-integrity.ts":{"source":"worktree","sha256":"f4efccd6f1be0603a90174f66ac961d07ea5bf1c1fbebe015b0537deee1c58f2"},"src/main/claude-usage/transcript-record-parser.ts":{"source":"worktree","sha256":"6598c02e38ea1776ef5ef926ca424dbc5880f27e7ff03b651cf8f60b791996f6"},"src/main/claude-usage/transcript-resume-projection.ts":{"source":"worktree","sha256":"b2ed0a589b60fdccb02c72fa234368853d32be080a84ee3bcc93f5834478a153"},"src/main/claude-usage/transcript-token-checkpoint.ts":{"source":"worktree","sha256":"e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2"},"src/main/claude-usage/transcript-usage-projection.ts":{"source":"worktree","sha256":"56e2fe017f806670595dae766b6291e09b05b321b83e4b83e1ae5166bab2041c"},"src/main/claude-usage/usage-aggregation.ts":{"source":"worktree","sha256":"be4dad6f41eaf720252137b16b9a96a2cfdd2e73b05eee097993653ce6c5e509"},"src/main/claude-usage/worktree-attribution.ts":{"source":"worktree","sha256":"7450e5ca7d8dcb66d1f5003a3e445c29f05c1416c6cd63aeb3f5f74804bc6213"},"src/main/usage/jsonl-file-checkpoint.ts":{"source":"worktree","sha256":"b7f307564989dabaf1dfda095a26c7bd9f0683e0efcabe79a010c7b58fa1a2d4"},"src/main/usage/jsonl-file-snapshot.ts":{"source":"worktree","sha256":"b1b8869db92c08c762160acba7570aabff25879649cb6ffa3826912ee35deffe"},"src/main/usage/jsonl-line-offsets.ts":{"source":"worktree","sha256":"f3574adfad4549c6330e2ac52760c91be5a8cbb9bf8e1beb440e3226087074db"}}},"measurement":{"cold":"scanner-cache cold; fixtures freshly written and page-cache warm","durationMs":"production scan only; excludes fixture I/O and cache serialization","totalDurationMs":"production scan plus cache stringify; excludes JSON.parse hydration","bytesRead":"raw filesystem API bytes including checkpoint windows; excludes metadata calls","behaviorParity":"exact legacy per-file and aggregate projections; excludes mtime and additive cache metadata"}} +{"scenario":"small-transcript-corpus","files":1000,"historyBytes":459780,"appendBytes":460780,"arms":{"baseline":{"phases":{"cold":{"durationMs":68.095,"cacheSerializationMs":1.589,"totalDurationMs":71.321,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537519},"warm":{"durationMs":8.109,"cacheSerializationMs":1.294,"totalDurationMs":9.424,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537519},"changed":{"durationMs":73.534,"cacheSerializationMs":1.499,"totalDurationMs":75.159,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540509},"freshAfterChange":{"durationMs":72.744,"cacheSerializationMs":1.54,"totalDurationMs":74.19,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540509}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":91.81129200000004,"cacheSerializationMs":1.6471250000000168,"totalDurationMs":93.45841700000005,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537515},"warm":{"durationMs":11.44437499999998,"cacheSerializationMs":1.4270840000000362,"totalDurationMs":12.871459000000016,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537515},"changed":{"durationMs":77.31625000000003,"cacheSerializationMs":1.5839169999999854,"totalDurationMs":78.90016700000001,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540507},"freshAfterChange":{"durationMs":82.84070799999995,"cacheSerializationMs":1.7395409999999174,"totalDurationMs":84.58024899999987,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540507}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":64.06779200000005,"cacheSerializationMs":1.6328750000000127,"totalDurationMs":65.70066700000007,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537490},"warm":{"durationMs":7.0522920000000795,"cacheSerializationMs":1.2486659999999574,"totalDurationMs":8.300958000000037,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537490},"changed":{"durationMs":74.81383299999993,"cacheSerializationMs":1.6398340000000644,"totalDurationMs":76.453667,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540494},"freshAfterChange":{"durationMs":76.86141700000007,"cacheSerializationMs":1.7288750000000164,"totalDurationMs":78.59029200000009,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540494}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":72.81200000000013,"cacheSerializationMs":1.5769999999999982,"totalDurationMs":74.38900000000012,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537536},"warm":{"durationMs":8.449916999999914,"cacheSerializationMs":1.328457999999955,"totalDurationMs":9.778374999999869,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537536},"changed":{"durationMs":72.25395800000001,"cacheSerializationMs":1.609958000000006,"totalDurationMs":73.86391600000002,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540520},"freshAfterChange":{"durationMs":72.87820899999997,"cacheSerializationMs":1.3662910000000466,"totalDurationMs":74.24450000000002,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540520}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":67.07329199999958,"cacheSerializationMs":1.6019169999999576,"totalDurationMs":68.67520899999954,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537507},"warm":{"durationMs":7.619290999999976,"cacheSerializationMs":1.2853749999999309,"totalDurationMs":8.904665999999906,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537507},"changed":{"durationMs":81.4206250000002,"cacheSerializationMs":1.5248750000000655,"totalDurationMs":82.94550000000027,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540508},"freshAfterChange":{"durationMs":69.86183399999982,"cacheSerializationMs":1.5535829999998896,"totalDurationMs":71.4154169999997,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540508}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":72.4033330000002,"cacheSerializationMs":1.4324169999999867,"totalDurationMs":73.83575000000019,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537492},"warm":{"durationMs":9.27158399999962,"cacheSerializationMs":1.2860000000000582,"totalDurationMs":10.557583999999679,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537492},"changed":{"durationMs":69.3298749999999,"cacheSerializationMs":1.4728749999999309,"totalDurationMs":70.80274999999983,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540505},"freshAfterChange":{"durationMs":79.31595800000014,"cacheSerializationMs":1.471125000000029,"totalDurationMs":80.78708300000017,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540505}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":68.85141699999986,"cacheSerializationMs":8.826375000000098,"totalDurationMs":77.67779199999995,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537532},"warm":{"durationMs":111.6949169999998,"cacheSerializationMs":1.367500000000291,"totalDurationMs":113.0624170000001,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537532},"changed":{"durationMs":78.86849999999959,"cacheSerializationMs":1.4491250000000946,"totalDurationMs":80.31762499999968,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540536},"freshAfterChange":{"durationMs":72.609375,"cacheSerializationMs":1.5264589999997042,"totalDurationMs":74.1358339999997,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540536}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":67.33866699999999,"cacheSerializationMs":1.4679170000008526,"totalDurationMs":68.80658400000084,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537523},"warm":{"durationMs":7.767249999999876,"cacheSerializationMs":1.30145900000025,"totalDurationMs":9.068709000000126,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537523},"changed":{"durationMs":71.66566700000021,"cacheSerializationMs":1.4268339999998716,"totalDurationMs":73.09250100000008,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540510},"freshAfterChange":{"durationMs":70.3256250000004,"cacheSerializationMs":1.4864580000003116,"totalDurationMs":71.81208300000071,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540510}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":64.44437500000004,"cacheSerializationMs":1.5129170000000158,"totalDurationMs":65.95729200000005,"bytesRead":459780,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1537531},"warm":{"durationMs":6.446042000000489,"cacheSerializationMs":1.2762500000008004,"totalDurationMs":7.722292000001289,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1537531},"changed":{"durationMs":66.82120899999973,"cacheSerializationMs":1.4427919999998267,"totalDurationMs":68.26400099999955,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540526},"freshAfterChange":{"durationMs":67.07304099999965,"cacheSerializationMs":1.6390840000003664,"totalDurationMs":68.71212500000001,"bytesRead":920560,"directReadBytes":0,"readCount":1000,"streamCount":1000,"cachedStateBytes":1540526}}}]},"current":{"phases":{"cold":{"durationMs":84.02,"cacheSerializationMs":1.704,"totalDurationMs":85.615,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629229},"warm":{"durationMs":8.711,"cacheSerializationMs":1.425,"totalDurationMs":10.173,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629229},"changed":{"durationMs":81.851,"cacheSerializationMs":1.61,"totalDurationMs":83.483,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632231},"freshAfterChange":{"durationMs":76.925,"cacheSerializationMs":1.649,"totalDurationMs":78.57,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632231}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":114.96520799999996,"cacheSerializationMs":1.659084000000007,"totalDurationMs":116.62429199999997,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629257},"warm":{"durationMs":11.144709000000034,"cacheSerializationMs":1.455041000000051,"totalDurationMs":12.599750000000085,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629257},"changed":{"durationMs":90.50979200000006,"cacheSerializationMs":1.9521250000000236,"totalDurationMs":92.46191700000008,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632259},"freshAfterChange":{"durationMs":132.40379099999996,"cacheSerializationMs":1.682374999999979,"totalDurationMs":134.08616599999993,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632259}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":87.20283300000006,"cacheSerializationMs":1.8353750000001128,"totalDurationMs":89.03820800000017,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629243},"warm":{"durationMs":8.738957999999911,"cacheSerializationMs":1.5068750000000364,"totalDurationMs":10.245832999999948,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629243},"changed":{"durationMs":86.9335000000001,"cacheSerializationMs":1.5526250000000346,"totalDurationMs":88.48612500000013,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632241},"freshAfterChange":{"durationMs":76.30016699999987,"cacheSerializationMs":1.625833000000057,"totalDurationMs":77.92599999999993,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632241}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":87.05891699999984,"cacheSerializationMs":1.7533330000001115,"totalDurationMs":88.81224999999995,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629215},"warm":{"durationMs":7.8568750000004,"cacheSerializationMs":1.4308750000000146,"totalDurationMs":9.287750000000415,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629215},"changed":{"durationMs":81.11795799999982,"cacheSerializationMs":1.5254170000002887,"totalDurationMs":82.6433750000001,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632209},"freshAfterChange":{"durationMs":73.35312500000009,"cacheSerializationMs":1.6160829999998896,"totalDurationMs":74.96920799999998,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632209}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":77.1711250000003,"cacheSerializationMs":1.7197080000000824,"totalDurationMs":78.89083300000038,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629273},"warm":{"durationMs":8.022958000000017,"cacheSerializationMs":1.390374999999949,"totalDurationMs":9.413332999999966,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629273},"changed":{"durationMs":77.11166599999979,"cacheSerializationMs":1.5813749999997526,"totalDurationMs":78.69304099999954,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632233},"freshAfterChange":{"durationMs":79.05237499999976,"cacheSerializationMs":1.633874999999989,"totalDurationMs":80.68624999999975,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632233}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":85.75858300000027,"cacheSerializationMs":1.6876250000000255,"totalDurationMs":87.4462080000003,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629239},"warm":{"durationMs":10.630292000000281,"cacheSerializationMs":1.5093329999999696,"totalDurationMs":12.139625000000251,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629239},"changed":{"durationMs":82.04620900000009,"cacheSerializationMs":1.6581249999999272,"totalDurationMs":83.70433400000002,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632147},"freshAfterChange":{"durationMs":74.42695800000001,"cacheSerializationMs":1.7668750000002547,"totalDurationMs":76.19383300000027,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632147}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":77.2780829999997,"cacheSerializationMs":1.4731670000001031,"totalDurationMs":78.7512499999998,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629189},"warm":{"durationMs":8.68224999999984,"cacheSerializationMs":1.4183329999996204,"totalDurationMs":10.10058299999946,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629189},"changed":{"durationMs":79.31187499999987,"cacheSerializationMs":1.840041999999812,"totalDurationMs":81.15191699999968,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632237},"freshAfterChange":{"durationMs":79.68458400000009,"cacheSerializationMs":1.4846670000001723,"totalDurationMs":81.16925100000026,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632237}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":81.57974999999988,"cacheSerializationMs":1.7741660000001502,"totalDurationMs":83.35391600000003,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629211},"warm":{"durationMs":9.232167000000118,"cacheSerializationMs":1.3943329999992784,"totalDurationMs":10.626499999999396,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629211},"changed":{"durationMs":86.88004199999978,"cacheSerializationMs":1.613666999999623,"totalDurationMs":88.4937089999994,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632229},"freshAfterChange":{"durationMs":73.59229099999993,"cacheSerializationMs":1.687750000000051,"totalDurationMs":75.28004099999998,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632229}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":82.28241699999944,"cacheSerializationMs":1.5015829999993002,"totalDurationMs":83.78399999999874,"bytesRead":919560,"directReadBytes":919560,"readCount":2000,"streamCount":0,"cachedStateBytes":1629219},"warm":{"durationMs":7.14391599999999,"cacheSerializationMs":1.393583000000035,"totalDurationMs":8.537499000000025,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629219},"changed":{"durationMs":81.65650000000005,"cacheSerializationMs":1.6060420000003433,"totalDurationMs":83.2625420000004,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632229},"freshAfterChange":{"durationMs":77.54920800000036,"cacheSerializationMs":1.6640830000005735,"totalDurationMs":79.21329100000094,"bytesRead":1841120,"directReadBytes":1841120,"readCount":2000,"streamCount":0,"cachedStateBytes":1632229}}}]}}} +{"scenario":"history-scaling","toolMiB":2,"usageKeys":256,"historyBytes":2284226,"appendBytes":4730,"arms":{"baseline":{"phases":{"cold":{"durationMs":6.147,"cacheSerializationMs":0.019,"totalDurationMs":6.167,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.164,"cacheSerializationMs":0.008,"totalDurationMs":0.173,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.191,"cacheSerializationMs":0.019,"totalDurationMs":6.212,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.178,"cacheSerializationMs":0.019,"totalDurationMs":6.202,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":6.242207999999664,"cacheSerializationMs":0.019083000000136963,"totalDurationMs":6.261290999999801,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.1649170000000595,"cacheSerializationMs":0.009415999999873748,"totalDurationMs":0.17433299999993324,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.060707999999977,"cacheSerializationMs":0.017041999999491964,"totalDurationMs":6.077749999999469,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.010833000000275,"cacheSerializationMs":0.033250000000407454,"totalDurationMs":6.044083000000683,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.349250000000211,"cacheSerializationMs":0.019667000000481494,"totalDurationMs":6.3689170000006925,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.16404199999942648,"cacheSerializationMs":0.008082999999714957,"totalDurationMs":0.17212499999914144,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.182709000000614,"cacheSerializationMs":0.01954200000000128,"totalDurationMs":6.202251000000615,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.242915999999241,"cacheSerializationMs":0.01729200000045239,"totalDurationMs":6.260207999999693,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":5.858083999999508,"cacheSerializationMs":0.01687500000025466,"totalDurationMs":5.8749589999997625,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.13558399999965332,"cacheSerializationMs":0.0071250000000873115,"totalDurationMs":0.14270899999974063,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.169499999999971,"cacheSerializationMs":0.019250000000283762,"totalDurationMs":6.188750000000255,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.138875000000553,"cacheSerializationMs":0.01766700000007404,"totalDurationMs":6.156542000000627,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.212875000000167,"cacheSerializationMs":0.018541999999797554,"totalDurationMs":6.231416999999965,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.16749999999956344,"cacheSerializationMs":0.008041999999477412,"totalDurationMs":0.17554199999904085,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.234958000000006,"cacheSerializationMs":0.018666999999368272,"totalDurationMs":6.253624999999374,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.1585830000003625,"cacheSerializationMs":0.018291999999746622,"totalDurationMs":6.176875000000109,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":6.106665999999677,"cacheSerializationMs":0.018374999999650754,"totalDurationMs":6.125040999999328,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.1410409999998592,"cacheSerializationMs":0.007333999999900698,"totalDurationMs":0.1483749999997599,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.163416999999754,"cacheSerializationMs":0.02716699999928096,"totalDurationMs":6.190583999999035,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.1982080000007045,"cacheSerializationMs":0.02937500000007276,"totalDurationMs":6.227583000000777,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.130833000000166,"cacheSerializationMs":0.01954200000000128,"totalDurationMs":6.150375000000167,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.15345800000068266,"cacheSerializationMs":0.007999999999810825,"totalDurationMs":0.16145800000049348,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.411540999999488,"cacheSerializationMs":0.01929199999995035,"totalDurationMs":6.4308329999994385,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.225749999999607,"cacheSerializationMs":0.018541999999797554,"totalDurationMs":6.244291999999405,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":6.002542000000176,"cacheSerializationMs":0.018541999999797554,"totalDurationMs":6.0210839999999735,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.2157919999999649,"cacheSerializationMs":0.009500000000116415,"totalDurationMs":0.22529200000008132,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":6.4352080000007845,"cacheSerializationMs":0.020125000000007276,"totalDurationMs":6.455333000000792,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.29620900000009,"cacheSerializationMs":0.019500000000334694,"totalDurationMs":6.315709000000425,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":6.163125000000036,"cacheSerializationMs":0.021458000000166066,"totalDurationMs":6.1845830000002024,"bytesRead":2284226,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7981},"warm":{"durationMs":0.20529199999964476,"cacheSerializationMs":0.009958000000551692,"totalDurationMs":0.21525000000019645,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7981},"append":{"durationMs":6.199541999999383,"cacheSerializationMs":0.02220800000031886,"totalDurationMs":6.221749999999702,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":6.090500000000247,"cacheSerializationMs":0.019957999999860476,"totalDurationMs":6.110458000000108,"bytesRead":2288956,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}}]},"current":{"phases":{"cold":{"durationMs":3.52,"cacheSerializationMs":0.02,"totalDurationMs":3.541,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13416},"warm":{"durationMs":0.168,"cacheSerializationMs":0.016,"totalDurationMs":0.185,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13416},"append":{"durationMs":0.834,"cacheSerializationMs":0.017,"totalDurationMs":0.851,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.337,"cacheSerializationMs":0.02,"totalDurationMs":3.357,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":4.984583999999813,"cacheSerializationMs":0.019624999999905413,"totalDurationMs":5.004208999999719,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.136583000000428,"cacheSerializationMs":0.01566700000057608,"totalDurationMs":0.15225000000100408,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":1.0346660000004704,"cacheSerializationMs":0.01599999999962165,"totalDurationMs":1.050666000000092,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13776},"freshAfterAppend":{"durationMs":3.791874999999891,"cacheSerializationMs":0.020375000000058208,"totalDurationMs":3.812249999999949,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13776}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.5029590000003736,"cacheSerializationMs":0.020167000000583357,"totalDurationMs":3.523126000000957,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.1704170000002705,"cacheSerializationMs":0.016249999999672582,"totalDurationMs":0.18666699999994307,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":0.7859589999998207,"cacheSerializationMs":0.01579100000071776,"totalDurationMs":0.8017500000005384,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.134749999999258,"cacheSerializationMs":0.01974999999947613,"totalDurationMs":3.154499999998734,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":4.016375000000153,"cacheSerializationMs":0.025582999999642198,"totalDurationMs":4.041957999999795,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.3205420000003869,"cacheSerializationMs":0.014415999999982887,"totalDurationMs":0.3349580000003698,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":1.9572079999998095,"cacheSerializationMs":0.017915999999786436,"totalDurationMs":1.975123999999596,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.239166999999725,"cacheSerializationMs":0.018667000000277767,"totalDurationMs":3.2578340000000026,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.252124999999978,"cacheSerializationMs":0.018500000000130967,"totalDurationMs":3.270625000000109,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13415},"warm":{"durationMs":0.14041599999927712,"cacheSerializationMs":0.016749999999774445,"totalDurationMs":0.15716599999905156,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13415},"append":{"durationMs":0.7396250000001601,"cacheSerializationMs":0.018000000000029104,"totalDurationMs":0.7576250000001892,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.3466669999997976,"cacheSerializationMs":0.02045799999996234,"totalDurationMs":3.36712499999976,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":3.498458000000028,"cacheSerializationMs":0.02233299999988958,"totalDurationMs":3.5207909999999174,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13415},"warm":{"durationMs":0.16612499999973807,"cacheSerializationMs":0.017333999999209482,"totalDurationMs":0.18345899999894755,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13415},"append":{"durationMs":0.7522090000002208,"cacheSerializationMs":0.01679100000001199,"totalDurationMs":0.7690000000002328,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.3080830000008064,"cacheSerializationMs":0.020249999999577994,"totalDurationMs":3.3283330000003843,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.1943329999994603,"cacheSerializationMs":0.02008300000034069,"totalDurationMs":3.214415999999801,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13415},"warm":{"durationMs":0.3372079999999187,"cacheSerializationMs":0.016375000000152795,"totalDurationMs":0.3535830000000715,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13415},"append":{"durationMs":1.9495420000002923,"cacheSerializationMs":0.01675000000068394,"totalDurationMs":1.9662920000009763,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":3.327874999999949,"cacheSerializationMs":0.019833000000289758,"totalDurationMs":3.347708000000239,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":4.1417920000003505,"cacheSerializationMs":0.02062500000010914,"totalDurationMs":4.16241700000046,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.1632500000005166,"cacheSerializationMs":0.01783400000022084,"totalDurationMs":0.18108400000073743,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":0.7982910000000629,"cacheSerializationMs":0.01733299999978044,"totalDurationMs":0.8156239999998434,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13776},"freshAfterAppend":{"durationMs":5.152541999999812,"cacheSerializationMs":0.019999999999527063,"totalDurationMs":5.172541999999339,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13776}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":3.5373329999993075,"cacheSerializationMs":0.02175000000079308,"totalDurationMs":3.5590830000001006,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13415},"warm":{"durationMs":0.19400000000041473,"cacheSerializationMs":0.01574999999957072,"totalDurationMs":0.20974999999998545,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13415},"append":{"durationMs":0.8696669999999358,"cacheSerializationMs":0.017458999999689695,"totalDurationMs":0.8871259999996255,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13776},"freshAfterAppend":{"durationMs":3.7325000000000728,"cacheSerializationMs":0.019667000000481494,"totalDurationMs":3.7521670000005543,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13776}}}]}}} +{"scenario":"history-scaling","toolMiB":32,"usageKeys":256,"historyBytes":34529726,"appendBytes":4730,"arms":{"baseline":{"phases":{"cold":{"durationMs":85.216,"cacheSerializationMs":0.022,"totalDurationMs":85.236,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.24,"cacheSerializationMs":0.01,"totalDurationMs":0.25,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":83.245,"cacheSerializationMs":0.023,"totalDurationMs":83.266,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":83.793,"cacheSerializationMs":0.021,"totalDurationMs":83.814,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":90.55345800000032,"cacheSerializationMs":0.023791000000528584,"totalDurationMs":90.57724900000085,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.24499999999989086,"cacheSerializationMs":0.009624999999687134,"totalDurationMs":0.254624999999578,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":83.25395799999933,"cacheSerializationMs":0.020375000000058208,"totalDurationMs":83.27433299999939,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":81.81958299999951,"cacheSerializationMs":0.023000000000138243,"totalDurationMs":81.84258299999965,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":84.97933300000022,"cacheSerializationMs":0.021666999999979453,"totalDurationMs":85.0010000000002,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.2531250000001819,"cacheSerializationMs":0.011666999999761174,"totalDurationMs":0.2647919999999431,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":83.02454099999977,"cacheSerializationMs":0.02079200000025594,"totalDurationMs":83.04533300000003,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195},"freshAfterAppend":{"durationMs":87.84508399999959,"cacheSerializationMs":0.024957999999969616,"totalDurationMs":87.87004199999956,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8195}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":84.02808300000015,"cacheSerializationMs":0.02208299999983865,"totalDurationMs":84.05016599999999,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.21504100000038306,"cacheSerializationMs":0.009166999999251857,"totalDurationMs":0.22420799999963492,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":84.33208300000024,"cacheSerializationMs":0.022583999999369553,"totalDurationMs":84.35466699999961,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":84.87737500000003,"cacheSerializationMs":0.019209000000046217,"totalDurationMs":84.89658400000008,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":90.93662499999937,"cacheSerializationMs":0.025582999999642198,"totalDurationMs":90.96220799999901,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.24558299999989686,"cacheSerializationMs":0.010457999999744061,"totalDurationMs":0.2560409999996409,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":82.72862499999974,"cacheSerializationMs":0.01916700000037963,"totalDurationMs":82.74779200000012,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":83.34762500000033,"cacheSerializationMs":0.021542000000408734,"totalDurationMs":83.36916700000074,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":84.72599999999966,"cacheSerializationMs":0.02275000000008731,"totalDurationMs":84.74874999999975,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7982},"warm":{"durationMs":0.22208399999999529,"cacheSerializationMs":0.008125000000291038,"totalDurationMs":0.23020900000028632,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7982},"append":{"durationMs":83.23508300000049,"cacheSerializationMs":0.022417000000132248,"totalDurationMs":83.25750000000062,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":84.23875000000044,"cacheSerializationMs":0.02045799999996234,"totalDurationMs":84.2592080000004,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":84.37487499999952,"cacheSerializationMs":0.01820899999984249,"totalDurationMs":84.39308399999936,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.23595799999930023,"cacheSerializationMs":0.009917000001223641,"totalDurationMs":0.24587500000052387,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":84.31845799999974,"cacheSerializationMs":0.024083000000246102,"totalDurationMs":84.34254099999998,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":81.97129200000018,"cacheSerializationMs":0.024625000000014552,"totalDurationMs":81.99591700000019,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":85.45341600000029,"cacheSerializationMs":0.01858399999946414,"totalDurationMs":85.47199999999975,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.22125000000050932,"cacheSerializationMs":0.009624999998777639,"totalDurationMs":0.23087499999928696,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":83.08620899999914,"cacheSerializationMs":0.024374999999054126,"totalDurationMs":83.1105839999982,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196},"freshAfterAppend":{"durationMs":84.74875000000065,"cacheSerializationMs":0.019999999998617568,"totalDurationMs":84.76874999999927,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8196}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":86.10645799999838,"cacheSerializationMs":0.021208000000115135,"totalDurationMs":86.1276659999985,"bytesRead":34529726,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":7983},"warm":{"durationMs":0.25408299999980954,"cacheSerializationMs":0.011999999998806743,"totalDurationMs":0.2660829999986163,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":7983},"append":{"durationMs":85.76545799999985,"cacheSerializationMs":0.026416999999128166,"totalDurationMs":85.79187499999898,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"freshAfterAppend":{"durationMs":83.3309590000008,"cacheSerializationMs":0.020000000000436557,"totalDurationMs":83.35095900000124,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197}}}]},"current":{"phases":{"cold":{"durationMs":34.124,"cacheSerializationMs":0.021,"totalDurationMs":34.144,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.186,"cacheSerializationMs":0.018,"totalDurationMs":0.204,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":0.813,"cacheSerializationMs":0.017,"totalDurationMs":0.829,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":33.666,"cacheSerializationMs":0.021,"totalDurationMs":33.688,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":35.774749999999585,"cacheSerializationMs":0.020958000000064203,"totalDurationMs":35.79570799999965,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.1827080000002752,"cacheSerializationMs":0.015333000000282482,"totalDurationMs":0.1980410000005577,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":0.773124999999709,"cacheSerializationMs":0.016499999999723514,"totalDurationMs":0.7896249999994325,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":33.574375000000146,"cacheSerializationMs":0.02016600000024482,"totalDurationMs":33.59454100000039,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":33.50212500000089,"cacheSerializationMs":0.020041000000674103,"totalDurationMs":33.52216600000156,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.1616249999997308,"cacheSerializationMs":0.015500000000429281,"totalDurationMs":0.17712500000016007,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":0.7665409999999611,"cacheSerializationMs":0.01729200000045239,"totalDurationMs":0.7838330000004134,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13778},"freshAfterAppend":{"durationMs":33.59174999999959,"cacheSerializationMs":0.021040999999968335,"totalDurationMs":33.61279099999956,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13778}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":35.4032500000003,"cacheSerializationMs":0.02070800000001327,"totalDurationMs":35.42395800000031,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.1937500000003638,"cacheSerializationMs":0.018082999999933236,"totalDurationMs":0.21183300000029703,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":0.8960420000003069,"cacheSerializationMs":0.01779199999964476,"totalDurationMs":0.9138339999999516,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":33.673415999999634,"cacheSerializationMs":0.021125000000211003,"totalDurationMs":33.694540999999845,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":33.354457999999795,"cacheSerializationMs":0.020833000000493485,"totalDurationMs":33.37529100000029,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.2498329999998532,"cacheSerializationMs":0.021749999999883585,"totalDurationMs":0.2715829999997368,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":1.0091670000001614,"cacheSerializationMs":0.017375000000356522,"totalDurationMs":1.0265420000005179,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":37.052458000000115,"cacheSerializationMs":0.024583000000347965,"totalDurationMs":37.07704100000046,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":34.74499999999989,"cacheSerializationMs":0.02045799999996234,"totalDurationMs":34.76545799999985,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.16208300000016607,"cacheSerializationMs":0.015292000000044936,"totalDurationMs":0.177375000000211,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":0.7825829999992493,"cacheSerializationMs":0.01633300000048621,"totalDurationMs":0.7989159999997355,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":33.38808400000016,"cacheSerializationMs":0.02079200000025594,"totalDurationMs":33.40887600000042,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":32.89324999999917,"cacheSerializationMs":0.020750000000589353,"totalDurationMs":32.91399999999976,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13419},"warm":{"durationMs":0.4360000000006039,"cacheSerializationMs":0.018875000000662112,"totalDurationMs":0.454875000001266,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13419},"append":{"durationMs":1.5375420000000304,"cacheSerializationMs":0.015707999999904132,"totalDurationMs":1.5532499999999345,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":33.6583329999994,"cacheSerializationMs":0.022417000000132248,"totalDurationMs":33.680749999999534,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":36.83179200000086,"cacheSerializationMs":0.019874999999956344,"totalDurationMs":36.851667000000816,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.18316699999923003,"cacheSerializationMs":0.018000000000029104,"totalDurationMs":0.20116699999925913,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":0.8424999999988358,"cacheSerializationMs":0.015708000000813627,"totalDurationMs":0.8582079999996495,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":91.75470800000039,"cacheSerializationMs":0.07833399999981339,"totalDurationMs":91.8330420000002,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":32.8315419999999,"cacheSerializationMs":0.020458000000871834,"totalDurationMs":32.85200000000077,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13417},"warm":{"durationMs":0.18883400000049733,"cacheSerializationMs":0.018040999999357155,"totalDurationMs":0.20687499999985448,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":13417},"append":{"durationMs":0.7504169999992882,"cacheSerializationMs":0.016584000000875676,"totalDurationMs":0.7670010000001639,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780},"freshAfterAppend":{"durationMs":34.51745800000026,"cacheSerializationMs":0.02095799999915471,"totalDurationMs":34.538415999999415,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":13780}}}]}}} +{"scaling":{"baseline":{"historyByteRatio":15.116597919820544,"appendReadByteRatio":15.087426757001882,"appendDurationRatio":13.446131481182363,"cachedStateByteRatio":1.0001220107369448},"current":{"historyByteRatio":15.116597919820544,"appendReadByteRatio":1,"appendDurationRatio":0.974820143884892,"cachedStateByteRatio":1.0001451589490493}},"exactColdParity":true,"crossArmBehaviorParity":true} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":4096,"historyBytes":36555744,"appendBytes":4748,"arms":{"baseline":{"phases":{"cold":{"durationMs":93.126,"cacheSerializationMs":0.366,"totalDurationMs":93.584,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.564,"cacheSerializationMs":0.081,"totalDurationMs":0.64,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":93.545,"cacheSerializationMs":0.342,"totalDurationMs":94.01,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":92.764,"cacheSerializationMs":0.39,"totalDurationMs":93.194,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":95.00245799999902,"cacheSerializationMs":0.30054199999904085,"totalDurationMs":95.30299999999806,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5693340000016178,"cacheSerializationMs":0.07091699999909906,"totalDurationMs":0.6402510000007169,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":93.47745900000155,"cacheSerializationMs":0.5133339999993041,"totalDurationMs":93.99079300000085,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":93.9213749999999,"cacheSerializationMs":0.21479100000033213,"totalDurationMs":94.13616600000023,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":93.05412500000057,"cacheSerializationMs":0.6111670000009326,"totalDurationMs":93.6652920000015,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5525419999994483,"cacheSerializationMs":0.0812499999992724,"totalDurationMs":0.6337919999987207,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":92.08050000000003,"cacheSerializationMs":0.40033299999959127,"totalDurationMs":92.48083299999962,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":93.06287500000144,"cacheSerializationMs":0.46212500000001455,"totalDurationMs":93.52500000000146,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":92.32424999999967,"cacheSerializationMs":0.4084999999995489,"totalDurationMs":92.73274999999921,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5120000000006257,"cacheSerializationMs":0.08016700000007404,"totalDurationMs":0.5921670000006998,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":93.61270899999909,"cacheSerializationMs":0.41670799999883457,"totalDurationMs":94.02941699999792,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":92.05541699999958,"cacheSerializationMs":0.38066600000092876,"totalDurationMs":92.43608300000051,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":96.52454200000102,"cacheSerializationMs":0.2903749999986758,"totalDurationMs":96.8149169999997,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.7030000000013388,"cacheSerializationMs":0.0830839999998716,"totalDurationMs":0.7860840000012104,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":92.02099999999882,"cacheSerializationMs":0.2883330000004207,"totalDurationMs":92.30933299999924,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":92.21108400000048,"cacheSerializationMs":0.38175000000046566,"totalDurationMs":92.59283400000095,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":92.48825000000033,"cacheSerializationMs":0.2870419999999285,"totalDurationMs":92.77529200000026,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5594579999997222,"cacheSerializationMs":0.0812499999992724,"totalDurationMs":0.6407079999989946,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":92.73520800000006,"cacheSerializationMs":0.3890000000010332,"totalDurationMs":93.12420800000109,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":91.50804099999914,"cacheSerializationMs":0.2947909999984404,"totalDurationMs":91.80283199999758,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":93.16108399999939,"cacheSerializationMs":0.34116699999867706,"totalDurationMs":93.50225099999807,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.6245830000007118,"cacheSerializationMs":0.09712500000023283,"totalDurationMs":0.7217080000009446,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":98.00124999999935,"cacheSerializationMs":0.28416699999979755,"totalDurationMs":98.28541699999914,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114261},"freshAfterAppend":{"durationMs":92.46491600000081,"cacheSerializationMs":0.3983749999988504,"totalDurationMs":92.86329099999966,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114261}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":93.09104099999968,"cacheSerializationMs":0.38995799999975134,"totalDurationMs":93.48099899999943,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114032},"warm":{"durationMs":0.5162920000002487,"cacheSerializationMs":0.08179100000052131,"totalDurationMs":0.59808300000077,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114032},"append":{"durationMs":275.58183299999837,"cacheSerializationMs":0.25083400000039546,"totalDurationMs":275.83266699999876,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114261},"freshAfterAppend":{"durationMs":94.75487500000054,"cacheSerializationMs":0.4764999999988504,"totalDurationMs":95.23137499999939,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114261}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":94.81508399999984,"cacheSerializationMs":0.4611249999998108,"totalDurationMs":95.27620899999965,"bytesRead":36555744,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114031},"warm":{"durationMs":0.609375,"cacheSerializationMs":0.08112500000061118,"totalDurationMs":0.6905000000006112,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":114031},"append":{"durationMs":96.52829199999906,"cacheSerializationMs":0.29558300000098825,"totalDurationMs":96.82387500000004,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"freshAfterAppend":{"durationMs":93.34133299999849,"cacheSerializationMs":0.6563750000004802,"totalDurationMs":93.99770799999897,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262}}}]},"current":{"phases":{"cold":{"durationMs":49.617,"cacheSerializationMs":0.298,"totalDurationMs":49.92,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.564,"cacheSerializationMs":0.228,"totalDurationMs":0.815,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.497,"cacheSerializationMs":0.22,"totalDurationMs":4.729,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":50.243,"cacheSerializationMs":0.254,"totalDurationMs":50.494,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.535249999998996,"cacheSerializationMs":0.282959000000119,"totalDurationMs":49.818208999999115,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.4966660000009142,"cacheSerializationMs":0.21595800000068266,"totalDurationMs":0.7126240000015969,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.567915999999968,"cacheSerializationMs":0.24508400000013353,"totalDurationMs":4.813000000000102,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":51.27416699999958,"cacheSerializationMs":0.2748329999994894,"totalDurationMs":51.54899999999907,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":56.99287499999991,"cacheSerializationMs":0.2782919999990554,"totalDurationMs":57.27116699999897,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.5507089999991877,"cacheSerializationMs":0.287625000000844,"totalDurationMs":0.8383340000000317,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.365832999999839,"cacheSerializationMs":0.21791699999994307,"totalDurationMs":4.583749999999782,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":49.807833000000755,"cacheSerializationMs":0.25979200000074343,"totalDurationMs":50.0676250000015,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":47.77425000000039,"cacheSerializationMs":0.31154199999946286,"totalDurationMs":48.085791999999856,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188587},"warm":{"durationMs":0.5315829999999551,"cacheSerializationMs":0.2687499999992724,"totalDurationMs":0.8003329999992275,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188587},"append":{"durationMs":4.209834000001138,"cacheSerializationMs":0.20562500000050932,"totalDurationMs":4.415459000001647,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":49.688500000000204,"cacheSerializationMs":0.23100000000158616,"totalDurationMs":49.91950000000179,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":50.715000000000146,"cacheSerializationMs":0.27720899999985704,"totalDurationMs":50.992209,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188587},"warm":{"durationMs":2.2102080000004207,"cacheSerializationMs":0.2165419999982987,"totalDurationMs":2.4267499999987194,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188587},"append":{"durationMs":4.48462500000096,"cacheSerializationMs":0.21454199999971024,"totalDurationMs":4.699167000000671,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":50.93037499999991,"cacheSerializationMs":0.31849999999940337,"totalDurationMs":51.248874999999316,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.69904200000019,"cacheSerializationMs":0.3232499999994616,"totalDurationMs":50.02229199999965,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.6057079999991402,"cacheSerializationMs":0.2244170000012673,"totalDurationMs":0.8301250000004075,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.587499999999636,"cacheSerializationMs":0.23204199999963748,"totalDurationMs":4.819541999999274,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":49.58454200000051,"cacheSerializationMs":0.2472910000014963,"totalDurationMs":49.83183300000201,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":48.5693339999998,"cacheSerializationMs":0.3262909999994008,"totalDurationMs":48.8956249999992,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.5674159999998665,"cacheSerializationMs":0.2185829999998532,"totalDurationMs":0.7859989999997197,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.450124999999389,"cacheSerializationMs":0.19912500000100408,"totalDurationMs":4.649250000000393,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":50.04500000000007,"cacheSerializationMs":0.2561249999998836,"totalDurationMs":50.301124999999956,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":49.50170799999978,"cacheSerializationMs":0.28712499999892316,"totalDurationMs":49.788832999998704,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":0.5607919999984006,"cacheSerializationMs":0.23175000000082946,"totalDurationMs":0.79254199999923,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":7.42791600000055,"cacheSerializationMs":0.2211669999996957,"totalDurationMs":7.649083000000246,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":50.58070899999984,"cacheSerializationMs":0.2515829999993002,"totalDurationMs":50.83229199999914,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":52.303625000000466,"cacheSerializationMs":0.30795900000157417,"totalDurationMs":52.61158400000204,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188589},"warm":{"durationMs":2.4320410000000265,"cacheSerializationMs":0.2537499999998545,"totalDurationMs":2.685790999999881,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":188589},"append":{"durationMs":4.510167000000365,"cacheSerializationMs":0.24825000000055297,"totalDurationMs":4.758417000000918,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966},"freshAfterAppend":{"durationMs":50.44104199999856,"cacheSerializationMs":0.24495799999931478,"totalDurationMs":50.685999999997875,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":188966}}}]}}} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":16384,"historyBytes":43058202,"appendBytes":4766,"arms":{"baseline":{"phases":{"cold":{"durationMs":125.567,"cacheSerializationMs":0.577,"totalDurationMs":126.246,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.682,"cacheSerializationMs":0.342,"totalDurationMs":2.047,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":124.826,"cacheSerializationMs":0.564,"totalDurationMs":125.406,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":122.622,"cacheSerializationMs":1.475,"totalDurationMs":123.643,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}},"rawSamples":[{"arm":"baseline","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":124.34320800000023,"cacheSerializationMs":0.5579580000012356,"totalDurationMs":124.90116600000147,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6265409999996336,"cacheSerializationMs":0.33654200000091805,"totalDurationMs":1.9630830000005517,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":126.44100000000071,"cacheSerializationMs":0.562208000001192,"totalDurationMs":127.0032080000019,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":121.10020799999984,"cacheSerializationMs":1.4370000000017171,"totalDurationMs":122.53720800000156,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":127.94700000000012,"cacheSerializationMs":0.5967500000006112,"totalDurationMs":128.54375000000073,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6927919999998267,"cacheSerializationMs":0.3657920000005106,"totalDurationMs":2.0585840000003373,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":119.4038330000003,"cacheSerializationMs":1.4402919999993173,"totalDurationMs":120.84412499999962,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":125.89850000000115,"cacheSerializationMs":0.860791999999492,"totalDurationMs":126.75929200000064,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":127.76337500000045,"cacheSerializationMs":0.5759170000001177,"totalDurationMs":128.33929200000057,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.7291669999995065,"cacheSerializationMs":0.3435829999998532,"totalDurationMs":2.0727499999993597,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":128.57666700000118,"cacheSerializationMs":0.5392920000012964,"totalDurationMs":129.11595900000248,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471123},"freshAfterAppend":{"durationMs":122.24304200000006,"cacheSerializationMs":1.5146249999997963,"totalDurationMs":123.75766699999986,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471123}}},{"arm":"baseline","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":126.25112499999886,"cacheSerializationMs":0.5498329999973066,"totalDurationMs":126.80095799999617,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.8312499999992724,"cacheSerializationMs":0.37704200000007404,"totalDurationMs":2.2082919999993464,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":133.79383400000006,"cacheSerializationMs":0.5662919999995211,"totalDurationMs":134.36012599999958,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":124.01150000000052,"cacheSerializationMs":1.5708330000015849,"totalDurationMs":125.58233300000211,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":124.88354199999958,"cacheSerializationMs":0.8082919999978913,"totalDurationMs":125.69183399999747,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470877},"warm":{"durationMs":1.4997919999987062,"cacheSerializationMs":0.31574999999793363,"totalDurationMs":1.8155419999966398,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470877},"append":{"durationMs":124.49562499999956,"cacheSerializationMs":0.6106660000004922,"totalDurationMs":125.10629100000006,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":123.00091599999723,"cacheSerializationMs":0.5265419999996084,"totalDurationMs":123.52745799999684,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":126.38366699999824,"cacheSerializationMs":0.5782920000019658,"totalDurationMs":126.9619590000002,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6679580000018177,"cacheSerializationMs":0.32950000000346336,"totalDurationMs":1.997458000005281,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":119.75370800000019,"cacheSerializationMs":1.8302089999997406,"totalDurationMs":121.58391699999993,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":126.44358399999692,"cacheSerializationMs":1.3055830000012065,"totalDurationMs":127.74916699999812,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":124.4443339999998,"cacheSerializationMs":0.5487500000017462,"totalDurationMs":124.99308400000155,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470877},"warm":{"durationMs":1.746500000001106,"cacheSerializationMs":0.3410829999993439,"totalDurationMs":2.08758300000045,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470877},"append":{"durationMs":125.15733399999954,"cacheSerializationMs":0.5478750000002037,"totalDurationMs":125.70520899999974,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"freshAfterAppend":{"durationMs":120.76379199999792,"cacheSerializationMs":2.555958000000828,"totalDurationMs":123.31974999999875,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124}}},{"arm":"baseline","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":123.25983300000007,"cacheSerializationMs":0.6032090000007884,"totalDurationMs":123.86304200000086,"bytesRead":43058202,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":470878},"warm":{"durationMs":1.6712079999997513,"cacheSerializationMs":0.36366699999780394,"totalDurationMs":2.0348749999975553,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":470878},"append":{"durationMs":124.21829199999775,"cacheSerializationMs":0.5536249999968277,"totalDurationMs":124.77191699999457,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471123},"freshAfterAppend":{"durationMs":119.58674999999857,"cacheSerializationMs":1.5122909999990952,"totalDurationMs":121.09904099999767,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471123}}}]},"current":{"phases":{"cold":{"durationMs":100.736,"cacheSerializationMs":0.911,"totalDurationMs":101.74,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.591,"cacheSerializationMs":0.792,"totalDurationMs":2.373,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.716,"cacheSerializationMs":0.793,"totalDurationMs":14.459,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":104.61,"cacheSerializationMs":0.992,"totalDurationMs":105.631,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}},"rawSamples":[{"arm":"current","round":1,"order":["baseline","current"],"phases":{"cold":{"durationMs":124.6869999999999,"cacheSerializationMs":0.9396660000002157,"totalDurationMs":125.62666600000011,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.6994580000009591,"cacheSerializationMs":0.8117090000014286,"totalDurationMs":2.511167000002388,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":15.27495799999997,"cacheSerializationMs":0.794832999999926,"totalDurationMs":16.069790999999896,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":101.50762500000019,"cacheSerializationMs":0.8825419999993755,"totalDurationMs":102.39016699999956,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}},{"arm":"current","round":2,"order":["current","baseline"],"phases":{"cold":{"durationMs":104.22795800000131,"cacheSerializationMs":0.8931250000005093,"totalDurationMs":105.12108300000182,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.5308750000003783,"cacheSerializationMs":0.8386250000003201,"totalDurationMs":2.3695000000006985,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":16.60279100000116,"cacheSerializationMs":0.7912089999990712,"totalDurationMs":17.394000000000233,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767011},"freshAfterAppend":{"durationMs":104.25937499999964,"cacheSerializationMs":1.0440419999995356,"totalDurationMs":105.30341699999917,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767011}}},{"arm":"current","round":3,"order":["baseline","current"],"phases":{"cold":{"durationMs":100.18904199999997,"cacheSerializationMs":0.9832499999993161,"totalDurationMs":101.17229199999929,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.6596250000002328,"cacheSerializationMs":0.7497919999987062,"totalDurationMs":2.409416999998939,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.672665999998571,"cacheSerializationMs":0.7290409999986878,"totalDurationMs":14.40170699999726,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":104.96137499999895,"cacheSerializationMs":0.9970000000012078,"totalDurationMs":105.95837500000016,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}},{"arm":"current","round":4,"order":["current","baseline"],"phases":{"cold":{"durationMs":98.64245799999844,"cacheSerializationMs":0.8834160000005795,"totalDurationMs":99.52587399999902,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.633417000000918,"cacheSerializationMs":0.7962919999990845,"totalDurationMs":2.4297090000000026,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.523083999998562,"cacheSerializationMs":0.741874999999709,"totalDurationMs":14.26495899999827,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":97.53412500000013,"cacheSerializationMs":0.9958330000008573,"totalDurationMs":98.52995800000099,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}},{"arm":"current","round":5,"order":["baseline","current"],"phases":{"cold":{"durationMs":99.79975000000195,"cacheSerializationMs":0.9283329999998386,"totalDurationMs":100.72808300000179,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.6002079999998386,"cacheSerializationMs":0.7347079999999551,"totalDurationMs":2.3349159999997937,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.760082999997394,"cacheSerializationMs":0.7562079999988782,"totalDurationMs":14.516290999996272,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":103.98912500000006,"cacheSerializationMs":0.9817089999996824,"totalDurationMs":104.97083399999974,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}},{"arm":"current","round":6,"order":["current","baseline"],"phases":{"cold":{"durationMs":101.28320800000074,"cacheSerializationMs":1.024333999997907,"totalDurationMs":102.30754199999865,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.5363330000000133,"cacheSerializationMs":0.7818749999969441,"totalDurationMs":2.3182079999969574,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.378416000003199,"cacheSerializationMs":0.8132080000032147,"totalDurationMs":14.191624000006414,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":106.71720800000185,"cacheSerializationMs":0.890584000000672,"totalDurationMs":107.60779200000252,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}},{"arm":"current","round":7,"order":["baseline","current"],"phases":{"cold":{"durationMs":99.39104199999929,"cacheSerializationMs":0.8712500000001455,"totalDurationMs":100.26229199999943,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.510167000000365,"cacheSerializationMs":0.7895409999982803,"totalDurationMs":2.2997079999986454,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.216374999999971,"cacheSerializationMs":0.835624999999709,"totalDurationMs":14.05199999999968,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767011},"freshAfterAppend":{"durationMs":105.75908300000083,"cacheSerializationMs":0.9883750000008149,"totalDurationMs":106.74745800000164,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767011}}},{"arm":"current","round":8,"order":["current","baseline"],"phases":{"cold":{"durationMs":104.5368329999983,"cacheSerializationMs":0.8444999999992433,"totalDurationMs":105.38133299999754,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":766620},"warm":{"durationMs":1.581625000002532,"cacheSerializationMs":0.7952079999995476,"totalDurationMs":2.3768330000020796,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":766620},"append":{"durationMs":13.903375000001688,"cacheSerializationMs":0.8032080000011774,"totalDurationMs":14.706583000002865,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013},"freshAfterAppend":{"durationMs":107.61383299999943,"cacheSerializationMs":1.0302080000001297,"totalDurationMs":108.64404099999956,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":767013}}}]}}} +{"keyScaling":[{"usageKeys":256,"historyBytes":34529726,"arms":{"baseline":{"durationMs":83.245,"cacheSerializationMs":0.023,"totalDurationMs":83.266,"bytesRead":34534456,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":8197},"current":{"durationMs":0.813,"cacheSerializationMs":0.017,"totalDurationMs":0.829,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":13780}}},{"usageKeys":4096,"historyBytes":36555744,"arms":{"baseline":{"durationMs":93.545,"cacheSerializationMs":0.342,"totalDurationMs":94.01,"bytesRead":36560492,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":114262},"current":{"durationMs":4.497,"cacheSerializationMs":0.22,"totalDurationMs":4.729,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":188966}}},{"usageKeys":16384,"historyBytes":43058202,"arms":{"baseline":{"durationMs":124.826,"cacheSerializationMs":0.564,"totalDurationMs":125.406,"bytesRead":43062968,"directReadBytes":0,"readCount":1,"streamCount":1,"cachedStateBytes":471124},"current":{"durationMs":13.716,"cacheSerializationMs":0.793,"totalDurationMs":14.459,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":767013}}}]} diff --git a/docs/bug-reproductions/usage-scan-append/hardening-summary.md b/docs/bug-reproductions/usage-scan-append/hardening-summary.md new file mode 100644 index 00000000000..a7a63f896a0 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/hardening-summary.md @@ -0,0 +1,72 @@ +# Usage scan hardening and remaining costs + +Claude keeps every historical ownership key and its five independent token maxima so an appended correction can update the original attribution. The final refinement shares unchanged tuple rows during an append, stores scalar or dense columns on disk, and validates source checkpoints on the usage worker. Main retains a separately protected aggregate report. The source/report split and `whenLoaded()` lifecycle came from upstream main; this PR adds the protected codec, source/report authority checks and guarded unchanged-source write reuse to that architecture. + +An unchanged source sidecar is retained only after schema 7 and its raw JSON checksum validate, normalization preserves every source, and the scanner returns identical file references in the same order and count. Changes, repairs and legacy upgrades write a new source generation. Report completion and report persistence still run. Raw checksums cover tiny unsigned source records as well as resumable checkpoints; source and report use different checksum domains. Corrupt sources force a cold scan while an independently valid report remains readable. A corrupt report clears its totals and explains the required rebuild. Tracking preferences survive both cases. + +Directory discovery distinguishes absent history from unreadable history. Permission and I/O failures reject the provider scan, preserving the previous completed totals and exposing an error. A deleted or genuinely absent directory remains valid absence. The [permission reproduction](./claude-discovery-coverage.json) demonstrates the earlier silent loss of a readable sibling session; deterministic error contracts cover environments where that POSIX permission experiment cannot run. + +## Final source and measurement scope + +The final artifacts compare published Claude PR commit `8467877ed92aba2ef59737aebf461e9cab52c273`, merged upstream main `b44a5796c1154de84efa25cc09f3dae2b61eb4b5`, and the frozen worktree. The [four-arm byte check](./claude-persisted-bytes-final.json) also includes original commit `51e7181850b022bae2d41091fe1229accef4bd50`. Every bundled project dependency comes from its named commit or the captured worktree snapshot. The [evidence receipt](./claude-resource-evidence-receipt.json) records tool/artifact hashes and verifies the complete source graphs after measurement. + +Six permutations balance the three timing arms across six rounds. The fixtures are scanner-cache cold and operating-system-page-cache warm. Production source-cache read/verification/decoding, scanning, source packing/checksumming/durable writes and report serialization/durable writes are measured in their production order. Durable writers include file sync and replacement. Timings exclude worker startup, IPC transport/queueing, telemetry, worktree discovery and rendering. They measure these operations, not whole-app speed. Every appended projection matches a fresh scan and the other arms' session/daily projections. + +## Actual persistence and refresh costs + +The [byte check](./claude-persisted-bytes-final.json) uses each arm's actual production layout and indentation. Totals include the report plus source sidecar where present. + +| Owned keys / maxima | Original full state | Published PR full state | Upstream main report + sources | Final report + sources | +| ------------------- | ------------------: | ----------------------: | -----------------------------: | ---------------------: | +| 16,384 / repeated | 620,849 B | 768,008 B | 472,318 B | 538,876 B | +| 100,000 / unique | 3,883,175 B | 6,327,802 B | 2,981,812 B | 6,128,046 B | + +The final representation is 29.8% smaller than the published PR at 16,384 repeated maxima and 3.2% smaller at 100,000 unique maxima. It is 14.1% and 105.5% larger than aggregate-only upstream main. The unique fixture has two attribution days, so all six columns are dense: one ownership-key list takes 2,977,781 bytes and the five maxima plus routing column take 3,145,041 bytes. There is no second key list to remove. At 16,384 repeated maxima, one correction expands one scalar column to a dense column; its exact values remain retained. No cap, dropped history or assumed correlation between counters hides this cost. + +The [16k](./claude-persistence-cost-final-16k.json) and [100k](./claude-persistence-cost-final-100k.json) artifacts include actual source and report persistence. Times below are complete measured-operation medians; individual phase medians need not add to their total median. + +| Owned keys / phase | Published PR | Upstream main | Final | +| --------------------------- | -----------: | ------------: | ---------: | +| 16,384 repeated / cold | 72.455 ms | 61.117 ms | 83.160 ms | +| 16,384 repeated / unchanged | 13.106 ms | 21.844 ms | 12.290 ms | +| 16,384 repeated / append | 28.000 ms | 61.131 ms | 28.876 ms | +| 100,000 unique / cold | 385.203 ms | 265.264 ms | 390.682 ms | +| 100,000 unique / unchanged | 34.915 ms | 36.950 ms | 30.662 ms | +| 100,000 unique / append | 128.631 ms | 267.204 ms | 84.152 ms | + +The guarded unchanged path writes zero source bytes in every recorded round. It still reads and validates 471,838 bytes or 6,126,038 bytes of source cache, and writes a 1,515-byte or 2,023-byte report. Dense cold scans remain slower than aggregate-only main. At 16k, the additional durable source/report commit offsets the faster append scanner relative to the published PR: 28.000 to 28.876 ms. At 100k, the final appended scanner takes 36.869 ms versus 105.960 ms in the published PR, and the complete measured append falls to 84.152 ms. These are visible tradeoffs, not universal speed claims. + +Transcript I/O and all cache I/O are different quantities. The 100k append reads 25,030 transcript bytes versus main's 47,323,259 bytes, but it also reads the 6,126,038-byte source sidecar. Total logical payload reads are therefore 6,151,068 bytes versus approximately 50,303,147 bytes, not a 99.9% reduction in all refresh traffic. Logical payload counts are not physical device I/O. + +## Readiness and remaining main-thread work + +The [readiness measurement](./claude-readiness-cost-final.json) uses the actual store lifecycle and prestarted Node workers calling the production splitter. Inactive telemetry/analytics/worktree paths throw if reached. Disabled history remains accessible after `whenLoaded()`, and main retains zero per-source records. + +For the one-session, 100k-key fixture, published synchronous loading takes 36.034 ms; upstream main's report-only load takes 0.092 ms and the final protected report takes 0.116 ms. Moving the source graph away from main is inherited upstream behavior, rather than a gain attributable solely to this PR. The final first inline migration takes 94.434 ms to become ready, versus 63.060 ms on upstream main; validation and source publication add worker work. Its initial legacy JSON read/parse still occupies main for an observed 8.752 ms. + +Worker unavailability preserves disabled history through a cooperative main fallback. The 100k legacy fixture yields 293 times, with a median maximum observed validation segment of 0.493 ms, but its initial legacy parse still occupies main for 8.574 ms. Those observations are not universal bounds: large metadata records, aggregate merging and sorting can remain synchronous. + +A separate 13,869,588-byte report with 13,222 distinct rollups exposes the remaining aggregate-report limit. Trusting validation of the exact worker-returned report text removes a repeated main checksum pass: the observed main segment falls from 21.393 to 16.512 ms. Main still parses the entire report; upstream main shows 16.690 ms for that parse path. Final readiness is 44.394 ms versus upstream's 39.592 ms, and main serialization plus checksum takes a median 20.628 ms versus upstream serialization's 16.183 ms. If the worker fails, report parse plus verification occupies main for an observed 22.326 ms. This diagnostic preserves an independently valid report with absent source cache and does not claim a generated transcript-corpus parity result. + +## Earlier measurements and persistent limits + +[comparison.jsonl](./comparison.jsonl), [hardening-comparison.jsonl](./hardening-comparison.jsonl), [claude-hardening-cost-16k.json](./claude-hardening-cost-16k.json), [claude-hardening-cost-100k.json](./claude-hardening-cost-100k.json) and [claude-cache-representation-final.json](./claude-cache-representation-final.json) retain earlier source/layout measurements. Their inline-cache loading costs predate the worker-owned protected sidecar. Captured hashes remain unchanged even where later scripts differ. Final costs come from the separate final artifacts above. + +The earlier canonical reader comparison documents the verification tradeoff: one thousand tiny changed files are read twice, while unchanged transcripts read zero bytes. Cold scanner time rose from 68.095 to 84.020 ms in that earlier run. Bounded head/boundary evidence remains an append-only check, not proof of an arbitrary unsampled middle rewrite that also grows the file. Same-length changes, replacement, truncation and invalid checkpoints fall back to full parsing. No automatic whole-corpus audit or new history-rebuild UI was added. + +Schema 7 fences older builds from interpreting protected columns as legacy inline state. Schema 6 remains an explicit migration path. Downgrading to an older build requires a cold rebuild before cached totals reappear; tracking preference remains preserved. Source/report write failures can cause a later colder scan, and one unreadable transcript still prevents a complete provider refresh. Checksum validation detects accidental inconsistency; it is not a signature against deliberate resealing. + +All per-source work belongs to the execution host. Public snapshots carry aggregate reports, rather than checkpoint arrays. The measurements do not establish Windows, SSH or whole-app latency improvements, and there are no machine-dependent timing gates. + +## Reproduce + +Run timing tools while builds, tests, apps and other benchmarks are idle: + +```sh +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persistence-cost-benchmark.mjs --usage-keys 16384 --maxima-pattern repeated --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persistence-cost-benchmark.mjs --usage-keys 100000 --maxima-pattern unique --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-readiness-cost-benchmark.mjs --usage-keys 100000 --large-report-mib 13 --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-persisted-bytes-check.mjs +``` + +Each accepts `--output`. Timing drivers accept `--published-ref` and `--main-ref`; defaults are the named immutable commits above. Equivalent environment-variable launchers work on Windows. The byte check uses fixed immutable refs and makes no timing claim. diff --git a/docs/bug-reproductions/usage-scan-append/pre-normalization.jsonl b/docs/bug-reproductions/usage-scan-append/pre-normalization.jsonl new file mode 100644 index 00000000000..e52500a441c --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/pre-normalization.jsonl @@ -0,0 +1,8 @@ +{"node":"v24.20.0","platform":"darwin","arch":"arm64","rounds":7,"verify":true} +{"scenario":"small-transcript-corpus","files":1000,"historyBytes":459780,"appendBytes":460780,"phases":{"cold":{"durationMs":141.933,"cacheSerializationMs":1.652,"totalDurationMs":143.585,"bytesRead":919560,"directReadBytes":459780,"readCount":2000,"streamCount":1000,"cachedStateBytes":1629225},"warm":{"durationMs":18.549,"cacheSerializationMs":1.545,"totalDurationMs":20.16,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1629225},"changed":{"durationMs":279.747,"cacheSerializationMs":1.622,"totalDurationMs":281.778,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632201},"freshAfterChange":{"durationMs":143.259,"cacheSerializationMs":1.832,"totalDurationMs":145.014,"bytesRead":1841120,"directReadBytes":920560,"readCount":2000,"streamCount":1000,"cachedStateBytes":1632201}}} +{"toolMiB":2,"usageKeys":256,"historyBytes":2284226,"appendBytes":4730,"phases":{"cold":{"durationMs":4,"cacheSerializationMs":0.097,"totalDurationMs":4.092,"bytesRead":2300610,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":97117},"warm":{"durationMs":0.434,"cacheSerializationMs":0.072,"totalDurationMs":0.504,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":97117},"append":{"durationMs":0.936,"cacheSerializationMs":0.077,"totalDurationMs":1.084,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":100110},"freshAfterAppend":{"durationMs":3.712,"cacheSerializationMs":0.09,"totalDurationMs":3.808,"bytesRead":2305340,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":100110}}} +{"toolMiB":32,"usageKeys":256,"historyBytes":34529726,"appendBytes":4730,"phases":{"cold":{"durationMs":58.765,"cacheSerializationMs":0.091,"totalDurationMs":58.86,"bytesRead":34546110,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":97119},"warm":{"durationMs":0.387,"cacheSerializationMs":0.073,"totalDurationMs":0.462,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":97119},"append":{"durationMs":1.638,"cacheSerializationMs":0.087,"totalDurationMs":1.747,"bytesRead":29306,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":100112},"freshAfterAppend":{"durationMs":45.341,"cacheSerializationMs":0.094,"totalDurationMs":45.431,"bytesRead":34550840,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":100112}}} +{"scaling":{"historyByteRatio":15.116597919820544,"appendReadByteRatio":1,"appendDurationRatio":1.7499999999999998,"cachedStateByteRatio":1.0000199780241734},"exactColdParity":true} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":4096,"historyBytes":36555744,"appendBytes":4748,"phases":{"cold":{"durationMs":49.091,"cacheSerializationMs":1.924,"totalDurationMs":50.952,"bytesRead":36572128,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":1541841},"warm":{"durationMs":0.64,"cacheSerializationMs":1.162,"totalDurationMs":1.858,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":1541841},"append":{"durationMs":3.662,"cacheSerializationMs":1.173,"totalDurationMs":4.835,"bytesRead":29324,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":1544866},"freshAfterAppend":{"durationMs":60.551,"cacheSerializationMs":1.752,"totalDurationMs":62.302,"bytesRead":36576876,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":1544866}}} +{"scenario":"usage-key-scaling","toolMiB":32,"usageKeys":16384,"historyBytes":43058202,"appendBytes":4766,"phases":{"cold":{"durationMs":101.024,"cacheSerializationMs":5.612,"totalDurationMs":106.636,"bytesRead":43074586,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":6199968},"warm":{"durationMs":1.797,"cacheSerializationMs":4.363,"totalDurationMs":6.167,"bytesRead":0,"directReadBytes":0,"readCount":0,"streamCount":0,"cachedStateBytes":6199968},"append":{"durationMs":13.105,"cacheSerializationMs":4.306,"totalDurationMs":17.431,"bytesRead":29342,"directReadBytes":24576,"readCount":7,"streamCount":1,"cachedStateBytes":6203025},"freshAfterAppend":{"durationMs":100.886,"cacheSerializationMs":6.06,"totalDurationMs":106.946,"bytesRead":43079352,"directReadBytes":16384,"readCount":5,"streamCount":1,"cachedStateBytes":6203025}}} +{"keyScaling":[{"usageKeys":256,"historyBytes":34529726,"appendReadBytes":29306,"appendDurationMs":1.638,"appendCacheSerializationMs":0.087,"appendTotalDurationMs":1.747,"cachedStateBytes":100112},{"usageKeys":4096,"historyBytes":36555744,"appendReadBytes":29324,"appendDurationMs":3.662,"appendCacheSerializationMs":1.173,"appendTotalDurationMs":4.835,"cachedStateBytes":1544866},{"usageKeys":16384,"historyBytes":43058202,"appendReadBytes":29342,"appendDurationMs":13.105,"appendCacheSerializationMs":4.306,"appendTotalDurationMs":17.431,"cachedStateBytes":6203025}]} diff --git a/docs/bug-reproductions/usage-scan-append/source-compression.md b/docs/bug-reproductions/usage-scan-append/source-compression.md new file mode 100644 index 00000000000..0d5df12a11f --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/source-compression.md @@ -0,0 +1,25 @@ +# Smaller saved Claude usage data + +The previous PR used more disk to remember previously counted usage. This follow-up losslessly compresses only the worker-owned source cache with asynchronous gzip level 1. The displayed report, every historical total, integrity checks and atomic file-write sequence stay intact. + +| Test history | Main disk | Previous PR disk | Compressed disk | Main update | Previous PR update | Compressed update | +| --------------------------------- | --------: | ---------------: | --------------: | ----------: | -----------------: | ----------------: | +| 16,384 repeated entries | 472 KB | 539 KB | 84 KB | 60 ms | 28 ms | 30 ms | +| 100,000 distinct entries | 2.98 MB | 6.13 MB | 1.60 MB | 260 ms | 83 ms | 97 ms | +| 100,000 less-compressible entries | 6.80 MB | 10.46 MB | 5.39 MB | 276 ms | 103 ms | 224 ms | + +Decimal sizes include the saved source cache and report. Each row uses six counterbalanced rounds of the complete measured processing/persistence path, checked against a full recount. Baselines are main `b44a5796` and published PR `4102ea91`. These are fixture measurements, not whole-app latency or a universal disk-size guarantee. + +Compression trades CPU for space. Full rebuilds measured 82 vs main's 62 ms, 410 vs 261 ms, and 533 vs 281 ms in these three fixtures. Unchanged refreshes measured 13 vs 22 ms, 37 vs 38 ms, and 60 vs 47 ms. Less-compressible data can therefore slow unchanged refreshes despite saving space. Unchanged source caches still incur zero writes. + +Small caches stay plain. Compression is kept only when smaller than this PR's plain representation. Sources exceeding 128 MiB stay plain, preserving history and existing cache reuse. Compressed reads validate the decoded size, bound expansion, and then apply the same independent source integrity checks. Truncation, corruption, inconsistent concatenated output and forged sizes are rejected. Existing plain caches remain readable. Older Orca versions skip the optional compressed source cache and can rebuild it; their independently valid displayed report remains available. Writes capture their destination and workspace binding before awaiting compression. A test changes the caller's binding mid-write and verifies that only the original destination is written. No public wire format changes. + +[Evidence receipt](./claude-source-compression-receipt.json) links raw samples and source hashes. Earlier measurement files describe the previous uncompressed implementation and remain historical evidence. Integration with current main updates benchmark subprocess imports to the existing `@orca/process-host` package; captured source and tooling hashes retain their original measurement provenance. + +Reproduce: + +```bash +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-source-compression-benchmark.mjs --usage-keys 16384 --maxima-pattern repeated --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-source-compression-benchmark.mjs --usage-keys 100000 --maxima-pattern unique --rounds 6 +ORCA_BACKGROUND_LAUNCH=1 node config/scripts/claude-usage-source-compression-benchmark.mjs --usage-keys 100000 --maxima-pattern varied --rounds 6 +``` diff --git a/docs/bug-reproductions/usage-scan-append/validation.json b/docs/bug-reproductions/usage-scan-append/validation.json new file mode 100644 index 00000000000..36c62511ff5 --- /dev/null +++ b/docs/bug-reproductions/usage-scan-append/validation.json @@ -0,0 +1,95 @@ +{ + "recordedAt": "2026-10-09T18:44:37.457961+00:00", + "baselineCommit": "51e7181850b022bae2d41091fe1229accef4bd50", + "executionHost": "Darwin", + "sourceSha256": { + "config/scripts/claude-usage-append-benchmark.mjs": "b171806ba5f58ce1ae4d2ea701be973505e7bfa27774f99d5c2408402a97f891", + "config/scripts/claude-usage-benchmark-scanner.mjs": "ffb6e5defb921f2ab35726a716f5e731dec439ead53cc2f3a192c7bef4df45d3", + "config/scripts/codex-usage-parser-memory-benchmark.mjs": "434e9818f8d8b132603912b104560a000e9e2635a2564cf65ae7e87cff483a1a", + "config/scripts/native-chat-tool-pairing-benchmark.mjs": "fa529dfb83db216bff9121240dccc7a8c7a1f5a88fb4c25e8a7c2abe8d65f062", + "config/vitest.performance.config.ts": "e548a19a39e3ad748a4ab29b93dae7d933f99c9913dc332c803e5b484815b65c", + "src/main/claude-usage/scanner-incremental-append.test.ts": "008548702f50700cb94aa6f729c9fd99c2fa06becb238f695132de4fb8b0a62d", + "src/main/claude-usage/scanner-incremental-ownership.test.ts": "e96be4afb64ad1bf1368f8f6cf85cd7a3d84140b4201d44f14759b8113d2e411", + "src/main/claude-usage/scanner-incremental-reader.test.ts": "cafe02b9015dd107b2ef0530415cbe354cc57811a43a892843456a2578865e1d", + "src/main/claude-usage/scanner.ts": "ef42add20f63152cf2ebe106e0794119b9c388c763736c8450b559ae7c2418f5", + "src/main/claude-usage/transcript-record-parser.ts": "d4fab89434c1b6c60480a561310542246be34ef86bc13da0340c1dfdbb269854", + "src/main/claude-usage/transcript-resume-projection.ts": "4828655a59454ee38ae46495ace531b6f149f8674c7d27828d2bbace1c549fd6", + "src/main/claude-usage/transcript-token-checkpoint.ts": "e96cc4aa9b899cad90aee462f053f483f5bb010dea99de1ee11a9f8fd8a2d0f2", + "src/main/claude-usage/transcript-usage-projection.ts": "41a1c8b86244efc60e92adb1368393ed52b0bf8773e26e38a0d018780486123b", + "src/main/claude-usage/types.ts": "12fa821ed77cec8888757b9556738aa4722d81cce97b8b94fa77f62ba8a1ecff", + "src/main/codex-usage/codex-rollout-file-parse.ts": "6e4937105fc9cf8457b79ac16bcfc71f706f22a87e036166bd461aeea8c07fdc", + "src/main/codex-usage/codex-rollout-resume-state.ts": "aa028d2155b7744c0d961c5649537faa20c39bfe404dea8d9c4c1464d11a0e39", + "src/main/codex-usage/scanner-checkpoint-races.test.ts": "f6f90a5967b297c2a0dfe5eb9d4acfe3257ef1e794a709501d1cdf29092dc379", + "src/main/codex-usage/scanner-file-generation.test.ts": "76c1620b4f0cfa793f21a8c67ea298b00a44692e7c6b1bb18d92048599288581", + "src/main/codex-usage/scanner-file-identity.test.ts": "7ff12e654fc20dbac8189947ca5e35151291ea4cda60398b0fb1d4d8d5e7b751", + "src/main/codex-usage/scanner-incremental-append.test.ts": "a06685d3b451b20d8d94023d6e35ba30aef83831f95192fed34433314342b938", + "src/main/codex-usage/scanner.ts": "8221f7420ddaae20a94a6c14421bc688d659f82daf85eb47bbe26760418c41a5", + "src/main/codex-usage/types.ts": "84bfd3976613b6a775d215fa54f00917cabb981be780d4837c92d43f7cb0a036", + "src/main/native-chat/transcript-line-decoders-codex.ts": "cbd4133da04988a9b86015349411a679a5b1b513738a7c10bf165869c49e05e4", + "src/main/native-chat/transcript-record-blocks.ts": "110990b4d8ebd6f28ea8702de92568fff5af398bffa5dafdb81d93b65f7da594", + "src/main/native-chat/transcript-tool-result-identity.test.ts": "4080f77a5cf7d035cbd69cfd9fd491113f23ef31485f2085e5d0cfabdd90f366", + "src/main/native-chat/transcript-window-tool-attribution.test.ts": "f62b5208890d8fe7b1d0a7659e12b13e4c8d4ecbf81ae97046012106faaf8c48", + "src/main/usage/jsonl-file-checkpoint.ts": "8eb579f356e1bb23b36319f00b3d4603fff80a963222dcb8a22331319cab3a03", + "src/main/usage/jsonl-file-snapshot.ts": "1bd98ac194f73097cd6c204238fe1db01e1e0d60a604e93c1d7841725971fe0d", + "src/main/usage/jsonl-line-offsets.ts": "f119465fad3771acd72b128853e84eed9165f0f74b75743ad662aa5bab991273", + "src/main/usage/usage-breakdown-scaling.test.ts": "128438475fac16436ffa39776c041ef1ef59ac9dcc4f9cee67a2fd124a5f18a2", + "src/main/usage/usage-event-aggregation.ts": "31adda2e8e0a32756416fb49b2c3e02c707703bfe76434aabc95c61a7efd180b", + "src/shared/native-chat-tool-fold-attribution.test.ts": "cd80f8d13ef8794946378a108392efcb6adce00a2f108ddca852516f31424564", + "src/shared/native-chat-tool-fold.ts": "3d75ee82c5c09bc796caef4d5127d55b3d291c03d3090f10a204622188aaba4a", + "src/shared/native-chat-tool-pairing.performance.test.ts": "5c02cb5f5242d71db91de142ec309864637e5f4788f187ec18814a16afaacb1e", + "src/shared/native-chat-tool-pairs.ts": "6be4c6ac899c275362658ac69478cd3b71dec97b0cd59520f71eb5e1dfc093b4", + "tests/e2e/helpers/store.ts": "82807c85d54f68bf4347ac37dee04a6112eae84521f3f597f883728df4627dea", + "tests/e2e/native-chat-tool-pairing.spec.ts": "053c667589d433b403f5d2a5758079f0edaf3d7598ee318c8d0c30652963bc2c" + }, + "integrated": { + "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/claude-usage src/main/codex-usage src/main/usage src/main/native-chat src/shared/native-chat src/renderer/src/components/native-chat", + "filesPassed": 839, + "testsPassed": 8278, + "existingTodo": 5, + "seconds": 58.06, + "exitCode": 0, + "scope": "Relevant provider usage, shared usage, native chat host/shared/renderer suites; not the full repository test suite." + }, + "performanceContracts": { + "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm test:perf:contracts", + "filesPassed": 14, + "testsPassed": 118, + "seconds": 4.68, + "exitCode": 0, + "ciPlatformsConfigured": ["Linux", "macOS", "Windows"], + "executedHere": "macOS" + }, + "typecheck": { + "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm tc", + "exitCode": 0 + }, + "changedQuality": { + "command": "ORCA_BACKGROUND_LAUNCH=1 ORCA_CODE_QUALITY_BASE=51e7181850b022bae2d41091fe1229accef4bd50 pnpm run check:code-quality:changed", + "sourceFiles": 37, + "newFindings": 0, + "exitCode": 0 + }, + "formatting": { + "command": "pnpm exec oxfmt --check <37 changed .ts/.tsx/.mjs files>", + "files": 37, + "exitCode": 0 + }, + "sourceAudit": { + "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --silent audit:perf", + "productionFindings": 0, + "existingTestFixtureFindings": 1, + "fixture": "src/shared/relay-frame-buffer.test.ts", + "exitCode": 0 + }, + "evidenceHashVerification": { + "renderAndUsageComparisons": 44, + "memoryComparisons": 21, + "mismatches": 0 + }, + "renderedEvidence": "https://github.com/stablyai/orca/blob/nwparker/perf-native-chat-tool-pairing/docs/bug-reproductions/native-chat-tool-pairing/rendered-validation.json", + "usageComparison": "comparison.jsonl", + "memoryComparison": "codex-parser-memory.json", + "independentReviews": "Pair identity/order and orphan indices; append/cold parity; duplicate maxima and first attribution; ownership recovery; pinned generation/coverage/cleanup; aggregation compatibility; benchmark instrumentation and provenance.", + "limits": "Timings measure pairing/scanner functions. Memory measures sampled retained heap under forced GC. Bounded append-only evidence cannot prove arbitrary middle-only rewrites during growth. No mobile or real SSH transport latency measurement.", + "sourceSnapshotScope": "Recorded from the combined usage-reader/Codex, Claude-append and chat-pairing worktree. Production source was preserved byte-for-byte when split into separate PRs; this is not an individual PR tip record." +} diff --git a/src/main/claude-usage/persisted-projection-validation.ts b/src/main/claude-usage/persisted-projection-validation.ts new file mode 100644 index 00000000000..2e0b1e66f6b --- /dev/null +++ b/src/main/claude-usage/persisted-projection-validation.ts @@ -0,0 +1,207 @@ +import type { + ClaudeUsageDailyAggregate, + ClaudeUsagePersistedFile, + ClaudeUsagePersistedState, + ClaudeUsageSession +} from './types' +import { iterateClaudeUsageResumeProjection } from './transcript-resume-projection' +import { decodeClaudeUsagePersistedFile } from './persisted-token-columns' +import { yieldToEventLoop } from '../../shared/event-loop-yield' +import { + finalizeClaudeSessions, + mergeClaudeDailyAggregates, + mergeClaudeSessions +} from './usage-aggregation' + +export type ClaudeUsageValidatedSources = { + processedFiles: ClaudeUsagePersistedFile[] + resumable: Set + invalidated: boolean +} +export type ClaudeUsageVerifiedSources = Pick, 'has'> + +function invalidateSavedProjections( + state: ClaudeUsagePersistedState, + processedFiles: ClaudeUsagePersistedState['processedFiles'] +): ClaudeUsagePersistedState { + return { + ...state, + processedFiles, + sessions: [], + dailyAggregates: [], + scanState: { + ...state.scanState, + lastScanCompletedAt: null, + lastScanError: 'Saved usage totals could not be validated. Refresh to rebuild them.' + } + } +} + +export function hasClaudeUsageProtectedCheckpoint(file: ClaudeUsagePersistedFile): boolean { + if (!file) { + return true + } + const checkpoint = file.parseResumeState + if (checkpoint === undefined || checkpoint === null) { + return false + } + return ( + typeof checkpoint !== 'object' || + Array.isArray(checkpoint) || + checkpoint.projectionIntegrity !== undefined || + 'tokenCodecVersion' in checkpoint || + 'ownedTokenColumns' in checkpoint + ) +} + +function requiresValidation(state: ClaudeUsagePersistedState): boolean { + try { + return state.processedFiles.some(hasClaudeUsageProtectedCheckpoint) + } catch { + return true + } +} + +export function* iterateClaudeUsageSourceValidation( + files: ClaudeUsagePersistedFile[], + verifiedSources?: ClaudeUsageVerifiedSources +): Generator { + const processedFiles: ClaudeUsagePersistedFile[] = [] + const resumable = new Set() + let invalidated = false + for (let index = 0; index < files.length; index++) { + let file = files[index] + try { + if ( + !file || + typeof file.path !== 'string' || + !Array.isArray(file.sessions) || + !Array.isArray(file.dailyAggregates) || + !Array.isArray(file.ownedDedupeKeys) || + typeof file.hasDeferredClaims !== 'boolean' + ) { + throw new Error('Saved Claude usage source projection is invalid.') + } + const checkpoint = file.parseResumeState + const verified = verifiedSources?.has(file) ?? false + const packed = Boolean( + checkpoint && ('tokenCodecVersion' in checkpoint || 'ownedTokenColumns' in checkpoint) + ) + file = yield* decodeClaudeUsagePersistedFile(file) + if (verified && files[index] !== file) { + // Verified inputs are the worker's private parsed array; release packed columns as decoded. + files[index] = file + } + if ( + (packed || file.parseResumeState?.projectionIntegrity !== undefined) && + !verified && + !(yield* iterateClaudeUsageResumeProjection(file)) + ) { + throw new Error('Saved Claude usage source integrity is invalid.') + } + processedFiles.push(file) + if (typeof file.parseResumeState?.projectionIntegrity === 'string') { + resumable.add(file) + } + } catch { + invalidated = true + } + if ((index + 1) % 4 === 0) { + yield + } + } + // Lost owners require deferred forks to reclaim their copied records on the next scan. + return { + processedFiles: invalidated + ? processedFiles.filter((file) => !file.hasDeferredClaims) + : processedFiles, + resumable, + invalidated + } +} + +export function normalizeClaudeUsageSourceFiles( + files: ClaudeUsagePersistedFile[], + verifiedSources?: ClaudeUsageVerifiedSources +): ClaudeUsageValidatedSources { + const iterator = iterateClaudeUsageSourceValidation(files, verifiedSources) + while (true) { + const next = iterator.next() + if (next.done) { + return next.value + } + } +} + +function* validateSavedProjections( + state: ClaudeUsagePersistedState +): Generator { + if (!requiresValidation(state)) { + return state + } + const { processedFiles, invalidated } = yield* iterateClaudeUsageSourceValidation( + state.processedFiles + ) + if (invalidated) { + return invalidateSavedProjections(state, processedFiles) + } + const sessions = new Map() + const daily = new Map() + for (const [index, file] of processedFiles.entries()) { + mergeClaudeSessions(sessions, file.sessions) + mergeClaudeDailyAggregates(daily, file.dailyAggregates) + if ((index + 1) % 4 === 0) { + yield + } + } + return { + ...state, + processedFiles, + sessions: finalizeClaudeSessions(sessions), + dailyAggregates: [...daily.values()].sort((a, b) => + a.day === b.day ? a.projectLabel.localeCompare(b.projectLabel) : a.day.localeCompare(b.day) + ), + scanState: state.scanState + } +} + +export function validatePersistedClaudeUsageProjections( + state: ClaudeUsagePersistedState +): ClaudeUsagePersistedState { + try { + const iterator = validateSavedProjections(state) + while (true) { + const next = iterator.next() + if (next.done) { + return next.value + } + } + } catch { + // Malformed cache records must not reset the user's tracking preference. + return invalidateSavedProjections(state, []) + } +} + +async function initializeSavedProjections( + state: ClaudeUsagePersistedState +): Promise { + await yieldToEventLoop() + try { + const iterator = validateSavedProjections(state) + while (true) { + const next = iterator.next() + if (next.done) { + return next.value + } + await yieldToEventLoop() + } + } catch { + return invalidateSavedProjections(state, []) + } +} + +export function initializePersistedClaudeUsageProjections( + state: ClaudeUsagePersistedState +): ClaudeUsagePersistedState | Promise { + return requiresValidation(state) ? initializeSavedProjections(state) : state +} diff --git a/src/main/claude-usage/persisted-source-authority.test.ts b/src/main/claude-usage/persisted-source-authority.test.ts new file mode 100644 index 00000000000..8059fc983ac --- /dev/null +++ b/src/main/claude-usage/persisted-source-authority.test.ts @@ -0,0 +1,266 @@ +import { appendFile, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import type { ClaudeUsagePersistedFile, ClaudeUsagePersistedState } from './types' +import { scanClaudeUsageFiles } from './scanner' +import { readClaudeUsageScanFile } from './transcript-record-parser' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import { parseClaudeUsageReport, serializeClaudeUsageReport } from './persisted-usage-report' +import { + readClaudeUsageSourceCache, + splitClaudeUsageCacheFile, + writeClaudeUsageSourceCache +} from './persisted-source-cache' +import { sealUsageCacheJson } from '../usage/usage-cache-json-integrity' +import { + compressClaudeUsageSourceText, + decodeClaudeUsageSourceText +} from './source-cache-compression' +import { readUsageSourceCache } from '../usage/usage-source-cache-file' + +const { discovered } = vi.hoisted(() => { + const discovered: { paths: string[] } = { paths: [] } + return { discovered } +}) +vi.mock('./transcript-file-discovery', () => ({ + listClaudeTranscriptFiles: async () => discovered.paths +})) + +let directory: string +let transcript: string +let sourcePath: string + +function row(input: number): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'authority', + requestId: 'request', + timestamp: '2026-10-09T12:00:00.000Z', + message: { id: 'message', usage: { input_tokens: input, output_tokens: 2 } } + })}\n` +} + +function ref() { + return { path: sourcePath, schemaVersion: 7, worktreeFingerprint: '[]', reuse: true } +} + +function state(file: ClaudeUsagePersistedFile, schemaVersion = 7): ClaudeUsagePersistedState { + return { + schemaVersion, + worktreeFingerprint: '[]', + processedFiles: [file], + sessions: structuredClone(file.sessions), + dailyAggregates: structuredClone(file.dailyAggregates), + scanState: { enabled: false, lastScanStartedAt: 1, lastScanCompletedAt: 2, lastScanError: null } + } +} + +async function fixture(large = true): Promise { + await writeFile( + transcript, + `${large ? `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n` : ''}${row(100)}` + ) + return projectClaudeUsageScanFile( + await readClaudeUsageScanFile(transcript), + new Map(), + () => true + ) +} + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'orca-claude-source-authority-')) + transcript = join(directory, 'session.jsonl') + sourcePath = join(directory, 'usage-sources.json') + discovered.paths = [transcript] +}) +afterEach(async () => { + await rm(directory, { recursive: true, force: true }) +}) + +it('uses a verified packed restart for exact append corrections', async () => { + const original = await fixture() + await writeClaudeUsageSourceCache(ref(), [original]) + const cached = await readClaudeUsageSourceCache(ref()) + expect(cached.sources).toEqual([original]) + expect(cached.verifiedSources?.has(cached.sources[0])).toBe(true) + await appendFile(transcript, row(150)) + + const resumed = await scanClaudeUsageFiles( + [], + cached.sources, + undefined, + [], + cached.verifiedSources + ) + const cold = await scanClaudeUsageFiles([], [], undefined, []) + + expect(resumed.sessions).toEqual(cold.sessions) + expect(resumed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(resumed.sessions[0]?.turnCount).toBe(1) + expect(resumed.sessions[0]?.totalInputTokens).toBe(150) +}) + +it('compresses large caches losslessly and resumes the same totals after restart', async () => { + const rows = Array.from({ length: 3000 }, (_, index) => + row(index).replace('"request"', `"request-${index}"`) + ).join('') + await writeFile(transcript, rows) + const cold = await scanClaudeUsageFiles([], [], undefined, []) + const mutableRef = ref() + const pending = writeClaudeUsageSourceCache(mutableRef, cold.processedFiles) + mutableRef.path = join(directory, 'different-cache.json') + mutableRef.worktreeFingerprint = '["different-workspace"]' + await pending + await expect(readFile(mutableRef.path)).rejects.toMatchObject({ code: 'ENOENT' }) + const text = await readFile(sourcePath) + expect([...text.subarray(0, 2)]).toEqual([0x1f, 0x8b]) + const decoded = await decodeClaudeUsageSourceText(text) + expect(Buffer.byteLength(text)).toBeLessThan(Buffer.byteLength(decoded)) + const cached = await readClaudeUsageSourceCache(ref()) + expect(cached.sources).toEqual(cold.processedFiles) + expect(cached.verifiedSources?.has(cached.sources[0])).toBe(true) + + await appendFile(transcript, row(4000).replace('"request"', '"request-7"')) + const resumed = await scanClaudeUsageFiles( + [], + cached.sources, + undefined, + [], + cached.verifiedSources + ) + expect(resumed).toEqual(await scanClaudeUsageFiles([], [], undefined, [])) + // Older readers discard the optional resume cache; the separately stored report stays readable. + expect(await readUsageSourceCache(ref())).toEqual([]) +}) + +it('keeps old plain caches readable and rejects compressed content with invalid integrity', async () => { + await writeFile( + transcript, + Array.from({ length: 3000 }, (_, index) => + row(index).replace('"request"', `"request-${index}"`) + ).join('') + ) + const cold = await scanClaudeUsageFiles([], [], undefined, []) + await writeClaudeUsageSourceCache(ref(), cold.processedFiles) + const decoded = await decodeClaudeUsageSourceText(await readFile(sourcePath)) + await writeFile(sourcePath, decoded) + expect((await readClaudeUsageSourceCache(ref())).sources).toEqual(cold.processedFiles) + const report = serializeClaudeUsageReport(state(cold.processedFiles[0])) + const damaged = JSON.parse(decoded) + damaged.sources[0].sessions[0].totalInputTokens++ + await writeFile(sourcePath, await compressClaudeUsageSourceText(JSON.stringify(damaged))) + expect(await readClaudeUsageSourceCache(ref())).toEqual({ sources: [] }) + expect(await parseClaudeUsageReport(report, JSON.parse(report))).toEqual(JSON.parse(report)) +}) + +it('protects tiny source rollups despite their absent resume checkpoint', async () => { + const original = await fixture(false) + expect(original.parseResumeState).toBeNull() + await writeClaudeUsageSourceCache(ref(), [original]) + const saved = JSON.parse(await readFile(sourcePath, 'utf8')) + saved.sources[0].sessions[0].totalInputTokens++ + await writeFile(sourcePath, JSON.stringify(saved)) + + const rejected = await readClaudeUsageSourceCache(ref()) + expect(rejected.sources).toEqual([]) + const rebuilt = await scanClaudeUsageFiles([], rejected.sources, undefined, []) + expect(rebuilt.sessions).toEqual(original.sessions) +}) + +it('rejects same-stat direct scanner corruption without a raw-envelope proof', async () => { + const original = await fixture() + const checkpoint = original.parseResumeState + if (!checkpoint) { + throw new Error('Expected a resumable fixture.') + } + checkpoint.ownedTokenMaxima[0][0]-- + const forged = { ...original, usageIntegrity: 'pretend-proof', schemaVersion: 7 } + + const rebuilt = await scanClaudeUsageFiles([], [forged], undefined, []) + + expect(rebuilt.sessions[0]?.totalInputTokens).toBe(100) + expect(rebuilt.sessions[0]?.turnCount).toBe(1) +}) + +it.each(['missing', 'null', 'number', 'pretty', 'domain'] as const)( + 'starts cold for %s source framing', + async (corruption) => { + const original = await fixture() + await writeClaudeUsageSourceCache(ref(), [original]) + const text = await readFile(sourcePath, 'utf8') + const saved = JSON.parse(text) + if (corruption === 'missing') { + delete saved.usageIntegrity + } + if (corruption === 'null') { + saved.usageIntegrity = null + } + if (corruption === 'number') { + saved.usageIntegrity = 7 + } + const damaged = + corruption === 'domain' + ? serializeClaudeUsageReport(state(original)) + : JSON.stringify(saved, null, corruption === 'pretty' ? 2 : undefined) + await writeFile(sourcePath, damaged) + + expect((await readClaudeUsageSourceCache(ref())).sources).toEqual([]) + } +) + +it('does not present a corrupt future completion as fresh report history', async () => { + const original = await fixture() + const saved = JSON.parse(serializeClaudeUsageReport(state(original))) + saved.scanState.lastScanCompletedAt = Date.now() + 86_400_000 + + const rejected = await parseClaudeUsageReport(JSON.stringify(saved)) + + expect(rejected.sessions).toEqual([]) + expect(rejected.scanState).toMatchObject({ enabled: false, lastScanCompletedAt: null }) + expect(rejected.scanState.lastScanError).toContain('could not be validated') +}) + +it('retains genuine unsigned schema6 reports without promoting their lineage', async () => { + const original = await fixture(false) + const legacy = state(original, 6) + const text = serializeClaudeUsageReport(legacy) + + expect(text).not.toContain('usageIntegrity') + expect(await parseClaudeUsageReport(text)).toMatchObject({ + schemaVersion: 6, + sessions: original.sessions + }) +}) + +it('does not seal arbitrary unprotected schema7 inline totals during migration', async () => { + const original = await fixture(false) + const cacheFile = join(directory, 'usage.json') + await writeFile(cacheFile, JSON.stringify(state(original))) + + const split = await splitClaudeUsageCacheFile({ + cacheFile, + sourceKey: 'processedFiles', + providerId: 'claude' + }) + const report = await parseClaudeUsageReport(split.reportText ?? '') + + expect(report.sessions).toEqual([]) + expect(report.scanState).toMatchObject({ enabled: false, lastScanCompletedAt: null }) + expect(report.scanState.lastScanError).toContain('could not be validated') +}) + +it('rejects a source envelope stamped for an unsupported producer schema', async () => { + const original = await fixture() + const material = JSON.stringify({ + schemaVersion: 6, + worktreeFingerprint: '[]', + sources: [original] + }) + await writeFile(sourcePath, sealUsageCacheJson(material, 'claude-usage-sources-v1')) + expect((await readClaudeUsageSourceCache(ref())).sources).toEqual([]) +}) + +it('rejects empty-object integrity material rather than emitting invalid JSON', () => { + expect(() => sealUsageCacheJson('{}', 'test')).toThrow('requires a JSON object') +}) diff --git a/src/main/claude-usage/persisted-source-cache.ts b/src/main/claude-usage/persisted-source-cache.ts new file mode 100644 index 00000000000..e1c60cec361 --- /dev/null +++ b/src/main/claude-usage/persisted-source-cache.ts @@ -0,0 +1,156 @@ +import { readFile } from 'node:fs/promises' +import type { ClaudeUsagePersistedFile, ClaudeUsagePersistedState } from './types' +import { encodeClaudeUsagePersistedFiles } from './persisted-token-columns' +import { + compressClaudeUsageSourceText, + decodeClaudeUsageSourceText +} from './source-cache-compression' +import { + hasClaudeUsageProtectedCheckpoint, + normalizeClaudeUsageSourceFiles, + type ClaudeUsageVerifiedSources +} from './persisted-projection-validation' +import { parseClaudeUsageReport, serializeClaudeUsageReport } from './persisted-usage-report' +import { sealUsageCacheJson, verifyUsageCacheJson } from '../usage/usage-cache-json-integrity' +import { + usageSourceCachePath, + writeUsageSourceCacheData, + type UsageCacheSplitRequest, + type UsageCacheSplitResult, + type UsageSourceCacheRef +} from '../usage/usage-source-cache-file' + +const SOURCE_DOMAIN = 'claude-usage-sources-v1' + +export type ClaudeUsageLoadedSourceCache = { + sources: ClaudeUsagePersistedFile[] + verifiedSources?: ClaudeUsageVerifiedSources + unchangedSourceCache?: { + ref: UsageSourceCacheRef + sources: readonly ClaudeUsagePersistedFile[] + } +} + +export async function readClaudeUsageSourceCache( + ref: UsageSourceCacheRef +): Promise { + const cacheRef = { ...ref } + if (!cacheRef.reuse) { + return { sources: [] } + } + try { + const text = await decodeClaudeUsageSourceText(await readFile(cacheRef.path)) + const parsed = JSON.parse(text) + const verified = verifyUsageCacheJson(text, parsed?.usageIntegrity, SOURCE_DOMAIN) + if ( + (parsed?.schemaVersion !== cacheRef.schemaVersion && + !(cacheRef.schemaVersion === 7 && parsed?.schemaVersion === 6)) || + parsed.worktreeFingerprint !== cacheRef.worktreeFingerprint || + !Array.isArray(parsed.sources) || + (parsed.schemaVersion === 7 && !verified) || + (parsed.schemaVersion === 6 && verified) + ) { + return { sources: [] } + } + if (verified) { + const normalized = normalizeClaudeUsageSourceFiles( + parsed.sources, + new WeakSet(parsed.sources) + ) + return { + sources: normalized.processedFiles, + verifiedSources: new WeakSet(normalized.processedFiles), + unchangedSourceCache: + !normalized.invalidated && + normalized.processedFiles.length === parsed.sources.length && + normalized.processedFiles.every((file, index) => file === parsed.sources[index]) + ? { ref: cacheRef, sources: [...normalized.processedFiles] } + : undefined + } + } + return { sources: parsed.sources } + } catch { + return { sources: [] } + } +} + +export async function persistClaudeUsageSourceCache( + ref: UsageSourceCacheRef, + sources: readonly ClaudeUsagePersistedFile[], + previous: ClaudeUsageLoadedSourceCache +): Promise { + const unchanged = previous.unchangedSourceCache + if ( + unchanged && + ref.reuse && + ref.schemaVersion === 7 && + ref.path === unchanged.ref.path && + ref.schemaVersion === unchanged.ref.schemaVersion && + ref.worktreeFingerprint === unchanged.ref.worktreeFingerprint && + sources.length === unchanged.sources.length && + sources.every((file, index) => file === unchanged.sources[index]) + ) { + return + } + await writeClaudeUsageSourceCache(ref, sources) +} + +export async function writeClaudeUsageSourceCache( + ref: UsageSourceCacheRef, + sources: readonly ClaudeUsagePersistedFile[] +): Promise { + const cacheRef = { ...ref } + const material = JSON.stringify({ + schemaVersion: cacheRef.schemaVersion, + worktreeFingerprint: cacheRef.worktreeFingerprint, + sources: encodeClaudeUsagePersistedFiles(sources) + }) + await writeUsageSourceCacheData( + cacheRef, + await compressClaudeUsageSourceText( + cacheRef.schemaVersion === 6 ? material : sealUsageCacheJson(material, SOURCE_DOMAIN) + ) + ) +} + +export async function splitClaudeUsageCacheFile( + request: UsageCacheSplitRequest +): Promise { + let text: string + try { + text = await readFile(request.cacheFile, 'utf8') + } catch (error) { + if (error instanceof Error && 'code' in error && error.code === 'ENOENT') { + return { reportText: null, migrated: false } + } + throw error + } + const parsed: ClaudeUsagePersistedState = JSON.parse(text) + if (!Array.isArray(parsed.processedFiles) || parsed.processedFiles.length === 0) { + const validated = await parseClaudeUsageReport(text, parsed) + return { + reportText: validated === parsed ? text : serializeClaudeUsageReport(validated), + migrated: false, + reportIntegrityVerified: validated.schemaVersion === 7 + } + } + const validated = await parseClaudeUsageReport(text, parsed) + const protectedInline = parsed.processedFiles.some(hasClaudeUsageProtectedCheckpoint) + const state = protectedInline ? { ...validated, schemaVersion: 7 } : validated + const ref = { + path: usageSourceCachePath(request.cacheFile), + schemaVersion: state.schemaVersion, + worktreeFingerprint: state.worktreeFingerprint, + reuse: true + } + const existing = await readClaudeUsageSourceCache({ ...ref, schemaVersion: 7 }) + // A newer sidecar can survive a failed report migration; do not replace its warm generation. + if (!existing.verifiedSources) { + await writeClaudeUsageSourceCache(ref, state.processedFiles) + } + return { + reportText: serializeClaudeUsageReport(state), + migrated: true, + reportIntegrityVerified: state.schemaVersion === 7 + } +} diff --git a/src/main/claude-usage/persisted-token-columns-store.test.ts b/src/main/claude-usage/persisted-token-columns-store.test.ts new file mode 100644 index 00000000000..f97d765aee8 --- /dev/null +++ b/src/main/claude-usage/persisted-token-columns-store.test.ts @@ -0,0 +1,94 @@ +import { readFile, writeFile } from 'node:fs/promises' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { + createPersistedUsageTestFixture, + type PersistedUsageTestFixture +} from './persisted-usage-test-fixture' + +const { getPath } = vi.hoisted(() => ({ getPath: vi.fn<() => string>() })) +vi.mock('electron', () => ({ app: { getPath } })) +vi.mock('../usage/usage-scan-worker-spawn', () => ({ + scanClaudeUsageFilesViaWorker: vi.fn(), + splitUsageCacheFileViaWorker: vi.fn() +})) +vi.mock('./transcript-file-discovery', () => ({ + listClaudeTranscriptFiles: vi.fn(), + claudeProfileTranscriptDirs: vi.fn(() => []) +})) + +let fixture: PersistedUsageTestFixture + +beforeEach(async () => { + fixture = await createPersistedUsageTestFixture(getPath) +}) + +afterEach(async () => { + await fixture.cleanup() +}) + +it.each([ + { name: 'empty', checkpoint: {} }, + { name: 'offset-only', checkpoint: { parsedBytes: 20_000 } }, + { + name: 'unsigned tuples', + checkpoint: { + parsedBytes: 20_000, + lineCount: 1, + boundaryDigest: 'boundary', + headDigest: 'head', + physicalFileId: '1:2', + ownedTokenMaxima: [[100, 10, 0, 20, 5, null]], + projections: [], + encounterOrder: [] + } + } +])( + 'preserves $name legacy checkpoints when enabling and flushing without a scan', + async ({ checkpoint }) => { + const file = { + path: join(fixture.directory, 'legacy.jsonl'), + mtimeMs: 1, + ctimeMs: 2, + physicalFileId: '1:2', + size: 20_000, + lineCount: 1, + sessions: [], + dailyAggregates: [], + ownedDedupeKeys: ['legacy-key'], + hasDeferredClaims: false, + parseResumeState: checkpoint + } + const state = { + schemaVersion: 6, + worktreeFingerprint: '[]', + processedFiles: [file], + sessions: [], + dailyAggregates: [], + scanState: { + enabled: false, + lastScanStartedAt: 1, + lastScanCompletedAt: 2, + lastScanError: null + } + } + await writeFile(fixture.reportPath, JSON.stringify(state)) + const store = fixture.createStore() + await store.setEnabled(true) + await store.flush() + + const report = JSON.parse(await readFile(fixture.reportPath, 'utf8')) + const sidecar = JSON.parse(await readFile(fixture.sourceRef.path, 'utf8')) + expect(report).not.toHaveProperty('processedFiles') + expect(report).not.toHaveProperty('usageIntegrity') + expect(report.schemaVersion).toBe(6) + expect(report.scanState).toEqual({ ...state.scanState, enabled: true }) + expect(sidecar.schemaVersion).toBe(6) + expect(sidecar).not.toHaveProperty('usageIntegrity') + expect(sidecar.sources).toEqual([file]) + expect(sidecar.sources[0]?.parseResumeState).not.toHaveProperty('tokenCodecVersion') + expect(sidecar.sources[0]?.parseResumeState).not.toHaveProperty('ownedTokenColumns') + expect(sidecar.sources[0]?.parseResumeState).not.toHaveProperty('projectionIntegrity') + expect(fixture.scanWorker).not.toHaveBeenCalled() + } +) diff --git a/src/main/claude-usage/persisted-token-columns.test.ts b/src/main/claude-usage/persisted-token-columns.test.ts new file mode 100644 index 00000000000..f6da90edae8 --- /dev/null +++ b/src/main/claude-usage/persisted-token-columns.test.ts @@ -0,0 +1,301 @@ +import { join } from 'node:path' +import { tmpdir } from 'node:os' +import { expect, it } from 'vitest' +import { + decodeClaudeUsagePersistedFile, + encodeClaudeUsagePersistedFiles, + encodeClaudeUsagePersistedState +} from './persisted-token-columns' +import { buildClaudeUsageProjectionIntegrity } from './transcript-projection-integrity' +import { hasClaudeUsageResumeProjection } from './transcript-resume-projection' +import { aggregateClaudeUsage } from './usage-aggregation' +import type { + ClaudeUsageAttributedTurn, + ClaudeUsagePersistedFile, + ClaudeUsagePersistedState, + ClaudeUsageTokenMaxima +} from './types' + +function fixture(rows: ClaudeUsageTokenMaxima[]): ClaudeUsagePersistedFile { + const turns: ClaudeUsageAttributedTurn[] = [] + const routes = [0, 1].filter((index) => rows.some((row) => row[5] === index)) + const order = new Map() + for (const row of rows) { + if (row[5] === null) { + continue + } + const sessionId = `session-${row[5]}` + const projectKey = `project-${row[5]}` + order.set(sessionId, [projectKey]) + turns.push({ + sessionId, + timestamp: '2026-10-09T12:00:00.000Z', + model: 'model', + cwd: null, + gitBranch: null, + inputTokens: row[0], + outputTokens: row[1], + cacheReadTokens: row[2], + cacheWriteTokens: row[3], + cacheWrite1hTokens: row[4], + day: '2026-10-09', + projectKey, + projectLabel: projectKey, + repoId: null, + worktreeId: null + }) + } + const file: ClaudeUsagePersistedFile = { + path: join(tmpdir(), 'claude-token-columns.jsonl'), + mtimeMs: 1, + size: 20_000, + lineCount: rows.length + 1, + physicalFileId: '1:2', + ctimeMs: 2, + ...aggregateClaudeUsage(turns), + ownedDedupeKeys: rows.map((_, index) => `key-${index}`), + hasDeferredClaims: true, + parseResumeState: { + parsedBytes: 20_000, + lineCount: rows.length + 1, + boundaryDigest: 'boundary', + headDigest: 'head', + physicalFileId: '1:2', + ownedTokenMaxima: rows, + projections: routes.map((index) => ({ + sessionId: `session-${index}`, + day: '2026-10-09', + model: 'model', + projectKey: `project-${index}` + })), + encounterOrder: [...order].map(([sessionId, projectKeys]) => ({ sessionId, projectKeys })) + } + } + if (!file.parseResumeState) { + throw new Error('Expected a checkpoint fixture.') + } + file.parseResumeState.projectionIntegrity = buildClaudeUsageProjectionIntegrity(file) + return file +} + +function savedState(file: ClaudeUsagePersistedFile): ClaudeUsagePersistedState { + return { + schemaVersion: 7, + worktreeFingerprint: '[]', + processedFiles: [file], + sessions: file.sessions, + dailyAggregates: file.dailyAggregates, + scanState: { + enabled: true, + lastScanStartedAt: 1, + lastScanCompletedAt: 2, + lastScanError: null + } + } +} + +function pack(file: ClaudeUsagePersistedFile): ClaudeUsagePersistedFile { + const state: ClaudeUsagePersistedState = JSON.parse( + JSON.stringify(encodeClaudeUsagePersistedState(savedState(file))) + ) + const packed = state.processedFiles[0] + if (!packed) { + throw new Error('Expected an encoded file.') + } + return packed +} + +function columns(file: ClaudeUsagePersistedFile): unknown[] { + const state = file.parseResumeState + if (!state || !('ownedTokenColumns' in state) || !Array.isArray(state.ownedTokenColumns)) { + throw new Error('Expected six encoded columns.') + } + return state.ownedTokenColumns +} + +function decode(file: ClaudeUsagePersistedFile): { + file: ClaudeUsagePersistedFile + yields: number +} { + const iterator = decodeClaudeUsagePersistedFile(file) + let yields = 0 + let step = iterator.next() + while (!step.done) { + yields++ + step = iterator.next() + } + return { file: step.value, yields } +} + +it('packs uniform columns without mutating tuples, sharing decoded rows or retaining disk fields', () => { + const original = fixture([ + [100, 10, 0, 20, 5, 0], + [100, 10, 0, 20, 5, 0] + ]) + const before = structuredClone(original) + const packed = pack(original) + expect(columns(packed)).toEqual([100, 10, 0, 20, 5, 0]) + expect(packed.parseResumeState).toHaveProperty('tokenCodecVersion', 1) + expect(packed.parseResumeState).not.toHaveProperty('ownedTokenMaxima') + expect(original).toEqual(before) + const decoded = decode(packed).file + expect(decoded).toEqual(original) + expect(decoded.parseResumeState).not.toHaveProperty('ownedTokenColumns') + expect(decoded.parseResumeState).not.toHaveProperty('tokenCodecVersion') + expect(hasClaudeUsageResumeProjection(decoded)).toBe(true) + const first = decoded.parseResumeState?.ownedTokenMaxima[0] + const second = decoded.parseResumeState?.ownedTokenMaxima[1] + if (!first || !second) { + throw new Error('Expected independent decoded rows.') + } + expect(first).not.toBe(second) + first[0]++ + expect(second[0]).toBe(100) + expect(original).toEqual(before) +}) + +it('preserves independently varying finite maxima, null routing and original integrity', () => { + const original = fixture([ + [-1.5, 2.25, 0, 20, 5, 0], + [3.75, 1, 4.5, 21, 6.25, 1], + [Number.MAX_VALUE, -2.5, -3.25, 22, -1.5, null] + ]) + const packed = pack(original) + expect(columns(packed)).toEqual([ + [-1.5, 3.75, Number.MAX_VALUE], + [2.25, 1, -2.5], + [0, 4.5, -3.25], + [20, 21, 22], + [5, 6.25, -1.5], + [0, 1, null] + ]) + const decoded = decode(packed).file + expect(decoded).toEqual(original) + expect(buildClaudeUsageProjectionIntegrity(decoded)).toBe( + original.parseResumeState?.projectionIntegrity + ) + expect(hasClaudeUsageResumeProjection(decoded)).toBe(true) +}) + +it('uses empty scalars for zero owned keys and returns legacy and nonresumable files unchanged', () => { + const empty = fixture([]) + expect(columns(pack(empty))).toEqual([0, 0, 0, 0, 0, null]) + expect(decode(pack(empty)).file).toEqual(empty) + expect(decode(empty)).toEqual({ file: empty, yields: 0 }) + expect(decode(empty).file).toBe(empty) + const small = { ...empty, parseResumeState: null } + expect(decode(small).file).toBe(small) + expect(pack(small)).toEqual(small) +}) + +it('yields every 1024 decoded rows before publishing a complete file', () => { + const rows: ClaudeUsageTokenMaxima[] = Array.from({ length: 2050 }, (_, index) => [ + index, + 10, + 0, + 20, + 5, + 0 + ]) + const original = fixture(rows) + const iterator = decodeClaudeUsagePersistedFile(pack(original)) + expect(iterator.next()).toEqual({ value: undefined, done: false }) + expect(iterator.next()).toEqual({ value: undefined, done: false }) + const completed = iterator.next() + expect(completed.done).toBe(true) + expect(completed.value).toEqual(original) +}) + +it('leaves a finite packed maximum drift visible to the coupled integrity validator', () => { + const original = fixture([[100, 10, 0, 20, 5, 0]]) + const packed = pack(original) + columns(packed)[0] = 99 + const decoded = decode(packed).file + expect(decoded.parseResumeState?.ownedTokenMaxima[0]?.[0]).toBe(99) + expect(decoded.parseResumeState?.projectionIntegrity).toBe( + original.parseResumeState?.projectionIntegrity + ) + expect(hasClaudeUsageResumeProjection(decoded)).toBe(false) +}) + +it('serializes a frozen source array and diagnostic state exactly like individual packing', () => { + const first = fixture([[100, 10, 0, 20, 5, 0]]) + const second = fixture([ + [101, 11, 1, 21, 6, 0], + [102, 12, 2, 22, 7, 0] + ]) + const unsigned = structuredClone(first) + if (!unsigned.parseResumeState) { + throw new Error('Expected an unsigned checkpoint fixture.') + } + delete unsigned.parseResumeState.projectionIntegrity + const state = savedState(first) + state.processedFiles.push(second, unsigned, { ...first, parseResumeState: null }) + const before = structuredClone(state) + const expected = { ...state, processedFiles: state.processedFiles.map(pack) } + for (const file of state.processedFiles) { + if (file.parseResumeState) { + file.parseResumeState.ownedTokenMaxima.forEach(Object.freeze) + Object.freeze(file.parseResumeState.ownedTokenMaxima) + Object.freeze(file.parseResumeState) + } + Object.freeze(file.ownedDedupeKeys) + Object.freeze(file) + } + Object.freeze(state.processedFiles) + Object.freeze(state) + expect(JSON.stringify(encodeClaudeUsagePersistedFiles(state.processedFiles))).toBe( + JSON.stringify(expected.processedFiles) + ) + expect(JSON.stringify(encodeClaudeUsagePersistedState(state))).toBe(JSON.stringify(expected)) + expect(pack(unsigned)).toEqual(unsigned) + expect(state).toEqual(before) +}) + +it.each([ + { name: 'null column', index: 0, value: null }, + { name: 'string column', index: 1, value: '10' }, + { name: 'nonfinite scalar', index: 2, value: Number.POSITIVE_INFINITY }, + { name: 'short column', index: 0, value: [100] }, + { name: 'long column', index: 0, value: [100, 200, 300] }, + { name: 'nonnumeric value', index: 1, value: [10, '20'] }, + { name: 'null token value', index: 2, value: [0, null] }, + { name: 'nonfinite value', index: 3, value: [20, Number.NaN] }, + { name: 'negative route', index: 5, value: [0, -1] }, + { name: 'fractional route', index: 5, value: [0, 0.5] }, + { name: 'unknown route', index: 5, value: [0, 2] }, + { name: 'nonnumeric route', index: 5, value: [0, true] } +])('rejects $name before publishing decoded rows', ({ index, value }) => { + const packed = pack( + fixture([ + [100, 10, 0, 20, 5, 0], + [200, 20, 1, 30, 6, 1] + ]) + ) + columns(packed)[index] = value + expect(() => decode(packed)).toThrow('Saved Claude usage token') +}) + +it.each([ + { tokenCodecVersion: undefined }, + { tokenCodecVersion: 0 }, + { tokenCodecVersion: 2 }, + { tokenCodecVersion: '1' }, + { ownedTokenColumns: undefined }, + { ownedTokenColumns: {} }, + { ownedTokenColumns: [1, 2, 3, 4, 5] }, + { ownedTokenColumns: [1, 2, 3, 4, 5, null, 7] }, + { ownedTokenMaxima: [[100, 10, 0, 20, 5, 0]] }, + { projectionIntegrity: undefined }, + { projectionIntegrity: null }, + { projectionIntegrity: 123 } +])('rejects unsupported, incomplete or duplicated codec fields %j', (patch) => { + const packed = pack(fixture([[100, 10, 0, 20, 5, 0]])) + if (!packed.parseResumeState) { + throw new Error('Expected an encoded checkpoint.') + } + const corrupted: ClaudeUsagePersistedFile = JSON.parse( + JSON.stringify({ ...packed, parseResumeState: { ...packed.parseResumeState, ...patch } }) + ) + expect(() => decode(corrupted)).toThrow('Saved Claude usage token') +}) diff --git a/src/main/claude-usage/persisted-token-columns.ts b/src/main/claude-usage/persisted-token-columns.ts new file mode 100644 index 00000000000..61bb06dc25b --- /dev/null +++ b/src/main/claude-usage/persisted-token-columns.ts @@ -0,0 +1,165 @@ +import type { + ClaudeUsageParseResumeState, + ClaudeUsagePersistedFile, + ClaudeUsagePersistedState, + ClaudeUsageTokenMaxima +} from './types' + +const TOKEN_CODEC_VERSION = 1 +const DECODE_ROWS_PER_YIELD = 1024 + +type PersistedTokenColumn = number | null | (number | null)[] +type TokenColumnIndex = 0 | 1 | 2 | 3 | 4 | 5 +type PackedResumeState = Omit & { + tokenCodecVersion: 1 + ownedTokenColumns: PersistedTokenColumn[] +} +type PackedFile = Omit & { + parseResumeState?: ClaudeUsageParseResumeState | PackedResumeState | null +} + +function encodeColumn( + rows: ClaudeUsageTokenMaxima[], + index: TokenColumnIndex +): PersistedTokenColumn { + let column: PersistedTokenColumn = rows[0]?.[index] ?? (index === 5 ? null : 0) + for (let rowIndex = 1; rowIndex < rows.length; rowIndex++) { + const value = rows[rowIndex][index] + if (Array.isArray(column)) { + column.push(value) + } else if (value !== column) { + const priorValue = column + const values = Array.from({ length: rowIndex }, () => priorValue) + values.push(value) + column = values + } + } + return column +} + +function encodeFile(file: ClaudeUsagePersistedFile): PackedFile { + const state = file.parseResumeState + if ( + !state || + typeof state.projectionIntegrity !== 'string' || + !Array.isArray(state.ownedTokenMaxima) + ) { + return file + } + const { ownedTokenMaxima, ...checkpoint } = state + return { + ...file, + parseResumeState: { + ...checkpoint, + tokenCodecVersion: TOKEN_CODEC_VERSION, + ownedTokenColumns: ([0, 1, 2, 3, 4, 5] as const).map((index) => + encodeColumn(ownedTokenMaxima, index) + ) + } + } +} + +export function encodeClaudeUsagePersistedFiles( + files: readonly ClaudeUsagePersistedFile[] +): readonly unknown[] { + // Serialize one file at a time so dense columns do not accumulate across the corpus. + return files.map((file) => ({ toJSON: () => encodeFile(file) })) +} + +export function encodeClaudeUsagePersistedState(state: ClaudeUsagePersistedState): unknown { + return { ...state, processedFiles: encodeClaudeUsagePersistedFiles(state.processedFiles) } +} + +function columnValue(column: unknown, rowIndex: number): unknown { + return Array.isArray(column) ? column[rowIndex] : column +} + +function readToken(column: unknown, rowIndex: number): number { + const value = columnValue(column, rowIndex) + if (typeof value !== 'number' || !Number.isFinite(value)) { + throw new Error('Saved Claude usage token column contains an invalid maximum.') + } + return value +} + +function readProjection(column: unknown, rowIndex: number, projectionCount: number): number | null { + const value = columnValue(column, rowIndex) + if (value === null) { + return null + } + if ( + typeof value !== 'number' || + !Number.isInteger(value) || + value < 0 || + value >= projectionCount + ) { + throw new Error('Saved Claude usage token column contains an invalid route index.') + } + return value +} + +export function* decodeClaudeUsagePersistedFile( + file: ClaudeUsagePersistedFile +): Generator { + const resume = file.parseResumeState + if (resume === null || resume === undefined) { + return file + } + const state: unknown = resume + if (state === null || typeof state !== 'object' || Array.isArray(state)) { + throw new Error('Saved Claude usage resume checkpoint is invalid.') + } + if (!('tokenCodecVersion' in state) && !('ownedTokenColumns' in state)) { + return file + } + if ( + !('tokenCodecVersion' in state) || + state.tokenCodecVersion !== TOKEN_CODEC_VERSION || + !('ownedTokenColumns' in state) || + 'ownedTokenMaxima' in state || + !('projectionIntegrity' in state) || + typeof state.projectionIntegrity !== 'string' || + !Array.isArray(file.ownedDedupeKeys) || + !('projections' in state) || + !Array.isArray(state.projections) + ) { + throw new Error('Saved Claude usage token codec is invalid or unsupported.') + } + const columns = state.ownedTokenColumns + if (!Array.isArray(columns) || columns.length !== 6) { + throw new Error('Saved Claude usage token checkpoint requires six columns.') + } + const rowCount = file.ownedDedupeKeys.length + for (const [index, column] of columns.entries()) { + if (Array.isArray(column)) { + if (column.length !== rowCount) { + throw new Error('Saved Claude usage token column does not match its ownership keys.') + } + } else if (index === 5) { + readProjection(column, 0, state.projections.length) + } else { + readToken(column, 0) + } + } + const ownedTokenMaxima: ClaudeUsageTokenMaxima[] = [] + for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) { + ownedTokenMaxima.push([ + readToken(columns[0], rowIndex), + readToken(columns[1], rowIndex), + readToken(columns[2], rowIndex), + readToken(columns[3], rowIndex), + readToken(columns[4], rowIndex), + readProjection(columns[5], rowIndex, state.projections.length) + ]) + if ((rowIndex + 1) % DECODE_ROWS_PER_YIELD === 0) { + yield + } + } + const checkpoint: ClaudeUsageParseResumeState & { + tokenCodecVersion?: unknown + ownedTokenColumns?: unknown + } = { ...resume, ownedTokenMaxima } + delete checkpoint.tokenCodecVersion + delete checkpoint.ownedTokenColumns + return { ...file, parseResumeState: checkpoint } +} diff --git a/src/main/claude-usage/persisted-usage-report.ts b/src/main/claude-usage/persisted-usage-report.ts new file mode 100644 index 00000000000..a5015bf90b4 --- /dev/null +++ b/src/main/claude-usage/persisted-usage-report.ts @@ -0,0 +1,56 @@ +import type { ClaudeUsagePersistedState } from './types' +import { + hasClaudeUsageProtectedCheckpoint, + initializePersistedClaudeUsageProjections +} from './persisted-projection-validation' +import { sealUsageCacheJson, verifyUsageCacheJson } from '../usage/usage-cache-json-integrity' + +const REPORT_DOMAIN = 'claude-usage-report-v1' + +function invalidateReport(state: ClaudeUsagePersistedState): ClaudeUsagePersistedState { + return { + ...state, + processedFiles: [], + sessions: [], + dailyAggregates: [], + scanState: { + ...state.scanState, + lastScanCompletedAt: null, + lastScanError: 'Saved usage totals could not be validated. Refresh to rebuild them.' + } + } +} + +export function serializeClaudeUsageReport(state: ClaudeUsagePersistedState): string { + const { processedFiles: _sources, usageIntegrity: _integrity, ...report } = state + const material = JSON.stringify(report) + // Unsigned v6 history retains its legacy status until a source scan verifies a new generation. + return state.schemaVersion === 6 ? material : sealUsageCacheJson(material, REPORT_DOMAIN) +} + +export function parseClaudeUsageReport( + text: string, + parsed?: ClaudeUsagePersistedState, + integrityVerified = false +): ClaudeUsagePersistedState | Promise { + const state: ClaudeUsagePersistedState = parsed ?? JSON.parse(text) + try { + if ('processedFiles' in state && !Array.isArray(state.processedFiles)) { + return invalidateReport(state) + } + if (integrityVerified || verifyUsageCacheJson(text, state.usageIntegrity, REPORT_DOMAIN)) { + if (state.schemaVersion !== 7 || (state.processedFiles?.length ?? 0) !== 0) { + return invalidateReport(state) + } + return state + } + const inline = Array.isArray(state.processedFiles) && state.processedFiles.length > 0 + const protectedInline = inline && state.processedFiles.some(hasClaudeUsageProtectedCheckpoint) + if (protectedInline) { + return initializePersistedClaudeUsageProjections(state) + } + return state.schemaVersion === 7 ? invalidateReport(state) : state + } catch { + return invalidateReport(state) + } +} diff --git a/src/main/claude-usage/persisted-usage-test-fixture.ts b/src/main/claude-usage/persisted-usage-test-fixture.ts new file mode 100644 index 00000000000..46735e02c99 --- /dev/null +++ b/src/main/claude-usage/persisted-usage-test-fixture.ts @@ -0,0 +1,133 @@ +import { mkdtemp, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { vi, type Mock } from 'vitest' +import type { ClaudeUsagePersistedFile, ClaudeUsagePersistedState } from './types' +import { readClaudeUsageScanFile } from './transcript-record-parser' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import { scanClaudeUsageFiles } from './scanner' +import { + readClaudeUsageSourceCache, + splitClaudeUsageCacheFile, + persistClaudeUsageSourceCache +} from './persisted-source-cache' +import { normalizeClaudeUsageSourceFiles } from './persisted-projection-validation' +import { usageSourceCachePath } from '../usage/usage-source-cache-file' + +import { ClaudeUsageStore, initClaudeUsagePath } from './store' +import { listClaudeTranscriptFiles } from './transcript-file-discovery' +import { + scanClaudeUsageFilesViaWorker, + splitUsageCacheFileViaWorker +} from '../usage/usage-scan-worker-spawn' + +export async function createPersistedUsageTestFixture(getPath: Mock<() => string>) { + const directory = await mkdtemp(join(tmpdir(), 'orca-claude-persisted-usage-')) + const transcript = join(directory, 'session.jsonl') + const reportPath = join(directory, 'orca-claude-usage.json') + const sourceRef = { + path: usageSourceCachePath(reportPath), + schemaVersion: 7, + worktreeFingerprint: '[]', + reuse: true + } + const transcripts = [transcript] + getPath.mockReturnValue(directory) + initClaudeUsagePath() + vi.mocked(listClaudeTranscriptFiles).mockReset() + vi.mocked(listClaudeTranscriptFiles).mockImplementation(async () => [...transcripts].sort()) + vi.mocked(splitUsageCacheFileViaWorker).mockReset() + vi.mocked(splitUsageCacheFileViaWorker).mockImplementation(splitClaudeUsageCacheFile) + vi.mocked(scanClaudeUsageFilesViaWorker).mockReset() + vi.mocked(scanClaudeUsageFilesViaWorker).mockImplementation(async (worktrees, ref) => { + const previous = await readClaudeUsageSourceCache(ref) + const result = await scanClaudeUsageFiles( + worktrees, + previous.sources, + undefined, + [], + previous.verifiedSources + ) + await persistClaudeUsageSourceCache(ref, result.processedFiles, previous) + return { sessions: result.sessions, dailyAggregates: result.dailyAggregates } + }) + + function row(index: number, duplicate = false): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: duplicate ? 'later-session' : 'original-session', + timestamp: duplicate ? '2026-10-10T12:00:00.000Z' : '2026-10-09T12:00:00.000Z', + cwd: duplicate ? join(directory, 'later-location') : directory, + requestId: `request-${index}`, + message: { + id: `message-${index}`, + model: duplicate ? 'later-model' : 'claude-sonnet-4-6', + usage: { + input_tokens: duplicate ? 2000 : 1000 + index, + output_tokens: duplicate ? 55 : 10 + (index % 7), + cache_read_input_tokens: duplicate ? 5 : index % 11, + cache_creation_input_tokens: duplicate ? 15 : 10 + (index % 17), + cache_creation: { ephemeral_1h_input_tokens: duplicate ? 3 : index % 3 } + } + } + })}\n` + } + + async function project(previous?: ClaudeUsagePersistedFile): Promise { + return projectClaudeUsageScanFile( + await readClaudeUsageScanFile(transcript, previous?.parseResumeState), + new Map(), + () => true, + previous + ) + } + + function state(files: ClaudeUsagePersistedFile[], schemaVersion = 6): ClaudeUsagePersistedState { + return { + schemaVersion, + worktreeFingerprint: '[]', + processedFiles: files, + sessions: structuredClone(files.flatMap((file) => file.sessions)), + dailyAggregates: structuredClone(files.flatMap((file) => file.dailyAggregates)), + scanState: { + enabled: true, + lastScanStartedAt: Date.now(), + lastScanCompletedAt: Date.now(), + lastScanError: null + } + } + } + + async function writeResumable(): Promise { + await writeFile( + transcript, + `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n${row(0)}` + ) + return project() + } + + return { + scanWorker: vi.mocked(scanClaudeUsageFilesViaWorker), + splitWorker: vi.mocked(splitUsageCacheFileViaWorker), + directory, + transcript, + transcripts, + reportPath, + sourceRef, + row, + project, + state, + writeResumable, + createStore: () => new ClaudeUsageStore({ getRepos: () => [], getAllWorktreeMeta: () => ({}) }), + decodedSources: async () => { + const read = await readClaudeUsageSourceCache(sourceRef) + return normalizeClaudeUsageSourceFiles(read.sources, read.verifiedSources).processedFiles + }, + cleanup: async () => { + vi.restoreAllMocks() + await rm(directory, { recursive: true, force: true }) + } + } +} + +export type PersistedUsageTestFixture = Awaited> diff --git a/src/main/claude-usage/scanner-incremental-append.test.ts b/src/main/claude-usage/scanner-incremental-append.test.ts new file mode 100644 index 00000000000..aca2f2f29c7 --- /dev/null +++ b/src/main/claude-usage/scanner-incremental-append.test.ts @@ -0,0 +1,169 @@ +import { appendFile, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' +import type * as NodeFs from 'node:fs' +import type * as NodeFsPromises from 'node:fs/promises' +import type * as NodeOs from 'node:os' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const { homedirMock, streamReads } = vi.hoisted(() => { + const streamReads: { path: string; start: number; bytes: number }[] = [] + return { homedirMock: vi.fn<() => string>(), streamReads } +}) + +vi.mock('node:os', async () => ({ + ...(await vi.importActual('node:os')), + homedir: homedirMock +})) + +vi.mock('../claude-accounts/claude-profile-installed-router', () => ({ + claudeProfileHistoryDirs: () => [] +})) + +vi.mock('node:fs', async () => { + const actual = await vi.importActual('node:fs') + return { + ...actual, + createReadStream: ( + path: Parameters[0], + options?: Parameters[1] + ) => { + const range = typeof options === 'object' && options !== null ? options : {} + const read = { path: String(path), start: range.start ?? 0, bytes: 0 } + streamReads.push(read) + const stream = actual.createReadStream(path, options) + stream.on('data', (chunk: string | Buffer) => { + read.bytes += typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.length + }) + return stream + } + } +}) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + open: async (...args: Parameters) => { + const handle = await actual.open(...args) + const createStream = handle.createReadStream.bind(handle) + const readWindow = handle.read.bind(handle) + let streaming = false + vi.spyOn(handle, 'createReadStream').mockImplementation((options) => { + const read = { path: String(args[0]), start: options?.start ?? 0, bytes: 0 } + streamReads.push(read) + const stream = createStream(options) + streaming = true + stream.once('end', () => (streaming = false)) + stream.once('close', () => (streaming = false)) + stream.on('data', (chunk: string | Buffer) => { + read.bytes += typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.length + }) + return stream + }) + vi.spyOn(handle, 'read').mockImplementation(async (...readArgs) => { + const streamRead = streaming + const result = await readWindow(...readArgs) + if (streamRead) { + return result + } + const position = readArgs.at(-1) + streamReads.push({ + path: String(args[0]), + start: typeof position === 'number' ? position : 0, + bytes: result.bytesRead + }) + return result + }) + return handle + } + } +}) + +let root: string +let transcriptPath: string + +beforeEach(async () => { + root = await mkdtemp(join(tmpdir(), 'orca-claude-usage-append-')) + homedirMock.mockReturnValue(root) + const projectDir = join(root, '.claude', 'projects', 'project-a') + await mkdir(projectDir, { recursive: true }) + transcriptPath = join(projectDir, 'active-session.jsonl') + streamReads.length = 0 + vi.resetModules() +}) + +afterEach(async () => { + await rm(root, { recursive: true, force: true }) +}) + +function usageRecord(index: number, inputTokens = 100, cacheReadTokens = 0): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'active-session', + timestamp: `2026-10-09T12:${String(index % 60).padStart(2, '0')}:00.000Z`, + requestId: `request-${index}`, + cwd: join(root, 'repo'), + message: { + id: `message-${index}`, + model: 'claude-sonnet-4-6', + usage: { + input_tokens: inputTokens, + output_tokens: 10, + cache_read_input_tokens: cacheReadTokens, + cache_creation_input_tokens: 20, + cache_creation: { ephemeral_1h_input_tokens: 5 } + } + } + })}\n` +} + +function prefixRecords(): string { + const toolResult = `${JSON.stringify({ type: 'user', content: '界'.repeat(350_000) })}\n` + return toolResult + Array.from({ length: 80 }, (_, index) => usageRecord(index)).join('') +} + +function streamedBytes(): number { + return streamReads + .filter((read) => read.path === transcriptPath) + .reduce((sum, read) => sum + read.bytes, 0) +} + +describe('Claude usage append scans', () => { + it('reads appended usage without rereading the transcript history', async () => { + const prefix = prefixRecords() + await writeFile(transcriptPath, prefix) + const { scanClaudeUsageFiles } = await import('./scanner') + const first = await scanClaudeUsageFiles([], [], undefined, []) + const appended = usageRecord(80) + await appendFile(transcriptPath, appended) + streamReads.length = 0 + + const second = await scanClaudeUsageFiles([], first.processedFiles, undefined, []) + const appendBytes = streamedBytes() + const cold = await scanClaudeUsageFiles([], [], undefined, []) + + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.processedFiles[0]?.lineCount).toBe(82) + expect(second.sessions[0]?.turnCount).toBe(81) + expect(appendBytes).toBeLessThan(Buffer.byteLength(prefix) / 10) + }) + + it('updates a previously counted assistant row with its later token maxima', async () => { + await writeFile(transcriptPath, prefixRecords()) + const { scanClaudeUsageFiles } = await import('./scanner') + const first = await scanClaudeUsageFiles([], [], undefined, []) + await appendFile(transcriptPath, usageRecord(3, 250, 40) + usageRecord(80)) + + const second = await scanClaudeUsageFiles([], first.processedFiles, undefined, []) + const cold = await scanClaudeUsageFiles([], [], undefined, []) + + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions[0]?.turnCount).toBe(81) + expect(second.sessions[0]?.totalInputTokens).toBe(8_250) + expect(second.sessions[0]?.totalCacheReadTokens).toBe(40) + expect(second.dailyAggregates[0]?.zeroCacheReadTurnCount).toBe(80) + }) +}) diff --git a/src/main/claude-usage/scanner-incremental-ownership.test.ts b/src/main/claude-usage/scanner-incremental-ownership.test.ts new file mode 100644 index 00000000000..1e8adff0a90 --- /dev/null +++ b/src/main/claude-usage/scanner-incremental-ownership.test.ts @@ -0,0 +1,699 @@ +import { appendFile, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' +import type * as NodeFs from 'node:fs' +import type * as NodeFsPromises from 'node:fs/promises' +import type * as NodeOs from 'node:os' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import type { ClaudeUsagePersistedFile } from './types' +import type { ClaudeUsageWorktreeRef } from './worktree-attribution' + +const { homedirMock, streamReads } = vi.hoisted(() => { + const streamReads: { path: string; start: number; checkpointWindow: boolean; bytes: number }[] = + [] + return { homedirMock: vi.fn<() => string>(), streamReads } +}) + +vi.mock('node:os', async () => ({ + ...(await vi.importActual('node:os')), + homedir: homedirMock +})) + +vi.mock('../claude-accounts/claude-profile-installed-router', () => ({ + claudeProfileHistoryDirs: () => [] +})) + +vi.mock('node:fs', async () => { + const actual = await vi.importActual('node:fs') + return { + ...actual, + createReadStream: ( + path: Parameters[0], + options?: Parameters[1] + ) => { + const range = typeof options === 'object' && options !== null ? options : {} + return observeReadStream( + String(path), + range.start ?? 0, + range.end, + actual.createReadStream(path, options) + ) + } + } +}) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + open: async ( + path: Parameters[0], + flags: Parameters[1], + mode?: Parameters[2] + ) => { + const handle = await actual.open(path, flags, mode) + const createReadStream = handle.createReadStream.bind(handle) + handle.createReadStream = (options) => + observeReadStream( + String(path), + options?.start ?? 0, + options?.end, + createReadStream(options) + ) + return handle + } + } +}) + +function observeReadStream( + path: string, + start: number, + end: number | undefined, + stream: NodeFs.ReadStream +): NodeFs.ReadStream { + const read = { + path, + start, + checkpointWindow: end !== undefined && end - start + 1 === 4096, + bytes: 0 + } + streamReads.push(read) + stream.on('data', (chunk: string | Buffer) => { + read.bytes += typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.length + }) + return stream +} + +type AssistantRowOptions = { + identified?: boolean + sessionId?: string + timestamp?: string + model?: string + cwd?: string + gitBranch?: string + inputTokens?: number + outputTokens?: number + cacheReadTokens?: number + cacheWriteTokens?: number + cacheWrite1hTokens?: number +} + +let root: string +let projectDir: string +let worktrees: ClaudeUsageWorktreeRef[] + +beforeEach(async () => { + root = await mkdtemp(join(tmpdir(), 'orca-claude-append-ownership-')) + homedirMock.mockReturnValue(root) + projectDir = join(root, '.claude', 'projects', 'project-a') + worktrees = ['a', 'b'].map((id) => ({ + repoId: `repo-${id}`, + worktreeId: `worktree-${id}`, + path: join(root, `workspace-${id}`), + displayName: `Workspace ${id.toUpperCase()}` + })) + await Promise.all([ + mkdir(projectDir, { recursive: true }), + ...worktrees.map((worktree) => mkdir(worktree.path)) + ]) + streamReads.length = 0 + vi.resetModules() +}) + +afterEach(async () => { + await rm(root, { recursive: true, force: true }) +}) + +function assistantRow(key: string, options: AssistantRowOptions = {}): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: options.sessionId ?? 'owner-session', + timestamp: options.timestamp ?? '2026-10-09T12:00:00.000Z', + cwd: options.cwd ?? worktrees[0]?.path, + gitBranch: options.gitBranch ?? 'original-branch', + requestId: options.identified === false ? undefined : `request-${key}`, + message: { + id: options.identified === false ? undefined : `message-${key}`, + model: options.model ?? 'claude-sonnet-4-6', + usage: { + input_tokens: options.inputTokens ?? 10, + output_tokens: options.outputTokens ?? 0, + cache_read_input_tokens: options.cacheReadTokens ?? 0, + cache_creation_input_tokens: options.cacheWriteTokens ?? 0, + cache_creation: { ephemeral_1h_input_tokens: options.cacheWrite1hTokens ?? 0 } + } + } + })}\n` +} + +function largePrefix(label = 'original'): string { + // Tool-result padding clears the resume floor without introducing extra billable turns. + return `${JSON.stringify({ type: 'user', label, content: '界'.repeat(12_000) })}\n` +} + +function processedFile(files: ClaudeUsagePersistedFile[], path: string): ClaudeUsagePersistedFile { + const file = files.find((candidate) => candidate.path === path) + if (!file) { + throw new Error(`Expected a scanned file at ${path}`) + } + return file +} + +function parseReadOffsets(path: string): number[] { + return streamReads + .filter((read) => read.path === path && !read.checkpointWindow && read.bytes > 0) + .map((read) => read.start) +} + +async function scanner() { + const { scanClaudeUsageFiles } = await import('./scanner') + return (previous: ClaudeUsagePersistedFile[] = []) => + scanClaudeUsageFiles(worktrees, previous, undefined, []) +} + +describe('Claude usage append ownership', () => { + it.each([ + { kind: 'object', keys: { copiedKey: 'message-streamed:request-streamed' } }, + { kind: 'string', keys: 'message-streamed:request-streamed' } + ])( + 'reparses persisted ownership keys stored as a $kind without reserving invalid claims', + async ({ keys }) => { + const ownerPath = join(projectDir, 'aaaa-damaged-owner.jsonl') + const forkPath = join(projectDir, 'zzzz-late-fork.jsonl') + await writeFile(ownerPath, largePrefix() + assistantRow('streamed', { inputTokens: 100 })) + const scan = await scanner() + const first = await scan() + const cached: ClaudeUsagePersistedFile[] = JSON.parse(JSON.stringify(first.processedFiles)) + Reflect.set(processedFile(cached, ownerPath), 'ownedDedupeKeys', keys) + await appendFile(ownerPath, assistantRow('streamed', { inputTokens: 150 })) + await writeFile( + forkPath, + largePrefix() + + assistantRow('streamed', { sessionId: 'fork-session', inputTokens: 100 }) + + assistantRow('fork-new', { sessionId: 'fork-session', inputTokens: 50 }) + ) + streamReads.length = 0 + + const second = await scan(cached) + expect(parseReadOffsets(ownerPath)).toEqual([0]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(processedFile(second.processedFiles, ownerPath).ownedDedupeKeys).toEqual([ + 'message-streamed:request-streamed' + ]) + expect(processedFile(second.processedFiles, forkPath).ownedDedupeKeys).toEqual([ + 'message-fork-new:request-fork-new' + ]) + expect(second.sessions.reduce((total, session) => total + session.totalInputTokens, 0)).toBe( + 200 + ) + } + ) + + it.each([ + 'ownedTokenMaxima', + 'encounterOrder', + 'missingProjections', + 'invalidProjectionIndex', + 'outOfRangeProjectionIndex' + ] as const)( + 'reparses a persisted checkpoint with damaged %s instead of extending an inconsistent projection', + async (missingField) => { + const transcriptPath = join(projectDir, 'damaged-checkpoint.jsonl') + await writeFile( + transcriptPath, + largePrefix() + assistantRow('streamed', { inputTokens: 100 }) + ) + const scan = await scanner() + const first = await scan() + const cached: ClaudeUsagePersistedFile[] = JSON.parse(JSON.stringify(first.processedFiles)) + const checkpoint = processedFile(cached, transcriptPath).parseResumeState + if (!checkpoint) { + throw new Error('Expected a resumable transcript before damaging its checkpoint') + } + if (missingField === 'missingProjections') { + Reflect.deleteProperty(checkpoint, 'projections') + } else if ( + missingField === 'invalidProjectionIndex' || + missingField === 'outOfRangeProjectionIndex' + ) { + const maxima = checkpoint.ownedTokenMaxima[0] + if (!maxima) { + throw new Error('Expected retained token maxima before damaging their projection index') + } + maxima[5] = missingField === 'invalidProjectionIndex' ? 0.5 : checkpoint.projections.length + } else { + checkpoint[missingField] = [] + } + await appendFile(transcriptPath, assistantRow('streamed', { inputTokens: 150 })) + streamReads.length = 0 + + const second = await scan(cached) + expect(parseReadOffsets(transcriptPath)).toEqual([0]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions[0]?.turnCount).toBe(1) + expect(second.sessions[0]?.totalInputTokens).toBe(150) + } + ) + + it('keeps a large unchanged deferred fork cached when its small owner only appends', async () => { + const ownerPath = join(projectDir, 'aaaa-small-owner.jsonl') + const forkPath = join(projectDir, 'zzzz-large-deferred-fork.jsonl') + await writeFile(ownerPath, assistantRow('shared', { inputTokens: 100 })) + await writeFile( + forkPath, + `${JSON.stringify({ type: 'user', content: '界'.repeat(350_000) })}\n${assistantRow( + 'shared', + { + sessionId: 'fork-session', + inputTokens: 100 + } + )}` + ) + const scan = await scanner() + const first = await scan() + const cachedFork = processedFile(first.processedFiles, forkPath) + expect(cachedFork.hasDeferredClaims).toBe(true) + expect(cachedFork.size).toBeGreaterThan(1_000_000) + expect(processedFile(first.processedFiles, ownerPath).parseResumeState).toBeNull() + await appendFile(ownerPath, assistantRow('owner-new', { inputTokens: 50 })) + streamReads.length = 0 + + const second = await scan(first.processedFiles) + expect(processedFile(second.processedFiles, forkPath)).toBe(cachedFork) + expect(streamReads.filter((read) => read.path === forkPath)).toEqual([]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions[0]?.turnCount).toBe(2) + expect(second.sessions[0]?.totalInputTokens).toBe(150) + }) + + it('retains a resumed owner when a fork of its earlier history appears', async () => { + const ownerPath = join(projectDir, 'aaaa-owner.jsonl') + const forkPath = join(projectDir, 'zzzz-late-fork.jsonl') + await writeFile(ownerPath, largePrefix() + assistantRow('shared')) + const scan = await scanner() + const first = await scan() + const ownerOffset = processedFile(first.processedFiles, ownerPath).size + + await appendFile(ownerPath, assistantRow('owner-new', { inputTokens: 20 })) + await writeFile( + forkPath, + largePrefix() + + assistantRow('shared', { sessionId: 'fork-session' }) + + assistantRow('fork-new', { sessionId: 'fork-session', inputTokens: 30 }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(ownerPath)).toEqual([ownerOffset]) + expect(processedFile(second.processedFiles, ownerPath).ownedDedupeKeys).toEqual([ + 'message-shared:request-shared', + 'message-owner-new:request-owner-new' + ]) + expect(processedFile(second.processedFiles, forkPath).ownedDedupeKeys).toEqual([ + 'message-fork-new:request-fork-new' + ]) + expect(processedFile(second.processedFiles, forkPath).hasDeferredClaims).toBe(true) + + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions.map((session) => [session.sessionId, session.turnCount])).toEqual([ + ['owner-session', 2], + ['fork-session', 1] + ]) + }) + + it('reclaims copied turns after a deferred fork resumes and its owner is deleted', async () => { + const ownerPath = join(projectDir, 'aaaa-owner.jsonl') + const forkPath = join(projectDir, 'zzzz-deferred-fork.jsonl') + await writeFile(ownerPath, largePrefix() + assistantRow('shared')) + await writeFile( + forkPath, + largePrefix() + + assistantRow('shared', { sessionId: 'fork-session' }) + + assistantRow('fork-new', { sessionId: 'fork-session', inputTokens: 20 }) + ) + const scan = await scanner() + const first = await scan() + const forkOffset = processedFile(first.processedFiles, forkPath).size + + await appendFile( + forkPath, + assistantRow('fork-later', { sessionId: 'fork-session', inputTokens: 30 }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(forkPath)).toEqual([forkOffset]) + expect(processedFile(second.processedFiles, forkPath).hasDeferredClaims).toBe(true) + + await rm(ownerPath) + const third = await scan(second.processedFiles) + const cold = await scan() + expect(third.sessions).toEqual(cold.sessions) + expect(third.dailyAggregates).toEqual(cold.dailyAggregates) + expect(third.sessions[0]?.turnCount).toBe(3) + expect(third.sessions[0]?.totalInputTokens).toBe(60) + expect(processedFile(third.processedFiles, forkPath).ownedDedupeKeys).toHaveLength(3) + }) + + it.each(['rewritten', 'truncated'])( + 'reclaims an unchanged fork after its owner is %s', + async (mode) => { + const ownerPath = join(projectDir, 'aaaa-owner.jsonl') + const forkPath = join(projectDir, 'zzzz-deferred-fork.jsonl') + await writeFile(ownerPath, largePrefix() + assistantRow('shared')) + await writeFile( + forkPath, + largePrefix() + + assistantRow('shared', { sessionId: 'fork-session' }) + + assistantRow('fork-new', { sessionId: 'fork-session', inputTokens: 20 }) + ) + const scan = await scanner() + const first = await scan() + const unrelated = assistantRow('replacement', { + sessionId: 'replacement-session', + inputTokens: 11 + }) + await writeFile( + ownerPath, + mode === 'rewritten' ? largePrefix('replacement') + unrelated : unrelated + ) + + const second = await scan(first.processedFiles) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(processedFile(second.processedFiles, forkPath).ownedDedupeKeys).toEqual([ + 'message-shared:request-shared', + 'message-fork-new:request-fork-new' + ]) + expect(second.sessions.reduce((total, session) => total + session.totalInputTokens, 0)).toBe( + 41 + ) + } + ) + + it('keeps first-row metadata while applying independent token maxima across appends', async () => { + const transcriptPath = join(projectDir, 'first-metadata.jsonl') + await writeFile( + transcriptPath, + largePrefix() + assistantRow('streamed', { outputTokens: 2, cacheWriteTokens: 5 }) + ) + const scan = await scanner() + const first = await scan() + const firstOffset = processedFile(first.processedFiles, transcriptPath).size + const changedMetadata = { + sessionId: 'different-session', + timestamp: '2026-10-10T12:00:00.000Z', + model: 'claude-opus-4-6', + cwd: worktrees[1]?.path, + gitBranch: 'different-branch' + } + await appendFile( + transcriptPath, + assistantRow('streamed', { + ...changedMetadata, + inputTokens: 20, + outputTokens: 7, + cacheReadTokens: 100, + cacheWriteTokens: 8, + cacheWrite1hTokens: 3 + }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(transcriptPath)).toEqual([firstOffset]) + + await appendFile( + transcriptPath, + assistantRow('streamed', { + ...changedMetadata, + inputTokens: 15, + outputTokens: 12, + cacheReadTokens: 50, + cacheWriteTokens: 6, + cacheWrite1hTokens: 5 + }) + ) + streamReads.length = 0 + const third = await scan(second.processedFiles) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(second.processedFiles, transcriptPath).size + ]) + const cold = await scan() + expect(third.sessions).toEqual(cold.sessions) + expect(third.dailyAggregates).toEqual(cold.dailyAggregates) + expect(third.sessions).toHaveLength(1) + expect(third.sessions[0]).toMatchObject({ + sessionId: 'owner-session', + firstTimestamp: '2026-10-09T12:00:00.000Z', + lastTimestamp: '2026-10-09T12:00:00.000Z', + model: 'claude-sonnet-4-6', + lastCwd: worktrees[0]?.path, + lastGitBranch: 'original-branch', + primaryWorktreeId: 'worktree-a', + turnCount: 1, + totalInputTokens: 20, + totalOutputTokens: 12, + totalCacheReadTokens: 100, + totalCacheWriteTokens: 8, + totalCacheWrite1hTokens: 5 + }) + expect(third.dailyAggregates[0]?.zeroCacheReadTurnCount).toBe(0) + }) + + it('keeps two keys aligned with distinct metadata after persisted appends arrive in reversed key order', async () => { + const transcriptPath = join(projectDir, 'persisted-key-alignment.jsonl') + const firstMetadata = { + sessionId: 'session-a', + timestamp: '2026-10-09T12:00:00.000Z', + cwd: worktrees[0]?.path, + model: 'claude-sonnet-4-6', + gitBranch: 'branch-a' + } + const secondMetadata = { + sessionId: 'session-b', + timestamp: '2026-10-08T13:00:00.000Z', + cwd: worktrees[1]?.path, + model: 'claude-opus-4-6', + gitBranch: 'branch-b' + } + await writeFile( + transcriptPath, + largePrefix() + + assistantRow('key-a', { + ...firstMetadata, + inputTokens: 100, + outputTokens: 10, + cacheReadTokens: 5, + cacheWriteTokens: 20, + cacheWrite1hTokens: 3 + }) + + assistantRow('key-b', { + ...secondMetadata, + inputTokens: 20, + outputTokens: 80, + cacheWriteTokens: 7, + cacheWrite1hTokens: 2 + }) + ) + const scan = await scanner() + const first = await scan() + const firstCache: ClaudeUsagePersistedFile[] = JSON.parse(JSON.stringify(first.processedFiles)) + await appendFile( + transcriptPath, + assistantRow('key-b', { + ...firstMetadata, + timestamp: '2026-10-10T12:00:00.000Z', + inputTokens: 50, + outputTokens: 70, + cacheReadTokens: 11, + cacheWriteTokens: 9, + cacheWrite1hTokens: 1 + }) + + assistantRow('key-a', { + ...secondMetadata, + timestamp: '2026-10-11T12:00:00.000Z', + inputTokens: 80, + outputTokens: 30, + cacheReadTokens: 1, + cacheWriteTokens: 25, + cacheWrite1hTokens: 5 + }) + ) + streamReads.length = 0 + const second = await scan(firstCache) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(firstCache, transcriptPath).size + ]) + const secondCold = await scan() + expect(second.sessions).toEqual(secondCold.sessions) + expect(second.dailyAggregates).toEqual(secondCold.dailyAggregates) + const secondCache: ClaudeUsagePersistedFile[] = JSON.parse( + JSON.stringify(second.processedFiles) + ) + await appendFile( + transcriptPath, + assistantRow('key-b', { + ...firstMetadata, + inputTokens: 40, + outputTokens: 90, + cacheReadTokens: 9, + cacheWriteTokens: 8, + cacheWrite1hTokens: 4 + }) + + assistantRow('key-a', { + ...secondMetadata, + inputTokens: 130, + outputTokens: 20, + cacheWriteTokens: 24, + cacheWrite1hTokens: 4 + }) + ) + streamReads.length = 0 + const third = await scan(secondCache) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(secondCache, transcriptPath).size + ]) + const cold = await scan() + expect(third.sessions).toEqual(cold.sessions) + expect(third.dailyAggregates).toEqual(cold.dailyAggregates) + expect(third.sessions.find((session) => session.sessionId === 'session-a')).toMatchObject({ + firstTimestamp: firstMetadata.timestamp, + lastTimestamp: firstMetadata.timestamp, + model: firstMetadata.model, + lastCwd: firstMetadata.cwd, + lastGitBranch: firstMetadata.gitBranch, + primaryWorktreeId: 'worktree-a', + turnCount: 1, + totalInputTokens: 130, + totalOutputTokens: 30, + totalCacheReadTokens: 5, + totalCacheWriteTokens: 25, + totalCacheWrite1hTokens: 5 + }) + expect(third.sessions.find((session) => session.sessionId === 'session-b')).toMatchObject({ + firstTimestamp: secondMetadata.timestamp, + lastTimestamp: secondMetadata.timestamp, + model: secondMetadata.model, + lastCwd: secondMetadata.cwd, + lastGitBranch: secondMetadata.gitBranch, + primaryWorktreeId: 'worktree-b', + turnCount: 1, + totalInputTokens: 50, + totalOutputTokens: 90, + totalCacheReadTokens: 11, + totalCacheWriteTokens: 9, + totalCacheWrite1hTokens: 4 + }) + }) + + it('keeps an invalid first timestamp uncounted when a later duplicate has valid metadata', async () => { + const transcriptPath = join(projectDir, 'invalid-first-timestamp.jsonl') + await writeFile( + transcriptPath, + largePrefix() + assistantRow('invalid-first', { timestamp: 'invalid-timestamp' }) + ) + const scan = await scanner() + const first = await scan() + expect(first.sessions).toEqual([]) + expect(processedFile(first.processedFiles, transcriptPath).ownedDedupeKeys).toEqual([ + 'message-invalid-first:request-invalid-first' + ]) + await appendFile( + transcriptPath, + assistantRow('invalid-first', { sessionId: 'valid-later-session', inputTokens: 20 }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(first.processedFiles, transcriptPath).size + ]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions).toEqual([]) + expect(second.dailyAggregates).toEqual([]) + }) + + it('uses first session encounter order when an append creates a last-timestamp tie', async () => { + const transcriptPath = join(projectDir, 'session-tie.jsonl') + await writeFile( + transcriptPath, + largePrefix() + + assistantRow('session-a-first', { sessionId: 'session-a' }) + + assistantRow('session-b-first', { + sessionId: 'session-b', + timestamp: '2026-10-09T13:00:00.000Z' + }) + ) + const scan = await scanner() + const first = await scan() + expect(first.sessions.map((session) => session.sessionId)).toEqual(['session-b', 'session-a']) + + await appendFile( + transcriptPath, + assistantRow('session-a-later', { + sessionId: 'session-a', + timestamp: '2026-10-09T13:00:00.000Z' + }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(first.processedFiles, transcriptPath).size + ]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions.map((session) => session.sessionId)).toEqual(['session-a', 'session-b']) + }) + + it.each(['keyed', 'unkeyed'])( + 'uses a %s first location encounter when appended maxima create a primary-location tie', + async (firstRowKind) => { + const transcriptPath = join(projectDir, 'location-tie.jsonl') + const secondLocation = assistantRow('second-location', { + cwd: worktrees[1]?.path, + inputTokens: 20 + }) + const history = + firstRowKind === 'unkeyed' + ? assistantRow('unkeyed-location', { inputTokens: 5, identified: false }) + + secondLocation + + assistantRow('first-location', { inputTokens: 5 }) + : assistantRow('first-location', { inputTokens: 10 }) + secondLocation + await writeFile(transcriptPath, largePrefix() + history) + const scan = await scanner() + const first = await scan() + expect(first.sessions[0]?.primaryWorktreeId).toBe('worktree-b') + expect(first.sessions[0]?.locationBreakdown.map((location) => location.worktreeId)).toEqual([ + 'worktree-b', + 'worktree-a' + ]) + await appendFile( + transcriptPath, + assistantRow('first-location', { inputTokens: firstRowKind === 'unkeyed' ? 15 : 20 }) + ) + streamReads.length = 0 + const second = await scan(first.processedFiles) + expect(parseReadOffsets(transcriptPath)).toEqual([ + processedFile(first.processedFiles, transcriptPath).size + ]) + const cold = await scan() + expect(second.sessions).toEqual(cold.sessions) + expect(second.dailyAggregates).toEqual(cold.dailyAggregates) + expect(second.sessions[0]?.primaryWorktreeId).toBe('worktree-a') + expect(second.sessions[0]?.turnCount).toBe(firstRowKind === 'unkeyed' ? 3 : 2) + expect(second.sessions[0]?.locationBreakdown.map((location) => location.worktreeId)).toEqual([ + 'worktree-a', + 'worktree-b' + ]) + } + ) +}) diff --git a/src/main/claude-usage/scanner-incremental-reader.test.ts b/src/main/claude-usage/scanner-incremental-reader.test.ts new file mode 100644 index 00000000000..52e4ed25de9 --- /dev/null +++ b/src/main/claude-usage/scanner-incremental-reader.test.ts @@ -0,0 +1,608 @@ +import { appendFile, mkdir, mkdtemp, rename, rm, stat, utimes, writeFile } from 'node:fs/promises' +import type * as NodeFsPromises from 'node:fs/promises' +import type * as NodeOs from 'node:os' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import type { scanClaudeUsageFiles } from './scanner' +import type { ClaudeUsagePersistedFile } from './types' + +type ReaderObservations = { + chunkBytes: number | undefined + afterStat: (() => Promise) | undefined + readFailure: 'eof' | Error | undefined + readFailureAtCall: number | undefined + streamEndOverride: number | undefined + handles: { path: string; closes: number; closed: boolean }[] + streams: { path: string; start: number; end: number | undefined; bytes: number }[] + windows: { path: string; start: number; bytes: number }[] +} + +const { homedirMock, reads } = vi.hoisted(() => { + const reads: ReaderObservations = { + chunkBytes: undefined, + afterStat: undefined, + readFailure: undefined, + readFailureAtCall: undefined, + streamEndOverride: undefined, + handles: [], + streams: [], + windows: [] + } + return { homedirMock: vi.fn<() => string>(), reads } +}) + +vi.mock('node:os', async () => ({ + ...(await vi.importActual('node:os')), + homedir: homedirMock +})) + +vi.mock('../claude-accounts/claude-profile-installed-router', () => ({ + claudeProfileHistoryDirs: () => [] +})) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + open: async (...args: Parameters) => { + const handle = await actual.open(...args) + const observedHandle = { path: String(args[0]), closes: 0, closed: false } + reads.handles.push(observedHandle) + const statHandle = handle.stat.bind(handle) + const closeHandle = handle.close.bind(handle) + const createStream = handle.createReadStream.bind(handle) + const readWindow = handle.read.bind(handle) + let streaming = false + vi.spyOn(handle, 'stat').mockImplementation(async (options) => { + const snapshot = await statHandle(options) + const mutate = reads.afterStat + reads.afterStat = undefined + await mutate?.() + return snapshot + }) + vi.spyOn(handle, 'close').mockImplementation(async () => { + await closeHandle() + if (!observedHandle.closed && handle.fd === -1) { + observedHandle.closes++ + } + observedHandle.closed = handle.fd === -1 + }) + vi.spyOn(handle, 'createReadStream').mockImplementation((options) => { + const read = { + path: String(args[0]), + start: options?.start ?? 0, + end: options?.end, + bytes: 0 + } + reads.streams.push(read) + const end = reads.streamEndOverride ?? options?.end + reads.streamEndOverride = undefined + const stream = createStream({ ...options, end, highWaterMark: reads.chunkBytes }) + streaming = true + stream.once('end', () => (streaming = false)) + stream.once('close', () => (streaming = false)) + stream.on('data', (chunk: Buffer) => { + read.bytes += chunk.length + }) + return stream + }) + vi.spyOn(handle, 'read').mockImplementation(async (...readArgs) => { + if (streaming) { + return readWindow(...readArgs) + } + const scheduled = + reads.readFailureAtCall === undefined || + reads.readFailureAtCall === reads.windows.length + 1 + const failure = scheduled ? reads.readFailure : undefined + if (scheduled) { + reads.readFailure = undefined + reads.readFailureAtCall = undefined + } + if (failure && failure !== 'eof') { + throw failure + } + const result = await readWindow(...readArgs) + const read = failure === 'eof' ? { ...result, bytesRead: 0 } : result + const position = readArgs.at(-1) + reads.windows.push({ + path: String(args[0]), + start: typeof position === 'number' ? position : 0, + bytes: read.bytesRead + }) + return read + }) + return handle + } + } +}) + +type ScanResult = Awaited> + +let root: string +let transcriptPath: string + +beforeEach(async () => { + root = await mkdtemp(join(tmpdir(), 'orca-claude-usage-reader-')) + homedirMock.mockReturnValue(root) + const projectDir = join(root, '.claude', 'projects', 'project-a') + await mkdir(projectDir, { recursive: true }) + transcriptPath = join(projectDir, 'reader-session.jsonl') + reads.chunkBytes = undefined + reads.afterStat = undefined + reads.readFailure = undefined + reads.readFailureAtCall = undefined + reads.streamEndOverride = undefined + reads.handles.length = 0 + reads.streams.length = 0 + reads.windows.length = 0 + vi.resetModules() +}) + +afterEach(async () => { + await rm(root, { recursive: true, force: true }) +}) + +function assistantRow(key: string | null, inputTokens: number, ending = '\n'): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'reader-会🙂', + timestamp: '2026-10-09T12:00:00.000Z', + cwd: join(root, 'workspace-会🙂'), + requestId: key === null ? undefined : `request-${key}`, + message: { + id: key === null ? undefined : `message-${key}-会🙂`, + model: 'claude-sonnet-4-6', + usage: { input_tokens: inputTokens, output_tokens: 5 } + } + })}${ending}` +} + +function padding(ending = '\n'): string { + return `${JSON.stringify({ type: 'user', content: '界🙂'.repeat(2500) })}${ending}` +} + +async function scan(previous: ClaudeUsagePersistedFile[] = []): Promise { + const { scanClaudeUsageFiles } = await import('./scanner') + return scanClaudeUsageFiles([], previous, undefined, []) +} + +function onlyFile(result: ScanResult): ClaudeUsagePersistedFile { + expect(result.processedFiles).toHaveLength(1) + const file = result.processedFiles[0] + if (!file) { + throw new Error('Expected one scanned transcript.') + } + return file +} + +function expectParseRange(start: number, size: number): void { + if (size <= 3 * 4096) { + expect(reads.streams).toHaveLength(0) + expect(reads.windows.slice(-2)).toEqual([ + { path: transcriptPath, start, bytes: size - start }, + { path: transcriptPath, start: 0, bytes: size } + ]) + return + } + expect(reads.streams.filter((read) => read.path === transcriptPath)).toEqual([ + { path: transcriptPath, start, end: size - 1, bytes: size - start } + ]) +} + +async function expectColdParity(result: ScanResult): Promise { + const cold = await scan() + expect(result.sessions).toEqual(cold.sessions) + expect(result.dailyAggregates).toEqual(cold.dailyAggregates) + expect(onlyFile(result).lineCount).toBe(onlyFile(cold).lineCount) +} + +describe('Claude usage incremental reader', () => { + it('publishes the pinned snapshot and discovers a concurrent append on the next scan', async () => { + const prefix = padding() + assistantRow('old', 10) + const appended = assistantRow('new', 20) + await writeFile(transcriptPath, prefix) + reads.afterStat = () => appendFile(transcriptPath, appended) + + const first = await scan() + + expectParseRange(0, Buffer.byteLength(prefix)) + expect(onlyFile(first).size).toBe(Buffer.byteLength(prefix)) + expect(onlyFile(first).parseResumeState?.parsedBytes).toBe(Buffer.byteLength(prefix)) + expect((await stat(transcriptPath)).size).toBe(Buffer.byteLength(prefix + appended)) + expect(first.sessions[0]?.totalInputTokens).toBe(10) + reads.streams.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(Buffer.byteLength(prefix), Buffer.byteLength(prefix + appended)) + expect(onlyFile(second).size).toBe(Buffer.byteLength(prefix + appended)) + expect(second.sessions[0]?.totalInputTokens).toBe(30) + expect(second.sessions[0]?.turnCount).toBe(2) + await expectColdParity(second) + }) + + it('reopens after truncation between stat and sampling and closes every opened handle', async () => { + await writeFile(transcriptPath, padding() + assistantRow('old', 10)) + const replacement = assistantRow('replacement', 90) + reads.afterStat = () => writeFile(transcriptPath, replacement) + + const result = await scan() + + expectParseRange(0, Buffer.byteLength(replacement)) + expect(reads.windows.some((read) => read.path === transcriptPath && read.bytes === 0)).toBe( + true + ) + expect(reads.handles).toEqual([ + { path: transcriptPath, closes: 1, closed: true }, + { path: transcriptPath, closes: 1, closed: true } + ]) + expect(onlyFile(result).size).toBe(Buffer.byteLength(replacement)) + expect(result.sessions[0]?.totalInputTokens).toBe(90) + await expectColdParity(result) + }, 5000) + + it('rejects a short sample from an unchanged file once and closes its only handle', async () => { + await writeFile(transcriptPath, padding() + assistantRow('old', 10)) + const original = await stat(transcriptPath) + reads.readFailure = 'eof' + + await expect(scan()).rejects.toThrow(/snapshot read.*unchanged file boundary/) + + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(reads.windows).toEqual([{ path: transcriptPath, start: 0, bytes: 0 }]) + expect(reads.streams).toHaveLength(0) + expect(await stat(transcriptPath)).toMatchObject({ + dev: original.dev, + ino: original.ino, + size: original.size, + mtimeMs: original.mtimeMs, + ctimeMs: original.ctimeMs + }) + }, 5000) + + it('propagates a sampling access failure without retrying and closes its only handle', async () => { + await writeFile(transcriptPath, padding() + assistantRow('old', 10)) + const failure = Object.assign(new Error('Sampling access denied'), { code: 'EACCES' }) + reads.readFailure = failure + + await expect(scan()).rejects.toBe(failure) + + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(reads.streams).toHaveLength(0) + }, 5000) + + it('rejects a zero-byte post-parse verification read from an unchanged file without retrying', async () => { + const content = padding() + assistantRow('old', 10) + assistantRow('new', 20) + const contentBytes = Buffer.byteLength(content) + await writeFile(transcriptPath, content) + const original = await stat(transcriptPath) + reads.readFailure = 'eof' + reads.readFailureAtCall = 3 + + await expect(scan()).rejects.toThrow(/snapshot read.*unchanged file boundary/) + + expectParseRange(0, contentBytes) + expect(reads.windows).toEqual([ + { path: transcriptPath, start: 0, bytes: 4096 }, + { path: transcriptPath, start: contentBytes - 4096, bytes: 4096 }, + { path: transcriptPath, start: 0, bytes: 0 } + ]) + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(await stat(transcriptPath)).toMatchObject({ + dev: original.dev, + ino: original.ino, + size: original.size, + mtimeMs: original.mtimeMs, + ctimeMs: original.ctimeMs + }) + reads.streams.length = 0 + reads.handles.length = 0 + + const cold = await scan() + + expectParseRange(0, contentBytes) + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(onlyFile(cold).size).toBe(contentBytes) + expect(onlyFile(cold).ownedDedupeKeys).toEqual([ + 'message-old-会🙂:request-old', + 'message-new-会🙂:request-new' + ]) + expect(onlyFile(cold).parseResumeState?.ownedTokenMaxima).toHaveLength(2) + expect(cold.sessions[0]?.totalInputTokens).toBe(30) + expect(cold.sessions[0]?.turnCount).toBe(2) + }, 5000) + + it('rejects an unchanged large file stream that ends early instead of caching partial totals', async () => { + const head = padding() + const rows = Array.from({ length: 40 }, (_, index) => assistantRow(`row-${index}`, 10)) + const content = head + rows.join('') + const partialContent = head + rows.slice(0, 5).join('') + const contentBytes = Buffer.byteLength(content) + const partialBytes = Buffer.byteLength(partialContent) + await writeFile(transcriptPath, content) + const original = await stat(transcriptPath) + reads.streamEndOverride = partialBytes - 1 + + await expect(scan()).rejects.toThrow(/snapshot stream.*unchanged file boundary/) + + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(reads.streams).toEqual([ + { path: transcriptPath, start: 0, end: contentBytes - 1, bytes: partialBytes } + ]) + expect(reads.windows).toContainEqual({ + path: transcriptPath, + start: contentBytes - 4096, + bytes: 4096 + }) + expect(await stat(transcriptPath)).toMatchObject({ + dev: original.dev, + ino: original.ino, + size: original.size, + mtimeMs: original.mtimeMs, + ctimeMs: original.ctimeMs + }) + reads.streams.length = 0 + reads.handles.length = 0 + + const cold = await scan() + + expectParseRange(0, contentBytes) + expect(reads.handles).toEqual([{ path: transcriptPath, closes: 1, closed: true }]) + expect(onlyFile(cold).size).toBe(contentBytes) + expect(onlyFile(cold).parseResumeState?.parsedBytes).toBe(contentBytes) + expect(onlyFile(cold).ownedDedupeKeys).toEqual( + rows.map((_, index) => `message-row-${index}-会🙂:request-row-${index}`) + ) + expect(onlyFile(cold).parseResumeState?.ownedTokenMaxima).toHaveLength(40) + expect(onlyFile(cold).hasDeferredClaims).toBe(false) + expect(cold.sessions[0]?.totalInputTokens).toBe(400) + expect(cold.sessions[0]?.totalOutputTokens).toBe(200) + expect(cold.sessions[0]?.turnCount).toBe(40) + }, 5000) + + it('resumes at exact UTF8 byte offsets after CRLF and blank lines', async () => { + reads.chunkBytes = 7 + const prefix = `${padding('\r\n')}${assistantRow('old', 10, '\r\n')}\r\n` + await writeFile(transcriptPath, prefix) + const first = await scan() + const prefixBytes = Buffer.byteLength(prefix) + expect(prefixBytes).toBeGreaterThan(prefix.length) + expect(onlyFile(first).parseResumeState?.parsedBytes).toBe(prefixBytes) + expect(onlyFile(first).parseResumeState?.lineCount).toBe(3) + const appended = `${assistantRow('new', 20, '\r\n')}{"type":"user","text":"終🙂"}\r\n` + await appendFile(transcriptPath, appended) + reads.streams.length = 0 + reads.windows.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(prefixBytes, prefixBytes + Buffer.byteLength(appended)) + expect(reads.windows.some((read) => read.start === 0 && read.bytes === 4096)).toBe(true) + expect(onlyFile(second).parseResumeState?.parsedBytes).toBe( + prefixBytes + Buffer.byteLength(appended) + ) + expect(onlyFile(second).lineCount).toBe(5) + expect(second.sessions[0]?.sessionId).toBe('reader-会🙂') + expect(second.sessions[0]?.totalInputTokens).toBe(30) + expect(second.sessions[0]?.turnCount).toBe(2) + await expectColdParity(second) + }) + + it('replays an incomplete UTF8 tail from the last complete line when it becomes valid', async () => { + const prefix = padding('\r\n') + assistantRow('old', 10, '\r\n') + const next = Buffer.from(assistantRow('completed', 20, '\r\n')) + const split = next.indexOf(Buffer.from('🙂')) + 2 + await writeFile(transcriptPath, Buffer.concat([Buffer.from(prefix), next.subarray(0, split)])) + const first = await scan() + expect(onlyFile(first).parseResumeState?.parsedBytes).toBe(Buffer.byteLength(prefix)) + expect(onlyFile(first).parseResumeState?.lineCount).toBe(2) + expect(onlyFile(first).lineCount).toBe(3) + expect(first.sessions[0]?.totalInputTokens).toBe(10) + await appendFile(transcriptPath, next.subarray(split)) + reads.streams.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(Buffer.byteLength(prefix), Buffer.byteLength(prefix) + next.length) + expect(onlyFile(second).lineCount).toBe(3) + expect(second.sessions[0]?.totalInputTokens).toBe(30) + expect(second.sessions[0]?.turnCount).toBe(2) + await expectColdParity(second) + }) + + it.each([ + { label: 'unkeyed turn', key: null, firstTotal: 35, nextTotal: 55, turns: 3 }, + { label: 'duplicate token maxima', key: 'old', firstTotal: 25, nextTotal: 45, turns: 2 } + ])('counts a valid unterminated $label once when later terminated', async (testCase) => { + const prefix = padding() + assistantRow('old', 10) + const tail = assistantRow(testCase.key, 25, '') + await writeFile(transcriptPath, prefix + tail) + const first = await scan() + expect(onlyFile(first).parseResumeState).toBeNull() + expect(first.sessions[0]?.totalInputTokens).toBe(testCase.firstTotal) + const appended = `\n${assistantRow('new', 20)}` + await appendFile(transcriptPath, appended) + reads.streams.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(0, Buffer.byteLength(prefix + tail + appended)) + expect(second.sessions[0]?.totalInputTokens).toBe(testCase.nextTotal) + expect(second.sessions[0]?.turnCount).toBe(testCase.turns) + await expectColdParity(second) + const unchanged = await scan(second.processedFiles) + expect(unchanged.sessions).toEqual(second.sessions) + expect(unchanged.dailyAggregates).toEqual(second.dailyAggregates) + }) + + it('restores a JSON-persisted checkpoint after restart and resumes growth with unchanged mtime', async () => { + const prefix = padding() + assistantRow('old', 10) + const timestamp = new Date('2026-10-09T12:00:00.000Z') + await writeFile(transcriptPath, prefix) + await utimes(transcriptPath, timestamp, timestamp) + const first = await scan() + const persisted: ClaudeUsagePersistedFile[] = JSON.parse(JSON.stringify(first.processedFiles)) + const appended = assistantRow('old', 25) + assistantRow('new', 20) + await appendFile(transcriptPath, appended) + await utimes(transcriptPath, timestamp, timestamp) + expect((await stat(transcriptPath)).mtimeMs).toBe(onlyFile(first).mtimeMs) + vi.resetModules() + reads.streams.length = 0 + + const second = await scan(persisted) + + expectParseRange(Buffer.byteLength(prefix), Buffer.byteLength(prefix + appended)) + expect(second.sessions[0]?.totalInputTokens).toBe(45) + expect(second.sessions[0]?.turnCount).toBe(2) + await expectColdParity(second) + }) + + it('rebuilds an older cached projection without a resume checkpoint', async () => { + const prefix = padding() + assistantRow('old', 10) + await writeFile(transcriptPath, prefix) + const first = await scan() + const legacyFiles = first.processedFiles.map(({ parseResumeState, ...file }) => { + expect(parseResumeState).toBeTruthy() + return file + }) + const appended = assistantRow('new', 20) + await appendFile(transcriptPath, appended) + reads.streams.length = 0 + + const second = await scan(legacyFiles) + + expectParseRange(0, Buffer.byteLength(prefix + appended)) + expect(second.sessions[0]?.totalInputTokens).toBe(30) + await expectColdParity(second) + }) + + it.each([ + { change: 'an unchanged file', total: 10 }, + { change: 'an atomic same-size replacement', total: 90 } + ])('upgrades legacy identity metadata once for $change', async ({ change, total }) => { + const timestamp = new Date('2026-10-09T12:00:00.000Z') + const prefix = padding() + const original = prefix + assistantRow('old', 10) + await writeFile(transcriptPath, original) + await utimes(transcriptPath, timestamp, timestamp) + const first = await scan() + const legacyFiles = first.processedFiles.map(({ physicalFileId, ctimeMs, ...file }) => { + expect(physicalFileId).not.toBeUndefined() + expect(typeof ctimeMs).toBe('number') + return file + }) + if (change === 'an atomic same-size replacement') { + const replacement = prefix + assistantRow('new', 90) + expect(Buffer.byteLength(replacement)).toBe(Buffer.byteLength(original)) + const replacementPath = `${transcriptPath}.replacement` + await writeFile(replacementPath, replacement) + await utimes(replacementPath, timestamp, timestamp) + await rename(replacementPath, transcriptPath) + } + const currentStats = await stat(transcriptPath) + expect(currentStats.size).toBe(onlyFile(first).size) + expect(currentStats.mtimeMs).toBe(onlyFile(first).mtimeMs) + reads.streams.length = 0 + + const upgraded = await scan(legacyFiles) + + expectParseRange(0, Buffer.byteLength(original)) + expect(onlyFile(upgraded).physicalFileId).not.toBeUndefined() + expect(typeof onlyFile(upgraded).ctimeMs).toBe('number') + expect(upgraded.sessions[0]?.totalInputTokens).toBe(total) + await expectColdParity(upgraded) + reads.streams.length = 0 + reads.windows.length = 0 + reads.handles.length = 0 + + const unchanged = await scan(upgraded.processedFiles) + + expect(onlyFile(unchanged)).toBe(onlyFile(upgraded)) + expect(reads.streams).toHaveLength(0) + expect(reads.windows).toHaveLength(0) + expect(reads.handles).toHaveLength(0) + }) + + it.each([ + { mutation: 'rotation', layout: 'small' }, + { mutation: 'in-place rewrite', layout: 'small' }, + { mutation: 'rotation', layout: 'large' }, + { mutation: 'in-place rewrite', layout: 'large middle' } + ])( + 'invalidates a $layout file after same-size $mutation with restored mtime', + async ({ mutation, layout }) => { + const timestamp = new Date('2026-10-09T12:00:00.000Z') + const prefix = layout === 'small' ? '' : padding() + const suffix = layout === 'large middle' ? padding() : '' + const original = prefix + assistantRow('old', 10) + suffix + const replacement = prefix + assistantRow('new', 90) + suffix + expect(Buffer.byteLength(replacement)).toBe(Buffer.byteLength(original)) + await writeFile(transcriptPath, original) + await utimes(transcriptPath, timestamp, timestamp) + const first = await scan() + const cached = onlyFile(first) + if (layout === 'small') { + expect(cached.parseResumeState).toBeNull() + } else { + expect(cached.parseResumeState).toBeTruthy() + } + await new Promise((resolve) => setTimeout(resolve, 20)) + if (mutation === 'rotation') { + await rename(transcriptPath, `${transcriptPath}.rotated`) + } + await writeFile(transcriptPath, replacement) + await utimes(transcriptPath, timestamp, timestamp) + const rewritten = await stat(transcriptPath) + expect(rewritten.size).toBe(cached.size) + expect(rewritten.mtimeMs).toBe(cached.mtimeMs) + expect(rewritten.ctimeMs).not.toBe(cached.ctimeMs) + reads.streams.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(0, Buffer.byteLength(replacement)) + expect(second.sessions[0]?.totalInputTokens).toBe(90) + const current = onlyFile(second) + if (mutation === 'rotation' && cached.physicalFileId !== null) { + expect(current.physicalFileId).not.toBe(cached.physicalFileId) + } else { + expect(current.physicalFileId).toBe(cached.physicalFileId) + } + await expectColdParity(second) + } + ) + + it.each([ + { mutation: 'head rewrite', total: 140 }, + { mutation: 'boundary rewrite', total: 100 }, + { mutation: 'rotation', total: 50 }, + { mutation: 'truncation', total: 50 } + ])('discards stale totals after $mutation', async ({ mutation, total }) => { + const prefix = assistantRow('old', 10) + padding() + assistantRow('second', 30) + await writeFile(transcriptPath, prefix) + const first = await scan() + expect(onlyFile(first).parseResumeState).toBeTruthy() + let replacement: string + if (mutation === 'rotation') { + await rename(transcriptPath, `${transcriptPath}.rotated`) + replacement = assistantRow('replacement', 50) + } else if (mutation === 'truncation') { + replacement = assistantRow('replacement', 50) + } else { + replacement = + prefix.replace( + mutation === 'head rewrite' ? '"input_tokens":10' : '"input_tokens":30', + mutation === 'head rewrite' ? '"input_tokens":90' : '"input_tokens":70' + ) + assistantRow('new', 20) + } + await writeFile(transcriptPath, replacement) + reads.streams.length = 0 + + const second = await scan(first.processedFiles) + + expectParseRange(0, Buffer.byteLength(replacement)) + expect(second.sessions[0]?.totalInputTokens).toBe(total) + await expectColdParity(second) + }) +}) diff --git a/src/main/claude-usage/scanner.ts b/src/main/claude-usage/scanner.ts index 13652648afe..913fe6e0f9c 100644 --- a/src/main/claude-usage/scanner.ts +++ b/src/main/claude-usage/scanner.ts @@ -1,181 +1,194 @@ -import { stat } from 'node:fs/promises' import type { ClaudeUsageDailyAggregate, - ClaudeUsageParsedTurn, + ClaudeUsageParseResumeState, ClaudeUsagePersistedFile, - ClaudeUsageProcessedFile, ClaudeUsageSession } from './types' import { listClaudeTranscriptFiles } from './transcript-file-discovery' -import { readClaudeUsageScanFile, stripClaudeSourceMetadata } from './transcript-record-parser' import { - attributeClaudeUsageTurns, - buildWorktreeLookup, - type ClaudeUsageWorktreeRef -} from './worktree-attribution' + getClaudeUsageProcessedFileStat, + readClaudeUsageScanFile, + type ClaudeUsageScanFile +} from './transcript-record-parser' +import { buildWorktreeLookup, type ClaudeUsageWorktreeRef } from './worktree-attribution' import { - aggregateClaudeUsage, finalizeClaudeSessions, mergeClaudeDailyAggregates, mergeClaudeSessions } from './usage-aggregation' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import { + normalizeClaudeUsageSourceFiles, + type ClaudeUsageVerifiedSources +} from './persisted-projection-validation' const FILE_SCAN_BATCH_SIZE = 4 -// Why setImmediate: setTimeout(0) is clamped to ~1ms, and this yields once per -// 4-file batch, so a 7.5k-transcript scan spent ~2s parked on timers. -async function yieldToEventLoop(): Promise { - await new Promise((resolve) => setImmediate(resolve)) +type ClaudeUsageFilePlan = { + previous: ClaudeUsagePersistedFile | undefined + reusable: boolean + resume: ClaudeUsageParseResumeState | null } -async function getProcessedFileStat( - filePath: string -): Promise> { - const fileStat = await stat(filePath) +async function planClaudeUsageFile( + filePath: string, + previous: ClaudeUsagePersistedFile | undefined, + resumable: ReadonlySet +): Promise { + const fileInfo = await getClaudeUsageProcessedFileStat(filePath) + const validProjection = + previous && + Array.isArray(previous.sessions) && + Array.isArray(previous.dailyAggregates) && + Array.isArray(previous.ownedDedupeKeys) && + typeof previous.hasDeferredClaims === 'boolean' + const previousId = previous?.physicalFileId ?? previous?.parseResumeState?.physicalFileId + const reusable = Boolean( + validProjection && + previous.physicalFileId !== undefined && + typeof previous.ctimeMs === 'number' && + previous.mtimeMs === fileInfo.mtimeMs && + previous.size === fileInfo.size && + (previous.ctimeMs === undefined || previous.ctimeMs === fileInfo.ctimeMs) && + (!previousId || !fileInfo.physicalFileId || previousId === fileInfo.physicalFileId) + ) + const resume = + !reusable && validProjection && fileInfo.size > previous.size && resumable.has(previous) + ? previous.parseResumeState + : null return { - path: filePath, - mtimeMs: fileStat.mtimeMs, - size: fileStat.size + previous, + reusable, + resume: resume && previous?.parseResumeState ? previous.parseResumeState : null } } +async function yieldToEventLoop(): Promise { + await new Promise((resolve) => setImmediate(resolve)) +} + export async function scanClaudeUsageFiles( worktrees: ClaudeUsageWorktreeRef[], previousProcessedFiles: ClaudeUsagePersistedFile[] = [], onFilesScanned?: (count: number) => void, - profileDirs?: string[] + profileDirs?: string[], + verifiedSources?: ClaudeUsageVerifiedSources ): Promise<{ processedFiles: ClaudeUsagePersistedFile[] sessions: ClaudeUsageSession[] dailyAggregates: ClaudeUsageDailyAggregate[] }> { const files = await listClaudeTranscriptFiles(profileDirs) + const normalized = normalizeClaudeUsageSourceFiles(previousProcessedFiles, verifiedSources) + previousProcessedFiles = normalized.processedFiles const previousByPath = new Map(previousProcessedFiles.map((file) => [file.path, file])) const worktreeLookup = await buildWorktreeLookup(worktrees) - - const currentPaths = new Set(files) - // Why: when a file that owned dedupe keys is deleted, remaining forks still - // contain those turns but their caches record them as unowned. Only files - // that previously deferred claims can reclaim, so invalidate those — not the - // entire transcript corpus (histories can be gigabytes). - const lostOwnerPath = previousProcessedFiles.some( - (file) => - !currentPaths.has(file.path) && - Array.isArray(file.ownedDedupeKeys) && - file.ownedDedupeKeys.length > 0 - ) - - const reusedByPath = new Map() - const pathsToParse: string[] = [] + const plans = new Map() for (let index = 0; index < files.length; index += FILE_SCAN_BATCH_SIZE) { const batch = files.slice(index, index + FILE_SCAN_BATCH_SIZE) - const reusable = await Promise.all( - batch.map(async (filePath) => { - const fileInfo = await getProcessedFileStat(filePath) - const previous = previousByPath.get(filePath) - // Why: Claude histories can be gigabytes. Unchanged files should pay - // only stat cost on refresh while preserving exactly the old projection. - // When an owner disappears, only deferred-claim files need reparse. - const mustReclaimDeferred = lostOwnerPath && previous?.hasDeferredClaims !== false - const canReuse = - !mustReclaimDeferred && - previous && - previous.mtimeMs === fileInfo.mtimeMs && - previous.size === fileInfo.size && - Array.isArray(previous.sessions) && - Array.isArray(previous.dailyAggregates) && - Array.isArray(previous.ownedDedupeKeys) && - typeof previous.hasDeferredClaims === 'boolean' - return canReuse ? previous : null - }) + const batchPlans = await Promise.all( + batch.map((path) => planClaudeUsageFile(path, previousByPath.get(path), normalized.resumable)) ) - for (const [batchIndex, previous] of reusable.entries()) { - if (previous) { - reusedByPath.set(batch[batchIndex], previous) - } else { - pathsToParse.push(batch[batchIndex]) - } + for (const [offset, plan] of batchPlans.entries()) { + plans.set(batch[offset], plan) } onFilesScanned?.(batch.length) if (index + batch.length < files.length) { await yieldToEventLoop() } } - - // Why: resuming or forking a Claude session copies earlier turns — with their - // original message/request IDs — into a new transcript file under a new - // session id. Per-file dedupe cannot see those copies, so long-lived sessions - // get re-counted on every fork (issue #8006). Cross-file ownership counts each - // turn for exactly one file; cached files keep the claims they persisted. - const turnOwnerByDedupeKey = new Map() - for (const [filePath, previous] of reusedByPath) { - for (const dedupeKey of previous.ownedDedupeKeys) { - // First cached claim wins so conflicting projections stay deterministic. - if (!turnOwnerByDedupeKey.has(dedupeKey)) { - turnOwnerByDedupeKey.set(dedupeKey, filePath) + const lostOwner = previousProcessedFiles.some( + (previous) => previous.ownedDedupeKeys?.length > 0 && !plans.has(previous.path) + ) + const ownerByKey = new Map() + const projections = new Map() + for (const path of files) { + const plan = plans.get(path)! + const previousKeys = plan.previous?.ownedDedupeKeys + for (const key of Array.isArray(previousKeys) ? previousKeys : []) { + if (!ownerByKey.has(key)) { + ownerByKey.set(key, path) } } + if (plan.reusable && plan.previous) { + projections.set(path, plan.previous) + } } - - const parsedByPath = new Map() - for (let index = 0; index < pathsToParse.length; index += FILE_SCAN_BATCH_SIZE) { - const batch = pathsToParse.slice(index, index + FILE_SCAN_BATCH_SIZE) - // Why: transcript scans run in Electron's main process. Small parallel - // batches cut independent file I/O without letting Settings stay blocked. - const reads = await Promise.all(batch.map((filePath) => readClaudeUsageScanFile(filePath))) - for (const [batchIndex, filePath] of batch.entries()) { - const { processedFile, turns } = reads[batchIndex] - // Why: ownership claims must be sequential in sorted-path order so - // rescans assign duplicated turns to the same file deterministically. - const ownedTurns: ClaudeUsageParsedTurn[] = [] - const ownedDedupeKeys: string[] = [] - let hasDeferredClaims = false - for (const turn of turns) { - if (turn.dedupeKey) { - const owner = turnOwnerByDedupeKey.get(turn.dedupeKey) - if (owner !== undefined && owner !== filePath) { - hasDeferredClaims = true - continue - } - turnOwnerByDedupeKey.set(turn.dedupeKey, filePath) - ownedDedupeKeys.push(turn.dedupeKey) + let lateOwnerLoss = lostOwner + const publishRead = async ( + path: string, + read: ClaudeUsageScanFile, + previous?: ClaudeUsagePersistedFile + ): Promise => { + const releasedKeys: string[] = [] + if (!read.resumed) { + const previousKeys = previous?.ownedDedupeKeys + for (const key of Array.isArray(previousKeys) ? previousKeys : []) { + if (ownerByKey.get(key) === path) { + ownerByKey.delete(key) + releasedKeys.push(key) } - ownedTurns.push(stripClaudeSourceMetadata(turn)) } - const attributed = await attributeClaudeUsageTurns(ownedTurns, worktreeLookup) - parsedByPath.set(filePath, { - ...processedFile, - ...aggregateClaudeUsage(attributed), - ownedDedupeKeys, - hasDeferredClaims - }) + } + const projected = await projectClaudeUsageScanFile( + read, + worktreeLookup, + (key) => { + const owner = ownerByKey.get(key) + if (owner !== undefined && owner !== path) { + return false + } + ownerByKey.set(key, path) + return true + }, + previous + ) + const retainedKeys = new Set(projected.ownedDedupeKeys) + lateOwnerLoss ||= releasedKeys.some((key) => !retainedKeys.has(key)) + projections.set(path, projected) + } + const changed = files.filter((path) => !plans.get(path)?.reusable) + for (let index = 0; index < changed.length; index += FILE_SCAN_BATCH_SIZE) { + const batch = changed.slice(index, index + FILE_SCAN_BATCH_SIZE) + const reads = await Promise.all( + batch.map((path) => readClaudeUsageScanFile(path, plans.get(path)?.resume)) + ) + for (const [offset, path] of batch.entries()) { + await publishRead(path, reads[offset], plans.get(path)?.previous) } onFilesScanned?.(batch.length) - if (index + batch.length < pathsToParse.length) { + if (index + batch.length < changed.length) { await yieldToEventLoop() } } - + // A planned owner can rotate during its read; previously deferred files must then reclaim. + while (lateOwnerLoss) { + lateOwnerLoss = false + for (const path of files) { + const previous = projections.get(path) + if (!previous?.hasDeferredClaims) { + continue + } + await publishRead(path, await readClaudeUsageScanFile(path), previous) + onFilesScanned?.(1) + } + } const processedFiles: ClaudeUsagePersistedFile[] = [] const sessionsById = new Map() const dailyByKey = new Map() - for (const filePath of files) { - const processed = reusedByPath.get(filePath) ?? parsedByPath.get(filePath) - if (!processed) { - continue + for (const path of files) { + const processed = projections.get(path) + if (processed) { + processedFiles.push(processed) + mergeClaudeSessions(sessionsById, processed.sessions) + mergeClaudeDailyAggregates(dailyByKey, processed.dailyAggregates) } - processedFiles.push(processed) - mergeClaudeSessions(sessionsById, processed.sessions) - mergeClaudeDailyAggregates(dailyByKey, processed.dailyAggregates) } - return { processedFiles, sessions: finalizeClaudeSessions(sessionsById), - dailyAggregates: [...dailyByKey.values()].sort((left, right) => - left.day === right.day - ? left.projectLabel.localeCompare(right.projectLabel) - : left.day.localeCompare(right.day) + dailyAggregates: [...dailyByKey.values()].sort((a, b) => + a.day === b.day ? a.projectLabel.localeCompare(b.projectLabel) : a.day.localeCompare(b.day) ) } } diff --git a/src/main/claude-usage/source-cache-compression.test.ts b/src/main/claude-usage/source-cache-compression.test.ts new file mode 100644 index 00000000000..37a643cc3ea --- /dev/null +++ b/src/main/claude-usage/source-cache-compression.test.ts @@ -0,0 +1,62 @@ +import { randomBytes } from 'node:crypto' +import { gzipSync } from 'node:zlib' +import { expect, it } from 'vitest' +import { + compressClaudeUsageSourceText, + decodeClaudeUsageSourceText +} from './source-cache-compression' + +const source = JSON.stringify({ sources: ['Unicode: 日本語 🌊'.repeat(10_000)] }) + +it('shrinks large saved data and restores every original byte', async () => { + const encoded = await compressClaudeUsageSourceText(source) + expect(Buffer.byteLength(encoded)).toBeLessThan(Buffer.byteLength(source) / 4) + expect(await decodeClaudeUsageSourceText(encoded)).toBe(source) +}) + +it('keeps small and existing plain caches readable without changing them', async () => { + const small = '{"schemaVersion":7,"sources":[]}' + expect(await compressClaudeUsageSourceText(small)).toBe(small) + expect(await decodeClaudeUsageSourceText(Buffer.from(small))).toBe(small) + expect(await decodeClaudeUsageSourceText(source)).toBe(source) +}) + +it('never grows a less compressible source and restores its original content', async () => { + const noisy = JSON.stringify({ value: randomBytes(100_000).toString('base64') }) + const saved = await compressClaudeUsageSourceText(noisy) + expect(Buffer.byteLength(saved)).toBeLessThanOrEqual(Buffer.byteLength(noisy)) + expect(await decodeClaudeUsageSourceText(saved)).toBe(noisy) +}) + +it('rejects truncated and corrupted gzip payloads', async () => { + const encoded = await compressClaudeUsageSourceText(source) + if (typeof encoded === 'string') { + throw new Error('Expected compressed fixture.') + } + await expect(decodeClaudeUsageSourceText(encoded.subarray(0, 2))).rejects.toThrow() + await expect(decodeClaudeUsageSourceText(encoded.subarray(0, -5))).rejects.toThrow() + const damaged = Buffer.from(encoded) + damaged[damaged.length - 5] ^= 1 + await expect(decodeClaudeUsageSourceText(damaged)).rejects.toThrow() +}) + +it.each([0, 70_001, 129 * 1024 * 1024])( + 'rejects inconsistent or excessive decoded length %i', + async (declared) => { + const saved = gzipSync('x'.repeat(70_000)) + saved.writeUInt32LE(declared, saved.length - 4) + await expect(decodeClaudeUsageSourceText(saved)).rejects.toThrow() + } +) + +it('bounds decompression to a forged smaller length', async () => { + const saved = gzipSync('x'.repeat(500_000)) + saved.writeUInt32LE(70_000, saved.length - 4) + await expect(decodeClaudeUsageSourceText(saved)).rejects.toThrow() +}) + +it('rejects concatenated streams rather than accepting a partial generation', async () => { + const first = gzipSync('x'.repeat(70_000)) + const second = gzipSync('y'.repeat(70_000)) + await expect(decodeClaudeUsageSourceText(Buffer.concat([first, second]))).rejects.toThrow() +}) diff --git a/src/main/claude-usage/source-cache-compression.ts b/src/main/claude-usage/source-cache-compression.ts new file mode 100644 index 00000000000..71b667dd3df --- /dev/null +++ b/src/main/claude-usage/source-cache-compression.ts @@ -0,0 +1,41 @@ +import { promisify } from 'node:util' +import { gunzip, gzip } from 'node:zlib' + +const gzipAsync = promisify(gzip) +const gunzipAsync = promisify(gunzip) +const MIN_COMPRESSED_BYTES = 64 * 1024 +const MAX_COMPRESSED_BYTES = 128 * 1024 * 1024 +const ZLIB_CHUNK_BYTES = 256 * 1024 + +export async function compressClaudeUsageSourceText(text: string): Promise { + const bytes = Buffer.byteLength(text) + if (bytes < MIN_COMPRESSED_BYTES || bytes > MAX_COMPRESSED_BYTES) { + return text + } + const compressed = await gzipAsync(text, { level: 1, chunkSize: ZLIB_CHUNK_BYTES }) + return compressed.byteLength < bytes ? compressed : text +} + +export async function decodeClaudeUsageSourceText(saved: string | Buffer): Promise { + if (typeof saved === 'string') { + return saved + } + if (saved[0] !== 0x1f || saved[1] !== 0x8b) { + return saved.toString('utf8') + } + if (saved.length < 18) { + throw new Error('Saved Claude usage gzip stream is truncated.') + } + const bytes = saved.readUInt32LE(saved.length - 4) + if (bytes < MIN_COMPRESSED_BYTES || bytes > MAX_COMPRESSED_BYTES) { + throw new Error('Saved Claude usage gzip length is invalid.') + } + const decoded = await gunzipAsync(saved, { + maxOutputLength: bytes, + chunkSize: ZLIB_CHUNK_BYTES + }) + if (decoded.byteLength !== bytes) { + throw new Error('Saved Claude usage compression length is invalid.') + } + return decoded.toString('utf8') +} diff --git a/src/main/claude-usage/source-cache-write-retention.test.ts b/src/main/claude-usage/source-cache-write-retention.test.ts new file mode 100644 index 00000000000..9bf616240d4 --- /dev/null +++ b/src/main/claude-usage/source-cache-write-retention.test.ts @@ -0,0 +1,234 @@ +import { appendFile, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { + persistClaudeUsageSourceCache, + readClaudeUsageSourceCache, + writeClaudeUsageSourceCache, + type ClaudeUsageLoadedSourceCache +} from './persisted-source-cache' +import { scanClaudeUsageFiles } from './scanner' +import { sealUsageCacheJson } from '../usage/usage-cache-json-integrity' +import * as sourceCacheWriter from '../usage/usage-source-cache-file' + +const { discovered } = vi.hoisted(() => { + const paths: string[] = [] + return { discovered: { paths } } +}) +vi.mock('./transcript-file-discovery', () => ({ + listClaudeTranscriptFiles: async () => discovered.paths +})) + +let directory: string +let owner: string +let fork: string +let sourcePath: string + +function ref() { + return { path: sourcePath, schemaVersion: 7, worktreeFingerprint: '[]', reuse: true } +} + +function row(input: number, key = 'shared'): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'session', + requestId: key, + timestamp: '2026-10-09T12:00:00.000Z', + cwd: directory, + message: { id: key, usage: { input_tokens: input, output_tokens: 2 } } + })}\n` +} + +function contents(input: number, key = 'shared'): string { + return `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n${row(input, key)}` +} + +function freeze(value: unknown): void { + if (!value || typeof value !== 'object' || Object.isFrozen(value)) { + return + } + for (const child of Object.values(value)) { + freeze(child) + } + Object.freeze(value) +} + +async function scanAndPersist(previous: ClaudeUsageLoadedSourceCache) { + const result = await scanClaudeUsageFiles( + [], + previous.sources, + undefined, + [], + previous.verifiedSources + ) + await persistClaudeUsageSourceCache(ref(), result.processedFiles, previous) + return result +} + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'orca-claude-retain-source-')) + owner = join(directory, 'owner.jsonl') + fork = join(directory, 'fork.jsonl') + sourcePath = join(directory, 'sources.json') + discovered.paths = [owner, fork] + await writeFile(owner, contents(100)) + await writeFile(fork, contents(100)) + const initial = await scanClaudeUsageFiles([], [], undefined, []) + expect(initial.processedFiles[1].hasDeferredClaims).toBe(true) + await writeClaudeUsageSourceCache(ref(), initial.processedFiles) +}) + +afterEach(async () => { + vi.restoreAllMocks() + await rm(directory, { recursive: true, force: true }) +}) + +it('retains the exact verified sidecar for unchanged frozen files without durable writes', async () => { + const text = await readFile(sourcePath, 'utf8') + const previous = await readClaudeUsageSourceCache(ref()) + const before = JSON.stringify(previous.sources) + freeze(previous.sources) + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + const result = await scanAndPersist(previous) + + expect(result.processedFiles).toEqual(previous.sources) + expect(result.processedFiles[0]).toBe(previous.sources[0]) + expect(result.processedFiles[1]).toBe(previous.sources[1]) + expect(JSON.stringify(previous.sources)).toBe(before) + expect(write).not.toHaveBeenCalled() + expect(await readFile(sourcePath, 'utf8')).toBe(text) +}) + +it.each(['append', 'rewrite', 'new', 'delete', 'reorder', 'reclaim', 'deferred'] as const)( + 'writes the new generation after %s without changing frozen previous files', + async (change) => { + const previous = await readClaudeUsageSourceCache(ref()) + const before = JSON.stringify(previous.sources) + freeze(previous.sources) + if (change === 'append') { + await appendFile(owner, row(150)) + } else if (change === 'rewrite') { + await writeFile(owner, contents(75)) + } else if (change === 'new') { + const added = join(directory, 'new.jsonl') + await writeFile(added, contents(50, 'new')) + discovered.paths.push(added) + } else if (change === 'delete') { + discovered.paths = [owner] + } else if (change === 'reorder') { + discovered.paths.reverse() + } else if (change === 'reclaim') { + discovered.paths = [fork] + } else { + await appendFile(fork, row(200)) + } + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + const result = await scanAndPersist(previous) + + expect(write).toHaveBeenCalledTimes(1) + expect(JSON.stringify(previous.sources)).toBe(before) + expect((await readClaudeUsageSourceCache(ref())).sources).toEqual(result.processedFiles) + if (change === 'reclaim') { + expect(result.processedFiles[0].hasDeferredClaims).toBe(false) + expect(result.sessions[0].totalInputTokens).toBe(100) + } + } +) + +it('writes a schema7 generation even when a legacy scan returns identical file references', async () => { + const saved = await readClaudeUsageSourceCache(ref()) + await writeFile( + sourcePath, + JSON.stringify({ schemaVersion: 6, worktreeFingerprint: '[]', sources: saved.sources }) + ) + const previous = await readClaudeUsageSourceCache(ref()) + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + const result = await scanAndPersist(previous) + + expect(result.processedFiles[0]).toBe(previous.sources[0]) + expect(write).toHaveBeenCalledTimes(1) + expect(JSON.parse(await readFile(sourcePath, 'utf8')).schemaVersion).toBe(7) +}) + +it('does not skip a write for cloned files with unchanged values', async () => { + const previous = await readClaudeUsageSourceCache(ref()) + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + await persistClaudeUsageSourceCache(ref(), structuredClone(previous.sources), previous) + + expect(write).toHaveBeenCalledTimes(1) +}) + +it('retains verified tiny files whose source envelope protects their complete rollups', async () => { + await writeFile(owner, row(100)) + await writeFile(fork, row(100)) + const initial = await scanClaudeUsageFiles([], [], undefined, []) + expect(initial.processedFiles.every((file) => file.parseResumeState === null)).toBe(true) + await writeClaudeUsageSourceCache(ref(), initial.processedFiles) + const previous = await readClaudeUsageSourceCache(ref()) + freeze(previous.sources) + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + await scanAndPersist(previous) + + expect(write).not.toHaveBeenCalled() +}) + +it('persists source repairs even when every surviving file reference is unchanged', async () => { + const saved = JSON.parse(await readFile(sourcePath, 'utf8')) + delete saved.usageIntegrity + saved.sources.push({ ...saved.sources[0], path: 'invalid', sessions: null }) + await writeFile(sourcePath, sealUsageCacheJson(JSON.stringify(saved), 'claude-usage-sources-v1')) + discovered.paths = [owner] + const previous = await readClaudeUsageSourceCache(ref()) + expect(previous.sources).toHaveLength(1) + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + const result = await scanAndPersist(previous) + + expect(result.processedFiles[0]).toBe(previous.sources[0]) + expect(write).toHaveBeenCalledTimes(1) + expect((await readClaudeUsageSourceCache(ref())).sources).toEqual(result.processedFiles) +}) + +it.each(['path', 'schema', 'fingerprint', 'reuse'] as const)( + 'does not retain a sidecar after its request %s changes', + async (change) => { + const sourceRef = ref() + const previous = await readClaudeUsageSourceCache(sourceRef) + if (change === 'path') { + sourceRef.path = join(directory, 'other-sources.json') + } else if (change === 'schema') { + sourceRef.schemaVersion = 6 + } else if (change === 'fingerprint') { + sourceRef.worktreeFingerprint = '["other-worktree"]' + } else { + sourceRef.reuse = false + } + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + await persistClaudeUsageSourceCache(sourceRef, previous.sources, previous) + + expect(write).toHaveBeenCalledTimes(1) + } +) + +it('writes changed attribution after an incompatible fingerprint starts cold', async () => { + const sourceRef = { ...ref(), worktreeFingerprint: '["worktree"]' } + const previous = await readClaudeUsageSourceCache(sourceRef) + const worktrees = [ + { repoId: 'repo', worktreeId: 'tree', path: directory, displayName: 'Project' } + ] + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + + const result = await scanClaudeUsageFiles(worktrees, previous.sources, undefined, []) + await persistClaudeUsageSourceCache(sourceRef, result.processedFiles, previous) + + expect(previous.sources).toEqual([]) + expect(result.sessions[0].primaryWorktreeId).toBe('tree') + expect(write).toHaveBeenCalledTimes(1) +}) diff --git a/src/main/claude-usage/store-checkpoint-persistence.test.ts b/src/main/claude-usage/store-checkpoint-persistence.test.ts new file mode 100644 index 00000000000..9d45f2d211a --- /dev/null +++ b/src/main/claude-usage/store-checkpoint-persistence.test.ts @@ -0,0 +1,212 @@ +import { appendFile, readFile, rm, writeFile } from 'node:fs/promises' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import { readClaudeUsageScanFile } from './transcript-record-parser' +import { + createPersistedUsageTestFixture, + type PersistedUsageTestFixture +} from './persisted-usage-test-fixture' + +const { getPath } = vi.hoisted(() => ({ getPath: vi.fn<() => string>() })) +vi.mock('electron', () => ({ app: { getPath } })) +vi.mock('../usage/usage-scan-worker-spawn', () => ({ + scanClaudeUsageFilesViaWorker: vi.fn(), + splitUsageCacheFileViaWorker: vi.fn() +})) +vi.mock('./transcript-file-discovery', () => ({ + listClaudeTranscriptFiles: vi.fn(), + claudeProfileTranscriptDirs: vi.fn(() => []) +})) + +let fixture: PersistedUsageTestFixture +const KEY_COUNT = 1024 + +beforeEach(async () => { + fixture = await createPersistedUsageTestFixture(getPath) +}) + +afterEach(async () => { + await fixture.cleanup() +}) + +it('persists every distinct maximum within the sidecar byte budget and resumes an older indented cache', async () => { + await writeFile( + fixture.transcript, + Array.from({ length: KEY_COUNT }, (_, index) => fixture.row(index)).join('') + ) + const initial = await fixture.project() + const store = fixture.createStore() + await store.setEnabled(true) + await store.refresh(true) + await store.flush() + + const report = JSON.parse(await readFile(fixture.reportPath, 'utf8')) + const sourceText = await readFile(fixture.sourceRef.path, 'utf8') + const sidecar = JSON.parse(sourceText) + expect(report.schemaVersion).toBe(7) + expect(report).not.toHaveProperty('processedFiles') + expect(report.sessions).toEqual(initial.sessions) + expect(Buffer.byteLength(sourceText)).toBeLessThan(100_000) + expect(sidecar.schemaVersion).toBe(7) + expect(sidecar.sources[0]?.parseResumeState).not.toHaveProperty('ownedTokenMaxima') + expect(sidecar.sources[0]?.parseResumeState.tokenCodecVersion).toBe(1) + expect(await fixture.decodedSources()).toEqual([initial]) + expect(initial.ownedDedupeKeys).toHaveLength(KEY_COUNT) + expect(initial.parseResumeState?.ownedTokenMaxima).toHaveLength(KEY_COUNT) + + await rm(fixture.sourceRef.path) + await writeFile(fixture.reportPath, JSON.stringify(fixture.state([initial]), null, 2)) + await appendFile(fixture.transcript, fixture.row(0, true)) + const restarted = fixture.createStore() + await restarted.whenLoaded() + const migrated = JSON.parse(await readFile(fixture.sourceRef.path, 'utf8')) + expect(migrated.schemaVersion).toBe(7) + expect(migrated.sources[0]?.parseResumeState.tokenCodecVersion).toBe(1) + expect(await fixture.decodedSources()).toEqual([initial]) + await restarted.refresh(true) + await restarted.flush() + + const afterRestart = JSON.parse(await readFile(fixture.reportPath, 'utf8')) + const cold = await fixture.project() + expect(afterRestart.schemaVersion).toBe(7) + expect(afterRestart).not.toHaveProperty('processedFiles') + expect(afterRestart.sessions).toEqual(cold.sessions) + expect(afterRestart.dailyAggregates).toEqual(cold.dailyAggregates) + expect(await fixture.decodedSources()).toEqual([cold]) + expect(cold.ownedDedupeKeys).toHaveLength(KEY_COUNT) + expect(cold.sessions[0]?.sessionId).toBe('original-session') + expect(cold.sessions[0]?.turnCount).toBe(KEY_COUNT) + expect(cold.parseResumeState?.ownedTokenMaxima[0]).toEqual([2000, 55, 5, 15, 3, 0]) +}) + +it('hides invalid saved totals until a refresh rebuilds the owner and its deferred fork', async () => { + const initial = await fixture.writeResumable() + const forkPath = join(fixture.directory, 'fork.jsonl') + await writeFile(forkPath, await readFile(fixture.transcript, 'utf8')) + fixture.transcripts.push(forkPath) + const fork = await projectClaudeUsageScanFile( + await readClaudeUsageScanFile(forkPath), + new Map(), + () => false + ) + expect(fork.hasDeferredClaims).toBe(true) + const state = fixture.state([initial, fork]) + const maxima = initial.parseResumeState?.ownedTokenMaxima[0] + if (!maxima) { + throw new Error('Expected a resumable owner fixture.') + } + maxima[0]-- + await writeFile(fixture.reportPath, JSON.stringify(state)) + + const store = fixture.createStore() + await store.whenLoaded() + expect(await fixture.decodedSources()).toEqual([]) + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { sessions: 0, turns: 0, inputTokens: 0 }, + daily: [], + recentSessions: [], + scanState: { + enabled: true, + hasAnyClaudeData: false, + lastScanCompletedAt: null, + lastScanError: 'Saved usage totals could not be validated. Refresh to rebuild them.' + } + }) + await store.refresh(false) + await store.flush() + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { sessions: 1, turns: 1, inputTokens: 1000 }, + scanState: { enabled: true, hasAnyClaudeData: true, lastScanError: null } + }) + const rebuilt = await fixture.decodedSources() + expect(rebuilt).toHaveLength(2) + expect(rebuilt.flatMap((file) => file.ownedDedupeKeys)).toHaveLength(1) + expect(rebuilt.some((file) => file.hasDeferredClaims)).toBe(true) +}) + +it('reconstructs duplicated global totals from validated file projections on load', async () => { + const initial = await fixture.writeResumable() + const state = fixture.state([initial]) + const session = state.sessions[0] + const daily = state.dailyAggregates[0] + if (!session || !daily) { + throw new Error('Expected saved global totals.') + } + session.totalInputTokens++ + daily.inputTokens++ + await writeFile(fixture.reportPath, JSON.stringify(state)) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { sessions: 1, turns: 1, inputTokens: 1000 }, + daily: [{ inputTokens: 1000 }], + scanState: { enabled: true, lastScanCompletedAt: state.scanState.lastScanCompletedAt } + }) + await store.refresh(false) + expect(fixture.scanWorker).not.toHaveBeenCalled() +}) + +it('retains both signed and older aggregate-only file totals when loading a fresh cache', async () => { + const initial = await fixture.writeResumable() + const legacyPath = join(fixture.directory, 'legacy.jsonl') + await writeFile(legacyPath, fixture.row(1)) + const legacy = await projectClaudeUsageScanFile( + await readClaudeUsageScanFile(legacyPath), + new Map(), + () => true + ) + delete legacy.parseResumeState + const state = fixture.state([initial, legacy]) + await writeFile(fixture.reportPath, JSON.stringify(state)) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { sessions: 1, turns: 2, inputTokens: 2001 }, + daily: [{ inputTokens: 2001 }], + scanState: { enabled: true, lastScanCompletedAt: state.scanState.lastScanCompletedAt } + }) + expect(await fixture.decodedSources()).toEqual([initial, legacy]) + await store.refresh(false) + expect(fixture.scanWorker).not.toHaveBeenCalled() +}) + +it.each(['nonArray', 'nullEntry', 'unsignedRollup'] as const)( + 'preserves tracking when malformed %s cache records cannot be validated', + async (malformation) => { + const initial = await fixture.writeResumable() + const state = fixture.state([initial]) + const malformedFiles = + malformation === 'nonArray' + ? null + : malformation === 'nullEntry' + ? [initial, null] + : [ + initial, + { + ...initial, + parseResumeState: null, + sessions: [{ ...initial.sessions[0], locationBreakdown: null }] + } + ] + await writeFile( + fixture.reportPath, + JSON.stringify({ ...state, processedFiles: malformedFiles }) + ) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { sessions: 0, turns: 0 }, + daily: [], + scanState: { + enabled: true, + hasAnyClaudeData: false, + lastScanCompletedAt: null, + lastScanError: 'Saved usage totals could not be validated. Refresh to rebuild them.' + } + }) + } +) diff --git a/src/main/claude-usage/store-source-authority.test.ts b/src/main/claude-usage/store-source-authority.test.ts new file mode 100644 index 00000000000..98049764f70 --- /dev/null +++ b/src/main/claude-usage/store-source-authority.test.ts @@ -0,0 +1,187 @@ +import { appendFile, readFile, writeFile } from 'node:fs/promises' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { UsageCacheSnapshotWriter } from '../usage-cache-snapshot-writer' +import * as sourceCacheWriter from '../usage/usage-source-cache-file' +import { readClaudeUsageSourceCache, writeClaudeUsageSourceCache } from './persisted-source-cache' +import { serializeClaudeUsageReport } from './persisted-usage-report' +import { + createPersistedUsageTestFixture, + type PersistedUsageTestFixture +} from './persisted-usage-test-fixture' + +const { getPath } = vi.hoisted(() => ({ getPath: vi.fn<() => string>() })) +vi.mock('electron', () => ({ app: { getPath } })) +vi.mock('../usage/usage-scan-worker-spawn', () => ({ + scanClaudeUsageFilesViaWorker: vi.fn(), + splitUsageCacheFileViaWorker: vi.fn() +})) +vi.mock('./transcript-file-discovery', () => ({ + listClaudeTranscriptFiles: vi.fn(), + claudeProfileTranscriptDirs: vi.fn(() => []) +})) + +let fixture: PersistedUsageTestFixture + +beforeEach(async () => { + fixture = await createPersistedUsageTestFixture(getPath) +}) + +afterEach(async () => { + await fixture.cleanup() +}) + +it('resumes an older source generation independently of a newer report', async () => { + const original = await fixture.writeResumable() + await appendFile(fixture.transcript, fixture.row(0, true)) + const updated = await fixture.project() + await writeClaudeUsageSourceCache({ ...fixture.sourceRef, schemaVersion: 6 }, [original]) + await writeFile(fixture.reportPath, serializeClaudeUsageReport(fixture.state([updated], 7))) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all').summary.inputTokens).toBe(2000) + expect(await fixture.decodedSources()).toEqual([original]) + expect(fixture.splitWorker).not.toHaveBeenCalled() + await store.refresh(true) + await store.flush() + expect(await fixture.decodedSources()).toEqual([updated]) + expect(store.getSnapshot('all', 'all').summary).toMatchObject({ turns: 1, inputTokens: 2000 }) + expect(JSON.parse(await readFile(fixture.sourceRef.path, 'utf8')).schemaVersion).toBe(7) +}) + +it('uses a newer source generation independently of an older report', async () => { + const original = await fixture.writeResumable() + await appendFile(fixture.transcript, fixture.row(0, true)) + const updated = await fixture.project() + await writeClaudeUsageSourceCache(fixture.sourceRef, [updated]) + await writeFile(fixture.reportPath, serializeClaudeUsageReport(fixture.state([original], 6))) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all').summary.inputTokens).toBe(1000) + expect(await fixture.decodedSources()).toEqual([updated]) + expect(fixture.splitWorker).not.toHaveBeenCalled() + await store.refresh(true) + await store.flush() + expect(await fixture.decodedSources()).toEqual([updated]) + expect(store.getSnapshot('all', 'all').summary).toMatchObject({ turns: 1, inputTokens: 2000 }) + expect(JSON.parse(await readFile(fixture.reportPath, 'utf8')).schemaVersion).toBe(7) +}) + +it('keeps a newer source generation when an earlier report migration could not be written', async () => { + const original = await fixture.writeResumable() + const inline = fixture.state([original]) + await writeFile(fixture.reportPath, JSON.stringify(inline)) + vi.spyOn(UsageCacheSnapshotWriter.prototype, 'write').mockRejectedValueOnce( + new Error('report migration write failed') + ) + const first = fixture.createStore() + await first.whenLoaded() + expect(JSON.parse(await readFile(fixture.reportPath, 'utf8'))).toEqual(inline) + expect(await fixture.decodedSources()).toEqual([original]) + + await appendFile(fixture.transcript, fixture.row(0, true)) + const updated = await fixture.project() + await writeClaudeUsageSourceCache(fixture.sourceRef, [updated]) + const warmSourceText = await readFile(fixture.sourceRef.path, 'utf8') + const restarted = fixture.createStore() + await restarted.whenLoaded() + expect(await readFile(fixture.sourceRef.path, 'utf8')).toBe(warmSourceText) + expect(await fixture.decodedSources()).toEqual([updated]) + expect(restarted.getSnapshot('all', 'all').summary.inputTokens).toBe(1000) + await restarted.refresh(true) + await restarted.flush() + expect(await fixture.decodedSources()).toEqual([updated]) + expect(restarted.getSnapshot('all', 'all').summary).toMatchObject({ turns: 1, inputTokens: 2000 }) +}) + +it('preserves a disabled inline cache through worker failure and preference writes', async () => { + const original = await fixture.writeResumable() + const inline = fixture.state([original]) + inline.scanState.enabled = false + await writeFile(fixture.reportPath, JSON.stringify(inline)) + fixture.splitWorker.mockRejectedValue(new Error('worker unavailable')) + vi.spyOn(console, 'warn').mockImplementation(() => {}) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all')).toMatchObject({ + summary: { inputTokens: 1000 }, + scanState: { enabled: false } + }) + await store.setEnabled(true) + await store.flush() + expect(JSON.parse(await readFile(fixture.reportPath, 'utf8'))).toEqual({ + ...inline, + scanState: { ...inline.scanState, enabled: true } + }) + expect(fixture.scanWorker).not.toHaveBeenCalled() + expect((await readClaudeUsageSourceCache(fixture.sourceRef)).sources).toEqual([]) + + await store.refresh(true) + await store.flush() + const report = JSON.parse(await readFile(fixture.reportPath, 'utf8')) + expect(report.schemaVersion).toBe(7) + expect(report).not.toHaveProperty('processedFiles') + expect(report.scanState.enabled).toBe(true) + expect(await fixture.decodedSources()).toEqual([original]) +}) + +it('rejects an unsigned schema7 tiny-file source without hiding its valid report', async () => { + await writeFile(fixture.transcript, fixture.row(0)) + const original = await fixture.project() + expect(original.parseResumeState).toBeNull() + await writeClaudeUsageSourceCache(fixture.sourceRef, [original]) + await writeFile(fixture.reportPath, serializeClaudeUsageReport(fixture.state([original], 7))) + const unsigned = JSON.parse(await readFile(fixture.sourceRef.path, 'utf8')) + delete unsigned.usageIntegrity + unsigned.sources[0].sessions[0].totalInputTokens = 9999 + unsigned.sources[0].dailyAggregates[0].inputTokens = 9999 + await writeFile(fixture.sourceRef.path, JSON.stringify(unsigned)) + expect((await readClaudeUsageSourceCache(fixture.sourceRef)).sources).toEqual([]) + + const store = fixture.createStore() + await store.whenLoaded() + expect(store.getSnapshot('all', 'all').summary.inputTokens).toBe(1000) + await store.refresh(true) + await store.flush() + expect(await fixture.decodedSources()).toEqual([original]) + expect(store.getSnapshot('all', 'all').summary).toMatchObject({ turns: 1, inputTokens: 1000 }) +}) + +it('rejects a source cache attributed to a different worktree fingerprint', async () => { + const original = await fixture.writeResumable() + await writeClaudeUsageSourceCache( + { ...fixture.sourceRef, worktreeFingerprint: '["other-worktree"]' }, + [original] + ) + await writeFile(fixture.reportPath, serializeClaudeUsageReport(fixture.state([original], 7))) + expect((await readClaudeUsageSourceCache(fixture.sourceRef)).sources).toEqual([]) + const store = fixture.createStore() + await store.whenLoaded() + await store.refresh(true) + await store.flush() + expect(await fixture.decodedSources()).toEqual([original]) + expect(store.getSnapshot('all', 'all').summary.inputTokens).toBe(1000) +}) + +it('updates the completed report while retaining an unchanged verified sidecar', async () => { + const original = await fixture.writeResumable() + await writeClaudeUsageSourceCache(fixture.sourceRef, [original]) + const state = fixture.state([original], 7) + state.scanState.lastScanCompletedAt = 1 + await writeFile(fixture.reportPath, serializeClaudeUsageReport(state)) + const sourceText = await readFile(fixture.sourceRef.path, 'utf8') + const write = vi.spyOn(sourceCacheWriter, 'writeUsageSourceCacheData') + const store = fixture.createStore() + await store.whenLoaded() + + await store.refresh(true) + await store.flush() + + expect(write).not.toHaveBeenCalled() + expect(await readFile(fixture.sourceRef.path, 'utf8')).toBe(sourceText) + const report = JSON.parse(await readFile(fixture.reportPath, 'utf8')) + expect(report.scanState.lastScanCompletedAt).toBeGreaterThan(1) + expect(store.getSnapshot('all', 'all').summary.inputTokens).toBe(1000) +}) diff --git a/src/main/claude-usage/store.test.ts b/src/main/claude-usage/store.test.ts index 88105e3ccc7..cdf37370303 100644 --- a/src/main/claude-usage/store.test.ts +++ b/src/main/claude-usage/store.test.ts @@ -709,7 +709,7 @@ describe('ClaudeUsageStore', () => { expect(scanClaudeUsageFilesViaWorker).toHaveBeenCalledWith([], { path: join(tempUserData, 'orca-claude-usage-sources.json'), - schemaVersion: 6, + schemaVersion: 7, worktreeFingerprint: '[]', reuse: false }) diff --git a/src/main/claude-usage/store.ts b/src/main/claude-usage/store.ts index ac4d3264f08..2ab8f0ef3cf 100644 --- a/src/main/claude-usage/store.ts +++ b/src/main/claude-usage/store.ts @@ -23,12 +23,14 @@ import { buildBreakdown, buildDaily, buildSummary } from './claude-usage-report- import { buildRecentSessions } from './claude-usage-session-rows' import type { AutomationUsageLookupInput } from './claude-usage-automation-attribution' import { resolveAutomationRunUsage } from './claude-usage-automation-attribution' +import { parseClaudeUsageReport, serializeClaudeUsageReport } from './persisted-usage-report' // Why: v5 widens Claude ownership keys (message-id / uuid fallbacks). Older // caches either lack ownership or used narrower keys and can under/over-count // after fork reclaim (#8006). v6 adds the 1-hour cache-write split, which older // caches never recorded, so their cost estimates stay stuck at the 5m rate (#15993). -const SCHEMA_VERSION = 6 +// v7 stores protected column checkpoints on the worker and a separately protected report. +const SCHEMA_VERSION = 7 // Why: capture the path after configureDevUserDataPath() but before app.setName() // mutates Electron's derived userData location, matching the persistence/store pattern. @@ -51,7 +53,7 @@ function getDefaultState(): ClaudeUsagePersistedState { } function normalizePersistedState(state: ClaudeUsagePersistedState): ClaudeUsagePersistedState { - if (state.schemaVersion === SCHEMA_VERSION) { + if (state.schemaVersion === 6 || state.schemaVersion === SCHEMA_VERSION) { return state } // Scanner changes invalidate totals, but preserving enabled keeps existing tracking on. @@ -91,6 +93,9 @@ export class ClaudeUsageStore extends UsageProviderStoreLifecycle< resolveCacheFile: getClaudeUsageFile, createDefaultState: getDefaultState, normalizeState: normalizePersistedState, + parseReport: parseClaudeUsageReport, + serializeReport: serializeClaudeUsageReport, + providerId: 'claude', sourceKey: 'processedFiles', dataPresenceKey: 'hasAnyClaudeData', scan: scanClaudeUsageFilesViaWorker, diff --git a/src/main/claude-usage/transcript-file-discovery-errors.test.ts b/src/main/claude-usage/transcript-file-discovery-errors.test.ts new file mode 100644 index 00000000000..19bf62f249c --- /dev/null +++ b/src/main/claude-usage/transcript-file-discovery-errors.test.ts @@ -0,0 +1,86 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' +import type * as FsPromises from 'node:fs/promises' +import type * as NodeOs from 'node:os' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import type { listClaudeTranscriptFiles } from './transcript-file-discovery' + +const state = vi.hoisted(() => ({ home: '', blocked: '', code: '' })) + +vi.mock('node:os', async () => { + const actual = await vi.importActual('node:os') + return { ...actual, homedir: () => state.home } +}) + +vi.mock('../claude-accounts/claude-profile-installed-router', () => ({ + claudeProfileHistoryDirs: () => [] +})) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + readdir: async (...args: Parameters) => { + if (String(args[0]) === state.blocked) { + throw Object.assign(new Error(`Cannot discover ${state.blocked}`), { code: state.code }) + } + return actual.readdir(...args) + } + } +}) + +let projects: string +let list: typeof listClaudeTranscriptFiles + +beforeEach(async () => { + vi.resetModules() + state.home = await mkdtemp(join(tmpdir(), 'orca-claude-discovery-error-')) + state.blocked = '' + state.code = '' + projects = join(state.home, '.claude', 'projects') + await mkdir(projects, { recursive: true }) + await mkdir(join(state.home, '.claude', 'transcripts'), { recursive: true }) + list = (await import('./transcript-file-discovery')).listClaudeTranscriptFiles +}) + +afterEach(async () => { + await rm(state.home, { recursive: true, force: true }) +}) + +describe('Claude history discovery failures', () => { + it.each(['EACCES', 'EPERM', 'EIO', 'UNKNOWN'])( + 'rejects an inaccessible root (%s)', + async (code) => { + state.blocked = projects + state.code = code + await expect(list([])).rejects.toMatchObject({ code }) + } + ) + + it('rejects an unreadable child instead of reporting that its sibling history disappeared', async () => { + const sibling = join(projects, 'kept.jsonl') + await writeFile(sibling, '') + state.blocked = join(projects, 'inaccessible') + await mkdir(state.blocked) + state.code = 'EACCES' + await expect(list([])).rejects.toMatchObject({ code: 'EACCES' }) + }) + + it.each(['ENOENT', 'ENOTDIR'])( + 'keeps sibling files when a child disappears (%s)', + async (code) => { + const sibling = join(projects, 'kept.jsonl') + await writeFile(sibling, '') + state.blocked = join(projects, 'removed') + await mkdir(state.blocked) + state.code = code + await expect(list([])).resolves.toEqual([sibling]) + } + ) + + it('accepts an absent history root', async () => { + await rm(projects, { recursive: true }) + await expect(list([])).resolves.toEqual([]) + }) +}) diff --git a/src/main/claude-usage/transcript-file-discovery.ts b/src/main/claude-usage/transcript-file-discovery.ts index 3b3a6bf76bc..2366846686b 100644 --- a/src/main/claude-usage/transcript-file-discovery.ts +++ b/src/main/claude-usage/transcript-file-discovery.ts @@ -2,12 +2,18 @@ import { claudeProfileHistoryDirs } from '../claude-accounts/claude-profile-inst import { homedir } from 'node:os' import { join } from 'node:path' import { readdir } from 'node:fs/promises' +import { isDefinitiveAbsence } from '../../shared/definitive-filesystem-absence' const CLAUDE_PROJECTS_DIR = join(homedir(), '.claude', 'projects') const CLAUDE_TRANSCRIPTS_DIR = join(homedir(), '.claude', 'transcripts') async function walkJsonlFiles(dirPath: string): Promise { - const entries = await readdir(dirPath, { withFileTypes: true }) + const entries = await readdir(dirPath, { withFileTypes: true }).catch((error: unknown) => { + if (isDefinitiveAbsence(error)) { + return [] + } + throw error + }) const files: string[] = [] for (const entry of entries) { @@ -41,14 +47,6 @@ export async function listClaudeTranscriptFiles( profileDirs = claudeProfileTranscriptDirs() ): Promise { const roots = [CLAUDE_PROJECTS_DIR, CLAUDE_TRANSCRIPTS_DIR, ...profileDirs] - const files = await Promise.all( - roots.map(async (root) => { - try { - return await walkJsonlFiles(root) - } catch { - return [] - } - }) - ) + const files = await Promise.all(roots.map((root) => walkJsonlFiles(root))) return [...new Set(files.flat())].sort() } diff --git a/src/main/claude-usage/transcript-projection-integrity.test.ts b/src/main/claude-usage/transcript-projection-integrity.test.ts new file mode 100644 index 00000000000..e0fd71091f5 --- /dev/null +++ b/src/main/claude-usage/transcript-projection-integrity.test.ts @@ -0,0 +1,197 @@ +import { appendFile, mkdtemp, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it } from 'vitest' +import { readClaudeUsageScanFile } from './transcript-record-parser' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import { hasClaudeUsageResumeProjection } from './transcript-resume-projection' +import type { ClaudeUsageParseResumeState, ClaudeUsagePersistedFile } from './types' + +let directory: string +let transcript: string +let original: ClaudeUsagePersistedFile + +function row( + key: string, + input: number, + secondRoute = false, + output = 2, + sameSession = false +): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: secondRoute && !sameSession ? 'second' : 'first', + timestamp: '2026-10-09T12:00:00.000Z', + cwd: join(directory, secondRoute ? 'second' : 'first'), + requestId: key, + message: { + id: key, + model: secondRoute ? 'model-b' : 'model-a', + usage: { input_tokens: input, output_tokens: output } + } + })}\n` +} + +function checkpoint(file: ClaudeUsagePersistedFile): ClaudeUsageParseResumeState { + if (!file.parseResumeState) { + throw new Error('Expected a resumable fixture.') + } + return file.parseResumeState +} + +async function project(previous?: ClaudeUsagePersistedFile): Promise { + const resume = + previous && hasClaudeUsageResumeProjection(previous) ? previous.parseResumeState : null + return projectClaudeUsageScanFile( + await readClaudeUsageScanFile(transcript, resume), + new Map(), + () => true, + previous + ) +} + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'orca-claude-integrity-')) + transcript = join(directory, 'session.jsonl') + await writeFile( + transcript, + `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n${row('a', 100)}${row('b', 20, true)}${row('c', 10, true, 2, true)}` + ) + original = await project() +}) + +afterEach(async () => { + await rm(directory, { recursive: true, force: true }) +}) + +it.each([ + 'lowerMaximum', + 'higherMaximum', + 'negativeMaximum', + 'keyOrder', + 'rowOrder', + 'routeIndex', + 'routeMetadata', + 'sessionOrder', + 'locationOrder', + 'sessionTotal', + 'locationTotal', + 'dailyTotal', + 'deferredFlag', + 'byteOffset', + 'lineCount', + 'boundaryDigest', + 'path', + 'missingDigest' +] as const)('cold-parses a persisted checkpoint with coupled %s corruption', async (mutation) => { + const cached: ClaudeUsagePersistedFile = JSON.parse(JSON.stringify(original)) + const state = checkpoint(cached) + const first = state.ownedTokenMaxima[0] + const second = state.ownedTokenMaxima[1] + const route = state.projections[0] + const session = cached.sessions[0] + const location = session?.locationBreakdown[0] + const daily = cached.dailyAggregates[0] + const order = state.encounterOrder[0] + const key = cached.ownedDedupeKeys[0] + const secondKey = cached.ownedDedupeKeys[1] + if ( + !first || + !second || + !route || + !session || + !location || + !daily || + !order || + !key || + !secondKey + ) { + throw new Error('Expected two distinct routes in the checkpoint fixture.') + } + switch (mutation) { + case 'lowerMaximum': + first[0]-- + break + case 'higherMaximum': + first[0]++ + break + case 'negativeMaximum': + first[0] = -1 + break + case 'keyOrder': + cached.ownedDedupeKeys[0] = secondKey + cached.ownedDedupeKeys[1] = key + break + case 'rowOrder': + state.ownedTokenMaxima[0] = second + state.ownedTokenMaxima[1] = first + break + case 'routeIndex': + { + const firstIndex = first[5] + first[5] = second[5] + second[5] = firstIndex + } + break + case 'routeMetadata': + state.projections.reverse() + break + case 'sessionOrder': + state.encounterOrder.reverse() + break + case 'locationOrder': + order.projectKeys.reverse() + break + case 'sessionTotal': + session.totalInputTokens++ + break + case 'locationTotal': + location.inputTokens++ + break + case 'dailyTotal': + daily.inputTokens++ + break + case 'deferredFlag': + cached.hasDeferredClaims = !cached.hasDeferredClaims + break + case 'byteOffset': + state.parsedBytes-- + break + case 'lineCount': + state.lineCount-- + break + case 'boundaryDigest': + state.boundaryDigest = 'changed' + break + case 'path': + cached.path = join(directory, 'different-session.jsonl') + break + case 'missingDigest': + delete state.projectionIntegrity + break + } + expect(hasClaudeUsageResumeProjection(cached)).toBe(false) + await appendFile(transcript, row('a', 150)) + const changed = await project(cached) + const cold = await project() + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(changed.ownedDedupeKeys).toEqual(cold.ownedDedupeKeys) +}) + +it('preserves accepted negative token components through persistence and an independent maximum update', async () => { + await writeFile( + transcript, + `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n${row('negative', -1)}` + ) + const initial = await project() + const cached: ClaudeUsagePersistedFile = JSON.parse(JSON.stringify(initial)) + expect(hasClaudeUsageResumeProjection(cached)).toBe(true) + expect(checkpoint(cached).ownedTokenMaxima[0]?.[0]).toBe(-1) + await appendFile(transcript, row('negative', 0, false, 3)) + const changed = await project(cached) + const cold = await project() + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(changed.sessions[0]?.turnCount).toBe(1) +}) diff --git a/src/main/claude-usage/transcript-projection-integrity.ts b/src/main/claude-usage/transcript-projection-integrity.ts new file mode 100644 index 00000000000..5b88a91bb5f --- /dev/null +++ b/src/main/claude-usage/transcript-projection-integrity.ts @@ -0,0 +1,87 @@ +import { createHash } from 'node:crypto' +import type { ClaudeUsagePersistedFile } from './types' + +const HASH_CHUNK_CHARACTERS = 16_384 +export const CLAUDE_USAGE_VALIDATION_BATCH_ROWS = 1024 + +export function* iterateClaudeUsageProjectionIntegrity( + file: ClaudeUsagePersistedFile +): Generator { + const state = file.parseResumeState + if (!state) { + throw new Error('Claude usage projection integrity requires a resume checkpoint.') + } + const hash = createHash('sha256') + let pieces: string[] = [] + let characters = 0 + const flush = (): void => { + if (pieces.length > 0) { + hash.update(pieces.join('')) + pieces = [] + characters = 0 + } + } + const append = (value: unknown): void => { + const record = `${JSON.stringify(value)}\n` + if (characters + record.length > HASH_CHUNK_CHARACTERS) { + flush() + } + if (record.length >= HASH_CHUNK_CHARACTERS) { + hash.update(record) + } else { + pieces.push(record) + characters += record.length + } + } + + append([ + 'claude-usage-projection-v1', + file.path, + file.mtimeMs, + file.size, + file.lineCount, + file.physicalFileId ?? null, + file.ctimeMs ?? null, + file.hasDeferredClaims, + state.parsedBytes, + state.lineCount, + state.boundaryDigest, + state.headDigest, + state.physicalFileId, + file.ownedDedupeKeys.length, + state.ownedTokenMaxima.length + ]) + for (let index = 0; index < file.ownedDedupeKeys.length; index++) { + append([file.ownedDedupeKeys[index], state.ownedTokenMaxima[index]]) + if ((index + 1) % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + let checkedRecords = 0 + for (const records of [ + state.projections, + state.encounterOrder, + file.sessions, + file.dailyAggregates + ]) { + append(records.length) + for (const record of records) { + append(record) + if (++checkedRecords % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + } + flush() + return hash.digest('hex') +} + +export function buildClaudeUsageProjectionIntegrity(file: ClaudeUsagePersistedFile): string { + const iterator = iterateClaudeUsageProjectionIntegrity(file) + while (true) { + const next = iterator.next() + if (next.done) { + return next.value + } + } +} diff --git a/src/main/claude-usage/transcript-reader-lifetime.test.ts b/src/main/claude-usage/transcript-reader-lifetime.test.ts new file mode 100644 index 00000000000..3303f564e30 --- /dev/null +++ b/src/main/claude-usage/transcript-reader-lifetime.test.ts @@ -0,0 +1,100 @@ +import { mkdtemp, rm, writeFile } from 'node:fs/promises' +import type * as NodeFsPromises from 'node:fs/promises' +import type { FileHandle } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' + +const { observations } = vi.hoisted(() => { + const observations: { + handles: FileHandle[] + afterValidationStat: (() => Promise) | undefined + } = { handles: [], afterValidationStat: undefined } + return { observations } +}) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + open: async (...args: Parameters) => { + expect(observations.handles.every((handle) => handle.fd === -1)).toBe(true) + const handle = await actual.open(...args) + const stat = handle.stat.bind(handle) + let stats = 0 + vi.spyOn(handle, 'stat').mockImplementation(async (options) => { + const snapshot = await stat(options) + stats++ + if (stats === 2) { + const mutate = observations.afterValidationStat + observations.afterValidationStat = undefined + await mutate?.() + } + return snapshot + }) + observations.handles.push(handle) + return handle + } + } +}) + +import { readClaudeUsageScanFile } from './transcript-record-parser' + +let directory: string +let transcript: string + +function row(input: number): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: 'reader-lifetime', + timestamp: '2026-10-09T12:00:00.000Z', + requestId: 'request', + message: { id: 'message', usage: { input_tokens: input, output_tokens: 2 } } + })}\n` +} + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'orca-claude-reader-lifetime-')) + transcript = join(directory, 'session.jsonl') + observations.handles.length = 0 + observations.afterValidationStat = undefined +}) + +afterEach(async () => { + await Promise.all(observations.handles.map((handle) => handle.close())) + vi.restoreAllMocks() + await rm(directory, { recursive: true, force: true }) +}) + +it('releases the pinned descriptor before consolidating duplicate token maxima', async () => { + await writeFile(transcript, row(301) + row(503)) + const max = Math.max + let duplicateCorrections = 0 + vi.spyOn(Math, 'max').mockImplementation((...values) => { + if (values[0] === 301 && values[1] === 503) { + expect(observations.handles).toHaveLength(1) + expect(observations.handles[0].fd).toBe(-1) + duplicateCorrections++ + } + return max(...values) + }) + + const read = await readClaudeUsageScanFile(transcript) + + expect(duplicateCorrections).toBe(1) + expect(read.turns).toHaveLength(1) + expect(read.turns[0].inputTokens).toBe(503) +}) + +it('closes a failed generation before opening its replacement', async () => { + await writeFile(transcript, row(301) + row(503)) + observations.afterValidationStat = () => writeFile(transcript, row(701)) + + const read = await readClaudeUsageScanFile(transcript) + + expect(observations.handles).toHaveLength(2) + expect(observations.handles.every((handle) => handle.fd === -1)).toBe(true) + expect(read.turns).toHaveLength(1) + expect(read.turns[0].inputTokens).toBe(701) + expect(read.processedFile.lineCount).toBe(1) +}) diff --git a/src/main/claude-usage/transcript-record-parser.ts b/src/main/claude-usage/transcript-record-parser.ts index 2ad51f3ee90..412cab18ad1 100644 --- a/src/main/claude-usage/transcript-record-parser.ts +++ b/src/main/claude-usage/transcript-record-parser.ts @@ -1,8 +1,21 @@ import { basename } from 'node:path' -import { stat } from 'node:fs/promises' +import { readJsonlFileSnapshot } from '../usage/jsonl-file-snapshot' import { createReadStream } from 'node:fs' import { createInterface } from 'node:readline' -import type { ClaudeUsageParsedTurn, ClaudeUsageProcessedFile } from './types' +import type { + ClaudeUsageParseResumeState, + ClaudeUsageParsedTurn, + ClaudeUsageProcessedFile +} from './types' +import { readJsonlLinesFromOffset } from '../usage/jsonl-line-offsets' +import { + buildJsonlFileCheckpoint, + jsonlPhysicalFileId, + openJsonlFileReader, + resolveJsonlFileCheckpoint, + validateJsonlFileReader, + type JsonlFileCheckpoint +} from '../usage/jsonl-file-checkpoint' type ClaudeUsageSourceRecord = { type?: string @@ -75,7 +88,7 @@ function dedupeClaudeUsageTurns( } } - deduped.push({ ...turn }) + deduped.push(turn) if (turn.dedupeKey) { dedupeIndexByKey.set(turn.dedupeKey, deduped.length - 1) } @@ -195,34 +208,86 @@ export async function parseClaudeUsageFile(filePath: string): Promise { - const fileStat = await stat(filePath) - let lineCount = 0 - const turns: ClaudeUsageParsedSourceTurn[] = [] - const fallbackSessionId = basename(filePath, '.jsonl') - const lines = createInterface({ - input: createReadStream(filePath, { encoding: 'utf-8' }), - crlfDelay: Infinity - }) + resumed: boolean + checkpoint: JsonlFileCheckpoint | null + committedLineCount: number +} - for await (const line of lines) { - lineCount++ - const parsed = parseClaudeUsageSourceRecord(line, fallbackSessionId) - if (parsed) { - turns.push(parsed) +export async function readClaudeUsageScanFile( + filePath: string, + resume?: ClaudeUsageParseResumeState | null +): Promise { + let candidate = resume + while (true) { + const reader = await openJsonlFileReader(filePath) + let read: ClaudeUsageScanFile + try { + const verifiedResume = + candidate && (await resolveJsonlFileCheckpoint(filePath, candidate, reader)) + const startOffset = verifiedResume?.parsedBytes ?? 0 + let lineCount = verifiedResume && candidate ? candidate.lineCount : 0 + let committedLineCount = lineCount + let parsedBytes = startOffset + let partialTailProducedTurn = false + const turns: ClaudeUsageParsedSourceTurn[] = [] + const fallbackSessionId = basename(filePath, '.jsonl') + for await (const { line, endOffset, terminated } of readJsonlLinesFromOffset( + filePath, + startOffset, + reader + )) { + lineCount++ + const parsed = parseClaudeUsageSourceRecord(line, fallbackSessionId) + if (terminated) { + parsedBytes = endOffset + committedLineCount = lineCount + } else if (parsed) { + partialTailProducedTurn = true + } + if (parsed) { + turns.push(parsed) + } + } + const checkpoint = partialTailProducedTurn + ? null + : await buildJsonlFileCheckpoint(filePath, parsedBytes, null, reader) + if (!(await validateJsonlFileReader(reader, verifiedResume))) { + candidate = null + continue + } + read = { + processedFile: { + path: filePath, + mtimeMs: reader.stats.mtimeMs, + size: reader.stats.size, + lineCount, + physicalFileId: jsonlPhysicalFileId(reader.stats), + ctimeMs: reader.stats.ctimeMs + }, + turns, + resumed: Boolean(verifiedResume), + checkpoint, + committedLineCount + } + } finally { + await reader.handle.close() } + return { ...read, turns: dedupeClaudeUsageTurns(read.turns) } } +} +export async function getClaudeUsageProcessedFileStat( + filePath: string +): Promise & { physicalFileId: string | null }> { + const fileStat = await readJsonlFileSnapshot(filePath) return { - processedFile: { - path: filePath, - mtimeMs: fileStat.mtimeMs, - size: fileStat.size, - lineCount - }, - turns: dedupeClaudeUsageTurns(turns) + path: filePath, + mtimeMs: fileStat.mtimeMs, + size: fileStat.size, + physicalFileId: jsonlPhysicalFileId(fileStat), + ctimeMs: fileStat.ctimeMs } } diff --git a/src/main/claude-usage/transcript-resume-projection.ts b/src/main/claude-usage/transcript-resume-projection.ts new file mode 100644 index 00000000000..d9f0e8785b4 --- /dev/null +++ b/src/main/claude-usage/transcript-resume-projection.ts @@ -0,0 +1,154 @@ +import type { ClaudeUsageParseResumeState, ClaudeUsagePersistedFile } from './types' +import { + CLAUDE_USAGE_VALIDATION_BATCH_ROWS, + iterateClaudeUsageProjectionIntegrity +} from './transcript-projection-integrity' + +export function* iterateClaudeUsageResumeProjection( + previous: ClaudeUsagePersistedFile +): Generator { + const state = previous.parseResumeState + if ( + !state || + !Array.isArray(previous.ownedDedupeKeys) || + !Array.isArray(previous.sessions) || + !Array.isArray(previous.dailyAggregates) || + !Number.isInteger(state.lineCount) || + state.lineCount < 0 || + state.lineCount > previous.lineCount || + state.parsedBytes > previous.size || + !Array.isArray(state.ownedTokenMaxima) || + !Array.isArray(state.projections) || + !Array.isArray(state.encounterOrder) || + typeof state.projectionIntegrity !== 'string' + ) { + return false + } + const expectedKeys = new Set() + let checked = 0 + for (const key of previous.ownedDedupeKeys) { + if (typeof key !== 'string') { + return false + } + expectedKeys.add(key) + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + if ( + expectedKeys.size !== previous.ownedDedupeKeys.length || + state.ownedTokenMaxima.length !== expectedKeys.size + ) { + return false + } + // Bind ownership, maxima and rollups together; valid shapes alone cannot reject drift. + if (state.projectionIntegrity !== (yield* iterateClaudeUsageProjectionIntegrity(previous))) { + return false + } + const sessionLocations = new Map>() + for (const session of previous.sessions) { + const locations = new Set() + for (const location of session.locationBreakdown) { + locations.add(location.locationKey) + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + sessionLocations.set(session.sessionId, locations) + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + const dailyKeys = new Set() + for (const day of previous.dailyAggregates) { + dailyKeys.add([day.day, day.model ?? 'unknown', day.projectKey].join('::')) + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + if (state.projections.length > state.ownedTokenMaxima.length) { + return false + } + const usedProjections = new Uint8Array(state.projections.length) + let usedProjectionCount = 0 + for (const row of state.ownedTokenMaxima) { + if ( + !Array.isArray(row) || + row.length !== 6 || + (row[5] !== null && + (!Number.isInteger(row[5]) || row[5] < 0 || row[5] >= state.projections.length)) + ) { + return false + } + for (let index = 0; index < 5; index++) { + if (typeof row[index] !== 'number' || !Number.isFinite(row[index])) { + return false + } + } + if (row[5] !== null && usedProjections[row[5]] === 0) { + usedProjections[row[5]] = 1 + usedProjectionCount++ + } + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + if (usedProjectionCount !== state.projections.length) { + return false + } + for (const projection of state.projections) { + if ( + !projection || + typeof projection.sessionId !== 'string' || + typeof projection.day !== 'string' || + typeof projection.projectKey !== 'string' || + (projection.model !== null && typeof projection.model !== 'string') || + !sessionLocations.get(projection.sessionId)?.has(projection.projectKey) || + !dailyKeys.has( + [projection.day, projection.model ?? 'unknown', projection.projectKey].join('::') + ) + ) { + return false + } + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + if (state.encounterOrder.length !== sessionLocations.size) { + return false + } + for (const entry of state.encounterOrder) { + if (!entry || typeof entry.sessionId !== 'string' || !Array.isArray(entry.projectKeys)) { + return false + } + const locations = sessionLocations.get(entry.sessionId) + if (!locations) { + return false + } + sessionLocations.delete(entry.sessionId) + if (entry.projectKeys.length !== locations.size) { + return false + } + for (const key of entry.projectKeys) { + if (typeof key !== 'string' || !locations.delete(key)) { + return false + } + if (++checked % CLAUDE_USAGE_VALIDATION_BATCH_ROWS === 0) { + yield + } + } + } + return sessionLocations.size === 0 +} + +export function hasClaudeUsageResumeProjection( + previous: ClaudeUsagePersistedFile +): previous is ClaudeUsagePersistedFile & { parseResumeState: ClaudeUsageParseResumeState } { + const iterator = iterateClaudeUsageResumeProjection(previous) + while (true) { + const next = iterator.next() + if (next.done) { + return next.value + } + } +} diff --git a/src/main/claude-usage/transcript-token-checkpoint.ts b/src/main/claude-usage/transcript-token-checkpoint.ts new file mode 100644 index 00000000000..4eea12448a3 --- /dev/null +++ b/src/main/claude-usage/transcript-token-checkpoint.ts @@ -0,0 +1,124 @@ +import type { + ClaudeUsageParseResumeState, + ClaudeUsagePersistedFile, + ClaudeUsageTokenMaxima, + ClaudeUsageTokenTotals, + ClaudeUsageTurnProjection +} from './types' + +export type ClaudeUsageTokenCorrection = { + previous: Readonly + updated: Readonly + projection: ClaudeUsageTurnProjection | null +} + +type ClaudeUsageTokenCheckpoint = { + ownedDedupeKeys: string[] + find: (key: string) => Readonly | undefined + increase: (key: string, turn: ClaudeUsageTokenTotals) => ClaudeUsageTokenCorrection | null + append: ( + key: string, + turn: ClaudeUsageTokenTotals, + projection: ClaudeUsageTurnProjection | null + ) => void + finish: () => Pick +} + +function projectionKey(projection: ClaudeUsageTurnProjection): string { + return JSON.stringify([ + projection.sessionId, + projection.day, + projection.model, + projection.projectKey + ]) +} + +export function createClaudeUsageTokenCheckpoint( + previous?: ClaudeUsagePersistedFile +): ClaudeUsageTokenCheckpoint { + const state = previous?.parseResumeState + const ownedDedupeKeys = state && previous ? [...previous.ownedDedupeKeys] : [] + const ownedTokenMaxima = [...(state?.ownedTokenMaxima ?? [])] + const projections = [...(state?.projections ?? [])] + const indexByKey = new Map() + const projectionIndex = new Map() + if (ownedDedupeKeys.length !== ownedTokenMaxima.length) { + throw new Error('Claude usage token checkpoint is missing a key or projection.') + } + for (let index = 0; index < ownedDedupeKeys.length; index++) { + const key = ownedDedupeKeys[index] + const row = ownedTokenMaxima[index] + if (typeof key !== 'string' || !row || (row[5] !== null && !projections[row[5]])) { + throw new Error('Claude usage token checkpoint is missing a key or projection.') + } + indexByKey.set(key, index) + } + for (let index = 0; index < projections.length; index++) { + projectionIndex.set(projectionKey(projections[index]), index) + } + + return { + ownedDedupeKeys, + find(key) { + const index = indexByKey.get(key) + return index === undefined ? undefined : ownedTokenMaxima[index] + }, + increase(key, turn) { + const index = indexByKey.get(key) + const row = index === undefined ? undefined : ownedTokenMaxima[index] + if (index === undefined || !row) { + throw new Error('Claude usage token checkpoint is missing an owned turn.') + } + const input = Math.max(row[0], turn.inputTokens) + const output = Math.max(row[1], turn.outputTokens) + const read = Math.max(row[2], turn.cacheReadTokens) + const write = Math.max(row[3], turn.cacheWriteTokens) + const write1h = Math.max(row[4], turn.cacheWrite1hTokens) + if ( + input === row[0] && + output === row[1] && + read === row[2] && + write === row[3] && + write1h === row[4] + ) { + return null + } + const updated: ClaudeUsageTokenMaxima = [input, output, read, write, write1h, row[5]] + ownedTokenMaxima[index] = updated + return { + previous: row, + updated, + projection: row[5] === null ? null : projections[row[5]] + } + }, + append(key, turn, projection) { + let routeIndex: number | null = null + if (projection) { + const routeKey = projectionKey(projection) + routeIndex = projectionIndex.get(routeKey) ?? null + if (routeIndex === null) { + routeIndex = projections.length + projectionIndex.set(routeKey, routeIndex) + projections.push(projection) + } + } + const row: ClaudeUsageTokenMaxima = [ + turn.inputTokens, + turn.outputTokens, + turn.cacheReadTokens, + turn.cacheWriteTokens, + turn.cacheWrite1hTokens, + routeIndex + ] + const index = indexByKey.get(key) + if (index === undefined) { + indexByKey.set(key, ownedDedupeKeys.length) + ownedDedupeKeys.push(key) + ownedTokenMaxima.push(row) + } else { + ownedTokenMaxima[index] = row + } + }, + finish: () => ({ ownedTokenMaxima, projections }) + } +} diff --git a/src/main/claude-usage/transcript-tuple-append.test.ts b/src/main/claude-usage/transcript-tuple-append.test.ts new file mode 100644 index 00000000000..64e2ef40913 --- /dev/null +++ b/src/main/claude-usage/transcript-tuple-append.test.ts @@ -0,0 +1,240 @@ +import { appendFile, mkdtemp, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { readClaudeUsageScanFile } from './transcript-record-parser' +import { hasClaudeUsageResumeProjection } from './transcript-resume-projection' +import { createClaudeUsageTokenCheckpoint } from './transcript-token-checkpoint' +import { projectClaudeUsageScanFile } from './transcript-usage-projection' +import type { ClaudeUsageParseResumeState, ClaudeUsagePersistedFile } from './types' + +type RowOptions = { + input?: number + output?: number + read?: number + write?: number + write1h?: number + route?: string + session?: string + timestamp?: string + model?: string +} + +let directory: string +let transcript: string + +function row(key: string, options: RowOptions = {}): string { + return `${JSON.stringify({ + type: 'assistant', + sessionId: options.session ?? 'session', + timestamp: options.timestamp ?? '2026-10-09T12:00:00.000Z', + cwd: join(directory, options.route ?? 'first'), + requestId: key, + message: { + id: key, + model: options.model ?? 'model', + usage: { + input_tokens: options.input ?? 1, + output_tokens: options.output ?? 2, + cache_read_input_tokens: options.read ?? 0, + cache_creation_input_tokens: options.write ?? 0, + cache_creation: { ephemeral_1h_input_tokens: options.write1h ?? 0 } + } + } + })}\n` +} + +function checkpoint(file: ClaudeUsagePersistedFile): ClaudeUsageParseResumeState { + if (!file.parseResumeState) { + throw new Error('Expected a resumable fixture.') + } + return file.parseResumeState +} + +async function project( + previous?: ClaudeUsagePersistedFile, + claimKey: (key: string) => boolean = () => true +): Promise { + const resume = + previous && hasClaudeUsageResumeProjection(previous) ? previous.parseResumeState : null + const read = await readClaudeUsageScanFile(transcript, resume) + if (previous) { + expect(read.resumed).toBe(true) + } + return projectClaudeUsageScanFile(read, new Map(), claimKey, previous) +} + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'orca-claude-tuple-append-')) + transcript = join(directory, 'session.jsonl') + await writeFile(transcript, `${JSON.stringify({ type: 'user', text: 'x'.repeat(20_000) })}\n`) +}) + +afterEach(async () => { + vi.restoreAllMocks() + await rm(directory, { recursive: true, force: true }) +}) + +it('copies checkpoint arrays while retaining every untouched historical tuple and route', async () => { + const rows = Array.from({ length: 4_096 }, (_, index) => + row(`key-${index}`, { + input: index === 0 ? -1 : index + 1, + output: 2, + read: (index % 4) / 4, + write: (index % 3) / 2, + write1h: (index % 3) / 4, + route: `route-${index % 4}` + }) + ) + await appendFile(transcript, `${rows.join('')}${row('invalid', { timestamp: 'invalid' })}`) + const initial = await project() + const before = structuredClone(initial) + const initialState = checkpoint(initial) + await appendFile( + transcript, + row('key-0', { input: -0.5, output: 3, read: 0.25, write: 0.5, write1h: 0.25 }) + + row('key-1', { input: 1, output: 1 }) + + row('invalid', { input: 50, timestamp: '2026-10-10T12:00:00.000Z' }) + + row('new-shared', { route: 'route-0' }) + + row('new-route', { route: 'last' }) + ) + const changed = await project(initial) + const changedState = checkpoint(changed) + const cold = await project() + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(changed.ownedDedupeKeys).toEqual(cold.ownedDedupeKeys) + expect(changedState).toEqual(checkpoint(cold)) + expect(initial).toEqual(before) + expect(changed.ownedDedupeKeys).not.toBe(initial.ownedDedupeKeys) + expect(changedState.ownedTokenMaxima).not.toBe(initialState.ownedTokenMaxima) + expect(changedState.projections).not.toBe(initialState.projections) + expect(changedState.ownedTokenMaxima[0]).not.toBe(initialState.ownedTokenMaxima[0]) + for (let index = 1; index < 4_096; index++) { + expect(changedState.ownedTokenMaxima[index]).toBe(initialState.ownedTokenMaxima[index]) + } + expect(changedState.ownedTokenMaxima[4_096]).toEqual([50, 2, 0, 0, 0, null]) + for (const [index, projection] of initialState.projections.entries()) { + expect(changedState.projections[index]).toBe(projection) + } + expect(changedState.projections).toHaveLength(initialState.projections.length + 1) + expect(hasClaudeUsageResumeProjection(changed)).toBe(true) +}) + +it('indexes each retained route once instead of serializing its route for every historical key', async () => { + await appendFile( + transcript, + Array.from({ length: 1_024 }, (_, index) => + row(`key-${index}`, { route: `route-${index % 2}` }) + ).join('') + ) + const initial = await project() + const stringify = vi.spyOn(JSON, 'stringify') + const accumulator = createClaudeUsageTokenCheckpoint(initial) + expect(stringify).toHaveBeenCalledTimes(checkpoint(initial).projections.length) + expect(accumulator.find('key-100:key-100')).toBe(checkpoint(initial).ownedTokenMaxima[100]) + expect( + accumulator.increase('key-100:key-100', { + inputTokens: 1, + outputTokens: 2, + cacheReadTokens: 0, + cacheWriteTokens: 0, + cacheWrite1hTokens: 0 + }) + ).toBeNull() + expect(stringify).toHaveBeenCalledTimes(2) + const encoded = accumulator.finish() + expect(encoded.ownedTokenMaxima[100]).toBe(checkpoint(initial).ownedTokenMaxima[100]) +}) + +it('preserves first-row routing, encounter ties and deferred claims across successive appends', async () => { + await appendFile( + transcript, + row('first', { input: 5, output: 1, route: 'first' }) + + row('second', { input: 10, output: 1, route: 'second' }) + + row('foreign', { input: 100, route: 'foreign', session: 'foreign' }) + ) + const claim = (key: string): boolean => key !== 'foreign:foreign' + const initial = await project(undefined, claim) + await appendFile( + transcript, + row('first', { + input: 10, + output: 0.5, + route: 'changed', + session: 'changed', + model: 'changed', + timestamp: '2026-10-10T12:00:00.000Z' + }) + row('foreign', { input: 150, route: 'foreign', session: 'foreign' }) + ) + const changed = await project(initial, claim) + const cold = await project(undefined, claim) + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(changed.hasDeferredClaims).toBe(true) + expect(changed.sessions[0]?.locationBreakdown.map((entry) => entry.locationKey)).toEqual( + checkpoint(initial).encounterOrder[0]?.projectKeys + ) + const before = structuredClone(changed) + await appendFile(transcript, row('second', { input: 20, route: 'changed' })) + const latest = await project(changed, claim) + expect(latest.sessions).toEqual((await project(undefined, claim)).sessions) + expect(changed).toEqual(before) + expect(latest.hasDeferredClaims).toBe(true) + expect(latest.ownedDedupeKeys).toEqual(['first:first', 'second:second']) +}) + +it('keeps independent fractional maxima without clamping accepted signed token components', async () => { + await appendFile( + transcript, + row('signed', { input: 5, output: -1, read: -0.5, write: -0.25, write1h: -0.5 }) + + row('large', { input: 1e100 }) + ) + const initial = await project() + expect(checkpoint(initial).ownedTokenMaxima[0]?.slice(0, 5)).toEqual([5, -1, -0.5, -0.25, -0.5]) + await appendFile( + transcript, + row('signed', { input: -0.5, output: 4, read: 0.25, write: 0, write1h: 0 }) + + row('large', { input: 5e99, output: 3 }) + ) + const changed = await project(initial) + const cold = await project() + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(checkpoint(changed)).toEqual(checkpoint(cold)) + expect(checkpoint(changed).ownedTokenMaxima[0]?.slice(0, 5)).toEqual([5, 4, 0.25, 0, 0]) + expect(checkpoint(changed).ownedTokenMaxima[1]?.slice(0, 5)).toEqual([1e100, 3, 0, 0, 0]) + expect(hasClaudeUsageResumeProjection(changed)).toBe(true) +}) + +it('attributes frozen source records without changing them or persisting their source-only fields', async () => { + await appendFile( + transcript, + row('first', { input: 10, route: 'first' }) + + row('second', { input: 20, route: 'second' }) + + row('invalid', { timestamp: 'invalid' }) + ) + const read = await readClaudeUsageScanFile(transcript) + const sourceBefore = structuredClone(read.turns) + for (const turn of read.turns) { + Object.freeze(turn) + } + Object.freeze(read.turns) + const initial = await projectClaudeUsageScanFile(read, new Map(), () => true) + expect(read.turns).toEqual(sourceBefore) + expect(initial.sessions).toEqual((await project()).sessions) + expect(JSON.stringify(initial)).not.toContain('"dedupeKey":') + await appendFile(transcript, row('first', { input: 30 }) + row('new', { route: 'third' })) + const appendRead = await readClaudeUsageScanFile(transcript, checkpoint(initial)) + const appendBefore = structuredClone(appendRead.turns) + for (const turn of appendRead.turns) { + Object.freeze(turn) + } + Object.freeze(appendRead.turns) + const changed = await projectClaudeUsageScanFile(appendRead, new Map(), () => true, initial) + const cold = await project() + expect(appendRead.turns).toEqual(appendBefore) + expect(changed.sessions).toEqual(cold.sessions) + expect(changed.dailyAggregates).toEqual(cold.dailyAggregates) + expect(JSON.stringify(changed)).not.toContain('"dedupeKey":') +}) diff --git a/src/main/claude-usage/transcript-usage-projection.ts b/src/main/claude-usage/transcript-usage-projection.ts new file mode 100644 index 00000000000..a508c568f88 --- /dev/null +++ b/src/main/claude-usage/transcript-usage-projection.ts @@ -0,0 +1,175 @@ +import type { + ClaudeUsageAttributedTurn, + ClaudeUsageDailyAggregate, + ClaudeUsagePersistedFile, + ClaudeUsageSession +} from './types' +import type { ClaudeUsageParsedSourceTurn, ClaudeUsageScanFile } from './transcript-record-parser' +import { + aggregateClaudeUsage, + finalizeClaudeSessions, + mergeClaudeDailyAggregates, + mergeClaudeSessions +} from './usage-aggregation' +import { attributeClaudeUsageTurns, type ClaudeUsageWorktreeRef } from './worktree-attribution' +import { + createClaudeUsageTokenCheckpoint, + type ClaudeUsageTokenCorrection +} from './transcript-token-checkpoint' +import { buildClaudeUsageProjectionIntegrity } from './transcript-projection-integrity' + +function dailyKey(day: string, model: string | null, projectKey: string): string { + return [day, model ?? 'unknown', projectKey].join('::') +} + +function applyTokenCorrection( + correction: ClaudeUsageTokenCorrection, + sessions: Map, + daily: Map +): void { + const { previous, updated, projection } = correction + if (!projection) { + return + } + const session = sessions.get(projection.sessionId) + const location = session?.locationBreakdown.find( + (entry) => entry.locationKey === projection.projectKey + ) + const aggregate = daily.get(dailyKey(projection.day, projection.model, projection.projectKey)) + if (!session || !location || !aggregate) { + throw new Error('Claude usage checkpoint does not match its cached projection.') + } + const input = updated[0] - previous[0] + const output = updated[1] - previous[1] + const read = updated[2] - previous[2] + const write = updated[3] - previous[3] + const write1h = updated[4] - previous[4] + session.totalInputTokens += input + session.totalOutputTokens += output + session.totalCacheReadTokens += read + session.totalCacheWriteTokens += write + session.totalCacheWrite1hTokens += write1h + for (const target of [location, aggregate]) { + target.inputTokens += input + target.outputTokens += output + target.cacheReadTokens += read + target.cacheWriteTokens += write + target.cacheWrite1hTokens += write1h + } + aggregate.zeroCacheReadTurnCount += Number(updated[2] === 0) - Number(previous[2] === 0) +} + +function retainEncounterOrder( + order: Map, + turns: ClaudeUsageAttributedTurn[] +): void { + for (const turn of turns) { + const locations = order.get(turn.sessionId) + if (!locations) { + order.set(turn.sessionId, [turn.projectKey]) + } else if (!locations.includes(turn.projectKey)) { + locations.push(turn.projectKey) + } + } +} + +function restoreEncounterOrder( + sessions: Map, + order: Map +): Map { + const ordered = new Map() + for (const [sessionId, locations] of order) { + const session = sessions.get(sessionId) + if (!session) { + continue + } + const locationIndex = new Map(locations.map((key, index) => [key, index])) + session.locationBreakdown.sort( + (a, b) => (locationIndex.get(a.locationKey) ?? 0) - (locationIndex.get(b.locationKey) ?? 0) + ) + ordered.set(sessionId, session) + } + return ordered +} + +export async function projectClaudeUsageScanFile( + read: ClaudeUsageScanFile, + worktreeLookup: Map, + claimKey: (key: string) => boolean, + previous?: ClaudeUsagePersistedFile +): Promise { + const retained = read.resumed ? previous : undefined + const sessions = new Map() + const daily = new Map() + mergeClaudeSessions(sessions, retained?.sessions ?? []) + mergeClaudeDailyAggregates(daily, retained?.dailyAggregates ?? []) + const owned = createClaudeUsageTokenCheckpoint(retained) + const order = new Map( + retained?.parseResumeState?.encounterOrder.map((entry) => [ + entry.sessionId, + [...entry.projectKeys] + ]) ?? [] + ) + let hasDeferredClaims = retained?.hasDeferredClaims ?? false + const newTurns: ClaudeUsageParsedSourceTurn[] = [] + for (const turn of read.turns) { + if (turn.dedupeKey && !claimKey(turn.dedupeKey)) { + hasDeferredClaims = true + continue + } + if (turn.dedupeKey && owned.find(turn.dedupeKey)) { + const correction = owned.increase(turn.dedupeKey, turn) + if (correction) { + applyTokenCorrection(correction, sessions, daily) + } + } else { + newTurns.push(turn) + } + } + const attributed = await attributeClaudeUsageTurns(newTurns, worktreeLookup) + let attributedIndex = 0 + for (const turn of newTurns) { + const attribution = Number.isNaN(new Date(turn.timestamp).getTime()) + ? undefined + : attributed[attributedIndex++] + if (turn.dedupeKey) { + owned.append( + turn.dedupeKey, + turn, + attribution + ? { + sessionId: attribution.sessionId, + day: attribution.day, + model: attribution.model, + projectKey: attribution.projectKey + } + : null + ) + } + } + const appended = aggregateClaudeUsage(attributed) + mergeClaudeSessions(sessions, appended.sessions) + mergeClaudeDailyAggregates(daily, appended.dailyAggregates) + retainEncounterOrder(order, attributed) + const projected: ClaudeUsagePersistedFile = { + ...read.processedFile, + sessions: finalizeClaudeSessions(restoreEncounterOrder(sessions, order)), + dailyAggregates: [...daily.values()].sort((a, b) => + a.day === b.day ? a.projectLabel.localeCompare(b.projectLabel) : a.day.localeCompare(b.day) + ), + ownedDedupeKeys: owned.ownedDedupeKeys, + hasDeferredClaims, + parseResumeState: read.checkpoint + ? { + ...read.checkpoint, + lineCount: read.committedLineCount, + ...owned.finish(), + encounterOrder: [...order].map(([sessionId, projectKeys]) => ({ sessionId, projectKeys })) + } + : null + } + if (projected.parseResumeState) { + projected.parseResumeState.projectionIntegrity = buildClaudeUsageProjectionIntegrity(projected) + } + return projected +} diff --git a/src/main/claude-usage/types.ts b/src/main/claude-usage/types.ts index 0a4d061c332..7e06824260c 100644 --- a/src/main/claude-usage/types.ts +++ b/src/main/claude-usage/types.ts @@ -3,6 +3,8 @@ export type ClaudeUsageProcessedFile = { mtimeMs: number size: number lineCount: number + physicalFileId?: string | null + ctimeMs?: number } export type ClaudeUsageLocationBreakdown = { @@ -54,6 +56,7 @@ export type ClaudeUsageDailyAggregate = { export type ClaudeUsagePersistedState = { schemaVersion: number + usageIntegrity?: string worktreeFingerprint: string | null processedFiles: ClaudeUsagePersistedFile[] sessions: ClaudeUsageSession[] @@ -77,6 +80,7 @@ export type ClaudeUsagePersistedFile = ClaudeUsageProcessedFile & { * owner disappears, only deferred files need reparse to reclaim — not the * entire transcript corpus. */ hasDeferredClaims: boolean + parseResumeState?: ClaudeUsageParseResumeState | null } export type ClaudeUsageParsedTurn = { @@ -100,3 +104,33 @@ export type ClaudeUsageAttributedTurn = ClaudeUsageParsedTurn & { repoId: string | null worktreeId: string | null } +import type { JsonlFileCheckpoint } from '../usage/jsonl-file-checkpoint' + +export type ClaudeUsageTokenTotals = Pick< + ClaudeUsageParsedTurn, + 'inputTokens' | 'outputTokens' | 'cacheReadTokens' | 'cacheWriteTokens' | 'cacheWrite1hTokens' +> + +export type ClaudeUsageTurnProjection = { + sessionId: string + day: string + model: string | null + projectKey: string +} + +export type ClaudeUsageTokenMaxima = [ + inputTokens: number, + outputTokens: number, + cacheReadTokens: number, + cacheWriteTokens: number, + cacheWrite1hTokens: number, + projectionIndex: number | null +] + +export type ClaudeUsageParseResumeState = JsonlFileCheckpoint & { + lineCount: number + ownedTokenMaxima: ClaudeUsageTokenMaxima[] + projections: ClaudeUsageTurnProjection[] + encounterOrder: { sessionId: string; projectKeys: string[] }[] + projectionIntegrity?: string +} diff --git a/src/main/durable-file-write.test.ts b/src/main/durable-file-write.test.ts index 5ea2d85b959..1b22705f897 100644 --- a/src/main/durable-file-write.test.ts +++ b/src/main/durable-file-write.test.ts @@ -20,6 +20,14 @@ describe('durable file write', () => { rmSync(dir, { recursive: true, force: true }) }) + it('durably writes a binary view without leaking bytes outside its bounds', async () => { + const final = join(dir, 'state.gz') + const backing = Buffer.from([99, 0x1f, 0x8b, 0, 0xff, 77]) + await writeFileDurable(`${final}.tmp`, final, backing.subarray(1, -1)) + expect(readFileSync(final)).toEqual(Buffer.from([0x1f, 0x8b, 0, 0xff])) + expect(existsSync(`${final}.tmp`)).toBe(false) + }) + for (const [label, write] of [ ['async', (t: string, f: string, p: string) => writeFileDurable(t, f, p)], [ diff --git a/src/main/durable-file-write.ts b/src/main/durable-file-write.ts index 6e15a76f872..839256e1861 100644 --- a/src/main/durable-file-write.ts +++ b/src/main/durable-file-write.ts @@ -80,7 +80,7 @@ export async function renameDurable(tmpPath: string, finalPath: string): Promise */ export async function writeTempFileDurable( tmpPath: string, - payload: string, + payload: string | Uint8Array, mode?: number ): Promise { const handle = await open(tmpPath, 'w', mode) @@ -132,7 +132,7 @@ export async function copyFileDurable(sourcePath: string, finalPath: string): Pr export async function writeFileDurable( tmpPath: string, finalPath: string, - payload: string + payload: string | Uint8Array ): Promise { await writeFileDurableIfCurrent(tmpPath, finalPath, payload, () => true) } @@ -146,7 +146,7 @@ export async function writeFileDurable( export async function writeFileDurableIfCurrent( tmpPath: string, finalPath: string, - payload: string, + payload: string | Uint8Array, isCurrent: () => boolean ): Promise { let renamed = false diff --git a/src/main/ipc/usage-provider-handlers-readiness.test.ts b/src/main/ipc/usage-provider-handlers-readiness.test.ts new file mode 100644 index 00000000000..998e1d6910c --- /dev/null +++ b/src/main/ipc/usage-provider-handlers-readiness.test.ts @@ -0,0 +1,207 @@ +import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import type { ClaudeUsagePersistedState } from '../claude-usage/types' +import type { UsageCacheSplitResult } from '../usage/usage-source-cache-file' + +const { handlers, getPathMock } = vi.hoisted(() => ({ + handlers: new Map unknown>(), + getPathMock: vi.fn<() => string>() +})) + +vi.mock('electron', () => ({ + app: { getPath: getPathMock }, + ipcMain: { + handle: (channel: string, handler: (event: unknown, args?: unknown) => unknown) => { + handlers.set(channel, handler) + } + } +})) + +vi.mock('../usage/usage-scan-worker-spawn', () => ({ + scanClaudeUsageFilesViaWorker: vi.fn(), + scanCodexUsageFilesViaWorker: vi.fn(), + scanOpenCodeUsageDatabasesViaWorker: vi.fn(), + scanMuseUsageFilesViaWorker: vi.fn(), + splitUsageCacheFileViaWorker: vi.fn() +})) + +import { ClaudeUsageStore, initClaudeUsagePath } from '../claude-usage/store' +import { CodexUsageStore, initCodexUsagePath } from '../codex-usage/store' +import { OpenCodeUsageStore, initOpenCodeUsagePath } from '../opencode-usage/store' +import { MuseUsageStore, initMuseUsagePath } from '../muse-usage/store' +import { + scanClaudeUsageFilesViaWorker, + splitUsageCacheFileViaWorker +} from '../usage/usage-scan-worker-spawn' +import { registerUsageProviderHandlers } from './usage-provider-handlers' + +let directory: string +let stores: { flush: () => Promise }[] +let releasePending: (() => void)[] + +function historicalState(): ClaudeUsagePersistedState { + return { + schemaVersion: 6, + worktreeFingerprint: null, + processedFiles: [], + sessions: [], + dailyAggregates: [ + { + day: '2026-10-09', + model: null, + projectKey: 'unscoped', + projectLabel: 'Unknown location', + repoId: null, + worktreeId: null, + turnCount: 1, + zeroCacheReadTurnCount: 1, + inputTokens: 7, + outputTokens: 2, + cacheReadTokens: 0, + cacheWriteTokens: 0, + cacheWrite1hTokens: 0 + } + ], + scanState: { + enabled: false, + lastScanStartedAt: null, + lastScanCompletedAt: 1, + lastScanError: null + } + } +} + +function createProviders(): Parameters[0] { + const backingStore = { getRepos: () => [], getAllWorktreeMeta: () => ({}) } + const providers = { + claudeUsage: new ClaudeUsageStore(backingStore), + codexUsage: new CodexUsageStore(backingStore), + openCodeUsage: new OpenCodeUsageStore(backingStore), + museUsage: new MuseUsageStore(backingStore) + } + stores.push(...Object.values(providers)) + registerUsageProviderHandlers(providers) + return providers +} + +function reportText(state: ClaudeUsagePersistedState): string { + const { processedFiles: _files, ...report } = state + return JSON.stringify(report) +} + +function invoke(channel: string, args?: unknown): unknown { + const handler = handlers.get(channel) + if (!handler) { + throw new Error(`No registered usage handler for ${channel}.`) + } + return handler({}, args) +} + +function nextTurn(): Promise { + return new Promise((resolve) => setImmediate(resolve)) +} + +beforeEach(() => { + directory = mkdtempSync(join(tmpdir(), 'orca-usage-ipc-readiness-')) + stores = [] + releasePending = [] + handlers.clear() + getPathMock.mockReturnValue(directory) + vi.mocked(scanClaudeUsageFilesViaWorker).mockReset() + vi.mocked(splitUsageCacheFileViaWorker).mockReset() + initClaudeUsagePath() + initCodexUsagePath() + initOpenCodeUsagePath() + initMuseUsagePath() +}) + +afterEach(async () => { + releasePending.forEach((release) => release()) + await Promise.all(stores.map((store) => store.flush())) + rmSync(directory, { recursive: true, force: true }) + vi.restoreAllMocks() +}) + +it('awaits loading before the first disabled cached snapshot and all historical queries', async () => { + const cached = historicalState() + writeFileSync( + join(directory, 'orca-claude-usage.json'), + `${JSON.stringify(cached)}${' '.repeat(9 * 1024 * 1024)}` + ) + const pending = Promise.withResolvers() + releasePending.push(() => pending.resolve({ reportText: reportText(cached), migrated: false })) + vi.mocked(splitUsageCacheFileViaWorker).mockReturnValueOnce(pending.promise) + const { claudeUsage } = createProviders() + const snapshotGetter = vi.spyOn(claudeUsage, 'getSnapshot') + const scanStateGetter = vi.spyOn(claudeUsage, 'getScanState') + const settled = vi.fn() + const args = { scope: 'all', range: 'all', limit: 7, kind: 'model' } + const requests = [ + 'getSnapshot', + 'getScanState', + 'getSummary', + 'getDaily', + 'getBreakdown', + 'getRecentSessions' + ].map((query) => + Promise.resolve(invoke(`claudeUsage:${query}`, args)).then((value) => { + settled() + return value + }) + ) + await nextTurn() + expect(settled).not.toHaveBeenCalled() + expect(snapshotGetter).not.toHaveBeenCalled() + expect(scanStateGetter).not.toHaveBeenCalled() + expect(scanClaudeUsageFilesViaWorker).not.toHaveBeenCalled() + pending.resolve({ reportText: reportText(cached), migrated: false }) + const [snapshot, scanState, summary, daily] = await Promise.all(requests) + expect(snapshot).toMatchObject({ + scanState: { enabled: false, isScanning: false, hasAnyClaudeData: true }, + summary: { turns: 1, inputTokens: 7 } + }) + expect(scanState).toMatchObject({ enabled: false, isScanning: false, hasAnyClaudeData: true }) + expect(summary).toMatchObject({ turns: 1, inputTokens: 7 }) + expect(daily).toEqual([ + { day: '2026-10-09', inputTokens: 7, outputTokens: 2, cacheReadTokens: 0, cacheWriteTokens: 0 } + ]) + expect(snapshotGetter).toHaveBeenCalledWith('all', 'all', 7) + expect(scanClaudeUsageFilesViaWorker).not.toHaveBeenCalled() +}) + +it.each(['claudeUsage', 'codexUsage', 'openCodeUsage', 'museUsage'] as const)( + 'gates snapshot and scan state for %s until whenLoaded resolves', + async (prefix) => { + const providers = createProviders() + const store = providers[prefix] + const pending = Promise.withResolvers() + releasePending.push(() => pending.resolve(undefined)) + vi.spyOn(store, 'whenLoaded').mockReturnValue(pending.promise) + const snapshotGetter = vi.spyOn(store, 'getSnapshot') + const scanStateGetter = vi.spyOn(store, 'getScanState') + const snapshot = Promise.resolve( + invoke(`${prefix}:getSnapshot`, { scope: 'all', range: 'all' }) + ) + const scanState = Promise.resolve(invoke(`${prefix}:getScanState`)) + await nextTurn() + expect(snapshotGetter).not.toHaveBeenCalled() + expect(scanStateGetter).not.toHaveBeenCalled() + pending.resolve(undefined) + await Promise.all([snapshot, scanState]) + expect(snapshotGetter).toHaveBeenCalledWith('all', 'all', undefined) + expect(scanStateGetter).toHaveBeenCalled() + } +) + +it('keeps a loaded provider snapshot synchronous for direct callers', () => { + const { codexUsage } = createProviders() + const loaded = vi.spyOn(codexUsage, 'whenLoaded') + const snapshot = codexUsage.getSnapshot('all', 'all', 3) + const scanState = codexUsage.getScanState() + expect(snapshot).not.toBeInstanceOf(Promise) + expect(scanState).not.toBeInstanceOf(Promise) + expect(loaded).not.toHaveBeenCalled() + expect(snapshot.summary.hasAnyCodexData).toBe(false) +}) diff --git a/src/main/usage/usage-cache-json-integrity.ts b/src/main/usage/usage-cache-json-integrity.ts new file mode 100644 index 00000000000..0251afcdbda --- /dev/null +++ b/src/main/usage/usage-cache-json-integrity.ts @@ -0,0 +1,30 @@ +import { createHash } from 'node:crypto' + +const HEADER = /^\{"usageIntegrity":"([a-f0-9]{64})",/ + +export function sealUsageCacheJson(material: string, domain: string): string { + if (!material.startsWith('{') || material === '{}') { + throw new Error('Usage cache integrity requires a JSON object.') + } + const digest = createHash('sha256').update(domain).update('\n').update(material).digest('hex') + return `{"usageIntegrity":"${digest}",${material.slice(1)}` +} + +export function verifyUsageCacheJson(text: string, digest: unknown, domain: string): boolean { + const header = HEADER.exec(text) + if (!header) { + if (digest !== undefined) { + throw new Error('Saved usage cache integrity framing is invalid.') + } + return false + } + const expected = createHash('sha256') + .update(domain) + .update('\n{') + .update(text.slice(header[0].length)) + .digest('hex') + if (digest !== header[1] || expected !== header[1]) { + throw new Error('Saved usage cache integrity does not match its contents.') + } + return true +} diff --git a/src/main/usage/usage-inline-cache-preservation.ts b/src/main/usage/usage-inline-cache-preservation.ts new file mode 100644 index 00000000000..28464e96f21 --- /dev/null +++ b/src/main/usage/usage-inline-cache-preservation.ts @@ -0,0 +1,33 @@ +import { readFile } from 'node:fs/promises' +import type { UsageCacheSnapshotWriter } from '../usage-cache-snapshot-writer' + +export class UsageInlineCachePreservation { + active = false + private pending = Promise.resolve() + + write( + cacheFile: string, + enabled: () => boolean, + writer: UsageCacheSnapshotWriter, + serializeReport: () => string + ): Promise { + if (!this.active) { + return writer.write(serializeReport) + } + // Failed migration leaves this file as the only source-cache generation. + this.pending = this.pending + .catch(() => {}) + .then(async () => { + const parsed: { scanState: { enabled: boolean } } = JSON.parse( + await readFile(cacheFile, 'utf8') + ) + parsed.scanState.enabled = enabled() + await writer.write(() => (this.active ? JSON.stringify(parsed) : serializeReport())) + }) + return this.pending + } + + settle(): Promise { + return this.pending.catch(() => {}) + } +} diff --git a/src/main/usage/usage-provider-store-initialization.test.ts b/src/main/usage/usage-provider-store-initialization.test.ts new file mode 100644 index 00000000000..f91099ebf1d --- /dev/null +++ b/src/main/usage/usage-provider-store-initialization.test.ts @@ -0,0 +1,381 @@ +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' +import type * as FsPromises from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { UsageProviderStoreLifecycle } from './usage-provider-store-lifecycle' +import { UsageCacheSnapshotWriter } from '../usage-cache-snapshot-writer' +import type { UsageScanWorktreeRef } from './usage-provider-contract' +import { + usageSourceCachePath, + type UsageCacheSplitRequest, + type UsageCacheSplitResult, + type UsageSourceCacheRef +} from './usage-source-cache-file' + +const { identityWriteGate } = vi.hoisted(() => ({ + identityWriteGate: { + prefix: '', + pending: Promise.resolve(), + entered: vi.fn() + } +})) + +vi.mock('node:fs/promises', async () => { + const actual = await vi.importActual('node:fs/promises') + return { + ...actual, + open: async (...args: Parameters) => { + if ( + args[1] === 'w' && + identityWriteGate.prefix && + String(args[0]).startsWith(identityWriteGate.prefix) + ) { + identityWriteGate.entered() + await identityWriteGate.pending + } + return actual.open(...args) + } + } +}) + +type TestState = { + schemaVersion: number + worktreeFingerprint: string | null + processedSources: { id: string }[] + sessions: { id: string }[] + dailyAggregates: { day: string }[] + scanState: { + enabled: boolean + lastScanStartedAt: number | null + lastScanCompletedAt: number | null + lastScanError: string | null + } +} +type ScanProjection = Pick +type Scan = ( + worktrees: UsageScanWorktreeRef[], + sourceCache: UsageSourceCacheRef +) => Promise +type Split = (request: UsageCacheSplitRequest) => Promise +type LoadOptions = { + splitCacheFile: Split + scan?: Scan + parseReport?: (text: string) => TestState | Promise + serializeReport?: (state: TestState) => string +} + +function defaultState(): TestState { + return { + schemaVersion: 1, + worktreeFingerprint: null, + processedSources: [], + sessions: [], + dailyAggregates: [], + scanState: { + enabled: false, + lastScanStartedAt: null, + lastScanCompletedAt: null, + lastScanError: null + } + } +} + +function historicalState(enabled = false): TestState { + return { + ...defaultState(), + worktreeFingerprint: '[]', + processedSources: [{ id: 'historical-source' }], + sessions: [{ id: 'historical-session' }], + dailyAggregates: [{ day: '2026-10-09' }], + scanState: { ...defaultState().scanState, enabled, lastScanCompletedAt: 1 } + } +} + +function reportState(state: TestState): TestState { + return { ...state, processedSources: [] } +} + +function reportText(state: TestState): string { + const { processedSources: _sources, ...report } = state + return JSON.stringify(report) +} + +class LoadingUsageStore extends UsageProviderStoreLifecycle< + 'processedSources', + TestState, + 'hasAnyTestData' +> { + constructor(cacheFile: string, options: LoadOptions) { + super( + { getRepos: () => [], getAllWorktreeMeta: () => ({}) }, + { + logTag: '[test-loading-usage]', + resolveCacheFile: () => cacheFile, + createDefaultState: defaultState, + normalizeState: (state) => state, + sourceKey: 'processedSources', + dataPresenceKey: 'hasAnyTestData', + scan: options.scan ?? (async () => defaultState()), + splitCacheFile: options.splitCacheFile, + parseReport: options.parseReport, + serializeReport: options.serializeReport + } + ) + } + + getSnapshot(): TestState { + return structuredClone(this.state) + } +} + +let directory: string +let cacheFile: string +let stores: LoadingUsageStore[] +let releasePending: (() => void)[] + +function createStore(options: LoadOptions): LoadingUsageStore { + const store = new LoadingUsageStore(cacheFile, options) + stores.push(store) + return store +} + +function writeLargeLegacyCache(state: TestState): string { + const payload = `${JSON.stringify(state)}${' '.repeat(9 * 1024 * 1024)}` + writeFileSync(cacheFile, payload) + return payload +} + +function pendingSplit(state: TestState, migrated = false) { + const pending = Promise.withResolvers() + releasePending.push(() => pending.resolve({ reportText: reportText(state), migrated })) + return pending +} + +function nextTurn(): Promise { + return new Promise((resolve) => setImmediate(resolve)) +} + +beforeEach(() => { + directory = mkdtempSync(join(tmpdir(), 'orca-usage-loading-')) + cacheFile = join(directory, 'usage.json') + stores = [] + releasePending = [] + identityWriteGate.prefix = '' + identityWriteGate.pending = Promise.resolve() + identityWriteGate.entered.mockClear() +}) + +afterEach(async () => { + releasePending.forEach((release) => release()) + await Promise.all(stores.map((store) => store.flush())) + rmSync(directory, { recursive: true, force: true }) + vi.restoreAllMocks() +}) + +it('withholds a large disabled history until whenLoaded and retains no source graph', async () => { + const cached = historicalState() + writeLargeLegacyCache(cached) + const pending = pendingSplit(cached) + const split = vi.fn(() => pending.promise) + const store = createStore({ splitCacheFile: split }) + const ready = vi.fn() + const loaded = store.whenLoaded().then(ready) + expect(store.getSnapshot()).toMatchObject({ sessions: [], dailyAggregates: [] }) + await nextTurn() + expect(split).toHaveBeenCalledWith( + expect.objectContaining({ cacheFile, sourceKey: 'processedSources' }) + ) + expect(ready).not.toHaveBeenCalled() + pending.resolve({ reportText: reportText(cached), migrated: false }) + await loaded + expect(store.getSnapshot()).toEqual(reportState(cached)) + expect(store.getScanState()).toMatchObject({ enabled: false, hasAnyTestData: true }) + expect(JSON.stringify(store.getSnapshot())).not.toContain('historical-source') +}) + +it('queues enabled changes and flush behind loading without writing provisional state', async () => { + const cached = historicalState() + const initialPayload = writeLargeLegacyCache(cached) + const pending = pendingSplit(cached, true) + const serialize = vi.fn((state: TestState) => { + const { processedSources: _sources, ...report } = state + return JSON.stringify({ ...report, serialized: true }) + }) + const store = createStore({ splitCacheFile: () => pending.promise, serializeReport: serialize }) + const enable = store.setEnabled(true) + const disable = store.setEnabled(false) + const finalEnable = store.setEnabled(true) + const flushed = vi.fn() + const flush = store.flush().then(flushed) + await nextTurn() + expect(serialize).not.toHaveBeenCalled() + expect(flushed).not.toHaveBeenCalled() + expect(readFileSync(cacheFile, 'utf8')).toBe(initialPayload) + pending.resolve({ reportText: reportText(cached), migrated: true }) + await flush + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).toMatchObject({ + sessions: cached.sessions, + scanState: { enabled: true }, + serialized: true + }) + await Promise.all([enable, disable, finalEnable]) + expect(store.getSnapshot()).toEqual({ + ...reportState(cached), + scanState: { ...cached.scanState, enabled: true } + }) + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).not.toHaveProperty('processedSources') +}) + +it('admits a shared refresh after loading and keeps the newer worker projection', async () => { + const cached = historicalState(true) + writeLargeLegacyCache(cached) + const pending = pendingSplit(cached) + const scanPending = Promise.withResolvers() + releasePending.push(() => scanPending.resolve(defaultState())) + const scan = vi.fn(() => scanPending.promise) + const store = createStore({ splitCacheFile: () => pending.promise, scan }) + const first = store.refresh(true) + const second = store.refresh(true) + await nextTurn() + expect(scan).not.toHaveBeenCalled() + pending.resolve({ reportText: reportText(cached), migrated: false }) + await vi.waitFor(() => expect(scan).toHaveBeenCalledTimes(1)) + expect(scan).toHaveBeenCalledWith([], { + path: usageSourceCachePath(cacheFile), + schemaVersion: 1, + worktreeFingerprint: '[]', + reuse: true + }) + const newer = { sessions: [{ id: 'new-session' }], dailyAggregates: [{ day: '2026-10-10' }] } + const workerReply = { ...newer, processedSources: [{ id: 'worker-source-graph' }] } + scanPending.resolve(workerReply) + await Promise.all([first, second]) + await store.whenLoaded() + await nextTurn() + expect(store.getSnapshot()).toMatchObject({ ...newer, processedSources: [] }) + expect(JSON.stringify(store.getSnapshot())).not.toContain('worker-source-graph') + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).toMatchObject(newer) + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).not.toHaveProperty('processedSources') +}) + +it('honors a queued disable before a queued refresh starts after loading', async () => { + const cached = historicalState(true) + writeLargeLegacyCache(cached) + const pending = pendingSplit(cached) + const scan = vi.fn(async () => defaultState()) + const store = createStore({ splitCacheFile: () => pending.promise, scan }) + const disable = store.setEnabled(false) + const refresh = store.refresh(true) + pending.resolve({ reportText: reportText(cached), migrated: false }) + await Promise.all([disable, refresh]) + expect(scan).not.toHaveBeenCalled() + expect(store.getSnapshot()).toMatchObject({ + sessions: cached.sessions, + scanState: { enabled: false } + }) +}) + +it.each(['rejection', 'throw'] as const)( + 'preserves disabled cached history after a worker %s', + async (failureMode) => { + const cached = historicalState() + writeLargeLegacyCache(cached) + const failure = new Error('usage worker unavailable') + const unhandled = vi.fn() + vi.spyOn(console, 'warn').mockImplementation(() => {}) + process.on('unhandledRejection', unhandled) + try { + const store = createStore({ + splitCacheFile: () => { + if (failureMode === 'throw') { + throw failure + } + return Promise.reject(failure) + } + }) + await expect(store.whenLoaded()).resolves.toBeUndefined() + await nextTurn() + expect(unhandled).not.toHaveBeenCalled() + expect(store.getSnapshot()).toEqual(reportState(cached)) + expect(store.getScanState()).toMatchObject({ enabled: false, hasAnyTestData: true }) + expect(store.getSnapshot().processedSources).toEqual([]) + await store.setEnabled(true) + await store.flush() + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).toEqual({ + ...cached, + scanState: { ...cached.scanState, enabled: true } + }) + expect(store.getSnapshot().processedSources).toEqual([]) + } finally { + process.off('unhandledRejection', unhandled) + } + } +) + +it('keeps an ordinary compact report synchronous and never asks the worker to split it', async () => { + const cached = historicalState() + writeFileSync(cacheFile, reportText(cached)) + const split = vi.fn() + const store = createStore({ splitCacheFile: split }) + expect(store.getSnapshot()).toEqual(reportState(cached)) + expect(split).not.toHaveBeenCalled() + await store.setEnabled(true) + expect(JSON.parse(readFileSync(cacheFile, 'utf8'))).not.toHaveProperty('processedSources') +}) + +it('extends whenLoaded through an asynchronous provider report parser', async () => { + const cached = historicalState() + writeFileSync(cacheFile, reportText(cached)) + const parsed = Promise.withResolvers() + releasePending.push(() => parsed.resolve(reportState(cached))) + const parseReport = vi.fn(() => parsed.promise) + const store = createStore({ splitCacheFile: vi.fn(), parseReport }) + const ready = vi.fn() + const loaded = store.whenLoaded().then(ready) + const enabled = store.setEnabled(true) + await nextTurn() + expect(ready).not.toHaveBeenCalled() + expect(readFileSync(cacheFile, 'utf8')).toBe(reportText(cached)) + parsed.resolve(reportState(cached)) + await Promise.all([loaded, enabled]) + expect(store.getSnapshot()).toMatchObject({ + sessions: cached.sessions, + scanState: { enabled: true } + }) +}) + +it('drains the pending analytics writer after an inline preference write rejects', async () => { + const cached = historicalState() + writeLargeLegacyCache(cached) + vi.spyOn(console, 'warn').mockImplementation(() => {}) + const store = createStore({ + splitCacheFile: async () => { + throw new Error('usage worker unavailable') + } + }) + await store.whenLoaded() + rmSync(cacheFile) + await expect(store.setEnabled(true)).rejects.toMatchObject({ code: 'ENOENT' }) + const identityFile = join(directory, 'usage-analytics-session-ids.json') + const pending = Promise.withResolvers() + releasePending.push(() => pending.resolve(undefined)) + identityWriteGate.prefix = identityFile + identityWriteGate.pending = pending.promise + const identity = store.getAnalyticsSessionIds(['session-with-pending-identity']) + await vi.waitFor(() => expect(identityWriteGate.entered).toHaveBeenCalledTimes(1)) + const writerFlush = vi.spyOn(UsageCacheSnapshotWriter.prototype, 'flush') + const flushed = vi.fn() + const flushing = store.flush().then(flushed) + await nextTurn() + expect(writerFlush).toHaveBeenCalled() + expect(flushed).not.toHaveBeenCalled() + pending.resolve(undefined) + await expect(flushing).resolves.toBeUndefined() + const [id] = await identity + expect(JSON.parse(readFileSync(identityFile, 'utf8'))).toMatchObject({ + entries: [['session-with-pending-identity', id]] + }) + expect(writerFlush).toHaveBeenCalledTimes(2) + expect(store.getSnapshot().processedSources).toEqual([]) +}) diff --git a/src/main/usage/usage-provider-store-lifecycle.test.ts b/src/main/usage/usage-provider-store-lifecycle.test.ts index 0ab96ae7900..4da29d99a51 100644 --- a/src/main/usage/usage-provider-store-lifecycle.test.ts +++ b/src/main/usage/usage-provider-store-lifecycle.test.ts @@ -359,6 +359,7 @@ describe('UsageProviderStoreLifecycle', () => { // A write racing the load must not clobber the history being loaded. const disabled = store.setEnabled(false) + await Promise.resolve() expect(split).toHaveBeenCalledWith({ cacheFile, sourceKey: 'processedSources' }) await store.whenLoaded() await disabled diff --git a/src/main/usage/usage-provider-store-lifecycle.ts b/src/main/usage/usage-provider-store-lifecycle.ts index fd0492d9b5b..6f29ab8a7f2 100644 --- a/src/main/usage/usage-provider-store-lifecycle.ts +++ b/src/main/usage/usage-provider-store-lifecycle.ts @@ -11,6 +11,7 @@ import { UsageCacheSnapshotWriter } from '../usage-cache-snapshot-writer' import { loadKnownUsageWorktreesByRepo } from '../usage-worktree-metadata' import type { UsageScanWorktreeRef } from './usage-provider-contract' import { createWorktreeRefs, getUsageWorktreeFingerprint } from './usage-worktree-refs' +import { UsageInlineCachePreservation } from './usage-inline-cache-preservation' import { usageSourceCachePath, type UsageCacheSplitRequest, @@ -46,6 +47,13 @@ type UsageProviderStoreLifecycleConfig< resolveCacheFile: () => string createDefaultState: () => State normalizeState: (state: State) => State + parseReport?: ( + text: string, + parsed?: State, + integrityVerified?: boolean + ) => State | Promise + serializeReport?: (state: State) => string + providerId?: 'claude' sourceKey: SourceKey dataPresenceKey: DataPresenceKey tokenUsage?: { @@ -76,6 +84,7 @@ export abstract class UsageProviderStoreLifecycle< private tokenReporter: AgentTokenUsageReporter | null = null private analyticsSessionIds: AnalyticsSessionIdStore | null = null private readonly writer: UsageCacheSnapshotWriter + private readonly inlineCache = new UsageInlineCachePreservation() constructor( private readonly store: Pick, @@ -116,6 +125,7 @@ export abstract class UsageProviderStoreLifecycle< /** Await queued cache writes so quit does not drop the final snapshot. */ async flush(): Promise { await this.loaded + await this.inlineCache.settle() await this.tokenReporter?.flush() await Promise.all([this.writer.flush(), this.analyticsSessionIds?.flush()]) } @@ -144,10 +154,32 @@ export abstract class UsageProviderStoreLifecycle< } protected writeToDisk(): Promise { - return this.writer.write(() => { - const { [this.config.sourceKey]: _sources, ...report } = this.state - return JSON.stringify(report) - }) + return this.inlineCache.write( + this.config.resolveCacheFile(), + () => this.state.scanState.enabled, + this.writer, + () => this.serializeReport() + ) + } + + private serializeReport(): string { + if (this.config.serializeReport) { + return this.config.serializeReport(this.state) + } + const { [this.config.sourceKey]: _sources, ...report } = this.state + return JSON.stringify(report) + } + + private applyReport(text: string, parsed?: State, verified = false): void | Promise { + const report = this.config.parseReport + ? this.config.parseReport(text, parsed, verified) + : (parsed ?? JSON.parse(text)) + if (report instanceof Promise) { + return report.then((state) => { + this.state = this.normalizeReport(state) + }) + } + this.state = this.normalizeReport(report) } private load(): Promise { @@ -156,20 +188,23 @@ export abstract class UsageProviderStoreLifecycle< if (statSync(cacheFile).size > MAIN_THREAD_PARSE_MAX_BYTES) { return this.loadOnWorker(cacheFile) } - const parsed: State = JSON.parse(readFileSync(cacheFile, 'utf-8')) - this.state = this.normalizeReport(parsed) + const text = readFileSync(cacheFile, 'utf-8') + const parsed: State = JSON.parse(text) if ( Array.isArray(parsed[this.config.sourceKey]) && parsed[this.config.sourceKey].length > 0 ) { return this.loadOnWorker(cacheFile) } + const applied = this.applyReport(text, parsed) + if (applied) { + return applied.catch((error: unknown) => { + console.error(`${this.config.logTag} Failed to load persisted state:`, error) + }) + } } catch (error) { if (!isMissingFileError(error)) { - console.error( - `${this.config.logTag} Failed to load persisted state, starting fresh:`, - error - ) + console.error(`${this.config.logTag} Failed to load persisted state:`, error) } } return Promise.resolve() @@ -177,17 +212,35 @@ export abstract class UsageProviderStoreLifecycle< private async loadOnWorker(cacheFile: string): Promise { try { - const { reportText, migrated } = await this.config - .splitCacheFile({ cacheFile, sourceKey: this.config.sourceKey }) + let fallback = false + const { reportText, migrated, reportIntegrityVerified } = await Promise.resolve() + .then(() => + this.config.splitCacheFile({ + cacheFile, + sourceKey: this.config.sourceKey, + ...(this.config.providerId ? { providerId: this.config.providerId } : {}) + }) + ) .catch(async (error: unknown) => { // Preserve usage history when the worker cannot start. console.warn(`${this.config.logTag} Reading the usage cache on the main thread:`, error) - return { reportText: await readFile(cacheFile, 'utf-8'), migrated: false } + fallback = true + return { + reportText: await readFile(cacheFile, 'utf-8'), + migrated: false, + reportIntegrityVerified: false + } }) if (reportText === null) { return } - this.state = this.normalizeReport(JSON.parse(reportText)) + const parsed: State = JSON.parse(reportText) + this.inlineCache.active = + fallback && + !('usageIntegrity' in parsed) && + Array.isArray(parsed[this.config.sourceKey]) && + parsed[this.config.sourceKey].length > 0 + await this.applyReport(reportText, parsed, !fallback && reportIntegrityVerified === true) if (migrated) { // Future launches can read the compact report synchronously. await this.writeToDisk().catch(() => {}) @@ -231,6 +284,8 @@ export abstract class UsageProviderStoreLifecycle< this.state.sessions = result.sessions this.state.dailyAggregates = result.dailyAggregates this.state.worktreeFingerprint = worktreeFingerprint + this.state.schemaVersion = this.schemaVersion + this.inlineCache.active = false this.state.scanState.lastScanCompletedAt = Date.now() this.state.scanState.lastScanError = null // Persistence failures do not turn a successful source scan into a scan failure. diff --git a/src/main/usage/usage-scan-worker-client.test.ts b/src/main/usage/usage-scan-worker-client.test.ts index c010d1afaa0..f82053e4431 100644 --- a/src/main/usage/usage-scan-worker-client.test.ts +++ b/src/main/usage/usage-scan-worker-client.test.ts @@ -122,6 +122,34 @@ describe('UsageScanWorkerClient', () => { await expect(pending).resolves.toEqual({ reportText: '{}', migrated: true }) }) + it('keeps worker verification attached to the exact returned report text', async () => { + const worker = new FakeWorker() + const client = createClient(() => worker) + const pending = client.splitCacheFile({ + cacheFile: '/tmp/usage.json', + sourceKey: 'processedFiles', + providerId: 'claude' + }) + await vi.waitFor(() => expect(worker.postedRequests).toHaveLength(1)) + const reportText = '{"usageIntegrity":"verified-by-worker","schemaVersion":7}' + worker.emit('message', { + id: worker.lastId(), + ok: true, + value: { + operation: 'splitCacheFile', + reportText, + migrated: false, + reportIntegrityVerified: true + } + }) + + await expect(pending).resolves.toEqual({ + reportText, + migrated: false, + reportIntegrityVerified: true + }) + }) + it('fails closed instead of scanning on the calling thread when spawn fails', async () => { const client = createClient(() => { throw new Error('no thread available') diff --git a/src/main/usage/usage-scan-worker-client.ts b/src/main/usage/usage-scan-worker-client.ts index 24a7ab5feb9..bb5cd5970e3 100644 --- a/src/main/usage/usage-scan-worker-client.ts +++ b/src/main/usage/usage-scan-worker-client.ts @@ -93,7 +93,13 @@ export class UsageScanWorkerClient { if (value.operation !== 'splitCacheFile') { throw new Error(`Usage scan worker answered ${value.operation}, expected splitCacheFile`) } - return { reportText: value.reportText, migrated: value.migrated } + return { + reportText: value.reportText, + migrated: value.migrated, + ...(value.reportIntegrityVerified === undefined + ? {} + : { reportIntegrityVerified: value.reportIntegrityVerified }) + } } private async dispatch(body: UsageScanWorkerRequestBody): Promise { diff --git a/src/main/usage/usage-scan-worker-entry.ts b/src/main/usage/usage-scan-worker-entry.ts index eefa7a2a468..84eab49e51a 100644 --- a/src/main/usage/usage-scan-worker-entry.ts +++ b/src/main/usage/usage-scan-worker-entry.ts @@ -5,7 +5,11 @@ import { scanOpenCodeUsageDatabases } from '../opencode-usage/scanner' import { scanMuseUsageFiles } from '../muse-usage/scanner' import { normalizeMuseUsagePersistedFiles } from '../muse-usage/persisted-file-normalization' import { normalizeOpenCodeUsagePersistedDatabases } from '../opencode-usage/persisted-database-normalization' -import type { ClaudeUsagePersistedFile } from '../claude-usage/types' +import { + readClaudeUsageSourceCache, + splitClaudeUsageCacheFile, + persistClaudeUsageSourceCache +} from '../claude-usage/persisted-source-cache' import type { CodexUsagePersistedFile } from '../codex-usage/types' import type { OpenCodeUsagePersistedDatabase } from '../opencode-usage/types' import type { MuseUsagePersistedFile } from '../muse-usage/types' @@ -73,7 +77,12 @@ async function runRequest( onFilesScanned: (count: number) => void ): Promise { if (request.operation === 'splitCacheFile') { - return { operation: 'splitCacheFile', ...(await splitUsageCacheFile(request)) } + return { + operation: 'splitCacheFile', + ...(await (request.providerId === 'claude' + ? splitClaudeUsageCacheFile(request) + : splitUsageCacheFile(request))) + } } return runScan(request, onFilesScanned) } @@ -86,13 +95,19 @@ async function runScan( // provider's own record type, so nothing here needs a type assertion. switch (request.providerId) { case 'claude': { + const previous = await readClaudeUsageSourceCache(request.sourceCache) const result = await scanClaudeUsageFiles( request.worktrees, - await readUsageSourceCache(request.sourceCache), + previous.sources, onFilesScanned, - request.profileDirs + request.profileDirs, + previous.verifiedSources ) - await persistSourceCache(request.sourceCache, result.processedFiles) + try { + await persistClaudeUsageSourceCache(request.sourceCache, result.processedFiles, previous) + } catch (error) { + console.warn('[usage-scan] Could not persist the per-source usage cache:', error) + } return { operation: 'scan', providerId: 'claude', diff --git a/src/main/usage/usage-source-cache-file.ts b/src/main/usage/usage-source-cache-file.ts index 0e0cffb2f78..18b78ca39f6 100644 --- a/src/main/usage/usage-source-cache-file.ts +++ b/src/main/usage/usage-source-cache-file.ts @@ -18,8 +18,12 @@ export type UsageSourceCacheRef = { reuse: boolean } -export type UsageCacheSplitRequest = { cacheFile: string; sourceKey: string } -export type UsageCacheSplitResult = { reportText: string | null; migrated: boolean } +export type UsageCacheSplitRequest = { cacheFile: string; sourceKey: string; providerId?: 'claude' } +export type UsageCacheSplitResult = { + reportText: string | null + migrated: boolean + reportIntegrityVerified?: boolean +} export function usageSourceCachePath(cacheFile: string): string { const { dir, name } = parse(cacheFile) @@ -47,6 +51,27 @@ export async function readUsageSourceCache(ref: UsageSourceCacheRef): Promise export async function writeUsageSourceCache( ref: UsageSourceCacheRef, sources: readonly unknown[] +): Promise { + await writeUsageSourceCacheText( + ref, + JSON.stringify({ + schemaVersion: ref.schemaVersion, + worktreeFingerprint: ref.worktreeFingerprint, + sources + }) + ) +} + +export async function writeUsageSourceCacheText( + ref: UsageSourceCacheRef, + text: string +): Promise { + await writeUsageSourceCacheData(ref, text) +} + +export async function writeUsageSourceCacheData( + ref: UsageSourceCacheRef, + data: string | Uint8Array ): Promise { await mkdir(dirname(ref.path), { recursive: true }).catch(() => {}) // Why: a worker terminated mid-write orphans a multi-MB temp file; reclaim earlier launches' ones. @@ -54,11 +79,7 @@ export async function writeUsageSourceCache( await writeFileDurable( durableWriteTempPath(ref.path, threadId > 0 ? String(threadId) : undefined), ref.path, - JSON.stringify({ - schemaVersion: ref.schemaVersion, - worktreeFingerprint: ref.worktreeFingerprint, - sources - }) + data ) }