Skip to content

refactor(advisory): give addPullRequestFindings named signals instead of a 12-argument tail - #10214

Merged
loopover-orb[bot] merged 1 commit into
mainfrom
refactor/advisory-findings-options-object
Jul 31, 2026
Merged

refactor(advisory): give addPullRequestFindings named signals instead of a 12-argument tail#10214
loopover-orb[bot] merged 1 commit into
mainfrom
refactor/advisory-findings-options-object

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

addPullRequestFindings exists twice — in src/rules/advisory.ts and its deliberately-divergent engine twin packages/loopover-engine/src/advisory/gate-advisory.ts — and both took the same positional tail. Every new signal had to be threaded in identical order through two files.

That is a shape where transposing two same-typed arguments compiles cleanly and silently changes a verdict. #10205 added the twelfth argument and paid the tax in both signatures and both call sites; the next signal would too.

Both copies now take one named object. Each declares its own local type rather than sharing one — keeping these two files free of a common import is precisely what the divergence exists for (#4518, keep-divergent recorded for #4881), so @loopover/engine still never reaches into the host's graph.

Selected as #10170's first target for a specific reason, not arbitrarily: it is the only entry on that list that must be edited in two places every time, so the fix removes a recurring class of drift rather than tidying one signature. Context and the corrected measurements are in this comment on #10170 — the audit's original ranking counted commas inside JSDoc, which inflated the numbers and mis-ranked the targets.

Why you can trust it is behaviour-neutral

Nothing else moved. No finding added or removed, no message text touched, no test edited. The diff contains zero changed lines matching findings.push or a finding-code literal — only the signature, the destructure, and the single call site in each file.

The existing advisory suites on both sides, test:engine-parity, and engine-parity:drift-check all pass unmodified. That is the whole regression proof: if an assertion had needed editing, it would have meant behaviour changed, and the right response would have been to re-examine the refactor rather than adjust the test.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123).

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests — not applicable by design: this changes no behaviour, and the value of the change is that the pre-existing suites pass untouched.

Full npx vitest run: 1358 files, 26503 tests, 0 failures. @loopover/engine: 945 pass. test:engine-parity: 15 pass. engine-parity:drift-check: 7 twin pairs agree at engine 3.20.0. Also green: dead-source-files, dead-exports, import-specifiers, coverage-boltons, typecheck-coverage, docs:drift, cf-typegen.

If any required check was skipped, explain why:

  • Not run locally: actionlint, test:workers, build:mcp, test:mcp-pack, ui:*. This PR touches exactly two TypeScript files under src/rules/ and packages/loopover-engine/src/advisory/ — no workflow, worker-pool, MCP, OpenAPI, or UI file. CI runs them all.
  • npm audit reports pre-existing advisories on main; this PR changes no dependency (no package.json / lockfile diff).

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

No contributor-visible string changes at all — the findings this function emits are byte-identical.

UI Evidence

Not applicable — no UI, frontend, docs, or extension files are touched.

Notes

The first three arguments (repo, pr, findings) stay positional: they are the genuine subject of the call, and findings is the accumulator being appended to. Only the resolved-signal tail moved into the object.

Closes #10210

… of a 12-argument tail

addPullRequestFindings exists twice, in the two deliberately-divergent advisory
twins, and both took the same POSITIONAL tail. Every new signal had to be
threaded in identical ORDER through two files -- a shape where transposing two
same-typed arguments compiles cleanly and silently changes a verdict. #10205
added the twelfth argument and paid that tax in both signatures and both call
sites; the next one would too.

Both copies now take one named object. Each declares its own local type rather
than sharing one: keeping these files free of a common import is precisely what
the divergence exists for (#4518, keep-divergent recorded for #4881), so the
engine still never reaches into the host's graph.

Pure refactor, and the evidence is that NOTHING ELSE MOVED: no finding added or
removed, no message text touched, no test edited. The diff contains zero changed
lines matching findings.push or a finding code literal. The existing advisory
suites on both sides, test:engine-parity and engine-parity:drift-check all pass
unmodified, which is the whole regression proof -- if an assertion had needed
editing, that would have meant behaviour changed.

Closes #10210
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 13:15:07 UTC

2 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a clean mechanical refactor that converts the 12-argument (host) and 6-argument (engine) positional tails of `addPullRequestFindings` into a single named-object parameter in each of the two deliberately-divergent twins. I traced both call sites and both function bodies: the destructure order and field names match the call-site keys exactly, all fields are accounted for (including the optional `scopedLinkedIssueClaimedAt`/`supersededBy` fields), and no `findings.push`, message text, or logic line was touched — this is genuinely a pure signature/shape change. The two types are correctly kept as separate local declarations rather than shared, consistent with the documented #4518/#4881 divergence rationale.

Nits — 6 non-blocking
  • No test files were changed, but since this is a pure signature refactor with unmodified call sites and the existing advisory/parity suites already exercise both functions end-to-end, the lack of new tests is defensible for a behavior-neutral rename — still, a coverage tool may flag the destructured lines in both files as 'new' code with no test asserting the object-shape contract itself.
  • The magic numbers `4518`/`4881` in the new doc comments are just issue references, not real magic numbers — no action needed, but worth noting the automated scan flagged them incorrectly.
  • src/rules/advisory.ts is already a very large file (~1094 lines); this refactor doesn't make that materially worse, but it's a candidate for splitting if more signals get added.
  • Consider whether a lightweight test asserting `addPullRequestFindings` still produces identical findings for a representative signals object would future-proof this refactor against a later destructure typo, even though none exists today (src/rules/advisory.ts and gate-advisory.ts).
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10210
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 9 registered-repo PR(s), 8 merged, 310 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 9 PR(s), 310 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: moderate
Linked issue satisfaction

Addressed
Both twins' addPullRequestFindings functions are converted from a positional argument tail to a single named-object parameter (repo, pr, findings staying positional as specified), each with its own locally-declared type and no shared import between host and engine, matching the issue's exact scope. The diff touches only signatures, destructuring, and call sites with no finding/message logic change

Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 9 PR(s), 310 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 31, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui c48137c Commit Preview URL

Branch Preview URL
Jul 31 2026, 12:49 PM

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.21%. Comparing base (0c2c845) to head (c48137c).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10214      +/-   ##
==========================================
- Coverage   92.22%   92.21%   -0.01%     
==========================================
  Files         937      937              
  Lines      114334   114347      +13     
  Branches    27645    27646       +1     
==========================================
+ Hits       105440   105449       +9     
  Misses       7588     7588              
- Partials     1306     1310       +4     
Flag Coverage Δ
backend 95.66% <100.00%> (-0.01%) ⬇️
engine 73.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ages/loopover-engine/src/advisory/gate-advisory.ts 81.93% <100.00%> (+0.25%) ⬆️
src/rules/advisory.ts 97.84% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit cb3f1ed into main Jul 31, 2026
11 checks passed
@loopover-orb
loopover-orb Bot deleted the refactor/advisory-findings-options-object branch July 31, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(advisory): addPullRequestFindings takes a 12-argument positional tail, threaded identically through both divergent twins

1 participant