amalgm 0.1.191 → 0.1.192
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
|
@@ -25,12 +25,28 @@ const { CHECKPOINT_CONTRACT, revisionOf } = require('../workspace/checkpoint');
|
|
|
25
25
|
const {
|
|
26
26
|
captureIsOnRail,
|
|
27
27
|
hydrateRepo,
|
|
28
|
+
localCardMayMaterialize,
|
|
28
29
|
materializeRepo,
|
|
29
30
|
readRepoState,
|
|
30
31
|
reduceCheckpoint,
|
|
31
32
|
reduceWall,
|
|
32
33
|
} = require('../workspace/reducer');
|
|
33
34
|
|
|
35
|
+
test('a materialized baseline can follow the rail without publishing an echo', () => {
|
|
36
|
+
assert.equal(localCardMayMaterialize(null, {
|
|
37
|
+
published: false,
|
|
38
|
+
reason: 'shared-state-covered',
|
|
39
|
+
}), true);
|
|
40
|
+
assert.equal(localCardMayMaterialize({ positionVersion: 7 }, null), true);
|
|
41
|
+
assert.equal(localCardMayMaterialize(null, {
|
|
42
|
+
published: true,
|
|
43
|
+
}), false);
|
|
44
|
+
assert.equal(localCardMayMaterialize(null, {
|
|
45
|
+
published: false,
|
|
46
|
+
reason: 'unchanged',
|
|
47
|
+
}), false);
|
|
48
|
+
});
|
|
49
|
+
|
|
34
50
|
test.after(() => {
|
|
35
51
|
closeLocalDb();
|
|
36
52
|
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
@@ -550,6 +550,10 @@ async function materializeRepo(localCardInput, plan) {
|
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
+
function localCardMayMaterialize(publishedCard, publication) {
|
|
554
|
+
return Boolean(publishedCard) || publication?.reason === 'shared-state-covered';
|
|
555
|
+
}
|
|
556
|
+
|
|
553
557
|
async function runReducer() {
|
|
554
558
|
service.counters.passes += 1;
|
|
555
559
|
const startedAt = Date.now();
|
|
@@ -583,8 +587,9 @@ async function runReducer() {
|
|
|
583
587
|
continue;
|
|
584
588
|
}
|
|
585
589
|
const refreshed = await refreshRepoCard(local.replica) || local;
|
|
586
|
-
|
|
587
|
-
|
|
590
|
+
const publishedCard = wall.publishedCardFor(refreshed);
|
|
591
|
+
const publication = publishedCard ? null : wall.publishWall(repoKey);
|
|
592
|
+
if (!localCardMayMaterialize(publishedCard, publication)) {
|
|
588
593
|
const outcome = { state: 'waiting', reason: 'local-card-publishing', moved: false };
|
|
589
594
|
service.repos.set(repoKey, {
|
|
590
595
|
repoKey,
|
|
@@ -697,6 +702,7 @@ function reducerStats() {
|
|
|
697
702
|
module.exports = {
|
|
698
703
|
captureIsOnRail,
|
|
699
704
|
hydrateRepo,
|
|
705
|
+
localCardMayMaterialize,
|
|
700
706
|
materializeRepo,
|
|
701
707
|
readRepoState,
|
|
702
708
|
reduceCheckpoint,
|