gitea: tell the controller which files a pull request deletes; say the dependents a merge would build (hq ADR 0238)
The controller asks its planner what a pull request reaches, as if merged: a module whose manifest the change deletes is one the merge removes, and the plan's dependents are said on the gate's status beside the modules it moves.
This commit is contained in:
+11
-4
@@ -21,7 +21,10 @@ export const REPO_CHECK_CONTEXT = "mesh/repo-check";
|
||||
export interface Layer {
|
||||
verdict: string;
|
||||
summary: string;
|
||||
/** The modules a merge of the change would move, as the controller's planner reckons it… */
|
||||
modules?: string[];
|
||||
/** …and those it would build after them because they stand on them. */
|
||||
dependents?: string[];
|
||||
}
|
||||
|
||||
/** What the controller says as `checked` (mesh-controller internal/link, Checked). */
|
||||
@@ -55,10 +58,10 @@ function stateOf(verdict: string): CommitStatus["state"] {
|
||||
return verdict === "pass" ? "success" : verdict === "warning" ? "warning" : verdict === "fail" ? "failure" : "error";
|
||||
}
|
||||
|
||||
function described(verdict: string, summary: string, modules?: string[]): string {
|
||||
function described(verdict: string, summary: string, modules?: string[], dependents?: string[]): string {
|
||||
// The forge keeps a short description; the rest is the comment's.
|
||||
let d = `${verdict || "error"}: ${summary}`;
|
||||
if (modules?.length) d += ` [${modules.join(", ")}]`;
|
||||
if (modules?.length) d += ` [${modules.join(", ")}${dependents?.length ? ` +${dependents.length} dependent(s)` : ""}]`;
|
||||
d = d.replace(/\s+/g, " ").trim();
|
||||
return d.length > 140 ? d.slice(0, 139) + "…" : d;
|
||||
}
|
||||
@@ -66,7 +69,10 @@ function described(verdict: string, summary: string, modules?: string[]): string
|
||||
/** The forge's status for the gate. */
|
||||
export function statusFor(c: Checked): CommitStatus {
|
||||
const gate = c.gate ?? { verdict: c.verdict, summary: c.summary };
|
||||
return { state: stateOf(gate.verdict), context: CHECK_CONTEXT, description: described(gate.verdict, gate.summary, gate.modules) };
|
||||
return {
|
||||
state: stateOf(gate.verdict), context: CHECK_CONTEXT,
|
||||
description: described(gate.verdict, gate.summary, gate.modules, gate.dependents),
|
||||
};
|
||||
}
|
||||
|
||||
/** Every status a verdict sets: the gate's, and the repository's own check's when it was said. */
|
||||
@@ -87,7 +93,8 @@ export function commentFor(c: Checked): string | null {
|
||||
if (gate.verdict === "pass" && !repoWrong) return null;
|
||||
const lines = [`**Merge check** at \`${c.commit.slice(0, 8)}\``, ""];
|
||||
lines.push(`- \`${CHECK_CONTEXT}\`: **${(gate.verdict || "error").toUpperCase()}** — ${gate.summary}` +
|
||||
(gate.modules?.length ? ` (modules: ${gate.modules.join(", ")})` : ""));
|
||||
(gate.modules?.length ? ` (modules: ${gate.modules.join(", ")}` +
|
||||
(gate.dependents?.length ? `; built after them: ${gate.dependents.join(", ")}` : "") + ")" : ""));
|
||||
if (repo) lines.push(`- \`${REPO_CHECK_CONTEXT}\`: **${(repo.verdict || "error").toUpperCase()}** — ${repo.summary}`);
|
||||
const ran = c.on ? `\n\nRun by the build seat on ${c.on} as \`${c.id}\` (\`builds --log ${c.id}\`).` : "";
|
||||
const report = c.report ? `\n\n\`\`\`\n${c.report.replace(/```/g, "'''")}\n\`\`\`` : "";
|
||||
|
||||
Reference in New Issue
Block a user