Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,13 @@ function ciSummary(s) {
const rows = t.rows ?? "?";
const gaps = t.gaps ? ` ${esc(t.gaps)} could not be measured.` : "";
const selftest = s.standard ? ` The standard's own selftest is ${esc(s.standard)}.` : "";
return `<p class="muted">${esc(t.caller.present)} of ${esc(rows)} public repos call the standard: ${esc(t.standard_run.green)} green, ${esc(t.standard_run.red)} red. ${esc(t.caller.absent)} do not call it.${gaps}${selftest}</p>`;
// The dark-factory count is printed only when the lane measured it: a snapshot
// older than .github#390 carries no `gate_ready`, and "0 of N" would be a claim
// the lane never made.
const dark = Number.isInteger(t.gate_ready)
? ` ${esc(t.gate_ready)} merge on their own green (gated on the standard and the claim, with the arming lane).`
: "";
return `<p class="muted">${esc(t.caller.present)} of ${esc(rows)} public repos call the standard: ${esc(t.standard_run.green)} green, ${esc(t.standard_run.red)} red. ${esc(t.caller.absent)} do not call it.${dark}${gaps}${selftest}</p>`;
}

function overviewSection(s) {
Expand Down
4 changes: 4 additions & 0 deletions src/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ export const FINDING_COPY = {
"pull-request-no-synchronize": "the caller's pull_request trigger does not re-run on a push",
"test-lane-absent": "carries a toolchain but no test lane — its tests, if any, gate nothing",
"standard-run-red": "the latest standard run on its default branch is red",
// The dark-factory pair (.github-private#913 step 4): the first is green that
// decides nothing, the second is green that waits for a person.
"gate-absent": "calls the standard, but nothing on its default branch requires it — green gates nothing",
"arming-lane-absent": "is gated, but nothing arms the merge — green waits for a person",
};

/**
Expand Down
20 changes: 20 additions & 0 deletions test/render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -731,3 +731,23 @@ test("a repo-health section with nothing flagged says so, and only then", () =>
assert.doesNotMatch(failed, /every standard run is green/);
assert.match(failed, /feed responded 504/);
});

// ── repo health: the dark-factory count (desk#85) ────────────────────────────

test("the repo-health summary says how many repos merge on their own green — only when the lane measured it", () => {
// A snapshot from before .github#390 carries no gate_ready: no sentence, no "0 of".
const before = renderOverview(overview(), AT, 60);
assert.doesNotMatch(before, /merge on their own green/);
// A measured one prints the lane's count, untouched.
const after = renderOverview(overview({
sections: [section("issues", "issues.bounded.tools"), section("claims", "claims.bounded.tools"), section("prs", "prs.bounded.tools"),
ciSection({ totals: { ...ciSection().totals, gated: 43, arming_lane: 37, gate_ready: 37 } })],
}), AT, 60);
assert.match(after, /37 merge on their own green \(gated on the standard and the claim, with the arming lane\)\./);
// Zero is a measurement too, and prints as one.
const none = renderOverview(overview({
sections: [section("issues", "issues.bounded.tools"), section("claims", "claims.bounded.tools"), section("prs", "prs.bounded.tools"),
ciSection({ totals: { ...ciSection().totals, gate_ready: 0 } })],
}), AT, 60);
assert.match(none, /0 merge on their own green/);
});
15 changes: 15 additions & 0 deletions test/select.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,18 @@ test("a snapshot predating totals or repos degrades to empty rather than throwin
assert.equal(r.totals.rows, null);
assert.equal(r.standard, null);
});

// ── the dark-factory findings read as sentences (desk#85) ────────────────────

test("selectCi renders the two dark-factory findings as sentences, not slugs", () => {
const r = selectCi(ciFeed([
ciRepo({ repo: "bounded-systems/ungated", findings: ["gate-absent"] }),
ciRepo({ repo: "bounded-systems/unarmed", findings: ["arming-lane-absent"] }),
]));
const by = Object.fromEntries(r.items.map((i) => [i.repo.split("/")[1], i.summary]));
assert.equal(by.ungated, FINDING_COPY["gate-absent"]);
assert.equal(by.unarmed, FINDING_COPY["arming-lane-absent"]);
assert.match(by.ungated, /green gates nothing/);
assert.match(by.unarmed, /green waits for a person/);
assert.doesNotMatch(by.ungated + by.unarmed, /gate-absent|arming-lane-absent/, "no slug leaks into the sentence");
});
Loading