Skip to content

Commit 6cb1ec3

Browse files
committed
fix(pre-triage): address review feedback on PR #156
- Hoist execFileSync import to top of mcp.ts (was re-imported on every loop iteration inside suggestion_box_pre_triage) - Filter suggestion-box-created issues from GitHub dedup candidates in pre-triage using isSuggestionBoxIssueTitle, matching the behaviour in github.ts so own published issues are never flagged as pre-existing - Allow pending_review items to be dismissed or published; dismiss() in store.ts and the CLI now accept status IN ('open', 'pending_review'), and suggestion_box_publish_to_github accepts both statuses so items marked by pre-triage are not stranded in a dead-end state
1 parent 461ab2d commit 6cb1ec3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ IMPORTANT RULES:
212212
await withDb(async (db) => {
213213
const now = Math.floor(Date.now() / 1000);
214214
const result = await db.prepare(
215-
"UPDATE feedback SET status = 'dismissed', updated_at = ? WHERE id = ? AND status = 'open'"
215+
"UPDATE feedback SET status = 'dismissed', updated_at = ? WHERE id = ? AND status IN ('open', 'pending_review')"
216216
).run(now, feedbackId);
217217
if (result.changes > 0) {
218218
console.log(`Feedback ${feedbackId} dismissed.`);

src/mcp.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
preTriageSchema,
1414
} from "./schemas.js";
1515
import { getCategories, getWebhooks } from "./categories.js";
16-
import { checkGhAuth, createGithubIssue, extractKeywords, keywordSimilarity } from "./github.js";
16+
import { execFileSync } from "child_process";
17+
import { checkGhAuth, createGithubIssue, extractKeywords, keywordSimilarity, isSuggestionBoxIssueTitle } from "./github.js";
1718
import { assertValidConfig } from "./config.js";
1819
import { RateLimiter, RateLimitError } from "./rate-limiter.js";
1920

@@ -226,8 +227,8 @@ If similar feedback already exists, your submission becomes a vote on it instead
226227
}
227228

228229
const item = await store.getFeedbackById(feedback_id);
229-
if (!item || item.status !== "open") {
230-
return { content: [{ type: "text" as const, text: `Feedback ${feedback_id} not found or not open.` }], isError: true };
230+
if (!item || (item.status !== "open" && item.status !== "pending_review")) {
231+
return { content: [{ type: "text" as const, text: `Feedback ${feedback_id} not found or not in a publishable state (must be open or pending_review).` }], isError: true };
231232
}
232233

233234
const repo = github_repo ?? item.githubRepo;
@@ -459,7 +460,6 @@ Returns a structured report of groups with representative items, vote totals, im
459460
const keywords = extractKeywords(group.representative);
460461
if (!keywords) continue;
461462
try {
462-
const { execFileSync } = await import("child_process");
463463
const raw = execFileSync(
464464
"gh",
465465
["issue", "list", "--repo", github_repo, "--search", `${keywords} in:title`, "--state", "open", "--json", "number,title,url", "--limit", "5"],
@@ -468,7 +468,7 @@ Returns a structured report of groups with representative items, vote totals, im
468468
const issues: Array<{ number: number; title: string; url: string }> = JSON.parse(raw.trim() || "[]");
469469
const SIMILARITY_THRESHOLD = 0.3;
470470
for (const issue of issues) {
471-
if (keywordSimilarity(keywords, issue.title) >= SIMILARITY_THRESHOLD) {
471+
if (!isSuggestionBoxIssueTitle(issue.title) && keywordSimilarity(keywords, issue.title) >= SIMILARITY_THRESHOLD) {
472472
group.existingGithubIssueUrl = issue.url;
473473
group.existingGithubIssueNumber = issue.number;
474474
break;

src/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export class FeedbackStore {
400400
const now = Math.floor(Date.now() / 1000);
401401
return this.withDb(async (db) => {
402402
const result = await db.prepare(
403-
"UPDATE feedback SET status = 'dismissed', updated_at = ? WHERE id = ? AND status = 'open'"
403+
"UPDATE feedback SET status = 'dismissed', updated_at = ? WHERE id = ? AND status IN ('open', 'pending_review')"
404404
).run(now, feedbackId);
405405
return result.changes > 0;
406406
});

0 commit comments

Comments
 (0)