Skip to content

focus-manifest.ts's preferred linked-issue branch is missing the bodyObserved false-positive guard its required sibling has #8326

Description

@JSONbored

Context

src/signals/focus-manifest.ts builds contributor-facing findings from a repo's maintainer focus manifest. For the linked-issue policy, the "required" branch (around line 773) is:

if (manifest.linkedIssuePolicy === "required" && linkedIssueCount === 0 && bodyObserved && !hasNoIssueRationale) {
  findings.push({
    code: "manifest_linked_issue_required",
    ...

The bodyObserved guard exists specifically to avoid a false positive on a sparse/incomplete webhook payload where the PR body wasn't actually observed (so linkedIssueCount === 0 might just mean "we don't know," not "there really is no linked issue").

The sibling "preferred" branch immediately below it does not have the same guard:

} else if (manifest.linkedIssuePolicy === "preferred" && linkedIssueCount === 0) {
  findings.push({
    code: "manifest_linked_issue_preferred",
    ...

Because bodyObserved is missing here, a repo configured with linkedIssuePolicy: "preferred" can surface a "Maintainer prefers a linked issue" nudge for a PR whose body was never actually observed (e.g. from a sparse webhook payload) — the exact false-positive class the "required" branch was already fixed to avoid, just still present in its "preferred" sibling.

Requirements

  • Add the same bodyObserved guard to the "preferred" branch's condition, so it reads manifest.linkedIssuePolicy === "preferred" && linkedIssueCount === 0 && bodyObserved.
  • Do not add hasNoIssueRationale to the "preferred" branch unless it is already meaningful there — check whether hasNoIssueRationale is scoped as a general "no issue" opt-out or specific to the "required" policy's stricter contract before deciding; if uncertain, leave hasNoIssueRationale out of the "preferred" branch and only add bodyObserved (the concretely-verified gap).

Deliverables

  • src/signals/focus-manifest.ts's "preferred" linked-issue branch gains the bodyObserved guard.
  • A regression test in the focus-manifest test suite proving a linkedIssuePolicy: "preferred" repo with bodyObserved: false and linkedIssueCount: 0 does NOT produce the manifest_linked_issue_preferred finding.
  • A test proving the finding still fires correctly when bodyObserved: true and linkedIssueCount: 0 (no regression on the existing, intended behavior).

Test Coverage Requirements

This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches. Cover both the new bodyObserved: false (finding suppressed) and the existing bodyObserved: true (finding fires) branches.

Expected Outcome

A repo with linkedIssuePolicy: "preferred" no longer nudges a contributor about a missing linked issue purely because a sparse webhook payload made the PR body appear unobserved — the "preferred" and "required" branches now share the same false-positive guard.

Links & Resources

  • src/signals/focus-manifest.ts — the "required"/"preferred" linked-issue branches, around line 773-788

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