Files
hapi/shared/fixtures/sse/mixed-flat-and-versioned-patch.json
T
weishu e1bfdd6265 feat(fixtures): SSE patch + pagination scenario fixtures (K7)
Two new golden-fixture suites, expectations machine-generated from the web
implementation (same source-of-truth principle as the chat suite):

- shared/fixtures/sse/ (12 cases): session-updated versioned-patch
  application via applySessionDetailPatch — strict version gates for
  metadata/agentState/todos/teamState, out-of-order arrival, teamState:null
  clear, max-monotonic updatedAt, flat last-write-wins fields, sub-minute
  activeAt keep-alive drop, scratchlistUpdatedAt trigger, and the pinned
  actual behavior that activeTurnStartedAt is NOT applied by the patch path.
  Inputs are stored schema-normalized and validated against SessionSchema /
  strict SessionPatchSchema at generation time; per-patch applied/unchanged
  verdicts are part of the contract.

- shared/fixtures/pagination/ (11 cases): op scripts driving the real
  message-window store with a scripted ApiClient — latest page + SSE ingest,
  before-cursor older pages, epoch-mismatch reset (window discard + recorded
  internal latest request), reset:true replace preserving optimistic rows,
  localId echo reconciliation, messages-consumed invokedAt stamping (no
  cursor advance), message-cancelled removal, cancel-too-late invoked-row
  ingest, hidden-row cursor advance, 400-row trim preserving queued rows,
  and queued-state gap recovery. Documents pin the exact requests the store
  issued, older-load outcomes, reconcile candidates, and a minimal window
  projection (ids/order, queued/optimistic flags, hasMore, epoch, viewMode,
  compound cursors).

Generator: web/scripts/fixtures/{sse,pagination}/ extend the K5 framework
(canonical serialization reused; suites pruned of stale files). Web
self-conformance tests replay every fixture against the real implementation
in bun run test:web. README documents schemas, projections, replay
contracts, and native consumption for both suites.

No time injection needed: the store's only Date.now() reads gate
notification throttling, which never reaches persisted or projected state.
2026-08-17 12:06:57 +08:00

94 lines
2.8 KiB
JSON

{
"description": "One patch carrying flat fields, a newer metadata wrapper, and a stale agentState wrapper: the flat fields and metadata apply, the stale agentState is rejected, and all of it happens in a single applied call.",
"expectedPatchResults": [
"applied"
],
"expectedSession": {
"active": true,
"activeAt": 1755000000000,
"activeTurnStartedAt": null,
"agentState": {
"controlledByUser": false
},
"agentStateVersion": 5,
"createdAt": 1754996400000,
"effort": null,
"id": "sess-sse-fixture",
"metadata": {
"flavor": "claude",
"host": "devbox",
"name": "project-renamed",
"path": "/home/dev/project"
},
"metadataVersion": 5,
"model": "claude-sonnet-4-6",
"modelReasoningEffort": null,
"namespace": "default",
"permissionMode": "default",
"seq": 12,
"serviceTier": null,
"thinking": true,
"thinkingAt": 0,
"updatedAt": 1755000030000
},
"fixtureVersion": 1,
"initialSession": {
"active": true,
"activeAt": 1755000000000,
"activeTurnStartedAt": null,
"agentState": {
"controlledByUser": false
},
"agentStateVersion": 5,
"createdAt": 1754996400000,
"effort": null,
"id": "sess-sse-fixture",
"metadata": {
"flavor": "claude",
"host": "devbox",
"name": "project",
"path": "/home/dev/project"
},
"metadataVersion": 3,
"model": "claude-sonnet-4-6",
"modelReasoningEffort": null,
"namespace": "default",
"permissionMode": "default",
"seq": 12,
"serviceTier": null,
"thinking": false,
"thinkingAt": 0,
"updatedAt": 1755000000000
},
"name": "mixed-flat-and-versioned-patch",
"patches": [
{
"agentState": {
"value": {
"requests": {
"req-stale": {
"arguments": {
"command": "echo stale"
},
"createdAt": 1754999940000,
"tool": "Bash"
}
}
},
"version": 2
},
"metadata": {
"value": {
"flavor": "claude",
"host": "devbox",
"name": "project-renamed",
"path": "/home/dev/project"
},
"version": 5
},
"thinking": true,
"updatedAt": 1755000030000
}
]
}