feat(miner-manage): local pr_outcome record writer - #4389
Conversation
Add packages/gittensory-miner/lib/pr-outcome.js: a MINER_PR_OUTCOME_EVENT constant + payload normalizer, a recordPrOutcomeSnapshot thin writer over the local event ledger (dependency-injected, mirroring recordManagePollSnapshot), and a readPrOutcomes read-side reducer (mirroring indexLatestManageUpdates) that reconstructs the current outcome per repo/PR from the append-only stream. A closed PR may carry an optional REJECTION_REASONS reason bucket. This is the miner's own local record of its PRs' outcomes — distinct from the server-side recordPrOutcome (src/review/outcomes-wire.ts). Closes JSONbored#4274
|
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 #4389 +/- ##
=======================================
Coverage 93.96% 93.96%
=======================================
Files 401 401
Lines 36869 36869
Branches 13480 13480
=======================================
Hits 34644 34644
Misses 1569 1569
Partials 656 656 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-09 17:21:24 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
Linked issue satisfactionAddressed 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.
|
|
Gittensory is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What
packages/gittensory-miner/lib/event-ledger.jsis a generic append-only local ledger;manage-status.jsshows the established pattern for a typed event layered on top of it (MANAGE_PR_UPDATE_EVENT+ a normalizer + a thin writer). There was no equivalent for PR outcomes. This adds one — the miner's own local record of the outcomes of its own PRs.New
packages/gittensory-miner/lib/pr-outcome.js:MINER_PR_OUTCOME_EVENT("pr_outcome") +normalizePrOutcomePayload— a plain, JSON-round-trippable{ prNumber, decision, reason, closedAt }.recordPrOutcomeSnapshot(input, options)— a thin writer over the ledger with the same dependency-injection shape asrecordManagePollSnapshot, so it's unit-testable without a real ledger file. Aclosed-not-merged PR may carry an optional reason fromREJECTION_REASONS(rejection-templates.js), so this writer and the rejection-note renderer share one reason vocabulary.readPrOutcomes(eventLedger, filter)— the read-side reducer (mirroringindexLatestManageUpdates) that reconstructs the current outcome per repo/PR from the append-only event stream.This is deliberately the miner's local bookkeeping — distinct from the server-side
recordPrOutcome(src/review/outcomes-wire.ts), which writes hosted-D1 ground truth from the App's webhook stream. Same concept name, different codebase layer, no shared code; a distinct constant name (MINER_PR_OUTCOME_EVENT) and a README note make that explicit.Deliverables
pr-outcome.jswithMINER_PR_OUTCOME_EVENT+ payload normalizer, mirroringmanage-status.js.recordPrOutcomeSnapshot(input, options)thin writer (DI shape ofrecordManagePollSnapshot), reusingREJECTION_REASONSfor the closed-PR reason bucket.readPrOutcomes(eventLedger, filter)read-side reducer mirroringindexLatestManageUpdates.test/unit/miner-pr-outcome.test.ts— writer (merged + closed), normalizer validation, and the read-side reduction over a multi-event history.recordPrOutcome.Closes #4274