feat(miner-manage): add rejection state machine (closed/rejected → disengaged) - #4441
Conversation
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4441 +/- ##
=======================================
Coverage 94.01% 94.01%
=======================================
Files 418 418
Lines 37417 37417
Branches 13677 13677
=======================================
Hits 35178 35178
Misses 1583 1583
Partials 656 656 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-09 19:14:17 UTC
✅ Suggested Action - Approve/Merge
Review summary Flagged checks (non-blocking)
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
8737b83 to
29e621d
Compare
…isengaged) New packages/gittensory-miner/lib/rejection-state-machine.js: the missing detector + classifier that turns a closed-without-merge PR into a rejection-reason bucket and, for the first time, drives renderRejectionMessage (previously caller-less). Pure — no GitHub calls, no network, no writes. - extractPrOutcomeFields: pull state/merged/merged_at/closed_at from a PR payload the poller already fetches (no second API call, no change to ci-poller's fetchHeadSha). - isRejectedPr / classifyRejectionReason: closed-without-merge detection + map to gate_close / superseded_by_duplicate / maintainer_close_no_reason (documented zero-signal fallback; gate outranks duplicate). - resolveRejection: the full transition to the 'disengaged' per-PR outcome + the rendered courtesy note. Design decisions documented in-module: 'disengaged' is a per-PR outcome (manage-poll family), NOT a run-state; this module does not silently expand another module's enum. Closes JSONbored#4278
29e621d to
e89f5f7
Compare
Adds the missing rejection state machine (Closes #4278).
packages/gittensory-miner/lib/rejection-templates.js(#2324) has a fully-implemented renderer with zero callers outside its own test. This adds the detector + classifier that finally drives it:extractPrOutcomeFields(prPayload)— pullstate/merged/merged_at/closed_atfrom theGET /pulls/{n}payload the poller already fetches (ci-poller.js'sfetchHeadShaGETs the full body and discards all buthead.sha). Pure — no second API call, no behavioral change to the existing fetch.isRejectedPr/classifyRejectionReason— detect closed-without-merge (a merged PR is alsostate:closed, so it's excluded) and map it togate_close/superseded_by_duplicate/maintainer_close_no_reason. Documented zero-signal fallback tomaintainer_close_no_reason; an explicit gate close outranks a duplicate signal.resolveRejection— the full transition to theDISENGAGED_OUTCOMEper-PR outcome + the rendered courtesy note (this isrenderRejectionMessage's first real caller).Design decisions documented in-module (both called out by the issue):
disengagedis a per-PR outcome (themanage-poll.jsready/needs-work/openfamily), not a per-reporun-state— and this module deliberately does not mutatemanage-poll.js's orrun-state.js's enum as a side effect (a poller adoptsDISENGAGED_OUTCOMEexplicitly). Still no GitHub write — local classification + local note only, matching the templates module's boundary.Test
test/unit/miner-rejection-state-machine.test.ts— field extraction (full + malformed/missing), rejection detection (closed-unmerged vs merged vs open), each reason bucket + the zero-signal fallback + gate-over-duplicate precedence, the fullresolveRejectiontransition for every reason, and null for non-rejections. 8 tests pass;build:miner+test:miner-pack+ typecheck green.site//CNAME/**/lovable/**; noCHANGELOG.md. Three new files (module +.d.ts+ test), no shared-file edits.