JS-1766 Filter peach issue history to SonarJS languages#7068
JS-1766 Filter peach issue history to SonarJS languages#7068francois-mora-sonarsource wants to merge 15 commits into
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 86 issue(s) found across 5 file(s):
Showing 50 of 86 issues. Analyzed by SonarQube Agentic Analysis in 3.7 s |
Ruling ReportCode no longer flagged (1 issue)S4782vitest/packages/runner/src/types/tasks.ts:1365 1363 | /** Original file system path to the screenshot, before attachment resolution */
1364 | originalPath: string
> 1365 | body?: undefined
1366 | }
1367 | |
SummaryThis PR replaces the peach-check analysis-consistency helper to detect issue count drops scoped to SonarJS-owned languages only. What changed:
Why: Impact: What reviewers should knowStart here: Begin with the main entry point Key decisions to understand:
Test coverage clues: Tests verify language filtering is always present in issue queries, reconstruction accuracy across open/resolved/timing boundaries, and concurrency handling for large result sets. Run tests with
|
|
Addressed the two open review notes in 4b33afe: exported SUPPORTED_LANGUAGES from the helper so the test imports the implementation constant directly, and renamed the report metric label from violations to sonarjs_issue_count to match the reconstructed issue-count semantics. Re-ran node --test .claude/skills/peach-check/peach-issue-history.test.js after the change. |
| } | ||
|
|
||
| const onlyTestLikePaths = Object.keys(candidate.nonTestLikeCountsByBaselineState).length === 0; | ||
| const newRuleIds = Object.keys(candidate.topRulesByBaselineState.new ?? {}); |
There was a problem hiding this comment.
💡 Bug: Object.keys on array yields indices, not rule IDs
In diagnoseDrop, line 156 calls Object.keys(candidate.topRulesByBaselineState.new ?? {}). However, topRulesByBaselineState.new is an array of { rule_id, count } objects (produced by sortCountEntries), not a plain object. Object.keys() on an array returns string indices (['0', '1', ...]), not rule_id values.
The variable newRuleIds is only used for its .length check, so the behavior is accidentally correct (non-empty array → non-zero length). However, the variable name and usage pattern are misleading and would break if anyone later used the values.
Use the array directly instead of Object.keys; rename to reflect the actual type.:
const newRules = candidate.topRulesByBaselineState.new ?? [];
const onlyTestRuleAdditions =
newRules.length === 0 ||
newRules.every(entry => TEST_ONLY_RULES.has(entry.rule_id));
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 2 resolved / 3 findingsRefactors Peach issue history to fetch scoped, language-specific counts while improving resilience with granular retries. Please correct the Object.keys usage in diagnoseDrop, as it currently iterates over array indices rather than rule IDs. 💡 Bug: Object.keys on array yields indices, not rule IDs📄 .claude/skills/peach-check/peach-drop-forensics.js:156 In The variable Use the array directly instead of Object.keys; rename to reflect the actual type.✅ 2 resolved✅ Performance: Resolved issues fetched without createdAfter, scanning all history
✅ Performance: O(n*m) resolved-issue scan per analysis date
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Code Review 👍 Approved with suggestions 2 resolved / 3 findingsRefactors Peach issue history to fetch scoped, language-specific counts while improving resilience with granular retries. Please correct the Object.keys usage in diagnoseDrop, as it currently iterates over array indices rather than rule IDs. 💡 Bug: Object.keys on array yields indices, not rule IDs📄 .claude/skills/peach-check/peach-drop-forensics.js:156 In The variable Use the array directly instead of Object.keys; rename to reflect the actual type.✅ 2 resolved✅ Performance: Resolved issues fetched without createdAfter, scanning all history
✅ Performance: O(n*m) resolved-issue scan per analysis date
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|





What changed
peach-issue-historyfrom whole-projectviolationshistory to issue counts reconstructed from Peach project analyses plusapi/issues/searchjs,ts,css,web, andyamlWhy
The previous consistency check looked at whole-project
violationshistory, which can include non-SonarJS analyzers and produce false drop signals. This follow-up keeps the check scoped to SonarJS-owned languages.Impact
Peach main-analysis triage should stop treating analyzer-external issue shifts as suspicious SonarJS drops.
Validation
node --test .claude/skills/peach-check/peach-issue-history.test.jsSummary by Gitar
Common green-path command sequencetoINSTRUCTIONS.mdcovering the full triage workflow.peach-issue-history.jsand added warnings about stale output files.peach-run-jobs.jsas an official canonical helper inSKILL.md.rm -ftool permission toSKILL.mdfor clean workspace management during check execution.This will update automatically on new commits.