Skip to content
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
038e7a9
test(agent/crdt): property coverage for the human write leg
christian-byrne Aug 29, 2026
c7538e8
test(agent/crdt): align stamp tripwire with schema v2
christian-byrne Aug 31, 2026
30f5c79
fix(agent): preserve actor clock across reconnects
Sep 1, 2026
97cc2cc
test(agent): cover framed batching boundaries
Sep 1, 2026
867f9f7
test(agent): use literal mint gate truth table
Sep 1, 2026
be0de81
fix(agent): keep frame reserve internal
Sep 1, 2026
a1d7247
test(agent/crdt): key the mint-gate truth table by state
christian-byrne Sep 2, 2026
cebd935
test(agent/crdt): remove vacuous >=0 assertions in chunkWireOps prope…
christian-byrne Sep 2, 2026
1ed0f0a
fix(agent/crdt): make wire batch byte accounting incremental
christian-byrne Sep 2, 2026
2a0027b
docs(agent/crdt): correct DQ-11 docstring — sender clamp is the curre…
christian-byrne Sep 2, 2026
460ada5
fix(agent/crdt): reset the sender's base_version clock on doc_reset
christian-byrne Sep 2, 2026
b0b776b
Merge main into test/agent CRDT property coverage
christian-byrne Sep 3, 2026
b0e9747
Fix property tests for current lint contracts
christian-byrne Sep 3, 2026
7f4e1c1
chore: merge main into agent CRDT property coverage branch
christian-byrne Sep 11, 2026
c1a0255
test(agent/crdt): cover cross-workflow retention across a lineage reset
christian-byrne Sep 11, 2026
a4ba4b2
fix(agent): scope stale result credits by workflow
ampagent Sep 11, 2026
934609d
Merge remote-tracking branch 'comfyorg/main' into tl2-prop-02b-wt
christian-byrne Sep 23, 2026
9c3a6e9
fix(agent/crdt): ignore replayed doc_reset frames
christian-byrne Sep 23, 2026
bc94ad8
[automated] Apply ESLint and Oxfmt fixes
actions-user Sep 23, 2026
a5d2d53
merge: update agent CRDT property coverage from main
ampagent Sep 25, 2026
274f002
Merge remote-tracking branch 'origin/main' into op385-pr16239
christian-byrne Oct 3, 2026
b27a17c
test(agent/crdt): simplify operation envelope properties
ampagent Oct 12, 2026
782032f
merge: update operation envelope properties from main
ampagent Oct 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions src/workbench/extensions/agent/crdt/opEnvelope.property.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { BATCHABLE_OPS } from '@comfyorg/comfy-multi-player'
import type { Op } from '@comfyorg/comfy-multi-player'
import * as fc from 'fast-check'
import { assert, describe, expect, it } from 'vitest'

import type { GraphOperation } from './graphOperations'
import type { SizedOp } from './opEnvelope'
import { chunkWireOps, measureWireOp, mintWireOps } from './opEnvelope'

const MINT = { actor: 'human:pbt-user:tab-1', baseVersion: 7 }

function addNode(id: number): GraphOperation {
return {
op: 'add_node',
node_id: id,
class_type: 'TestNode',
pos: [id, id],
node: {
id,
type: 'TestNode',
pos: [id, id],
inputs: [],
outputs: [],
widgets_values: []
}
}
}

function setWidget(id: number, value: unknown): GraphOperation {
return { op: 'set_widget', node_id: id, widget: 'text', value }
}

function deleteNode(id: number): GraphOperation {
return { op: 'delete_node', node_id: id, removed_links: [] }
}

function clear(ids: number[]): GraphOperation {
return { op: 'clear', removed_nodes: ids }
}

function sizedOf(op: Op): SizedOp {
const measured = measureWireOp(op)
assert(measured.admitted)
return measured.sized
}

function isBatchable(sized: SizedOp): boolean {
return BATCHABLE_OPS.some((kind) => kind === sized.op.op)
}

function batchesBelowCaps(ops: SizedOp[]): SizedOp[][] {
const batches: SizedOp[][] = []
for (const op of ops) {
const last = batches.at(-1)
if (last && isBatchable(op) && isBatchable(last[0])) last.push(op)
else batches.push([op])
}
return batches
}

const operationsArb = fc.array(
fc.oneof(
{ arbitrary: fc.integer({ min: 0, max: 40 }).map(addNode), weight: 4 },
{
arbitrary: fc
.tuple(fc.integer({ min: 0, max: 40 }), fc.string({ maxLength: 32 }))
.map(([id, value]) => setWidget(id, value)),
weight: 4
},
{ arbitrary: fc.integer({ min: 0, max: 40 }).map(deleteNode), weight: 2 },
{
arbitrary: fc
.array(fc.integer({ min: 0, max: 40 }), { maxLength: 4 })
.map(clear),
weight: 1
}
),
{ maxLength: 40 }
)

describe('chunkWireOps (property)', () => {
it('below the caps, batches each batchable run and isolates the rest', () => {
fc.assert(
fc.property(operationsArb, (operations) => {
const ops = mintWireOps(operations, MINT).map(sizedOf)

expect(chunkWireOps(ops)).toEqual(batchesBelowCaps(ops))
})
)
})
})

describe('mintWireOps (property)', () => {
it('adds only a unique envelope to each operation', () => {
fc.assert(
fc.property(
operationsArb,
fc.string({ minLength: 1, maxLength: 24 }),
fc.nat(),
(operations, actor, baseVersion) => {
const minted = mintWireOps(operations, { actor, baseVersion })

expect(minted).toEqual(
operations.map((operation) => ({
...operation,
op_id: expect.stringMatching(/^[0-9a-f]{32}$/),
actor,
base_version: baseVersion,
stamp: [baseVersion, actor]
}))
)
expect(new Set(minted.map((op) => op.op_id)).size).toBe(minted.length)
}
)
)
})
})
Loading