@sparkelf/dsh-patch-mobile-journal-generation 0.2.0-rc.2 → 0.2.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,11 +4,11 @@
4
4
  "formatVersion": 1,
5
5
  "variants": [
6
6
  {
7
- "dsh": ">=0.1.6-alpha.1",
7
+ "dsh": ">=0.1.7-alpha.2",
8
8
  "file": "./patches/mobile-journal-generation.patch",
9
9
  "id": "mobile-journal-opening-generation",
10
10
  "target": {
11
- "baseRevision": "0a15e36e7f82b6ed45af6fa9759f29b40dcd965d",
11
+ "baseRevision": "00102833dfaee1da9f48a3a8eae9d34005a75218",
12
12
  "kind": "dsh-source",
13
13
  "paths": [
14
14
  "packages/api/gateway/src/client/",
@@ -32,5 +32,5 @@
32
32
  "url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
33
33
  },
34
34
  "type": "module",
35
- "version": "0.2.0-rc.2"
35
+ "version": "0.2.0-rc.21"
36
36
  }
@@ -1,20 +1,20 @@
1
1
  diff --git a/packages/api/gateway/src/client/journal-stream.ts b/packages/api/gateway/src/client/journal-stream.ts
2
- index ab013abdf3..25e415747e 100644
2
+ index ab013abdf3..35dcb86255 100644
3
3
  --- a/packages/api/gateway/src/client/journal-stream.ts
4
4
  +++ b/packages/api/gateway/src/client/journal-stream.ts
5
5
  @@ -241,6 +241,10 @@ export abstract class RemoteJournalStream<
6
6
  if (next.done) return
7
7
  const item = next.value
8
8
  if (item.generation !== this.generation) {
9
- + // A replaced mobile carrier can surface buffered live entries before
10
- + // its opening snapshot. The snapshot subsumes them, so retain the
9
+ + // A replaced carrier can surface buffered live entries before its
10
+ + // opening snapshot. The snapshot subsumes them, so retain the
11
11
  + // published window and wait for that generation's opening cursor.
12
12
  + if (item.value.type !== 'opened') continue
13
13
  this.replaceGeneration(item, true)
14
14
  continue
15
15
  }
16
16
  diff --git a/packages/api/gateway/tests/journal-stream.client.spec.ts b/packages/api/gateway/tests/journal-stream.client.spec.ts
17
- index 498f5a033b..226340fee9 100644
17
+ index 498f5a033b..e6f1b41f69 100644
18
18
  --- a/packages/api/gateway/tests/journal-stream.client.spec.ts
19
19
  +++ b/packages/api/gateway/tests/journal-stream.client.spec.ts
20
20
  @@ -788,7 +788,7 @@ describe('RemoteJournalStream', () => {
@@ -26,7 +26,7 @@ index 498f5a033b..226340fee9 100644
26
26
  const finish = Promise.withResolvers<undefined>()
27
27
  const fixture = journalFixture(
28
28
  [
29
- @@ -797,17 +797,26 @@ describe('RemoteJournalStream', () => {
29
+ @@ -797,13 +797,46 @@ describe('RemoteJournalStream', () => {
30
30
  waitAfterFrames: finish.promise,
31
31
  terminal: new RemoteStreamCarrierError('lost'),
32
32
  },
@@ -44,16 +44,33 @@ index 498f5a033b..226340fee9 100644
44
44
 
45
45
  await fixture.journal.open({})
46
46
  finish.resolve(undefined)
47
- - await vi.waitFor(() => { expect(fixture.failed).toHaveBeenCalledOnce() })
48
- - expect(fixture.failed.mock.calls[0]?.[0]).toMatchObject({
49
- - message: 'resumed fixture journal emitted an entry before its opening cursor',
50
47
  + await vi.waitFor(() => { expect(fixture.changes).toHaveLength(2) })
51
48
  + expect(fixture.changes.at(-1)).toMatchObject({
52
49
  + type: 'replace',
53
50
  + page: { marker: 'replacement' },
54
51
  + entries: [{ seq: 0 }, { seq: 1 }],
55
- })
52
+ + })
56
53
  + expect(fixture.failed).not.toHaveBeenCalled()
57
- await fixture.journal.dispose()
58
- })
59
-
54
+ + await fixture.journal.dispose()
55
+ + })
56
+ +
57
+ + it('rejects a superseded repair whose replacement emits an entry first', async () => {
58
+ + const gap = Promise.withResolvers<ScriptedFrame>()
59
+ + const fixture = journalFixture(
60
+ + [
61
+ + {
62
+ + frames: [opened(1, page('initial', [0, 1])), gap.promise],
63
+ + terminal: new RemoteStreamCarrierError('generation lost'),
64
+ + },
65
+ + { frames: [{ type: 'entry', entry: { seq: 4 } }], hold: true },
66
+ + ],
67
+ + [
68
+ + () => new Promise<Page>(() => {}),
69
+ + ],
70
+ + )
71
+ +
72
+ + await fixture.journal.open({ limit: 5 })
73
+ + gap.resolve({ type: 'entry', entry: { seq: 4 } })
74
+ await vi.waitFor(() => { expect(fixture.failed).toHaveBeenCalledOnce() })
75
+ expect(fixture.failed.mock.calls[0]?.[0]).toMatchObject({
76
+ message: 'resumed fixture journal emitted an entry before its opening cursor',