@futurelastic/colab-handbook 1.21.0-rc.3 → 1.21.0-rc.4
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 +34 -5
- package/tools/lib/codec/labels.d.ts +1 -1
- package/tools/lib/codec/labels.js +5 -2
package/package.json
CHANGED
package/tools/colab
CHANGED
|
@@ -3722,7 +3722,7 @@ function cmdReadiness(argv) {
|
|
|
3722
3722
|
// #727: through the REST dependencies endpoint (readBlockedByEdges), never `gh issue view
|
|
3723
3723
|
// --json blockedBy` — that JSON field is absent from some supported gh versions (2.85.0
|
|
3724
3724
|
// measured), which made this line read "unread" on every issue there.
|
|
3725
|
-
const summary =
|
|
3725
|
+
const summary = readBlockerSummary(repoAbs, num);
|
|
3726
3726
|
print(labels.readinessMarkedMessage({ num, repo: shortRepo(repoAbs), summary }));
|
|
3727
3727
|
}
|
|
3728
3728
|
|
|
@@ -3764,9 +3764,12 @@ function cmdReadinessMechanical(repoAbs, num, opts) {
|
|
|
3764
3764
|
// blocked` makes), not `gh issue view --json blockedBy`: that JSON field does not exist on some
|
|
3765
3765
|
// supported gh versions (2.85.0 measured), so the old read was null there and this lane refused
|
|
3766
3766
|
// on every issue. A failed read is still a refusal, never an empty graph.
|
|
3767
|
-
|
|
3767
|
+
// #728: the refusal names the underlying error and the command that re-measures it, so a triage
|
|
3768
|
+
// pass can tell an auth or API failure from a parser bug without re-deriving the call by hand.
|
|
3769
|
+
const graph = readBlockerSummary(repoAbs, num);
|
|
3768
3770
|
if (!graph.ok) {
|
|
3769
|
-
throw new UserError(`could not read #${num}'s blockedBy graph — refusing to write ${labels.MECHANICAL_READINESS_LABEL} on an unmeasured read`
|
|
3771
|
+
throw new UserError(`could not read #${num}'s blockedBy graph (${graph.error}) — refusing to write ${labels.MECHANICAL_READINESS_LABEL} on an unmeasured read. `
|
|
3772
|
+
+ `Re-run the read by hand to see the full error: \`gh api repos/{owner}/{repo}/issues/${num}/dependencies/blocked_by\` (run it in this repo), then \`colab readiness ${num} --mechanical\` once it reads`);
|
|
3770
3773
|
}
|
|
3771
3774
|
if (graph.total > 0) {
|
|
3772
3775
|
throw new UserError(`#${num} has ${graph.total} recorded blocker(s), ${graph.open} open — ${labels.MECHANICAL_READINESS_LABEL} asserts an EMPTY graph, so this read does not qualify. `
|
|
@@ -3860,14 +3863,40 @@ Options:
|
|
|
3860
3863
|
* read (mirrors ghIssueView's own null-means-unreadable contract).
|
|
3861
3864
|
*/
|
|
3862
3865
|
function readBlockedByEdges(repoAbs, num) {
|
|
3866
|
+
return readBlockedByEdgesDetailed(repoAbs, num).raw;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
/**
|
|
3870
|
+
* The same read, keeping WHY it failed (#728): `{ raw, error }`, where `error` is one short line —
|
|
3871
|
+
* gh's exit code plus the first line of its stderr, or the parse failure — and null on success.
|
|
3872
|
+
* The refusal that reads it can then tell an auth/API failure (`exit 1: HTTP 401 …`) from a
|
|
3873
|
+
* response this module could not parse; a bare "could not read" sent a triage pass guessing.
|
|
3874
|
+
*/
|
|
3875
|
+
function readBlockedByEdgesDetailed(repoAbs, num) {
|
|
3863
3876
|
const r = git.ghApi(repoAbs, [
|
|
3864
3877
|
// per_page=100: the endpoint pages at 30 by default, and GitHub allows up to 50 blockers per
|
|
3865
3878
|
// issue — a default-size page would undercount (#727's readiness summary reads this too).
|
|
3866
3879
|
`repos/{owner}/{repo}/issues/${num}/dependencies/blocked_by?per_page=100`,
|
|
3867
3880
|
'-q', '[.[] | {id: .id, number: .number, state: .state, repository_url: .repository_url}]',
|
|
3868
3881
|
]);
|
|
3869
|
-
if (!r.ok)
|
|
3870
|
-
|
|
3882
|
+
if (!r.ok) {
|
|
3883
|
+
const line = String(r.stderr || '').split('\n').map((l) => l.trim()).find(Boolean);
|
|
3884
|
+
return { raw: null, error: `\`gh api …/dependencies/blocked_by\` exit ${r.code == null ? '?' : r.code}: ${line || 'no stderr'}` };
|
|
3885
|
+
}
|
|
3886
|
+
try { return { raw: JSON.parse(r.stdout), error: null }; } catch (e) {
|
|
3887
|
+
return { raw: null, error: `unparseable response from \`gh api …/dependencies/blocked_by\` (${e.message})` };
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
/**
|
|
3892
|
+
* `readBlockedByEdgesDetailed` folded through `openBlockerSummary`, with a reason whenever the
|
|
3893
|
+
* summary is not ok — including a read that parsed but did not have the edge shape (#728).
|
|
3894
|
+
*/
|
|
3895
|
+
function readBlockerSummary(repoAbs, num) {
|
|
3896
|
+
const read = readBlockedByEdgesDetailed(repoAbs, num);
|
|
3897
|
+
const summary = blockedBy.openBlockerSummary(read.raw);
|
|
3898
|
+
if (summary.ok) return summary;
|
|
3899
|
+
return { ...summary, error: read.error || 'the response was not a list of issues (unexpected shape)' };
|
|
3871
3900
|
}
|
|
3872
3901
|
|
|
3873
3902
|
/**
|
|
@@ -39,7 +39,7 @@ export function readinessLabelArgs(opts?: { clear?: boolean }): string[];
|
|
|
39
39
|
export function readinessMissingLabelHint(present: LabelLike[] | null | undefined): string | null;
|
|
40
40
|
export function readinessMarkedMessage(opts?: {
|
|
41
41
|
num?: number | string; repo?: string;
|
|
42
|
-
summary?: { ok: boolean; total: number; read: number; open: number; unknownState: number } | null;
|
|
42
|
+
summary?: { ok: boolean; total: number; read: number; open: number; unknownState: number; error?: string } | null;
|
|
43
43
|
}): string;
|
|
44
44
|
export const TRACKING_LABEL: 'tracking';
|
|
45
45
|
export const MECHANICAL_READINESS_LABEL: 'graph-empty';
|
|
@@ -515,12 +515,15 @@ function readinessLabelArgs({ clear } = {}) {
|
|
|
515
515
|
// --mechanical reads blockedBy), printed verbatim even on issues with open blockers, and the one
|
|
516
516
|
// line operators copy into reports. It now says what was DONE (the review was recorded) and what
|
|
517
517
|
// the graph holds, from one blockedBy read (`summary` = blocked-by.js openBlockerSummary, or
|
|
518
|
-
// null/{ok:false} when the read failed). It never says "verified" and never "no open blocker":
|
|
518
|
+
// null/{ok:false[, error]} when the read failed). It never says "verified" and never "no open blocker":
|
|
519
519
|
// deps-checked is a review record, and an open edge carries the block on its own (§5, #279).
|
|
520
520
|
function readinessMarkedMessage({ num, repo, summary } = {}) {
|
|
521
521
|
const head = `Marked #${num} in ${repo} ${READINESS_LABEL} — dependencies reviewed`;
|
|
522
522
|
if (!summary || !summary.ok) {
|
|
523
|
-
|
|
523
|
+
// #728: name why the read failed when the caller knows (`summary.error`, one line), so an
|
|
524
|
+
// auth/API failure reads differently from a parser bug. The label has landed either way.
|
|
525
|
+
const why = summary && typeof summary.error === 'string' && summary.error.trim() ? `${summary.error.trim()}; ` : '';
|
|
526
|
+
return `${head}; blockedBy: unread (${why}the label records your review, not a graph read)`;
|
|
524
527
|
}
|
|
525
528
|
const { total, read, open, unknownState } = summary;
|
|
526
529
|
const truncated = read < total;
|