Skip to content

fix(signals): wire open-PR pressure scenarios into the branch scenario summary (#348) - #923

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
oktofeesh1:fix/issue-348-wire-open-pr-pressure
Jun 20, 2026
Merged

fix(signals): wire open-PR pressure scenarios into the branch scenario summary (#348)#923
JSONbored merged 3 commits into
JSONbored:mainfrom
oktofeesh1:fix/issue-348-wire-open-pr-pressure

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

The bug

The open-PR pressure strategy feature from #348 is dark in production. simulateOpenPrPressure (src/services/open-pr-pressure-scenarios.ts) computes a contributor strategy comparison — open another PR now / wait / clean up existing work first — ranked by repo queue pressure and miner-vs-maintainer lane. Its output is rendered by renderPublicScenarioSummary (src/scenarios/scenario-summary.ts), which fills the scenario options and headline from it.

Both halves are implemented and unit-tested — but the only production caller, buildLocalBranchAnalysis (src/signals/local-branch.ts), never built or passed pressureSimulation. So:

  • scenarioSummary.options was always [] in analyze-branch / preflight / local-diff,
  • the strategy headline never fired,
  • and simulateOpenPrPressure had zero production callers (only its test referenced it).

The fix

Build the simulation at the existing call site and pass it through:

  • roleContext is already in scope (built a few lines above),
  • queueHealth is derived with the same buildCollisionReportbuildQueueHealth pair the pr-status route uses,
  • contributorOpenPrCount is the contributor's own open PRs.

Pure and read-only; the renderer already runs every line through sanitizePublicComment, so output stays public-safe.

Test

test/unit/local-branch.test.ts now asserts scenarioSummary.options is populated — 3 ranked options, exactly one recommended, each with a non-empty label and nextStep — the regression that was silently empty before. Full npm run test:coverage stays green (branches 97.09%).

🤖 Generated with Claude Code

@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner June 19, 2026 06:31
@dosubot dosubot Bot added the size:S label Jun 19, 2026
@ghost

ghost commented Jun 19, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #923 is no longer open. No action.

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

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

@ghost ghost added the gittensory:reviewed label Jun 19, 2026
@superagent-security

superagent-security Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

⚠️ Contributor trust inconclusive. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

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

@ghost

This comment has been minimized.

…o summary (JSONbored#348)

`simulateOpenPrPressure` (open-pr-pressure-scenarios.ts, JSONbored#348) and the
`renderPublicScenarioSummary` `options`/headline rendering for it were both
implemented and tested, but the only production caller —
buildLocalBranchAnalysis — never built or passed `pressureSimulation`. As a
result `scenarioSummary.options` was ALWAYS empty in analyze-branch / preflight
/ local-diff, and the strategy guidance (open new work / wait / clean up first)
never reached contributors.

Build the simulation at the call site (roleContext is already in scope; derive
queueHealth via buildCollisionReport + buildQueueHealth, and the contributor's
own open-PR count) and pass it through. Pure/read-only and public-safe — the
renderer already sanitizes every line.

Test: local-branch.test.ts now asserts scenarioSummary.options is populated
(3 ranked options, exactly one recommended, non-empty label + nextStep).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oktofeesh1
oktofeesh1 force-pushed the fix/issue-348-wire-open-pr-pressure branch from 7e575b7 to 77aceb4 Compare June 19, 2026 06:41
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.61%. Comparing base (e9234e8) to head (bbde981).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #923   +/-   ##
=======================================
  Coverage   96.60%   96.61%           
=======================================
  Files         109      109           
  Lines       14895    14898    +3     
  Branches     5384     5385    +1     
=======================================
+ Hits        14390    14393    +3     
  Misses        104      104           
  Partials      401      401           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 19, 2026
@ghost

ghost commented Jun 19, 2026

Copy link
Copy Markdown

🔍 Maintainer review

Reviewed 2 file(s) — ✅ all CI green.

Suggested action:Safe to merge — both reviewers found no blocking issues.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The change correctly wires open‑PR pressure simulation into the public scenario summary and adds a comprehensive test. Types and imports appear consistent, no new external fetches or secret handling are introduced, and the public output still passes the sanitizer. The added logic is confined to scenario generation and does not weaken auth or DB handling. Tests cover the new behavior, and existing test suite should remain green.

Suggestions

  • Verify that renderPublicScenarioSummary signature includes the new pressureSimulation field and that all callers are updated.
  • Run the TypeScript compiler to ensure buildCollisionReport, buildQueueHealth, and simulateOpenPrPressure are exported correctly.
  • Add a brief comment describing the shape of pressureSimulation for future maintainers.
  • Consider sanitizing any dynamic text inside the generated option labels with isPublicSafeText to guarantee the public/private boundary.

Worth double-checking

  • If renderPublicScenarioSummary is not updated elsewhere, a compile‑time error may occur.
  • UI components that previously assumed options could be empty might need to handle the new non‑empty list.
  • Unexpected forbidden terms could appear in option labels if underlying simulation logic is not properly sanitized.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The change correctly wires the open-PR pressure simulation into the branch scenario summary, fixing the issue where options were always empty. The added test validates the expected behavior (3 options with ranks, one recommended). No public/private boundary violations are evident; the simulation outputs are consumed by the existing public scenario summary renderer which includes sanitization. The change is localized, follows existing patterns, and includes appropriate test coverage.

No blocking issues spotted.

@dosubot dosubot Bot added the lgtm label Jun 20, 2026
@JSONbored
JSONbored merged commit e9cfe0e into JSONbored:main Jun 20, 2026
16 of 17 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 20, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants