amalgm 0.1.204 → 0.1.206
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
|
@@ -257,6 +257,15 @@ test('a repo project appends immutable machine records', async () => {
|
|
|
257
257
|
null,
|
|
258
258
|
);
|
|
259
259
|
assert.equal(publishedCardFor(refreshed.cards[0]).positionVersion, 1);
|
|
260
|
+
const readyObjects = {
|
|
261
|
+
...refreshed.cards[0],
|
|
262
|
+
objects: { kind: 'bundle' },
|
|
263
|
+
refs: refreshed.cards[0].refs.map((ref) => ({
|
|
264
|
+
...ref,
|
|
265
|
+
objects: { kind: 'bundle' },
|
|
266
|
+
})),
|
|
267
|
+
};
|
|
268
|
+
assert.equal(publishedCardFor(readyObjects), null);
|
|
260
269
|
|
|
261
270
|
const again = publishWall(repoKey);
|
|
262
271
|
assert.equal(again.published, false);
|
|
@@ -355,6 +364,18 @@ test('side branches keep one rail operation while the checked-out card advances'
|
|
|
355
364
|
card = readWall(repoKey)[0].cards[0];
|
|
356
365
|
assert.equal(card.positionMutationId, advanced.mutationId);
|
|
357
366
|
assert.equal(card.branches.find((entry) => entry.name === branch).mutationId, created.mutationId);
|
|
367
|
+
|
|
368
|
+
acknowledgeCloudMutation(project.resourceId, advanced.mutationId, {
|
|
369
|
+
version: 4,
|
|
370
|
+
committedAt: '2026-07-23T00:00:05.000Z',
|
|
371
|
+
});
|
|
372
|
+
await run(repo, 'branch', '-D', branch);
|
|
373
|
+
await refreshRepoCards();
|
|
374
|
+
const deleted = publishWall(repoKey);
|
|
375
|
+
assert.equal(deleted.published, true);
|
|
376
|
+
card = readWall(repoKey)[0].cards[0];
|
|
377
|
+
assert.equal(card.branches.find((entry) => entry.name === branch).oid, null);
|
|
378
|
+
assert.equal(card.branches.find((entry) => entry.name === branch).mutationId, deleted.mutationId);
|
|
358
379
|
});
|
|
359
380
|
|
|
360
381
|
test('peer records and earlier local history survive later publishes', async () => {
|
|
@@ -194,6 +194,7 @@ function publishedCardFor(card) {
|
|
|
194
194
|
|| published.head?.branch !== card.head?.branch
|
|
195
195
|
|| published.head?.oid !== card.head?.oid
|
|
196
196
|
|| Boolean(published.head?.detached) !== Boolean(card.head?.detached)
|
|
197
|
+
|| hasObjectUpgrade(card, { card: published, branches: published.branches })
|
|
197
198
|
) return null;
|
|
198
199
|
return published;
|
|
199
200
|
}
|
|
@@ -224,7 +225,7 @@ function oidMap(refs) {
|
|
|
224
225
|
* materialized. A local value equal to either that baseline or the current
|
|
225
226
|
* rail is not new work. Anything else is a local contribution.
|
|
226
227
|
*/
|
|
227
|
-
function hasLocalContribution(card, plan, baseline, checkpoint = null) {
|
|
228
|
+
function hasLocalContribution(card, plan, baseline, checkpoint = null, previousCard = null) {
|
|
228
229
|
if (!plan?.card) return true;
|
|
229
230
|
const onRail = samePosition(card, plan.card);
|
|
230
231
|
const atBaseline = baseline
|
|
@@ -235,11 +236,21 @@ function hasLocalContribution(card, plan, baseline, checkpoint = null) {
|
|
|
235
236
|
const currentRefs = oidMap(card.refs);
|
|
236
237
|
const railRefs = oidMap(plan.branches);
|
|
237
238
|
const baselineRefs = oidMap(baseline?.branches);
|
|
238
|
-
|
|
239
|
+
const previousRefs = oidMap(previousCard?.branches || previousCard?.refs);
|
|
240
|
+
for (const name of new Set([
|
|
241
|
+
...currentRefs.keys(),
|
|
242
|
+
...baselineRefs.keys(),
|
|
243
|
+
...previousRefs.keys(),
|
|
244
|
+
])) {
|
|
239
245
|
const current = currentRefs.get(name) ?? null;
|
|
240
246
|
const shared = railRefs.get(name) ?? null;
|
|
241
247
|
const previous = baselineRefs.get(name) ?? null;
|
|
242
|
-
|
|
248
|
+
const changedFromPublished = previousRefs.has(name)
|
|
249
|
+
&& current !== (previousRefs.get(name) ?? null);
|
|
250
|
+
if (
|
|
251
|
+
current !== shared
|
|
252
|
+
&& (!baselineRefs.has(name) || current !== previous || changedFromPublished)
|
|
253
|
+
) return true;
|
|
243
254
|
}
|
|
244
255
|
|
|
245
256
|
if (
|
|
@@ -498,7 +509,8 @@ function publishProject(project, rawCards) {
|
|
|
498
509
|
const removed = [...previousReplicas].some((replica) => !currentReplicas.has(replica));
|
|
499
510
|
const contributes = rawCards.some((card) => {
|
|
500
511
|
const checkpoint = readCheckpoint(machineId(), project.repoKey);
|
|
501
|
-
|
|
512
|
+
const previousCard = previousEntry?.cards?.find((entry) => entry.replica === card.replica);
|
|
513
|
+
return hasLocalContribution(card, sharedPlan, baseline, checkpoint, previousCard)
|
|
502
514
|
|| hasObjectUpgrade(card, sharedPlan);
|
|
503
515
|
});
|
|
504
516
|
if (!removed && !contributes) {
|