Add comprehensive documentation for validation and parsing organization#7065
Merged
Add comprehensive documentation for validation and parsing organization#7065
Conversation
- Add package-level documentation explaining organization rationale - Document why validation functions are co-located with domain logic - Explain parse function grouping in tools_parser.go and config_helpers.go - Add helper file purpose and conventions documentation - Document validation function placement following established patterns Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor code organization for semantic function clustering
Add comprehensive documentation for validation and parsing organization
Dec 20, 2025
pelikhan
approved these changes
Dec 20, 2025
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.
The semantic function clustering analysis identified validation functions, parse functions, and helper files as potential refactoring candidates. Analysis revealed these are already well-organized per documented architectural patterns—validation co-located with domain logic, parse functions grouped by purpose, helpers with 3+ callers.
Changes
Documentation Added
Added package-level documentation to 10 files explaining organization rationale:
Validation functions (7 functions across 5 files):
sandbox.go- Sandbox-specific validation co-located with configuration logicrepo_memory.go- Memory ID validation with memory implementationcompile_campaign.go- Campaign validation with campaign compilationrun_command.go- Input/remote workflow validation with run commandactions_build_command.go- Action metadata validation with build logicParse functions (30+ functions across 2 files):
tools_parser.go- All tool configuration parsing (github, bash, playwright, MCP, etc.)config_helpers.go- Safe output configuration parsing utilitiesHelper files (11 files):
engine_helpers.go- Shared agent/npm installation across enginesmap_helpers.go- Generic map/type conversion utilitiescompile_helpers.go- Batch compilation and statisticsEach doc explains: purpose, why functions are grouped here, usage patterns, and caller count justification.
Organization Principles
The codebase follows these patterns from
pkg/workflow/validation.goandskills/developer/SKILL.md:No code movement needed—current organization is sound.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/user/usr/bin/gh gh api user --jq .login ithub/workflows stmain.go ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet env -json GO111MODULE 6520148/b372/vet.cfg GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x/var/run/docker/runtime-runc/moby(http block)/usr/bin/gh gh api user --jq .login g_.a om/org1/repo1 /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env orkflows(http block)/usr/bin/gh gh api user --jq .login ithub/workflows GO111MODULE 1f8519d77c713c6721a3659afe3dabfe56a/log.json l GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/xremote.origin.url -ato�� -bool l(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>[refactor] Semantic Function Clustering Analysis - Code Organization Improvements</issue_title>
<issue_description>## Executive Summary
This analysis examined 331 non-test Go source files across the repository to identify refactoring opportunities through semantic function clustering. The codebase demonstrates generally good organization with well-structured packages, but several opportunities for improvement were identified:
The analysis focused on the largest packages:
pkg/workflow(175 files) andpkg/cli(114 files), where the most significant refactoring opportunities exist.Full Analysis Report
Repository Structure Overview
Package Distribution
File Organization Assessment
The repository follows Go best practices with files organized by feature:
✅ Well-Organized Clusters:
create_*.gofiles for entity creation (issues, PRs, discussions, etc.)update_*.gofiles for entity updatescompiler_*.gofiles for workflow compilation stages*_engine.gofiles for different AI enginessafe_output*.gofiles for output validationmcp*.gofiles for MCP server integrationlogs_*.gofiles in CLI for log analysisupdate_*.gofiles in CLI for update operationsIdentified Refactoring Opportunities
1. Validation Functions in Non-Validation Files
Issue: Validation functions scattered outside dedicated validation files
Outliers Found:
File:
pkg/workflow/repo_memory.govalidateNoDuplicateMemoryIDspkg/workflow/validation.goor createpkg/workflow/repo_memory_validation.goFile:
pkg/workflow/sandbox.govalidateMountsSyntax,validateSandboxConfigpkg/workflow/sandbox_validation.goto match pattern ofdocker_validation.go,npm_validation.go, etc.Pattern Analysis: The codebase has 22 dedicated validation files following the
*_validation.gonaming pattern. These outliers break this established convention.2. Parse Functions Scattered Across Files
Issue: 30+ parse functions distributed across 10+ non-parser files instead of being consolidated
Major Concentrations:
File:
pkg/workflow/config_helpers.go(268 lines)Parse functions:
parseLabelsFromConfigparseTitlePrefixFromConfigparseTargetRepoFromConfigparseTargetRepoWithValidationparseParticipantsFromConfigparseAllowedReposFromConfigparseAllowedLabelsFromConfigparseExpiresFromConfigparseRelativeTimeSpecAnalysis: These are config parsing utilities, but the file is named "helpers" rather than "config_parser" which would be more accurate.
File:
pkg/workflow/dependabot.go(685 lines)Parse functions:
parseNpmPackageparsePipPackageparseGoPackageIssue: Package dependency parsing logic embedded in dependabot feature file
Recommendation: Extract to
pkg/workflow/package_parsing.gofor reusabilityFile:
pkg/workflow/time_delta.go(370 lines)Parse functions:
parseTimeDeltaparseTimeDeltaForStopAfterparseTimeDeltaWithMinutesparseAbsoluteDateTimeparseRelativeDateAnalysis: This file is well-organized - all time parsing in one place ✅
Other Files with Parse Functions:
pkg/workflow/map_helpers.go:parseIntValuepkg/workflow/reactions.go:parseReactionValuepkg/workflow/safe_inputs.go:parseSafeInputsMappkg/workflow/safe_output_builder.go:parseRequiredLabelsFromConfig,parseRequiredTitlePrefixFromConfigpkg/workflow/safe_outputs_app.go:parseAppConfig💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.