Skip to content

feat(review): capture bounded raw context in the linked_issue_scope_mismatch fired signal#8132

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
kai392:feat/critical-issue-scope-mismatch-raw-context
Jul 23, 2026
Merged

feat(review): capture bounded raw context in the linked_issue_scope_mismatch fired signal#8132
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
kai392:feat/critical-issue-scope-mismatch-raw-context

Conversation

@kai392

@kai392 kai392 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extend the metadata at calibration: wire linked_issue_scope_mismatch into the shared signal-tracking module (fired + reversal) #8101's recordRuleFired call site (src/queue/processors.ts, the linkedIssueSatisfactionGateMode === "block" && status === "unaddressed" block) with the four bounded raw-context fields the assessment was actually based on: issueText, prTitle, prBody, diff — so Epic: verifiable pre-merge backtest for ORB/AMS deterministic rules #8082's backtest primitives can re-run a changed assessment prompt/logic against the stored corpus, not just validate confidence-floor tweaks.
  • Bounds reuse LinkedIssueSatisfactionInput's own constants — MAX_ISSUE_TEXT_CHARS/MAX_BODY_CHARS/MAX_DIFF_CHARS are now exported from src/services/linked-issue-satisfaction.ts (values unchanged) and applied with the exact trim/slice shapes buildLinkedIssueSatisfactionPrompt itself uses, so what's stored is byte-what the assessment saw. No new bound constants, per the issue's requirement.
  • All four values were already in scope at the call site (computed for the original LinkedIssueSatisfactionInput construction earlier in the same function) — nothing is re-fetched or re-derived.

Closes #8129

Test plan

  • Extended test/unit/linked-issue-satisfaction-run.test.ts: the fired event's metadata carries all four fields (issue title+body composite, exact prTitle, diff equal to buildAiReviewDiff(files) under its bound); an over-limit prBody is stored truncated to exactly MAX_BODY_CHARS (the required truncation branch); a body-less PR stores an empty prBody (the ?? "" arm), never the string null/undefined
  • Existing calibration: wire linked_issue_scope_mismatch into the shared signal-tracking module (fired + reversal) #8101 suite (58/58) passes unchanged — toMatchObject({ confidence }) assertions are unaffected by the added fields
  • npm run typecheck green
  • CI validate

@kai392
kai392 requested a review from JSONbored as a code owner July 22, 2026 23:57
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (c02a277) to head (d89073a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8132      +/-   ##
==========================================
- Coverage   92.02%   90.29%   -1.73%     
==========================================
  Files         760       99     -661     
  Lines       77394    25751   -51643     
  Branches    23392     4992   -18400     
==========================================
- Hits        71225    23253   -47972     
+ Misses       5061     2233    -2828     
+ Partials     1108      265     -843     
Flag Coverage Δ
shard-1 80.45% <100.00%> (+23.35%) ⬆️
shard-2 30.23% <75.00%> (-24.11%) ⬇️
shard-3 39.99% <75.00%> (-10.34%) ⬇️

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

Files with missing lines Coverage Δ
src/queue/processors.ts 95.76% <100.00%> (+<0.01%) ⬆️
src/services/linked-issue-satisfaction.ts 100.00% <100.00%> (ø)

... and 661 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 23, 2026
@loopover-orb

loopover-orb Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-23 00:17:21 UTC

3 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR extends the linked_issue_scope_mismatch fired-signal metadata (added in #8101) with four bounded raw-context fields (issueText, prTitle, prBody, diff) so a future backtest can re-run assessment logic against stored history, per #8129. The bounds are correctly reused from linked-issue-satisfaction.ts's own exported constants and applied with the same trim/slice shape buildLinkedIssueSatisfactionPrompt uses, and the two added tests verify the over-limit-body truncation and null-body-to-empty-string arms. The change is narrow, additive (toMatchObject assertions in the existing #8101 suite are unaffected by new keys), requires no schema/migration since metadata is a JSON blob, and closes a linked issue as required.

Nits — 5 non-blocking
  • The new tests cover the prBody truncation arm and the null-body arm, but never exercise the truncation arm for issueText or diff (both just happen to be under their bounds in the fixtures) — worth adding an over-limit case for at least one of them to lock in the slice bound.
  • src/queue/processors.ts:7563 — the multi-line `// calibration: capture bounded raw context (issueText/prTitle/prBody/diff) in linked_issue_scope_mismatch's fired-event metadata #8129: ...` comment block explaining the rationale is fine given this file's existing convention of similar comments, but per general style guidance keep new comments to what's non-obvious (the WHY, not a restatement of the PR description).
  • Storing up to ~68KB (6000+2000+60000 char bounds) of raw context per fired signal is a deliberate, bounded design per the PR description, but worth flagging as a storage-growth consideration for the signal_history table if this feature fires frequently across many repos.
  • Consider adding one test asserting the issueText or diff field is truncated to its exact MAX_*_CHARS bound (mirroring the existing prBody truncation test) to fully lock in all four bound applications.
  • If `recordRuleFired`'s metadata parameter has an explicit TypeScript shape/type elsewhere, confirm it was widened to accept these new string fields rather than relying on structural `Record<string, unknown>` typing.

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 #8129
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 97 registered-repo PR(s), 52 merged, 2 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kai392; Gittensor profile; 97 PR(s), 2 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR extends the recordRuleFired metadata at the exact call site with issueText/prTitle/prBody/diff, bounded using the exported MAX_ISSUE_TEXT_CHARS/MAX_BODY_CHARS/MAX_DIFF_CHARS constants reused from linked-issue-satisfaction.ts rather than redefined, and adds tests verifying all four fields are present plus truncation of an over-limit body.

Review context
  • Author: kai392
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 97 PR(s), 2 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (PR #8135)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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

@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 66a026f into JSONbored:main Jul 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calibration: capture bounded raw context (issueText/prTitle/prBody/diff) in linked_issue_scope_mismatch's fired-event metadata

2 participants