Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/scripts/issue-quality.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,8 @@ const REPRO_PATH_RE = new RegExp([
"~?/[\\w.@-]+(?:/[\\w.@-]+)+",
"[A-Za-z]:\\\\(?:[\\w.@-]+\\\\)+[\\w.@-]+",
"~?/[\\w.@-]+/[\\w.@-]+\\.(?:json|yaml|yml|toml|conf|log|env|txt|ts|js|tsx|jsx|sh|ps1|py)",
"[\\w.@-]+\\.(?:json|yaml|yml|toml|conf|log|env)\\b",
"(?:^|[^\\w.@-])[\\w.@-]+\\.(?:json|yaml|yml|toml|conf|log|env)\\b",
].join("|"));
const ACTIONABLE_REPRO_RE = new RegExp(
[REPRO_COMMAND_RE.source, REPRO_FAILURE_RE.source, REPRO_PATH_RE.source].join("|"),
"i",
);

// Sigil-only fences with no body content are never actionable.
const EMPTY_FENCE_RE = /^[ \t]{0,3}(?:```+|~~~+)\s*\n\s*\n[ \t]{0,3}(?:```+|~~~+)\s*$/;

Expand All @@ -1104,9 +1099,17 @@ const EMPTY_FENCE_RE = /^[ \t]{0,3}(?:```+|~~~+)\s*\n\s*\n[ \t]{0,3}(?:```+|~~~+
* count as actionable when their body contains non-whitespace content.
*/
function hasActionableReproductionDetail(text) {
if (typeof text !== "string") return false;
// Reject text with no actionable syntax before clean() performs Markdown
// media handling, which is unnecessary for a plain non-matching token.
if (!/[./\\`~]/.test(text) && !REPRO_COMMAND_RE.test(text) && !REPRO_FAILURE_RE.test(text)) {
return false;
}
const c = clean(text);
if (!c) return false;
if (ACTIONABLE_REPRO_RE.test(c)) return true;
if (REPRO_COMMAND_RE.test(c) || REPRO_FAILURE_RE.test(c)) return true;
// Avoid running path patterns over long tokens that cannot contain a path.
if (/[./\\]/.test(c) && REPRO_PATH_RE.test(c)) return true;
// Fenced blocks: only count when the body has non-whitespace content.
if (/```|~~~/.test(c)) {
const parts = stripFencedActionableContent(c);
Expand Down
6 changes: 6 additions & 0 deletions .github/scripts/issue-quality.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ describe("validateIssue - feature", () => {
assert.equal(hasActionableReproductionDetail("```\nSIGSEGV at 0x0000\n```"), true);
});

it("checks long non-matching reproduction tokens in linear time", () => {
const startedAt = performance.now();
assert.equal(hasActionableReproductionDetail("a".repeat(60_000)), false);
assert.ok(performance.now() - startedAt < 500, "actionable reproduction check took too long");
});

Comment on lines +657 to +662

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Exercise REPRO_PATH_RE in the performance test.

The current input contains no path marker. .github/scripts/issue-quality.cjs returns at Line 1106 before REPRO_PATH_RE runs at Line 1112. This test cannot detect a regression in the bounded filename alternative at Line 1090.

Use a long token with an unsupported extension, such as "a".repeat(60_000) + ".unknown", and keep the false assertion and timing check.

Proposed test adjustment
-    assert.equal(hasActionableReproductionDetail("a".repeat(60_000)), false);
+    assert.equal(
+      hasActionableReproductionDetail("a".repeat(60_000) + ".unknown"),
+      false,
+    );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it("checks long non-matching reproduction tokens in linear time", () => {
const startedAt = performance.now();
assert.equal(hasActionableReproductionDetail("a".repeat(60_000)), false);
assert.ok(performance.now() - startedAt < 500, "actionable reproduction check took too long");
});
it("checks long non-matching reproduction tokens in linear time", () => {
const startedAt = performance.now();
assert.equal(
hasActionableReproductionDetail("a".repeat(60_000) + ".unknown"),
false,
);
assert.ok(performance.now() - startedAt < 500, "actionable reproduction check took too long");
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/issue-quality.test.cjs around lines 657 - 662, Update the
long-token input in “checks long non-matching reproduction tokens in linear
time” to append an unsupported extension such as “.unknown”, ensuring
REPRO_PATH_RE is exercised. Keep the false assertion and existing timing
threshold unchanged.

it("rejects fenced placeholder-only examples", () => {
const fencedPlaceholders = [
"```\nN/A\n```",
Expand Down
Loading