Skip to content

formatGateCheckOutput silently truncates configured blockers past 8 with no omitted-count disclosure #8323

Description

@JSONbored

Context

src/rules/advisory.ts's buildCheckRunAnnotations already discloses truncation: when candidate annotations exceed CHECK_RUN_ANNOTATION_LIMIT, it computes omittedCount and formatCheckRunOutput appends "…N more hotspot annotation(s) omitted from inline check output." to the check-run text so a contributor knows more findings exist than are shown.

The sibling function that renders configured hard-blocker text, formatGateCheckOutput (same file, around line 744), truncates the same way but with no such disclosure:

const blockerLines = gate.blockers.slice(0, 8).map((finding) => {
  const action = finding.action ? ` Action: ${sanitizeForCheckRun(finding.action)}` : "";
  return `- ${sanitizeForCheckRun(finding.title)}.${action}`;
});
return {
  title: gate.title.slice(0, 255),
  summary: `${LOOPOVER_GATE_CHECK_NAME} found a repo-configured hard blocker.`,
  text: blockerLines.length > 0 ? blockerLines.join("\n") : "A configured hard blocker was found.",
};

The 8 cap has no explanatory comment and no disclosure line. A contributor with 9+ genuine configured blockers sees only the first 8, fixes them, and only discovers the 9th (and beyond) on the next gate run — indistinguishable from the bot silently moving the goalposts. test/unit/rules.test.ts's existing coverage of formatGateCheckOutput tops out at 2 blockers (around line 623), so the gate.blockers.length > 8 path has no test today.

Requirements

  • When gate.blockers.length exceeds 8, formatGateCheckOutput's returned text must append a disclosure line naming how many additional blockers were omitted, following the same wording pattern already used by buildCheckRunAnnotations's omittedCount disclosure (e.g. "…N more configured blocker(s) omitted from inline check output.").
  • The 8 truncation limit must be extracted to a named constant (e.g. GATE_CHECK_BLOCKER_LIMIT) with a one-line comment explaining its purpose, instead of remaining a bare magic number inline.
  • The disclosure line must not appear when gate.blockers.length <= 8 (i.e. no omission) — do not add the line unconditionally.

Deliverables

  • A named constant (e.g. GATE_CHECK_BLOCKER_LIMIT = 8) replacing the current inline 8 in formatGateCheckOutput.
  • Disclosure text appended to text when blockers are truncated, mirroring buildCheckRunAnnotations's omitted-count pattern.
  • A test in test/unit/rules.test.ts with more than 8 blockers asserting: (a) the disclosure text appears with the correct omitted count, and (b) a case with exactly 8 or fewer blockers asserting the disclosure text does NOT appear.

Test Coverage Requirements

This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches. Both the truncated-with-disclosure branch and the not-truncated (no disclosure) branch must be independently covered.

Expected Outcome

A contributor with more than 8 configured hard blockers on a single PR sees an explicit "N more omitted" disclosure in the gate check's text, the same transparency buildCheckRunAnnotations already provides for annotations, instead of silently seeing only a partial list.

Links & Resources

  • src/rules/advisory.tsformatGateCheckOutput (the gap, ~line 744) and buildCheckRunAnnotations's omittedCount pattern to mirror (~line 747-749 in formatCheckRunOutput)
  • test/unit/rules.test.ts — existing formatGateCheckOutput coverage, ~line 623

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions