chore(optimizer): update processes based on investigation

This commit is contained in:
Christian Gunderman
2026-04-21 17:50:55 -07:00
parent aa30764f0a
commit b29db20cf4
11 changed files with 272 additions and 15 deletions
@@ -3,8 +3,8 @@ import readline from 'readline';
import { execSync } from 'child_process';
async function processPRs() {
const prsFile = 'prs-before.csv';
const afterFile = 'prs-after.csv';
const prsFile = 'open-community-prs-before.csv';
const afterFile = 'open-community-prs-after.csv';
if (!fs.existsSync(prsFile)) return 0;
// Counter-metric: 'active_contributors'
@@ -62,7 +62,7 @@ async function processPRs() {
if (commitMode) {
try {
execSync(`gh pr close ${number} --comment "Closing PR as it has been marked Stale with no recent activity."`);
} catch(e) {}
} catch { /* ignore */ }
}
} else {
const needsIssue = pr.labels.some(l => l.name === 'status/need-issue');
@@ -71,7 +71,7 @@ async function processPRs() {
if (commitMode) {
try {
execSync(`gh pr edit ${number} --add-label "Stale"`);
} catch(e) {}
} catch { /* ignore */ }
}
}
}
@@ -54,6 +54,7 @@ async function processIssues() {
if (issue && state.includes('OPEN')) {
const isPossibleDuplicate = issue.labels.some(l => l.name === 'status/possible-duplicate');
const isUnassigned = !issue.assignees || issue.assignees.length === 0;
// We implement a phased rollout. Instead of closing possible duplicates immediately,
// we apply a 'stale-candidate' label. We do not close them yet to preserve project health.
@@ -62,10 +63,16 @@ async function processIssues() {
// In commit mode, we would apply the label.
try {
execSync(`gh issue edit ${number} --add-label "stale-candidate"`);
} catch(e) {}
} catch { /* ignore */ }
}
// We do NOT change state to closed in the CSV simulation either. It remains open.
}
if (isUnassigned && commitMode) {
try {
execSync(`gh issue edit ${number} --add-label "needs-assignee"`);
} catch { /* ignore */ }
}
}
outStream.write(`${parts[0]},${state}\n`);