Skip to content

[jsweep] Clean issue_title_dedup.cjs - #47915

Merged
pelikhan merged 1 commit into
mainfrom
signed/jsweep/issue-title-dedup-66740373b9435e0f
Jul 25, 2026
Merged

[jsweep] Clean issue_title_dedup.cjs#47915
pelikhan merged 1 commit into
mainfrom
signed/jsweep/issue-title-dedup-66740373b9435e0f

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Cleans up actions/setup/js/issue_title_dedup.cjs and adds comprehensive test coverage.

Context Type

Node.js (pure utility module)

Changes

issue_title_dedup.cjs

  • Replace parameter reassignment with local variable: The parseDeduplicateByTitle function previously reassigned the value parameter (value = Number.parseInt(value, 10)). This is replaced with a const numeric local variable for cleaner, more idiomatic JavaScript.
  • Fix imprecise @type {any} annotation: The bestMatch variable in findDuplicateByTitle now uses the precise type { title: string, distance: number } | null instead of any, improving type safety.

issue_title_dedup.test.cjs (new file)

Added 26 test cases across three describe blocks:

  • parseDeduplicateByTitle: 12 tests covering undefined/null/false/true, boolean-like strings ("true", "false"), integer values (0, 5, 10, 100), out-of-range values (101, -1), float, and invalid strings.
  • normalizeTitleForDedup: 5 tests covering lowercasing, space collapsing, trimming, empty string, and mixed cases.
  • findDuplicateByTitle: 7 tests covering empty candidates, exact match at distance 0, no match within threshold, closest-match selection, normalizedTitle usage, best-match ordering, and match exceeding maxDistance.

Validation

✅ Formatting: npm run format:cjs
✅ Linting: npm run lint:cjs
✅ Type checking: npm run typecheck
✅ Tests: npm run test:js — 26 new tests all pass ✓

Note: Pre-existing test failures in send_otlp_span.test.cjs and setup_threat_detection.test.cjs are unrelated to this change.

Generated by 🧹 jsweep - JavaScript Unbloater · ⌖ 10.4 AIC ·

  • expires on Jul 26, 2026, 8:57 PM UTC-08:00

- Replace parameter reassignment (value = Number.parseInt(...)) with
  a local const variable for cleaner, more idiomatic code
- Fix imprecise `@type {any}` annotation on bestMatch to use the
  correct type `{{ title: string, distance: number } | null}`
- Add comprehensive test file (issue_title_dedup.test.cjs) with 26
  test cases covering parseDeduplicateByTitle, normalizeTitleForDedup,
  and findDuplicateByTitle (previously had no tests)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review July 25, 2026 05:05
Copilot AI review requested due to automatic review settings July 25, 2026 05:05
@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #47915 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refines issue-title deduplication internals and adds focused unit coverage.

Changes:

  • Avoids parameter reassignment during configuration parsing.
  • Replaces an imprecise JSDoc type.
  • Adds 26 tests covering parsing, normalization, and matching.
Show a summary per file
File Description
actions/setup/js/issue_title_dedup.cjs Improves implementation clarity and type precision.
actions/setup/js/issue_title_dedup.test.cjs Adds comprehensive unit coverage for deduplication utilities.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

PR Code Quality Reviewer completed the code quality review.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /tdd and /codebase-design — this is a clean, well-executed improvement with no actionable issues.

📋 Highlights
  • Parameter reassignment eliminated: const numeric replaces mutating value = ..., making data flow explicit and idiomatic.
  • Type annotation sharpened: @type {any}{ title: string, distance: number } | null documents the invariant precisely.
  • 26 tests added: Cover happy path, boundary values (0, 100, 101, -1), boolean-like strings, floats, and degenerate inputs — solid specification-by-test.
  • Test names read as plain-English specs: Structure is clear and consistent across all three describe blocks.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 18.3 AIC · ⌖ 7.37 AIC · ⊞ 6.7K
Comment /matt to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clean, straightforward refactor. The parseDeduplicateByTitle change correctly avoids parameter reassignment with a const numeric local, and the JSDoc fix on bestMatch improves type precision. The new test file follows the established pattern (import + createRequire) and covers the changed logic well. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 14.4 AIC · ⌖ 4.48 AIC · ⊞ 5K

@github-actions

Copy link
Copy Markdown
Contributor Author

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 74/100 — Acceptable

Analyzed 26 test(s): 26 design, 0 implementation, 0 violation(s).

📊 Metrics (26 tests)
Metric Value
Analyzed 26 (Go: 0, JS: 26)
✅ Design 26 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 12 (46%)
Duplicate clusters 0
Inflation YES (131 test lines added vs 4 prod lines added; >2:1)
🚨 Violations 0
Test File Classification Issues
parseDeduplicateByTitle (14 cases) issue_title_dedup.test.cjs design_test None
normalizeTitleForDedup (5 cases) issue_title_dedup.test.cjs design_test None
findDuplicateByTitle (7 cases) issue_title_dedup.test.cjs design_test None
⚠️ Flagged Tests (1 note)

Test inflation (issue_title_dedup.test.cjs) — 131 new test lines vs 4 new production lines (32:1 ratio). This exceeds the 2:1 threshold. However, this is an expected pattern when adding a new test suite for a pre-existing module — the production file was lightly modified (4 lines) but tests cover the full existing API surface.

Verdict

passed. 0% implementation tests (threshold: 30%). Inflation flag is cosmetic — new test suite covers a pre-existing production module. No violations.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 29.1 AIC · ⌖ 10.5 AIC · ⊞ 8.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 74/100. 0% implementation tests (threshold: 30%). No violations.

@github-actions github-actions Bot mentioned this pull request Jul 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clean refactor, solid test coverage

The const numeric replacement for parameter reassignment in parseDeduplicateByTitle is correct and functionally equivalent. The @type annotation fix is accurate. The new test file follows established repo patterns (import.meta.url in .cjs with vitest) and provides thorough coverage including null/undefined, boundary values, floats, fuzzy-match edge cases, and the normalizedTitle pre-computed path. No actionable issues.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 · 19 AIC · ⌖ 4.5 AIC · ⊞ 5.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Excellent work on cleaning up issue_title_dedup.cjs! This PR improves code quality through better variable naming and type precision, and adds solid test coverage.

What looks great:

  • Eliminates the misleading parameter reassignment pattern in parseDeduplicateByTitle with a clear local variable (numeric)
  • Replaces the imprecise @type {any} annotation with a precise type definition, improving type safety
  • Comprehensive test suite with 26 tests covering edge cases: boundary values (0, 100, 101), boolean-like strings, type coercion, and all three public functions
  • All validation checks pass: formatting, linting, type checking, and tests
  • Clear, well-organized PR description with detailed context

This change is focused, well-tested, and ready for review. 🚀

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • patchdiff.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "patchdiff.githubusercontent.com"

See Network Configuration for more information.

Generated by ✅ Contribution Check · sonnet46 · 59.5 AIC · ⌖ 7.62 AIC · ⊞ 6.2K ·

@pelikhan
pelikhan merged commit 862e1f8 into main Jul 25, 2026
52 of 60 checks passed
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.83.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants