@arjunkhera/atlas 0.4.4 → 0.4.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Atlas: the delivery lifecycle, its crews and the Atlas tools, for any repository.",
5
5
  "author": {
6
6
  "name": "Arjun Khera"
package/door/lib/gate.mjs CHANGED
@@ -206,9 +206,17 @@ export function readyCommand({ repo, pr, answer }, line, gh = ghApi) {
206
206
  const rows = checkStates(checks, checkRuns(gh, repo, sha));
207
207
  line(`atlas gate ready: #${pr} at ${sha.slice(0, 7)}, ${checks.length} required check(s) from atlas.yaml on ${pull.base.ref}.`);
208
208
  for (const row of rows) line(checkLine(row));
209
- const ready = rows.every((row) => row.state === 'green');
210
- line(ready ? 'READY: every required check is green. Merge with a merge commit, at this head.' : 'NOT READY: do not merge. Wait for a pending check; fix a red or missing one.');
211
- return ready ? 0 : 1;
209
+ // Checks that ran on an old base prove nothing about the merge: two pull
210
+ // requests, each green alone, can turn the main branch red together (atlas#188).
211
+ const behind = Number(gh('GET', `repos/${repo}/compare/${encodeURIComponent(pull.base.ref)}...${sha}`)?.behind_by ?? NaN);
212
+ if (!(behind >= 0)) throw new GateError(`GitHub gave no compare of ${pull.base.ref} and ${sha.slice(0, 7)}.`);
213
+ line(` ${behind === 0 ? '✓' : '✗'} ${(behind === 0 ? 'current' : 'behind').padEnd(8)} ${behind === 0 ? `the head holds every commit of ${pull.base.ref}` : `${pull.base.ref} has ${behind} commit(s) that the head does not hold`}`);
214
+ const green = rows.every((row) => row.state === 'green');
215
+ if (green && behind === 0) { line('READY: every required check is green, on top of the current main branch. Merge with a merge commit, at this head.'); return 0; }
216
+ line(behind > 0
217
+ ? `NOT READY: do not merge. Merge ${pull.base.ref} in, wait for green, then run ready again.`
218
+ : 'NOT READY: do not merge. Wait for a pending check; fix a red or missing one.');
219
+ return 1;
212
220
  }
213
221
 
214
222
  // The merge door hook (packages/atlas/hooks/door.mjs) reads this file before
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arjunkhera/atlas",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Atlas: the delivery lifecycle, its crews and the Atlas tools, as a Claude Code plugin for any repository.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -148,7 +148,9 @@ A lock is the owner's approval of a short design.
148
148
  nothing, so this step is the gate (owner, 24 October 2026).
149
149
  1. Right before the merge, run `atlas gate` with the verb `ready`,
150
150
  `--repo` and `--pr`.
151
- 2. A pending check: wait for it. A red or missing check: fix it.
151
+ 2. A pending check: wait for it. A red or missing check: fix it. A
152
+ branch behind the main branch: merge the main branch in, wait for
153
+ green, and run `ready` again.
152
154
  3. Merge only when it prints READY. Name the head SHA that it read in
153
155
  the merge call, so a later push cannot slip in.
154
156
  4. Where the verb `apply` set the rulesets, the branch rule holds the
@@ -97,7 +97,9 @@ If the tracker cannot be reached, skip this half and say so.
97
97
  diff changes only index lines and link targets, run `atlas gate` with
98
98
  the verb `ready`, `--repo` and `--pr`. On READY, merge it with a merge
99
99
  commit at the head SHA that ready read. The merge door hook refuses any
100
- other merge. Otherwise leave it open and say why in the report.
100
+ other merge. When the branch is behind the main branch, merge the main
101
+ branch in, wait for green, and run `ready` again. Otherwise leave it
102
+ open and say why in the report.
101
103
 
102
104
  ## The run line
103
105