@futurelastic/colab-handbook 1.12.0-rc.46 → 1.12.0-rc.47
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 +1 -1
- package/tools/colab +6 -1
- package/tools/lib/branch-name.js +29 -1
package/package.json
CHANGED
package/tools/colab
CHANGED
|
@@ -470,9 +470,14 @@ function remoteClaimConflicts(st, repoAbs, nums) {
|
|
|
470
470
|
const want = new Set(nums);
|
|
471
471
|
const records = [...Object.values(st.worktrees || {}), ...Object.values(st.claims || {})];
|
|
472
472
|
const ours = (b) => records.some((r) => r && r.repo === repoAbs && r.branch === b && machine.isLocal(r));
|
|
473
|
+
// #485: a dependabot ref, trunk and every declared integration: line are never a session's claim —
|
|
474
|
+
// their trailing digits are a version or an accident of naming. Same filter as code-sweep §1.3.
|
|
475
|
+
const doc = projectDoc(repoAbs);
|
|
476
|
+
const trunk = resolveTrunk(repoAbs, doc) || '';
|
|
477
|
+
const scope = { trunk, integration: trunk ? resolveIntegration(repoAbs, doc, trunk) : [] };
|
|
473
478
|
const conflicts = [];
|
|
474
479
|
for (const h of heads.heads) {
|
|
475
|
-
const carried =
|
|
480
|
+
const carried = branchName.claimIssueNumbers(h.branch, scope).filter((n) => want.has(n));
|
|
476
481
|
if (!carried.length || ours(h.branch)) continue;
|
|
477
482
|
for (const num of carried) conflicts.push({ num, remote, branch: h.branch, sha: h.sha });
|
|
478
483
|
}
|
package/tools/lib/branch-name.js
CHANGED
|
@@ -54,6 +54,34 @@ function branchIssueNumbers(branchName) {
|
|
|
54
54
|
return m[1].split('-').map(Number).filter((n) => Number.isInteger(n) && n > 0);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Ref-name prefixes owned by a dependency bot, never by a session (#485). Dependabot names its
|
|
59
|
+
* branches after the version it bumps to — `dependabot/github_actions/actions/github-script-9` —
|
|
60
|
+
* so the trailing run is a MAJOR VERSION, not an issue number, and reading it as one makes an
|
|
61
|
+
* unrelated issue look held. `code-sweep` §1.3 drops the same prefix with `grep -v '^dependabot/'`;
|
|
62
|
+
* keep the two in step.
|
|
63
|
+
*/
|
|
64
|
+
const BOT_BRANCH_PREFIXES = ['dependabot/'];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Issue numbers a branch carries AS A CLAIM — `branchIssueNumbers`, minus every ref that can only
|
|
68
|
+
* be a false positive (#485): a dependency bot's branch (`BOT_BRANCH_PREFIXES`), `HEAD`, the
|
|
69
|
+
* declared trunk, and any declared `integration:` line. Those are long-lived lines or tool-owned
|
|
70
|
+
* refs whose trailing digits mean something else; a match against one would refuse a claim that
|
|
71
|
+
* nobody holds and teach the session to reach for `--force` — the one flag that also bypasses a
|
|
72
|
+
* real holder. Returns [] for an excluded ref, exactly like a name with no trailing run.
|
|
73
|
+
*
|
|
74
|
+
* `branchIssueNumbers` itself stays unfiltered on purpose: ship's harvest reads the session's OWN
|
|
75
|
+
* branch, which can never be one of these.
|
|
76
|
+
*/
|
|
77
|
+
function claimIssueNumbers(branchName, { trunk = '', integration = [] } = {}) {
|
|
78
|
+
const b = String(branchName || '');
|
|
79
|
+
if (!b || b === 'HEAD' || (trunk && b === trunk)) return [];
|
|
80
|
+
if (BOT_BRANCH_PREFIXES.some((p) => b.startsWith(p))) return [];
|
|
81
|
+
if ((integration || []).includes(b)) return [];
|
|
82
|
+
return branchIssueNumbers(b);
|
|
83
|
+
}
|
|
84
|
+
|
|
57
85
|
/**
|
|
58
86
|
* A §4-conforming name → `{ login, machine, type, rest, slug, issues, prefixed }`, or `null` when the
|
|
59
87
|
* name conforms to neither shape. `rest` is `<slug>-<N…>` (everything after the type); `slug` is
|
|
@@ -133,5 +161,5 @@ function worktreeName(branch) {
|
|
|
133
161
|
|
|
134
162
|
module.exports = {
|
|
135
163
|
TYPES, BRANCH_RE_SOURCE, BRANCH_RE,
|
|
136
|
-
branchIssueNumbers, parse, format, machineLabel, sessionBranch, worktreeName,
|
|
164
|
+
branchIssueNumbers, claimIssueNumbers, BOT_BRANCH_PREFIXES, parse, format, machineLabel, sessionBranch, worktreeName,
|
|
137
165
|
};
|