Conversation
- Add uint64 overflow checking to parseIntValue for consistency - Refactor ParseIntFromConfig to use parseIntValue internally - Eliminates 24 lines of duplicated type-switching code - All existing tests pass without modification Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor code organization and reduce duplicate functions
Consolidate integer parsing logic to eliminate duplication
Jan 17, 2026
pelikhan
approved these changes
Jan 17, 2026
pelikhan
marked this pull request as ready for review
January 17, 2026 17:34
pelikhan
deleted the
copilot/refactor-semantic-function-clustering-one-more-time
branch
January 17, 2026 17:34
37 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses Priority 1 refactoring from automated semantic function clustering analysis: two nearly identical integer parsing functions with 30+ lines of duplicated type-switching logic.
Changes
parseIntValuewith uint64 overflow checking (previously missing)ParseIntFromConfigto delegate type conversion toparseIntValueBefore/After
Before:
After:
All existing tests pass without modification.
Original prompt
This section details on the original issue you should resolve
<issue_title>[refactor] Semantic Function Clustering: Code Organization and Duplicate Detection Analysis</issue_title>
<issue_description># 🔧 Semantic Function Clustering Analysis
Automated analysis of repository: githubnext/gh-aw
Overview
This automated analysis examined 430 non-test Go source files across the repository to identify refactoring opportunities through semantic function clustering, outlier detection, and duplicate code identification. The analysis focuses on improving code organization, reducing duplication, and enhancing maintainability.
Key Findings
pkg/workflow(227 files), 28% inpkg/cli(136 files)Full Report
1. Package Organization Analysis
File Distribution by Package
Major File Clusters Identified
pkg/workflow Clusters
compiler_*safe_outputs**validation**_engine*expression_*runtime_*frontmatter_*pkg/cli Clusters
compile_*logs_*mcp_*update_*run_*2. Duplicate and Near-Duplicate Functions
2.1 Integer Parsing Duplication
Severity: 🔴 High
Files Affected: 2
Lines Duplicated: ~30
Two nearly identical functions for parsing integers from
interface{}types:Location 1:
pkg/workflow/map_helpers.go:35Location 2:
pkg/workflow/config_helpers.go:272Recommendation: Merge into a single
parseIntValueWithOptionsfunction with optional overflow checking and truncation warnings.2.2 Sanitization Function Proliferation
Severity: 🟡 Medium
Files Affected: 8
Lines Duplicated: ~200+
Eight sanitization functions across three packages with overlapping concerns:
SanitizeNamepkg/workflow/strings.go:142SanitizeWorkflowNamepkg/workflow/strings.go:245SanitizeIdentifierpkg/workflow/workflow_name.go:35SanitizeErrorMessagepkg/stringutil/sanitize.go:52SanitizeParameterNamepkg/stringutil/sanitize.go:96SanitizePythonVariableNamepkg/stringutil/sanitize.go:130SanitizeToolIDpkg/stringutil/sanitize.go:162✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.