amalgm 0.1.219 → 0.1.220

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.219",
3
+ "version": "0.1.220",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -176,6 +176,46 @@ test('a checkpoint base replaces covered history and keeps only newer mutations'
176
176
  assert.equal(reduced.checkpointRevision, revisionOf(oid, patchAB, ''));
177
177
  });
178
178
 
179
+ test('an unfinished checkpoint base cannot replace the last complete base', () => {
180
+ const oid = 'a'.repeat(40);
181
+ const complete = card('/complete', oid, 1);
182
+ complete.checkpointBase = {
183
+ checkpoint: CHECKPOINT_CONTRACT,
184
+ baseOid: oid,
185
+ branch: 'main',
186
+ through: 4,
187
+ value: value(oid, 'complete-patch'),
188
+ };
189
+ complete.checkpoints = [
190
+ transition('machine-a', 5, oid, 'complete-patch', 'later-patch'),
191
+ ];
192
+
193
+ const unfinished = card('/unfinished', oid, 1);
194
+ unfinished.checkpointBase = {
195
+ checkpoint: CHECKPOINT_CONTRACT,
196
+ baseOid: oid,
197
+ branch: 'main',
198
+ through: 6,
199
+ value: {
200
+ revision: 'b'.repeat(64),
201
+ payload: {
202
+ kind: 'pending',
203
+ contract: 'opaque-chunks@1',
204
+ checksum: 'c'.repeat(64),
205
+ },
206
+ },
207
+ };
208
+
209
+ const plan = reduceWall([
210
+ { machine: 'machine-a', cards: [complete] },
211
+ { machine: 'machine-b', cards: [unfinished] },
212
+ ]).get('root:test');
213
+
214
+ assert.equal(plan.checkpointBase.through, 4);
215
+ assert.equal(plan.checkpointBaseConflict, false);
216
+ assert.deepEqual(plan.transitions.map((entry) => entry.version), [5]);
217
+ });
218
+
179
219
  test('different snapshots claiming the same rail position stop instead of choosing a winner', () => {
180
220
  const oid = 'a'.repeat(40);
181
221
  const first = card('/first', oid, 1);
@@ -453,6 +453,20 @@ test('a checkpoint base replaces history already covered by the applied rail', a
453
453
  assert.deepEqual(settleProject(), [3]);
454
454
  });
455
455
 
456
+ test('an uploading checkpoint base is not announced as complete', () => {
457
+ const card = readWall(repoKey)[0].cards[0];
458
+ const [stamped] = stampCards([card], [], { card, branches: [], transitions: [] }, {
459
+ repoKey,
460
+ baseOid: card.head.oid,
461
+ branch: card.head.branch,
462
+ appliedThrough: 3,
463
+ indexDiff: 'x'.repeat(600 * 1024),
464
+ worktreeDiff: '',
465
+ }, 'mut_project_pending_base', project);
466
+
467
+ assert.equal(stamped.checkpointBase, undefined);
468
+ });
469
+
456
470
  test('one failed project publisher cannot block the next repo', () => {
457
471
  const selected = [{ repoKey: 'root:first' }, { repoKey: 'root:second' }];
458
472
  const calls = [];
@@ -153,6 +153,7 @@ function reduceWall(entries) {
153
153
  .filter((entry) => (
154
154
  entry.baseOid === repo.card.head?.oid
155
155
  && entry.branch === repo.card.head?.branch
156
+ && checkpointValueReady(entry.value)
156
157
  ))
157
158
  .sort((left, right) => right.through - left.through);
158
159
  const newestThrough = matchingBases[0]?.through ?? null;
@@ -20,6 +20,7 @@ const { listRepoCards } = require('./cards');
20
20
  const {
21
21
  CHECKPOINT_CONTRACT,
22
22
  checkpointValue,
23
+ checkpointValueReady,
23
24
  readCheckpoint,
24
25
  repoKeyOfCard,
25
26
  sameTransition,
@@ -331,6 +332,7 @@ function checkpointBaseFor(card, baseline, project, shared = null) {
331
332
  baseline.indexDiff || '',
332
333
  baseline.worktreeDiff || '',
333
334
  );
335
+ if (!checkpointValueReady(value)) return null;
334
336
  const reusableThrough = shared
335
337
  && shared.baseOid === card.head.oid
336
338
  && shared.branch === card.head.branch