amalgm 0.1.205 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.205",
3
+ "version": "0.1.206",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -364,6 +364,18 @@ test('side branches keep one rail operation while the checked-out card advances'
364
364
  card = readWall(repoKey)[0].cards[0];
365
365
  assert.equal(card.positionMutationId, advanced.mutationId);
366
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);
367
379
  });
368
380
 
369
381
  test('peer records and earlier local history survive later publishes', async () => {
@@ -225,7 +225,7 @@ function oidMap(refs) {
225
225
  * materialized. A local value equal to either that baseline or the current
226
226
  * rail is not new work. Anything else is a local contribution.
227
227
  */
228
- function hasLocalContribution(card, plan, baseline, checkpoint = null) {
228
+ function hasLocalContribution(card, plan, baseline, checkpoint = null, previousCard = null) {
229
229
  if (!plan?.card) return true;
230
230
  const onRail = samePosition(card, plan.card);
231
231
  const atBaseline = baseline
@@ -236,11 +236,21 @@ function hasLocalContribution(card, plan, baseline, checkpoint = null) {
236
236
  const currentRefs = oidMap(card.refs);
237
237
  const railRefs = oidMap(plan.branches);
238
238
  const baselineRefs = oidMap(baseline?.branches);
239
- for (const name of new Set([...currentRefs.keys(), ...baselineRefs.keys()])) {
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
+ ])) {
240
245
  const current = currentRefs.get(name) ?? null;
241
246
  const shared = railRefs.get(name) ?? null;
242
247
  const previous = baselineRefs.get(name) ?? null;
243
- if (current !== shared && (!baselineRefs.has(name) || current !== previous)) return true;
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;
244
254
  }
245
255
 
246
256
  if (
@@ -499,7 +509,8 @@ function publishProject(project, rawCards) {
499
509
  const removed = [...previousReplicas].some((replica) => !currentReplicas.has(replica));
500
510
  const contributes = rawCards.some((card) => {
501
511
  const checkpoint = readCheckpoint(machineId(), project.repoKey);
502
- return hasLocalContribution(card, sharedPlan, baseline, checkpoint)
512
+ const previousCard = previousEntry?.cards?.find((entry) => entry.replica === card.replica);
513
+ return hasLocalContribution(card, sharedPlan, baseline, checkpoint, previousCard)
503
514
  || hasObjectUpgrade(card, sharedPlan);
504
515
  });
505
516
  if (!removed && !contributes) {